Skip to content
REFERENCE / ZLIB × LEAN

InflateFastCallOrigin.lean

Source snapshot · e3a9e254997ac6e5 · Source at the matching commit ↗

Lean source with line numbers. Follow a line number to locate a statement, or an import to read its dependency.

1import ZlibF.Spec.InflateFastBodyOrigin
2
3/-!
4# Exact remaining source input after a whole fast call
5
6Body origin must survive the actual loop and epilogue. This property
7identifies the final heap registers with the original input suffix. It
8does not assign a DEFLATE token meaning to the bits consumed.
9-/
10
11namespace Zlib.Inffast.Spec.CallOrigin
12open C Zlib.Inffast Zlib.Inffast.Proofs
13
14def HasOrigin (e : Env) (after : Heap) : Prop :=
15  ∃ (state : InflateState) (stream : ZStream) (input used : Nat),
16    after.istates e.stid = some state ∧ e.r.get after = some stream ∧
17    stream.next_in = .ref (.blk e.ib) input ∧
18    input + stream.avail_in.toNat = e.i0 + e.sm0.avail_in.toNat ∧
19    Origin.Inv e state.hold.toNat state.bits.toNat input used
20
21/-- The actual whole call preserves the source suffix through every
22body and rollback, retaining its full existing safety/frame result.
23The actual body-origin theorem must be proved, not taken as a premise. -/
24def Goal.actual_fast_preserves_origin : Prop :=
25  ∀ e : Env, ∃ after,
26    C.run (inflate_fast e.strm e.start) e.h0 = .ok ((), after) ∧
27    FastPost e after ∧ HasOrigin e after
28
29end Zlib.Inffast.Spec.CallOrigin
ZLIB × LEAN

Global contents

READING NOWInflateFastCallOrigin.lean