TheoremfieldOf_of_mem
Statement
theorem fieldOf_of_mem : ∀ {r : List (String × Val)} {l : String} {v : Val},
(r.map (·.1)).Nodup → (l, v) ∈ r → fieldOf r l = some v
| [], _, _, _, h => by simp at h
| (k, w) :: r, l, v, hn, h => by
simp only [List.map_cons, List.nodup_cons] at hn
simp only [List.mem_cons] at h
unfold fieldOf fmLookup
rcases h with h | h
· simp only [Prod.mk.injEq] at h; obtain ⟨rfl, rfl⟩Proof
h; simp
· have hk : k ≠ l := fun he => hn.1 (he ▸ List.mem_map_of_mem (f := (·.1)) h)
have : (k == l) = false := by simpa using hk
simp only [this]
exact fieldOf_of_mem hn.2 hProved by a term, which Lean's kernel checks directly.
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.