Lift requirement that choice_types have to be inhabited#98
Merged
4ever2 merged 9 commits intoSSProve:mainfrom Dec 4, 2025
Merged
Lift requirement that choice_types have to be inhabited#984ever2 merged 9 commits intoSSProve:mainfrom
4ever2 merged 9 commits intoSSProve:mainfrom
Conversation
Contributor
Author
|
@ErVinuelas, I made some changes to tSDH.v and I know that you may be depending on it. Will you check that the changes (removing locations and adding default value) are compatible with your development? |
Collaborator
|
I think the changes should be compatible. I had to change the tSDH.v in my own development, so it is no longer the same as the one in main. When I merge (my own branch) I will probably have to change some parts of the proof to accommodate this changes, but I think it should be doable. Thank you for the heads-up. |
ErVinuelas
approved these changes
Dec 1, 2025
Collaborator
|
I was planning to make a pull request regarding adding a chTuple to the choice_type. I will wait for these changes to be merged to make the pull request. |
Contributor
|
Thanks! LGTM. @4ever2 feel free to merge when you're happy. |
4ever2
approved these changes
Dec 4, 2025
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 lifts the requirement that choice_types are inhabited, which allows for significant simplifications. This also allows us to model all
finTypes aschoice_typeinstead of just the inhabited ones, which makes parametric arguments simpler. All in all: less up front proof obligations (and custom concepts) for the user.A canonical element (
chCanonical) was relied upon in the following constructs:resolve). Instead, we sample from the null distribution (corresponding tofailor#assert false). The behavior on failed resolution is not relied upon by any of the code as it cannot happen when two packages with compatible interfaces are composed.opr(a call to underlying module). Like above, we sample from the null distribution instead.This has led to the following simplifications and improvements:
chFinuses anatinstead of a custompositiverecord (which is anatincluding a proof of positivity). As a consequence allfinTypes can be represented and there is no need for aPositiveproof.uniformis defined for all natural numbers, butuniform 0is equivalent tofail. So to proveLosslessOpofuniform nwe require that0 < n. However, this is only required to be known in very few places throughout the examples.chCanonical,positiveandPositiveand minor definitions have been removed. This has led to simplifications in all affected the examples.coercereturns an option and callees have to decide what happens on failed type coercion.mkloc n (v : T)defines aLocationnumberedn : natwith initial valuevof typeT(which should be achoice_typeby reverse coercion).tSDH.vhas been fixed (adversary was able to callguessbeforeset_up. This kind of bug should become less prevalent because there is no obvious initial element to choose and therefore the location should be anoption.