Library SetcodeConcrete.consensusresourcesproofs

Proof of the admitted-window resource property

This uses the exact proposition in consensusresources, not a separate restatement. Fee coverage and full validation safety remain unproved.
From Stdlib Require Import List ZArith.
Require Import RocqOfOCaml.RocqOfOCaml MonadVM.Execution.
Require Import SetcodeConcrete.consensusresources SetcodeConcrete.consensusnonce
  SetcodeConcrete.windowsupply.
Set Default Goal Selector "!".
Local Open Scope Z_scope.
Module E := Execution.Make.
Section Consensus.
Context {F : E.FArgs}.
Context (cold warm access write reserve : N).

Theorem consensus_preserves_resource_bounds :
  consensusResourceSafety cold warm access write reserve.
Proof.
  intros snapshot senders verify height past rest Hprotocol Hwindow Hcheck.
  destruct Hprotocol as [Hrevision Hcold Hwarm Hhash Hsha Hg1 Hg2 Hchain].
  destruct Hwindow as [Hinputs Hbalance Hformat Hsupply Hsystem Hnonces Hnative Hsenders].
  pose proof (consensus_prefix_retains_nonce_capacity cold warm access write reserve
    verify snapshot height past rest senders Hrevision Hcold Hwarm Hnative Hsenders
    Hcheck Hsystem Hnonces) as Hnonce.
  pose proof (execution_prefix_retains_supply_capacity cold warm access write reserve
    Hrevision Hcold Hwarm Hhash Hsha Hg1 Hg2 Hchain verify snapshot past rest
    Hinputs Hbalance Hformat Hsupply) as HsupplyResult.
  destruct (Result.List.fold_leftM (E.process_block verify) snapshot past) as [post|error];
    [|exact Hnonce].
  destruct Hnonce as [HsystemAfter HnoncesAfter].
  destruct HsupplyResult as [HbalanceAfter [HformatAfter HsupplyAfter]].
  constructor; assumption.
Qed.
End Consensus.
Print Assumptions consensus_preserves_resource_bounds.