From f2fa444b0c88c14e389ab0421d13f6c2289a069e Mon Sep 17 00:00:00 2001 From: Markus Alexander Kuppe Date: Tue, 1 Dec 2026 11:29:05 -0800 Subject: [PATCH] Restore suffix and constant-function sum proofs Prove the empty and reflexive suffix cases using the corresponding prefix theorems on reversed sequences. Establish the constant function's domain, type, and pointwise value before applying SumFunctionOnSetConst. In the graph proofs, show that the repeat-index injection misses a specific index before ruling out surjectivity. Use TreeAcyclic to pick a node before recovering its index in the path. Z3 upgrade: https://github.com/tlaplus/tlapm/pull/347 Related proof-search issue: https://github.com/tlaplus/tlapm/issues/291 Co-authored-by: GPT-6.2 Sol Signed-off-by: Markus Alexander Kuppe --- modules/FunctionTheorems_proofs.tla | 11 ++++++++++- modules/GraphTheorems_proofs.tla | 14 ++++++++++++-- modules/SequencesExtTheorems_proofs.tla | 11 +++++++++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/modules/FunctionTheorems_proofs.tla b/modules/FunctionTheorems_proofs.tla index d2c912b..2cb9bbe 100644 --- a/modules/FunctionTheorems_proofs.tla +++ b/modules/FunctionTheorems_proofs.tla @@ -1431,7 +1431,16 @@ BY SumFunctionOnSetZero DEF SumFunction THEOREM SumFunctionConst == ASSUME NEW S, IsFiniteSet(S), NEW c \in Int PROVE SumFunction([s \in S |-> c]) = c * Cardinality(S) -BY SumFunctionOnSetConst DEF SumFunction +<1>. DEFINE f == [s \in S |-> c] +<1>1. DOMAIN f = S + OBVIOUS +<1>2. f \in [S -> Int] + OBVIOUS +<1>3. \A x \in S : f[x] = c + OBVIOUS +<1>4. SumFunctionOnSet(f, S) = c * Cardinality(S) + BY <1>2, <1>3, SumFunctionOnSetConst +<1>. QED BY <1>1, <1>4 DEF SumFunction THEOREM SumFunctionMonotonic == ASSUME NEW f, IsFiniteSet(DOMAIN f), NEW g, DOMAIN g = DOMAIN f, diff --git a/modules/GraphTheorems_proofs.tla b/modules/GraphTheorems_proofs.tla index 9739c85..7c81fe8 100644 --- a/modules/GraphTheorems_proofs.tla +++ b/modules/GraphTheorems_proofs.tla @@ -245,7 +245,15 @@ THEOREM ExistsPathIffExistsSimplePath == <4>7. i \notin Repeats(qq) BY <3>2 <4>8. inj \notin Surjection(Repeats(qq), Repeats(pp)) - BY <3>2, <4>6, <4>7, SMTT(10) DEF Surjection + <5>1. j > i + BY <3>2 + <5>2. ASSUME NEW ii \in Repeats(qq) + PROVE inj[ii] # i + <6>1. ii \in Int + OBVIOUS + <6>. HIDE DEF Repeats, qq + <6>. QED BY <5>1, <6>1, <4>7 + <5>. QED BY <4>6, <5>2, Zenon DEF Surjection <4>9. /\ CR(qq) <= CR(pp) /\ CR(qq) # CR(pp) <5>. HIDE DEF Repeats, inj, qq @@ -368,7 +376,9 @@ THEOREM TreeSimplePath == BY DEF Path <1>. DEFINE S == {p[k] : k \in i .. j} <1>1. PICK k \in i..j : \A e \in G.edge : e[1] = p[k] => e[2] \notin S - BY TreeAcyclic, S \subseteq G.node, S # {} + <2>1. PICK q \in S : \A e \in G.edge : e[1] = q => e[2] \notin S + BY TreeAcyclic, S \subseteq G.node, S # {}, Zenon + <2>. QED BY <2>1, Zenon <1>2. CASE k < j <2>1. /\ <> \in G.edge /\ p[k+1] \in S diff --git a/modules/SequencesExtTheorems_proofs.tla b/modules/SequencesExtTheorems_proofs.tla index 00bf47f..185b993 100644 --- a/modules/SequencesExtTheorems_proofs.tla +++ b/modules/SequencesExtTheorems_proofs.tla @@ -705,7 +705,14 @@ THEOREM EmptyIsSuffix == /\ IsSuffix(s, <<>>) <=> s = <<>> /\ IsStrictSuffix(<<>>, s) <=> s # <<>> /\ ~ IsStrictSuffix(s, <<>>) -BY IsSuffixProperties, IsStrictSuffixProperties +<1>1. Reverse(s) \in Seq(S) + BY ReverseProperties +<1>2. Reverse(s) = <<>> <=> s = <<>> + BY ReverseEmpty, ReverseEmptyIffEmpty +<1>3. /\ IsPrefix(<<>>, Reverse(s)) + /\ IsPrefix(Reverse(s), <<>>) <=> Reverse(s) = <<>> + BY <1>1, EmptyIsPrefix +<1>. QED BY <1>2, <1>3, ReverseEmpty DEF IsSuffix, IsStrictSuffix THEOREM IsSuffixConcat == ASSUME NEW S, NEW s \in Seq(S), NEW t \in Seq(S) @@ -731,7 +738,7 @@ THEOREM IsSuffixPartialOrder == /\ \A s,t \in Seq(S) : IsSuffix(s,t) /\ IsSuffix(t,s) => s = t /\ \A s,t,u \in Seq(S) : IsSuffix(s,t) /\ IsSuffix(t,u) => IsSuffix(s,u) <1>1. ASSUME NEW s \in Seq(S) PROVE IsSuffix(s,s) - BY s = s \o <<>>, IsSuffixProperties + BY IsPrefixPartialOrder, ReverseProperties DEF IsSuffix <1>2. ASSUME NEW s \in Seq(S), NEW t \in Seq(S), IsSuffix(s,t), IsSuffix(t,s) PROVE s = t BY <1>2, IsPrefixPartialOrder, ReverseProperties, ReverseEqual DEF IsSuffix