Elm Exactly

TheoremmergeF_map

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

Statement

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

Proof

mergeF_map g n r1 ((l2, τ2) :: r2)
    have ih2 := mergeF_map g n ((l1, τ1) :: r1) r2
    simp only [rowMap, List.map_cons] at ih1 ih2 ⊢
    simp only [Row.mergeF]
    split
    · simp
    · split
      · rw [ih1]; cases Row.mergeF n r1 ((l2, τ2) :: r2) <;> simp [rowMap]
      · rw [ih2]; cases Row.mergeF n ((l1, τ1) :: r1) r2 <;> simp [rowMap]

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.