-
Notifications
You must be signed in to change notification settings - Fork 45
theorem library for fold operators #116
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
Conversation
Signed-off-by: Stephan Merz <stephan.merz@loria.fr>
b346abd to
bb74c66
Compare
Signed-off-by: Stephan Merz <stephan.merz@loria.fr>
|
Any comments on these theorems? Are they ready to be merged? |
…rems and proofs Signed-off-by: Stephan Merz <stephan.merz@loria.fr>
modules/FoldTheorems.tla
Outdated
| @@ -0,0 +1,77 @@ | |||
| --------------------------- MODULE FoldTheorems --------------------------- | |||
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.
You used snake_case for FiniteSetsExt_theorems earlier, but camelCase here.
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.
In fact, @kape1395 used snake_case for that module, but we had used camelCase for all other modules (in the standard library and here). I just changed FiniteSetExt_theorems to FiniteSetExtTheorems for consistency.
Related, FoldTheorems should perhaps be renamed to FoldsTheorems, even if it sounds ugly?
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.
I'd favor consistency.
modules/FoldTheorems.tla
Outdated
| (* This module only lists theorem statements for reference. The proofs *) | ||
| (* can be found in module FoldTheorems_proofs.tla. *) | ||
| (*************************************************************************) | ||
| EXTENDS Folds, FiniteSets, TLAPS |
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.
Remove TLAPS from EXTEND?
modules/FiniteSetsExtTheorems.tla
Outdated
| EXTENDS FiniteSetsExt, FiniteSets, Integers | ||
| (*************************************************************************) | ||
| (* This module only lists theorem statements for reference. The proofs *) | ||
| (* can be found in module FiniteSetsExt_theorems_proofs.tla. *) |
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.
The filename is now outdated.
| ASSUME NEW S \in SUBSET Int, IsFiniteSet(S) | ||
| PROVE ProductSet(S) \in Int | ||
|
|
||
| THEOREM ProductSetNonempty == |
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.
Also add ProductSetEmpty (THEOREM ProductSetEmpty == ProductSet({}) = 1) for consistency with SumSetEmpty?
|
|
||
| THEOREM SumSetNatZero == | ||
| ASSUME NEW S \in SUBSET Nat, IsFiniteSet(S) | ||
| PROVE SumSet(S) = 0 <=> S \subseteq {0} |
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.
S \subseteq {0} is elegant, but perhaps the more explicit (S = {} \/ S = {0}) instead of S \subseteq {0} (same below for ProductSetNatOne) is easier to understand?
lemmy
left a comment
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.
Adding comments would make the theorems in FoldTheorems.tla and FiniteSetsExtTheorems.tla more accessible.
We should integrate TLAPS into the CI. Related question: which version (release vs. HEAD) of TLAPS discharges these proofs?
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Stephan Merz <stephan.merz@loria.fr>
|
@lemmy Thank you for your review. I addressed all of the remarks except leaving The proofs are checked with the HEAD of TLAPS: the binary release is too outdated to make much sense anymore. |
|
Assuming the pre-release at https://github.com/tlaplus/tlapm/releases/download/1.6.0-pre/tlapm-1.6.0-pre-x86_64-linux-gnu.tar.gz is sufficient to prove these theorems, https://github.com/tlaplus-workshops/ewd998/blob/36880a06bc5e251eb3ad982a0d03a3fd55670a0a/.github/workflows/main.yml#L26 shows an extremely simple integration of TLAPS into Github CI. |
This PR adds a library of theorems for the fold operators defined in modules Fold.tla and FiniteSetsExt.tla.
@kape1395: These theorems essentially supersede those that (I believe) you introduced for the operator MapThenSumSet of module FIniteSetsExt, using proofs about the underlying MapThenFoldSet operator rather than going through an auxiliary operator. Your theorems and proofs are still there, below the end module separator, but it looks to me that they are not needed anymore.