Class FormulaUnLet
java.lang.Object
de.uni_freiburg.informatik.ultimate.logic.NonRecursive
de.uni_freiburg.informatik.ultimate.logic.TermTransformer
de.uni_freiburg.informatik.ultimate.logic.FormulaUnLet
public class FormulaUnLet extends TermTransformer
This class removes all let terms from the formula. It's a term transformer
that transforms a term with lets into an equivalent term without let.
A tricky issue here are variable name clashes that can appear when renaming.
This class will check whether renaming is necessary, i.e., if a let makes a
variable with the same name as a bounded variable visible inside the
quantifier. A simple example is
(let ((y x)) (exists ((x Int)) (= x y))). In this case the variable
of the inner quantifier is renamed by adding dots in front of it. Note that
symbols starting with a dot are reserved for solver use.
By renaming in a consistent manner and by only renaming if there is a name
clash, the unletted form of an assumed term in a proof should be equal to the
unletted asserted term.- Author:
- Jochen Hoenicke
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFormulaUnLet.UnletTypeNested classes/interfaces inherited from class de.uni_freiburg.informatik.ultimate.logic.TermTransformer
TermTransformer.BuildAnnotation, TermTransformer.BuildApplicationTerm, TermTransformer.BuildLambda, TermTransformer.BuildLetTerm, TermTransformer.BuildObjectArray, TermTransformer.BuildQuantifier, TermTransformer.StartLetTerm, TermTransformer.WalkMatchTermNested classes/interfaces inherited from class de.uni_freiburg.informatik.ultimate.logic.NonRecursive
NonRecursive.TermWalker, NonRecursive.Walker -
Constructor Summary
Constructors Constructor Description FormulaUnLet()Create a FormulaUnLet with the standard SMT-LIB semantics for let.FormulaUnLet(FormulaUnLet.UnletType type)Create a FormulaUnLet. -
Method Summary
Modifier and Type Method Description voidaddSubstitutions(java.util.Map<TermVariable,Term> termSubst)Add user defined substitutions.voidconvert(Term term)The function that does the transformation.TermVariable[]endVarScope(TermVariable[] vars)Ends a variable scope and determines the renamed bounded variables.voidpostConvertLambda(LambdaTerm old, Term newBody)Build the converted formula for a lambda term.voidpostConvertLet(LetTerm oldLet, Term[] newValues, Term newBody)voidpostConvertMatch(MatchTerm oldMatch, Term newDataTerm, Term[] newCases)voidpostConvertQuantifier(QuantifiedFormula old, Term newBody)Build the converted formula for a quantified formula.voidpreConvertLet(LetTerm oldLet, Term[] newValues)voidpreConvertMatchCase(MatchTerm oldMatch, int caseNr)voidstartVarScope(Term body, TermVariable[] vars)This is called for each quantifier, lambda term, or match term that introduces new bound variables.Termunlet(Term term)Unlet a term, i.e., remove all LetTerm and replace the term variables accordingly.Methods inherited from class de.uni_freiburg.informatik.ultimate.logic.TermTransformer
beginScope, convertApplicationTerm, endScope, getConverted, getConverted, getConvertedObjectArray, postConvertAnnotation, pushTerm, pushTerms, reset, setResult, transformMethods inherited from class de.uni_freiburg.informatik.ultimate.logic.NonRecursive
enqueueWalker, run, run, toString
-
Constructor Details
-
FormulaUnLet
public FormulaUnLet()Create a FormulaUnLet with the standard SMT-LIB semantics for let. -
FormulaUnLet
Create a FormulaUnLet.- Parameters:
type- The type of the unletter.
-
-
Method Details
-
addSubstitutions
Add user defined substitutions. This allows to map variables to terms, without adding a surrounding let term first. Note that these substitutions are then used for all formulas unletted by this class.- Parameters:
termSubst- The substitution, which maps term variables to the term with which they should be substituted.
-
unlet
Unlet a term, i.e., remove all LetTerm and replace the term variables accordingly.- Parameters:
term- the term to unlet- Returns:
- the resulting let-free term.
-
startVarScope
This is called for each quantifier, lambda term, or match term that introduces new bound variables. It determines if there is a name clash and renamed the bound variables accordingly. It adds the corresponding renaming to the let map. This also adds a new scope to the let map.- Parameters:
body- The term that contains the bounded variables.vars- The bounded variables that may need to be renamed.
-
endVarScope
Ends a variable scope and determines the renamed bounded variables.- Parameters:
vars- the bounded variables of the exists, lambda or match term.- Returns:
- the renamed variables in case renaming bounded variables were necessary (returns vars if no renaming was necessary).
-
convert
Description copied from class:TermTransformerThe function that does the transformation. Override this function if you build your own term transformer. It does not return the result but instead it puts it on the converted stack using setResult(). Instead it can also enqueue some Builders that will in the end put the result on the converted stack. You can always call super.convert() if you do not need to convert the term. It will still convert the sub-terms. If you do not want to convert the sub terms, call setResult(term) instead.- Overrides:
convertin classTermTransformer- Parameters:
term- The term to convert.
-
preConvertLet
- Overrides:
preConvertLetin classTermTransformer
-
postConvertLet
- Overrides:
postConvertLetin classTermTransformer
-
postConvertLambda
Build the converted formula for a lambda term. This also ends the scope of the lambda term. It stores the converted quantifier usingTermTransformer.setResult(Term).- Overrides:
postConvertLambdain classTermTransformer- Parameters:
old- the quantifier to convert.newBody- the converted sub formula.
-
postConvertQuantifier
Build the converted formula for a quantified formula. This also ends the scope of the quantifier. It stores the converted quantifier usingTermTransformer.setResult(Term).- Overrides:
postConvertQuantifierin classTermTransformer- Parameters:
old- the quantifier to convert.newBody- the converted sub formula.
-
preConvertMatchCase
- Overrides:
preConvertMatchCasein classTermTransformer
-
postConvertMatch
- Overrides:
postConvertMatchin classTermTransformer
-