Skip to content

Commit da2c7f8

Browse files
JKTKopsgithub-actionsrv-jenkins
authored
Apply Substitutions to ClaimPatterns When Simplifying (#2764)
* Potentially fix logic, but some tests fail * Update tests, new integration test * Format with fourmolu * update integration tests that output affected configs * simplify construction of Patterns in tests Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: rv-jenkins <admin@runtimeverification.com>
1 parent 757e5e2 commit da2c7f8

File tree

9 files changed

+196
-208
lines changed

9 files changed

+196
-208
lines changed

kore/src/Kore/Reachability/Claim.hs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,16 @@ simplify' ::
590590
Strategy.TransitionT (AppliedRule claim) m claim
591591
simplify' lensClaimPattern claim = do
592592
claim' <- simplifyLeftHandSide claim
593-
let sideCondition = extractSideCondition claim'
594-
simplifyRightHandSide lensClaimPattern sideCondition claim'
593+
let claim'' = Lens.over lensClaimPattern applySubstOnRightHandSide claim'
594+
sideCondition = extractSideCondition claim''
595+
simplifyRightHandSide lensClaimPattern sideCondition claim''
595596
where
597+
applySubstOnRightHandSide claimPat =
598+
let substitution = Pattern.substitution $ Lens.view (field @"left") claimPat
599+
noLeftSubst = Lens.set (field @"left" . field @"substitution") mempty claimPat
600+
appliedSubst = ClaimPattern.applySubstitution substitution noLeftSubst
601+
in appliedSubst
602+
596603
extractSideCondition =
597604
SideCondition.fromConditionWithReplacements
598605
. Pattern.withoutTerm

kore/test/Test/Kore/Reachability/OnePathStrategy.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,7 @@ test_onePathStrategy =
808808
)
809809
)
810810
left' =
811-
Pattern.withCondition
812-
Mock.a
813-
(Condition.assign (inject Mock.x) Mock.a)
811+
Pattern.fromTermLike Mock.a
814812
right =
815813
Pattern.withCondition
816814
(TermLike.mkElemVar Mock.x)

kore/test/Test/Kore/Reachability/Prove.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,7 @@ test_proveClaims =
426426
)
427427
)
428428
)
429-
, Pattern.withCondition
430-
Mock.b
431-
(Condition.assign (inject Mock.x) Mock.a)
429+
, Pattern.fromTermLike Mock.b
432430
]
433431
initialPattern =
434432
Pattern.fromTermLike
Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,10 @@
1-
/* Created: Kore.Internal.OrPattern.toTermLike */
2-
/* Spa */
3-
\and{SortGeneratedTopCell{}}(
1+
/* Fl Fn D Sfa */
2+
Lbl'-LT-'generatedTop'-GT-'{}(
3+
/* Fl Fn D Sfa Cl */ Lbl'-LT-'k'-GT-'{}(/* Fl Fn D Sfa Cl */ dotk{}()),
44
/* Fl Fn D Sfa */
5-
Lbl'-LT-'generatedTop'-GT-'{}(
6-
/* Fl Fn D Sfa Cl */ Lbl'-LT-'k'-GT-'{}(/* Fl Fn D Sfa Cl */ dotk{}()),
7-
/* Fl Fn D Sfa */
8-
Lbl'-LT-'generatedCounter'-GT-'{}(
9-
/* Fl Fn D Sfa */ Var'Unds'DotVar1:SortInt{}
10-
),
11-
/* Fl Fn D Sfa Cl */
12-
Lbl'-LT-'size'-GT-'{}(/* Fl Fn D Sfa Cl */ \dv{SortInt{}}("1"))
5+
Lbl'-LT-'generatedCounter'-GT-'{}(
6+
/* Fl Fn D Sfa */ Var'Unds'DotVar1:SortInt{}
137
),
14-
/* Spa */
15-
\and{SortGeneratedTopCell{}}(
16-
/* Spa */
17-
\equals{SortMyList{}, SortGeneratedTopCell{}}(
18-
/* Fl Fn D Sfa */ Var'Unds'0:SortMyList{},
19-
/* Fl Fn D Sfa */
20-
Lbl'UndsUndsUnds'LIST-SIZER-SYNTAX'Unds'MyList'Unds'Int'Unds'MyList{}(
21-
/* Fl Fn D Sfa */ Var'Unds'E:SortInt{},
22-
/* Fl Fn D Sfa Cl */
23-
Lbl'Stop'MyList'Unds'LIST-SIZER-SYNTAX'Unds'MyList{}()
24-
)
25-
),
26-
/* Spa */
27-
\equals{SortMyList{}, SortGeneratedTopCell{}}(
28-
/* Fl Fn D Sfa */ VarL:SortMyList{},
29-
/* Fl Fn D Sfa Cl */
30-
Lbl'Stop'MyList'Unds'LIST-SIZER-SYNTAX'Unds'MyList{}()
31-
)
32-
)
8+
/* Fl Fn D Sfa Cl */
9+
Lbl'-LT-'size'-GT-'{}(/* Fl Fn D Sfa Cl */ \dv{SortInt{}}("1"))
3310
)

0 commit comments

Comments
 (0)