Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: unbundle array size constraint from hash map bucket array #748

Open
wants to merge 370 commits into
base: nightly-testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
370 commits
Select commit Hold shift + click to select a range
7bcea89
remove unnecessary import
kim-em Feb 16, 2024
3ee03e5
fix import
kim-em Feb 16, 2024
a50b4ec
removing omega dependencies
kim-em Feb 16, 2024
a45defd
chore: compatibility updates for Int migration
joehendrix Feb 16, 2024
c21447f
chore: adaptations for nightly-2024-02-15 (#652)
kim-em Feb 16, 2024
9237675
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 16, 2024
edae365
ripping stuff out
kim-em Feb 16, 2024
767f696
merge lean-pr-testing-3364
kim-em Feb 16, 2024
74c7d4e
finished
kim-em Feb 16, 2024
b281189
oops cleanup
kim-em Feb 16, 2024
31d95ec
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 16, 2024
601f022
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 16, 2024
44f0b92
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 16, 2024
426c0f9
update all
kim-em Feb 17, 2024
ce2284e
chore: bump to nightly-2024-02-17
leanprover-community-mathlib4-bot Feb 17, 2024
0f3cc42
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 17, 2024
9ce61f1
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 17, 2024
db74bfd
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 18, 2024
bfa9e08
bump toolchain
kim-em Feb 18, 2024
05a934e
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 18, 2024
796408b
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 18, 2024
39070b1
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 18, 2024
1da1231
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 18, 2024
6b45710
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 19, 2024
bbf6b59
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 19, 2024
c6e95fa
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 19, 2024
269beca
chore: bump to nightly-2024-02-19
leanprover-community-mathlib4-bot Feb 19, 2024
fe0a29a
not sure why that proof broke
kim-em Feb 19, 2024
3e4027b
fixes
kim-em Feb 19, 2024
0fc11f3
fix
kim-em Feb 19, 2024
5cb2a58
fixes
kim-em Feb 19, 2024
afdc088
Delete
kim-em Feb 19, 2024
1586642
remove imports
kim-em Feb 19, 2024
c8ada7a
reduce imports
kim-em Feb 20, 2024
6a756a4
merge main
kim-em Feb 20, 2024
5f9deb5
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 20, 2024
a1eba7d
Merge remote-tracking branch 'origin/main' into nightly-testing
kim-em Feb 20, 2024
1eb42c7
Merge branch 'nightly-testing' of github.com:leanprover/std4 into nig…
kim-em Feb 20, 2024
cb218dc
Merge remote-tracking branch 'origin/main' into bump/v4.7.0
kim-em Feb 20, 2024
6d2ee66
chore: bump to nightly-2024-02-20
leanprover-community-mathlib4-bot Feb 20, 2024
21e80ab
adaptations for nightly-2024-02-20
kim-em Feb 20, 2024
c939336
fixes
kim-em Feb 20, 2024
652a672
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 20, 2024
0b837b3
chore: bump to nightly-2024-02-21
leanprover-community-mathlib4-bot Feb 21, 2024
ef96051
fixes
kim-em Feb 22, 2024
292f8f2
.
kim-em Feb 22, 2024
b997f3f
.
kim-em Feb 22, 2024
cad2a50
fixes
kim-em Feb 22, 2024
f1f0b58
chore: bump to nightly-2024-02-22
leanprover-community-mathlib4-bot Feb 22, 2024
a178ab5
fix
kim-em Feb 22, 2024
dc1b9b4
merge main
kim-em Feb 22, 2024
327fee2
chore: bump to nightly-2024-02-23
leanprover-community-mathlib4-bot Feb 23, 2024
bc54f14
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 23, 2024
d7451c6
chore: adaptations for nightly-2024-02-19 (#666)
kim-em Feb 23, 2024
1eef461
chore: bump to nightly-2024-02-24
leanprover-community-mathlib4-bot Feb 24, 2024
79e7958
Merge remote-tracking branch 'origin/main' into bump/v4.7.0
kim-em Feb 25, 2024
aca27e1
adaptations for nightly-2024-02-24
kim-em Feb 25, 2024
43d6686
rename std_apply?
kim-em Feb 25, 2024
4c80d37
fixes
kim-em Feb 25, 2024
58f119a
chore: add test for simultaneous 'import Lean' and 'import Std'
kim-em Feb 25, 2024
4f24443
Merge branch 'import_all' into nightly-testing
kim-em Feb 25, 2024
1910966
updates
kim-em Feb 25, 2024
5a874b1
restore lemma
kim-em Feb 25, 2024
ce0285d
fix bitvec stuff
kim-em Feb 25, 2024
5cda2bc
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 25, 2024
b4c07ab
Merge remote-tracking branch 'origin/main' into nightly-testing
kim-em Feb 25, 2024
d6cc703
Merge branch 'nightly-testing' of github.com:leanprover/std4 into nig…
kim-em Feb 25, 2024
6b80b72
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 26, 2024
6162096
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 26, 2024
ced7701
fix tests
kim-em Feb 26, 2024
c733963
chore: bump to nightly-2024-02-26
leanprover-community-mathlib4-bot Feb 26, 2024
3fdf76f
incomplete fixes
kim-em Feb 26, 2024
faf7129
chore: adaptations for nightly-2024-02-22 (#668)
kim-em Feb 27, 2024
a9af8e1
,
kim-em Feb 27, 2024
4b1c0ce
remove sorries
kim-em Feb 27, 2024
ad10d34
Merge branch 'bump/v4.7.0' of github.com:leanprover/std4 into bump/v4…
kim-em Feb 27, 2024
1e1f991
Merge remote-tracking branch 'origin/main' into bump/v4.7.0
kim-em Feb 27, 2024
c416f40
chore: adaptations for nightly-2024-02-27
kim-em Feb 27, 2024
f9edca7
backport cleanup from bump/nightly-2024-02-27
kim-em Feb 27, 2024
fb65114
chore: bump to nightly-2024-02-28
leanprover-community-mathlib4-bot Feb 28, 2024
026c06b
chore: adaptations for nightly-2024-02-27 (#674)
kim-em Feb 28, 2024
9ec791d
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 28, 2024
67ab85e
delete librarySearch test; it's in Lean
kim-em Feb 28, 2024
946e6f8
remove tests already in Lean
kim-em Feb 28, 2024
9a2342b
remove test already moved to Lean
kim-em Feb 28, 2024
a6501ee
migrate tests in https://github.com/leanprover/lean4/pull/3535
kim-em Feb 28, 2024
79c1bcf
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 29, 2024
0de6b50
deleted tests upstreamed in https://github.com/leanprover/lean4/pull/…
kim-em Feb 29, 2024
ffd8e69
chore: bump to nightly-2024-02-29
leanprover-community-mathlib4-bot Feb 29, 2024
bb1c3db
Merge main into nightly-testing
leanprover-community-mathlib4-bot Feb 29, 2024
004dcf8
remove upstreamed lemmas
kim-em Feb 29, 2024
6d22f96
fixed
kim-em Feb 29, 2024
e2648a0
oops, omega benchmark regression
kim-em Feb 29, 2024
7179275
remove @[simp] from lemmas simp can prove
kim-em Feb 29, 2024
9d123ff
chore: bump to nightly-2024-03-01
leanprover-community-mathlib4-bot Mar 1, 2024
ff94a57
upstreamed lemmas
kim-em Mar 1, 2024
bafb6c2
lint
kim-em Mar 1, 2024
44c96b4
merge main
kim-em Mar 1, 2024
53641cf
merge bump/v4.7.0
kim-em Mar 1, 2024
f7b73e3
restore one lemma
kim-em Mar 1, 2024
0f56020
chore: bump to nightly-2024-03-02
leanprover-community-mathlib4-bot Mar 2, 2024
d0a9d56
chore: adaptations for nightly-2024-03-01 (#678)
kim-em Mar 2, 2024
8650789
bump/v4.7.0
kim-em Mar 2, 2024
1fc6571
Update lean-toolchain for testing https://github.com/leanprover/lean4…
leanprover-community-mathlib4-bot Mar 4, 2024
86c0e09
fixes
kim-em Mar 4, 2024
f495a4a
Trigger CI for https://github.com/leanprover/lean4/pull/3579
leanprover-community-mathlib4-bot Mar 4, 2024
354e681
fixes
kim-em Mar 4, 2024
d53045b
Merge branch 'lean-pr-testing-3579' of github.com:leanprover/std4 int…
kim-em Mar 4, 2024
fef6851
Trigger CI for https://github.com/leanprover/lean4/pull/3579
leanprover-community-mathlib4-bot Mar 4, 2024
0594498
fix (#680)
Ruben-VandeVelde Mar 4, 2024
253a287
toolchain
kim-em Mar 4, 2024
1c42649
Merge branch 'nightly-testing' of github.com:leanprover/std4 into nig…
kim-em Mar 4, 2024
9baecd6
Update lean-toolchain for testing https://github.com/leanprover/lean4…
leanprover-community-mathlib4-bot Mar 4, 2024
e53c259
chore: bump to nightly-2024-03-05
leanprover-community-mathlib4-bot Mar 5, 2024
d9e573b
upstream lemmas
kim-em Mar 5, 2024
1501a2e
changes to simp normal form
kim-em Mar 5, 2024
bd2ee35
changes to simp
kim-em Mar 5, 2024
ebd8f65
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 6, 2024
19d21a2
merge nightly-testing
kim-em Mar 7, 2024
204abb9
chore: bump to nightly-2024-03-07
leanprover-community-mathlib4-bot Mar 7, 2024
b1e4f9f
fix
kim-em Mar 7, 2024
b0616e9
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 7, 2024
8740fe4
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 7, 2024
22c99b7
chore: bump to nightly-2024-03-08
leanprover-community-mathlib4-bot Mar 8, 2024
9fa2310
chore: bump to nightly-2024-03-09
leanprover-community-mathlib4-bot Mar 9, 2024
dd225d4
chore: fixes
joehendrix Mar 7, 2024
004e8d1
chore: reduce imports
joehendrix Mar 7, 2024
a2a2479
chore: bump to nightly-2024-03-10
leanprover-community-mathlib4-bot Mar 10, 2024
ea0bc70
chore: bump to nightly-2024-03-11
leanprover-community-mathlib4-bot Mar 11, 2024
a0945f0
Trigger CI for https://github.com/leanprover/lean4/pull/3589
leanprover-community-mathlib4-bot Mar 11, 2024
2cd6bbf
fix
kim-em Mar 11, 2024
dafa107
fix tests
kim-em Mar 12, 2024
0936d27
fixes
kim-em Mar 12, 2024
63e50b7
chore: adaptations for nightly-2024-03-11 (#692)
kim-em Mar 12, 2024
0ef13c5
chore: adaptations for nightly-2024-03-12
kim-em Mar 12, 2024
6332027
chore: adaptations for nightly-2024-03-12
kim-em Mar 12, 2024
d273b2f
fix test
kim-em Mar 12, 2024
359d423
merge bump/nightly-2024-03-12
kim-em Mar 12, 2024
a5128fc
chore: adaptations for nightly-2024-03-12 (#693)
kim-em Mar 12, 2024
b963be3
merge nightly-testing-2024-03-12
kim-em Mar 13, 2024
c59e73d
Trigger CI for https://github.com/leanprover/lean4/pull/3579
leanprover-community-mathlib4-bot Mar 13, 2024
e002a96
bump toolchain
kim-em Mar 13, 2024
d2b6687
merge lean-pr-testing-3579
kim-em Mar 13, 2024
576d053
chore: adaptations for nightly-2024-03-13 (#695)
kim-em Mar 13, 2024
707b99b
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 14, 2024
b0cb780
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 15, 2024
5bcbfa4
chore: bump to nightly-2024-03-15
leanprover-community-mathlib4-bot Mar 15, 2024
c3bbed0
fixes
kim-em Mar 15, 2024
3294e73
fix deprecated code action
kim-em Mar 15, 2024
2c55b6b
check for reserved names in isAutoDecl
kim-em Mar 15, 2024
1411c74
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 15, 2024
05f0ca9
chore: bump to nightly-2024-03-16
leanprover-community-mathlib4-bot Mar 16, 2024
ecee90f
chore: bump to nightly-2024-03-17
leanprover-community-mathlib4-bot Mar 17, 2024
85cae1f
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 18, 2024
c922570
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 18, 2024
c318688
chore: bump to nightly-2024-03-18
leanprover-community-mathlib4-bot Mar 18, 2024
70c816d
fix
kim-em Mar 18, 2024
f56b1f9
merge main
kim-em Mar 18, 2024
972eaa9
Trigger CI for https://github.com/leanprover/lean4/pull/3589
leanprover-community-mathlib4-bot Mar 18, 2024
48ebe8f
chore: bump to nightly-2024-03-19
leanprover-community-mathlib4-bot Mar 19, 2024
f6441c8
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 19, 2024
784c0ae
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 20, 2024
edb7a9d
fixes
kim-em Mar 20, 2024
976093e
chore: adaptations for nightly-2024-03-19
kim-em Mar 20, 2024
27fa4af
Merge remote-tracking branch 'origin/main' into bump/v4.8.0
kim-em Mar 20, 2024
af5681b
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 20, 2024
7084c23
Merge remote-tracking branch 'origin/main' into bump/v4.8.0
kim-em Mar 20, 2024
241c0fa
Merge branch 'bump/v4.8.0' into bump/nightly-2024-03-19
kim-em Mar 20, 2024
3aa0736
Merge branch 'bump/nightly-2024-03-19' into nightly-testing
kim-em Mar 20, 2024
865c48e
fix
kim-em Mar 21, 2024
54afc1e
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 21, 2024
df2d21b
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 21, 2024
4ccec46
chore: bump to nightly-2024-03-21
leanprover-community-mathlib4-bot Mar 21, 2024
6de82f1
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 21, 2024
06a7bcb
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 21, 2024
cda53ac
fix
kim-em Mar 22, 2024
44bd9ba
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 22, 2024
09e0f3e
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 22, 2024
3930d30
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 22, 2024
93ed0a8
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 22, 2024
702be0d
bump
kim-em Mar 22, 2024
0f0374b
merge lean-pr-testing-3589
kim-em Mar 22, 2024
4dbc8fa
unused variable
kim-em Mar 22, 2024
eadf616
fix test
kim-em Mar 22, 2024
36473ef
fix check_imports script
kim-em Mar 22, 2024
5161bf2
chore: bump to nightly-2024-03-23
leanprover-community-mathlib4-bot Mar 23, 2024
96a5ca9
fix test
kim-em Mar 23, 2024
9a1aa2d
chore: bump to nightly-2024-03-24
leanprover-community-mathlib4-bot Mar 24, 2024
2e31efe
chore: bump to nightly-2024-03-25
leanprover-community-mathlib4-bot Mar 25, 2024
0efce25
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 26, 2024
f9dbfb5
bump
kim-em Mar 26, 2024
f274ebd
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 26, 2024
e0ab3b1
chore: bump to nightly-2024-03-27
leanprover-community-mathlib4-bot Mar 27, 2024
74f80f5
chore: bump to nightly-2024-03-28
leanprover-community-mathlib4-bot Mar 28, 2024
406fe30
fix: remove upstreamed defs and fix some proofs
joehendrix Mar 28, 2024
1c9e0fb
chore: bump to nightly-2024-03-29
leanprover-community-mathlib4-bot Mar 29, 2024
4ebd51a
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 29, 2024
c780117
Merge main into nightly-testing
leanprover-community-mathlib4-bot Mar 29, 2024
aec0741
chore: bump to nightly-2024-03-30
leanprover-community-mathlib4-bot Mar 30, 2024
06f06f9
chore: bump to nightly-2024-04-01
leanprover-community-mathlib4-bot Apr 1, 2024
1838f35
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 1, 2024
ebaf319
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 1, 2024
3676120
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 1, 2024
5bca7bd
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 1, 2024
fac121c
chore: bump to nightly-2024-04-02
leanprover-community-mathlib4-bot Apr 2, 2024
0af134a
fixes
kim-em Apr 2, 2024
bbd71a6
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 3, 2024
8ac01e7
chore: bump to nightly-2024-04-03
leanprover-community-mathlib4-bot Apr 3, 2024
e0eb309
chore: bump to nightly-2024-04-04
leanprover-community-mathlib4-bot Apr 4, 2024
4d33b75
chore: bump to nightly-2024-04-05
leanprover-community-mathlib4-bot Apr 5, 2024
956e5c6
wip: list migration
joehendrix Mar 29, 2024
f47b0fb
chore: bump to nightly-2024-04-07
leanprover-community-mathlib4-bot Apr 7, 2024
7514475
chore: bump to nightly-2024-04-08
leanprover-community-mathlib4-bot Apr 8, 2024
324d76c
chore: bump to nightly-2024-04-09
leanprover-community-mathlib4-bot Apr 9, 2024
1352583
chore: bump to nightly-2024-04-11
leanprover-community-mathlib4-bot Apr 11, 2024
e9b95dc
chore: bump to nightly-2024-04-12
leanprover-community-mathlib4-bot Apr 12, 2024
36f9315
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 12, 2024
e6a371f
chore: bump to nightly-2024-04-13
leanprover-community-mathlib4-bot Apr 13, 2024
9a0a8c9
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 13, 2024
146806d
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 13, 2024
9fd499b
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 13, 2024
7e974b7
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 14, 2024
ea64e2b
chore: bump to nightly-2024-04-14
leanprover-community-mathlib4-bot Apr 14, 2024
6fd186c
fix: for lean4#3851 (#741)
kmill Apr 14, 2024
7022446
fix: for std4#727 interacting with lean4#3625
kmill Apr 14, 2024
325d548
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 15, 2024
fba4f4a
update to #734
kim-em Apr 15, 2024
f032d36
chore: bump to nightly-2024-04-16
leanprover-community-mathlib4-bot Apr 16, 2024
f612c22
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 17, 2024
ffbec9e
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 17, 2024
96ab0e6
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 17, 2024
5b38c68
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 17, 2024
92a9eda
fix
kim-em Apr 17, 2024
7e7cdb7
Merge main into nightly-testing
leanprover-community-mathlib4-bot Apr 17, 2024
d9fed9f
chore: bump to nightly-2024-04-17
leanprover-community-mathlib4-bot Apr 17, 2024
e220c04
WIP
TwoFX Apr 17, 2024
2051046
Works?
TwoFX Apr 17, 2024
c3cb7db
WIP
TwoFX Apr 17, 2024
116f272
Fix imports
TwoFX Apr 17, 2024
221752c
feat: List.(take|drop)_set_of_lt
TwoFX Apr 17, 2024
fcf82f9
Merge branch 'move-list-init-lemmas-import' into hashmap-positivity
TwoFX Apr 17, 2024
5c28ffd
Merge branch 'drop-set' into hashmap-positivity
TwoFX Apr 17, 2024
c38e8ec
Cleanup
TwoFX Apr 17, 2024
8c45a61
Cleanup
TwoFX Apr 17, 2024
2af8b75
More cleanup
TwoFX Apr 17, 2024
e4273cf
More cleanup
TwoFX Apr 17, 2024
2c5f684
More cleanup
TwoFX Apr 17, 2024
3158c7a
More cleanup
TwoFX Apr 17, 2024
e3f7e6e
Cleanup
TwoFX Apr 17, 2024
f021da7
Style
TwoFX Apr 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Std.lean
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ import Std.Tactic.OpenPrivate
import Std.Tactic.PermuteGoals
import Std.Tactic.PrintDependents
import Std.Tactic.PrintPrefix
import Std.Tactic.Relation.Rfl
import Std.Tactic.SeqFocus
import Std.Tactic.ShowUnused
import Std.Tactic.SqueezeScope
Expand Down
5 changes: 0 additions & 5 deletions Std/Classes/BEq.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@ class PartialEquivBEq (α) [BEq α] : Prop where
symm : (a : α) == b → b == a
/-- Transitivity for `BEq`. If `a == b` and `b == c` then `a == c`. -/
trans : (a : α) == b → b == c → a == c

@[simp] theorem beq_eq_false_iff_ne [BEq α] [LawfulBEq α]
(a b : α) : (a == b) = false ↔ a ≠ b := by
rw [ne_eq, ← beq_iff_eq a b]
cases a == b <;> decide
2 changes: 1 addition & 1 deletion Std/CodeAction/Attr.lean
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ initialize
if (IR.getSorryDep (← getEnv) decl).isSome then return -- ignore in progress definitions
modifyEnv (tacticSeqCodeActionExt.addEntry · (decl, ← mkTacticSeqCodeAction decl))
else
let args ← args.mapM resolveGlobalConstNoOverloadWithInfo
let args ← args.mapM realizeGlobalConstNoOverloadWithInfo
if (IR.getSorryDep (← getEnv) decl).isSome then return -- ignore in progress definitions
modifyEnv (tacticCodeActionExt.addEntry · (⟨decl, args⟩, ← mkTacticCodeAction decl))
| _ => pure ()
Expand Down
4 changes: 2 additions & 2 deletions Std/CodeAction/Deprecated.lean
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def deprecatedCodeActionProvider : CodeActionProvider := fun params snap => do
let mut i := 0
let doc ← readDoc
let mut msgs := #[]
for diag in snap.interactiveDiags do
if let some #[.deprecated] := diag.tags? then
for m in snap.msgLog.msgs do
if m.data.isDeprecationWarning then
if h : _ then
msgs := msgs.push (snap.cmdState.messages.msgs[i])
i := i + 1
Expand Down
8 changes: 4 additions & 4 deletions Std/Data/Array/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ namespace Subarray
The empty subarray.
-/
protected def empty : Subarray α where
as := #[]
array := #[]
start := 0
stop := 0
h₁ := Nat.le_refl 0
h₂ := Nat.le_refl 0
start_le_stop := Nat.le_refl 0
stop_le_array_size := Nat.le_refl 0

instance : EmptyCollection (Subarray α) :=
⟨Subarray.empty⟩
Expand Down Expand Up @@ -198,7 +198,7 @@ def popHead? (as : Subarray α) : Option (α × Subarray α) :=
let tail :=
{ as with
start := as.start + 1
h₁ := Nat.le_of_lt_succ $ Nat.succ_lt_succ h }
start_le_stop := Nat.le_of_lt_succ $ Nat.succ_lt_succ h }
some (head, tail)
else
none
Expand Down
25 changes: 12 additions & 13 deletions Std/Data/Array/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.

Authors: Mario Carneiro, Gabriel Ebner
-/
import Std.Data.Nat.Lemmas
import Std.Data.List.Lemmas
import Std.Data.Array.Init.Lemmas
import Std.Data.Array.Basic
Expand All @@ -20,12 +19,6 @@ import Std.Util.ProofWanted
@[simp] theorem getElem!_fin [GetElem Cont Nat Elem Dom] (a : Cont) (i : Fin n)
[Decidable (Dom a i)] [Inhabited Elem] : a[i]! = a[i.1]! := rfl

theorem getElem?_pos [GetElem Cont Idx Elem Dom]
(a : Cont) (i : Idx) (h : Dom a i) [Decidable (Dom a i)] : a[i]? = a[i] := dif_pos h

theorem getElem?_neg [GetElem Cont Idx Elem Dom]
(a : Cont) (i : Idx) (h : ¬Dom a i) [Decidable (Dom a i)] : a[i]? = none := dif_neg h

@[simp] theorem mkArray_data (n : Nat) (v : α) : (mkArray n v).data = List.replicate n v := rfl

@[simp] theorem getElem_mkArray (n : Nat) (v : α) (h : i < (mkArray n v).size) :
Expand Down Expand Up @@ -93,13 +86,19 @@ theorem get?_push_eq (a : Array α) (x : α) : (a.push x)[a.size]? = some x := b
rw [getElem?_pos, get_push_eq]

theorem get?_push {a : Array α} : (a.push x)[i]? = if i = a.size then some x else a[i]? := by
split
. next heq => rw [heq, getElem?_pos, get_push_eq]
· next hne =>
match Nat.lt_trichotomy i a.size with
| Or.inl g =>
have h1 : i < a.size + 1 := by omega
have h2 : i ≠ a.size := by omega
simp [getElem?, size_push, g, h1, h2, get_push_lt]
| Or.inr (Or.inl heq) =>
simp [heq, getElem?_pos, get_push_eq]
| Or.inr (Or.inr g) =>
simp only [getElem?, size_push]
split <;> split <;> try simp only [*, get_push_lt]
· next p q => exact Or.elim (Nat.eq_or_lt_of_le (Nat.le_of_lt_succ p)) hne q
· next p q => exact p (Nat.lt.step q)
have h1 : ¬ (i < a.size ) := by omega
have h2 : ¬ (i < a.size + 1) := by omega
have h3 : i ≠ a.size := by omega
simp [h1, h2, h3]

@[simp] theorem get?_size {a : Array α} : a[a.size]? = none := by
simp only [getElem?, Nat.lt_irrefl, dite_false]
Expand Down
1 change: 0 additions & 1 deletion Std/Data/Array/Match.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ Copyright (c) 2023 F. G. Dorais. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: F. G. Dorais
-/
import Std.Data.Nat.Lemmas

namespace Array

Expand Down
2 changes: 0 additions & 2 deletions Std/Data/Array/Merge.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jannis Limperg
-/

import Std.Data.Nat.Lemmas

namespace Array

/--
Expand Down
1 change: 0 additions & 1 deletion Std/Data/BinomialHeap/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Authors: Leonardo de Moura, Jannis Limperg, Mario Carneiro
-/
import Std.Classes.Order
import Std.Control.ForInStep.Basic
import Std.Data.Nat.Lemmas

namespace Std
namespace BinomialHeap
Expand Down
5 changes: 1 addition & 4 deletions Std/Data/BitVec/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ Copyright (c) 2023 Lean FRO, LLC. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joe Hendrix
-/
import Std.Data.Bool
import Std.Data.Fin.Lemmas
import Std.Data.Nat.Lemmas
import Std.Util.ProofWanted
import Std.Tactic.Alias

namespace BitVec

Expand Down
120 changes: 71 additions & 49 deletions Std/Data/HashMap/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,25 @@ class LawfulHashable (α : Type _) [BEq α] [Hashable α] : Prop where
namespace Imp

/--
The bucket array of a `HashMap` is a nonempty array of `AssocList`s.
The bucket array of a `HashMap` is an array of `AssocList`s.
(This type is an internal implementation detail of `HashMap`.)
All operations assume that the array is nonempty. This fact is part of `Buckets.WF`. We do not
bundle it here for positivity reasons (see `test/collection_positivity.lean`).
-/
def Buckets (α : Type u) (β : Type v) := {b : Array (AssocList α β) // 0 < b.size}
structure Buckets (α : Type u) (β : Type v) where mk' ::
/-- The array of `AssocList`s making up the bucket array. -/
b : Array (AssocList α β)

namespace Buckets

/-- Construct a new empty bucket array with the specified capacity. -/
def mk (buckets := 8) (h : 0 < buckets := by decide) : Buckets α β :=
⟨mkArray buckets .nil, by simp [h]
def mk (buckets := 8) : Buckets α β :=
⟨mkArray buckets .nil⟩

/-- Update one bucket in the bucket array with a new value. -/
def update (data : Buckets α β) (i : USize)
(d : AssocList α β) (h : i.toNat < data.1.size) : Buckets α β :=
⟨data.1.uset i d h, (Array.size_uset ..).symm ▸ data.2
⟨data.1.uset i d h⟩

/--
The number of elements in the bucket array.
Expand All @@ -45,7 +49,7 @@ noncomputable def size (data : Buckets α β) : Nat := .sum (data.1.data.map (·

/-- Map a function over the values in the map. -/
@[specialize] def mapVal (f : α → β → γ) (self : Buckets α β) : Buckets α γ :=
⟨self.1.map (.mapVal f), by simp [self.2]
⟨self.1.map (.mapVal f)⟩

/--
The well-formedness invariant for the bucket array says that every element hashes to its index
Expand All @@ -58,11 +62,15 @@ structure WF [BEq α] [Hashable α] (buckets : Buckets α β) : Prop where
/-- Every element in a bucket should hash to its location. -/
hash_self (i : Nat) (h : i < buckets.1.size) :
buckets.1[i].All fun k _ => ((hash k).toUSize % buckets.1.size).toNat = i
/-- There must be at least one bucket. -/
size : 0 < buckets.1.size

end Buckets
end Imp

/-- `HashMap.Imp α β` is the internal implementation type of `HashMap α β`. -/
/-- `HashMap.Imp α β` is the implementation type of `HashMap α β` without the bundled
well-formedness constraint. Unlike `HashMap α β`, it is possible to use `HashMap.Imp α β` as a
constructor argument for an inductive type `β`, because `HashMap.Imp α β` is "positive". -/
structure Imp (α : Type u) (β : Type v) where
/-- The number of elements stored in the `HashMap`.
We cache this both so that we can implement `.size` in `O(1)`, and also because we
Expand All @@ -81,16 +89,16 @@ A "load factor" of 0.75 is the usual standard for hash maps, so we return `capac
capacity * 4 / 3

/-- Constructs an empty hash map with the specified nonzero number of buckets. -/
@[inline] def empty' (buckets := 8) (h : 0 < buckets := by decide) : Imp α β :=
⟨0, .mk buckets h
@[inline] def empty' (buckets := 8) : Imp α β :=
⟨0, .mk buckets⟩

/-- Constructs an empty hash map with the specified target capacity. -/
def empty (capacity := 0) : Imp α β :=
let nbuckets := numBucketsForCapacity capacity
let n : {n : Nat // 0 < n} :=
if h : nbuckets = 0 then ⟨8, by decide⟩
else ⟨nbuckets, Nat.zero_lt_of_ne_zero h⟩
empty' n n.2
empty' n

/-- Calculates the bucket index from a hash value `u`. -/
def mkIdx {n : Nat} (h : 0 < n) (u : USize) : {u : USize // u.toNat < n} :=
Expand All @@ -102,8 +110,10 @@ already in the array, which is appropriate when reinserting elements into the ar
-/
@[inline] def reinsertAux [Hashable α]
(data : Buckets α β) (a : α) (b : β) : Buckets α β :=
let ⟨i, h⟩ := mkIdx data.2 (hash a |>.toUSize)
data.update i (.cons a b data.1[i]) h
if hd : 0 < data.1.size then
Copy link
Member

@digama0 digama0 Apr 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a parameter to the function. There is no need to be doing this check here. You can also avoid having an additional parameter in the IR by smuggling the property in a subtype, as in (data : {b : Buckets α β // 0 < b.size}).

let ⟨i, h⟩ := mkIdx hd (hash a |>.toUSize)
data.update i (.cons a b data.1[i]) h
else data

/-- Folds a monadic function over the elements in the map (in arbitrary order). -/
@[inline] def foldM [Monad m] (f : δ → α → β → m δ) (d : δ) (map : Imp α β) : m δ :=
Expand All @@ -119,26 +129,32 @@ already in the array, which is appropriate when reinserting elements into the ar

/-- Given a key `a`, returns a key-value pair in the map whose key compares equal to `a`. -/
def findEntry? [BEq α] [Hashable α] (m : Imp α β) (a : α) : Option (α × β) :=
let ⟨_, buckets⟩ := m
let ⟨i, h⟩ := mkIdx buckets.2 (hash a |>.toUSize)
buckets.1[i].findEntry? a
if hm : 0 < m.2.1.size then
let ⟨_, buckets⟩ := m
let ⟨i, h⟩ := mkIdx hm (hash a |>.toUSize)
buckets.1[i].findEntry? a
else .none -- Will never happen for well-formed inputs

/-- Looks up an element in the map with key `a`. -/
def find? [BEq α] [Hashable α] (m : Imp α β) (a : α) : Option β :=
let ⟨_, buckets⟩ := m
let ⟨i, h⟩ := mkIdx buckets.2 (hash a |>.toUSize)
buckets.1[i].find? a
if hm : 0 < m.2.1.size then
let ⟨_, buckets⟩ := m
let ⟨i, h⟩ := mkIdx hm (hash a |>.toUSize)
buckets.1[i].find? a
else .none -- Will never happen for well-formed inputs

/-- Returns true if the element `a` is in the map. -/
def contains [BEq α] [Hashable α] (m : Imp α β) (a : α) : Bool :=
let ⟨_, buckets⟩ := m
let ⟨i, h⟩ := mkIdx buckets.2 (hash a |>.toUSize)
buckets.1[i].contains a
if hm : 0 < m.2.1.size then
let ⟨_, buckets⟩ := m
let ⟨i, h⟩ := mkIdx hm (hash a |>.toUSize)
buckets.1[i].contains a
else false -- Will never happen for well-formed inputs

/-- Copies all the entries from `buckets` into a new hash map with a larger capacity. -/
def expand [Hashable α] (size : Nat) (buckets : Buckets α β) : Imp α β :=
let nbuckets := buckets.1.size * 2
{ size, buckets := go 0 buckets.1 (.mk nbuckets (Nat.mul_pos buckets.2 (by decide))) }
{ size, buckets := go 0 buckets.1 (.mk nbuckets) }
where
/-- Inner loop of `expand`. Copies elements `source[i:]` into `target`,
destroying `source` in the process. -/
Expand All @@ -159,39 +175,45 @@ Inserts key-value pair `a, b` into the map.
If an element equal to `a` is already in the map, it is replaced by `b`.
-/
@[inline] def insert [BEq α] [Hashable α] (m : Imp α β) (a : α) (b : β) : Imp α β :=
let ⟨size, buckets⟩ := m
let ⟨i, h⟩ := mkIdx buckets.2 (hash a |>.toUSize)
let bkt := buckets.1[i]
bif bkt.contains a then
⟨size, buckets.update i (bkt.replace a b) h⟩
else
let size' := size + 1
let buckets' := buckets.update i (.cons a b bkt) h
if numBucketsForCapacity size' ≤ buckets.1.size then
{ size := size', buckets := buckets' }
if hm : 0 < m.2.1.size then
let ⟨size, buckets⟩ := m
let ⟨i, h⟩ := mkIdx hm (hash a |>.toUSize)
let bkt := buckets.1[i]
bif bkt.contains a then
⟨size, buckets.update i (bkt.replace a b) h⟩
else
expand size' buckets'
let size' := size + 1
let buckets' := buckets.update i (.cons a b bkt) h
if numBucketsForCapacity size' ≤ buckets.1.size then
{ size := size', buckets := buckets' }
else
expand size' buckets'
else m -- Will never happen for well-formed inputs

/--
Removes key `a` from the map. If it does not exist in the map, the map is returned unchanged.
-/
def erase [BEq α] [Hashable α] (m : Imp α β) (a : α) : Imp α β :=
let ⟨size, buckets⟩ := m
let ⟨i, h⟩ := mkIdx buckets.2 (hash a |>.toUSize)
let bkt := buckets.1[i]
bif bkt.contains a then ⟨size - 1, buckets.update i (bkt.erase a) h⟩ else ⟨size, buckets⟩
if hm : 0 < m.2.1.size then
let ⟨size, buckets⟩ := m
let ⟨i, h⟩ := mkIdx hm (hash a |>.toUSize)
let bkt := buckets.1[i]
bif bkt.contains a then ⟨size - 1, buckets.update i (bkt.erase a) h⟩ else ⟨size, buckets⟩
else m -- Will never happen for well-formed inputs

/-- Map a function over the values in the map. -/
@[inline] def mapVal (f : α → β → γ) (self : Imp α β) : Imp α γ :=
{ size := self.size, buckets := self.buckets.mapVal f }

/-- Performs an in-place edit of the value, ensuring that the value is used linearly. -/
def modify [BEq α] [Hashable α] (m : Imp α β) (a : α) (f : α → β → β) : Imp α β :=
let ⟨size, buckets⟩ := m
let ⟨i, h⟩ := mkIdx buckets.2 (hash a |>.toUSize)
let bkt := buckets.1[i]
let buckets := buckets.update i .nil h -- for linearity
⟨size, buckets.update i (bkt.modify a f) ((Buckets.update_size ..).symm ▸ h)⟩
if hm : 0 < m.2.1.size then
let ⟨size, buckets⟩ := m
let ⟨i, h⟩ := mkIdx hm (hash a |>.toUSize)
let bkt := buckets.1[i]
let buckets := buckets.update i .nil h -- for linearity
⟨size, buckets.update i (bkt.modify a f) ((Buckets.update_size ..).symm ▸ h)⟩
else m -- Will never happen for well-formed inputs

/--
Applies `f` to each key-value pair `a, b` in the map. If it returns `some c` then
Expand All @@ -200,11 +222,7 @@ Applies `f` to each key-value pair `a, b` in the map. If it returns `some c` the
@[specialize] def filterMap {α : Type u} {β : Type v} {γ : Type w}
(f : α → β → Option γ) (m : Imp α β) : Imp α γ :=
let m' := m.buckets.1.mapM (m := StateT (ULift Nat) Id) (go .nil) |>.run ⟨0⟩ |>.run
have : m'.1.size > 0 := by
have := Array.size_mapM (m := StateT (ULift Nat) Id) (go .nil) m.buckets.1
simp [SatisfiesM_StateT_eq, SatisfiesM_Id_eq] at this
simp [this, Id.run, StateT.run, m.2.2, m']
⟨m'.2.1, m'.1, this⟩
⟨m'.2.1, ⟨m'.1⟩⟩
where
/-- Inner loop of `filterMap`. Note that this reverses the bucket lists,
but this is fine since bucket lists are unordered. -/
Expand All @@ -230,15 +248,19 @@ inductive WF [BEq α] [Hashable α] : Imp α β → Prop where
is lawful then every element hashes to its index. -/
| mk : m.size = m.buckets.size → m.buckets.WF → WF m
/-- The empty hash map is well formed. -/
| empty' : WF (empty' n h)
| empty' : 0 < n → WF (empty' n)
/-- Inserting into a well formed hash map yields a well formed hash map. -/
| insert : WF m → WF (insert m a b)
/-- Removing an element from a well formed hash map yields a well formed hash map. -/
| erase : WF m → WF (erase m a)
/-- Replacing an element in a well formed hash map yields a well formed hash map. -/
| modify : WF m → WF (modify m a f)

theorem WF.empty [BEq α] [Hashable α] : WF (empty n : Imp α β) := by unfold empty; apply empty'
theorem WF.empty [BEq α] [Hashable α] : WF (empty n : Imp α β) := by
dsimp only [Imp.empty]
split
· exact WF.empty' (by decide)
· next h => exact WF.empty' (Nat.pos_of_ne_zero h)

end Imp

Expand Down
2 changes: 1 addition & 1 deletion Std/Data/HashMap/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Std.HashMap
namespace Imp

@[simp] theorem empty_buckets :
(empty : Imp α β).buckets = ⟨mkArray 8 AssocList.nil, by simp⟩ := rfl
(empty : Imp α β).buckets = ⟨mkArray 8 AssocList.nil⟩ := rfl

@[simp] theorem empty_val [BEq α] [Hashable α] : (∅ : HashMap α β).val = Imp.empty := rfl

Expand Down
Loading