Kyle Miller
0eca3bd55d
feat: add a coercion from List Nat to Lean.Meta.Occurrences ( #6206 )
...
This PR makes it possible to write `rw (occs := [1,2]) ...` instead of
`rw (occs := .pos [1,2]) ...` by adding a coercion from `List.Nat` to
`Lean.Meta.Occurrences`.
2024-11-25 13:19:23 +00:00
Kim Morrison
884a9ea2ff
feat: remove partial keyword and runtime bounds checks from Array.binSearch ( #6193 )
...
This PR completes the TODO in `Init.Data.Array.BinSearch`, removing the
`partial` keyword and converting runtime bounds checks to compile time
bounds checks.
2024-11-24 06:08:16 +00:00
Kim Morrison
a5ffef7e13
feat: Array.zipWithAll ( #6191 )
...
This PR adds `Array.zipWithAll`, and the basic lemmas relating it to
`List.zipWithAll`.
2024-11-24 03:49:57 +00:00
Kim Morrison
c8b4f6b511
feat: duplicate List.attach/attachWith/pmap API for Array ( #6132 )
...
This PR duplicates the verification API for
`List.attach`/`attachWith`/`pmap` over to `Array`.
2024-11-20 01:16:48 +00:00
Eric Wieser
d6f898001b
chore: generalize List.get_mem ( #6095 )
...
This is syntactically more general than before, though up to eta
expansion it make no difference.
2024-11-19 11:08:10 +00:00
Kim Morrison
e10fac93a6
feat: lemmas for Array.findSome? and find? ( #6111 )
...
This PR fills in the API for `Array.findSome?` and `Array.find?`,
transferring proofs from the corresponding List statements.
2024-11-18 04:19:56 +00:00
Violeta Hernández
7e6363dc05
chore: join → flatten in docstring ( #6040 )
...
Update the docstring of `List.flatten`.
2024-11-15 10:11:42 +00:00
Kim Morrison
63132105ba
feat: lemmas about for loops over Array ( #6055 )
...
This PR adds lemmas about for loops over `Array`, following the existing
lemmas for `List`.
2024-11-13 23:23:55 +00:00
Kim Morrison
a401368384
feat: various minor changes to List/Array API ( #6044 )
...
Minor emendations to the List/Array API, collected from other PRs that
are still in the pipeline.
2024-11-12 08:27:36 +00:00
Kim Morrison
48e3d76173
feat: variants of List.forIn_eq_foldlM ( #6023 )
2024-11-11 02:30:40 +00:00
Lukas Gerlach
9b167e2051
feat: verify keys method on HashMaps ( #5866 )
...
This PR verifies the `keys` function on `Std.HashMap`.
---
Initial discussions have already happend with @TwoFX and we are
collaborating on this matter.
This will remain a draft as long as not all desired results have been
added.
If we should still create an issue for the topic of this PR, let us
know.
Of course, any other feedback is appreciated as well :)
---------
Co-authored-by: Markus Himmel <markus@lean-fro.org>
Co-authored-by: monsterkrampe <monsterkrampe@users.noreply.github.com>
Co-authored-by: jt0202 <johannes.tantow@gmail.com>
2024-11-08 07:24:58 +00:00
Kim Morrison
680177049f
chore: List.modifyTailIdx naming fix ( #6007 )
2024-11-08 02:42:06 +00:00
Kim Morrison
ebc02fc6e8
feat: lemmas relating Array.findX and List.findX ( #5985 )
...
This PR relates the operations `findSomeM?`, `findM?`, `findSome?`, and
`find?` on `Array` with the corresponding operations on `List`, and also
provides simp lemmas for the `Array` operations `findSomeRevM?`,
`findRevM?`, `findSomeRev?`, `findRev?` (in terms of `reverse` and the
usual forward find operations).
2024-11-07 03:30:11 +00:00
Kim Morrison
05caf1bda9
feat: interactions between List.foldX and List.filterX ( #5984 )
...
This PR adds lemmas for `List` for the interactions between {`foldl`,
`foldr`, `foldlM`, `foldlrM`} and {`filter`, `filterMap`}.
2024-11-07 02:37:20 +00:00
Kim Morrison
b1dee4a42e
chore: upstream List.insertIdx from Batteries, lemmas from Mathlib, and revise lemmas ( #5969 )
...
To follow, connecting this to `Array.insertAt` (and renaming).
2024-11-06 23:29:27 +00:00
Kim Morrison
a54226196d
feat: minor lemmas about List.ofFn ( #5982 )
...
`List.ofFn` still has very incomplete API.
2024-11-06 23:05:42 +00:00
Kim Morrison
1e98fd7f2d
feat: add another List.find?_eq_some lemma ( #5974 )
...
Inspired by https://github.com/leanprover-community/mathlib4/pull/18593
2024-11-06 10:02:25 +00:00
Kim Morrison
15139b6ef6
feat: relate Array.zipWith/zip/unzip with List versions ( #5972 )
2024-11-06 09:22:08 +00:00
Kim Morrison
128b049904
feat: relate Array.eraseIdx with List.eraseIdx ( #5952 )
2024-11-05 06:13:29 +00:00
Kim Morrison
0e3f26e6df
feat: relate Array.takeWhile with List.takeWhile ( #5950 )
2024-11-05 05:05:53 +00:00
Violeta Hernández
e573676db1
feat: List.pmap_eq_self ( #5927 )
...
This is a `pmap` analog of
[`List.map_id''`](https://leanprover-community.github.io/mathlib4_docs/Init/Data/List/Lemmas.html#List.map_id '').
As discussed on
[Zulip](https://leanprover.zulipchat.com/#narrow/channel/217875-Is-there-code-for-X.3F/topic/.60pmap_eq_self.60/near/472496933 ).
2024-11-05 01:38:13 +00:00
Kim Morrison
c779f3a039
feat: List.mapFinIdx, lemmas, relate to Array version ( #5941 )
2024-11-04 05:29:41 +00:00
Kim Morrison
fc17468f78
chore: upstream List.ofFn and relate to Array.ofFn ( #5938 )
2024-11-04 01:35:29 +00:00
Kyle Miller
b75cc35db2
feat: update omega/solve_by_elim to use new tactic syntax, use new tactic syntax ( #5932 )
...
Following up #5928 , updates the syntax for `omega` and `solve_by_elim`
and restores the syntax quotations in their implementations.
Following up #5898 , uses the new tactic syntax in the library, replacing
all uses of `(config := ...)`.
2024-11-03 16:23:37 +00:00
Kim Morrison
a75a03c077
feat: relate for loops over List with foldlM ( #5913 )
...
There are many more lemmas about `foldlM`, so this may be useful for
reasoning about for loops by transforming them into folds.
The transformation includes accounting for monad effects, but does have
a mild performance difference in that short-circuiting on
`ForInStep.done` is replaced by traversing the rest of the list with a
noop.
2024-11-01 02:41:05 +00:00
Kim Morrison
6922832327
chore: minor tweaks to Array lemmas ( #5912 )
2024-11-01 02:20:16 +00:00
Kim Morrison
a826de8a3d
chore: remove duplicated ForIn instances ( #5892 )
...
I'd previously added an instance from `ForIn'` to `ForIn`, but this then
caused some non-defeq duplication. It seems fine to just remove the
concrete `ForIn` instances in cases where the `ForIn'` instance exists
too. We can even remove a number of type-specific lemmas in favour of
the general ones.
2024-10-31 07:40:09 +00:00
Kim Morrison
5357fd2369
chore: rename List.groupBy to splitBy ( #5879 )
...
This makes room for adding a function that returns a HashMap, parallel
to `Array.groupByKey` (which I may also rename to `Array.groupBy`.
2024-10-30 00:56:52 +00:00
Kim Morrison
07ea626560
feat: Array.forIn', and relate to List ( #5833 )
...
Adds support for `for h : x in my_array do`, and relates this to the
existing `List` version.
2024-10-25 07:24:39 +00:00
Kim Morrison
c1143d9432
feat: more lemmas for List.modify ( #5816 )
2024-10-23 06:45:20 +00:00
Kim Morrison
07c09ee579
feat: relate Array.forIn and List.forIn ( #5799 )
2024-10-22 01:20:13 +00:00
Kim Morrison
919f64b2e6
chore: upstream List.modify, add lemmas, relate to Array.modify ( #5798 )
...
Note that the order of arguments still differs between `List.modify` and
`Array.modify`. I'll settle this later.
2024-10-22 01:01:32 +00:00
Kim Morrison
51377afd6c
feat: simp lemmas for Array.isEqv and beq ( #5786 )
...
- [ ] depends on: #5785
2024-10-21 07:37:40 +00:00
Kim Morrison
8151ac79d6
chore: Array cleanup ( #5782 )
...
More cleanup of Array API. More to come.
2024-10-21 06:00:37 +00:00
Kim Morrison
41797a78c3
chore: deprecate Nat.sum ( #5746 )
2024-10-18 00:03:36 +00:00
Kim Morrison
6fa75e346a
chore: upstream List.foldxM_map ( #5697 )
2024-10-17 04:30:08 +00:00
Kim Morrison
565ac23b78
chore: move Antisymm to Std.Antisymm ( #5740 )
2024-10-17 02:26:55 +00:00
Kim Morrison
3f7854203a
chore: rename List.pure to List.singleton ( #5732 )
2024-10-16 22:11:07 +00:00
Kim Morrison
ef05bdc449
chore: rename List.bind and Array.concatMap to flatMap ( #5731 )
2024-10-16 11:30:49 +00:00
Kim Morrison
dc83a607b2
fix: List.drop_drop addition order ( #5716 )
2024-10-15 10:14:02 +00:00
Kim Morrison
4409e39c43
chore: upstream List.sum, planning to later deprecate Nat.sum ( #5703 )
2024-10-15 08:41:35 +00:00
Kim Morrison
16e2a785aa
chore: remove @[simp] from Option.isSome_eq_isSome ( #5704 )
2024-10-14 12:28:43 +00:00
Johan Commelin
2580694e26
chore: mark prefix_append_right_inj as simp lemma ( #5706 )
2024-10-14 11:49:38 +00:00
Kim Morrison
aa2360a41d
chore: rename List.join to List.flatten
...
one more
one more
one more
fix test
2024-10-14 22:28:12 +11:00
Kim Morrison
20ea855e50
feat: upstream List.mapIdx, and add lemmas ( #5696 )
2024-10-14 07:25:02 +00:00
Henrik Böving
53c5470200
perf: remove List.redLength ( #5605 )
2024-10-03 14:57:33 +00:00
Kim Morrison
a4fda010f3
feat: Array/Option.unattach ( #5586 )
...
More support for automatically removing `.attach`, for `Array` and
`Option`.
2024-10-03 07:29:00 +00:00
Markus Himmel
09dfe1c71c
chore: induction-friendly List.min?_cons ( #5594 )
...
@kim-em, I'm happy to keep any subset of `foldl_min`, `foldl_min_right`,
`foldl_min_le`, `foldl_min_min_of_le` (should that one have been called
`foldl_min_le_of_le`?). Which ones do you like?
2024-10-02 14:10:15 +00:00
Kim Morrison
9322d8d639
feat: List.unattach and simp lemmas ( #5550 )
...
Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
2024-10-02 02:42:54 +00:00
Kim Morrison
e3811fd838
chore: cleanup unused variables ( #5579 )
...
This pulls changes to the standard library out of #5338 .
2024-10-02 01:51:22 +00:00