Update copyright headers to 2021. (#6081)
[cvc5.git] / src / expr / proof_rule.h
1 /********************* */
2 /*! \file proof_rule.h
3 ** \verbatim
4 ** Top contributors (to current version):
5 ** Andrew Reynolds, Haniel Barbosa, Gereon Kremer
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8 ** in the top-level source directory and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
11 **
12 ** \brief Proof rule enumeration
13 **/
14
15 #include "cvc4_private.h"
16
17 #ifndef CVC4__EXPR__PROOF_RULE_H
18 #define CVC4__EXPR__PROOF_RULE_H
19
20 #include <iosfwd>
21
22 namespace CVC4 {
23
24 /**
25 * An enumeration for proof rules. This enumeration is analogous to Kind for
26 * Node objects. In the documentation below, P:F denotes a ProofNode that
27 * proves formula F.
28 *
29 * Conceptually, the following proof rules form a calculus whose target
30 * user is the Node-level theory solvers. This means that the rules below
31 * are designed to reason about, among other things, common operations on Node
32 * objects like Rewriter::rewrite or Node::substitute. It is intended to be
33 * translated or printed in other formats.
34 *
35 * The following PfRule values include core rules and those categorized by
36 * theory, including the theory of equality.
37 *
38 * The "core rules" include two distinguished rules which have special status:
39 * (1) ASSUME, which represents an open leaf in a proof.
40 * (2) SCOPE, which closes the scope of assumptions.
41 * The core rules additionally correspond to generic operations that are done
42 * internally on nodes, e.g. calling Rewriter::rewrite.
43 */
44 enum class PfRule : uint32_t
45 {
46 //================================================= Core rules
47 //======================== Assume and Scope
48 // ======== Assumption (a leaf)
49 // Children: none
50 // Arguments: (F)
51 // --------------
52 // Conclusion: F
53 //
54 // This rule has special status, in that an application of assume is an
55 // open leaf in a proof that is not (yet) justified. An assume leaf is
56 // analogous to a free variable in a term, where we say "F is a free
57 // assumption in proof P" if it contains an application of F that is not
58 // bound by SCOPE (see below).
59 ASSUME,
60 // ======== Scope (a binder for assumptions)
61 // Children: (P:F)
62 // Arguments: (F1, ..., Fn)
63 // --------------
64 // Conclusion: (=> (and F1 ... Fn) F) or (not (and F1 ... Fn)) if F is false
65 //
66 // This rule has a dual purpose with ASSUME. It is a way to close
67 // assumptions in a proof. We require that F1 ... Fn are free assumptions in
68 // P and say that F1, ..., Fn are not free in (SCOPE P). In other words, they
69 // are bound by this application. For example, the proof node:
70 // (SCOPE (ASSUME F) :args F)
71 // has the conclusion (=> F F) and has no free assumptions. More generally, a
72 // proof with no free assumptions always concludes a valid formula.
73 SCOPE,
74
75 //======================== Builtin theory (common node operations)
76 // ======== Substitution
77 // Children: (P1:F1, ..., Pn:Fn)
78 // Arguments: (t, (ids)?)
79 // ---------------------------------------------------------------
80 // Conclusion: (= t t*sigma{ids}(Fn)*...*sigma{ids}(F1))
81 // where sigma{ids}(Fi) are substitutions, which notice are applied in
82 // reverse order.
83 // Notice that ids is a MethodId identifier, which determines how to convert
84 // the formulas F1, ..., Fn into substitutions.
85 SUBS,
86 // ======== Rewrite
87 // Children: none
88 // Arguments: (t, (idr)?)
89 // ----------------------------------------
90 // Conclusion: (= t Rewriter{idr}(t))
91 // where idr is a MethodId identifier, which determines the kind of rewriter
92 // to apply, e.g. Rewriter::rewrite.
93 REWRITE,
94 // ======== Evaluate
95 // Children: none
96 // Arguments: (t)
97 // ----------------------------------------
98 // Conclusion: (= t Evaluator::evaluate(t))
99 // Note this is equivalent to:
100 // (REWRITE t MethodId::RW_EVALUATE)
101 EVALUATE,
102 // ======== Substitution + Rewriting equality introduction
103 //
104 // In this rule, we provide a term t and conclude that it is equal to its
105 // rewritten form under a (proven) substitution.
106 //
107 // Children: (P1:F1, ..., Pn:Fn)
108 // Arguments: (t, (ids (idr)?)?)
109 // ---------------------------------------------------------------
110 // Conclusion: (= t t')
111 // where
112 // t' is
113 // Rewriter{idr}(t*sigma{ids}(Fn)*...*sigma{ids}(F1))
114 //
115 // In other words, from the point of view of Skolem forms, this rule
116 // transforms t to t' by standard substitution + rewriting.
117 //
118 // The argument ids and idr is optional and specify the identifier of the
119 // substitution and rewriter respectively to be used. For details, see
120 // theory/builtin/proof_checker.h.
121 MACRO_SR_EQ_INTRO,
122 // ======== Substitution + Rewriting predicate introduction
123 //
124 // In this rule, we provide a formula F and conclude it, under the condition
125 // that it rewrites to true under a proven substitution.
126 //
127 // Children: (P1:F1, ..., Pn:Fn)
128 // Arguments: (F, (ids (idr)?)?)
129 // ---------------------------------------------------------------
130 // Conclusion: F
131 // where
132 // Rewriter{idr}(F*sigma{ids}(Fn)*...*sigma{ids}(F1)) == true
133 // where ids and idr are method identifiers.
134 //
135 // More generally, this rule also holds when:
136 // Rewriter::rewrite(toWitness(F')) == true
137 // where F' is the result of the left hand side of the equality above. Here,
138 // notice that we apply rewriting on the witness form of F', meaning that this
139 // rule may conclude an F whose Skolem form is justified by the definition of
140 // its (fresh) Skolem variables. For example, this rule may justify the
141 // conclusion (= k t) where k is the purification Skolem for t, whose
142 // witness form is (witness ((x T)) (= x t)).
143 //
144 // Furthermore, notice that the rewriting and substitution is applied only
145 // within the side condition, meaning the rewritten form of the witness form
146 // of F does not escape this rule.
147 MACRO_SR_PRED_INTRO,
148 // ======== Substitution + Rewriting predicate elimination
149 //
150 // In this rule, if we have proven a formula F, then we may conclude its
151 // rewritten form under a proven substitution.
152 //
153 // Children: (P1:F, P2:F1, ..., P_{n+1}:Fn)
154 // Arguments: ((ids (idr)?)?)
155 // ----------------------------------------
156 // Conclusion: F'
157 // where
158 // F' is
159 // Rewriter{idr}(F*sigma{ids}(Fn)*...*sigma{ids}(F1)).
160 // where ids and idr are method identifiers.
161 //
162 // We rewrite only on the Skolem form of F, similar to MACRO_SR_EQ_INTRO.
163 MACRO_SR_PRED_ELIM,
164 // ======== Substitution + Rewriting predicate transform
165 //
166 // In this rule, if we have proven a formula F, then we may provide a formula
167 // G and conclude it if F and G are equivalent after rewriting under a proven
168 // substitution.
169 //
170 // Children: (P1:F, P2:F1, ..., P_{n+1}:Fn)
171 // Arguments: (G, (ids (idr)?)?)
172 // ----------------------------------------
173 // Conclusion: G
174 // where
175 // Rewriter{idr}(F*sigma{ids}(Fn)*...*sigma{ids}(F1)) ==
176 // Rewriter{idr}(G*sigma{ids}(Fn)*...*sigma{ids}(F1))
177 //
178 // More generally, this rule also holds when:
179 // Rewriter::rewrite(toWitness(F')) == Rewriter::rewrite(toWitness(G'))
180 // where F' and G' are the result of each side of the equation above. Here,
181 // witness forms are used in a similar manner to MACRO_SR_PRED_INTRO above.
182 MACRO_SR_PRED_TRANSFORM,
183
184 //================================================= Processing rules
185 // ======== Remove Term Formulas Axiom
186 // Children: none
187 // Arguments: (t)
188 // ---------------------------------------------------------------
189 // Conclusion: RemoveTermFormulas::getAxiomFor(t).
190 REMOVE_TERM_FORMULA_AXIOM,
191
192 //================================================= Trusted rules
193 // ======== Theory lemma
194 // Children: none
195 // Arguments: (F, tid)
196 // ---------------------------------------------------------------
197 // Conclusion: F
198 // where F is a (T-valid) theory lemma generated by theory with TheoryId tid.
199 // This is a "coarse-grained" rule that is used as a placeholder if a theory
200 // did not provide a proof for a lemma or conflict.
201 THEORY_LEMMA,
202 // ======== Theory Rewrite
203 // Children: none
204 // Arguments: (F, tid, rid)
205 // ----------------------------------------
206 // Conclusion: F
207 // where F is an equality of the form (= t t') where t' is obtained by
208 // applying the kind of rewriting given by the method identifier rid, which
209 // is one of:
210 // { RW_REWRITE_THEORY_PRE, RW_REWRITE_THEORY_POST, RW_REWRITE_EQ_EXT }
211 // Notice that the checker for this rule does not replay the rewrite to ensure
212 // correctness, since theory rewriter methods are not static. For example,
213 // the quantifiers rewriter involves constructing new bound variables that are
214 // not guaranteed to be consistent on each call.
215 THEORY_REWRITE,
216 // The rules in this section have the signature of a "trusted rule":
217 //
218 // Children: none
219 // Arguments: (F)
220 // ---------------------------------------------------------------
221 // Conclusion: F
222 //
223 // where F is an equality of the form t = t' where t was replaced by t'
224 // based on some preprocessing pass, or otherwise F was added as a new
225 // assertion by some preprocessing pass.
226 PREPROCESS,
227 // where F was added as a new assertion by some preprocessing pass.
228 PREPROCESS_LEMMA,
229 // where F is an equality of the form t = Theory::ppRewrite(t) for some
230 // theory. Notice this is a "trusted" rule.
231 THEORY_PREPROCESS,
232 // where F was added as a new assertion by theory preprocessing.
233 THEORY_PREPROCESS_LEMMA,
234 // where F is an equality of the form t = t' where t was replaced by t'
235 // based on theory expand definitions.
236 THEORY_EXPAND_DEF,
237 // where F is an existential (exists ((x T)) (P x)) used for introducing
238 // a witness term (witness ((x T)) (P x)).
239 WITNESS_AXIOM,
240 // where F is an equality (= t t') that holds by a form of rewriting that
241 // could not be replayed during proof postprocessing.
242 TRUST_REWRITE,
243 // where F is an equality (= t t') that holds by a form of substitution that
244 // could not be replayed during proof postprocessing.
245 TRUST_SUBS,
246 // where F is an equality (= t t') that holds by a form of substitution that
247 // could not be determined by the TrustSubstitutionMap.
248 TRUST_SUBS_MAP,
249
250 //================================================= Boolean rules
251 // ======== Resolution
252 // Children:
253 // (P1:C1, P2:C2)
254 // Arguments: (pol, L)
255 // ---------------------
256 // Conclusion: C
257 // where
258 // - C1 and C2 are nodes viewed as clauses, i.e., either an OR node with
259 // each children viewed as a literal or a node viewed as a literal. Note
260 // that an OR node could also be a literal.
261 // - pol is either true or false, representing the polarity of the pivot on
262 // the first clause
263 // - L is the pivot of the resolution, which occurs as is (resp. under a
264 // NOT) in C1 and negatively (as is) in C2 if pol = true (pol = false).
265 // C is a clause resulting from collecting all the literals in C1, minus the
266 // first occurrence of the pivot or its negation, and C2, minus the first
267 // occurrence of the pivot or its negation, according to the policy above.
268 // If the resulting clause has a single literal, that literal itself is the
269 // result; if it has no literals, then the result is false; otherwise it's
270 // an OR node of the resulting literals.
271 //
272 // Note that it may be the case that the pivot does not occur in the
273 // clauses. In this case the rule is not unsound, but it does not correspond
274 // to resolution but rather to a weakening of the clause that did not have a
275 // literal eliminated.
276 RESOLUTION,
277 // ======== N-ary Resolution
278 // Children: (P1:C_1, ..., Pm:C_n)
279 // Arguments: (pol_1, L_1, ..., pol_{n-1}, L_{n-1})
280 // ---------------------
281 // Conclusion: C
282 // where
283 // - let C_1 ... C_n be nodes viewed as clauses, as defined above
284 // - let "C_1 <>_{L,pol} C_2" represent the resolution of C_1 with C_2 with
285 // pivot L and polarity pol, as defined above
286 // - let C_1' = C_1 (from P1),
287 // - for each i > 1, let C_i' = C_{i-1} <>_{L_{i-1}, pol_{i-1}} C_i'
288 // The result of the chain resolution is C = C_n'
289 CHAIN_RESOLUTION,
290 // ======== Factoring
291 // Children: (P:C1)
292 // Arguments: ()
293 // ---------------------
294 // Conclusion: C2
295 // where
296 // Set representations of C1 and C2 is the same and the number of literals in
297 // C2 is smaller than that of C1
298 FACTORING,
299 // ======== Reordering
300 // Children: (P:C1)
301 // Arguments: (C2)
302 // ---------------------
303 // Conclusion: C2
304 // where
305 // Set representations of C1 and C2 is the same but the number of literals in
306 // C2 is the same of that of C1
307 REORDERING,
308 // ======== N-ary Resolution + Factoring + Reordering
309 // Children: (P1:C_1, ..., Pm:C_n)
310 // Arguments: (C, pol_1, L_1, ..., pol_{n-1}, L_{n-1})
311 // ---------------------
312 // Conclusion: C
313 // where
314 // - let C_1 ... C_n be nodes viewed as clauses, as defined in RESOLUTION
315 // - let "C_1 <>_{L,pol} C_2" represent the resolution of C_1 with C_2 with
316 // pivot L and polarity pol, as defined in RESOLUTION
317 // - let C_1' be equal, in its set representation, to C_1 (from P1),
318 // - for each i > 1, let C_i' be equal, it its set representation, to
319 // C_{i-1} <>_{L_{i-1}, pol_{i-1}} C_i'
320 // The result of the chain resolution is C, which is equal, in its set
321 // representation, to C_n'
322 MACRO_RESOLUTION,
323
324 // ======== Split
325 // Children: none
326 // Arguments: (F)
327 // ---------------------
328 // Conclusion: (or F (not F))
329 SPLIT,
330 // ======== Equality resolution
331 // Children: (P1:F1, P2:(= F1 F2))
332 // Arguments: none
333 // ---------------------
334 // Conclusion: (F2)
335 // Note this can optionally be seen as a macro for EQUIV_ELIM1+RESOLUTION.
336 EQ_RESOLVE,
337 // ======== Modus ponens
338 // Children: (P1:F1, P2:(=> F1 F2))
339 // Arguments: none
340 // ---------------------
341 // Conclusion: (F2)
342 // Note this can optionally be seen as a macro for IMPLIES_ELIM+RESOLUTION.
343 MODUS_PONENS,
344 // ======== Double negation elimination
345 // Children: (P:(not (not F)))
346 // Arguments: none
347 // ---------------------
348 // Conclusion: (F)
349 NOT_NOT_ELIM,
350 // ======== Contradiction
351 // Children: (P1:F P2:(not F))
352 // Arguments: ()
353 // ---------------------
354 // Conclusion: false
355 CONTRA,
356 // ======== And elimination
357 // Children: (P:(and F1 ... Fn))
358 // Arguments: (i)
359 // ---------------------
360 // Conclusion: (Fi)
361 AND_ELIM,
362 // ======== And introduction
363 // Children: (P1:F1 ... Pn:Fn))
364 // Arguments: ()
365 // ---------------------
366 // Conclusion: (and P1 ... Pn)
367 AND_INTRO,
368 // ======== Not Or elimination
369 // Children: (P:(not (or F1 ... Fn)))
370 // Arguments: (i)
371 // ---------------------
372 // Conclusion: (not Fi)
373 NOT_OR_ELIM,
374 // ======== Implication elimination
375 // Children: (P:(=> F1 F2))
376 // Arguments: ()
377 // ---------------------
378 // Conclusion: (or (not F1) F2)
379 IMPLIES_ELIM,
380 // ======== Not Implication elimination version 1
381 // Children: (P:(not (=> F1 F2)))
382 // Arguments: ()
383 // ---------------------
384 // Conclusion: (F1)
385 NOT_IMPLIES_ELIM1,
386 // ======== Not Implication elimination version 2
387 // Children: (P:(not (=> F1 F2)))
388 // Arguments: ()
389 // ---------------------
390 // Conclusion: (not F2)
391 NOT_IMPLIES_ELIM2,
392 // ======== Equivalence elimination version 1
393 // Children: (P:(= F1 F2))
394 // Arguments: ()
395 // ---------------------
396 // Conclusion: (or (not F1) F2)
397 EQUIV_ELIM1,
398 // ======== Equivalence elimination version 2
399 // Children: (P:(= F1 F2))
400 // Arguments: ()
401 // ---------------------
402 // Conclusion: (or F1 (not F2))
403 EQUIV_ELIM2,
404 // ======== Not Equivalence elimination version 1
405 // Children: (P:(not (= F1 F2)))
406 // Arguments: ()
407 // ---------------------
408 // Conclusion: (or F1 F2)
409 NOT_EQUIV_ELIM1,
410 // ======== Not Equivalence elimination version 2
411 // Children: (P:(not (= F1 F2)))
412 // Arguments: ()
413 // ---------------------
414 // Conclusion: (or (not F1) (not F2))
415 NOT_EQUIV_ELIM2,
416 // ======== XOR elimination version 1
417 // Children: (P:(xor F1 F2)))
418 // Arguments: ()
419 // ---------------------
420 // Conclusion: (or F1 F2)
421 XOR_ELIM1,
422 // ======== XOR elimination version 2
423 // Children: (P:(xor F1 F2)))
424 // Arguments: ()
425 // ---------------------
426 // Conclusion: (or (not F1) (not F2))
427 XOR_ELIM2,
428 // ======== Not XOR elimination version 1
429 // Children: (P:(not (xor F1 F2)))
430 // Arguments: ()
431 // ---------------------
432 // Conclusion: (or F1 (not F2))
433 NOT_XOR_ELIM1,
434 // ======== Not XOR elimination version 2
435 // Children: (P:(not (xor F1 F2)))
436 // Arguments: ()
437 // ---------------------
438 // Conclusion: (or (not F1) F2)
439 NOT_XOR_ELIM2,
440 // ======== ITE elimination version 1
441 // Children: (P:(ite C F1 F2))
442 // Arguments: ()
443 // ---------------------
444 // Conclusion: (or (not C) F1)
445 ITE_ELIM1,
446 // ======== ITE elimination version 2
447 // Children: (P:(ite C F1 F2))
448 // Arguments: ()
449 // ---------------------
450 // Conclusion: (or C F2)
451 ITE_ELIM2,
452 // ======== Not ITE elimination version 1
453 // Children: (P:(not (ite C F1 F2)))
454 // Arguments: ()
455 // ---------------------
456 // Conclusion: (or (not C) (not F1))
457 NOT_ITE_ELIM1,
458 // ======== Not ITE elimination version 1
459 // Children: (P:(not (ite C F1 F2)))
460 // Arguments: ()
461 // ---------------------
462 // Conclusion: (or C (not F2))
463 NOT_ITE_ELIM2,
464
465 //================================================= De Morgan rules
466 // ======== Not And
467 // Children: (P:(not (and F1 ... Fn))
468 // Arguments: ()
469 // ---------------------
470 // Conclusion: (or (not F1) ... (not Fn))
471 NOT_AND,
472 //================================================= CNF rules
473 // ======== CNF And Pos
474 // Children: ()
475 // Arguments: ((and F1 ... Fn), i)
476 // ---------------------
477 // Conclusion: (or (not (and F1 ... Fn)) Fi)
478 CNF_AND_POS,
479 // ======== CNF And Neg
480 // Children: ()
481 // Arguments: ((and F1 ... Fn))
482 // ---------------------
483 // Conclusion: (or (and F1 ... Fn) (not F1) ... (not Fn))
484 CNF_AND_NEG,
485 // ======== CNF Or Pos
486 // Children: ()
487 // Arguments: ((or F1 ... Fn))
488 // ---------------------
489 // Conclusion: (or (not (or F1 ... Fn)) F1 ... Fn)
490 CNF_OR_POS,
491 // ======== CNF Or Neg
492 // Children: ()
493 // Arguments: ((or F1 ... Fn), i)
494 // ---------------------
495 // Conclusion: (or (or F1 ... Fn) (not Fi))
496 CNF_OR_NEG,
497 // ======== CNF Implies Pos
498 // Children: ()
499 // Arguments: ((implies F1 F2))
500 // ---------------------
501 // Conclusion: (or (not (implies F1 F2)) (not F1) F2)
502 CNF_IMPLIES_POS,
503 // ======== CNF Implies Neg version 1
504 // Children: ()
505 // Arguments: ((implies F1 F2))
506 // ---------------------
507 // Conclusion: (or (implies F1 F2) F1)
508 CNF_IMPLIES_NEG1,
509 // ======== CNF Implies Neg version 2
510 // Children: ()
511 // Arguments: ((implies F1 F2))
512 // ---------------------
513 // Conclusion: (or (implies F1 F2) (not F2))
514 CNF_IMPLIES_NEG2,
515 // ======== CNF Equiv Pos version 1
516 // Children: ()
517 // Arguments: ((= F1 F2))
518 // ---------------------
519 // Conclusion: (or (not (= F1 F2)) (not F1) F2)
520 CNF_EQUIV_POS1,
521 // ======== CNF Equiv Pos version 2
522 // Children: ()
523 // Arguments: ((= F1 F2))
524 // ---------------------
525 // Conclusion: (or (not (= F1 F2)) F1 (not F2))
526 CNF_EQUIV_POS2,
527 // ======== CNF Equiv Neg version 1
528 // Children: ()
529 // Arguments: ((= F1 F2))
530 // ---------------------
531 // Conclusion: (or (= F1 F2) F1 F2)
532 CNF_EQUIV_NEG1,
533 // ======== CNF Equiv Neg version 2
534 // Children: ()
535 // Arguments: ((= F1 F2))
536 // ---------------------
537 // Conclusion: (or (= F1 F2) (not F1) (not F2))
538 CNF_EQUIV_NEG2,
539 // ======== CNF Xor Pos version 1
540 // Children: ()
541 // Arguments: ((xor F1 F2))
542 // ---------------------
543 // Conclusion: (or (not (xor F1 F2)) F1 F2)
544 CNF_XOR_POS1,
545 // ======== CNF Xor Pos version 2
546 // Children: ()
547 // Arguments: ((xor F1 F2))
548 // ---------------------
549 // Conclusion: (or (not (xor F1 F2)) (not F1) (not F2))
550 CNF_XOR_POS2,
551 // ======== CNF Xor Neg version 1
552 // Children: ()
553 // Arguments: ((xor F1 F2))
554 // ---------------------
555 // Conclusion: (or (xor F1 F2) (not F1) F2)
556 CNF_XOR_NEG1,
557 // ======== CNF Xor Neg version 2
558 // Children: ()
559 // Arguments: ((xor F1 F2))
560 // ---------------------
561 // Conclusion: (or (xor F1 F2) F1 (not F2))
562 CNF_XOR_NEG2,
563 // ======== CNF ITE Pos version 1
564 // Children: ()
565 // Arguments: ((ite C F1 F2))
566 // ---------------------
567 // Conclusion: (or (not (ite C F1 F2)) (not C) F1)
568 CNF_ITE_POS1,
569 // ======== CNF ITE Pos version 2
570 // Children: ()
571 // Arguments: ((ite C F1 F2))
572 // ---------------------
573 // Conclusion: (or (not (ite C F1 F2)) C F2)
574 CNF_ITE_POS2,
575 // ======== CNF ITE Pos version 3
576 // Children: ()
577 // Arguments: ((ite C F1 F2))
578 // ---------------------
579 // Conclusion: (or (not (ite C F1 F2)) F1 F2)
580 CNF_ITE_POS3,
581 // ======== CNF ITE Neg version 1
582 // Children: ()
583 // Arguments: ((ite C F1 F2))
584 // ---------------------
585 // Conclusion: (or (ite C F1 F2) (not C) (not F1))
586 CNF_ITE_NEG1,
587 // ======== CNF ITE Neg version 2
588 // Children: ()
589 // Arguments: ((ite C F1 F2))
590 // ---------------------
591 // Conclusion: (or (ite C F1 F2) C (not F2))
592 CNF_ITE_NEG2,
593 // ======== CNF ITE Neg version 3
594 // Children: ()
595 // Arguments: ((ite C F1 F2))
596 // ---------------------
597 // Conclusion: (or (ite C F1 F2) (not F1) (not F2))
598 CNF_ITE_NEG3,
599
600 //================================================= Equality rules
601 // ======== Reflexive
602 // Children: none
603 // Arguments: (t)
604 // ---------------------
605 // Conclusion: (= t t)
606 REFL,
607 // ======== Symmetric
608 // Children: (P:(= t1 t2)) or (P:(not (= t1 t2)))
609 // Arguments: none
610 // -----------------------
611 // Conclusion: (= t2 t1) or (not (= t2 t1))
612 SYMM,
613 // ======== Transitivity
614 // Children: (P1:(= t1 t2), ..., Pn:(= t{n-1} tn))
615 // Arguments: none
616 // -----------------------
617 // Conclusion: (= t1 tn)
618 TRANS,
619 // ======== Congruence
620 // Children: (P1:(= t1 s1), ..., Pn:(= tn sn))
621 // Arguments: (<kind> f?)
622 // ---------------------------------------------
623 // Conclusion: (= (<kind> f? t1 ... tn) (<kind> f? s1 ... sn))
624 // Notice that f must be provided iff <kind> is a parameterized kind, e.g.
625 // APPLY_UF. The actual node for <kind> is constructible via
626 // ProofRuleChecker::mkKindNode.
627 CONG,
628 // ======== True intro
629 // Children: (P:F)
630 // Arguments: none
631 // ----------------------------------------
632 // Conclusion: (= F true)
633 TRUE_INTRO,
634 // ======== True elim
635 // Children: (P:(= F true))
636 // Arguments: none
637 // ----------------------------------------
638 // Conclusion: F
639 TRUE_ELIM,
640 // ======== False intro
641 // Children: (P:(not F))
642 // Arguments: none
643 // ----------------------------------------
644 // Conclusion: (= F false)
645 FALSE_INTRO,
646 // ======== False elim
647 // Children: (P:(= F false))
648 // Arguments: none
649 // ----------------------------------------
650 // Conclusion: (not F)
651 FALSE_ELIM,
652 // ======== HO trust
653 // Children: none
654 // Arguments: (t)
655 // ---------------------
656 // Conclusion: (= t TheoryUfRewriter::getHoApplyForApplyUf(t))
657 // For example, this rule concludes (f x y) = (HO_APPLY (HO_APPLY f x) y)
658 HO_APP_ENCODE,
659 // ======== Congruence
660 // Children: (P1:(= f g), P2:(= t1 s1), ..., Pn+1:(= tn sn))
661 // Arguments: ()
662 // ---------------------------------------------
663 // Conclusion: (= (f t1 ... tn) (g s1 ... sn))
664 // Notice that this rule is only used when the application kinds are APPLY_UF.
665 HO_CONG,
666
667 //================================================= Array rules
668 // ======== Read over write
669 // Children: (P:(not (= i1 i2)))
670 // Arguments: ((select (store a i2 e) i1))
671 // ----------------------------------------
672 // Conclusion: (= (select (store a i2 e) i1) (select a i1))
673 ARRAYS_READ_OVER_WRITE,
674 // ======== Read over write, contrapositive
675 // Children: (P:(not (= (select (store a i2 e) i1) (select a i1)))
676 // Arguments: none
677 // ----------------------------------------
678 // Conclusion: (= i1 i2)
679 ARRAYS_READ_OVER_WRITE_CONTRA,
680 // ======== Read over write 1
681 // Children: none
682 // Arguments: ((select (store a i e) i))
683 // ----------------------------------------
684 // Conclusion: (= (select (store a i e) i) e)
685 ARRAYS_READ_OVER_WRITE_1,
686 // ======== Extensionality
687 // Children: (P:(not (= a b)))
688 // Arguments: none
689 // ----------------------------------------
690 // Conclusion: (not (= (select a k) (select b k)))
691 // where k is arrays::SkolemCache::getExtIndexSkolem((not (= a b))).
692 ARRAYS_EXT,
693 // ======== Array Trust
694 // Children: (P1 ... Pn)
695 // Arguments: (F)
696 // ---------------------
697 // Conclusion: F
698 ARRAYS_TRUST,
699
700 //================================================= Bit-Vector rules
701 // ======== Bitblast
702 // Children: none
703 // Arguments: (t)
704 // ---------------------
705 // Conclusion: (= t bitblast(t))
706 BV_BITBLAST,
707 // ======== Eager Atom
708 // Children: none
709 // Arguments: (F)
710 // ---------------------
711 // Conclusion: (= F F[0])
712 // where F is of kind BITVECTOR_EAGER_ATOM
713 BV_EAGER_ATOM,
714
715 //================================================= Datatype rules
716 // ======== Unification
717 // Children: (P:(= (C t1 ... tn) (C s1 ... sn)))
718 // Arguments: (i)
719 // ----------------------------------------
720 // Conclusion: (= ti si)
721 // where C is a constructor.
722 DT_UNIF,
723 // ======== Instantiate
724 // Children: none
725 // Arguments: (t, n)
726 // ----------------------------------------
727 // Conclusion: (= ((_ is C) t) (= t (C (sel_1 t) ... (sel_n t))))
728 // where C is the n^th constructor of the type of T, and (_ is C) is the
729 // discriminator (tester) for C.
730 DT_INST,
731 // ======== Collapse
732 // Children: none
733 // Arguments: ((sel_i (C_j t_1 ... t_n)))
734 // ----------------------------------------
735 // Conclusion: (= (sel_i (C_j t_1 ... t_n)) r)
736 // where C_j is a constructor, r is t_i if sel_i is a correctly applied
737 // selector, or TypeNode::mkGroundTerm() of the proper type otherwise. Notice
738 // that the use of mkGroundTerm differs from the rewriter which uses
739 // mkGroundValue in this case.
740 DT_COLLAPSE,
741 // ======== Split
742 // Children: none
743 // Arguments: (t)
744 // ----------------------------------------
745 // Conclusion: (or ((_ is C1) t) ... ((_ is Cn) t))
746 DT_SPLIT,
747 // ======== Clash
748 // Children: (P1:((_ is Ci) t), P2: ((_ is Cj) t))
749 // Arguments: none
750 // ----------------------------------------
751 // Conclusion: false
752 // for i != j.
753 DT_CLASH,
754 // ======== Datatype Trust
755 // Children: (P1 ... Pn)
756 // Arguments: (F)
757 // ---------------------
758 // Conclusion: F
759 DT_TRUST,
760
761 //================================================= Quantifiers rules
762 // ======== Witness intro
763 // Children: (P:(exists ((x T)) F[x]))
764 // Arguments: none
765 // ----------------------------------------
766 // Conclusion: (= k (witness ((x T)) F[x]))
767 // where k is the Skolem form of (witness ((x T)) F[x]).
768 WITNESS_INTRO,
769 // ======== Exists intro
770 // Children: (P:F[t])
771 // Arguments: ((exists ((x T)) F[x]))
772 // ----------------------------------------
773 // Conclusion: (exists ((x T)) F[x])
774 // This rule verifies that F[x] indeed matches F[t] with a substitution
775 // over x.
776 EXISTS_INTRO,
777 // ======== Skolemize
778 // Children: (P:(exists ((x1 T1) ... (xn Tn)) F))
779 // Arguments: none
780 // ----------------------------------------
781 // Conclusion: F*sigma
782 // sigma maps x1 ... xn to their representative skolems obtained by
783 // SkolemManager::mkSkolemize, returned in the skolems argument of that
784 // method. Alternatively, can use negated forall as a premise.
785 SKOLEMIZE,
786 // ======== Instantiate
787 // Children: (P:(forall ((x1 T1) ... (xn Tn)) F))
788 // Arguments: (t1 ... tn)
789 // ----------------------------------------
790 // Conclusion: F*sigma
791 // sigma maps x1 ... xn to t1 ... tn.
792 INSTANTIATE,
793
794 //================================================= String rules
795 //======================== Core solver
796 // ======== Concat eq
797 // Children: (P1:(= (str.++ t1 ... tn t) (str.++ t1 ... tn s)))
798 // Arguments: (b), indicating if reverse direction
799 // ---------------------
800 // Conclusion: (= t s)
801 //
802 // Notice that t or s may be empty, in which case they are implicit in the
803 // concatenation above. For example, if
804 // P1 concludes (= x (str.++ x z)), then
805 // (CONCAT_EQ P1 :args false) concludes (= "" z)
806 //
807 // Also note that constants are split, such that if
808 // P1 concludes (= (str.++ "abc" x) (str.++ "a" y)), then
809 // (CONCAT_EQ P1 :args false) concludes (= (str.++ "bc" x) y)
810 // This splitting is done only for constants such that Word::splitConstant
811 // returns non-null.
812 CONCAT_EQ,
813 // ======== Concat unify
814 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
815 // P2:(= (str.len t1) (str.len s1)))
816 // Arguments: (b), indicating if reverse direction
817 // ---------------------
818 // Conclusion: (= t1 s1)
819 CONCAT_UNIFY,
820 // ======== Concat conflict
821 // Children: (P1:(= (str.++ c1 t) (str.++ c2 s)))
822 // Arguments: (b), indicating if reverse direction
823 // ---------------------
824 // Conclusion: false
825 // Where c1, c2 are constants such that Word::splitConstant(c1,c2,index,b)
826 // is null, in other words, neither is a prefix of the other.
827 CONCAT_CONFLICT,
828 // ======== Concat split
829 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
830 // P2:(not (= (str.len t1) (str.len s1))))
831 // Arguments: (false)
832 // ---------------------
833 // Conclusion: (or (= t1 (str.++ s1 r_t)) (= s1 (str.++ t1 r_s)))
834 // where
835 // r_t = (witness ((z String)) (= z (suf t1 (str.len s1)))),
836 // r_s = (witness ((z String)) (= z (suf s1 (str.len t1)))).
837 //
838 // or the reverse form of the above:
839 //
840 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
841 // P2:(not (= (str.len t2) (str.len s2))))
842 // Arguments: (true)
843 // ---------------------
844 // Conclusion: (or (= t2 (str.++ r_t s2)) (= s2 (str.++ r_s t2)))
845 // where
846 // r_t = (witness ((z String)) (= z (pre t2 (- (str.len t2) (str.len
847 // s2))))), r_s = (witness ((z String)) (= z (pre s2 (- (str.len s2)
848 // (str.len t2))))).
849 //
850 // Above, (suf x n) is shorthand for (str.substr x n (- (str.len x) n)) and
851 // (pre x n) is shorthand for (str.substr x 0 n).
852 CONCAT_SPLIT,
853 // ======== Concat constant split
854 // Children: (P1:(= (str.++ t1 t2) (str.++ c s2)),
855 // P2:(not (= (str.len t1) 0)))
856 // Arguments: (false)
857 // ---------------------
858 // Conclusion: (= t1 (str.++ c r))
859 // where
860 // r = (witness ((z String)) (= z (suf t1 1))).
861 //
862 // or the reverse form of the above:
863 //
864 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 c)),
865 // P2:(not (= (str.len t2) 0)))
866 // Arguments: (true)
867 // ---------------------
868 // Conclusion: (= t2 (str.++ r c))
869 // where
870 // r = (witness ((z String)) (= z (pre t2 (- (str.len t2) 1)))).
871 CONCAT_CSPLIT,
872 // ======== Concat length propagate
873 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
874 // P2:(> (str.len t1) (str.len s1)))
875 // Arguments: (false)
876 // ---------------------
877 // Conclusion: (= t1 (str.++ s1 r_t))
878 // where
879 // r_t = (witness ((z String)) (= z (suf t1 (str.len s1))))
880 //
881 // or the reverse form of the above:
882 //
883 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
884 // P2:(> (str.len t2) (str.len s2)))
885 // Arguments: (false)
886 // ---------------------
887 // Conclusion: (= t2 (str.++ r_t s2))
888 // where
889 // r_t = (witness ((z String)) (= z (pre t2 (- (str.len t2) (str.len
890 // s2))))).
891 CONCAT_LPROP,
892 // ======== Concat constant propagate
893 // Children: (P1:(= (str.++ t1 w1 t2) (str.++ w2 s)),
894 // P2:(not (= (str.len t1) 0)))
895 // Arguments: (false)
896 // ---------------------
897 // Conclusion: (= t1 (str.++ w3 r))
898 // where
899 // w1, w2, w3, w4 are words,
900 // w3 is (pre w2 p),
901 // w4 is (suf w2 p),
902 // p = Word::overlap((suf w2 1), w1),
903 // r = (witness ((z String)) (= z (suf t1 (str.len w3)))).
904 // In other words, w4 is the largest suffix of (suf w2 1) that can contain a
905 // prefix of w1; since t1 is non-empty, w3 must therefore be contained in t1.
906 //
907 // or the reverse form of the above:
908 //
909 // Children: (P1:(= (str.++ t1 w1 t2) (str.++ s w2)),
910 // P2:(not (= (str.len t2) 0)))
911 // Arguments: (true)
912 // ---------------------
913 // Conclusion: (= t2 (str.++ r w3))
914 // where
915 // w1, w2, w3, w4 are words,
916 // w3 is (suf w2 (- (str.len w2) p)),
917 // w4 is (pre w2 (- (str.len w2) p)),
918 // p = Word::roverlap((pre w2 (- (str.len w2) 1)), w1),
919 // r = (witness ((z String)) (= z (pre t2 (- (str.len t2) (str.len w3))))).
920 // In other words, w4 is the largest prefix of (pre w2 (- (str.len w2) 1))
921 // that can contain a suffix of w1; since t2 is non-empty, w3 must therefore
922 // be contained in t2.
923 CONCAT_CPROP,
924 // ======== String decompose
925 // Children: (P1: (>= (str.len t) n)
926 // Arguments: (false)
927 // ---------------------
928 // Conclusion: (and (= t (str.++ w1 w2)) (= (str.len w1) n))
929 // or
930 // Children: (P1: (>= (str.len t) n)
931 // Arguments: (true)
932 // ---------------------
933 // Conclusion: (and (= t (str.++ w1 w2)) (= (str.len w2) n))
934 // where
935 // w1 is (witness ((z String)) (= z (pre t n)))
936 // w2 is (witness ((z String)) (= z (suf t n)))
937 STRING_DECOMPOSE,
938 // ======== Length positive
939 // Children: none
940 // Arguments: (t)
941 // ---------------------
942 // Conclusion: (or (and (= (str.len t) 0) (= t "")) (> (str.len t 0)))
943 STRING_LENGTH_POS,
944 // ======== Length non-empty
945 // Children: (P1:(not (= t "")))
946 // Arguments: none
947 // ---------------------
948 // Conclusion: (not (= (str.len t) 0))
949 STRING_LENGTH_NON_EMPTY,
950 //======================== Extended functions
951 // ======== Reduction
952 // Children: none
953 // Arguments: (t)
954 // ---------------------
955 // Conclusion: (and R (= t w))
956 // where w = strings::StringsPreprocess::reduce(t, R, ...).
957 // In other words, R is the reduction predicate for extended term t, and w is
958 // (witness ((z T)) (= z t))
959 // Notice that the free variables of R are w and the free variables of t.
960 STRING_REDUCTION,
961 // ======== Eager Reduction
962 // Children: none
963 // Arguments: (t, id?)
964 // ---------------------
965 // Conclusion: R
966 // where R = strings::TermRegistry::eagerReduce(t, id).
967 STRING_EAGER_REDUCTION,
968 //======================== Regular expressions
969 // ======== Regular expression intersection
970 // Children: (P:(str.in.re t R1), P:(str.in.re t R2))
971 // Arguments: none
972 // ---------------------
973 // Conclusion: (str.in.re t (re.inter R1 R2)).
974 RE_INTER,
975 // ======== Regular expression unfold positive
976 // Children: (P:(str.in.re t R))
977 // Arguments: none
978 // ---------------------
979 // Conclusion:(RegExpOpr::reduceRegExpPos((str.in.re t R))),
980 // corresponding to the one-step unfolding of the premise.
981 RE_UNFOLD_POS,
982 // ======== Regular expression unfold negative
983 // Children: (P:(not (str.in.re t R)))
984 // Arguments: none
985 // ---------------------
986 // Conclusion:(RegExpOpr::reduceRegExpNeg((not (str.in.re t R)))),
987 // corresponding to the one-step unfolding of the premise.
988 RE_UNFOLD_NEG,
989 // ======== Regular expression unfold negative concat fixed
990 // Children: (P:(not (str.in.re t R)))
991 // Arguments: none
992 // ---------------------
993 // Conclusion:(RegExpOpr::reduceRegExpNegConcatFixed((not (str.in.re t
994 // R)),L,i)) where RegExpOpr::getRegExpConcatFixed((not (str.in.re t R)), i) =
995 // L. corresponding to the one-step unfolding of the premise, optimized for
996 // fixed length of component i of the regular expression concatenation R.
997 RE_UNFOLD_NEG_CONCAT_FIXED,
998 // ======== Regular expression elimination
999 // Children: none
1000 // Arguments: (F, b)
1001 // ---------------------
1002 // Conclusion: (= F strings::RegExpElimination::eliminate(F, b))
1003 // where b is a Boolean indicating whether we are using aggressive
1004 // eliminations. Notice this rule concludes (= F F) if no eliminations
1005 // are performed for F.
1006 RE_ELIM,
1007 //======================== Code points
1008 // Children: none
1009 // Arguments: (t, s)
1010 // ---------------------
1011 // Conclusion:(or (= (str.code t) (- 1))
1012 // (not (= (str.code t) (str.code s)))
1013 // (not (= t s)))
1014 STRING_CODE_INJ,
1015 //======================== Sequence unit
1016 // Children: (P:(= (seq.unit x) (seq.unit y)))
1017 // Arguments: none
1018 // ---------------------
1019 // Conclusion:(= x y)
1020 // Also applies to the case where (seq.unit y) is a constant sequence
1021 // of length one.
1022 STRING_SEQ_UNIT_INJ,
1023 // ======== String Trust
1024 // Children: none
1025 // Arguments: (Q)
1026 // ---------------------
1027 // Conclusion: (Q)
1028 STRING_TRUST,
1029
1030 //================================================= Arithmetic rules
1031 // ======== Adding Inequalities
1032 // Note: an ArithLiteral is a term of the form (>< poly const)
1033 // where
1034 // >< is >=, >, ==, <, <=, or not(== ...).
1035 // poly is a polynomial
1036 // const is a rational constant
1037
1038 // Children: (P1:l1, ..., Pn:ln)
1039 // where each li is an ArithLiteral
1040 // not(= ...) is dis-allowed!
1041 //
1042 // Arguments: (k1, ..., kn), non-zero reals
1043 // ---------------------
1044 // Conclusion: (>< (* k t1) (* k t2))
1045 // where >< is the fusion of the combination of the ><i, (flipping each it
1046 // its ki is negative). >< is always one of <, <=
1047 // NB: this implies that lower bounds must have negative ki,
1048 // and upper bounds must have positive ki.
1049 // t1 is the sum of the polynomials.
1050 // t2 is the sum of the constants.
1051 ARITH_SCALE_SUM_UPPER_BOUNDS,
1052
1053 // ======== Tightening Strict Integer Upper Bounds
1054 // Children: (P:(< i c))
1055 // where i has integer type.
1056 // Arguments: none
1057 // ---------------------
1058 // Conclusion: (<= i greatestIntLessThan(c)})
1059 INT_TIGHT_UB,
1060
1061 // ======== Tightening Strict Integer Lower Bounds
1062 // Children: (P:(> i c))
1063 // where i has integer type.
1064 // Arguments: none
1065 // ---------------------
1066 // Conclusion: (>= i leastIntGreaterThan(c)})
1067 INT_TIGHT_LB,
1068
1069 // ======== Trichotomy of the reals
1070 // Children: (A B)
1071 // Arguments: (C)
1072 // ---------------------
1073 // Conclusion: (C),
1074 // where (not A) (not B) and C
1075 // are (> x c) (< x c) and (= x c)
1076 // in some order
1077 // note that "not" here denotes arithmetic negation, flipping
1078 // >= to <, etc.
1079 ARITH_TRICHOTOMY,
1080
1081 // ======== Arithmetic operator elimination
1082 // Children: none
1083 // Arguments: (t)
1084 // ---------------------
1085 // Conclusion: arith::OperatorElim::getAxiomFor(t)
1086 ARITH_OP_ELIM_AXIOM,
1087
1088 // ======== Int Trust
1089 // Children: (P1 ... Pn)
1090 // Arguments: (Q)
1091 // ---------------------
1092 // Conclusion: (Q)
1093 INT_TRUST,
1094
1095 //======== Multiplication sign inference
1096 // Children: none
1097 // Arguments: (f1, ..., fk, m)
1098 // ---------------------
1099 // Conclusion: (=> (and f1 ... fk) (~ m 0))
1100 // Where f1, ..., fk are variables compared to zero (less, greater or not
1101 // equal), m is a monomial from these variables, and ~ is the comparison (less
1102 // or greater) that results from the signs of the variables. All variables
1103 // with even exponent in m should be given as not equal to zero while all
1104 // variables with odd exponent in m should be given as less or greater than
1105 // zero.
1106 ARITH_MULT_SIGN,
1107 //======== Multiplication with positive factor
1108 // Children: none
1109 // Arguments: (m, orig, lhs, rel, rhs)
1110 // ---------------------
1111 // Conclusion: (=> (and (> m 0) (rel lhs rhs)) (rel (* m lhs) (* m rhs)))
1112 // Where orig is the origin that implies (rel lhs rhs) and rel is a relation
1113 // symbol.
1114 ARITH_MULT_POS,
1115 //======== Multiplication with negative factor
1116 // Children: none
1117 // Arguments: (m, orig, (rel lhs rhs))
1118 // ---------------------
1119 // Conclusion: (=> (and (< m 0) (rel lhs rhs)) (rel_inv (* m lhs) (* m rhs)))
1120 // Where orig is the origin that implies (rel lhs rhs) and rel is a relation
1121 // symbol and rel_inv the inverted relation symbol.
1122 ARITH_MULT_NEG,
1123 //======== Multiplication tangent plane
1124 // Children: none
1125 // Arguments: (t, x, y, a, b, sgn)
1126 // ---------------------
1127 // Conclusion:
1128 // sgn=-1: (= (<= t tplane) (or (and (<= x a) (>= y b)) (and (>= x a) (<= y b)))
1129 // sgn= 1: (= (>= t tplane) (or (and (<= x a) (<= y b)) (and (>= x a) (>= y b)))
1130 // Where x,y are real terms (variables or extended terms), t = (* x y)
1131 // (possibly under rewriting), a,b are real constants, and sgn is either -1
1132 // or 1. tplane is the tangent plane of x*y at (a,b): b*x + a*y - a*b
1133 ARITH_MULT_TANGENT,
1134
1135 // ================ Lemmas for transcendentals
1136 //======== Assert bounds on PI
1137 // Children: none
1138 // Arguments: (l, u)
1139 // ---------------------
1140 // Conclusion: (and (>= real.pi l) (<= real.pi u))
1141 // Where l (u) is a valid lower (upper) bound on pi.
1142 ARITH_TRANS_PI,
1143
1144 //======== Exp at negative values
1145 // Children: none
1146 // Arguments: (t)
1147 // ---------------------
1148 // Conclusion: (= (< t 0) (< (exp t) 1))
1149 ARITH_TRANS_EXP_NEG,
1150 //======== Exp is always positive
1151 // Children: none
1152 // Arguments: (t)
1153 // ---------------------
1154 // Conclusion: (> (exp t) 0)
1155 ARITH_TRANS_EXP_POSITIVITY,
1156 //======== Exp grows super-linearly for positive values
1157 // Children: none
1158 // Arguments: (t)
1159 // ---------------------
1160 // Conclusion: (or (<= t 0) (> exp(t) (+ t 1)))
1161 ARITH_TRANS_EXP_SUPER_LIN,
1162 //======== Exp at zero
1163 // Children: none
1164 // Arguments: (t)
1165 // ---------------------
1166 // Conclusion: (= (= t 0) (= (exp t) 1))
1167 ARITH_TRANS_EXP_ZERO,
1168 //======== Exp is approximated from above for negative values
1169 // Children: none
1170 // Arguments: (d, t, l, u)
1171 // ---------------------
1172 // Conclusion: (=> (and (>= t l) (<= t u)) (<= (exp t) (secant exp l u t))
1173 // Where d is an even positive number, t an arithmetic term and l (u) a lower
1174 // (upper) bound on t. Let p be the d'th taylor polynomial at zero (also
1175 // called the Maclaurin series) of the exponential function. (secant exp l u
1176 // t) denotes the secant of p from (l, exp(l)) to (u, exp(u)) evaluated at t,
1177 // calculated as follows:
1178 // (p(l) - p(u)) / (l - u) * (t - l) + p(l)
1179 // The lemma states that if t is between l and u, then (exp t) is below the
1180 // secant of p from l to u.
1181 ARITH_TRANS_EXP_APPROX_ABOVE_NEG,
1182 //======== Exp is approximated from above for positive values
1183 // Children: none
1184 // Arguments: (d, t, l, u)
1185 // ---------------------
1186 // Conclusion: (=> (and (>= t l) (<= t u)) (<= (exp t) (secant-pos exp l u t))
1187 // Where d is an even positive number, t an arithmetic term and l (u) a lower
1188 // (upper) bound on t. Let p* be a modification of the d'th taylor polynomial
1189 // at zero (also called the Maclaurin series) of the exponential function as
1190 // follows where p(d-1) is the regular Maclaurin series of degree d-1:
1191 // p* = p(d-1) * (1 + t^n / n!)
1192 // (secant-pos exp l u t) denotes the secant of p from (l, exp(l)) to (u,
1193 // exp(u)) evaluated at t, calculated as follows:
1194 // (p(l) - p(u)) / (l - u) * (t - l) + p(l)
1195 // The lemma states that if t is between l and u, then (exp t) is below the
1196 // secant of p from l to u.
1197 ARITH_TRANS_EXP_APPROX_ABOVE_POS,
1198 //======== Exp is approximated from below
1199 // Children: none
1200 // Arguments: (d, t)
1201 // ---------------------
1202 // Conclusion: (>= (exp t) (maclaurin exp d t))
1203 // Where d is an odd positive number and (maclaurin exp d t) is the d'th
1204 // taylor polynomial at zero (also called the Maclaurin series) of the
1205 // exponential function evaluated at t. The Maclaurin series for the
1206 // exponential function is the following:
1207 // e^x = \sum_{n=0}^{\infty} x^n / n!
1208 ARITH_TRANS_EXP_APPROX_BELOW,
1209
1210 //======== Sine is always between -1 and 1
1211 // Children: none
1212 // Arguments: (t)
1213 // ---------------------
1214 // Conclusion: (and (<= (sin t) 1) (>= (sin t) (- 1)))
1215 ARITH_TRANS_SINE_BOUNDS,
1216 //======== Sine arg shifted to -pi..pi
1217 // Children: none
1218 // Arguments: (x, y, s)
1219 // ---------------------
1220 // Conclusion: (and
1221 // (<= -pi y pi)
1222 // (= (sin y) (sin x))
1223 // (ite (<= -pi x pi) (= x y) (= x (+ y (* 2 pi s))))
1224 // )
1225 // Where x is the argument to sine, y is a new real skolem that is x shifted
1226 // into -pi..pi and s is a new integer skolem that is the number of phases y
1227 // is shifted.
1228 ARITH_TRANS_SINE_SHIFT,
1229 //======== Sine is symmetric with respect to negation of the argument
1230 // Children: none
1231 // Arguments: (t)
1232 // ---------------------
1233 // Conclusion: (= (- (sin t) (sin (- t))) 0)
1234 ARITH_TRANS_SINE_SYMMETRY,
1235 //======== Sine is bounded by the tangent at zero
1236 // Children: none
1237 // Arguments: (t)
1238 // ---------------------
1239 // Conclusion: (and
1240 // (=> (> t 0) (< (sin t) t))
1241 // (=> (< t 0) (> (sin t) t))
1242 // )
1243 ARITH_TRANS_SINE_TANGENT_ZERO,
1244 //======== Sine is bounded by the tangents at -pi and pi
1245 // Children: none
1246 // Arguments: (t)
1247 // ---------------------
1248 // Conclusion: (and
1249 // (=> (> t -pi) (> (sin t) (- -pi t)))
1250 // (=> (< t pi) (< (sin t) (- pi t)))
1251 // )
1252 ARITH_TRANS_SINE_TANGENT_PI,
1253 //======== Sine is approximated from above for negative values
1254 // Children: none
1255 // Arguments: (d, t, lb, ub, l, u)
1256 // ---------------------
1257 // Conclusion: (=> (and (>= t lb) (<= t ub)) (<= (sin t) (secant sin l u t))
1258 // Where d is an even positive number, t an arithmetic term, lb (ub) a
1259 // symbolic lower (upper) bound on t (possibly containing pi) and l (u) the
1260 // evaluated lower (upper) bound on t. Let p be the d'th taylor polynomial at
1261 // zero (also called the Maclaurin series) of the sine function. (secant sin l
1262 // u t) denotes the secant of p from (l, sin(l)) to (u, sin(u)) evaluated at
1263 // t, calculated as follows:
1264 // (p(l) - p(u)) / (l - u) * (t - l) + p(l)
1265 // The lemma states that if t is between l and u, then (sin t) is below the
1266 // secant of p from l to u.
1267 ARITH_TRANS_SINE_APPROX_ABOVE_NEG,
1268 //======== Sine is approximated from above for positive values
1269 // Children: none
1270 // Arguments: (d, t, c, lb, ub)
1271 // ---------------------
1272 // Conclusion: (=> (and (>= t lb) (<= t ub)) (<= (sin t) (upper sin c))
1273 // Where d is an even positive number, t an arithmetic term, c an arithmetic
1274 // constant, and lb (ub) a symbolic lower (upper) bound on t (possibly
1275 // containing pi). Let p be the d'th taylor polynomial at zero (also called
1276 // the Maclaurin series) of the sine function. (upper sin c) denotes the upper
1277 // bound on sin(c) given by p and lb,ub are such that sin(t) is the maximum of
1278 // the sine function on (lb,ub).
1279 ARITH_TRANS_SINE_APPROX_ABOVE_POS,
1280 //======== Sine is approximated from below for negative values
1281 // Children: none
1282 // Arguments: (d, t, c, lb, ub)
1283 // ---------------------
1284 // Conclusion: (=> (and (>= t lb) (<= t ub)) (>= (sin t) (lower sin c))
1285 // Where d is an even positive number, t an arithmetic term, c an arithmetic
1286 // constant, and lb (ub) a symbolic lower (upper) bound on t (possibly
1287 // containing pi). Let p be the d'th taylor polynomial at zero (also called
1288 // the Maclaurin series) of the sine function. (lower sin c) denotes the lower
1289 // bound on sin(c) given by p and lb,ub are such that sin(t) is the minimum of
1290 // the sine function on (lb,ub).
1291 ARITH_TRANS_SINE_APPROX_BELOW_NEG,
1292 //======== Sine is approximated from below for positive values
1293 // Children: none
1294 // Arguments: (d, t, lb, ub, l, u)
1295 // ---------------------
1296 // Conclusion: (=> (and (>= t lb) (<= t ub)) (>= (sin t) (secant sin l u t))
1297 // Where d is an even positive number, t an arithmetic term, lb (ub) a
1298 // symbolic lower (upper) bound on t (possibly containing pi) and l (u) the
1299 // evaluated lower (upper) bound on t. Let p be the d'th taylor polynomial at
1300 // zero (also called the Maclaurin series) of the sine function. (secant sin l
1301 // u t) denotes the secant of p from (l, sin(l)) to (u, sin(u)) evaluated at
1302 // t, calculated as follows:
1303 // (p(l) - p(u)) / (l - u) * (t - l) + p(l)
1304 // The lemma states that if t is between l and u, then (sin t) is above the
1305 // secant of p from l to u.
1306 ARITH_TRANS_SINE_APPROX_BELOW_POS,
1307
1308 // ================ CAD Lemmas
1309 // We use IRP for IndexedRootPredicate.
1310 //
1311 // A formula "Interval" describes that a variable (xn is none is given) is
1312 // within a particular interval whose bounds are given as IRPs. It is either
1313 // an open interval or a point interval:
1314 // (IRP k poly) < xn < (IRP k poly)
1315 // xn == (IRP k poly)
1316 //
1317 // A formula "Cell" describes a portion
1318 // of the real space in the following form:
1319 // Interval(x1) and Interval(x2) and ...
1320 // We implicitly assume a Cell to go up to n-1 (and can be empty).
1321 //
1322 // A formula "Covering" is a set of Intervals, implying that xn can be in
1323 // neither of these intervals. To be a covering (of the real line), the union
1324 // of these intervals should be the real numbers.
1325 // ======== CAD direct conflict
1326 // Children (Cell, A)
1327 // ---------------------
1328 // Conclusion: (false)
1329 // A direct interval is generated from an assumption A (in variables x1...xn)
1330 // over a Cell (in variables x1...xn). It derives that A evaluates to false
1331 // over the Cell. In the actual algorithm, it means that xn can not be in the
1332 // topmost interval of the Cell.
1333 ARITH_NL_CAD_DIRECT,
1334 // ======== CAD recursive interval
1335 // Children (Cell, Covering)
1336 // ---------------------
1337 // Conclusion: (false)
1338 // A recursive interval is generated from a Covering (for xn) over a Cell
1339 // (in variables x1...xn-1). It generates the conclusion that no xn exists
1340 // that extends the Cell and satisfies all assumptions.
1341 ARITH_NL_CAD_RECURSIVE,
1342
1343 //================================================= Unknown rule
1344 UNKNOWN,
1345 };
1346
1347 /**
1348 * Converts a proof rule to a string. Note: This function is also used in
1349 * `safe_print()`. Changing this function name or signature will result in
1350 * `safe_print()` printing "<unsupported>" instead of the proper strings for
1351 * the enum values.
1352 *
1353 * @param id The proof rule
1354 * @return The name of the proof rule
1355 */
1356 const char* toString(PfRule id);
1357
1358 /**
1359 * Writes a proof rule name to a stream.
1360 *
1361 * @param out The stream to write to
1362 * @param id The proof rule to write to the stream
1363 * @return The stream
1364 */
1365 std::ostream& operator<<(std::ostream& out, PfRule id);
1366
1367 /** Hash function for proof rules */
1368 struct PfRuleHashFunction
1369 {
1370 size_t operator()(PfRule id) const;
1371 }; /* struct PfRuleHashFunction */
1372
1373 } // namespace CVC4
1374
1375 #endif /* CVC4__EXPR__PROOF_RULE_H */