跳到正文
参考文档 / ZLIB × LEAN

inftrees.c.fixed.lean

此页源文件快照 · 07dcede67701b6bd · 对应提交的原文 ↗

本页保留 Lean 源码及行号。点击行号可定位语句,点击 import 中的模块名可查看依赖。

1import ZlibF.Proof.«inflate.c.base»
2import ZlibF.Zlib.«inftrees.c»
3
4/-!
5# inftrees.c: `inflate_fixed`
6
7`inflate_fixed` does not build a table. It points the state at the two static tables (`lenfix`, `distfix`) and sets
8their root widths. The tables themselves are static data of the heap (installed by `initStatics`).
9-/
10
11namespace Zlib.Inftrees.Proofs
12open C Zlib.Inflate Zlib.Inflate.Spec Zlib.Inflate.Proofs
13
14/-- The state record after `inflate_fixed`. -/
15def fixedState (st : InflateState) : InflateState :=
16  { st with lencode := .ref .st_lenfix 0, lenbits := 9, distcode := .ref .st_distfix 0, distbits := 5 }
17
18/-- **inflate_fixed.** On a live inflate state `zs` the call does not fault and changes exactly four fields of that
19record: `lencode` is the static `lenfix`, `lenbits` is 9, `distcode` is the static `distfix`, `distbits` is 5. No other
20table entry of the heap changes, and nothing is allocated or freed. -/
21theorem inflate_fixed_ok {h : Heap} {zs : Nat} {st : InflateState} (hs : h.istates zs = some st) :
22    C.run (inflate_fixed (some (.tab zs))) h = .ok ((), setI h zs (fixedState st)) := by
23  rw [C.run]
24  simp [inflate_fixed, bind_app, ldI_eq, stI_eq, hs, fixedState, setI, upd_upd]
25
26end Zlib.Inftrees.Proofs
ZLIB × LEAN

全局目录

当前位置inftrees.c.fixed.lean