Elm Exactly

TheorempartOf_plus

StandardElmMech/Mod/Good.lean:258, Headers · tactic proof

Statement

theorem partOf_plus {I J1 J2 : Interface} (h1 : I.PartOf J1) (h2 : I.PartOf J2) :
    I.PartOf (J1.plus J2)

Proof

by
  refine ⟨fun c w h => ?_, fun t ht => ?_, fun t VEt c v hce hc => ?_⟩
  · simp only [Interface.plus] at h
    rcases fmLookup_fmPlus_cases h with h | ⟨_, h⟩
    · exact h2.1 c w h
    · exact h1.1 c w h
  · simp only [Interface.plus, List.mem_append] at ht ⊢
    rcases ht with ht | ht
    · exact fmLookup_fmPlus_isSome (Or.inl (h1.2.1 t ht))
    · exact fmLookup_fmPlus_isSome (Or.inr (h2.2.1 t ht))
  · simp only [Interface.plus] at hce ⊢
    rcases fmLookup_fmPlus_cases hce with h | ⟨_, h⟩
    · exact fmLookup_fmPlus_some_right (h2.2.2 t VEt c v h hc)
    · have hv1 : fmLookup J1.VE c = some v := h1.2.2 t VEt c v h hc
      cases hj2 : fmLookup J2.VE c with
      | some w =>
        have e1 := h2.1 c w hj2
        have e2 := h1.1 c v hv1
        rw [e1] at e2
        rw [fmLookup_fmPlus_some_right hj2, e2]
      | none => rw [fmLookup_fmPlus_left hj2]; exact hv1

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

Theorems it uses

In StandardElmMech/Mod/Good.lean: The property of interfaces (Interface.Good): ME0 and the harness have it (ME0_good), a top-level declaration with distinct bound names infers an interface with it (EvalTopDec.good), a header's exposing list keeps it (EvalHeader.good), and so does every interface a module puts in the basis (EvalModule.good).

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.