All proofs
Project-declaredLean 4.31.0 · null

Map MOn Values ok implies all ok

Cedar.Data.Map.mapMOnValues_ok_implies_all_ok

Plain-language statement

Note that the converse is not true: counterexample m₁ is [(1, false)], m₂ is [(1, false), (2, true)], f is Except.ok But for a limited converse, see all_ok_implies_mapMOnValues_ok

Exact Lean statement

public theorem mapMOnValues_ok_implies_all_ok [LT α] [DecidableLT α] {f : β → Except ε γ} {m₁ : Map α β} {m₂ : Map α γ} :
  m₁.mapMOnValues f = .ok m₂ →
  ∀ kv ∈ m₁.toList, ∃ v, (kv.fst, v) ∈ m₂.toList ∧ f kv.snd = .ok v

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
public theorem mapMOnValues_ok_implies_all_ok [LT α] [DecidableLT α] {f : β  Except ε γ} {m₁ : Map α β} {m₂ : Map α γ} :  m₁.mapMOnValues f = .ok m₂    kv  m₁.toList,  v, (kv.fst, v)  m₂.toList  f kv.snd = .ok v:= by  unfold mapMOnValues  intro h₁ kv h₂  cases h₃ : m₁.toList.mapM λ kv => match kv with | (k, v) => do let v'  f v ; pure (k, v')  <;> rw [h₃] at h₁  <;> simp only [pure, Except.pure, Except.bind_ok, Except.bind_err, Except.ok.injEq, reduceCtorEq] at h₁  case ok ags =>    subst h₁    have (a, b) := kv ; clear kv    simp only    replace (a', g), h₃, h₄ := List.mapM_ok_implies_all_ok h₃ (a, b) h₂    simp [pure, Except.pure] at h₄    cases h₅ : f b <;> simp [h₅] at h₄    replace h₄, h₄' := h₄ ; subst a' g ; rename_i g    exists g
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/Data/Map.lean:1370-1387

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