Elm Exactly

Theoremnot_legal_of_mainFailB

StandardElmMech/Stat/RefuseTypes.lean:1801, The type of `main` · tactic proof

Statement

theorem not_legal_of_mainFailB {B : SBasis} {sp : Src.SProgram} (h : mainFailB B sp = true) :
    ¬ LegalProgram B sp

Proof

by
  unfold mainFailB at h
  split at h
  · rename_i m hms
    split at h
    · rename_i C0 d hC hd
      simp only [Bool.and_eq_true] at h
      obtain ⟨⟨hfix, hun⟩, hr⟩ := h
      refine not_legal_of_main hms ?_
      intro a B' E he hres
      have hC' : importCtx B a.imports = some C0 := by rw [imports_erase he]; exact hC
      rw [AModule.result_of_ctx hC'] at hres
      obtain ⟨PE, hc⟩ := resultIn_check hres
      obtain ⟨ad, hb, had⟩ := body_erase he hd
      rw [hb] at hc
      obtain ⟨hU, hT⟩ := importCtx_UT hC
      have hI := inv_base B (fcol B.T) C0 _ hU hT hun
      exact not_mainOK (main_bad (col_fcol B hfix) rfl ad C0 E PE hI (had ▸ hr) hc)
    · cases h
  · cases h

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

Theorems it uses

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.