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


Java IExpression類代碼示例

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


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

示例1: and

import ap.parser.IExpression; //導入依賴的package包/類
@Override
public IFormula and(IExpression t1, IExpression t2) {
  if (t1 == t2) {
    return (IFormula) t1;
  }
  if (isTrue(t1)) {
    return (IFormula) t2;
  }
  if (isTrue(t2)) {
    return (IFormula) t1;
  }
  if (isFalse(t1)) {
    return pFalse;
  }
  if (isFalse(t2)) {
    return pFalse;
  }
  return simplify(new IBinFormula(IBinJunctor.And(), (IFormula) t1, (IFormula) t2));
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:20,代碼來源:PrincessBooleanFormulaManager.java

示例2: or

import ap.parser.IExpression; //導入依賴的package包/類
@Override
public IFormula or(IExpression t1, IExpression t2) {
  if (t1 == t2) {
    return (IFormula) t1;
  }
  if (isTrue(t1)) {
    return pTrue;
  }
  if (isTrue(t2)) {
    return pTrue;
  }
  if (isFalse(t1)) {
    return (IFormula) t2;
  }
  if (isFalse(t2)) {
    return (IFormula) t1;
  }
  return simplify(new IBinFormula(IBinJunctor.Or(), (IFormula) t1, (IFormula) t2));
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:20,代碼來源:PrincessBooleanFormulaManager.java

示例3: getArrayAddresses

import ap.parser.IExpression; //導入依賴的package包/類
/**
 * Collect array-models, we need them to replace identifiers later. Princess models arrays as
 * plain numeric "memory-addresses", and the model for an array-access at one of the addresses is
 * the array-content. Example: "arr[5]=123" is modeled as "{arr=0, select(0,5)=123}" or "{arr=0,
 * store(0,5,123)=0}", where "0" is the memory-address. The returned mapping contains the mapping
 * of "0" (=address) to "arr" (=identifier).
 */
private Map<IdealInt, ITerm> getArrayAddresses(
    scala.collection.Map<ModelLocation, ModelValue> interpretation) {
  Map<IdealInt, ITerm> arrays = new HashMap<>();
  Iterator<Tuple2<ModelLocation, ModelValue>> it1 = interpretation.iterator();
  while (it1.hasNext()) {
    Tuple2<ModelLocation, ModelValue> entry = it1.next();
    if (entry._1 instanceof ConstantLoc) {
      ITerm maybeArray = IExpression.i(((ConstantLoc) entry._1).c());
      if (creator.getEnv().hasArrayType(maybeArray) && entry._2 instanceof IntValue) {
        arrays.put(((IntValue) entry._2).v(), maybeArray);
      }
    }
  }
  return arrays;
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:23,代碼來源:PrincessModel.java

示例4: mkTrigger

import ap.parser.IExpression; //導入依賴的package包/類
public ProverExpr mkTrigger(ProverExpr body, ProverExpr[] triggers) {
  final ArrayBuffer<IExpression> triggerExprs = new ArrayBuffer<IExpression> ();
  
  for (int i = 0; i < triggers.length; ++i) {
    if (triggers[i] instanceof TermExpr)
      triggerExprs.$plus$eq(((TermExpr)triggers[i]).term);
    else
         triggerExprs.$plus$eq(((FormulaExpr)triggers[i]).formula);
  }
  
  return new FormulaExpr(IExpression.trig(((FormulaExpr)body).formula,
                                          triggerExprs));
}
 
開發者ID:SRI-CSL,項目名稱:bixie,代碼行數:14,代碼來源:PrincessProver.java

示例5: simplify

import ap.parser.IExpression; //導入依賴的package包/類
@Override
protected IExpression simplify(IExpression f) {
  // TODO this method is not tested, check it!
  if (f instanceof IFormula) {
    f = BooleanCompactifier.apply((IFormula) f);
  }
  return PartialEvaluator.apply(f);
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:9,代碼來源:PrincessFormulaManager.java

示例6: PrincessArrayFormulaManager

import ap.parser.IExpression; //導入依賴的package包/類
PrincessArrayFormulaManager(
    FormulaCreator<
            IExpression, PrincessTermType, PrincessEnvironment, PrincessFunctionDeclaration>
        pFormulaCreator) {
  super(pFormulaCreator);
  env = pFormulaCreator.getEnv();
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:8,代碼來源:PrincessArrayFormulaManager.java

示例7: internalMakeArray

import ap.parser.IExpression; //導入依賴的package包/類
@Override
protected <TI extends Formula, TE extends Formula> IExpression internalMakeArray(
    String pName, FormulaType<TI> pIndexType, FormulaType<TE> pElementType) {

  // other types in arrays are not supported in princess
  assert pIndexType.isIntegerType() && pElementType.isIntegerType();

  final ArrayFormulaType<TI, TE> arrayFormulaType =
      FormulaType.getArrayType(pIndexType, pElementType);
  final PrincessTermType arrayType = toSolverType(arrayFormulaType);

  return getFormulaCreator().makeVariable(arrayType, pName);
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:14,代碼來源:PrincessArrayFormulaManager.java

示例8: makeApp

import ap.parser.IExpression; //導入依賴的package包/類
@Override
public IExpression makeApp(PrincessEnvironment env, List<IExpression> args) {
  Preconditions.checkArgument(args.size() == 2);
  if (args.get(0) instanceof IIntLit) {
    return new ITimes(((IIntLit) args.get(0)).value(), (ITerm) args.get(1));
  } else if (args.get(1) instanceof IIntLit) {
    return new ITimes(((IIntLit) args.get(1)).value(), (ITerm) args.get(0));
  } else {
    throw new AssertionError("unexpected args for multiplication");
  }
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:12,代碼來源:PrincessFunctionDeclaration.java

示例9: ifThenElse

import ap.parser.IExpression; //導入依賴的package包/類
@Override
public IExpression ifThenElse(IExpression condition, IExpression t1, IExpression t2) {
  if (t1 instanceof IFormula) {
    return new IFormulaITE((IFormula) condition, (IFormula) t1, (IFormula) t2);
  } else {
    return new ITermITE((IFormula) condition, (ITerm) t1, (ITerm) t2);
  }
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:9,代碼來源:PrincessBooleanFormulaManager.java

示例10: not

import ap.parser.IExpression; //導入依賴的package包/類
@Override
public IFormula not(IExpression pBits) {
  if (pBits instanceof INot) {
    return ((INot) pBits).subformula(); // "not not a" == "a"
  } else {
    return new INot((IFormula) pBits);
  }
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:9,代碼來源:PrincessBooleanFormulaManager.java

示例11: evaluateImpl

import ap.parser.IExpression; //導入依賴的package包/類
@Nullable
@Override
public Object evaluateImpl(IExpression f) {
  Option<ModelValue> out = model.evalExpression(f);
  if (out.isEmpty()) {
    return null;
  }
  ModelValue value = out.get();
  return getValue(value);
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:11,代碼來源:PrincessModel.java

示例12: multiply

import ap.parser.IExpression; //導入依賴的package包/類
@Override
public IExpression multiply(IExpression pNumber1, IExpression pNumber2) {
  IExpression result;
  try {
    result = ((ITerm) pNumber1).$times((ITerm) pNumber2);
  } catch (IllegalArgumentException e) {
    result = BitShiftMultiplication.mult((ITerm) pNumber1, (ITerm) pNumber2);
  }
  return result;
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:11,代碼來源:PrincessIntegerFormulaManager.java

示例13: getUnsatCore

import ap.parser.IExpression; //導入依賴的package包/類
@Override
public List<BooleanFormula> getUnsatCore() {
  Preconditions.checkState(!closed && computeUnsatCores);
  final List<BooleanFormula> result = new ArrayList<>();
  final scala.collection.immutable.Set<Object> core = api.getUnsatCore();

  int cnt = 0;
  for (IExpression formula : getAssertedFormulas()) {
    if (core.contains(cnt)) {
      result.add(mgr.encapsulateBooleanFormula(formula));
    }
    ++cnt;
  }
  return result;
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:16,代碼來源:PrincessAbstractProver.java

示例14: parseStringToTerms

import ap.parser.IExpression; //導入依賴的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

示例15: getName

import ap.parser.IExpression; //導入依賴的package包/類
private static String getName(IExpression var) {
  if (var instanceof IAtom) {
    return ((IAtom) var).pred().name();
  } else if (var instanceof IConstant) {
    return var.toString();
  } else if (var instanceof IFunApp) {
    String fullStr = ((IFunApp) var).fun().toString();
    return fullStr.substring(0, fullStr.indexOf('/'));
  }

  throw new IllegalArgumentException("The given parameter is no variable or function");
}
 
開發者ID:sosy-lab,項目名稱:java-smt,代碼行數:13,代碼來源:PrincessEnvironment.java


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