spells no identifier, syntax-core)." /> <!-- PLACEHOLDER_TITLE --> spells no identifier, syntax-core)." /> <!-- PLACEHOLDER_TITLE --> spells no identifier, syntax-core)." />
Elm Exactly

TheoremcopyName_inj

StandardElmMech/Stat/Pipeline.lean:116, Copy names · tactic proof

Copy names are new and distinct ($ spells no identifier, syntax-core).

Statement

theorem copyName_inj {x y : Var} {a b : Assignment} (ha : a.length = b.length)
    (hx : '#039; ∉ x.toList) (hy : '#039; ∉ y.toList) (h : copyName x a = copyName y b) : x = y ∧ a = b

Proof

by
  unfold copyName at h
  by_cases da : a.isDefault = true <;> by_cases db : b.isDefault = true <;>
    simp only [da, db, ↓reduceIte, Bool.false_eq_true] at h
  · refine ⟨h, ?_⟩
    rw [(isDefault_iff a).mp da, (isDefault_iff b).mp db, ha]
  · exfalso; apply hx; rw [h]; simp [String.toList_append]
  · exfalso; apply hy; rw [← h]; simp [String.toList_append]
  · have h' := congrArg String.toList h
    simp only [String.toList_append, List.append_assoc] at h'
    have : ("quot; : String).toList = ['#039;] := rfl
    rw [this] at h'
    simp only [List.singleton_append] at h'
    obtain ⟨h1, h2⟩ := append_dollar_inj _ _ _ _ hx hy h'
    rw [key_toList, key_toList] at h2
    exact ⟨String.toList_inj.mp h1, keyChars_inj a b ha h2⟩

Proved with tactics, which Lean expands into a proof term that its kernel checks.

Theorems it uses

In StandardElmMech/Stat/Pipeline.lean: SpecOf, DynOf (in Lib.Btest for a view, Mod.Btest [] for a worker: dynBasis), ProgramSem (r:p-program), D11For; copy names, payload types and main (copyName_inj, toPTy_isSome_iff, mainKind_worker_iff, mainKind_view_iff); the pipeline theorems (specOf_of_endToEnd, programSem_of_legal).

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.