Lean migration: Phase 7 (Sign + Constant analyses, executable)
- Spa.Showable: port of Showable.agda (quoted strings, map format) for output parity - Spa.Analysis.Utils: eval_combine₂ - Spa.Lattice.AboveBelow.le_cases: order of the flat lattice by cases - Spa.Analysis.Sign / Spa.Analysis.Constant: the four monotonicity POSTULATES from the Agda files are now proved theorems (via le_cases); interpretations, evaluator validity, analyze_correct per analysis - Main + lake exe spa: runs both analyses on the Agda test program; constant analysis folds unknown=0, sign analysis gives unknown=⊤ Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -134,6 +134,27 @@ theorem mk_lt_top (x : α) : (mk x : AboveBelow α) < top :=
|
||||
theorem bot_lt_top : (bot : AboveBelow α) < top :=
|
||||
lt_of_le_of_ne (bot_le' _) (by simp)
|
||||
|
||||
/-- The order of the flat lattice, by cases (used to discharge the
|
||||
monotonicity obligations that were `postulate`d in `Analysis/Sign.agda` and
|
||||
`Analysis/Constant.agda`). -/
|
||||
theorem le_cases {a b : AboveBelow α} (h : a ≤ b) :
|
||||
a = bot ∨ b = top ∨ a = b := by
|
||||
have hsup := le_iff.mp h
|
||||
rcases a with _ | _ | x <;> rcases b with _ | _ | y
|
||||
· exact Or.inl rfl
|
||||
· exact Or.inr (Or.inl rfl)
|
||||
· exact Or.inl rfl
|
||||
· exact absurd hsup (by simp)
|
||||
· exact Or.inr (Or.inl rfl)
|
||||
· exact absurd hsup (by simp)
|
||||
· exact absurd hsup (by simp)
|
||||
· exact Or.inr (Or.inl rfl)
|
||||
· rw [mk_sup_mk] at hsup
|
||||
by_cases hxy : x = y
|
||||
· exact Or.inr (Or.inr (by rw [hxy]))
|
||||
· rw [if_neg hxy] at hsup
|
||||
exact absurd hsup (by simp)
|
||||
|
||||
/-- Rank of an element: `⊥ ↦ 0`, `[x] ↦ 1`, `⊤ ↦ 2`. Used to bound chains
|
||||
(Agda's `isLongest` / `x≺[y]⇒x≡⊥` / `[x]≺y⇒y≡⊤` case analysis lives here). -/
|
||||
def rank : AboveBelow α → ℕ
|
||||
|
||||
Reference in New Issue
Block a user