参考文档 / ZLIB × LEAN
Compress.lean
此页源文件快照 ·
8b4a13bde22fd1ea · 对应提交的原文 ↗本页保留 Lean 源码及行号。点击行号可定位语句,点击 import 中的模块名可查看依赖。
1import ZlibF.Spec.Api.Goals
2
3namespace ZlibF.Spec.Api.Proofs
4
5/-- The `Compress2` model refuses `Z_BUF_ERROR` when the destination has at least
6`compressBound` bytes, and its output stays within that bound. This is a property
7of the model relation; applying it to translated calls also needs refinement. -/
8theorem compress_bound_adequate : Goal.compress_bound_adequate := by
9 intro level src cap rc dst hcap hrun
10 cases hp : compressParams level with
11 | none =>
12 simp only [Compress2, Bool.true_eq_false, ↓reduceIte, hp] at hrun
13 obtain ⟨rfl, rfl⟩ := hrun
14 exact ⟨by decide, by simp⟩
15 | some p =>
16 simp only [Compress2, Bool.true_eq_false, ↓reduceIte, hp] at hrun
17 rcases hrun with ⟨rfl, rfl⟩ | ⟨rfl, _, _, hb⟩ | ⟨_, _, hlt, _⟩
18 · exact ⟨by decide, by simp⟩
19 · exact ⟨by decide, hb⟩
20 · omega
21
22end ZlibF.Spec.Api.Proofs