01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: //
09: //
10:
11: package de.uka.ilkd.key.strategy.quantifierHeuristics;
12:
13: import de.uka.ilkd.key.logic.PosInOccurrence;
14: import de.uka.ilkd.key.logic.Term;
15: import de.uka.ilkd.key.proof.Goal;
16: import de.uka.ilkd.key.rule.RuleApp;
17: import de.uka.ilkd.key.strategy.RuleAppCost;
18: import de.uka.ilkd.key.strategy.feature.Feature;
19: import de.uka.ilkd.key.strategy.termProjection.ProjectionToTerm;
20:
21: /**
22: * Feature that returns the number of branches after instantiated the quantifier
23: * formula.
24: */
25: public class InstantiationCost implements Feature {
26:
27: final private ProjectionToTerm varInst;
28:
29: private InstantiationCost(ProjectionToTerm var) {
30: varInst = var;
31: }
32:
33: public static Feature create(ProjectionToTerm varInst) {
34: return new InstantiationCost(varInst);
35: }
36:
37: /**
38: * Compute the cost of a RuleApp.
39: */
40: public RuleAppCost compute(RuleApp app, PosInOccurrence pos,
41: Goal goal) {
42: assert pos != null : "Projection is only applicable to rules with find";
43:
44: final Term formula = pos.constrainedFormula().formula();
45: final Term instance = varInst.toTerm(app, pos, goal);
46:
47: return Instantiation.computeCost(instance, formula, goal
48: .sequent());
49: }
50: }
|