Elm Exactly

TheoremwCheck_inv

StandardElmMech/Stat/Complete/Discharge.lean:88, The check · tactic proof

What a successful check says.

Statement

theorem wCheck_inv {B : SBasis} {s : SProgram} {q : Option Mod.Reduced} (hB : BasisInv B)
    (h : wCheck B s q = true) :
    Src.SynOK s ∧ ∃ as rs, MW.inferProgramW MW.wFuel B (bareOf s).modules = .ok as ∧
      PrincipalProgDeriv B (bareOf s) as ∧ progResults B as = some rs ∧ checksAll rs = true ∧
      furtherAllB B as = true ∧ ∀ r, q = some r → reduceWith B as rs = .ok r

Proof

by
  unfold wCheck at h
  simp only [Bool.and_eq_true] at h
  obtain ⟨hsyn, h⟩ := h
  refine ⟨(Src.decSynOK_iff s).mp hsyn, ?_⟩
  split at h
  · rename_i as hw
    split at h
    · rename_i rs hr
      simp only [Bool.and_eq_true] at h
      obtain ⟨⟨hc, hf⟩, hq⟩ := h
      refine ⟨as, rs, hw, MW.inferProgramW_principal hB hw, hr, hc, hf, fun r hrq => ?_⟩
      subst hrq
      simp only at hq
      split at hq
      · rename_i r' hr'
        simp only [decide_eq_true_eq] at hq
        rw [hr', hq]
      · cases hq
    · cases h
  · cases h

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

Used by

In StandardElmMech/Stat/Complete/Discharge.lean: Step 11, milestone (g): Stat.wCheck, legal_of_W, ident_of_wCheck, programSem_of_wCheck (D11 discharged test by test), not_legal_of_wMainVar (A96's flags refusal), principalExistsCore_of_covers, principalExistsMod_of_covers, d11For_of_agree; Lean's pipeline with W, endToEndW (step 10's endToEnd with W in place of step 9's inference), with endToEndW_of_wCheck (the per-test spec_ from wcheck_, without a second run of the inference), specOf_of_endToEndW, ident_of_endToEndW, programSem_of_endToEndW (step 10's statements, without D11); wCheckIn, wCheck_of_ctx (the W check of a one-module program with the context of its imports given by a lemma ctx_<name>_eq, so the kernel does not compute it per test: an end-to-end shard of 20 tests takes 32 s instead of 98 s).

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.