feat: arbitrary solutions for thm/ax challenges (take 2)#8
Open
JasonGross wants to merge 2 commits intoleanprover:masterfrom
Open
feat: arbitrary solutions for thm/ax challenges (take 2)#8JasonGross wants to merge 2 commits intoleanprover:masterfrom
JasonGross wants to merge 2 commits intoleanprover:masterfrom
Conversation
This PR allows challenges that demand the construction of terms of non-Prop types. We remove the error "Challenge and solution constant kind don't match" in favor of permitting any kind of solution to a challenge that is a theorem or axiom. Note that permitted axioms must still be declared as axioms or theorems in the solution; it would invite inconsistency if we allowed instantiating informative axioms with definitions. The optional field "allow_partial" indicates whether or not challenges may be solved with `partial def` solutions. We uniformly forbid unsafe solutions. We rely on the Lean kernel to mark as unsafe (resp. partial) any definitions that make use of unsafe (resp. partial) dependencies. Axioms is now responsible for ensuring that solutions to challenges are present and have valid kinds (no forbidden axioms recursively; only partial if permitted; not unsafe) Compare is is responsible for ensuring that: - targets are present and are axioms or theorems in the challenge file - targets have the same type in the challenge and solution - any dependency of a solution, which is not an explicit target, and which occurs in both the challenge and the solution, has the same contents in both Fixes #3 (mostly) Fixes #4 Closes leanprover#5 Closes leanprover#6 Closes leanprover#7
74f3783 to
0632d4c
Compare
This file contains hidden or 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
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.
This PR allows challenges that demand the construction of terms of
non-Prop types.
We remove the error "Challenge and solution constant kind don't match"
in favor of permitting any kind of solution to a challenge that is a
theorem or axiom.
Note that permitted axioms must still be declared as axioms or theorems
in the solution; it would invite inconsistency if we allowed
instantiating informative axioms with definitions.
The optional field "allow_partial" indicates whether or not challenges
may be solved with
partial defsolutions. We uniformly forbid unsafesolutions. We rely on the Lean kernel to mark as unsafe (resp. partial)
any definitions that make use of unsafe (resp. partial) dependencies.
This is a more invasive and global change than #7, but I believe it is more principled and better designed. (And when you exclude the 21 loc in Comparator/Utils.lean which is present only for having nicer error messages, it is actually a net reduction of -10 loc.)
Axioms is now responsible for ensuring that solutions to challenges are present and have valid kinds (no forbidden axioms recursively; only partial if permitted; not unsafe)
Compare is is responsible for ensuring that:
Fixes #3 (mostly)
Fixes #4
Closes #5
Closes #6
Closes #7