Elm Exactly

TheoremmodifyF_map

StandardElmMech/Stat/RefuseTypes.lean:97, Renaming type names · term proof

Statement

theorem modifyF_map (g : Ty → Ty) : ∀ (n : Nat) (ρ ρ' : Row),
    Row.modifyF n (rowMap g ρ) (rowMap g ρ') = rowMap g (Row.modifyF n ρ ρ')
  | n, [], ρ' => by cases n <;> simp [rowMap, Row.modifyF]
  | n, (l, τ) :: r, [] => by cases n <;> simp [rowMap, Row.modifyF]
  | 0, (l1, τ1) :: r1, (l2, τ2) :: r2 => by simp [rowMap, Row.modifyF]
  | n + 1, (l1, τ1) :: r1, (l2, τ2) :: r2 => by
    have ih0

Proof

modifyF_map g n r1 r2
    have ih1 := modifyF_map g n r1 ((l2, τ2) :: r2)
    have ih2 := modifyF_map g n ((l1, τ1) :: r1) r2
    simp only [rowMap, List.map_cons] at ih0 ih1 ih2 ⊢
    simp only [Row.modifyF]
    split
    · simp [ih0]
    · split
      · simp [ih1]
      · simp [ih2]

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

Used by

In StandardElmMech/Stat/RefuseTypes.lean: Refusals by type expressions (aliases, constructor arguments, annotations, ports) and by the type of main (typesFailB, mainFailB), for every choice of generated names and variable sorts.

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.