public abstract class AbstractProofRule extends Object implements Proof.Rule
| Modifier and Type | Field and Description |
|---|---|
protected Simplification |
simp |
protected TypeSystem |
types |
| Constructor and Description |
|---|
AbstractProofRule(Simplification simp,
TypeSystem types) |
| Modifier and Type | Method and Description |
|---|---|
abstract Proof.State |
apply(Proof.State head,
Formula truth) |
Proof.State |
apply(Proof.State current,
Proof.State head) |
static <T extends WyalFile.Expr> |
extractDefinedTerms(wybs.lang.SyntacticItem item,
int kind,
Formula.Quantifier... stack)
Search through a given syntactic item looking for matching ground terms
which are guaranteed to be defined in the given state.
|
protected static <T extends wybs.lang.SyntacticItem> |
findAllInstances(wybs.lang.SyntacticItem e,
Class<T> kind) |
wybs.lang.SyntacticItem |
substitute(wybs.lang.SyntacticItem from,
wybs.lang.SyntacticItem to,
wybs.lang.SyntacticItem item)
Substitute for a given variable within a given syntactic item.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetNameprotected final Simplification simp
protected final TypeSystem types
public AbstractProofRule(Simplification simp, TypeSystem types)
public Proof.State apply(Proof.State current, Proof.State head) throws wybs.lang.NameResolver.ResolutionError
wybs.lang.NameResolver.ResolutionErrorpublic abstract Proof.State apply(Proof.State head, Formula truth) throws wybs.lang.NameResolver.ResolutionError
wybs.lang.NameResolver.ResolutionErrorprotected static <T extends wybs.lang.SyntacticItem> List<T> findAllInstances(wybs.lang.SyntacticItem e, Class<T> kind)
public static <T extends WyalFile.Expr> List<T> extractDefinedTerms(wybs.lang.SyntacticItem item, int kind, Formula.Quantifier... stack)
Search through a given syntactic item looking for matching ground terms which are guaranteed to be defined in the given state. This is useful for a number of different rules which attempt to extract information from formulae, even when they are universally quantified or contained in disjunctions. As an example, consider the following:
type nat is (int n) where n >= 0
function f(int x) -> (nat r)
define invariant(int[] xs, int x) is:
forall(int k):
(f(x) > xs[k]) || (f(x) < xs[k])
assert:
forall (int[] ys, int i):
if:
i < 0
invariant(ys,i)
then:
false
The key is that, since invarint(ys,i) is asserted, it
follows that f(i) is defined in the antecedent. As a result,
the postcondition of f() dictates that i >= 0
must follow. This gives a contradiction in the antecedent, meaning the
overall assertion holds.
item - SyntacticItem to search throughkind - Instances of this class will be extractedpublic wybs.lang.SyntacticItem substitute(wybs.lang.SyntacticItem from,
wybs.lang.SyntacticItem to,
wybs.lang.SyntacticItem item)
Substitute for a given variable within a given syntactic item. Specifically, this replaces all instances of VariableAccess which match the given declaration. Observe that the substitution is performed verbatim and (for example) without simplifying the underlying item.
This function preserves the aliasing structure of the original item up to the substitution itself. Furthermore, if no substitution was performed then the original item is returned as is.
from - to - item - Copyright © 2017. All rights reserved.