Skip to content

Commit b799307

Browse files
committed
more lemmas
1 parent d3854d8 commit b799307

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed

src/Std/Data/DTreeMap/Lemmas.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6142,6 +6142,10 @@ theorem equiv_iff_toList_eq [TransCmp cmp] :
61426142
t₁ ~m t₂ ↔ t₁.toList = t₂.toList :=
61436143
equiv_iff_equiv.trans (Impl.equiv_iff_toList_eq t₁.2 t₂.2)
61446144

6145+
theorem equiv_iff_toArray_eq [TransCmp cmp] :
6146+
t₁ ~m t₂ ↔ t₁.toArray = t₂.toArray :=
6147+
equiv_iff_equiv.trans (Impl.equiv_iff_toArray_eq t₁.2 t₂.2)
6148+
61456149
theorem insertMany_list_equiv_foldl {l : List ((a : α) × β a)} :
61466150
t₁.insertMany l ~m l.foldl (init := t₁) fun acc p => acc.insert p.1 p.2 := by
61476151
constructor
@@ -6175,6 +6179,9 @@ theorem Const.equiv_iff_toArray_perm : t₁ ~m t₂ ↔ (Const.toArray t₁).Per
61756179
theorem Const.equiv_iff_toList_eq [TransCmp cmp] : t₁ ~m t₂ ↔ Const.toList t₁ = Const.toList t₂ :=
61766180
equiv_iff_equiv.trans (Impl.Const.equiv_iff_toList_eq t₁.2 t₂.2)
61776181

6182+
theorem Const.equiv_iff_toArray_eq [TransCmp cmp] : t₁ ~m t₂ ↔ Const.toArray t₁ = Const.toArray t₂ :=
6183+
equiv_iff_equiv.trans (Impl.Const.equiv_iff_toArray_eq t₁.2 t₂.2)
6184+
61786185
theorem Const.equiv_iff_keys_unit_perm {t₁ t₂ : DTreeMap α Unit cmp} : t₁ ~m t₂ ↔ t₁.keys.Perm t₂.keys :=
61796186
equiv_iff_equiv.trans Impl.Const.equiv_iff_keys_perm
61806187

src/Std/Data/DTreeMap/Raw/Lemmas.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6010,6 +6010,10 @@ theorem equiv_iff_toList_eq [TransCmp cmp] (h₁ : t₁.WF) (h₂ : t₂.WF) :
60106010
t₁ ~m t₂ ↔ t₁.toList = t₂.toList :=
60116011
equiv_iff.trans (Impl.equiv_iff_toList_eq h₁.1 h₂.1)
60126012

6013+
theorem equiv_iff_toArray_eq [TransCmp cmp] (h₁ : t₁.WF) (h₂ : t₂.WF) :
6014+
t₁ ~m t₂ ↔ t₁.toArray = t₂.toArray :=
6015+
equiv_iff.trans (Impl.equiv_iff_toArray_eq h₁.1 h₂.1)
6016+
60136017
theorem insertMany_list_equiv_foldl {l : List ((a : α) × β a)} :
60146018
t₁.insertMany l ~m l.foldl (init := t₁) fun acc p => acc.insert p.1 p.2 := by
60156019
constructor
@@ -6036,6 +6040,10 @@ theorem Const.equiv_iff_toList_eq [TransCmp cmp] (h₁ : t₁.WF) (h₂ : t₂.W
60366040
t₁ ~m t₂ ↔ Const.toList t₁ = Const.toList t₂ :=
60376041
equiv_iff.trans (Impl.Const.equiv_iff_toList_eq h₁.1 h₂.1)
60386042

6043+
theorem Const.equiv_iff_toArray_eq [TransCmp cmp] (h₁ : t₁.WF) (h₂ : t₂.WF) :
6044+
t₁ ~m t₂ ↔ Const.toArray t₁ = Const.toArray t₂ :=
6045+
equiv_iff.trans (Impl.Const.equiv_iff_toArray_eq h₁.1 h₂.1)
6046+
60396047
theorem Const.equiv_iff_keys_unit_perm {t₁ t₂ : Raw α Unit cmp} :
60406048
t₁ ~m t₂ ↔ t₁.keys.Perm t₂.keys :=
60416049
equiv_iff.trans Impl.Const.equiv_iff_keys_perm

src/Std/Data/TreeMap/Lemmas.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4508,6 +4508,10 @@ theorem equiv_iff_toList_eq [TransCmp cmp] :
45084508
t₁ ~m t₂ ↔ t₁.toList = t₂.toList :=
45094509
equiv_iff_equiv.trans DTreeMap.Const.equiv_iff_toList_eq
45104510

4511+
theorem equiv_iff_toArray_eq [TransCmp cmp] :
4512+
t₁ ~m t₂ ↔ t₁.toArray = t₂.toArray :=
4513+
equiv_iff_equiv.trans DTreeMap.Const.equiv_iff_toArray_eq
4514+
45114515
theorem equiv_iff_keys_unit_perm {t₁ t₂ : TreeMap α Unit cmp} :
45124516
t₁ ~m t₂ ↔ t₁.keys.Perm t₂.keys :=
45134517
equiv_iff_equiv.trans DTreeMap.Const.equiv_iff_keys_unit_perm

src/Std/Data/TreeMap/Raw/Lemmas.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4235,13 +4235,23 @@ theorem empty_equiv_iff_isEmpty : empty ~m t ↔ t.isEmpty :=
42354235
theorem equiv_iff_toList_perm : t₁ ~m t₂ ↔ t₁.toList.Perm t₂.toList :=
42364236
equiv_iff.trans DTreeMap.Raw.Const.equiv_iff_toList_perm
42374237

4238+
theorem equiv_iff_toArray_perm : t₁ ~m t₂ ↔ t₁.toArray.Perm t₂.toArray :=
4239+
equiv_iff.trans DTreeMap.Raw.Const.equiv_iff_toArray_perm
4240+
42384241
theorem Equiv.of_toList_perm (h : t₁.toList.Perm t₂.toList) : t₁ ~m t₂ :=
42394242
⟨.of_constToList_perm h⟩
42404243

4244+
theorem Equiv.of_toArray_perm (h : t₁.toArray.Perm t₂.toArray) : t₁ ~m t₂ :=
4245+
⟨.of_constToArray_perm h⟩
4246+
42414247
theorem equiv_iff_toList_eq [TransCmp cmp] (h₁ : t₁.WF) (h₂ : t₂.WF) :
42424248
t₁ ~m t₂ ↔ t₁.toList = t₂.toList :=
42434249
equiv_iff.trans (DTreeMap.Raw.Const.equiv_iff_toList_eq h₁.1 h₂.1)
42444250

4251+
theorem equiv_iff_toArray_eq [TransCmp cmp] (h₁ : t₁.WF) (h₂ : t₂.WF) :
4252+
t₁ ~m t₂ ↔ t₁.toArray = t₂.toArray :=
4253+
equiv_iff.trans (DTreeMap.Raw.Const.equiv_iff_toArray_eq h₁.1 h₂.1)
4254+
42454255
theorem equiv_iff_keys_unit_perm {t₁ t₂ : Raw α Unit cmp} :
42464256
t₁ ~m t₂ ↔ t₁.keys.Perm t₂.keys :=
42474257
equiv_iff.trans DTreeMap.Raw.Const.equiv_iff_keys_unit_perm

src/Std/Data/TreeSet/Lemmas.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module
88
prelude
99
import Std.Data.TreeMap.Lemmas
1010
import Std.Data.DTreeMap.Lemmas
11+
public import Init.Data.Array.Perm
1112
public import Std.Data.TreeSet.AdditionalOperations
1213

1314
@[expose] public section
@@ -2386,17 +2387,27 @@ theorem empty_equiv_iff_isEmpty : empty ~m t ↔ t.isEmpty :=
23862387
theorem equiv_iff_toList_perm : t₁ ~m t₂ ↔ t₁.toList.Perm t₂.toList :=
23872388
equiv_iff_equiv.trans TreeMap.equiv_iff_keys_unit_perm
23882389

2390+
theorem equiv_iff_toArray_perm : t₁ ~m t₂ ↔ t₁.toArray.Perm t₂.toArray :=
2391+
equiv_iff_equiv.trans TreeMap.equiv_iff_keysArray_unit_perm
2392+
23892393
theorem equiv_iff_forall_mem_iff [TransCmp cmp] [LawfulEqCmp cmp] :
23902394
t₁ ~m t₂ ↔ (∀ k, k ∈ t₁ ↔ k ∈ t₂) :=
23912395
fun h _ => h.mem_iff, Equiv.of_forall_mem_iff⟩
23922396

23932397
theorem Equiv.of_toList_perm (h : t₁.toList.Perm t₂.toList) : t₁ ~m t₂ :=
23942398
⟨.of_keys_unit_perm h⟩
23952399

2400+
theorem Equiv.of_toArray_perm (h : t₁.toArray.Perm t₂.toArray) : t₁ ~m t₂ :=
2401+
⟨.of_keysArray_unit_perm h⟩
2402+
23962403
theorem equiv_iff_toList_eq [TransCmp cmp] :
23972404
t₁ ~m t₂ ↔ t₁.toList = t₂.toList :=
23982405
equiv_iff_equiv.trans TreeMap.equiv_iff_keys_unit_eq
23992406

2407+
theorem equiv_iff_toArray_eq [TransCmp cmp] :
2408+
t₁ ~m t₂ ↔ t₁.toArray = t₂.toArray :=
2409+
equiv_iff_equiv.trans TreeMap.equiv_iff_keysArray_unit_eq
2410+
24002411
theorem insertMany_list_equiv_foldl {l : List α} :
24012412
insertMany t₁ l ~m l.foldl (init := t₁) fun acc a => acc.insert a := by
24022413
constructor

0 commit comments

Comments
 (0)