Skip to content

Commit

Permalink
reworked ssa building and hoare triple checking in treeAutomizer, #143
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandernutz committed Aug 5, 2017
1 parent be2d5f0 commit e6d8f38
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 317 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -32,7 +33,7 @@ public class HCSymbolTable extends DefaultIcfgSymbolTable {
private HornClausePredicateSymbol mDontCareHornClausePredSym;
private HornClausePredicateSymbol mTrueHornClausePredSym;

private Map<TermVariable, ApplicationTerm> mTermVarToConst;
private final Map<TermVariable, ApplicationTerm> mTermVarToConst = new HashMap<>();


public HCSymbolTable(ManagedScript mgdScript) {
Expand Down Expand Up @@ -182,13 +183,21 @@ private Sort[] transferSorts(Sort[] sorts) {
*/
public void registerTermVariable(TermVariable tv) {
assert tv == new TermTransferrer(mManagedScript.getScript()).transform(tv);
mManagedScript.lock(this);
final ApplicationTerm constant = ProgramVarUtils.constructDefaultConstant(mManagedScript, this, tv.getSort(),
tv.getName());
mManagedScript.unlock(this);
mTermVarToConst.put(tv, constant);
if (!mTermVarToConst.containsKey(tv)) {
mManagedScript.lock(this);
final ApplicationTerm constant = ProgramVarUtils.constructDefaultConstant(mManagedScript, this, tv.getSort(),
tv.getName());
mManagedScript.unlock(this);
mTermVarToConst.put(tv, constant);
}
}

/**
* Every TermVariable that appears in a HornClause has a default constant associated with it, which is declared
* up front. (used for hoare triple checks)
* @param fv
* @return
*/
public Term getConstForTermVar(TermVariable fv) {
final ApplicationTerm res = mTermVarToConst.get(fv);
assert res != null;
Expand Down
Loading

0 comments on commit e6d8f38

Please sign in to comment.