TheoremtoList?_some
Statement
theorem toList?_some (l : Val) : ∀ {vs : List Val}, l.toList? = some vs → l = Val.ofList vsProof
by
induction l using Val.toList?.induct with
| case1 => intro vs h; simp [Val.toList?] at h; subst h; rfl
| case2 c hc => intro vs h; simp [Val.toList?, hc] at h
| case3 hd tl ih =>
intro vs h
simp only [Val.toList?, ite_true] at h
cases ht : tl.toList? with
| none => rw [ht] at h; cases h
| some ts =>
rw [ht] at h; simp only [Option.map_some, Option.some.injEq] at h; subst h
simp [Val.ofList, ih ht]
| case4 c hd tl hc => intro vs h; simp [Val.toList?, hc] at h
| case5 t h1 h2 =>
intro vs h
unfold Val.toList? at h
split at h
· exact absurd rfl (h1 _)
· exact absurd rfl (h2 _ _ _)
· cases hProved with tactics, which Lean expands into a proof term that its kernel checks.
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.