All proofs
Project-declaredLean 4.31.0 · null

Map M preserves Sorted By

List.mapM_preserves_SortedBy

Plain-language statement

mapM preserves SortedBy if the keys are preserved

Exact Lean statement

public theorem mapM_preserves_SortedBy
  [LT γ]
  {l₁ : List α} {l₂ : List β}
  {f : α → Option β}
  {k₁ : α → γ}
  {k₂ : β → γ}
  (hsorted : List.SortedBy k₁ l₁)
  (hmapM : l₁.mapM f = .some l₂)
  (hkey : ∀ a b, f a = .some b → k₁ a = k₂ b) :
  List.SortedBy k₂ l₂

Formal artifact

Lean source

Canonical source
Full Lean sourceLean 4
public theorem mapM_preserves_SortedBy  [LT γ]  {l₁ : List α} {l₂ : List β}  {f : α  Option β}  {k₁ : α  γ}  {k₂ : β  γ}  (hsorted : List.SortedBy k₁ l₁)  (hmapM : l₁.mapM f = .some l₂)  (hkey :  a b, f a = .some b  k₁ a = k₂ b) :  List.SortedBy k₂ l₂:= by  have := List.mapM_some_iff_forall₂.mp hmapM  induction this with  | nil => constructor  | cons hhd hrst ih =>    rename_i hd₁ hd₂ tl₁ tl₂    have hrst' := List.mapM_some_iff_forall₂.mpr hrst    cases tl₂ with    | nil => constructor    | cons hd₂' tl₂' =>      constructor      · cases hrst with | cons h =>        rename_i hd₁' _ _        simp only [          hkey _ _ hhd,          hkey _ _ h        ]        cases hsorted        assumption      · apply ih        · cases hsorted          · constructor          · assumption        · exact hrst'
Project
Cedar Specification
License
Apache-2.0
Commit
3f093947b8ae
Source
cedar-lean/Cedar/Thm/Data/List/Lemmas.lean:1881-1914

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