MCPcopy Create free account
hub / github.com/Z3Prover/z3 / commAxiom

Method commAxiom

examples/java/JavaExample.java:156–176  ·  view source on GitHub ↗
(Context ctx, FuncDecl f)

Source from the content-addressed store, hash-verified

154 // construction.
155 // / </remarks>
156 private BoolExpr commAxiom(Context ctx, FuncDecl f) throws Exception
157 {
158 Sort t = f.getRange();
159 Sort[] dom = f.getDomain();
160
161 if (dom.length != 2 || !t.equals(dom[0]) || !t.equals(dom[1]))
162 {
163 System.out.println(Integer.toString(dom.length) + " "
164 + dom[0].toString() + " " + dom[1].toString() + " "
165 + t.toString());
166 throw new Exception(
167 "function must be binary, and argument types must be equal to return type");
168 }
169
170 String bench = "(assert (forall (x " + t.getName()
171 + ") (y " + t.getName() + ") (= (" + f.getName() + " x y) ("
172 + f.getName() + " y x))))";
173 return ctx.parseSMTLIB2String(bench, new Symbol[] { t.getName() },
174 new Sort[] { t }, new Symbol[] { f.getName() },
175 new FuncDecl[] { f })[0];
176 }
177
178 // / "Hello world" example: create a Z3 logical context, and delete it.
179

Callers 1

parserExample3Method · 0.95

Calls 8

equalsMethod · 0.95
toStringMethod · 0.95
getNameMethod · 0.95
parseSMTLIB2StringMethod · 0.80
toStringMethod · 0.65
getNameMethod · 0.65
getRangeMethod · 0.45
getDomainMethod · 0.45

Tested by

no test coverage detected