What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)
Read-back: BitcoinToLocal.csv_concrete
Statement. Let
- f be a script flag record, a triple of booleans (f.cltv,f.csv,f.nulldummy);
- sf be a signature-layer flag record, a quadruple of booleans (dersig,lowS,strictenc,witnessPubkeyType);
- tx be a transaction (a record with version∈N, a list vin of inputs each carrying an nSequence∈N, a list vout, and nLockTime∈N);
- nin∈N, amount∈Z;
- v be a signature version, one of the two values base or witnessV0;
- sc be a byte string (a script code);
- δ∈Z (named
delay).
Assume the three hypotheses
f.csv=true,0≤δ,δ<216.
Then
CsvPasses(f, legacyOracle(sf,tx,nin,amount,v,sc), δ)⟺checkSequence(tx,nin,δ)=true.
Unfolding the left-hand side. legacyOracle(sf,tx,nin,amount,v,sc) is the concrete oracle record whose five hash components are the preamble's SHA-256, SHA-1, RIPEMD-160, HASH160 and HASH256 implementations, whose signature-check component is the pre-tapscript checker built from sf,tx,nin,amount,v,sc, whose lock-time component is the transaction lock-time check for (tx,nin), and whose sequence component is exactly s↦checkSequence(tx,nin,s). The proposition CsvPasses(f,o,δ) is
f.csv=false ∨ (0≤δ∧((toNat(δ)&231)=0∨o.checkSequence(δ)=true)),
and it consults only the sequence component of o. Under the hypothesis f.csv=true the first disjunct is false, so the left-hand side says:
0≤δ ∧ ((δ&231)=0 ∨ checkSequence(tx,nin,δ)=true),
where toNat(δ)=δ because δ≥0. The parameters sf, amount, v and sc enter the statement only through oracle components that CsvPasses never reads.
Unfolding the right-hand side. checkSequence(tx,nin,s) for an integer s: let σ be the nSequence of the nin-th input of tx (zero-indexed), or 0 if nin≥∣tx.vin∣. If tx.version<2, return false. Else if σ&231=0, return false. Else let M:=222∣0xffff=0x40ffff, τ:=σ&M, ς:=toNat(s)&M. If neither (τ<222 and ς<222) nor (222≤τ and 222≤ς) holds, return false. Else if τ<ς, return false. Else return true.
Remarks on the hypotheses. The constant 231 in CsvPasses is the script-layer constant 2147483648, numerically equal to the signature-layer 231 used inside checkSequence. The hypothesis δ<216 places δ strictly below 65536; in particular bit 31 of δ is clear, so the disjunct (δ&231)=0 is false for every δ admitted by the hypotheses. No hypothesis constrains tx, nin (which may be out of range), amount, v, sc or sf.
Confirmed by the moderator at approval.