All proofs
Project-declaredLean 4.31.0 · null

Find? pair map

List.find?_pair_map

Project documentation

our own variant of map_congr, for mapM -/ public theorem mapM_congr [Monad m] [LawfulMonad m] {f g : α → m β} : ∀ {l : List α}, (∀ x ∈ l, f x = g x) → mapM f l = mapM g l := by intro l rw [← mapM'_eq_mapM, ← mapM'_eq_mapM] exact mapM'_congr public theorem to_option_distr_mapM' {α β ε} {l : List α} {f: α → Except ε β} : (List.mapM' f l).toOption = (List.ma...

Exact Lean statement

public theorem find?_pair_map {α β γ} [BEq α] (f : β → γ) (xs : List (α × β)) (k : α)  :
  Option.map (λ x => (x.fst, f x.snd)) (List.find? (λ x => x.fst == k) xs)  =
  List.find? (λ x => x.fst == k) (List.map (λ x => (x.fst, f x.snd)) xs)

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
public theorem find?_pair_map {α β γ} [BEq α] (f : β  γ) (xs : List (α × β)) (k : α)  :  Option.map (λ x => (x.fst, f x.snd)) (List.find? (λ x => x.fst == k) xs)  =  List.find? (λ x => x.fst == k) (List.map (λ x => (x.fst, f x.snd)) xs):= by  induction xs  case nil => simp only [find?_nil, Option.map_none, map_nil]  case cons hd tl ih =>    cases h₁ : hd.fst == k <;> simp only [map_cons]    case false =>      rw [Bool.eq_false_iff, ne_eq] at h₁      have h₂ := @List.find?_cons_of_neg _        (λ (x : α × β) => x.fst == k) hd tl h₁      have h₃ := @List.find?_cons_of_neg _        (λ (x : α × γ) => x.fst == k) (hd.fst, f hd.snd)        (map (λ x => (x.fst, f x.snd)) tl)      simp only [h₁, not_false_eq_true, forall_const, reduceCtorEq] at h₃      simp only [h₂, h₃]      exact ih    case true =>      have h₂ := @List.find?_cons_of_pos _        (λ (x : α × β) => x.fst == k) hd tl h₁      have h₃ := @List.find?_cons_of_pos _        (λ (x : α × γ) => x.fst == k) (hd.fst, f hd.snd)        (map (λ x => (x.fst, f x.snd)) tl)      simp only [h₁, forall_const] at h₃      simp [h₂, h₃]
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/Data/List/Lemmas.lean:1437-1462

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