TheoremaliasOrder_valid
Statement
theorem aliasOrder_valid (hnd : (all.map (·.1)).Nodup)
(hacyc : ∀ i < all.length, ¬ Plus all.length (mentionsIdx all) i i) :
ValidAliasOrder all (aliasOrder all)Proof
by
obtain ⟨out, hout, hp, hrl⟩ := aliasOrderAux_spec hnd hacyc all.length [] all (by simp) (Nat.le_refl _)
have heq : aliasOrder all = out := by unfold aliasOrder; simpa using hout
rw [heq]
refine ⟨hp, ?_⟩
intro i j hi hj hij hm
have hndo : (out.map (·.1)).Nodup := (hp.map (·.1)).nodup_iff.mpr hnd
have hdistinct := names_distinct hndo
have hrd := aReadyList_get [] out hrl i hi
simp only [List.nil_append] at hrd
unfold aReady at hrd
have hb := (List.all_eq_true.mp hrd) out[j] (hp.mem_iff.mp (List.getElem_mem hj))
simp only [Bool.or_eq_true, beq_iff_eq, Bool.not_eq_true', List.any_eq_true, hm] at hb
rcases hb with (he | hf) | ⟨x, hx, hxe⟩
· exact absurd he (hdistinct j i hj hi (Ne.symm hij))
· cases hf
· obtain ⟨k, hk, rfl⟩ := List.mem_take_iff_getElem.mp hx
have hk' := Nat.lt_min.mp hk
have : k = j := by
apply Classical.byContradiction
intro hkj
exact hdistinct k j hk'.2 hj hkj hxe
subst this
exact hk'.1Proved with tactics, which Lean expands into a proof term that its kernel checks.
Theorems it uses
Used by
In StandardElmMech/Src/AliasOrderProof.lean: aliasOrder_valid: the canonical order of aliases is one the book allows.
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.