use of de.prob.model.eventb.EventBAxiom in project prob2 by bendisposto.
the class ContextTranslator method processAxiomsAndTheorems.
private List<PContextClause> processAxiomsAndTheorems() {
List<PContextClause> axiomsAndThms = new ArrayList<>();
List<PPredicate> axioms = new ArrayList<>();
List<PPredicate> thms = new ArrayList<>();
for (EventBAxiom axiom : context.getAxioms()) {
PPredicate ppred = (PPredicate) ((EventB) axiom.getPredicate()).getAst();
nodeInfos.put(ppred, new Tuple2<>(context.getName(), axiom.getName()));
if (axiom.isTheorem()) {
thms.add(ppred);
} else {
axioms.add(ppred);
}
}
axiomsAndThms.add(new AAxiomsContextClause(axioms));
axiomsAndThms.add(new ATheoremsContextClause(thms));
return axiomsAndThms;
}
use of de.prob.model.eventb.EventBAxiom in project prob2 by bendisposto.
the class ContextXmlHandler method addAxiom.
private void addAxiom(final Attributes attributes) {
String source = attributes.getValue("org.eventb.core.source");
String internalName = source.substring(source.lastIndexOf('#') + 1, source.length());
String filePath = source.substring(0, source.indexOf('|'));
String contextName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.lastIndexOf('.'));
String label = attributes.getValue("org.eventb.core.label");
String predicate = attributes.getValue("org.eventb.core.predicate");
boolean theorem = "true".equals(attributes.getValue("org.eventb.core.theorem"));
if (inInternalContext) {
if (contextName.equals(internalContext.getName())) {
EventBAxiom axiom = new EventBAxiom(label, predicate, theorem, typeEnv);
internalAxioms.add(axiom);
axiomCache.get(internalContext.getName()).put(internalName, axiom);
} else {
internalInheritedAxioms.add(axiomCache.get(contextName).get(internalName));
}
} else {
if (contextName.equals(context.getName())) {
EventBAxiom axiom = new EventBAxiom(label, predicate, theorem, typeEnv);
axioms.add(axiom);
axiomCache.get(context.getName()).put(internalName, axiom);
} else {
inheritedAxioms.add(axiomCache.get(contextName).get(internalName));
}
}
}
use of de.prob.model.eventb.EventBAxiom in project prob2 by bendisposto.
the class MachineXmlHandler method addAxiom.
private void addAxiom(final Attributes attributes) {
String source = attributes.getValue("org.eventb.core.source");
String internalName = source.substring(source.lastIndexOf('#') + 1, source.length());
internalName = internalName.replace("\\", "");
String filePath = source.substring(0, source.indexOf('|'));
String contextName = filePath.substring(filePath.lastIndexOf('/') + 1, filePath.lastIndexOf('.'));
if (contextName.equals(internalContext.getName())) {
String label = attributes.getValue("org.eventb.core.label");
String predicate = attributes.getValue("org.eventb.core.predicate");
boolean theorem = "true".equals(attributes.getValue("org.eventb.core.theorem"));
EventBAxiom axiom = new EventBAxiom(label, predicate, theorem, typeEnv);
axioms.add(axiom);
axiomCache.get(internalContext.getName()).put(internalName, axiom);
} else {
inheritedAxioms.add(axiomCache.get(contextName).get(internalName));
}
}
use of de.prob.model.eventb.EventBAxiom in project prob2 by bendisposto.
the class TheoryTranslator method printAxiomaticDefinitonBlock.
private void printAxiomaticDefinitonBlock(final AxiomaticDefinitionBlock block, final IPrologTermOutput pto) {
pto.openTerm("axiomatic_def_block");
pto.printAtom(block.getName());
printTypeParameters(block.getTypeParameters(), pto);
pto.openList();
for (Operator operator : block.getOperators()) {
printAxiomaticOperator(operator, pto);
}
pto.closeList();
pto.openList();
for (EventBAxiom axiom : block.getAxioms()) {
printEventBElement((EventB) axiom.getPredicate(), pto);
}
pto.closeList();
pto.closeTerm();
}
Aggregations