Skip to content

Commit e0d6539

Browse files
authored
Refactor reachability proof strategies (#1932)
* Rename "remove destination" to "check implication" We would like to use the same terminology as the domain experts, which is "check implication". * Remove ProofState type family The ProofState associated type family is always instantiated at the concrete ProofState type, so this was a meaningless layer of indirection. * Remove Prim type family The associated type family Prim was only ever instantiated at a single type. * checkImplication: Return CheckImplicationResult The function checkImplication returns a CheckImplicationResult instead of a ProofState. This follows a principle from domain-driven design: the function indicates its own result (CheckImplicationResult) instead of telling the caller what to do next (ProofState). The code is more flexible because checkImplication now does not need to know anything about the caller. * Move TransitionRuleTemplate into Goal class * Move logTransitionRule to Kore.Strategies.Verification This acts to separate the domain model from the application code. * Move withDebugProofState to Kore.Strategies.Verification This change extracts application code from the domain model. * Extract transitionRule Now, the only instance of transitionRule is the canonical instance. This instance _defines_ reachability proving and the individual types of reachability claims may only define how they implement each step. * Move withConfiguration to Kore.Strategies.Verification This change reinforces the separation between the application and domain model code. * Goal: Remove MonadCatch constraints * Add applyClaims * Add instance Foldable ProofState * Add applyAxioms * Remove redundant steps from one-path strategy This makes the one-path strategy like the all-path strategy. * Test.Kore.Strategies.AllPath.AllPath: Use ApplyAxioms and ApplyClaims * Remove DerivePar and DeriveSeq * TODO: ApplyResult * Extract strategy from class Goal The strategy belongs to and is common to all reachability proofs. * Remove stray comment * withConfiguration: Use extractUnproven * rm test/imp/sum-breadth-limit-three-spec.k
1 parent 4b5e164 commit e0d6539

File tree

10 files changed

+517
-756
lines changed

10 files changed

+517
-756
lines changed

kore/src/Kore/Log/DebugProofState.hs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ module Kore.Log.DebugProofState
99

1010
import Prelude.Kore
1111

12-
import Kore.Rewriting.RewritingVariable
1312
import Kore.Step.RulePattern
1413
( ReachabilityRule (..)
15-
, RewriteRule (..)
1614
)
1715
import Kore.Strategies.ProofState
1816
( Prim (..)
@@ -27,7 +25,7 @@ import qualified Pretty
2725
data DebugProofState =
2826
DebugProofState
2927
{ proofState :: ProofState ReachabilityRule
30-
, transition :: Prim (RewriteRule RewritingVariableName)
28+
, transition :: Prim
3129
, result :: Maybe (ProofState ReachabilityRule)
3230
}
3331
deriving (Show)
@@ -44,14 +42,10 @@ instance Pretty DebugProofState where
4442
[ "Reached proof state with the following configuration:"
4543
, Pretty.indent 4 (pretty proofState)
4644
, "On which the following transition applies:"
47-
, Pretty.indent 4 (prettyTransition transition)
45+
, Pretty.indent 4 (pretty transition)
4846
, "Resulting in:"
4947
, Pretty.indent 4 (maybe "Terminal state." pretty result)
5048
]
51-
where
52-
prettyTransition (DeriveSeq _) = "Transition DeriveSeq."
53-
prettyTransition (DerivePar _) = "Transition DerivePar."
54-
prettyTransition prim = Pretty.pretty prim
5549

5650
instance Entry DebugProofState where
5751
entrySeverity _ = Debug

kore/src/Kore/Log/InfoReachability.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ License : NCSA
66
module Kore.Log.InfoReachability
77
( InfoReachability (..)
88
, whileSimplify
9-
, whileRemoveDestination
9+
, whileCheckImplication
1010
, whileDeriveSeq
1111
, whileDerivePar
1212
) where
@@ -19,7 +19,7 @@ import qualified Pretty
1919

2020
data InfoReachability
2121
= InfoSimplify !ReachabilityRule
22-
| InfoRemoveDestination !ReachabilityRule
22+
| InfoCheckImplication !ReachabilityRule
2323
| InfoDeriveSeq ![Rule ReachabilityRule] !ReachabilityRule
2424
| InfoDerivePar ![Rule ReachabilityRule] !ReachabilityRule
2525
deriving (Show)
@@ -55,8 +55,8 @@ prettyInfoReachabilityGoalAndRules transition goal rules fromRule =
5555
instance Pretty.Pretty InfoReachability where
5656
pretty (InfoSimplify goal) =
5757
prettyInfoReachabilityGoal "Simplify" goal
58-
pretty (InfoRemoveDestination goal) =
59-
prettyInfoReachabilityGoal "RemoveDestination" goal
58+
pretty (InfoCheckImplication goal) =
59+
prettyInfoReachabilityGoal "CheckImplication" goal
6060
pretty (InfoDeriveSeq rules goal) =
6161
prettyInfoReachabilityGoalAndRules
6262
"DeriveSeq"
@@ -74,7 +74,7 @@ instance Entry InfoReachability where
7474
entrySeverity _ = Info
7575
shortDoc (InfoSimplify _) =
7676
Just "While simplifying the configuration"
77-
shortDoc (InfoRemoveDestination _) =
77+
shortDoc (InfoCheckImplication _) =
7878
Just "While checking implication of the proof goal"
7979
shortDoc (InfoDeriveSeq _ _) =
8080
Just "While applying axioms in sequence"
@@ -89,12 +89,12 @@ whileSimplify
8989
-> log a
9090
whileSimplify goal = logWhile (InfoSimplify goal)
9191

92-
whileRemoveDestination
92+
whileCheckImplication
9393
:: MonadLog log
9494
=> ReachabilityRule
9595
-> log a
9696
-> log a
97-
whileRemoveDestination goal = logWhile (InfoRemoveDestination goal)
97+
whileCheckImplication goal = logWhile (InfoCheckImplication goal)
9898

9999
whileDeriveSeq
100100
:: MonadLog log

0 commit comments

Comments
 (0)