File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
booster/library/Booster/Pattern Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ module Booster.Pattern.Match (
1010 FailReason (.. ),
1111 Substitution ,
1212 matchTerms ,
13+ matchTermsWithSubst ,
1314 checkSubsort ,
1415 SortError (.. ),
1516) where
@@ -121,6 +122,10 @@ instance FromModifiersT mods => Pretty (PrettyWithModifiers mods FailReason) whe
121122
122123type Substitution = Map Variable Term
123124
125+ -- | Specialisation of @matchTermsWithSubst@ to an empty initial substitution
126+ matchTerms :: MatchType -> KoreDefinition -> Term -> Term -> MatchResult
127+ matchTerms matchType def = matchTermsWithSubst matchType def mempty
128+
124129{- | Attempts to find a simple unifying substitution for the given
125130 terms.
126131
@@ -131,8 +136,9 @@ type Substitution = Map Variable Term
131136 to ensure that we always produce a matching substitution without having to check
132137 after running the matcher
133138-}
134- matchTerms :: MatchType -> KoreDefinition -> Term -> Term -> MatchResult
135- matchTerms matchType KoreDefinition {sorts} term1 term2 =
139+ matchTermsWithSubst ::
140+ MatchType -> KoreDefinition -> Substitution -> Term -> Term -> MatchResult
141+ matchTermsWithSubst matchType KoreDefinition {sorts} knownSubst term1 term2 =
136142 let runMatch :: MatchState -> MatchResult
137143 runMatch =
138144 fromEither
@@ -153,7 +159,7 @@ matchTerms matchType KoreDefinition{sorts} term1 term2 =
153159 else
154160 runMatch
155161 State
156- { mSubstitution = Map. empty
162+ { mSubstitution = knownSubst
157163 , mQueue = Seq. singleton (term1, term2) -- PriorityQueue.singleton (term1, term2) RegularTerm ()
158164 , mMapQueue = mempty
159165 , mIndeterminate = []
You can’t perform that action at this time.
0 commit comments