Theoremmem_of_keys_nodup_eq
Statement
theorem mem_of_keys_nodup_eq : ∀ {l : List Bind} {a b : Bind}, (keysOf l).Nodup → a ∈ l → b ∈ l →
a.1 = b.1 → a = b
| [], _, _, _, ha, _, _ => by simp at ha
| c :: rest, a, b, hn, ha, hb, he => by
simp only [keysOf, List.map_cons, List.nodup_cons] at hn
simp only [List.mem_cons] at ha hb
have notin : ∀ x ∈ rest, x.1 ≠ c.1Proof
fun x hx hx' => hn.1 (hx' ▸ List.mem_map_of_mem hx)
rcases ha with rfl | ha <;> rcases hb with rfl | hb
· rfl
· exact absurd he.symm (notin b hb)
· exact absurd he (notin a ha)
· exact mem_of_keys_nodup_eq hn.2 ha hb heProved by a term, which Lean's kernel checks directly.
Used by
In StandardElmMech/Eff/MkObj.lean: A76: mkObj ignores the order of distinct keys (a76_mkObj_perm), a lookup finds the last binding (lookup_mkObj), and decoding ignores keys outside the record type (a76_dec_extra_key).
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.