|
ESC/Java2 © 2003,2004,2005,2006 David Cok and Joseph Kiniry © 2005,2006 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectescjava.vcGeneration.ProverType
escjava.vcGeneration.xml.XmlProver
This class provides a simple mechanism by which new prover plugins to the VC generator may be implemented.
All one has to do is to provide a stylesheet within the escjava.vcGeneration.xml package or located on the system property search path XMLPROVERPATH for the targeted prover (eg. simplify.xslt). This stylesheet transforms XML terms, conforming to the DTD defined by escjava/vcGeneration/xml/xmlprover.dtd (as we are compiling with JDK 1.4 this can not be checked!!), into terms of the targeted prover.
Calling ESC/Java with the nvcg option xml.<prover> enables the target prover VC terms to be generated (eg. -nvcp xml.simplify will enable VC's for the targeted prover to be generated using the stylesheet escjava/vcGeneration/xml/simplify.xslt - supplied by default with ESC/Java).
Using this XML based prover interface should make it easier to build and debug new prover interfaces to the VC generator.
| Field Summary | |
private org.w3c.dom.Document |
dom
|
private org.w3c.dom.Element |
node
|
private java.lang.String |
stylesheet
This field defines the prover based stylesheet that will be used to translate our generated XML VC terms with calls to getProof(java.io.Writer, java.lang.String, escjava.vcGeneration.TNode) |
private TXmlVisitor |
visitor
|
| Constructor Summary | |
XmlProver()
|
|
| Method Summary | |
Expr |
addTypeInfo(InitialState initState,
Expr tree)
At this stage, we do not know if the target prover is typed or not. |
void |
generateDeclarations(java.io.Writer s,
java.util.HashMap variableNames)
This methods generates the declarations for a specified prover. |
void |
getProof(java.io.Writer out,
java.lang.String proofName,
TNode term)
Here we ensure that the resulting XML term is suitable for writing to an output file. |
java.lang.String |
getTypeInfo(TypeInfo caller)
Since our XML mapping of type names is the identity one, we may simply return the old type name here. |
java.lang.String |
getVariableInfo(VariableInfo caller)
Since our XML mapping of variable names is the identity one, we may simply return the old variable name here. |
void |
init()
Initialization simply defines an identity map on the known types and names. |
java.lang.String |
labelRename(java.lang.String label)
Our DTD specifies that term names are of type CDATA. |
TNode |
rewrite(TNode tree)
All rewriting is handled by the prover based stylesheet, so we do nothing here. |
void |
setStyleSheet(java.lang.String stylesheet)
This method only allows the field stylesheet to be set once. |
TVisitor |
visitor(java.io.Writer out)
The visitor pattern is used to map an ESC/Java VC term to a prover term. |
| Methods inherited from class escjava.vcGeneration.ProverType |
generateDeclarations, generateTerm |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private java.lang.String stylesheet
getProof(java.io.Writer, java.lang.String, escjava.vcGeneration.TNode)
private TXmlVisitor visitor
private org.w3c.dom.Document dom
private org.w3c.dom.Element node
| Constructor Detail |
public XmlProver()
| Method Detail |
public void setStyleSheet(java.lang.String stylesheet)
stylesheet to be set once.
stylesheet - target prover's stylesheetpublic java.lang.String labelRename(java.lang.String label)
labelRename in class ProverTypelabel - The method based label that needs to be renamed.
public TVisitor visitor(java.io.Writer out)
throws java.io.IOException
ProverTypevcGenerator uses this method to perform the mapping.
A typical implementation of this method will also need to extend the TVisitor class.
visitor in class ProverTypeout - The stream to which we should write our visitor trail
java.io.IOException
public void getProof(java.io.Writer out,
java.lang.String proofName,
TNode term)
throws java.io.IOException
After generating our raw XML term conforming to escjava/vcGeneration/xml/xmlprover.dtd
(this can not be checked with JDK 1.4!!), we convert it to a prover VC term using the stylesheet
specified by stylesheet.
The search rules for the stylesheet to be used are as follows (here we assume that <stylesheet>
is the value of the field stylesheet):
getProof in class ProverTypeproofName - name to be given to the proof assertion (eg. lemma or theorem)
java.io.IOExceptionpublic java.lang.String getVariableInfo(VariableInfo caller)
getVariableInfo in class ProverTypecaller - The specific variable name translation/mapplet we are to use.
public java.lang.String getTypeInfo(TypeInfo caller)
getTypeInfo in class ProverTypecaller - The specific type name translation/mapplet we are to use.
public void init()
init in class ProverType
public Expr addTypeInfo(InitialState initState,
Expr tree)
addTypeInfo in class ProverTypetree - the VC term to which typing predicates may need to be added.
public TNode rewrite(TNode tree)
rewrite in class ProverTypetree - a VC term to be simplified
public void generateDeclarations(java.io.Writer s,
java.util.HashMap variableNames)
throws java.io.IOException
ProverType
generateDeclarations in class ProverTypes - The buffer to which we want to generate the declarations to.variableNames - The hashmap containing all the variables, usually TNode.variablesName.
java.io.IOException
|
ESC/Java2 © 2003,2004,2005,2006 David Cok and Joseph Kiniry © 2005,2006 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||