Elm Exactly

TheoremspecializeCon_typed

StandardElmMech/Stat/PatternsProof.lean:618, Small facts the induction uses · term proof

Statement

theorem specializeCon_typed {tbl : ConTable} {τ : Ty} {τr : List Ty} {k : String} {as : List Ty}
    (has : argTys tbl τ k = some as) : ∀ (P : List (List PatN)), (∀ r ∈ P, PTypedList tbl (τ :: τr) r) →
    ∀ r ∈ specializeCon k as.length P, PTypedList tbl (as ++ τr) r
  | [], _, r, hr => by simp [specializeCon] at hr
  | r0 :: P, hP, r, hr => by
    have ih

Proof

specializeCon_typed has P (fun r h => hP r (List.mem_cons_of_mem _ h))
    have h0 := hP r0 List.mem_cons_self
    match r0, hr, h0 with
    | .wild :: rest, hr, h0 =>
      simp only [specializeCon, List.mem_cons] at hr
      rcases hr with rfl | hr
      · exact PTypedList.append (PTypedList.wilds as) h0.2
      · exact ih r hr
    | .con k' args :: rest, hr, h0 =>
      simp only [specializeCon] at hr
      split at hr
      · rename_i hk
        subst hk
        rcases List.mem_cons.mp hr with rfl | hr
        · obtain ⟨_, as', has', hargs⟩ := ptyped_con h0.1
          rw [has] at has'
          cases has'
          exact PTypedList.append hargs h0.2
        · exact ih r hr
      · exact ih r hr
    | .den _ :: _, hr, _ => exact ih r (by simpa [specializeCon] using hr)
    | [], hr, _ => exact ih r (by simpa [specializeCon] using hr)

Proved by a term, which Lean's kernel checks directly.

Theorems it uses

Used by

In StandardElmMech/Stat/PatternsProof.lean: The pattern decider is correct: every type is inhabited (inhabited), useful_spec, exhDec_sound, irrDec_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.