Elm Exactly

TheoremportB_map

StandardElmMech/Stat/RefuseTypes.lean:1086, Annotations and ports · tactic proof

Statement

theorem portB_map {f : TyName → TyName} (hfix : ∀ t ∈ fixedNames, f t = t) :
    ∀ τ, portB τ = true → portB (mapTy f τ) = true
  | .con [] t, h => by
    simp only [portB, Bool.or_eq_true, beq_iff_eq] at h
    have hf : f t = t

Proof

by
      apply hfix
      rcases h with ((((((h | h) | h) | h) | h) | h) | h) <;> subst h <;> simp [fixedNames]
    simp only [mapTy, mapTys, hf, portB, Bool.or_eq_true, beq_iff_eq]
    exact h
  | .con [τ] t, h => by
    simp only [portB, Bool.and_eq_true, Bool.or_eq_true, beq_iff_eq] at h
    have hf : f t = t := by
      apply hfix
      rcases h.1 with ((h | h) | h) <;> subst h <;> simp [fixedNames]
    simp only [mapTy, mapTys, hf, portB, Bool.and_eq_true, Bool.or_eq_true, beq_iff_eq]
    exact ⟨h.1, portB_map hfix τ h.2⟩
  | .con [τ1, τ2] t, h => by
    simp only [portB, Bool.and_eq_true, beq_iff_eq] at h
    obtain ⟨⟨rfl, h1⟩, h2⟩ := h
    simp only [mapTy, mapTys, hfix tTuple2 (by simp [fixedNames]), portB, Bool.and_eq_true, beq_iff_eq]
    exact ⟨⟨trivial, portB_map hfix τ1 h1⟩, portB_map hfix τ2 h2⟩
  | .con [τ1, τ2, τ3] t, h => by
    simp only [portB, Bool.and_eq_true, beq_iff_eq] at h
    obtain ⟨⟨⟨rfl, h1⟩, h2⟩, h3⟩ := h
    simp only [mapTy, mapTys, hfix tTuple3 (by simp [fixedNames]), portB, Bool.and_eq_true, beq_iff_eq]
    exact ⟨⟨⟨trivial, portB_map hfix τ1 h1⟩, portB_map hfix τ2 h2⟩, portB_map hfix τ3 h3⟩
  | .con (_ :: _ :: _ :: _ :: _) _, h => by simp [portB] at h
  | .record ρ none, h => by
    simp only [portB] at h
    simp only [mapTy, portB]
    exact portRowB_map hfix ρ h
  | .record _ (some _), h => by simp [portB] at h
  | .var _, h => by simp [portB] at h
  | .fn _ _, h => by simp [portB] at h

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

Theorems it uses

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.