chars int64 40 24k | content_type stringclasses 9
values | id stringlengths 13 64 | source stringclasses 5
values | subset stringclasses 31
values | text stringlengths 40 24k |
|---|---|---|---|---|---|
18,949 | lean_file_chunk | cc736a5a5c19e0c5bc43f8deff953257f49db004dc41b4d29649af4a67221340 | lean_source_file | lean_toolchain_source_file_chunks | t.lift (fun m => DTreeMap.Const.minEntry? m)
(fun _ _ h => h.constMinEntry?_eq)
@[inline, inherit_doc ExtDTreeMap.minEntry]
def minEntry [TransCmp cmp] (t : ExtDTreeMap α β cmp) (h : t ≠ ∅) : α × β :=
t.pliftOn (fun m h' => DTreeMap.Const.minEntry m (h' ▸ isEmpty_eq_false_iff.mpr h :))
(fun _ _ _ _ h => h.co... |
14,404 | lean_file_chunk | e09b695549462247a7c0fca12a245bce235a5299927d51bda43a1865047635af | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2026 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Init.Data.String.Slice
public import Init.Data.String.Search
public import Init.Data.Nat.ToString
import all Init.Data.String.Slice
import... |
7,482 | lean_file_chunk | 5fe027d4bc7816d606035020ce69da38c392d179cb3f8555d13e35df6d89b7a9 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2026 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Julia Markus Himmel
-/
module
prelude
public import Init.Data.String.Slice
public import Init.Data.String.Search
public import Init.Data.ToString.Extra
public import Init.Data.String.T... |
5,146 | lean_file_chunk | cc37b11fbb26a980f45d824f1b4a6152751d1a8af2ce11b8a564eb27ab980478 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
public import Std.Data.DTreeMap.Raw.Basic
public import Std.Data.DTreeMap.Internal.WF.Lemmas
@[expose] public section
/-!
# Additional dependent tree ... |
690 | lean_file_chunk | e91f9a8060afff7d4a4909804039b638901f53be4b1bf5b69c998ec9c642a852 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Wojciech Różowski
-/
module
prelude
public import Std.Data.DTreeMap.Raw
public section
/-!
# Decidable equivalence for `DTreeMap`
-/
open Std.DTreeMap.Internal.Impl
namespace Std.D... |
23,955 | lean_file_chunk | 4b13b8e59821f82857f037f22de725203df21b4a1d13881210f9021011889046 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel, Paul Reichert
-/
module
prelude
import Std.Data.DTreeMap.Internal.Lemmas
public import Std.Data.DTreeMap.AdditionalOperations
public import Init.Data.Array.Perm
import I... |
23,930 | lean_file_chunk | 7e250a1c83a07ac16a7c97fbc9df7f3a3040b5f07deab2802b657731ca833202 | lean_source_file | lean_toolchain_source_file_chunks | theorem getD_eq_getD [TransCmp cmp] [LawfulEqCmp cmp] {a : α} {fallback : β} :
getD t a fallback = t.getD a fallback :=
Impl.Const.getD_eq_getD t.wf
theorem getD_congr [TransCmp cmp] {a b : α} {fallback : β} (hab : cmp a b = .eq) :
getD t a fallback = getD t b fallback :=
Impl.Const.getD_congr t.wf hab
en... |
23,956 | lean_file_chunk | cbccb26eee42ee39886f317934738b67cdd9ba37115f32fa04fcb6348c3f98f1 | lean_source_file | lean_toolchain_source_file_chunks | theorem foldl_eq_foldl_toList {f : δ → (a : α) → β a → δ} {init : δ} :
t.foldl f init = t.toList.foldl (fun a b => f a b.1 b.2) init :=
Impl.foldl_eq_foldl_toList
theorem foldl_eq_foldl_toArray {f : δ → (a : α) → β a → δ} {init : δ} :
t.foldl f init = t.toArray.foldl (fun a b => f a b.1 b.2) init :=
Impl.f... |
23,962 | lean_file_chunk | 844d0fb99ce6053c7b186c2f4d8745c433f261d15f961fc0b81857958cd50fc9 | lean_source_file | lean_toolchain_source_file_chunks | k ∈ insertManyIfNewUnit t l ↔ k ∈ t ∨ l.contains k :=
Impl.Const.mem_insertManyIfNewUnit_list t.wf
theorem mem_of_mem_insertManyIfNewUnit_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp]
{l : List α} {k : α} (contains_eq_false : l.contains k = false) :
k ∈ insertManyIfNewUnit t l → k ∈ t :=
Impl.Const.mem_of... |
23,958 | lean_file_chunk | a3bac5531ea59d7cd3903623247266987527451fd7c8606fd025373320aabd81 | lean_source_file | lean_toolchain_source_file_chunks | (t₁ ∪ (t₂.insert p.fst p.snd)).Equiv ((t₁ ∪ t₂).insert p.fst p.snd) :=
⟨Impl.union_insert_right_equiv_insert_union t₁.wf t₂.wf⟩
/- get? -/
theorem get?_union [TransCmp cmp] [LawfulEqCmp cmp] {k : α} :
(t₁ ∪ t₂).get? k = (t₂.get? k).or (t₁.get? k) := by
exact Impl.get?_union t₁.wf t₂.wf
theorem get?_union_of_n... |
23,990 | lean_file_chunk | be0e8e0e915e06cb83c7e8e55722e770f2d1a0384bb82739df2d0b0390bff9c8 | lean_source_file | lean_toolchain_source_file_chunks | theorem not_mem_diff_of_mem_right [TransCmp cmp]
{k : α} (h : k ∈ t₂) :
¬ k ∈ t₁ \ t₂ := by
rw [← contains_eq_false_iff_not_mem]
exact Impl.contains_diff_eq_false_of_contains_right t₁.wf t₂.wf h
/- Equiv -/
theorem Equiv.diff_left {t₃ : DTreeMap α β cmp} [TransCmp cmp]
(equiv : t₁ ~m t₂) :
(t₁ \ t₃... |
23,969 | lean_file_chunk | 268645e66ffef9865f845e205f050b9b282ef6da3152fc17b64c2f967b35975e | lean_source_file | lean_toolchain_source_file_chunks | (alter t k f).getKey? k' =
if cmp k k' = .eq then
if (f (get? t k)).isSome then some k else none
else
t.getKey? k' :=
Impl.Const.getKey?_alter t.wf
theorem getKey?_alter_self [TransCmp cmp] {k : α} {f : Option β → Option β} :
(alter t k f).getKey? k = if (f (get? t k)).isSome then som... |
23,923 | lean_file_chunk | 4fb1423d102563f830d46c276ed37c7af6d349324c7c27d9ae3972678f500e91 | lean_source_file | lean_toolchain_source_file_chunks | (t.modify k f).minKey he = t.minKey (cast (congrArg (· = false) isEmpty_modify) he) :=
Impl.minKey_modify t.wf
theorem minKey_alter_eq_self [TransCmp cmp] [LawfulEqCmp cmp] {k f he} :
(t.alter k f).minKey he = k ↔
(f (t.get? k)).isSome ∧ ∀ k', k' ∈ t → (cmp k k').isLE :=
Impl.minKey_alter_eq_self t.wf
n... |
23,943 | lean_file_chunk | 0ba440ed31e0aec072ecc67cdf4f0470988126a63f6dc6a851cc1434bc2a5d7b | lean_source_file | lean_toolchain_source_file_chunks | theorem maxKey_erase_eq_of_not_compare_eq_maxKey [TransCmp cmp] {k he} :
(hc : ¬ cmp k (t.maxKey (isEmpty_eq_false_of_isEmpty_erase_eq_false he)) = .eq) →
(t.erase k |>.maxKey he) =
t.maxKey (isEmpty_eq_false_of_isEmpty_erase_eq_false he) :=
Impl.maxKey_erase_eq_of_not_compare_eq_maxKey t.wf
theorem ma... |
23,952 | lean_file_chunk | 0a84e8f95ae2d696868cfcfa2865004187b79d03d769f902f78751566ecd3989 | lean_source_file | lean_toolchain_source_file_chunks | theorem getEntryGTD_eq [TransCmp cmp] {k : α} {fallback : (a : α) × β a} (h : t₁ ~m t₂) :
t₁.getEntryGTD k fallback = t₂.getEntryGTD k fallback :=
h.1.getEntryGTD_eq t₁.2 t₂.2
theorem getEntryLE?_eq [TransCmp cmp] {k : α} (h : t₁ ~m t₂) :
t₁.getEntryLE? k = t₂.getEntryLE? k :=
h.1.getEntryLE?_eq t₁.2 t₂.2
... |
23,936 | lean_file_chunk | 6c3845a504412d52d91f5347e9df1336841361441c37edc8238a297a5de0e9fe | lean_source_file | lean_toolchain_source_file_chunks | theorem getKeyD_filterMap [TransCmp cmp] [LawfulEqCmp cmp]
{f : (a : α) → β a → Option (γ a)} {k fallback : α} :
(t.filterMap f).getKeyD k fallback =
((t.getKey? k).pfilter (fun x h' =>
(f x (t.get x (mem_of_getKey?_eq_some h'))).isSome)).getD fallback :=
Impl.getKeyD_filterMap t.wf
namespace Const... |
1,259 | lean_file_chunk | c96b1c5a22a81fb0e757b09cb545ee35f1522ef8b17e5b090aaec7b21d831abf | lean_source_file | lean_toolchain_source_file_chunks | (fun _ h' => mem_iff_isSome_get?.mpr (Option.isSome_of_eq_some h'))).getD fallback :=
Impl.Const.getD_map' t.wf
theorem getD_map_of_getKey?_eq_some [TransCmp cmp] [Inhabited γ]
{f : α → β → γ} {k k' : α} {fallback : γ} (h : t.getKey? k = some k') :
Const.getD (t.map f) k fallback = ((Const.get? t k).map (f k... |
23,947 | lean_file_chunk | bdad84dea1c35c894ef7f368f9706bd197be4675a57aee6cdc76117b59e8dc3d | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel, Paul Reichert
-/
module
prelude
public import Std.Data.DTreeMap.Internal.WF.Defs
@[expose] public section
/-!
# Dependent tree maps
This file develops the type `Std.D... |
17,237 | lean_file_chunk | 929a8488e46e38517838658c4804700cf123559967fac42f4dacd1baf4a23227 | lean_source_file | lean_toolchain_source_file_chunks | def get? (t : DTreeMap α β cmp) (a : α) : Option β :=
letI : Ord α := ⟨cmp⟩; Impl.Const.get? t.inner a
@[inline, inherit_doc DTreeMap.get]
def get (t : DTreeMap α β cmp) (a : α) (h : a ∈ t) : β :=
letI : Ord α := ⟨cmp⟩; Impl.Const.get t.inner a h
@[inline, inherit_doc DTreeMap.get!]
def get! [Inhabited β] (t : DT... |
486 | lean_file_chunk | 3b687d516ffd919ce688d3ad90d2f817005c1960769714f5e1068be096b16c58 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
public import Std.Data.DTreeMap.Raw.Basic
public import Std.Data.DTreeMap.Raw.AdditionalOperations
public import Std.Data.DTreeMap.Raw.Lemmas
public imp... |
2,021 | lean_file_chunk | c33148e3077868cefe44c75d29689926cb867f5cca29962aab5aa3dcb253046d | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Wojciech Różowski
-/
module
prelude
public import Std.Data.DTreeMap.Raw.Iterator
/-!
# Iterators on `DTreeMap`
-/
namespace Std.DTreeMap
open Std.Iterators
/--
Returns a finite iter... |
5,678 | lean_file_chunk | cbba0a257a126ea2d0755c8b1978c235faebbad3e49668a2a59782e71e2fe26e | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Wojciech Różowski
-/
module
prelude
public import Std.Data.DTreeMap.Raw.Slice
/-!
This module provides slice notation for `TreeMap` slices and implements an iterator
for those slices.... |
23,957 | lean_file_chunk | 9213a8046ebdaa18f37dbb3e6800c0afaf1c73b3346a330f67b547ac211d36a2 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Robin Arnez. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Robin Arnez, Markus Himmel, Paul Reichert
-/
module
prelude
public import Std.Data.ExtDTreeMap.Lemmas
public import Std.Data.ExtTreeMap.Basic
import Init.Data.List.Pairwise
@[expose] pu... |
23,971 | lean_file_chunk | 8a6db68ca3d46dd1d5790b93f2942439379275cee22105c01776ba009436f167 | lean_source_file | lean_toolchain_source_file_chunks | theorem mem_of_mem_insertIfNew [TransCmp cmp] {k a : α} {v : β} :
a ∈ t.insertIfNew k v → cmp k a ≠ .eq → a ∈ t :=
ExtDTreeMap.contains_of_contains_insertIfNew
/-- This is a restatement of `mem_of_mem_insertIfNew` that is written to exactly match the
proof obligation in the statement of `get_insertIfNew`. -/
the... |
23,995 | lean_file_chunk | f2e6b50b0c8bdb19aae609a0ab139e57e3bfdd38fb7d5c37c33a45fb2c1eca90 | lean_source_file | lean_toolchain_source_file_chunks | simpa only [ext_iff] using ExtDTreeMap.Const.insertManyIfNewUnit_list_eq_empty_iff
@[simp]
theorem getElem?_insertManyIfNewUnit_list [TransCmp cmp] [BEq α] [LawfulBEqCmp cmp]
{l : List α} {k : α} :
(insertManyIfNewUnit t l)[k]? = if k ∈ t ∨ l.contains k then some () else none :=
ExtDTreeMap.Const.get?_insert... |
23,956 | lean_file_chunk | 1be1b455ae29ae5396dc926783d2eacc67418157a7bbb524b3f5fd48c78c81e9 | lean_source_file | lean_toolchain_source_file_chunks | /- get! -/
@[deprecated getElem!_inter (since := "2025-12-10")]
theorem get!_inter [TransCmp cmp] {k : α} [Inhabited β] :
(t₁ ∩ t₂).get! k = if k ∈ t₂ then t₁.get! k else default :=
ExtDTreeMap.Const.get!_inter
@[deprecated getElem!_inter_of_mem_right (since := "2025-12-10")]
theorem get!_inter_of_mem_right [Tra... |
23,957 | lean_file_chunk | 33f24dcee9b6bfd6e09e72c9a1603196ff3cd86105c04f7f251717c205901642 | lean_source_file | lean_toolchain_source_file_chunks | theorem getKeyD_modify [TransCmp cmp] {k k' fallback : α} {f : β → β} :
(modify t k f).getKeyD k' fallback =
if cmp k k' = .eq then
if k ∈ t then k else fallback
else
t.getKeyD k' fallback :=
ExtDTreeMap.Const.getKeyD_modify
theorem getKeyD_modify_self [TransCmp cmp] [Inhabited α] {k ... |
23,972 | lean_file_chunk | 7c797f9912433d5b962e6711259714ae3acd3dc2c23098b18b36f53f4eb27fce | lean_source_file | lean_toolchain_source_file_chunks | (modify t k f |>.minKeyD fallback) = t.minKeyD fallback :=
ExtDTreeMap.Const.minKeyD_modify_eq_minKeyD
theorem compare_minKeyD_modify_eq [TransCmp cmp] {k f fallback} :
cmp (modify t k f |>.minKeyD fallback) (t.minKeyD fallback) = .eq :=
ExtDTreeMap.Const.compare_minKeyD_modify_eq
@[simp]
theorem ordCompare_m... |
17,802 | lean_file_chunk | a2dc723de5bf278caab4d9bc942194a448309822d768c53f7fe49227534e5cee | lean_source_file | lean_toolchain_source_file_chunks | (h : ∀ k, t₁.contains k = t₂.contains k) : t₁ = t₂ :=
ext (ExtDTreeMap.Const.ext_contains_unit h)
theorem ext_mem_unit [TransCmp cmp] [LawfulEqCmp cmp] {t₁ t₂ : ExtTreeMap α Unit cmp}
(h : ∀ k, k ∈ t₁ ↔ k ∈ t₂) : t₁ = t₂ :=
ext (ExtDTreeMap.Const.ext_mem_unit h)
theorem toList_inj [TransCmp cmp] {t₁ t₂ : ExtT... |
23,141 | lean_file_chunk | d8f64cc3cb2cb574daf32a7658ee7438ee2e120758ddffad07043272089ae8c6 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Robin Arnez. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Robin Arnez, Markus Himmel, Paul Reichert
-/
module
prelude
public import Std.Data.ExtDTreeMap.Basic
@[expose] public section
/-!
# Extensional tree maps
This file develops the type `... |
2,397 | lean_file_chunk | e03a678366c4c4a5bb5b436f059c8f893ccd6894f475b0494abda5ba52af4c45 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
public import Std.Data.TreeMap.Basic
public import Std.Data.TreeMap.Raw.Basic
public import Std.Data.DTreeMap.AdditionalOperations
@[expose] public sec... |
618 | lean_file_chunk | f309ec668b488b72170521be13d7ed1816b0db7ba7c9d0db10f59d3b82422459 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Wojciech Różowski
-/
module
prelude
public import Std.Data.DTreeMap.DecidableEquiv
public import Std.Data.TreeMap.Basic
public section
/-!
# Decidable equivalence for `TreeMap`
-/
o... |
23,993 | lean_file_chunk | d748025ea72c957200321932edb8c0236a1ce800858f0bb6cf6347998cec10c6 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel, Paul Reichert
-/
module
prelude
import Std.Data.DTreeMap.Lemmas
public import Std.Data.TreeMap.AdditionalOperations
public import Init.Data.Array.Perm
import Init.Data.L... |
23,989 | lean_file_chunk | e25890e965fbf59e08d2754ce52cbc5de531932d9fbc467a1e68898662ad133c | lean_source_file | lean_toolchain_source_file_chunks | DTreeMap.getKeyD_eq_of_contains h'
theorem getKeyD_eq_of_mem [TransCmp cmp] [LawfulEqCmp cmp] {k fallback : α} (h' : k ∈ t) :
t.getKeyD k fallback = k :=
DTreeMap.getKeyD_eq_of_contains h'
@[simp, grind =]
theorem isEmpty_insertIfNew [TransCmp cmp] {k : α} {v : β} :
(t.insertIfNew k v).isEmpty = false :=
... |
23,993 | lean_file_chunk | dc9e42a8290bfe54d3c76312a4d4b23155dc172256767bac6bbd000055f2fd33 | lean_source_file | lean_toolchain_source_file_chunks | getKey? (insertManyIfNewUnit t l) k = none :=
DTreeMap.Const.getKey?_insertManyIfNewUnit_list_of_not_mem_of_contains_eq_false
not_mem contains_eq_false
theorem getKey?_insertManyIfNewUnit_list_of_not_mem_of_mem [TransCmp cmp]
{l : List α} {k k' : α} (k_eq : cmp k k' = .eq)
(not_mem : ¬ k ∈ t) (distinct :... |
23,985 | lean_file_chunk | 59e25b156a260708d87fd75db7d5e1a9a0888b74b258eb993fa25a5b537447d9 | lean_source_file | lean_toolchain_source_file_chunks | @[simp]
theorem contains_inter [TransCmp cmp] {k : α} :
(t₁ ∩ t₂).contains k = (t₁.contains k && t₂.contains k) :=
DTreeMap.contains_inter
/- mem -/
@[simp]
theorem mem_inter_iff [TransCmp cmp] {k : α} :
k ∈ t₁ ∩ t₂ ↔ k ∈ t₁ ∧ k ∈ t₂ :=
DTreeMap.mem_inter_iff
theorem not_mem_inter_of_not_mem_left [TransCm... |
23,968 | lean_file_chunk | a761b2b9b3cc9d78491ed8190d48d26b2b3c97c217ddf7f5e8a98125955f095d | lean_source_file | lean_toolchain_source_file_chunks | theorem getKey!_alter [TransCmp cmp] [Inhabited α] {k k' : α} {f : Option β → Option β} :
(alter t k f).getKey! k' =
if cmp k k' = .eq then
if (f t[k]?).isSome then k else default
else
t.getKey! k' :=
DTreeMap.Const.getKey!_alter
theorem getKey!_alter_self [TransCmp cmp] [Inhabited α]... |
23,950 | lean_file_chunk | 430af54a695026cd8427b980849d23dfa4fbc064df6a908b7390f7eea96441fc | lean_source_file | lean_toolchain_source_file_chunks | t.minKey! = t.keys.head! :=
DTreeMap.minKey!_eq_head!_keys
theorem minKey!_eq_getElem!_keysArray [TransCmp cmp] [Inhabited α] :
t.minKey! = t.keysArray[0]! :=
DTreeMap.minKey!_eq_getElem!_keysArray
theorem minKey!_modify [TransCmp cmp] [Inhabited α] {k f}
(he : (modify t k f).isEmpty = false) :
(modif... |
23,937 | lean_file_chunk | 7b0ab56a3f8f3391808c28ab6462b2a5641a370184eab63d43ca09922113c3c9 | lean_source_file | lean_toolchain_source_file_chunks | theorem ordCompare_maxKey!_modify_eq [Ord α] [TransOrd α] {t : TreeMap α β} [Inhabited α] {k f} :
compare (modify t k f).maxKey! t.maxKey! = .eq :=
compare_maxKey!_modify_eq
theorem maxKey!_alter_eq_self [TransCmp cmp] [Inhabited α] {k f}
(he : (alter t k f).isEmpty = false) :
(alter t k f).maxKey! = k ↔... |
18,254 | lean_file_chunk | ef1649915d332aba17ae285786abc64129b8c26e85b3faa8d83b9aaa192b8eea | lean_source_file | lean_toolchain_source_file_chunks | t.toList.filterMap (fun p => (f p.1 p.2).map (fun x => (p.1, x))) :=
DTreeMap.Const.toList_filterMap
@[simp, grind =]
theorem toArray_filterMap {f : α → β → Option γ} :
(t.filterMap f).toArray =
t.toArray.filterMap (fun p => (f p.1 p.2).map (fun x => (p.1, x))) :=
DTreeMap.Const.toArray_filterMap
@[grin... |
18,650 | lean_file_chunk | 5eac377b61fb5016702c9139d27883db4de9e9c0be8a0fc0641c4ce0d1dde85a | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel, Paul Reichert
-/
module
prelude
public import Std.Data.DTreeMap.Basic
@[expose] public section
/-!
# Tree maps
This file develops the type `Std.TreeMap` of tree maps.... |
479 | lean_file_chunk | af93b8d0cf8fcbeab5e7ad51c8db87725fafcd38223d7aa245531d794acdbe47 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
public import Std.Data.TreeMap.Raw.Basic
public import Std.Data.TreeMap.Raw.AdditionalOperations
public import Std.Data.TreeMap.Raw.Lemmas
public import... |
2,271 | lean_file_chunk | 85e7de95bef66686e885ec3848277f6d1805249b4e5d160887a1c89fa3f3b6a2 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Wojciech Różowski
-/
module
prelude
public import Std.Data.TreeMap.Basic
public import Std.Data.DTreeMap.Iterator
import Init.Data.Iterators.Lemmas.Combinators.FilterMap
/-!
# Iterato... |
6,130 | lean_file_chunk | ca17499eed4da1ea6cf30b2c07f10594dc23992d111b6b82390e44ac64ec077c | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Wojciech Różowski
-/
module
prelude
public import Std.Data.TreeMap.Raw.Slice
public import Std.Data.TreeMap.Basic
/-!
This module provides slice notation for `TreeMap` slices and impl... |
369 | lean_file_chunk | eb58a416dc10cb545f268310bcc36e83392e0a5b05e69e54eadcc9622683903d | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
public import Std.Data.Iterators.Lemmas.Monadic
public import Std.Data.Iterators.Lemmas.Combinators
public import Std.Data.Iterators.Lemmas.Producers
pu... |
265 | lean_file_chunk | a887ab37f5993c84b0664fc77e5a272d98a2cce6fd009adf331d99bf261f2af6 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2026 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Std.Data.Iterators.Consumers.Monadic
public import Std.Data.Iterators.Consumers.Set |
514 | lean_file_chunk | 0cc3419bef83b807526396bc227fad8cbcce47d67685f03919f9d4413995fe8d | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
public import Std.Data.Iterators.Producers.Monadic
public import Std.Data.Iterators.Producers.Array
public import Std.Data.Iterators.Producers.Vector
pu... |
483 | lean_file_chunk | 17259baa29721317a588d9e42b7ab8983189d99bf0560744a7a5fae11806c3c1 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
public import Std.Data.Iterators.Combinators.Monadic
public import Std.Data.Iterators.Combinators.TakeWhile
public import Std.Data.Iterators.Combinators... |
1,693 | lean_file_chunk | 93579e2d63103e56bbf72e6c09030da2bf6ba764dce6e4fbe3c85aef0bcad9ac | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Init.Data.LawfulHashable
public import Std.Data.Internal.List.Associative
public import Std.Data.DHashMap.Internal.Defs
public section
/... |
2,220 | lean_file_chunk | 19ab76ac95b78e868afae7d18adcea648c11d3c6f23bd3e4f79f6a1cfd5542e3 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Init.Data.UInt.Bitwise
import Init.ByCases
import Init.Data.UInt.Lemmas
public section
/-!
This is an internal implementation file of th... |
23,964 | lean_file_chunk | 5fbd3f6f1aa744bb77a6fb4baf9668e92138661311b541256c611fa04490ad93 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Init.Data.Array.TakeDrop
public import Std.Data.DHashMap.Basic
import all Std.Data.DHashMap.Internal.Defs
public import Std.Data.DHashMap.... |
9,667 | lean_file_chunk | 80c9ef8c53867d6ce68db48b027178343f70e5cec7499d7ab62c05b94c44b75e | lean_source_file | lean_toolchain_source_file_chunks | simp only [AssocList.contains_eq] at h
simp only [AssocList.modify_eq_alter, AssocList.contains_eq,
containsKey_of_perm AssocList.toList_alter, ← modifyKey_eq_alterKey,
containsKey_modifyKey, h, reduceIte]
· rfl
theorem modify_eq_modifyₘ [BEq α] [Hashable α] [LawfulBEq α] (m : Raw₀ α β) (a : ... |
23,985 | lean_file_chunk | e6e10fe3a9cd582878b61f1560fc34b7575b643318922b7bd9e53cbced6ecbc6 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2018 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro, Markus Himmel
-/
module
prelude
public import Init.Data.Array.Lemmas
public import Std.Data.DHashMap.RawDef
public import Std.Data.Internal.L... |
5,375 | lean_file_chunk | fb132885550857b8a1c1a87833f62ab2f79a4d7cb956d78b88082be192a983d9 | lean_source_file | lean_toolchain_source_file_chunks | if m₁.1.size ≠ m₂.1.size then false else m₁.1.all (fun k v => m₂.get? k == some v)
/-- Internal implementation detail of the hash map -/
@[inline] def diff [BEq α] [Hashable α] (m₁ m₂ : Raw₀ α β) : Raw₀ α β :=
if m₁.1.size ≤ m₂.1.size then m₁.filter (fun k _ => !m₂.contains k) else (eraseManyEntries m₁ m₂.1).1
sec... |
23,942 | lean_file_chunk | ea59752b10546205c3ccab683540d9ba449327527f8f561cb8d0f999d0093ff0 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
import all Std.Data.Internal.List.Associative
import all Std.Data.DHashMap.Internal.Defs
public import Std.Data.DHashMap.Internal.WF
import all Std.Data... |
23,926 | lean_file_chunk | 83b8515c1372d1916460f85d1fed5983afbf549a3f1645beb010c13887b37b2d | lean_source_file | lean_toolchain_source_file_chunks | theorem get!_erase [EquivBEq α] [LawfulHashable α] [Inhabited β] (h : m.1.WF) {k a : α} :
get! (m.erase k) a = if k == a then default else get! m a := by
simp_to_model [erase, Const.get!] using List.getValue!_eraseKey
theorem get!_erase_self [EquivBEq α] [LawfulHashable α] [Inhabited β] (h : m.1.WF) {k : α} :
... |
23,953 | lean_file_chunk | e7ce074c7ff8562e02928f7e225077142a37860778b8797b447a86ae4e44e9ab | lean_source_file | lean_toolchain_source_file_chunks | (∀ k ∈ m.1.keys, p k) ↔ ∀ (k : α) (h : m.contains k), p (m.getKey k h) := by
simp_to_model [keys, getKey, contains] using List.forall_mem_keys_iff_forall_containsKey_getKey
theorem contains_of_mem_keys [EquivBEq α] [LawfulHashable α] (h : m.1.WF) {k : α}
(h' : k ∈ m.1.keys) : m.contains k :=
(contains_keys m h... |
23,950 | lean_file_chunk | 4ec6a2f00485fbcce9cebfaffeedfb165a61398eac993d1e68f4a99b5f60c367 | lean_source_file | lean_toolchain_source_file_chunks | rw [forIn_eq_forIn_toList, forIn_eq_forIn']
induction Raw.Const.toList m.1 with
| nil => simp
| cons hd tl ih =>
simp only [List.forIn'_cons, Id.run_bind, List.all_cons]
by_cases h : p hd.fst hd.snd = false
· simp [h]
· simp only at ih
simp [h, ih]
theorem all_eq_true [EquivBEq α] [LawfulHa... |
23,977 | lean_file_chunk | 29c387d48c4af09ed24a53a64cc70c8e788aafad355d21328670ce2a5f8cfa92 | lean_source_file | lean_toolchain_source_file_chunks | getKey (insertManyIfNewUnit m l).1 k h' = getKey m k contains := by
simp_to_model [Const.insertManyIfNewUnit, getKey]
using List.getKey_insertListIfNewUnit_of_contains
theorem getKey_insertManyIfNewUnit_list_of_contains_eq_false_of_mem [EquivBEq α] [LawfulHashable α]
(h : m.1.WF) {l : List α}
{k k' : α} ... |
23,963 | lean_file_chunk | 619b34f36c69623cee9d327f9efad53d2ad8cea6f4aa7d715f17cd286f989805 | lean_source_file | lean_toolchain_source_file_chunks | {l : List α} {k fallback : α}
(h' : l.contains k = false) :
getKeyD (insertManyIfNewUnit (emptyWithCapacity : Raw₀ α (fun _ => Unit)) l).1 k fallback = fallback := by
exact getKeyD_insertManyIfNewUnit_list_of_contains_eq_false_of_contains_eq_false
_ Raw.WF.emptyWithCapacity₀ contains_emptyWithCapacity h'
... |
23,991 | lean_file_chunk | 0c962f60a5c7b6daecc339936afb8c265d4960dcbd8576a69e72dd2db8691da9 | lean_source_file | lean_toolchain_source_file_chunks | (h : m₂.contains k = false) :
(m₁.inter m₂).contains k = false := by
revert h
simp_to_model [inter, contains] using containsKey_filter_containsKey_eq_false_of_containsKey_eq_false_right
/- Equiv -/
theorem Equiv.inter_left {m₃ : Raw₀ α β} [EquivBEq α] [LawfulHashable α]
(h₁ : m₁.val.WF) (h₂ : m₂.val.WF) (... |
23,948 | lean_file_chunk | 9c0d2a9d2555653a4a431daeef944604b915a9484c4c9d00256aaae56c7b0e62 | lean_source_file | lean_toolchain_source_file_chunks | (h₂ : m₂.val.WF) {k fallback : α} (h : m₂.contains k = false) :
(m₁.diff m₂).getKeyD k fallback = m₁.getKeyD k fallback := by
revert h
simp_to_model [contains, diff, getKeyD] using List.getKeyD_filter_not_contains_map_fst_of_contains_eq_false_right
theorem getKeyD_diff_of_contains_right [EquivBEq α] [LawfulHas... |
23,980 | lean_file_chunk | e56ccbb019543655dd1b1d5fca58f5f86e28c8a401e956f05f4d73cab260d9a6 | lean_source_file | lean_toolchain_source_file_chunks | theorem getKey?_modify_self (h : m.1.WF) {k : α} {f : β k → β k} :
(m.modify k f).getKey? k = if m.contains k then some k else none := by
simp_to_model [modify, getKey?, contains] using List.getKey?_modifyKey_self
theorem getKey!_modify (h : m.1.WF) [Inhabited α] {k k' : α} {f : β k → β k} :
(m.modify k f).g... |
23,975 | lean_file_chunk | eb83059da9cb9d6d48f792089a4bd0fe501cc7aaae8e1d0f68cec13aef6dcd8c | lean_source_file | lean_toolchain_source_file_chunks | theorem contains_filterMap_iff [EquivBEq α] [LawfulHashable α]
{f : α → β → Option γ} {k : α} (h : m.1.WF) :
(m.filterMap f).contains k = true ↔ ∃ (h' : m.contains k = true),
(f (m.getKey k h') (Const.get m k h')).isSome := by
simp_to_model [filterMap, contains, getKey, Const.get] using List.Const.conta... |
2,847 | lean_file_chunk | 2f97cc05a28f32dbdee2f9a5cfbb2e87b9b1d9c1638a694b0454761a4223cfb8 | lean_source_file | lean_toolchain_source_file_chunks | {f : α → β → γ} {k : α} (h : m.1.WF) {h'} :
Const.get (m.map f) k h' = f k (Const.get m k (contains_of_contains_map m h h')) := by
simp [get_map' m h, getKey_eq m h]
/-- Variant of `get!_map` that holds with `EquivBEq` (i.e. without `LawfulBEq`). -/
theorem get!_map' [EquivBEq α] [LawfulHashable α] [Inhabited γ]... |
11,692 | lean_file_chunk | 5eeb91add0bb0d04e78dc79d3753449bc72a33f0035202fb9ad32f3472607c59 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Std.Data.DHashMap.Basic
import all Std.Data.DHashMap.Basic
public section
/-!
This is an internal implementation file of the hash map. U... |
23,987 | lean_file_chunk | 8686de6adfcf90d3ce0f0682f27fedc9adc4590cb2e53f05aebdbeecd257740b | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
import all Std.Data.Internal.List.Associative
import all Std.Data.DHashMap.Raw
import all Std.Data.DHashMap.Internal.Defs
public import Std.Data.DHashMa... |
23,979 | lean_file_chunk | 2987eebf9a4a4547891e09f9a097877f8864aede8c1138a12041bc9542250a27 | lean_source_file | lean_toolchain_source_file_chunks | m.getKey!ₘ a = List.getKey! a (toListModel m.1.buckets) := by
rw [getKey!ₘ, getKey?ₘ_eq_getKey? hm, List.getKey!_eq_getKey?]
theorem getKey!_eq_getKey! [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α] [Inhabited α]
{m : Raw₀ α β} (hm : Raw.WFImp m.1) {a : α} :
m.getKey! a = List.getKey! a (toListModel m.... |
23,917 | lean_file_chunk | 27f9f9745461660c5cef5e6d48f0bd41c34575ac0b9d29cb36d8737f72fb257d | lean_source_file | lean_toolchain_source_file_chunks | (h : Raw.WFImp m.1) : Raw.WFImp (m.erase a).1 := by
rw [erase_eq_eraseₘ]
exact wfImp_eraseₘ h
/-! # `filterₘ` -/
theorem toListModel_filterₘ {m : Raw₀ α β} {f : (a : α) → β a → Bool} :
Perm (toListModel (m.filterₘ f).1.buckets)
((toListModel m.1.buckets).filter fun p => f p.1 p.2) :=
toListModel_updat... |
3,003 | lean_file_chunk | 6792b76cf01e7f5c88267d9f870d825a1ea875ff94b0b752675d81cc8a69e312 | lean_source_file | lean_toolchain_source_file_chunks | (Const.insertMany m l).1 = l.foldl (init := m) fun a b => a.insert b.1 b.2 := by
simpa [Const.insertMany] using (List.foldl_hom Subtype.val (by simp)).symm
/-! # `Const.insertListIfNewUnitₘ` -/
theorem Const.toListModel_insertListIfNewUnitₘ [BEq α] [Hashable α] [EquivBEq α] [LawfulHashable α]
{m : Raw₀ α (fun _... |
11,320 | lean_file_chunk | 0797bc772ca5c7773ebde5e6bdceadcbc6ea8a641ab24919f89f9fc654f5762e | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Std.Data.DHashMap.Internal.AssocList.Basic
import all Std.Data.DHashMap.Internal.AssocList.Basic
public import Std.Data.Internal.List.Asso... |
10,226 | lean_file_chunk | 028839906870eed89a353796e375b301f9d114749abc3f0c2618fb02b2eda60c | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2019 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro, Markus Himmel
-/
module
prelude
public import Init.NotationExtra
public section
/-!
This is an internal implementation file of the hash map... |
1,978 | lean_file_chunk | ec50f889181730fe270157d777ef17729eca794a985ef2d6daaaf3ad5964604a | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Paul Reichert
-/
module
prelude
import Init.Data.Nat.Lemmas
public import Init.Data.Iterators.Consumers
public import Std.Data.DHashMap.Internal.AssocList.Basic
/-!
# Iterators on a... |
1,219 | lean_file_chunk | 7555215027d103809baa82efc01b07973983b2572722c65789b9fa0b02ef6108 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Init.BinderPredicates
public import Init.NotationExtra
public section
/-!
This is an internal implementation file of the hash map. Users... |
23,997 | lean_file_chunk | 89eada171cbec1d9811447861aeb0a6091d61c316f3557e9f9276040ea6cd180 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel
-/
module
prelude
public import Init.Data.Option.Attach
public import Init.Data.List.Perm
public import Std.Data.Internal.List.Defs
import all Std.Data.Internal.List.Defs... |
23,978 | lean_file_chunk | 8cbeb43bd1b036c8e7ae916bc6b2b540c0ac1607fcef4f1177ae219449e1305e | lean_source_file | lean_toolchain_source_file_chunks | (h : containsKey a l = false) : getValueCast? a l = none := by
rwa [← Option.not_isSome_iff_eq_none, ← containsKey_eq_isSome_getValueCast?, Bool.not_eq_true]
theorem containsKey_congr [BEq α] [PartialEquivBEq α] {l : List ((a : α) × β a)} {a b : α}
(h : a == b) : containsKey a l = containsKey b l := by
simp [c... |
23,983 | lean_file_chunk | e06ba6b51f519f3fa6eaf1e80ba0e1d50fd53658f45c17280b4702816b7090cc | lean_source_file | lean_toolchain_source_file_chunks | theorem getKeyD_eq_fallback [BEq α] [EquivBEq α] {l : List ((a : α) × β a)} {a fallback : α}
(h : containsKey a l = false) : getKeyD a l fallback = fallback := by
rw [containsKey_eq_isSome_getKey?, Bool.eq_false_iff, ne_eq,
Option.not_isSome_iff_eq_none] at h
rw [getKeyD_eq_getKey?, h, Option.getD_none]
th... |
23,942 | lean_file_chunk | 4d97619b493d403f7b5c11a362f24a4bee11303a35bd28cff3d6fdff0ae0fd93 | lean_source_file | lean_toolchain_source_file_chunks | simp [getValue!_insertEntry, BEq.rfl]
theorem getValueD_insertEntry {β : Type v} [BEq α] [PartialEquivBEq α] {l : List ((_ : α) × β)}
{k a : α} {fallback v : β} : getValueD a (insertEntry k v l) fallback =
if k == a then v else getValueD a l fallback := by
simp [getValueD_eq_getValue?, getValue?_insertEntr... |
23,960 | lean_file_chunk | 347a6d43edfeda55b87064fc8ad82951903797dbd7466587b162c7d174823c82 | lean_source_file | lean_toolchain_source_file_chunks | rw [containsKey_congr hka, containsKey_eraseKey_self hl]
theorem containsKey_eraseKey_of_false [BEq α] [PartialEquivBEq α] {l : List ((a : α) × β a)}
{k a : α} (hka : (k == a) = false) : containsKey a (eraseKey k l) = containsKey a l := by
simp [containsKey_eq_isSome_getEntry?, getEntry?_eraseKey_of_false hka]
... |
23,975 | lean_file_chunk | 04507e043a3377318576490d774103b974400b6aa318d922cff56f117865c834 | lean_source_file | lean_toolchain_source_file_chunks | ⟨k, v⟩ ∈ l ↔ getValueCast? k l = some v := by
rw [mem_iff_getEntry?_eq_some h, getValueCast?_eq_getEntry?, Option.dmap_eq_some]
refine ⟨?_, ?_⟩
· intro hkv
refine ⟨⟨k, v⟩, hkv, by simp⟩
· rintro ⟨⟨k', v'⟩, hkv, hkv'⟩
obtain rfl := beq_iff_eq.1 (beq_of_getEntry?_eq_some hkv)
simpa [hkv]
theorem find... |
23,956 | lean_file_chunk | 64ba5b91fa961a7d089f656a61e8c304e0e657e69ac260ddda95f76c401c7e0d | lean_source_file | lean_toolchain_source_file_chunks | (distinct_l : DistinctKeys l)
(distinct_toInsert : toInsert.Pairwise (fun a b => (a.1 == b.1) = false))
(distinct_both : ∀ (a : α), containsKey a l → (toInsert.map Sigma.fst).contains a = false) :
(insertList l toInsert).length = l.length + toInsert.length := by
simpa using (perm_insertList distinct_l dis... |
23,949 | lean_file_chunk | 62a22e6ef43c5a4f1acf5b2e9f1e4830c6c6ad36363ca9b05d8916811aa02cac | lean_source_file | lean_toolchain_source_file_chunks | have hc := h hd.1 (by rw [containsKey_cons_self])
suffices tl.length ≤ (eraseKey hd.1 l₂).length by
rw [List.length_eraseKey, hc] at this
simp only [↓reduceIte] at this
simp only [List.length_cons, ge_iff_le]
have : l₂.length > 0 := by cases l₂ <;> simp_all
omega
apply ih
· rw ... |
23,973 | lean_file_chunk | 1d6c5b752e631fbc5e4e37ce4da7ef2c32c99a915c7cd28d0dd07d7ffa29cac4 | lean_source_file | lean_toolchain_source_file_chunks | theorem getKey!_insertListIfNewUnit_of_contains_eq_false_of_contains_eq_false [BEq α] [EquivBEq α]
[Inhabited α] {l : List ((_ : α) × Unit)} {toInsert : List α} {k : α}
(contains_eq_false : containsKey k l = false)
(contains_eq_false' : toInsert.contains k = false) :
getKey! k (insertListIfNewUnit l toI... |
23,931 | lean_file_chunk | 3a57231866a577e0b1bfed184d8d2cb9cb03fe1ea15c9d8cc8f348e054623f40 | lean_source_file | lean_toolchain_source_file_chunks | have := getValue?_alterKey k k' f l hl
rw [getValue?_eq_some_getValue hc] at this
split
next heq =>
apply Option.some_inj.mp
simp_all
next heq =>
apply Option.some_inj.mp
simp_all only [Bool.false_eq_true, ite_false]
rw [getValue?_eq_some_getValue]
theorem getValue_alterKey_self [EquivBEq ... |
23,974 | lean_file_chunk | b8e9fe9d241bd55a4aa595e1f3715c7db4a0d14ca97955b88b300ee43bd90825 | lean_source_file | lean_toolchain_source_file_chunks | suffices (getEntry? k (List.filter (fun p => containsKey p.fst l₂) l₁)) = none by simp [this]
rw [getEntry?_filter]
simp [Option.filter]
split
case h_1 _ val heq =>
have := PartialEquivBEq.symm <| @beq_of_getEntry?_eq_some α β _ l₁ k val heq
simp at h
rw [@containsKey_congr _ _ _ _ l₂... |
23,992 | lean_file_chunk | 95a7ace76b321595ca1ead024f13d3d5a3cd5249e46e940b5cdeeedd305e6bac | lean_source_file | lean_toolchain_source_file_chunks | apply getValueCastD_eq_fallback
apply containsKey_filter_not_contains_of_contains_right
· exact dl₁
· exact h
case isFalse h =>
rw [getValueCastD_eq_getValueCast?, getValueCastD_eq_getValueCast?]
congr 1
rw [Bool.not_eq_true] at h
rw [getValueCast?_filter_not_contains, h]
simp [Bool.fa... |
23,983 | lean_file_chunk | 2223b1f2c6ec7312c79271c0ec5775b98c98e113021e69caf96edf6942e43f06 | lean_source_file | lean_toolchain_source_file_chunks | · exact dl₁
· exact hyp
theorem List.getValue?_filter_containsKey {β : Type v} [BEq α] [EquivBEq α]
{l₁ l₂ : List ((_ : α) × β)} {k : α}
(dl₁ : DistinctKeys l₁) :
getValue? k (List.filter (fun p => containsKey p.fst l₂) l₁) =
if containsKey k l₂ = true then getValue? k l₁ else none := by
simp only ... |
23,980 | lean_file_chunk | 400054927ba0ae4bae0d79a18c9c9fc59e4dc4d2c3d5b1ec7c405877d073efa4 | lean_source_file | lean_toolchain_source_file_chunks | theorem Const.map_insertEntry_perm_filter_map {β : Type v} [BEq α] [EquivBEq α]
(k : α) (v : β) {l : List ((_ : α) × β)} (hl : DistinctKeys l) :
(List.map (fun x => (x.fst, x.snd)) (insertEntry k v l)).Perm <|
(k, v) :: List.filter (fun x => !k == x.fst) (List.map (fun x => (x.fst, x.snd)) l) := by
appl... |
23,945 | lean_file_chunk | c0220f7106d8ff291cce2aa3d37be1b510f00e36974a70ad0c32dc6c5437923c | lean_source_file | lean_toolchain_source_file_chunks | (∀ k, containsKey k l = false) ↔ l = [] := by
constructor
case mp =>
intro hyp
rw [List.eq_nil_iff_forall_not_mem]
intro a
specialize hyp a.fst
rw [List.containsKey_eq_false_iff_forall_mem_keys] at hyp
specialize hyp a.fst
have : (a.fst == a.fst) → a.fst ∉keys l := by
intro h₁ h₂
... |
23,994 | lean_file_chunk | d391fc43d1cdc7f4d69a4a89cd8483d78c742d380885c24ca7ef934f70899509 | lean_source_file | lean_toolchain_source_file_chunks | forall_mem_iff_forall_contains_getKey_getValue (p := fun a b => f a b = true) distinct]
theorem length_filter_key_eq_length_iff {β : Type v} [BEq α] [EquivBEq α]
{f : (_ : α) → Bool} {l : List ((_ : α) × β)} (distinct : DistinctKeys l) :
(l.filter fun p => f p.1).length = l.length ↔
∀ (a : α) (h : contai... |
23,979 | lean_file_chunk | 64cca5368f1c092a482921966e35e7bf09e1c86ee71528ba65993aaa88b99ec5 | lean_source_file | lean_toolchain_source_file_chunks | apply containsKey_minKey? hd.eraseKey hkme
theorem minKey?_le_minKey?_eraseKey [Ord α] [TransOrd α] [BEq α] [LawfulBEqOrd α] {k km kme}
{l : List ((a : α) × β a)} (hd : DistinctKeys l)
(hkme : (eraseKey k l |> minKey?) = some kme)
(hkm : (minKey? l |>.get <|
isSome_minKey?_of_isSome_minKey?_eraseKey ... |
23,947 | lean_file_chunk | 0a43c3ec2b647461e85436b885f483b8b339d299cb096e394ed5cc0fa5e96110 | lean_source_file | lean_toolchain_source_file_chunks | theorem minKey!_le_minKey!_erase [Ord α] [TransOrd α] [BEq α] [LawfulBEqOrd α] [Inhabited α]
{l : List ((a : α) × β a)} (hd : DistinctKeys l) {k} (he : (eraseKey k l).isEmpty = false) :
compare (minKey! l) (eraseKey k l |> minKey!) |>.isLE := by
simpa only [minKey_eq_minKey!] using minKey_le_minKey_erase hd (... |
23,948 | lean_file_chunk | 1b21e990b940b92a4cea0be91618b16500e4a30e548baf1258f4e460afc00b01 | lean_source_file | lean_toolchain_source_file_chunks | theorem maxKey?_le_of_containsKey [Ord α] [TransOrd α] [BEq α] [LawfulBEqOrd α] {k km}
{l : List ((a : α) × β a)} (hd : DistinctKeys l) (hc : containsKey k l)
(hkm : (maxKey? l |>.get <| isSome_maxKey?_of_containsKey hc) = km) :
compare k km |>.isLE :=
letI : Ord α := .opposite inferInstance
(minKey?_le... |
15,551 | lean_file_chunk | f33bc9aec8bf056626dd5b12c4a900aca0324b295f9b4135b0f911e834d376ad | lean_source_file | lean_toolchain_source_file_chunks | {l : List ((_ : α) × β)} (hd : DistinctKeys l) {k f} (he : (modifyKey k f l).isEmpty = false) :
(modifyKey k f l |> maxKey!) = if (maxKey! l) == k then k else (maxKey! l) :=
letI : Ord α := .opposite inferInstance
minKey!_modifyKey hd he
theorem maxKey!_modifyKey_eq_maxKey! [Ord α] [TransOrd α] [BEq α] [Lawful... |
727 | lean_file_chunk | fc8604de52a9d74e13bec79497b9bc692bf4c914cbc19fc0146632d1f4cc3ab0 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Wojciech Różowski
-/
module
prelude
public import Std.Data.TreeMap.Raw.DecidableEquiv
public import Std.Data.TreeSet.Raw.Basic
public section
/-!
# Decidable equivalence for `TreeSe... |
23,984 | lean_file_chunk | b384861878c3641be4e7cd24e0e03118ca486eab3978c654238f1a97e3523d99 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2025 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel, Paul Reichert
-/
module
prelude
import Std.Data.TreeMap.Raw.Lemmas
import Std.Data.DTreeMap.Raw.Lemmas
public import Std.Data.TreeSet.Raw.Basic
public import Init.Data.L... |
23,967 | lean_file_chunk | 89436e5eabcc60e7fdebae600d29ed8bb5ff040bd20c69d46f45e8ac87780f6a | lean_source_file | lean_toolchain_source_file_chunks | TreeMap.Raw.contains_inter h₁ h₂
/- mem -/
@[simp]
theorem mem_inter_iff [TransCmp cmp] (h₁ : t₁.WF)
(h₂ : t₂.WF) {k : α} :
k ∈ t₁ ∩ t₂ ↔ k ∈ t₁ ∧ k ∈ t₂ :=
TreeMap.Raw.mem_inter_iff h₁ h₂
theorem not_mem_inter_of_not_mem_left [TransCmp cmp]
(h₁ : t₁.WF) (h₂ : t₂.WF) {k : α}
(not_mem : k ∉ t₁) :
... |
23,988 | lean_file_chunk | fcc81e958b2029eac1c70b18b176583a6ec628a5224eed442863af5ebcf02a43 | lean_source_file | lean_toolchain_source_file_chunks | TreeMap.Raw.minKey?_insertIfNew h
@[simp] theorem min?_toList [TransCmp cmp] [Min α]
[LE α] [LawfulOrderCmp cmp] [LawfulOrderMin α]
[LawfulOrderLeftLeaningMin α] [LawfulEqCmp cmp]
(h : t.WF) :
t.toList.min? = t.min? :=
TreeMap.Raw.min?_keys h
@[simp] theorem head?_toList [TransCmp cmp] [Min α]
[... |
13,699 | lean_file_chunk | 5a64f7959387b618aca4f91c44d8f6d6401c61e6f6dd842d88e8f52735fc8ab0 | lean_source_file | lean_toolchain_source_file_chunks | (t.erase k |>.maxD fallback) = t.maxD fallback :=
TreeMap.Raw.maxKeyD_erase_eq_of_not_compare_maxKeyD_eq h he heq
theorem maxD_erase_le_maxD [TransCmp cmp] (h : t.WF) {k}
(he : (t.erase k).isEmpty = false) {fallback} :
cmp (t.erase k |>.maxD fallback) (t.maxD fallback) |>.isLE :=
TreeMap.Raw.maxKeyD_erase_... |
12,079 | lean_file_chunk | d66f9dc942c50356c842705706f58bdfb0a5c61032cd72fcd66e0b79535e6c66 | lean_source_file | lean_toolchain_source_file_chunks | /-
Copyright (c) 2024 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Markus Himmel, Paul Reichert
-/
module
prelude
public import Std.Data.TreeMap.Raw.Basic
public import Std.Data.TreeSet.Basic
@[expose] public section
/-
# Tree sets with unbundled we... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.