Elm Exactly

TheoremmapM_cons_some

StandardElmMech/Eff/RoundTrip.lean:76, Lists and their values · tactic proof

Statement

theorem mapM_cons_some {α β : Type} {f : α → Option β} {a : α} {l : List α} {r : List β} :
    (a :: l).mapM f = some r ↔ ∃ b bs, f a = some b ∧ l.mapM f = some bs ∧ r = b :: bs

Proof

by
  simp only [List.mapM_cons]
  cases h1 : f a with
  | none => simp
  | some b =>
    cases h2 : l.mapM f with
    | none => simp
    | some bs => simp [eq_comm]

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

Used by

In StandardElmMech/Eff/RoundTrip.lean: The round trip of encoding and decoding (roundtrip), except where A88 says otherwise (NoExc), under the named hypothesis FloatRoundTrip; the exceptions shown to be needed.

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.