diff options
Diffstat (limited to 'Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/Logic2VampireLanguageMapper.java')
-rw-r--r-- | Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/Logic2VampireLanguageMapper.java | 442 |
1 files changed, 442 insertions, 0 deletions
diff --git a/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/Logic2VampireLanguageMapper.java b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/Logic2VampireLanguageMapper.java new file mode 100644 index 00000000..390a6b10 --- /dev/null +++ b/Solvers/Vampire-Solver/ca.mcgill.ecse.dslreasoner.vampire.reasoner/xtend-gen/ca/mcgill/ecse/dslreasoner/vampire/reasoner/builder/Logic2VampireLanguageMapper.java | |||
@@ -0,0 +1,442 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.vampire.reasoner.builder; | ||
2 | |||
3 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.VampireSolverConfiguration; | ||
4 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.builder.Logic2VampireLanguageMapperTrace; | ||
5 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.builder.Logic2VampireLanguageMapper_ConstantMapper; | ||
6 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.builder.Logic2VampireLanguageMapper_RelationMapper; | ||
7 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.builder.Logic2VampireLanguageMapper_Support; | ||
8 | import ca.mcgill.ecse.dslreasoner.vampire.reasoner.builder.Logic2VampireLanguageMapper_TypeMapper; | ||
9 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSComment; | ||
10 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSConstant; | ||
11 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSEquality; | ||
12 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSEquivalent; | ||
13 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSFofFormula; | ||
14 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSFunction; | ||
15 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSImplies; | ||
16 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSInt; | ||
17 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSReal; | ||
18 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSTerm; | ||
19 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSUnaryNegation; | ||
20 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VLSVariable; | ||
21 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VampireLanguageFactory; | ||
22 | import ca.mcgill.ecse.dslreasoner.vampireLanguage.VampireModel; | ||
23 | import com.google.common.collect.Iterables; | ||
24 | import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput; | ||
25 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.And; | ||
26 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Assertion; | ||
27 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolLiteral; | ||
28 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.BoolTypeReference; | ||
29 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ComplexTypeReference; | ||
30 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ConstantDeclaration; | ||
31 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.ConstantDefinition; | ||
32 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.DefinedElement; | ||
33 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Distinct; | ||
34 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Equals; | ||
35 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Exists; | ||
36 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Forall; | ||
37 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.FunctionDeclaration; | ||
38 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.FunctionDefinition; | ||
39 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Iff; | ||
40 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Impl; | ||
41 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.InstanceOf; | ||
42 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.IntLiteral; | ||
43 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Not; | ||
44 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Or; | ||
45 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RealLiteral; | ||
46 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Relation; | ||
47 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDeclaration; | ||
48 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.RelationDefinition; | ||
49 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.SymbolicDeclaration; | ||
50 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.SymbolicValue; | ||
51 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Term; | ||
52 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.TypeReference; | ||
53 | import hu.bme.mit.inf.dslreasoner.logic.model.logiclanguage.Variable; | ||
54 | import hu.bme.mit.inf.dslreasoner.logic.model.logicproblem.LogicProblem; | ||
55 | import hu.bme.mit.inf.dslreasoner.util.CollectionsUtil; | ||
56 | import java.util.Arrays; | ||
57 | import java.util.Collections; | ||
58 | import java.util.HashMap; | ||
59 | import java.util.List; | ||
60 | import java.util.Map; | ||
61 | import java.util.function.Consumer; | ||
62 | import org.eclipse.emf.common.util.EList; | ||
63 | import org.eclipse.xtend.lib.annotations.AccessorType; | ||
64 | import org.eclipse.xtend.lib.annotations.Accessors; | ||
65 | import org.eclipse.xtext.xbase.lib.Extension; | ||
66 | import org.eclipse.xtext.xbase.lib.Functions.Function1; | ||
67 | import org.eclipse.xtext.xbase.lib.IterableExtensions; | ||
68 | import org.eclipse.xtext.xbase.lib.ListExtensions; | ||
69 | import org.eclipse.xtext.xbase.lib.ObjectExtensions; | ||
70 | import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; | ||
71 | import org.eclipse.xtext.xbase.lib.Pure; | ||
72 | |||
73 | @SuppressWarnings("all") | ||
74 | public class Logic2VampireLanguageMapper { | ||
75 | @Extension | ||
76 | private final VampireLanguageFactory factory = VampireLanguageFactory.eINSTANCE; | ||
77 | |||
78 | private final Logic2VampireLanguageMapper_Support support = new Logic2VampireLanguageMapper_Support(); | ||
79 | |||
80 | @Accessors(AccessorType.PUBLIC_GETTER) | ||
81 | private final Logic2VampireLanguageMapper_ConstantMapper constantMapper = new Logic2VampireLanguageMapper_ConstantMapper(this); | ||
82 | |||
83 | @Accessors(AccessorType.PUBLIC_GETTER) | ||
84 | private final Logic2VampireLanguageMapper_RelationMapper relationMapper = new Logic2VampireLanguageMapper_RelationMapper(this); | ||
85 | |||
86 | @Accessors(AccessorType.PUBLIC_GETTER) | ||
87 | private final Logic2VampireLanguageMapper_TypeMapper typeMapper; | ||
88 | |||
89 | public Logic2VampireLanguageMapper(final Logic2VampireLanguageMapper_TypeMapper typeMapper) { | ||
90 | this.typeMapper = typeMapper; | ||
91 | } | ||
92 | |||
93 | public TracedOutput<VampireModel, Logic2VampireLanguageMapperTrace> transformProblem(final LogicProblem problem, final VampireSolverConfiguration configuration) { | ||
94 | VLSComment _createVLSComment = this.factory.createVLSComment(); | ||
95 | final Procedure1<VLSComment> _function = (VLSComment it) -> { | ||
96 | it.setComment("%This is an initial Test Comment \r"); | ||
97 | }; | ||
98 | final VLSComment initialComment = ObjectExtensions.<VLSComment>operator_doubleArrow(_createVLSComment, _function); | ||
99 | VampireModel _createVampireModel = this.factory.createVampireModel(); | ||
100 | final Procedure1<VampireModel> _function_1 = (VampireModel it) -> { | ||
101 | EList<VLSComment> _comments = it.getComments(); | ||
102 | _comments.add(initialComment); | ||
103 | }; | ||
104 | final VampireModel specification = ObjectExtensions.<VampireModel>operator_doubleArrow(_createVampireModel, _function_1); | ||
105 | Logic2VampireLanguageMapperTrace _logic2VampireLanguageMapperTrace = new Logic2VampireLanguageMapperTrace(); | ||
106 | final Procedure1<Logic2VampireLanguageMapperTrace> _function_2 = (Logic2VampireLanguageMapperTrace it) -> { | ||
107 | it.specification = specification; | ||
108 | }; | ||
109 | final Logic2VampireLanguageMapperTrace trace = ObjectExtensions.<Logic2VampireLanguageMapperTrace>operator_doubleArrow(_logic2VampireLanguageMapperTrace, _function_2); | ||
110 | boolean _isEmpty = problem.getTypes().isEmpty(); | ||
111 | boolean _not = (!_isEmpty); | ||
112 | if (_not) { | ||
113 | this.typeMapper.transformTypes(problem.getTypes(), problem.getElements(), this, trace); | ||
114 | } | ||
115 | trace.constantDefinitions = this.collectConstantDefinitions(problem); | ||
116 | trace.relationDefinitions = this.collectRelationDefinitions(problem); | ||
117 | final Consumer<Relation> _function_3 = (Relation it) -> { | ||
118 | this.relationMapper.transformRelation(it, trace); | ||
119 | }; | ||
120 | problem.getRelations().forEach(_function_3); | ||
121 | final Consumer<ConstantDefinition> _function_4 = (ConstantDefinition it) -> { | ||
122 | this.constantMapper.transformConstantDefinitionSpecification(it, trace); | ||
123 | }; | ||
124 | Iterables.<ConstantDefinition>filter(problem.getConstants(), ConstantDefinition.class).forEach(_function_4); | ||
125 | EList<Assertion> _assertions = problem.getAssertions(); | ||
126 | for (final Assertion assertion : _assertions) { | ||
127 | this.transformAssertion(assertion, trace); | ||
128 | } | ||
129 | return new TracedOutput<VampireModel, Logic2VampireLanguageMapperTrace>(specification, trace); | ||
130 | } | ||
131 | |||
132 | protected VLSTerm _transformTypeReference(final BoolTypeReference boolTypeReference, final Logic2VampireLanguageMapperTrace trace) { | ||
133 | return null; | ||
134 | } | ||
135 | |||
136 | private HashMap<ConstantDeclaration, ConstantDefinition> collectConstantDefinitions(final LogicProblem problem) { | ||
137 | final HashMap<ConstantDeclaration, ConstantDefinition> res = new HashMap<ConstantDeclaration, ConstantDefinition>(); | ||
138 | final Function1<ConstantDefinition, Boolean> _function = (ConstantDefinition it) -> { | ||
139 | ConstantDeclaration _defines = it.getDefines(); | ||
140 | return Boolean.valueOf((_defines != null)); | ||
141 | }; | ||
142 | final Consumer<ConstantDefinition> _function_1 = (ConstantDefinition it) -> { | ||
143 | res.put(it.getDefines(), it); | ||
144 | }; | ||
145 | IterableExtensions.<ConstantDefinition>filter(Iterables.<ConstantDefinition>filter(problem.getConstants(), ConstantDefinition.class), _function).forEach(_function_1); | ||
146 | return res; | ||
147 | } | ||
148 | |||
149 | private HashMap<RelationDeclaration, RelationDefinition> collectRelationDefinitions(final LogicProblem problem) { | ||
150 | final HashMap<RelationDeclaration, RelationDefinition> res = new HashMap<RelationDeclaration, RelationDefinition>(); | ||
151 | final Function1<RelationDefinition, Boolean> _function = (RelationDefinition it) -> { | ||
152 | RelationDeclaration _defines = it.getDefines(); | ||
153 | return Boolean.valueOf((_defines != null)); | ||
154 | }; | ||
155 | final Consumer<RelationDefinition> _function_1 = (RelationDefinition it) -> { | ||
156 | res.put(it.getDefines(), it); | ||
157 | }; | ||
158 | IterableExtensions.<RelationDefinition>filter(Iterables.<RelationDefinition>filter(problem.getRelations(), RelationDefinition.class), _function).forEach(_function_1); | ||
159 | return res; | ||
160 | } | ||
161 | |||
162 | protected boolean transformAssertion(final Assertion assertion, final Logic2VampireLanguageMapperTrace trace) { | ||
163 | boolean _xblockexpression = false; | ||
164 | { | ||
165 | VLSFofFormula _createVLSFofFormula = this.factory.createVLSFofFormula(); | ||
166 | final Procedure1<VLSFofFormula> _function = (VLSFofFormula it) -> { | ||
167 | it.setName(this.support.toID(assertion.getName())); | ||
168 | it.setFofRole("axiom"); | ||
169 | it.setFofFormula(this.transformTerm(assertion.getValue(), trace, Collections.EMPTY_MAP)); | ||
170 | }; | ||
171 | final VLSFofFormula res = ObjectExtensions.<VLSFofFormula>operator_doubleArrow(_createVLSFofFormula, _function); | ||
172 | EList<VLSFofFormula> _formulas = trace.specification.getFormulas(); | ||
173 | _xblockexpression = _formulas.add(res); | ||
174 | } | ||
175 | return _xblockexpression; | ||
176 | } | ||
177 | |||
178 | protected VLSTerm _transformTerm(final BoolLiteral literal, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
179 | VLSTerm _xifexpression = null; | ||
180 | boolean _isValue = literal.isValue(); | ||
181 | boolean _equals = (_isValue == true); | ||
182 | if (_equals) { | ||
183 | _xifexpression = this.factory.createVLSTrue(); | ||
184 | } else { | ||
185 | _xifexpression = this.factory.createVLSFalse(); | ||
186 | } | ||
187 | return _xifexpression; | ||
188 | } | ||
189 | |||
190 | protected VLSTerm _transformTerm(final IntLiteral literal, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
191 | VLSInt _createVLSInt = this.factory.createVLSInt(); | ||
192 | final Procedure1<VLSInt> _function = (VLSInt it) -> { | ||
193 | it.setValue(Integer.valueOf(literal.getValue()).toString()); | ||
194 | }; | ||
195 | return ObjectExtensions.<VLSInt>operator_doubleArrow(_createVLSInt, _function); | ||
196 | } | ||
197 | |||
198 | protected VLSTerm _transformTerm(final RealLiteral literal, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
199 | VLSReal _createVLSReal = this.factory.createVLSReal(); | ||
200 | final Procedure1<VLSReal> _function = (VLSReal it) -> { | ||
201 | it.setValue(literal.getValue().toString()); | ||
202 | }; | ||
203 | return ObjectExtensions.<VLSReal>operator_doubleArrow(_createVLSReal, _function); | ||
204 | } | ||
205 | |||
206 | protected VLSTerm _transformTerm(final Not not, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
207 | VLSUnaryNegation _createVLSUnaryNegation = this.factory.createVLSUnaryNegation(); | ||
208 | final Procedure1<VLSUnaryNegation> _function = (VLSUnaryNegation it) -> { | ||
209 | it.setOperand(this.transformTerm(not.getOperand(), trace, variables)); | ||
210 | }; | ||
211 | return ObjectExtensions.<VLSUnaryNegation>operator_doubleArrow(_createVLSUnaryNegation, _function); | ||
212 | } | ||
213 | |||
214 | protected VLSTerm _transformTerm(final And and, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
215 | final Function1<Term, VLSTerm> _function = (Term it) -> { | ||
216 | return this.transformTerm(it, trace, variables); | ||
217 | }; | ||
218 | return this.support.unfoldAnd(ListExtensions.<Term, VLSTerm>map(and.getOperands(), _function)); | ||
219 | } | ||
220 | |||
221 | protected VLSTerm _transformTerm(final Or or, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
222 | final Function1<Term, VLSTerm> _function = (Term it) -> { | ||
223 | return this.transformTerm(it, trace, variables); | ||
224 | }; | ||
225 | return this.support.unfoldOr(ListExtensions.<Term, VLSTerm>map(or.getOperands(), _function)); | ||
226 | } | ||
227 | |||
228 | protected VLSTerm _transformTerm(final Impl impl, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
229 | VLSImplies _createVLSImplies = this.factory.createVLSImplies(); | ||
230 | final Procedure1<VLSImplies> _function = (VLSImplies it) -> { | ||
231 | it.setLeft(this.transformTerm(impl.getLeftOperand(), trace, variables)); | ||
232 | it.setRight(this.transformTerm(impl.getRightOperand(), trace, variables)); | ||
233 | }; | ||
234 | return ObjectExtensions.<VLSImplies>operator_doubleArrow(_createVLSImplies, _function); | ||
235 | } | ||
236 | |||
237 | protected VLSTerm _transformTerm(final Iff iff, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
238 | VLSEquivalent _createVLSEquivalent = this.factory.createVLSEquivalent(); | ||
239 | final Procedure1<VLSEquivalent> _function = (VLSEquivalent it) -> { | ||
240 | it.setLeft(this.transformTerm(iff.getLeftOperand(), trace, variables)); | ||
241 | it.setRight(this.transformTerm(iff.getRightOperand(), trace, variables)); | ||
242 | }; | ||
243 | return ObjectExtensions.<VLSEquivalent>operator_doubleArrow(_createVLSEquivalent, _function); | ||
244 | } | ||
245 | |||
246 | protected VLSTerm _transformTerm(final Equals equals, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
247 | VLSEquality _createVLSEquality = this.factory.createVLSEquality(); | ||
248 | final Procedure1<VLSEquality> _function = (VLSEquality it) -> { | ||
249 | it.setLeft(this.transformTerm(equals.getLeftOperand(), trace, variables)); | ||
250 | it.setRight(this.transformTerm(equals.getRightOperand(), trace, variables)); | ||
251 | }; | ||
252 | return ObjectExtensions.<VLSEquality>operator_doubleArrow(_createVLSEquality, _function); | ||
253 | } | ||
254 | |||
255 | protected VLSTerm _transformTerm(final Distinct distinct, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
256 | return this.support.unfoldDistinctTerms(this, distinct.getOperands(), trace, variables); | ||
257 | } | ||
258 | |||
259 | protected VLSTerm _transformTerm(final Forall forall, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
260 | return this.support.createUniversallyQuantifiedExpression(this, forall, trace, variables); | ||
261 | } | ||
262 | |||
263 | protected VLSTerm _transformTerm(final Exists exists, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
264 | return this.support.createExistentiallyQuantifiedExpression(this, exists, trace, variables); | ||
265 | } | ||
266 | |||
267 | protected VLSTerm _transformTerm(final InstanceOf instanceOf, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
268 | VLSFunction _createVLSFunction = this.factory.createVLSFunction(); | ||
269 | final Procedure1<VLSFunction> _function = (VLSFunction it) -> { | ||
270 | TypeReference _range = instanceOf.getRange(); | ||
271 | it.setConstant(this.support.toIDMultiple("type", ((ComplexTypeReference) _range).getReferred().getName())); | ||
272 | EList<VLSTerm> _terms = it.getTerms(); | ||
273 | VLSTerm _transformTerm = this.transformTerm(instanceOf.getValue(), trace, variables); | ||
274 | _terms.add(_transformTerm); | ||
275 | }; | ||
276 | return ObjectExtensions.<VLSFunction>operator_doubleArrow(_createVLSFunction, _function); | ||
277 | } | ||
278 | |||
279 | protected VLSTerm _transformTerm(final SymbolicValue symbolicValue, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
280 | return this.transformSymbolicReference(symbolicValue.getSymbolicReference(), symbolicValue.getParameterSubstitutions(), trace, variables); | ||
281 | } | ||
282 | |||
283 | protected VLSTerm _transformSymbolicReference(final DefinedElement referred, final List<Term> parameterSubstitutions, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
284 | return this.typeMapper.transformReference(referred, trace); | ||
285 | } | ||
286 | |||
287 | protected VLSTerm _transformSymbolicReference(final ConstantDeclaration constant, final List<Term> parameterSubstitutions, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
288 | VLSConstant _createVLSConstant = this.factory.createVLSConstant(); | ||
289 | final Procedure1<VLSConstant> _function = (VLSConstant it) -> { | ||
290 | it.setName(this.support.toID(constant.getName())); | ||
291 | }; | ||
292 | final VLSConstant res = ObjectExtensions.<VLSConstant>operator_doubleArrow(_createVLSConstant, _function); | ||
293 | return res; | ||
294 | } | ||
295 | |||
296 | protected VLSTerm _transformSymbolicReference(final ConstantDefinition constant, final List<Term> parameterSubstitutions, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
297 | return null; | ||
298 | } | ||
299 | |||
300 | protected VLSTerm _transformSymbolicReference(final Variable variable, final List<Term> parameterSubstitutions, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
301 | VLSVariable _createVLSVariable = this.factory.createVLSVariable(); | ||
302 | final Procedure1<VLSVariable> _function = (VLSVariable it) -> { | ||
303 | it.setName(this.support.toID(CollectionsUtil.<Variable, VLSVariable>lookup(variable, variables).getName())); | ||
304 | }; | ||
305 | final VLSVariable res = ObjectExtensions.<VLSVariable>operator_doubleArrow(_createVLSVariable, _function); | ||
306 | return res; | ||
307 | } | ||
308 | |||
309 | protected VLSTerm _transformSymbolicReference(final FunctionDeclaration function, final List<Term> parameterSubstitutions, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
310 | return null; | ||
311 | } | ||
312 | |||
313 | protected VLSTerm _transformSymbolicReference(final FunctionDefinition function, final List<Term> parameterSubstitutions, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
314 | return null; | ||
315 | } | ||
316 | |||
317 | /** | ||
318 | * def dispatch protected VLSTerm transformSymbolicReference(Relation relation, | ||
319 | * List<Term> parameterSubstitutions, Logic2VampireLanguageMapperTrace trace, | ||
320 | * Map<Variable, VLSVariable> variables) { | ||
321 | * if (trace.relationDefinitions.containsKey(relation)) { | ||
322 | * this.transformSymbolicReference(relation.lookup(trace.relationDefinitions), | ||
323 | * parameterSubstitutions, trace, variables) | ||
324 | * } | ||
325 | * else { | ||
326 | * // if (relationMapper.transformToHostedField(relation, trace)) { | ||
327 | * // val VLSRelation = relation.lookup(trace.relationDeclaration2Field) | ||
328 | * // // R(a,b) => | ||
329 | * // // b in a.R | ||
330 | * // return createVLSSubset => [ | ||
331 | * // it.leftOperand = parameterSubstitutions.get(1).transformTerm(trace, variables) | ||
332 | * // it.rightOperand = createVLSJoin => [ | ||
333 | * // it.leftOperand = parameterSubstitutions.get(0).transformTerm(trace, variables) | ||
334 | * // it.rightOperand = createVLSReference => [it.referred = VLSRelation] | ||
335 | * // ] | ||
336 | * // ] | ||
337 | * // } else { | ||
338 | * // val target = createVLSJoin => [ | ||
339 | * // leftOperand = createVLSReference => [referred = trace.logicLanguage] | ||
340 | * // rightOperand = createVLSReference => [ | ||
341 | * // referred = relation.lookup(trace.relationDeclaration2Global) | ||
342 | * // ] | ||
343 | * // ] | ||
344 | * // val source = support.unfoldTermDirectProduct(this, parameterSubstitutions, trace, variables) | ||
345 | * // | ||
346 | * // return createVLSSubset => [ | ||
347 | * // leftOperand = source | ||
348 | * // rightOperand = target | ||
349 | * // ] | ||
350 | * // } | ||
351 | * } | ||
352 | * } | ||
353 | */ | ||
354 | protected VLSTerm _transformSymbolicReference(final Relation relation, final List<Term> parameterSubstitutions, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
355 | VLSFunction _createVLSFunction = this.factory.createVLSFunction(); | ||
356 | final Procedure1<VLSFunction> _function = (VLSFunction it) -> { | ||
357 | it.setConstant(this.support.toIDMultiple("rel", relation.getName())); | ||
358 | EList<VLSTerm> _terms = it.getTerms(); | ||
359 | final Function1<Term, VLSTerm> _function_1 = (Term p) -> { | ||
360 | return this.transformTerm(p, trace, variables); | ||
361 | }; | ||
362 | List<VLSTerm> _map = ListExtensions.<Term, VLSTerm>map(parameterSubstitutions, _function_1); | ||
363 | Iterables.<VLSTerm>addAll(_terms, _map); | ||
364 | }; | ||
365 | return ObjectExtensions.<VLSFunction>operator_doubleArrow(_createVLSFunction, _function); | ||
366 | } | ||
367 | |||
368 | protected VLSTerm transformTypeReference(final BoolTypeReference boolTypeReference, final Logic2VampireLanguageMapperTrace trace) { | ||
369 | return _transformTypeReference(boolTypeReference, trace); | ||
370 | } | ||
371 | |||
372 | protected VLSTerm transformTerm(final Term and, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
373 | if (and instanceof And) { | ||
374 | return _transformTerm((And)and, trace, variables); | ||
375 | } else if (and instanceof BoolLiteral) { | ||
376 | return _transformTerm((BoolLiteral)and, trace, variables); | ||
377 | } else if (and instanceof Distinct) { | ||
378 | return _transformTerm((Distinct)and, trace, variables); | ||
379 | } else if (and instanceof Equals) { | ||
380 | return _transformTerm((Equals)and, trace, variables); | ||
381 | } else if (and instanceof Exists) { | ||
382 | return _transformTerm((Exists)and, trace, variables); | ||
383 | } else if (and instanceof Forall) { | ||
384 | return _transformTerm((Forall)and, trace, variables); | ||
385 | } else if (and instanceof Iff) { | ||
386 | return _transformTerm((Iff)and, trace, variables); | ||
387 | } else if (and instanceof Impl) { | ||
388 | return _transformTerm((Impl)and, trace, variables); | ||
389 | } else if (and instanceof IntLiteral) { | ||
390 | return _transformTerm((IntLiteral)and, trace, variables); | ||
391 | } else if (and instanceof Not) { | ||
392 | return _transformTerm((Not)and, trace, variables); | ||
393 | } else if (and instanceof Or) { | ||
394 | return _transformTerm((Or)and, trace, variables); | ||
395 | } else if (and instanceof RealLiteral) { | ||
396 | return _transformTerm((RealLiteral)and, trace, variables); | ||
397 | } else if (and instanceof InstanceOf) { | ||
398 | return _transformTerm((InstanceOf)and, trace, variables); | ||
399 | } else if (and instanceof SymbolicValue) { | ||
400 | return _transformTerm((SymbolicValue)and, trace, variables); | ||
401 | } else { | ||
402 | throw new IllegalArgumentException("Unhandled parameter types: " + | ||
403 | Arrays.<Object>asList(and, trace, variables).toString()); | ||
404 | } | ||
405 | } | ||
406 | |||
407 | protected VLSTerm transformSymbolicReference(final SymbolicDeclaration constant, final List<Term> parameterSubstitutions, final Logic2VampireLanguageMapperTrace trace, final Map<Variable, VLSVariable> variables) { | ||
408 | if (constant instanceof ConstantDeclaration) { | ||
409 | return _transformSymbolicReference((ConstantDeclaration)constant, parameterSubstitutions, trace, variables); | ||
410 | } else if (constant instanceof ConstantDefinition) { | ||
411 | return _transformSymbolicReference((ConstantDefinition)constant, parameterSubstitutions, trace, variables); | ||
412 | } else if (constant instanceof FunctionDeclaration) { | ||
413 | return _transformSymbolicReference((FunctionDeclaration)constant, parameterSubstitutions, trace, variables); | ||
414 | } else if (constant instanceof FunctionDefinition) { | ||
415 | return _transformSymbolicReference((FunctionDefinition)constant, parameterSubstitutions, trace, variables); | ||
416 | } else if (constant instanceof DefinedElement) { | ||
417 | return _transformSymbolicReference((DefinedElement)constant, parameterSubstitutions, trace, variables); | ||
418 | } else if (constant instanceof Relation) { | ||
419 | return _transformSymbolicReference((Relation)constant, parameterSubstitutions, trace, variables); | ||
420 | } else if (constant instanceof Variable) { | ||
421 | return _transformSymbolicReference((Variable)constant, parameterSubstitutions, trace, variables); | ||
422 | } else { | ||
423 | throw new IllegalArgumentException("Unhandled parameter types: " + | ||
424 | Arrays.<Object>asList(constant, parameterSubstitutions, trace, variables).toString()); | ||
425 | } | ||
426 | } | ||
427 | |||
428 | @Pure | ||
429 | public Logic2VampireLanguageMapper_ConstantMapper getConstantMapper() { | ||
430 | return this.constantMapper; | ||
431 | } | ||
432 | |||
433 | @Pure | ||
434 | public Logic2VampireLanguageMapper_RelationMapper getRelationMapper() { | ||
435 | return this.relationMapper; | ||
436 | } | ||
437 | |||
438 | @Pure | ||
439 | public Logic2VampireLanguageMapper_TypeMapper getTypeMapper() { | ||
440 | return this.typeMapper; | ||
441 | } | ||
442 | } | ||