Elm Exactly

TheoremtopSound

StandardElmMech/Stat/RefuseScope.lean:983, Top-level declarations · term proof

Statement

theorem topSound : (a : ATopDec) → (C : Ctx) → (E : Env) → (PE : PortEnv) →
    checkTopDec C a = some (E, PE) → TopSound E (topBs a.erase)
  | .value VE vb, C, E, PE, h => by
    simp only [checkTopDec] at h
    split at h
    · rename_i hc
      simp only [Bool.and_eq_true, decide_eq_true_eq] at hc
      replace hc

Proof

hc.1
      simp only [Option.some.injEq, Prod.mk.injEq] at h
      obtain ⟨rfl, rfl⟩ := h
      refine ⟨rfl, vesound_of_keysIn ?_⟩
      simp only [Env.ofVE]
      rw [← hc.2]
      exact keysIn_closGroup _ (keys_valBind vb)
    · cases h
  | .types TE VE db tbs, C, E, PE, h => by
    simp only [checkTopDec] at h
    split at h
    · rename_i hc
      simp only [Option.some.injEq, Prod.mk.injEq] at h
      obtain ⟨rfl, rfl⟩ := h
      exact ⟨rfl, vesound_checkTypes hc⟩
    · cases h
  | .port x ty U, C, E, PE, h => by
    simp only [checkTopDec] at h
    exact elabPort_shape h
  | .seq a1 a2, C, E, PE, h => by
    simp only [checkTopDec] at h
    split at h
    · rename_i E1 PE1 h1
      split at h
      · rename_i E2 PE2 h2
        simp only [Option.some.injEq, Prod.mk.injEq] at h
        obtain ⟨rfl, rfl⟩ := h
        exact topSound_plus (topSound a1 C E1 PE1 h1) (topSound a2 _ E2 PE2 h2)
      · cases h
    · cases h

Proved by a term, which Lean's kernel checks directly.

Theorems it uses

Used by

In StandardElmMech/Stat/RefuseScope.lean: Refusals by scope, constructor arity and imports, for one module and for a module after a helper (scopeFailB).

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.