當前位置: 首頁>>代碼示例>>Java>>正文


Java ConstantTerm類代碼示例

本文整理匯總了Java中ap.terfor.ConstantTerm的典型用法代碼示例。如果您正苦於以下問題:Java ConstantTerm類的具體用法?Java ConstantTerm怎麽用?Java ConstantTerm使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConstantTerm類屬於ap.terfor包,在下文中一共展示了ConstantTerm類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: freeVariables

import ap.terfor.ConstantTerm; //導入依賴的package包/類
public ProverExpr[] freeVariables(ProverExpr expr) {
  final ArrayList<ProverExpr> res = new ArrayList<ProverExpr> ();
  
  final scala.Tuple3<scala.collection.Set<IVariable>,
                      scala.collection.Set<ConstantTerm>,
                      scala.collection.Set<Predicate>> symTriple;
  if (expr instanceof TermExpr)
    symTriple = SymbolCollector$.MODULE$.varsConstsPreds(((TermExpr)expr).term);
  else
    symTriple = SymbolCollector$.MODULE$.varsConstsPreds(((FormulaExpr)expr).formula);
  
  final Iterator<IVariable> it1 = symTriple._1().iterator();
  while (it1.hasNext())
    res.add(new TermExpr(it1.next(), getIntType()));
  
  final Iterator<ConstantTerm> it2 = symTriple._2().iterator();
  while (it2.hasNext())
    res.add(new TermExpr(IConstant$.MODULE$.apply(it2.next()), getIntType()));
  
  final Iterator<Predicate> it3 = symTriple._3().iterator();
  final List<ITerm> emptyArgs = (new ArrayBuffer<ITerm>()).toList();
  while (it3.hasNext())
    res.add(new FormulaExpr(IAtom$.MODULE$.apply(it3.next(), emptyArgs)));
  
  return res.toArray(new ProverExpr[0]);
}
 
開發者ID:SRI-CSL,項目名稱:bixie,代碼行數:27,代碼來源:PrincessProver.java

示例2: substitute

import ap.terfor.ConstantTerm; //導入依賴的package包/類
/**
 * Simultaneously substitute <code>from</code> with <code>to</code>
 * in <code>target</code>. <code>from</code> has to be an array of
 * free or bound variables.
 */
public ProverExpr substitute(ProverExpr target,
                              ProverExpr[] from, ProverExpr[] to) {
  assert(from.length == to.length);
  
     final scala.collection.mutable.HashMap<ConstantTerm, ITerm> constantSubst =
         new scala.collection.mutable.HashMap<ConstantTerm, ITerm>();
     final scala.collection.mutable.HashMap<Predicate, IFormula> predicateSubst =
         new scala.collection.mutable.HashMap<Predicate, IFormula>();

     for (int i = 0; i < from.length; ++i) {
       if (from[i] instanceof TermExpr) {
         final ConstantTerm c = ((IConstant)((TermExpr)from[i]).term).c();
         final ITerm t = ((TermExpr)to[i]).term;
         constantSubst.put(c, t);
       } else {
         final Predicate p = ((IAtom)((FormulaExpr)from[i]).formula).pred();
         assert(p.arity() == 0);
         final IFormula f = ((FormulaExpr)to[i]).formula;
         predicateSubst.put(p, f);
       }
     }
     
     // We currently just assume that there are no clashes between substituted
     // terms and predicates/formulae, and that the substitutions can be
     // carried out in sequence
     
     if (target instanceof TermExpr) {
       final ITerm t1 = ((TermExpr)target).term;
       final ITerm t2 = ConstantSubstVisitor$.MODULE$.apply(t1, constantSubst);
       final ITerm t3 = PredicateSubstVisitor$.MODULE$.apply(t2, predicateSubst);
       return new TermExpr(t3, target.getType());
     } else {
       final IFormula f1 = ((FormulaExpr)target).formula;
       final IFormula f2 = ConstantSubstVisitor$.MODULE$.apply(f1, constantSubst);
       final IFormula f3 = PredicateSubstVisitor$.MODULE$.apply(f2, predicateSubst);
       return new FormulaExpr(f3);
     }
}
 
開發者ID:SRI-CSL,項目名稱:bixie,代碼行數:44,代碼來源:PrincessProver.java

示例3: parseStringToTerms

import ap.terfor.ConstantTerm; //導入依賴的package包/類
public List<? extends IExpression> parseStringToTerms(String s, PrincessFormulaCreator creator) {

    Tuple3<
            Seq<IFormula>, scala.collection.immutable.Map<IFunction, SMTFunctionType>,
            scala.collection.immutable.Map<ConstantTerm, SMTType>>
        triple = api.extractSMTLIBAssertionsSymbols(new StringReader(s));

    List<? extends IExpression> formula = seqAsJavaList(triple._1());
    Map<IFunction, SMTFunctionType> functionTypes = mapAsJavaMap(triple._2());
    Map<ConstantTerm, SMTType> constantTypes = mapAsJavaMap(triple._3());

    ImmutableSet.Builder<IExpression> declaredFunctions = ImmutableSet.builder();
    for (IExpression f : formula) {
      declaredFunctions.addAll(creator.extractVariablesAndUFs(f, true).values());
    }
    for (IExpression var : declaredFunctions.build()) {
      if (var instanceof IConstant) {
        SMTType type = constantTypes.get(((IConstant) var).c());
        if (type instanceof SMTParser2InputAbsy.SMTArray) {
          arrayVariablesCache.put(var.toString(), (ITerm) var);
        } else {
          intVariablesCache.put(var.toString(), (ITerm) var);
        }
        addSymbol((IConstant) var);
      } else if (var instanceof IAtom) {
        boolVariablesCache.put(((IAtom) var).pred().name(), (IFormula) var);
        addSymbol((IAtom) var);
      } else if (var instanceof IFunApp) {
        IFunction fun = ((IFunApp) var).fun();
        functionsCache.put(fun.name(), fun);
        functionsReturnTypes.put(fun, convertToTermType(functionTypes.get(fun)));
        addFunction(fun);
      }
    }
    return formula;
  }
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:37,代碼來源:PrincessEnvironment.java

示例4: toConstantTerm

import ap.terfor.ConstantTerm; //導入依賴的package包/類
private List<ConstantTerm> toConstantTerm(List<IExpression> lst) {
  List<ConstantTerm> retVal = new ArrayList<>(lst.size());
  for (IExpression f : lst) {
    retVal.add(((IConstant) f).c());
  }
  return retVal;
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:8,代碼來源:PrincessQuantifiedFormulaManager.java


注:本文中的ap.terfor.ConstantTerm類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。