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.feature;
12:
13: import de.uka.ilkd.key.logic.PIOPathIterator;
14: import de.uka.ilkd.key.logic.PosInOccurrence;
15: import de.uka.ilkd.key.logic.Term;
16: import de.uka.ilkd.key.logic.op.Quantifier;
17: import de.uka.ilkd.key.proof.Goal;
18: import de.uka.ilkd.key.rule.TacletApp;
19: import de.uka.ilkd.key.util.Debug;
20:
21: /**
22: * BinaryFeature that return zero if all the operator is quantifier from root
23: * to position it point to.
24: */
25: public class OnlyInScopeOfQuantifiersFeature extends
26: BinaryTacletAppFeature {
27:
28: public final static Feature INSTANCE = new OnlyInScopeOfQuantifiersFeature();
29:
30: private OnlyInScopeOfQuantifiersFeature() {
31: }
32:
33: protected boolean filter(TacletApp app, PosInOccurrence pos,
34: Goal goal) {
35: Debug.assertFalse(pos == null,
36: "Feature is only applicable to rules with find");
37:
38: final PIOPathIterator it = pos.iterator();
39: while (it.next() != -1) {
40: final Term subterm = it.getSubTerm();
41: if (!(subterm.op() instanceof Quantifier))
42: return false;
43: }
44:
45: return true;
46: }
47: }
|