Map make append find disjoint
Cedar.Data.Map.map_make_append_find_disjoint
Plain-language statement
If a key exists in l₂ but not in l₁, then Map.make (l₁ ++ l₂) contains that key.
Exact Lean statement
public theorem map_make_append_find_disjoint
[LT α] [StrictLT α] [DecidableEq α] [DecidableLT α]
[SizeOf α] [SizeOf β]
{l₁ : List (α × β)} {l₂ : List (α × β)} {k : α}
(hfind₁ : l₁.find? (λ ⟨k', _⟩ => k' == k) = none)
(hfind₂ : (l₂.find? (λ ⟨k', _⟩ => k' == k)).isSome) :
∃ v,
(Map.make (l₁ ++ l₂)).find? k = some v ∧
(k, v) ∈ l₂Formal artifact
Lean source
public theorem map_make_append_find_disjoint [LT α] [StrictLT α] [DecidableEq α] [DecidableLT α] [SizeOf α] [SizeOf β] {l₁ : List (α × β)} {l₂ : List (α × β)} {k : α} (hfind₁ : l₁.find? (λ ⟨k', _⟩ => k' == k) = none) (hfind₂ : (l₂.find? (λ ⟨k', _⟩ => k' == k)).isSome) : ∃ v, (Map.make (l₁ ++ l₂)).find? k = some v ∧ (k, v) ∈ l₂:= by have hwf : (Map.make (l₁ ++ l₂)).WellFormed := by exact Map.make_wf _ have hsub : (Map.make (l₁ ++ l₂)).toList ⊆ l₁ ++ l₂ := by apply List.canonicalize_subseteq simp [Subset, List.Subset] at hsub have ⟨v, hv⟩ : ∃ v, (Map.make (l₁ ++ l₂)).find? k = some v := by simp only [Option.isSome] at hfind₂ split at hfind₂ rotate_left contradiction rename_i kv hkv exists kv.snd rw [make_find?_eq_list_find?] rw [List.find?_append] rw [hkv, hfind₁] simp simp only [hv, Option.some.injEq, exists_eq_left'] have := Map.find?_mem_toList hv have := hsub k v this cases this with | inl hmem₁ => have := List.find?_eq_none.mp hfind₁ specialize this (k, v) hmem₁ simp at this | inr h => exact h- Project
- Cedar Specification
- License
- Apache-2.0
- Commit
- 3f093947b8ae
- Source
- cedar-lean/Cedar/Thm/Data/Map.lean:1590-1628
Reuse this declaration
Bring the exact result into your workflow
The import identifies the source module. Your project still needs the pinned package dependency shown on this page.
What this badge means
This completion status comes from the project or community source. It has not yet been represented here as an independent rebuild and axiom audit.
Continue in this project
Related declarations
Find? ext
Cedar.Data.Map.find?_ext
Plain-language statement
Two well-formed maps are equal if they have the same find? for every key.
Source project: Cedar Specification
Person-level attribution pending.
Find? notmem keys
Cedar.Data.Map.find?_notmem_keys
Plain-language statement
Inverse of find?_mem_toList, except that this requires wf
Source project: Cedar Specification
Person-level attribution pending.
Find? some iff in values
Cedar.Data.Map.find?_some_iff_in_values
Plain-language statement
The mp direction of this does not need the wf precondition and, in fact, is available separately as find?_some_implies_in_values above
Source project: Cedar Specification
Person-level attribution pending.