Skip to content

Conversation

@muenchnerkindl
Copy link
Contributor

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.

Signed-off-by: Stephan Merz <stephan.merz@loria.fr>
Signed-off-by: Stephan Merz <stephan.merz@loria.fr>
@muenchnerkindl
Copy link
Contributor Author

Any comments on these theorems? Are they ready to be merged?
@kape1395 confirmed offline that the previous versions of the theorems can be removed.

…rems and proofs

Signed-off-by: Stephan Merz <stephan.merz@loria.fr>
@@ -0,0 +1,77 @@
--------------------------- MODULE FoldTheorems ---------------------------
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd favor consistency.

(* This module only lists theorem statements for reference. The proofs *)
(* can be found in module FoldTheorems_proofs.tla. *)
(*************************************************************************)
EXTENDS Folds, FiniteSets, TLAPS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove TLAPS from EXTEND?

EXTENDS FiniteSetsExt, FiniteSets, Integers
(*************************************************************************)
(* This module only lists theorem statements for reference. The proofs *)
(* can be found in module FiniteSetsExt_theorems_proofs.tla. *)
Copy link
Member

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 ==
Copy link
Member

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}
Copy link
Member

@lemmy lemmy Dec 15, 2025

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?

Copy link
Member

@lemmy lemmy left a 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?

@lemmy lemmy requested a review from Copilot December 15, 2025 15:09
@lemmy

This comment was marked as outdated.

This comment was marked as outdated.

Signed-off-by: Stephan Merz <stephan.merz@loria.fr>
@muenchnerkindl
Copy link
Contributor Author

@lemmy Thank you for your review. I addressed all of the remarks except leaving S \subseteq {0} in the statement, but explaining the disjunction in the comment.

The proofs are checked with the HEAD of TLAPS: the binary release is too outdated to make much sense anymore.

@lemmy
Copy link
Member

lemmy commented Dec 15, 2025

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.

@muenchnerkindl muenchnerkindl merged commit 8d6a226 into master Dec 15, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants