Elm Exactly

Theorema25_no_value

StandardElmMech/Mod/A25.lean:108 · tactic proof

A25: a delayed self-reference forced during its own evaluation has no result: the module x = let f _ = x in f () has no meaning, in any basis.

Statement

theorem a25_no_value (B : Basis) : ¬ ∃ B' VE, EvalModule B mA25 B' VE

Proof

by
  rintro ⟨B', VE, d⟩
  cases d with
  | r_dm_module h is td E I m I' himp htd hh =>
  cases htd with
  | r_dm_topdec_val _ _ VE1 vs hne hvb hforce =>
  rw [thunkGroup_a25] at hvb
  cases hvb with
  | r_d_valbind_var _ _ _ _ v VE2 hexp hopt =>
  cases hexp
  cases hopt
  simp only [List.map_cons, List.map_nil, Function.comp, thunkVar] at hforce
  cases hforce with
  | seq_cons _ _ v' vs' hfx _ =>
  obtain ⟨L, n, hn⟩ := evExp_complete hfx
  have hfmp : fmPlus [("#x", Val.closure AtPat.wild a25T (E0base.plusEnv E) [])] ([] : ValEnv) =
      [("#x", Val.closure AtPat.wild a25T (E0base.plusEnv E) [])] := by simp [fmPlus]
  have hx : ("#" ++ "x" : String) = "#x" := rfl
  rw [hfmp, hx, a25_force_out] at hn
  cases hn

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

Rules of the book it uses

Theorems it uses

Used by

About ruling A25 of the book, where the implementations disagreed or were silent and the definition decides.

In StandardElmMech/Mod/A25.lean: A25: the module x = let f _ = x in f () has no meaning (a25_no_value, a25_no_meaning), by the loop of the evaluator forcing x's thunk (a25_loop) and completeness.

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.