Alternative execution-side reserve check model.
This file keeps only the reservebal2-specific execution predicate (finalBalSufficient) plus the minimal extra definitions it depends on. Everything else is imported from reservebal.
Address-parameterized variant of reservebal.indexWithinK.
Definition indexWithinKForAddr
    (proj: ExtraAcState option N)
    (state : ExtraAcStates)
    (blkNum: N)
    (addr: EvmAddr) : bool :=
  let startIndex := blkNum - (K - 1) in
  match proj (state addr) with
  | Some indexasbool (startIndex index blkNum)
  | Nonefalse
  end.

Definition existsTxWithinKForAddr
    (state : AugmentedState) (blkNum: N) (addr: EvmAddr) : bool :=
  indexWithinKForAddr lastTxInBlockIndex (snd state) blkNum addr.

Definition existsDelUndelTxWithinKForAddr
    (state : AugmentedState) (blkNum: N) (addr: EvmAddr) : bool :=
  indexWithinKForAddr lastDelUndelInBlockIndex (snd state) blkNum addr.

Address-parameterized “allowed to empty” predicate.
reservebal2 variant: exemption uses isAllowedToEmptyG per-account.
Conditional equivalence: if a's balance did not decrease, both execution checks accept a.
we prove finalBalSufficient and finalBalSufficientPiotr equivalent under no-recent-history assumptions only for the accounts for which reservebal.finalBalSufficient has an extra exemption:
The post-state isSC case needs no extra assumptions because both predicates immediately return true there.

This page has been generated by coqdoc