TheoremmapM_byteOf
Statement
theorem mapM_byteOf : ∀ (vs : List Val) (os : List Nat), vs.mapM byteOf? = some os →
vs.map normVal = os.map (fun (o : Nat) => Val.int (o : Int)) ∧ ∀ o ∈ os, o < 256
| [], os, h => by simp at h; subst h; simp
| v :: vs, os, h => by
obtain ⟨b, bs, h1, h2, rfl⟩Proof
mapM_cons_some.mp h
obtain ⟨ih1, ih2⟩ := mapM_byteOf vs bs h2
unfold byteOf? at h1
split at h1
· rename_i n
split at h1
· rename_i hn
simp only [Option.some.injEq] at h1; subst h1
refine ⟨?_, ?_⟩
· simp only [List.map_cons, ih1]
simp [normVal, Int.toNat_of_nonneg hn.1]
· intro o ho
simp only [List.mem_cons] at ho
rcases ho with rfl | ho
· omega
· exact ih2 o ho
· cases h1
· cases h1Proved by a term, which Lean's kernel checks directly.
Theorems it uses
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.