Conversation
|
Also renamed internal |
|
Comparison with |
|
To check also the case when I again compare the new ( Master For completeness, I show that tracking partitions matters. |
This makes the preprocessing more maintainable, allows overriding particular parts and also allows preprocessing single formulas without necessarily giving them to the SMT solver Also added `preprocess` as an alias to `simplifyFormulas`
| return processed; | ||
| } | ||
|
|
||
| void MainSolver::preprocessFormulaDoFinalTheoryPreprocessing(PreprocessingContext const &) { |
There was a problem hiding this comment.
It is a function which calls one function, why not use original function call?
(Also imho name's a bit too long)
There was a problem hiding this comment.
This way, it is clearer that this part must not be omitted. Without the auxiliary function, it could be missed. Besides, connecting the theory and preprocessor is not completely useless, prevents code duplication.
There was a problem hiding this comment.
I'm not sure I understand 🤔 Why would one assume this part can be ommited? It can also be highlighted by the comment in the code, what theory->afterPreprocessing does...
Can you elaborate on code duplication point? Because as I understand a single function function call is being replaced by a different function call + additional lines of code in MainSolver.cc and MainSolver.h
| return processed; | ||
| } | ||
|
|
||
| PTRef MainSolver::preprocessFormulaBeforeFinalTheoryPreprocessing(PTRef fla, PreprocessingContext const & context) { |
There was a problem hiding this comment.
I think it's too big of a name... I see that there is a naming convention, but that can be a pain to use inside the code...
Functionality can be described with a comment or documentation, but using this long func names feels a bit too much 🤔
Why not
initialPreprocessing
corePreprocessing
finalPreprocessing
or smth shorter...
There was a problem hiding this comment.
I wanted to use sth. like that, but I do not like that corePreprocessing (or body or whatever) would be just that one call, which is actually just a minor step within the whole process. The whole reason why it is separated is that in preprocessFormulasPerPartition, both preprocessFormulaBeforeFinalTheoryPreprocessing and preprocessFormulaAfterFinalTheoryPreprocessing are called on each particular frame formula, while preprocessFormulaDoFinalTheoryPreprocessing is called just once. In preprocessFormulasDefault, i.e., in preprocessFormula, all is called just once (because we mix all formulas into one conjunction).
What could potentially work is preprocessFormulaBegin, preprocessFormulaMiddle, preprocessFormulaEnd. This way, middle does not make the impression that it is the main part.
What do you think?
There was a problem hiding this comment.
I like your idea here!
Middle looks a little bit off, but I don't have a better idea for the name
There is also an option to ask LLM for the recommendation))
| ts.setClauseCallBack(&callBack); | ||
| ts.Cnfizer::cnfize(root, push_id); | ||
| bool const keepPartitionsSeparate = trackPartitions(); | ||
| Lit frameLit = push_id == 0 ? Lit{} : term_mapper->getOrCreateLit(frameTerms[push_id]); |
There was a problem hiding this comment.
Why not lambda?
(Not important, but tbh I just like lambdas 😊)
There was a problem hiding this comment.
To not use the variable at all if push_id == 0 (i.e., do not even initialize it on the stack). Maybe it would be worth to also add the [[maybe_unused]] attribute to the variable, to make it more explicit.
There was a problem hiding this comment.
Hmm, wouldn't it get optimized by compiler?
Main reason I like lambda is because it looks a little bit more compact here, it is not a major point of contention though...
|
Overall 6 functions might be a little bit complex to navigate 🤔 |
|
I need to use |
I think it actually can improve readability, especially if separated and split into private/public, to see which functions will be used outside and which are purely internal... |
This is just a refactoring. The behavior or performance should not change.
This makes the preprocessing more maintainable, allows overriding particular parts, and also allows preprocessing single formulas without necessarily giving them to the SMT solver with
giveToSolver.Also added
preprocessas an alias tosimplifyFormulas.