/* Copyright (C) 2000, 2001, Geert Vernaeve. All Rights Reserved. */ package gve.calc.logic; import awt.*; import java.awt.*; import java.util.Vector; import java.util.Enumeration; import gve.calc.formula.*; import gve.calc.formula.Boolean; public class Proof extends Tabular {
Worden verondersteld iets van de vorm `a |- b' te bevatten |
Worden verondersteld iets van de vorm `A', `C1(1)' of `R(3,4)' te bevatten |
Only used by read() and clone() |
Returns null if all symbols inside p have a type. Else returns a symbol that has no type |
Throws a ProofInvalidException when the proof line is bad. When the proof line is ok, matched symbols are addded to the VariableStore. |
PENDING: backtrace ??? |
match lines of the proof proof with
lines having numbers in prem[] of rule
marked with "prem"
For each match of all those, call m.foundMatch().
|
matched
doesn't contain identifiers
* of type List or Term */
private boolean checkForLists(Part matched,Matcher m) {
if (matched instanceof Identifier) {
Part typ = m.getTomatchType(((Identifier)matched).getString());
if (typ instanceof Identifier) {
String typstr = ((Identifier)typ).getString();
if (typstr.equals("List")) return false;
if (typstr.equals("Term")) return false;
}
}
int count = 0;
while (true) {
Part child = matched.getChild(count);
if (child == null) return true; // done
if (!checkForLists(child,m)) return false;
count++;
}
}
Creates an Evaluator where symbols of the proof are defined This is important for functions acting on unknowns. E.g., suppose we have to match a line of the rule "Ltx = subst(t,x,L)" and L matches to "L1,x=t" where L1 is an unknown List. Then "subst(t,x,L)" becomes "subst(t,x,(L1,x=t))" which must *not* be evaluated as "{L1,t=t}" but as "subst(t,x,L1) union {t=t} |
Returns true if all identifiers in pattern are matched
to a value *and* those values are not of type List
This code is heavily inspired on Matcher.isKnown() |