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

Method commAxiom

examples/java/JavaGenericExample.java:147–162  ·  view source on GitHub ↗
(Context ctx, FuncDecl<R> f)

Source from the content-addressed store, hash-verified

145 // construction.
146 // / </remarks>
147 private <R extends Sort> BoolExpr commAxiom(Context ctx, FuncDecl<R> f) throws Exception
148 {
149 R t = f.getRange();
150 Sort[] dom = f.getDomain();
151
152 if (dom.length != 2 || !t.equals(dom[0]) || !t.equals(dom[1]))
153 {
154 System.out.printf("%d %s %s %s%n", dom.length, dom[0], dom[1], t);
155 throw new Exception("function must be binary, and argument types must be equal to return type");
156 }
157
158 String bench = String.format("(assert (forall (x %s) (y %s) (= (%s x y) (%s y x))))", t.getName(), t.getName(), f.getName(), f.getName());
159 return ctx.parseSMTLIB2String(bench, new Symbol[] { t.getName() },
160 new Sort[] { t }, new Symbol[] { f.getName() },
161 new FuncDecl[] { f })[0];
162 }
163
164 // / "Hello world" example: create a Z3 logical context, and delete it.
165

Callers 1

parserExample3Method · 0.95

Calls 5

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

Tested by

no test coverage detected