TheoremcheckTopDec_sound
Statement
theorem checkTopDec_sound (C : Ctx) : (a : ATopDec) → (E : Env) → (PE : PortEnv) →
checkTopDec C a = some (E, PE) → ElTopDec C a.erase E PE
| .value VE vb, E, PE, h => by
simp only [checkTopDec] at h
split at h
· rename_i hc
simp only [Bool.and_eq_true, decide_eq_true_eq] at hc
simp only [Option.some.injEq, Prod.mk.injEq] at h
obtain ⟨rfl, rfl⟩Proof
h
have hv := checkValBind_sound _ vb hc.1.1
rw [hc.1.2] at hv
exact .r_sm_topdec_value hv
· cases h
| .types TE VE db tbs, E, PE, h => by
simp only [checkTopDec] at h
split at h
· rename_i hc
simp only [Option.some.injEq, Prod.mk.injEq] at h
obtain ⟨rfl, rfl⟩ := h
exact .r_sm_topdec_types (checkTypes_sound C TE VE db tbs hc).1 (checkTypes_sound C TE VE db tbs hc).2
· cases h
| .port x ty U, E, PE, h => by
simp only [checkTopDec] at h
exact elabPort_sound C x ty U E PE h
| .seq a1 a2, E, PE, h => by
simp only [checkTopDec] at h
split at h
· rename_i E1 PE1 h1
split at h
· rename_i E2 PE2 h2
simp only [Option.some.injEq, Prod.mk.injEq] at h
obtain ⟨rfl, rfl⟩ := h
exact .r_sm_topdec_seq (checkTopDec_sound C a1 E1 PE1 h1) (checkTopDec_sound _ a2 E2 PE2 h2)
· cases h
· cases hProved by a term, which Lean's kernel checks directly.
Rules of the book it uses
Theorems it uses
Used by
In StandardElmMech/Stat/CheckSound.lean: The checker is sound: a phrase that checks has a derivation by the rules of Chapters 4 and 5 (checkExp_sound, checkModule_sound).
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.