Elm Exactly

Theoremlegal_of_infer

StandardElmMech/Stat/Legal.lean:271, Programs of several modules · tactic proof

Legality of a program of any number of modules, everything computed by the kernel.

Statement

theorem legal_of_infer {B : SBasis} {sp : SProgram} (h : legalB B sp = true) :
    InferPrincipalFor B (Src.deriveProgram (Src.canonOrder sp)) → LegalProgram B sp

Proof

by
  intro H
  unfold legalB at h
  simp only [Bool.and_eq_true] at h
  obtain ⟨hsyn, h⟩ := h
  obtain ⟨as, hinf, hb⟩ := progCheck_infer _ B h
  obtain ⟨Bs, hBs⟩ := Option.isSome_iff_exists.mp hb
  have hck : checkProgram B as = true := by simp [checkProgram, hBs]
  obtain ⟨⟨_, herase⟩, Bs', hBs', hpr⟩ := H as hinf hck
  rw [hBs] at hBs'
  cases hBs'
  obtain ⟨τ, PE, hel⟩ := progCheck_el _ B as Bs h hinf hBs hpr herase
  exact ⟨Src.synOKSet_of_synOK (by simpa [Src.decSynOK] using hsyn), τ, PE, hel⟩

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

Theorems it uses

In StandardElmMech/Stat/Legal.lean: The master theorems: a program whose inferred derivation checks, meets the further restrictions and gives main a Chapter 9 type is legal, under D11 (legal_of_infer1, legal_of_infer).

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.