All proofs
Project-declaredLean 4.31.0 · null

Map M for M

List.mapM_forM

Project documentation

our own variant of map_congr, for filterMap -/ public theorem filterMap_congr {f g : α → Option β} : ∀ {l : List α}, (∀ x ∈ l, f x = g x) → filterMap f l = filterMap g l | [], _ => rfl | a :: l, h => by let ⟨h₁, h₂⟩ := forall_mem_cons.1 h rw [filterMap, filterMap, h₁, filterMap_congr h₂] public theorem filterMap_empty_iff_all_none {f : α → Option β} {xs :...

Exact Lean statement

public theorem mapM_forM {α β : Type} (f : α → Except β PUnit) (xs : List α) (ys : List PUnit) :
  xs.mapM f = Except.ok ys → xs.forM f = Except.ok ()

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
public theorem mapM_forM {α β : Type} (f : α  Except β PUnit) (xs : List α) (ys : List PUnit) :  xs.mapM f = Except.ok ys  xs.forM f = Except.ok ():= by  intro h₀  induction xs generalizing ys with  | nil => simp only [forM_eq_forM, forM_nil]; rfl  | cons xh xt ih =>    simp only [forM_eq_forM, forM_cons]    cases h₁ : f xh with    | error =>      simp only [List.mapM_cons] at h₀      rw [h₁] at h₀      simp only [Except.bind_err, reduceCtorEq] at h₀    | ok =>        simp only [List.mapM_cons, pure, Except.pure] at h₀        cases h₁ : f xh <;>        simp only [h₁, Except.bind_err, Except.bind_ok, reduceCtorEq] at h₀        rename_i yh        cases h₂ : List.mapM f xt <;>        simp only [h₂, Except.bind_err, Except.bind_ok, reduceCtorEq] at h₀        rename_i yt        simp only [Except.ok.injEq] at h₀        subst h₀        simp only [Except.bind_ok]        apply ih yt        assumption
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/Data/List/Lemmas.lean:1653-1678

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

Project-declaredLean 4.31.0

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.

authorizationprogram verificationsemantics

Source project: Cedar Specification

Person-level attribution pending.

View proof record
Project-declaredLean 4.31.0

Find? notmem keys

Cedar.Data.Map.find?_notmem_keys

Plain-language statement

Inverse of find?_mem_toList, except that this requires wf

authorizationprogram verificationsemantics

Source project: Cedar Specification

Person-level attribution pending.

View proof record
Project-declaredLean 4.31.0

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

authorizationprogram verificationsemantics

Source project: Cedar Specification

Person-level attribution pending.

View proof record