Map MOn Values some implies all from some alt proof
Cedar.Data.Map.mapMOnValues_some_implies_all_from_some_alt_proof
Plain-language statement
alternate proof of mapMOnValues_some_implies_all_from_some, which instead of relying on mapMOnValues_some_implies_forall₂, relies on List.mapM_some_implies_all_from_some. Which do we prefer?
Exact Lean statement
theorem mapMOnValues_some_implies_all_from_some_alt_proof [LT α] [DecidableLT α] {f : β → Option γ} {m₁ : Map α β} {m₂ : Map α γ} :
m₁.mapMOnValues f = some m₂ →
∀ kv ∈ m₂.toList, ∃ v, (kv.fst, v) ∈ m₁.toList ∧ f v = kv.sndFormal artifact
Lean source
theorem mapMOnValues_some_implies_all_from_some_alt_proof [LT α] [DecidableLT α] {f : β → Option γ} {m₁ : Map α β} {m₂ : Map α γ} : m₁.mapMOnValues f = some m₂ → ∀ kv ∈ m₂.toList, ∃ v, (kv.fst, v) ∈ m₁.toList ∧ f v = kv.snd:= by unfold mapMOnValues intro h₁ kv h₂ cases h₃ : m₁.toList.mapM (λ x => match x with | (k, v) => do let v' ← f v ; pure (k, v')) <;> rw [h₃] at h₁ <;> simp only [Option.pure_def, Option.bind_some_fun, Option.bind_none_fun, Option.some.injEq, reduceCtorEq] at h₁ case some ags => subst h₁ have (a, g) := kv ; clear kv simp only replace h₃ := List.mapM_some_implies_all_from_some h₃ replace ⟨(a', b), h₃, h₄⟩ := h₃ (a, g) h₂ simp only [Option.pure_def, Option.bind_eq_bind, Option.bind_eq_some_iff, Option.some.injEq, Prod.mk.injEq, exists_eq_right_right] at h₄ replace ⟨h₄, h₄'⟩ := h₄ subst a' exists b- Project
- Cedar Specification
- License
- Apache-2.0
- Commit
- 3f093947b8ae
- Source
- cedar-lean/Cedar/Thm/Data/Map.lean:1297-1316
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.