-
Notifications
You must be signed in to change notification settings - Fork 78
Remove SAWCore.Simulator.TermModel #2660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fe02a9b to
c2fe216
Compare
7d0218f to
ffac933
Compare
| , "for the function." | ||
| ] | ||
|
|
||
| , prim "extract_uninterp" "[String] -> [String] -> Term -> TopLevel (Term, [(String,[(Term, Term)])])" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note this function's removal in the SAW changelog.
| normalize_term_opaque :: [Text] -> TypedTerm -> TopLevel TypedTerm | ||
| normalize_term_opaque opaque tt = | ||
| do sc <- getSharedContext | ||
| modmap <- io (scGetModuleMap sc) | ||
| idxs <- mconcat <$> mapM (resolveName sc) opaque | ||
| let opaqueSet = Set.fromList idxs | ||
| tm' <- io (TM.normalizeSharedTerm sc modmap mempty mempty opaqueSet (ttTerm tt)) | ||
| tm' <- io (scTypeCheckWHNF sc =<< scUnfoldConstantSet sc False opaqueSet (ttTerm tt)) | ||
| pure tt{ ttTerm = tm' } | ||
|
|
||
| goal_normalize :: [Text] -> ProofScript () | ||
| goal_normalize opaque = | ||
| execTactic $ tacticChange $ \goal -> | ||
| do sc <- getSharedContext | ||
| idxs <- mconcat <$> mapM (resolveName sc) opaque | ||
| modmap <- io (scGetModuleMap sc) | ||
| let opaqueSet = Set.fromList idxs | ||
| sqt' <- io $ traverseSequentWithFocus (normalizeProp sc modmap opaqueSet) (goalSequent goal) | ||
| sqt' <- io $ traverseSequentWithFocus (normalizeProp sc opaqueSet) (goalSequent goal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you expect there to be any subtle differences in behavior in the normalize_term_opaque/goal_normalize functions as a result of these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there will be differences. The new implementation will (by definition) always return a normalized term that is convertible (according to the type checker) with the input term. This was not the case with normalizeSharedTerm (see #2552).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. To be on the safe side, it would be worth mentioning this in the changelog as well.
This PR removes the
TermModelbackend from the SAWCore simulator. This was a backend that used the SAWCoreTermtype itself as the value type, implementing a sort of partial evaluator for SAWCore terms.TermModelprimarily existed to support the MRSolver tactic, which has now been removed (#2576).As it turns out, a lot of extra plumbing within the SAWCore simulator was only there to support
TermModel, so the removal enables much simplification of SAWCore code. In particular, removing the extra type information from the simulator unblocks further reforms to the recursor implementation (which will be a follow-on to #2429 to solve #2358).Removing
TermModelnecessitated the removal of the experimental SAWScriptextract_uninterpcommand, which was not used in any of our regression tests or examples. Commandsnormalize_term_opaque(also unused in our tests/examples) andgoal_normalizewere previously implemented usingTermModel; these are still in place but are now implemented instead usingscUnfoldConstantSetandscTypeCheckWHNF.