forked from leanprover/lean4
-
Notifications
You must be signed in to change notification settings - Fork 0
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: fix BitVec.abs, prove toInt produces the expected value #26
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bollu
force-pushed
the
lean4-toint-abs
branch
from
October 15, 2024 04:12
9f51eb4
to
d18e179
Compare
…rover#5688) This replaces `export Lean (Name NameMap)` and `export System (SearchPath FilePath)` with the relevant `open` commands. This fixes docgen output so that it can refer to, for example, `Lean.Name` instead of `Lake.Name`. The reason for these `export`s was convenience: by doing `open Lake` you could get these aliases for free. However, aliases affect pretty printing, and the Lake aliases took precedence. We don't want to disable pretty printing re-exported names because this can be a valid pattern (names could incrementally get re-exported from namespace to parent namespace). In the future we might implement a feature to be able to `scoped open` some names. Breaking change: Lakefiles that refer to `FilePath` may need to change this to `System.FilePath` or otherwise add `open System (FilePath)`. Closes leanprover#2524
…er#5781) Co-authored-by: Tobias Grosser <[email protected]>
This PR simplifies the signature of `Array.mapIdx`, to take a function `f : Nat \to \a \to \b` rather than a function `f : Fin as.size \to \a \to \b`. Lean doesn't actually use the extra generality anywhere (so in fact this change *simplifies* all the call sites of `Array.mapIdx`, since we no longer need to throw away the proof). This change would make the function signature equivalent to `List.mapIdx`, hence making it easier to write verification lemmas. We keep the original behaviour as `Array.mapFinIdx`.
More cleanup of Array API. More to come.
bollu
force-pushed
the
lean4-toint-abs
branch
2 times, most recently
from
October 21, 2024 07:10
1405f9c
to
6d9cce7
Compare
bollu
changed the title
feat: fix BitVec.abs, prove toInt produces the expected value.
feat: fix BitVec.abs, prove toInt produces the expected value
Oct 21, 2024
bollu
force-pushed
the
lean4-toint-abs
branch
4 times, most recently
from
October 21, 2024 07:34
843182c
to
eabe2c1
Compare
bollu
force-pushed
the
lean4-toint-abs
branch
7 times, most recently
from
October 21, 2024 08:23
7a37773
to
4a7b7ae
Compare
…eanprover#5679) Previously `RecursorVal.getInduct` would return the prefix of the recursor’s name, which is unlikely the right value for the “derived” recursors in nested recursion. The code using `RecursorVal.getInduct` seems to expect the name of the inductive type of major argument here. If we return that name, this fixes leanprover#5661. This bug becomes more visible now that we have structural mutual recursion. Also, to avoid confusion, renames the function to ``getMajorInduct`.
bollu
force-pushed
the
lean4-toint-abs
branch
from
October 21, 2024 17:18
4a7b7ae
to
43661f6
Compare
We implement `toInt_abs`. A subtle wrinkle is to note that `abs (intMin w) = intMin w`, which complicates our proof.
bollu
force-pushed
the
lean4-toint-abs
branch
from
October 23, 2024 20:23
ca406e5
to
e7d4c9d
Compare
Co-authored-by: Alex Keizer <[email protected]>
Co-authored-by: Tobias Grosser <[email protected]>
Upstreamed, closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Abs has the interesting wrinkle where if we feed it
intMin
, it staysintMin
:If we compute
-x
, i.e.!x + 1
, we get:In this PR, we show that
abs
ofintMin
producesintMin
again, andabs
of every other number gives.toInt.abs
. We also defineInt.abs
to phrase lemmas naturally.