-
Notifications
You must be signed in to change notification settings - Fork 418
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
fix: bring elaborator in line with kernel for primitive projections #5822
Merged
+127
−30
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/-! | ||
# Tests for numeric projections of inductive types | ||
-/ | ||
|
||
/-! | ||
Non-recursive, no indices. | ||
-/ | ||
inductive I0 where | ||
| mk (x : Nat) (xs : List Nat) | ||
/-- info: fun v => v.1 : I0 → Nat -/ | ||
#guard_msgs in #check fun (v : I0) => v.1 | ||
/-- info: fun v => v.2 : I0 → List Nat -/ | ||
#guard_msgs in #check fun (v : I0) => v.2 | ||
|
||
/-! | ||
Recursive, no indices. | ||
-/ | ||
inductive I1 where | ||
| mk (x : Nat) (xs : I1) | ||
/-- info: fun v => v.1 : I1 → Nat -/ | ||
#guard_msgs in #check fun (v : I1) => v.1 | ||
/-- info: fun v => v.2 : I1 → I1 -/ | ||
#guard_msgs in #check fun (v : I1) => v.2 | ||
|
||
/-! | ||
Non-recursive, indices. | ||
-/ | ||
inductive I2 : Nat → Type where | ||
| mk (x : Nat) (xs : List (Fin x)) : I2 (x + 1) | ||
/-- info: fun v => v.1 : I2 2 → Nat -/ | ||
#guard_msgs in #check fun (v : I2 2) => v.1 | ||
/-- info: fun v => v.2 : (v : I2 2) → List (Fin v.1) -/ | ||
#guard_msgs in #check fun (v : I2 2) => v.2 | ||
|
||
/-! | ||
Recursive, indices. | ||
-/ | ||
inductive I3 : Nat → Type where | ||
| mk (x : Nat) (xs : I3 (x + 1)) : I3 x | ||
/-- info: fun v => v.1 : I3 2 → Nat -/ | ||
#guard_msgs in #check fun (v : I3 2) => v.1 | ||
/-- info: fun v => v.2 : (v : I3 2) → I3 (v.1 + 1) -/ | ||
#guard_msgs in #check fun (v : I3 2) => v.2 | ||
|
||
|
||
/-! | ||
Make sure these can be compiled. | ||
-/ | ||
def f0_1 (v : I0) : Nat := v.1 | ||
def f0_2 (v : I0) : List Nat := v.2 | ||
def f1_1 (v : I1) : Nat := v.1 | ||
def f1_2 (v : I1) : I1 := v.2 | ||
def f2_1 (v : I2 n) : Nat := v.1 | ||
def f2_2 (v : I2 n) : List (Fin (f2_1 v)) := v.2 | ||
def f3_1 (v : I3 n) : Nat := v.1 | ||
def f3_2 (v : I3 n) : I3 (f3_1 v + 1) := v.2 |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename these functions in the future? It is ok to merge with the current names, but I guess we will get confused in the future. I am referring to
matchConstStructure
andmatchConstStructureLike
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
matchConstStructure
andmatchConstNonRecStructure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created an issue to track this suggestion #5891