-
Notifications
You must be signed in to change notification settings - Fork 465
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: Array.mem: Avoid DecidableEq, set up decreasing_trivial #2774
Conversation
awaiting-review |
A first attempt failed tests like
where there is not even any It seemed that |
|
You should make it a |
Will do. Is there a difference between a one field structure and a one field one constructor inductive? Ive seen both patterns so far. |
Structures have various additional niceties, I don't see why you would ever not use them unless you don't meet the restrictions. Do you have an example? (The field projection is the main important nicety in this case.) |
I've seen it mostly with rose trees recently: lean4/src/Lean/Data/PrefixTree.lean Line 11 in 6c5f79c
Maybe the benefit of an inductive is that you don't have to think of a name for the projection :-) |
Fixed in 9a7d350, PTAL. |
Squashed. (And because Github is very strange in that squashing is just one click away when merging, but basically impossible without a laptop and a command line for the PR authors, in the process I wrote half a Github App that squashes PRs… :-) |
e1a1fc3
to
bf19459
Compare
My suggestion would be to just use |
977f2e6
to
3864fa4
Compare
done |
The notation `a ∈ as` for Arrays was previously only defined with `DecidableEq` on the elements, for (apparently) no good reason. This drops this requirements (by using `a ∈ as.data`), and simplifies a bunch of proofs by simply lifting the corresponding proof from lists. Also, `sizeOf_lt_of_mem` was defined, but not set up to be picked up by `decreasing_trivial` in the same way that the corresponding List lemma was set up, so this adds the tactic setup. The definition for `a ∈ as` is intentionally not defeq to `a ∈ as.data` so that the termination tactics for Arrays don’t spuriously apply when recursing through lists.
…over#2774) The notation `a ∈ as` for Arrays was previously only defined with `DecidableEq` on the elements, for (apparently) no good reason. This drops this requirements (by using `a ∈ as.data`), and simplifies a bunch of proofs by simply lifting the corresponding proof from lists. Also, `sizeOf_lt_of_mem` was defined, but not set up to be picked up by `decreasing_trivial` in the same way that the corresponding List lemma was set up, so this adds the tactic setup. The definition for `a ∈ as` is intentionally not defeq to `a ∈ as.data` so that the termination tactics for Arrays don’t spuriously apply when recursing through lists.
The notation
a ∈ as
for Arrays was previously only defined withDecidableEq
on the elements, for (apparently) no good reason. Thisdrops this requirements (by using
a ∈ as.data
), and simplifies a bunchof proofs by simply lifting the corresponding proof from lists.
Also,
sizeOf_lt_of_mem
was defined, but not set up to be picked up bydecreasing_trivial
in the same way that the corresponding List lemmawas set up, so this adds the tactic setup.
The definition for
a ∈ as
is intentionally not defeq toa ∈ as.data
so that the termination tactics for Arrays don’t spuriously apply when
recursing through lists.