Map M' error implies exists error
List.mapM'_error_implies_exists_error
Plain-language statement
The converse is not true: counterexample xs is [1, 2] and f is Except.error. In that case, f 2 = .error 2 but xs.mapM' f = .error 1. But for a limited converse, see element_error_implies_mapM_error
Exact Lean statement
public theorem mapM'_error_implies_exists_error {α β γ} {f : α → Except γ β} {xs : List α} {e : γ} :
List.mapM' f xs = .error e → ∃ x ∈ xs, f x = .error eFormal artifact
Lean source
public theorem mapM'_error_implies_exists_error {α β γ} {f : α → Except γ β} {xs : List α} {e : γ} : List.mapM' f xs = .error e → ∃ x ∈ xs, f x = .error e:= by intro h₁ cases xs case nil => simp only [mapM'_nil, pure, Except.pure, reduceCtorEq] at h₁ case cons xhd xtl => simp only [mapM'_cons] at h₁ cases h₂ : f xhd <;> simp only [h₂, Except.bind_ok, Except.bind_err, Except.error.injEq] at h₁ case error => subst h₁ exists xhd simp only [mem_cons, true_or, h₂, and_self] case ok => cases h₃ : mapM' f xtl <;> simp only [h₃, Except.bind_ok, Except.bind_err, Except.error.injEq, pure, Except.pure, reduceCtorEq] at h₁ subst h₁ replace h₃ := mapM'_error_implies_exists_error h₃ replace ⟨x, h₃⟩ := h₃ exists x simp only [mem_cons, h₃, or_true, and_self]- Project
- Cedar Specification
- License
- Apache-2.0
- Commit
- 3f093947b8ae
- Source
- cedar-lean/Cedar/Thm/Data/List/Lemmas.lean:906-928
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.