Skip to content

Commit c866c11

Browse files
committed
fix preprocessing for matching, until implies eventually goes through
1 parent b2dda5f commit c866c11

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

prover/strategies/matching.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,37 @@ module MATCHING-FUNCTIONAL
3636
rule (MR1, MR1s) ++MatchResults MR2s => MR1, (MR1s ++MatchResults MR2s)
3737
rule .MatchResults ++MatchResults MR2s => MR2s
3838
39-
rule #match( terms: \and(sep(H), Hs), pattern: P, variables: Vs )
40-
=> #match( terms: H, pattern: P, variables: Vs )
41-
++MatchResults #match( terms: \and(Hs), pattern: P, variables: Vs )
42-
requires Hs =/=K .Patterns
43-
44-
rule #match( terms: \and(sep(H), .Patterns), pattern: P, variables: Vs )
45-
=> #match( terms: H, pattern: P, variables: Vs )
46-
47-
rule #match( terms: \and(.Patterns), pattern: P, variables: Vs )
39+
rule #match( terms: \and(T, Ts), pattern: P, variables: Vs )
40+
=> #match( terms: T, pattern: P, variables: Vs )
41+
++MatchResults #match( terms: \and(Ts), pattern: P, variables: Vs )
42+
requires \and(_) :/=K P
43+
rule #match( terms: \and(T, .Patterns), pattern: P, variables: Vs )
44+
=> #match( terms: T, pattern: P, variables: Vs )
45+
requires \and(_) :/=K P
46+
rule #match( terms: \and(.Patterns), pattern: P, variables: Vs )
4847
=> .MatchResults
48+
requires \and(_) :/=K P
4949
50-
rule #match( terms: T, pattern: P, variables: Vs )
51-
=> #filterErrors( #matchAssocComm( terms: T
52-
, pattern: P
50+
rule #match( terms: sep(Ts), pattern: sep(Ps), variables: Vs )
51+
=> #filterErrors( #matchAssocComm( terms: Ts
52+
, pattern: Ps
5353
, variables: Vs
5454
, results: .MatchResults
5555
, subst: .Map
5656
, rest: .Patterns
5757
)
5858
)
59+
60+
rule #match( terms: Ts, pattern: Ps, variables: Vs )
61+
=> #filterErrors( #matchAssoc( terms: Ts
62+
, pattern: Ps
63+
, variables: Vs
64+
, subst: .Map
65+
, rest: .Patterns
66+
)
67+
)
5968
[owise]
60-
// requires isSpatialPattern(sep(T))
69+
6170
syntax MatchResults ::= #filterErrors(MatchResults) [function]
6271
rule #filterErrors(MR:Error , MRs) => #filterErrors(MRs)
6372
rule #filterErrors(MR , MRs) => MR , #filterErrors(MRs)
@@ -153,7 +162,9 @@ Recurse over assoc-only constructors (including `pto`):
153162
, subst: SUBST
154163
, rest: REST
155164
)
165+
requires S =/=K sep
156166
167+
// TODO: the conjunction/disjunction matching rules should be more general, i.e. aware of commutativity
157168
// Recursive over conjunction
158169
rule #matchAssoc( terms: \and(T_ARGs), Ts
159170
=> T_ARGs ++Patterns Ts
@@ -742,14 +753,15 @@ Remove any patterns on the RHS that match a pattern on the LHS:
742753
```k
743754
rule <claim> \implies(\and(LHS), \exists{Vs} \and(RHS, REST)) </claim>
744755
<k> patterns-equal
745-
=> with-each-match( #match( terms: LHS
756+
=> with-each-match( #match( terms: \and(LHS)
746757
, pattern: RHS
747758
, variables: .Patterns
748759
)
749760
, patterns-equal
750761
)
751762
...
752763
</k>
764+
753765
rule <claim> \implies(LHS, \exists{ Vs } \and(RHS, REST))
754766
=> \implies(LHS, \exists{ Vs } \and(REST))
755767
</claim>

prover/t/ltl/until-implies-eventually.kore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ phi-implies-phi
3838
*/
3939

4040
strategy normalize . kt . ( ( right-unfold-Nth(0, 0) . normalize . patterns-equal . rhs-top )
41-
| ( right-unfold-Nth(0, 1) . normalize . lift-constraints . wait . patterns-equal . wait . rhs-top )
41+
| ( right-unfold-Nth(0, 1) . normalize . lift-constraints . patterns-equal . rhs-top )
4242
)

0 commit comments

Comments
 (0)