Rename CVC4__ header guards to CVC5__. (#6326)
[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 CVC5__EXPR__PROOF_RULE_H
18 #define CVC5__EXPR__PROOF_RULE_H
19
20 #include <iosfwd>
21
22 namespace cvc5 {
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(toOriginal(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 original form of F', meaning that
139 // this rule may conclude an F whose Skolem form is justified by the
140 // definition of its (fresh) Skolem variables. For example, this rule may
141 // justify the conclusion (= k t) where k is the purification Skolem for t,
142 // e.g. where the original form of k is t.
143 //
144 // Furthermore, notice that the rewriting and substitution is applied only
145 // within the side condition, meaning the rewritten form of the original 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(toOriginal(F')) == Rewriter::rewrite(toOriginal(G'))
180 // where F' and G' are the result of each side of the equation above. Here,
181 // original 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 are the same and the number of literals
306 // in 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 // As above but not checked
324 MACRO_RESOLUTION_TRUST,
325
326 // ======== Split
327 // Children: none
328 // Arguments: (F)
329 // ---------------------
330 // Conclusion: (or F (not F))
331 SPLIT,
332 // ======== Equality resolution
333 // Children: (P1:F1, P2:(= F1 F2))
334 // Arguments: none
335 // ---------------------
336 // Conclusion: (F2)
337 // Note this can optionally be seen as a macro for EQUIV_ELIM1+RESOLUTION.
338 EQ_RESOLVE,
339 // ======== Modus ponens
340 // Children: (P1:F1, P2:(=> F1 F2))
341 // Arguments: none
342 // ---------------------
343 // Conclusion: (F2)
344 // Note this can optionally be seen as a macro for IMPLIES_ELIM+RESOLUTION.
345 MODUS_PONENS,
346 // ======== Double negation elimination
347 // Children: (P:(not (not F)))
348 // Arguments: none
349 // ---------------------
350 // Conclusion: (F)
351 NOT_NOT_ELIM,
352 // ======== Contradiction
353 // Children: (P1:F P2:(not F))
354 // Arguments: ()
355 // ---------------------
356 // Conclusion: false
357 CONTRA,
358 // ======== And elimination
359 // Children: (P:(and F1 ... Fn))
360 // Arguments: (i)
361 // ---------------------
362 // Conclusion: (Fi)
363 AND_ELIM,
364 // ======== And introduction
365 // Children: (P1:F1 ... Pn:Fn))
366 // Arguments: ()
367 // ---------------------
368 // Conclusion: (and P1 ... Pn)
369 AND_INTRO,
370 // ======== Not Or elimination
371 // Children: (P:(not (or F1 ... Fn)))
372 // Arguments: (i)
373 // ---------------------
374 // Conclusion: (not Fi)
375 NOT_OR_ELIM,
376 // ======== Implication elimination
377 // Children: (P:(=> F1 F2))
378 // Arguments: ()
379 // ---------------------
380 // Conclusion: (or (not F1) F2)
381 IMPLIES_ELIM,
382 // ======== Not Implication elimination version 1
383 // Children: (P:(not (=> F1 F2)))
384 // Arguments: ()
385 // ---------------------
386 // Conclusion: (F1)
387 NOT_IMPLIES_ELIM1,
388 // ======== Not Implication elimination version 2
389 // Children: (P:(not (=> F1 F2)))
390 // Arguments: ()
391 // ---------------------
392 // Conclusion: (not F2)
393 NOT_IMPLIES_ELIM2,
394 // ======== Equivalence elimination version 1
395 // Children: (P:(= F1 F2))
396 // Arguments: ()
397 // ---------------------
398 // Conclusion: (or (not F1) F2)
399 EQUIV_ELIM1,
400 // ======== Equivalence elimination version 2
401 // Children: (P:(= F1 F2))
402 // Arguments: ()
403 // ---------------------
404 // Conclusion: (or F1 (not F2))
405 EQUIV_ELIM2,
406 // ======== Not Equivalence elimination version 1
407 // Children: (P:(not (= F1 F2)))
408 // Arguments: ()
409 // ---------------------
410 // Conclusion: (or F1 F2)
411 NOT_EQUIV_ELIM1,
412 // ======== Not Equivalence elimination version 2
413 // Children: (P:(not (= F1 F2)))
414 // Arguments: ()
415 // ---------------------
416 // Conclusion: (or (not F1) (not F2))
417 NOT_EQUIV_ELIM2,
418 // ======== XOR elimination version 1
419 // Children: (P:(xor F1 F2)))
420 // Arguments: ()
421 // ---------------------
422 // Conclusion: (or F1 F2)
423 XOR_ELIM1,
424 // ======== XOR elimination version 2
425 // Children: (P:(xor F1 F2)))
426 // Arguments: ()
427 // ---------------------
428 // Conclusion: (or (not F1) (not F2))
429 XOR_ELIM2,
430 // ======== Not XOR elimination version 1
431 // Children: (P:(not (xor F1 F2)))
432 // Arguments: ()
433 // ---------------------
434 // Conclusion: (or F1 (not F2))
435 NOT_XOR_ELIM1,
436 // ======== Not XOR elimination version 2
437 // Children: (P:(not (xor F1 F2)))
438 // Arguments: ()
439 // ---------------------
440 // Conclusion: (or (not F1) F2)
441 NOT_XOR_ELIM2,
442 // ======== ITE elimination version 1
443 // Children: (P:(ite C F1 F2))
444 // Arguments: ()
445 // ---------------------
446 // Conclusion: (or (not C) F1)
447 ITE_ELIM1,
448 // ======== ITE elimination version 2
449 // Children: (P:(ite C F1 F2))
450 // Arguments: ()
451 // ---------------------
452 // Conclusion: (or C F2)
453 ITE_ELIM2,
454 // ======== Not ITE elimination version 1
455 // Children: (P:(not (ite C F1 F2)))
456 // Arguments: ()
457 // ---------------------
458 // Conclusion: (or (not C) (not F1))
459 NOT_ITE_ELIM1,
460 // ======== Not ITE elimination version 1
461 // Children: (P:(not (ite C F1 F2)))
462 // Arguments: ()
463 // ---------------------
464 // Conclusion: (or C (not F2))
465 NOT_ITE_ELIM2,
466
467 //================================================= De Morgan rules
468 // ======== Not And
469 // Children: (P:(not (and F1 ... Fn))
470 // Arguments: ()
471 // ---------------------
472 // Conclusion: (or (not F1) ... (not Fn))
473 NOT_AND,
474 //================================================= CNF rules
475 // ======== CNF And Pos
476 // Children: ()
477 // Arguments: ((and F1 ... Fn), i)
478 // ---------------------
479 // Conclusion: (or (not (and F1 ... Fn)) Fi)
480 CNF_AND_POS,
481 // ======== CNF And Neg
482 // Children: ()
483 // Arguments: ((and F1 ... Fn))
484 // ---------------------
485 // Conclusion: (or (and F1 ... Fn) (not F1) ... (not Fn))
486 CNF_AND_NEG,
487 // ======== CNF Or Pos
488 // Children: ()
489 // Arguments: ((or F1 ... Fn))
490 // ---------------------
491 // Conclusion: (or (not (or F1 ... Fn)) F1 ... Fn)
492 CNF_OR_POS,
493 // ======== CNF Or Neg
494 // Children: ()
495 // Arguments: ((or F1 ... Fn), i)
496 // ---------------------
497 // Conclusion: (or (or F1 ... Fn) (not Fi))
498 CNF_OR_NEG,
499 // ======== CNF Implies Pos
500 // Children: ()
501 // Arguments: ((implies F1 F2))
502 // ---------------------
503 // Conclusion: (or (not (implies F1 F2)) (not F1) F2)
504 CNF_IMPLIES_POS,
505 // ======== CNF Implies Neg version 1
506 // Children: ()
507 // Arguments: ((implies F1 F2))
508 // ---------------------
509 // Conclusion: (or (implies F1 F2) F1)
510 CNF_IMPLIES_NEG1,
511 // ======== CNF Implies Neg version 2
512 // Children: ()
513 // Arguments: ((implies F1 F2))
514 // ---------------------
515 // Conclusion: (or (implies F1 F2) (not F2))
516 CNF_IMPLIES_NEG2,
517 // ======== CNF Equiv Pos version 1
518 // Children: ()
519 // Arguments: ((= F1 F2))
520 // ---------------------
521 // Conclusion: (or (not (= F1 F2)) (not F1) F2)
522 CNF_EQUIV_POS1,
523 // ======== CNF Equiv Pos version 2
524 // Children: ()
525 // Arguments: ((= F1 F2))
526 // ---------------------
527 // Conclusion: (or (not (= F1 F2)) F1 (not F2))
528 CNF_EQUIV_POS2,
529 // ======== CNF Equiv Neg version 1
530 // Children: ()
531 // Arguments: ((= F1 F2))
532 // ---------------------
533 // Conclusion: (or (= F1 F2) F1 F2)
534 CNF_EQUIV_NEG1,
535 // ======== CNF Equiv Neg version 2
536 // Children: ()
537 // Arguments: ((= F1 F2))
538 // ---------------------
539 // Conclusion: (or (= F1 F2) (not F1) (not F2))
540 CNF_EQUIV_NEG2,
541 // ======== CNF Xor Pos version 1
542 // Children: ()
543 // Arguments: ((xor F1 F2))
544 // ---------------------
545 // Conclusion: (or (not (xor F1 F2)) F1 F2)
546 CNF_XOR_POS1,
547 // ======== CNF Xor Pos version 2
548 // Children: ()
549 // Arguments: ((xor F1 F2))
550 // ---------------------
551 // Conclusion: (or (not (xor F1 F2)) (not F1) (not F2))
552 CNF_XOR_POS2,
553 // ======== CNF Xor Neg version 1
554 // Children: ()
555 // Arguments: ((xor F1 F2))
556 // ---------------------
557 // Conclusion: (or (xor F1 F2) (not F1) F2)
558 CNF_XOR_NEG1,
559 // ======== CNF Xor Neg version 2
560 // Children: ()
561 // Arguments: ((xor F1 F2))
562 // ---------------------
563 // Conclusion: (or (xor F1 F2) F1 (not F2))
564 CNF_XOR_NEG2,
565 // ======== CNF ITE Pos version 1
566 // Children: ()
567 // Arguments: ((ite C F1 F2))
568 // ---------------------
569 // Conclusion: (or (not (ite C F1 F2)) (not C) F1)
570 CNF_ITE_POS1,
571 // ======== CNF ITE Pos version 2
572 // Children: ()
573 // Arguments: ((ite C F1 F2))
574 // ---------------------
575 // Conclusion: (or (not (ite C F1 F2)) C F2)
576 CNF_ITE_POS2,
577 // ======== CNF ITE Pos version 3
578 // Children: ()
579 // Arguments: ((ite C F1 F2))
580 // ---------------------
581 // Conclusion: (or (not (ite C F1 F2)) F1 F2)
582 CNF_ITE_POS3,
583 // ======== CNF ITE Neg version 1
584 // Children: ()
585 // Arguments: ((ite C F1 F2))
586 // ---------------------
587 // Conclusion: (or (ite C F1 F2) (not C) (not F1))
588 CNF_ITE_NEG1,
589 // ======== CNF ITE Neg version 2
590 // Children: ()
591 // Arguments: ((ite C F1 F2))
592 // ---------------------
593 // Conclusion: (or (ite C F1 F2) C (not F2))
594 CNF_ITE_NEG2,
595 // ======== CNF ITE Neg version 3
596 // Children: ()
597 // Arguments: ((ite C F1 F2))
598 // ---------------------
599 // Conclusion: (or (ite C F1 F2) (not F1) (not F2))
600 CNF_ITE_NEG3,
601
602 //================================================= Equality rules
603 // ======== Reflexive
604 // Children: none
605 // Arguments: (t)
606 // ---------------------
607 // Conclusion: (= t t)
608 REFL,
609 // ======== Symmetric
610 // Children: (P:(= t1 t2)) or (P:(not (= t1 t2)))
611 // Arguments: none
612 // -----------------------
613 // Conclusion: (= t2 t1) or (not (= t2 t1))
614 SYMM,
615 // ======== Transitivity
616 // Children: (P1:(= t1 t2), ..., Pn:(= t{n-1} tn))
617 // Arguments: none
618 // -----------------------
619 // Conclusion: (= t1 tn)
620 TRANS,
621 // ======== Congruence
622 // Children: (P1:(= t1 s1), ..., Pn:(= tn sn))
623 // Arguments: (<kind> f?)
624 // ---------------------------------------------
625 // Conclusion: (= (<kind> f? t1 ... tn) (<kind> f? s1 ... sn))
626 // Notice that f must be provided iff <kind> is a parameterized kind, e.g.
627 // APPLY_UF. The actual node for <kind> is constructible via
628 // ProofRuleChecker::mkKindNode.
629 CONG,
630 // ======== True intro
631 // Children: (P:F)
632 // Arguments: none
633 // ----------------------------------------
634 // Conclusion: (= F true)
635 TRUE_INTRO,
636 // ======== True elim
637 // Children: (P:(= F true))
638 // Arguments: none
639 // ----------------------------------------
640 // Conclusion: F
641 TRUE_ELIM,
642 // ======== False intro
643 // Children: (P:(not F))
644 // Arguments: none
645 // ----------------------------------------
646 // Conclusion: (= F false)
647 FALSE_INTRO,
648 // ======== False elim
649 // Children: (P:(= F false))
650 // Arguments: none
651 // ----------------------------------------
652 // Conclusion: (not F)
653 FALSE_ELIM,
654 // ======== HO trust
655 // Children: none
656 // Arguments: (t)
657 // ---------------------
658 // Conclusion: (= t TheoryUfRewriter::getHoApplyForApplyUf(t))
659 // For example, this rule concludes (f x y) = (HO_APPLY (HO_APPLY f x) y)
660 HO_APP_ENCODE,
661 // ======== Congruence
662 // Children: (P1:(= f g), P2:(= t1 s1), ..., Pn+1:(= tn sn))
663 // Arguments: ()
664 // ---------------------------------------------
665 // Conclusion: (= (f t1 ... tn) (g s1 ... sn))
666 // Notice that this rule is only used when the application kinds are APPLY_UF.
667 HO_CONG,
668
669 //================================================= Array rules
670 // ======== Read over write
671 // Children: (P:(not (= i1 i2)))
672 // Arguments: ((select (store a i2 e) i1))
673 // ----------------------------------------
674 // Conclusion: (= (select (store a i2 e) i1) (select a i1))
675 ARRAYS_READ_OVER_WRITE,
676 // ======== Read over write, contrapositive
677 // Children: (P:(not (= (select (store a i2 e) i1) (select a i1)))
678 // Arguments: none
679 // ----------------------------------------
680 // Conclusion: (= i1 i2)
681 ARRAYS_READ_OVER_WRITE_CONTRA,
682 // ======== Read over write 1
683 // Children: none
684 // Arguments: ((select (store a i e) i))
685 // ----------------------------------------
686 // Conclusion: (= (select (store a i e) i) e)
687 ARRAYS_READ_OVER_WRITE_1,
688 // ======== Extensionality
689 // Children: (P:(not (= a b)))
690 // Arguments: none
691 // ----------------------------------------
692 // Conclusion: (not (= (select a k) (select b k)))
693 // where k is arrays::SkolemCache::getExtIndexSkolem((not (= a b))).
694 ARRAYS_EXT,
695 // ======== Array Trust
696 // Children: (P1 ... Pn)
697 // Arguments: (F)
698 // ---------------------
699 // Conclusion: F
700 ARRAYS_TRUST,
701
702 //================================================= Bit-Vector rules
703 // ======== Bitblast
704 // Children: none
705 // Arguments: (t)
706 // ---------------------
707 // Conclusion: (= t bitblast(t))
708 BV_BITBLAST,
709 // ======== Eager Atom
710 // Children: none
711 // Arguments: (F)
712 // ---------------------
713 // Conclusion: (= F F[0])
714 // where F is of kind BITVECTOR_EAGER_ATOM
715 BV_EAGER_ATOM,
716
717 //================================================= Datatype rules
718 // ======== Unification
719 // Children: (P:(= (C t1 ... tn) (C s1 ... sn)))
720 // Arguments: (i)
721 // ----------------------------------------
722 // Conclusion: (= ti si)
723 // where C is a constructor.
724 DT_UNIF,
725 // ======== Instantiate
726 // Children: none
727 // Arguments: (t, n)
728 // ----------------------------------------
729 // Conclusion: (= ((_ is C) t) (= t (C (sel_1 t) ... (sel_n t))))
730 // where C is the n^th constructor of the type of T, and (_ is C) is the
731 // discriminator (tester) for C.
732 DT_INST,
733 // ======== Collapse
734 // Children: none
735 // Arguments: ((sel_i (C_j t_1 ... t_n)))
736 // ----------------------------------------
737 // Conclusion: (= (sel_i (C_j t_1 ... t_n)) r)
738 // where C_j is a constructor, r is t_i if sel_i is a correctly applied
739 // selector, or TypeNode::mkGroundTerm() of the proper type otherwise. Notice
740 // that the use of mkGroundTerm differs from the rewriter which uses
741 // mkGroundValue in this case.
742 DT_COLLAPSE,
743 // ======== Split
744 // Children: none
745 // Arguments: (t)
746 // ----------------------------------------
747 // Conclusion: (or ((_ is C1) t) ... ((_ is Cn) t))
748 DT_SPLIT,
749 // ======== Clash
750 // Children: (P1:((_ is Ci) t), P2: ((_ is Cj) t))
751 // Arguments: none
752 // ----------------------------------------
753 // Conclusion: false
754 // for i != j.
755 DT_CLASH,
756 // ======== Datatype Trust
757 // Children: (P1 ... Pn)
758 // Arguments: (F)
759 // ---------------------
760 // Conclusion: F
761 DT_TRUST,
762
763 //================================================= Quantifiers rules
764 // ======== Skolem intro
765 // Children: none
766 // Arguments: (k)
767 // ----------------------------------------
768 // Conclusion: (= k t)
769 // where t is the original form of skolem k.
770 SKOLEM_INTRO,
771 // ======== Exists intro
772 // Children: (P:F[t])
773 // Arguments: ((exists ((x T)) F[x]))
774 // ----------------------------------------
775 // Conclusion: (exists ((x T)) F[x])
776 // This rule verifies that F[x] indeed matches F[t] with a substitution
777 // over x.
778 EXISTS_INTRO,
779 // ======== Skolemize
780 // Children: (P:(exists ((x1 T1) ... (xn Tn)) F))
781 // Arguments: none
782 // ----------------------------------------
783 // Conclusion: F*sigma
784 // sigma maps x1 ... xn to their representative skolems obtained by
785 // SkolemManager::mkSkolemize, returned in the skolems argument of that
786 // method. Alternatively, can use negated forall as a premise. The witness
787 // terms for the returned skolems can be obtained by
788 // SkolemManager::getWitnessForm.
789 SKOLEMIZE,
790 // ======== Instantiate
791 // Children: (P:(forall ((x1 T1) ... (xn Tn)) F))
792 // Arguments: (t1 ... tn)
793 // ----------------------------------------
794 // Conclusion: F*sigma
795 // sigma maps x1 ... xn to t1 ... tn.
796 INSTANTIATE,
797
798 //================================================= String rules
799 //======================== Core solver
800 // ======== Concat eq
801 // Children: (P1:(= (str.++ t1 ... tn t) (str.++ t1 ... tn s)))
802 // Arguments: (b), indicating if reverse direction
803 // ---------------------
804 // Conclusion: (= t s)
805 //
806 // Notice that t or s may be empty, in which case they are implicit in the
807 // concatenation above. For example, if
808 // P1 concludes (= x (str.++ x z)), then
809 // (CONCAT_EQ P1 :args false) concludes (= "" z)
810 //
811 // Also note that constants are split, such that if
812 // P1 concludes (= (str.++ "abc" x) (str.++ "a" y)), then
813 // (CONCAT_EQ P1 :args false) concludes (= (str.++ "bc" x) y)
814 // This splitting is done only for constants such that Word::splitConstant
815 // returns non-null.
816 CONCAT_EQ,
817 // ======== Concat unify
818 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
819 // P2:(= (str.len t1) (str.len s1)))
820 // Arguments: (b), indicating if reverse direction
821 // ---------------------
822 // Conclusion: (= t1 s1)
823 CONCAT_UNIFY,
824 // ======== Concat conflict
825 // Children: (P1:(= (str.++ c1 t) (str.++ c2 s)))
826 // Arguments: (b), indicating if reverse direction
827 // ---------------------
828 // Conclusion: false
829 // Where c1, c2 are constants such that Word::splitConstant(c1,c2,index,b)
830 // is null, in other words, neither is a prefix of the other.
831 CONCAT_CONFLICT,
832 // ======== Concat split
833 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
834 // P2:(not (= (str.len t1) (str.len s1))))
835 // Arguments: (false)
836 // ---------------------
837 // Conclusion: (or (= t1 (str.++ s1 r_t)) (= s1 (str.++ t1 r_s)))
838 // where
839 // r_t = (witness ((z String)) (= z (suf t1 (str.len s1)))),
840 // r_s = (witness ((z String)) (= z (suf s1 (str.len t1)))).
841 //
842 // or the reverse form of the above:
843 //
844 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
845 // P2:(not (= (str.len t2) (str.len s2))))
846 // Arguments: (true)
847 // ---------------------
848 // Conclusion: (or (= t2 (str.++ r_t s2)) (= s2 (str.++ r_s t2)))
849 // where
850 // r_t = (witness ((z String)) (= z (pre t2 (- (str.len t2) (str.len
851 // s2))))), r_s = (witness ((z String)) (= z (pre s2 (- (str.len s2)
852 // (str.len t2))))).
853 //
854 // Above, (suf x n) is shorthand for (str.substr x n (- (str.len x) n)) and
855 // (pre x n) is shorthand for (str.substr x 0 n).
856 CONCAT_SPLIT,
857 // ======== Concat constant split
858 // Children: (P1:(= (str.++ t1 t2) (str.++ c s2)),
859 // P2:(not (= (str.len t1) 0)))
860 // Arguments: (false)
861 // ---------------------
862 // Conclusion: (= t1 (str.++ c r))
863 // where
864 // r = (witness ((z String)) (= z (suf t1 1))).
865 //
866 // or the reverse form of the above:
867 //
868 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 c)),
869 // P2:(not (= (str.len t2) 0)))
870 // Arguments: (true)
871 // ---------------------
872 // Conclusion: (= t2 (str.++ r c))
873 // where
874 // r = (witness ((z String)) (= z (pre t2 (- (str.len t2) 1)))).
875 CONCAT_CSPLIT,
876 // ======== Concat length propagate
877 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
878 // P2:(> (str.len t1) (str.len s1)))
879 // Arguments: (false)
880 // ---------------------
881 // Conclusion: (= t1 (str.++ s1 r_t))
882 // where
883 // r_t = (witness ((z String)) (= z (suf t1 (str.len s1))))
884 //
885 // or the reverse form of the above:
886 //
887 // Children: (P1:(= (str.++ t1 t2) (str.++ s1 s2)),
888 // P2:(> (str.len t2) (str.len s2)))
889 // Arguments: (false)
890 // ---------------------
891 // Conclusion: (= t2 (str.++ r_t s2))
892 // where
893 // r_t = (witness ((z String)) (= z (pre t2 (- (str.len t2) (str.len
894 // s2))))).
895 CONCAT_LPROP,
896 // ======== Concat constant propagate
897 // Children: (P1:(= (str.++ t1 w1 t2) (str.++ w2 s)),
898 // P2:(not (= (str.len t1) 0)))
899 // Arguments: (false)
900 // ---------------------
901 // Conclusion: (= t1 (str.++ w3 r))
902 // where
903 // w1, w2, w3, w4 are words,
904 // w3 is (pre w2 p),
905 // w4 is (suf w2 p),
906 // p = Word::overlap((suf w2 1), w1),
907 // r = (witness ((z String)) (= z (suf t1 (str.len w3)))).
908 // In other words, w4 is the largest suffix of (suf w2 1) that can contain a
909 // prefix of w1; since t1 is non-empty, w3 must therefore be contained in t1.
910 //
911 // or the reverse form of the above:
912 //
913 // Children: (P1:(= (str.++ t1 w1 t2) (str.++ s w2)),
914 // P2:(not (= (str.len t2) 0)))
915 // Arguments: (true)
916 // ---------------------
917 // Conclusion: (= t2 (str.++ r w3))
918 // where
919 // w1, w2, w3, w4 are words,
920 // w3 is (suf w2 (- (str.len w2) p)),
921 // w4 is (pre w2 (- (str.len w2) p)),
922 // p = Word::roverlap((pre w2 (- (str.len w2) 1)), w1),
923 // r = (witness ((z String)) (= z (pre t2 (- (str.len t2) (str.len w3))))).
924 // In other words, w4 is the largest prefix of (pre w2 (- (str.len w2) 1))
925 // that can contain a suffix of w1; since t2 is non-empty, w3 must therefore
926 // be contained in t2.
927 CONCAT_CPROP,
928 // ======== String decompose
929 // Children: (P1: (>= (str.len t) n)
930 // Arguments: (false)
931 // ---------------------
932 // Conclusion: (and (= t (str.++ w1 w2)) (= (str.len w1) n))
933 // or
934 // Children: (P1: (>= (str.len t) n)
935 // Arguments: (true)
936 // ---------------------
937 // Conclusion: (and (= t (str.++ w1 w2)) (= (str.len w2) n))
938 // where
939 // w1 is (witness ((z String)) (= z (pre t n)))
940 // w2 is (witness ((z String)) (= z (suf t n)))
941 STRING_DECOMPOSE,
942 // ======== Length positive
943 // Children: none
944 // Arguments: (t)
945 // ---------------------
946 // Conclusion: (or (and (= (str.len t) 0) (= t "")) (> (str.len t 0)))
947 STRING_LENGTH_POS,
948 // ======== Length non-empty
949 // Children: (P1:(not (= t "")))
950 // Arguments: none
951 // ---------------------
952 // Conclusion: (not (= (str.len t) 0))
953 STRING_LENGTH_NON_EMPTY,
954 //======================== Extended functions
955 // ======== Reduction
956 // Children: none
957 // Arguments: (t)
958 // ---------------------
959 // Conclusion: (and R (= t w))
960 // where w = strings::StringsPreprocess::reduce(t, R, ...).
961 // In other words, R is the reduction predicate for extended term t, and w is
962 // (witness ((z T)) (= z t))
963 // Notice that the free variables of R are w and the free variables of t.
964 STRING_REDUCTION,
965 // ======== Eager Reduction
966 // Children: none
967 // Arguments: (t, id?)
968 // ---------------------
969 // Conclusion: R
970 // where R = strings::TermRegistry::eagerReduce(t, id).
971 STRING_EAGER_REDUCTION,
972 //======================== Regular expressions
973 // ======== Regular expression intersection
974 // Children: (P:(str.in.re t R1), P:(str.in.re t R2))
975 // Arguments: none
976 // ---------------------
977 // Conclusion: (str.in.re t (re.inter R1 R2)).
978 RE_INTER,
979 // ======== Regular expression unfold positive
980 // Children: (P:(str.in.re t R))
981 // Arguments: none
982 // ---------------------
983 // Conclusion:(RegExpOpr::reduceRegExpPos((str.in.re t R))),
984 // corresponding to the one-step unfolding of the premise.
985 RE_UNFOLD_POS,
986 // ======== Regular expression unfold negative
987 // Children: (P:(not (str.in.re t R)))
988 // Arguments: none
989 // ---------------------
990 // Conclusion:(RegExpOpr::reduceRegExpNeg((not (str.in.re t R)))),
991 // corresponding to the one-step unfolding of the premise.
992 RE_UNFOLD_NEG,
993 // ======== Regular expression unfold negative concat fixed
994 // Children: (P:(not (str.in.re t R)))
995 // Arguments: none
996 // ---------------------
997 // Conclusion:(RegExpOpr::reduceRegExpNegConcatFixed((not (str.in.re t
998 // R)),L,i)) where RegExpOpr::getRegExpConcatFixed((not (str.in.re t R)), i) =
999 // L. corresponding to the one-step unfolding of the premise, optimized for
1000 // fixed length of component i of the regular expression concatenation R.
1001 RE_UNFOLD_NEG_CONCAT_FIXED,
1002 // ======== Regular expression elimination
1003 // Children: none
1004 // Arguments: (F, b)
1005 // ---------------------
1006 // Conclusion: (= F strings::RegExpElimination::eliminate(F, b))
1007 // where b is a Boolean indicating whether we are using aggressive
1008 // eliminations. Notice this rule concludes (= F F) if no eliminations
1009 // are performed for F.
1010 RE_ELIM,
1011 //======================== Code points
1012 // Children: none
1013 // Arguments: (t, s)
1014 // ---------------------
1015 // Conclusion:(or (= (str.code t) (- 1))
1016 // (not (= (str.code t) (str.code s)))
1017 // (not (= t s)))
1018 STRING_CODE_INJ,
1019 //======================== Sequence unit
1020 // Children: (P:(= (seq.unit x) (seq.unit y)))
1021 // Arguments: none
1022 // ---------------------
1023 // Conclusion:(= x y)
1024 // Also applies to the case where (seq.unit y) is a constant sequence
1025 // of length one.
1026 STRING_SEQ_UNIT_INJ,
1027 // ======== String Trust
1028 // Children: none
1029 // Arguments: (Q)
1030 // ---------------------
1031 // Conclusion: (Q)
1032 STRING_TRUST,
1033
1034 //================================================= Arithmetic rules
1035 // ======== Adding Inequalities
1036 // Note: an ArithLiteral is a term of the form (>< poly const)
1037 // where
1038 // >< is >=, >, ==, <, <=, or not(== ...).
1039 // poly is a polynomial
1040 // const is a rational constant
1041
1042 // Children: (P1:l1, ..., Pn:ln)
1043 // where each li is an ArithLiteral
1044 // not(= ...) is dis-allowed!
1045 //
1046 // Arguments: (k1, ..., kn), non-zero reals
1047 // ---------------------
1048 // Conclusion: (>< t1 t2)
1049 // where >< is the fusion of the combination of the ><i, (flipping each it
1050 // its ki is negative). >< is always one of <, <=
1051 // NB: this implies that lower bounds must have negative ki,
1052 // and upper bounds must have positive ki.
1053 // t1 is the sum of the scaled polynomials (k_1 * poly_1 + ... + k_n *
1054 // poly_n) t2 is the sum of the scaled constants (k_1 * const_1 + ... + k_n
1055 // * const_n)
1056 ARITH_SCALE_SUM_UPPER_BOUNDS,
1057
1058 // ======== Sum Upper Bounds
1059 // Children: (P1, ... , Pn)
1060 // where each Pi has form (><i, Li, Ri)
1061 // for ><i in {<, <=, ==}
1062 // Conclusion: (>< L R)
1063 // where >< is < if any ><i is <, and <= otherwise.
1064 // L is (+ L1 ... Ln)
1065 // R is (+ R1 ... Rn)
1066 ARITH_SUM_UB,
1067 // ======== Tightening Strict Integer Upper Bounds
1068 // Children: (P:(< i c))
1069 // where i has integer type.
1070 // Arguments: none
1071 // ---------------------
1072 // Conclusion: (<= i greatestIntLessThan(c)})
1073 INT_TIGHT_UB,
1074
1075 // ======== Tightening Strict Integer Lower Bounds
1076 // Children: (P:(> i c))
1077 // where i has integer type.
1078 // Arguments: none
1079 // ---------------------
1080 // Conclusion: (>= i leastIntGreaterThan(c)})
1081 INT_TIGHT_LB,
1082
1083 // ======== Trichotomy of the reals
1084 // Children: (A B)
1085 // Arguments: (C)
1086 // ---------------------
1087 // Conclusion: (C),
1088 // where (not A) (not B) and C
1089 // are (> x c) (< x c) and (= x c)
1090 // in some order
1091 // note that "not" here denotes arithmetic negation, flipping
1092 // >= to <, etc.
1093 ARITH_TRICHOTOMY,
1094
1095 // ======== Arithmetic operator elimination
1096 // Children: none
1097 // Arguments: (t)
1098 // ---------------------
1099 // Conclusion: arith::OperatorElim::getAxiomFor(t)
1100 ARITH_OP_ELIM_AXIOM,
1101
1102 // ======== Int Trust
1103 // Children: (P1 ... Pn)
1104 // Arguments: (Q)
1105 // ---------------------
1106 // Conclusion: (Q)
1107 INT_TRUST,
1108
1109 //======== Multiplication sign inference
1110 // Children: none
1111 // Arguments: (f1, ..., fk, m)
1112 // ---------------------
1113 // Conclusion: (=> (and f1 ... fk) (~ m 0))
1114 // Where f1, ..., fk are variables compared to zero (less, greater or not
1115 // equal), m is a monomial from these variables, and ~ is the comparison (less
1116 // or greater) that results from the signs of the variables. All variables
1117 // with even exponent in m should be given as not equal to zero while all
1118 // variables with odd exponent in m should be given as less or greater than
1119 // zero.
1120 ARITH_MULT_SIGN,
1121 //======== Multiplication with positive factor
1122 // Children: none
1123 // Arguments: (m, (rel lhs rhs))
1124 // ---------------------
1125 // Conclusion: (=> (and (> m 0) (rel lhs rhs)) (rel (* m lhs) (* m rhs)))
1126 // Where rel is a relation symbol.
1127 ARITH_MULT_POS,
1128 //======== Multiplication with negative factor
1129 // Children: none
1130 // Arguments: (m, (rel lhs rhs))
1131 // ---------------------
1132 // Conclusion: (=> (and (< m 0) (rel lhs rhs)) (rel_inv (* m lhs) (* m rhs)))
1133 // Where rel is a relation symbol and rel_inv the inverted relation symbol.
1134 ARITH_MULT_NEG,
1135 //======== Multiplication tangent plane
1136 // Children: none
1137 // Arguments: (t, x, y, a, b, sgn)
1138 // ---------------------
1139 // Conclusion:
1140 // sgn=-1: (= (<= t tplane) (or (and (<= x a) (>= y b)) (and (>= x a) (<= y
1141 // b))) sgn= 1: (= (>= t tplane) (or (and (<= x a) (<= y b)) (and (>= x a)
1142 // (>= y b)))
1143 // Where x,y are real terms (variables or extended terms), t = (* x y)
1144 // (possibly under rewriting), a,b are real constants, and sgn is either -1
1145 // or 1. tplane is the tangent plane of x*y at (a,b): b*x + a*y - a*b
1146 ARITH_MULT_TANGENT,
1147
1148 // ================ Lemmas for transcendentals
1149 //======== Assert bounds on PI
1150 // Children: none
1151 // Arguments: (l, u)
1152 // ---------------------
1153 // Conclusion: (and (>= real.pi l) (<= real.pi u))
1154 // Where l (u) is a valid lower (upper) bound on pi.
1155 ARITH_TRANS_PI,
1156
1157 //======== Exp at negative values
1158 // Children: none
1159 // Arguments: (t)
1160 // ---------------------
1161 // Conclusion: (= (< t 0) (< (exp t) 1))
1162 ARITH_TRANS_EXP_NEG,
1163 //======== Exp is always positive
1164 // Children: none
1165 // Arguments: (t)
1166 // ---------------------
1167 // Conclusion: (> (exp t) 0)
1168 ARITH_TRANS_EXP_POSITIVITY,
1169 //======== Exp grows super-linearly for positive values
1170 // Children: none
1171 // Arguments: (t)
1172 // ---------------------
1173 // Conclusion: (or (<= t 0) (> exp(t) (+ t 1)))
1174 ARITH_TRANS_EXP_SUPER_LIN,
1175 //======== Exp at zero
1176 // Children: none
1177 // Arguments: (t)
1178 // ---------------------
1179 // Conclusion: (= (= t 0) (= (exp t) 1))
1180 ARITH_TRANS_EXP_ZERO,
1181 //======== Exp is approximated from above for negative values
1182 // Children: none
1183 // Arguments: (d, t, l, u)
1184 // ---------------------
1185 // Conclusion: (=> (and (>= t l) (<= t u)) (<= (exp t) (secant exp l u t))
1186 // Where d is an even positive number, t an arithmetic term and l (u) a lower
1187 // (upper) bound on t. Let p be the d'th taylor polynomial at zero (also
1188 // called the Maclaurin series) of the exponential function. (secant exp l u
1189 // t) denotes the secant of p from (l, exp(l)) to (u, exp(u)) evaluated at t,
1190 // calculated as follows:
1191 // (p(l) - p(u)) / (l - u) * (t - l) + p(l)
1192 // The lemma states that if t is between l and u, then (exp t) is below the
1193 // secant of p from l to u.
1194 ARITH_TRANS_EXP_APPROX_ABOVE_NEG,
1195 //======== Exp is approximated from above for positive values
1196 // Children: none
1197 // Arguments: (d, t, l, u)
1198 // ---------------------
1199 // Conclusion: (=> (and (>= t l) (<= t u)) (<= (exp t) (secant-pos exp l u t))
1200 // Where d is an even positive number, t an arithmetic term and l (u) a lower
1201 // (upper) bound on t. Let p* be a modification of the d'th taylor polynomial
1202 // at zero (also called the Maclaurin series) of the exponential function as
1203 // follows where p(d-1) is the regular Maclaurin series of degree d-1:
1204 // p* = p(d-1) * (1 + t^n / n!)
1205 // (secant-pos exp l u t) denotes the secant of p from (l, exp(l)) to (u,
1206 // exp(u)) evaluated at t, calculated as follows:
1207 // (p(l) - p(u)) / (l - u) * (t - l) + p(l)
1208 // The lemma states that if t is between l and u, then (exp t) is below the
1209 // secant of p from l to u.
1210 ARITH_TRANS_EXP_APPROX_ABOVE_POS,
1211 //======== Exp is approximated from below
1212 // Children: none
1213 // Arguments: (d, t)
1214 // ---------------------
1215 // Conclusion: (>= (exp t) (maclaurin exp d t))
1216 // Where d is an odd positive number and (maclaurin exp d t) is the d'th
1217 // taylor polynomial at zero (also called the Maclaurin series) of the
1218 // exponential function evaluated at t. The Maclaurin series for the
1219 // exponential function is the following:
1220 // e^x = \sum_{n=0}^{\infty} x^n / n!
1221 ARITH_TRANS_EXP_APPROX_BELOW,
1222
1223 //======== Sine is always between -1 and 1
1224 // Children: none
1225 // Arguments: (t)
1226 // ---------------------
1227 // Conclusion: (and (<= (sin t) 1) (>= (sin t) (- 1)))
1228 ARITH_TRANS_SINE_BOUNDS,
1229 //======== Sine arg shifted to -pi..pi
1230 // Children: none
1231 // Arguments: (x, y, s)
1232 // ---------------------
1233 // Conclusion: (and
1234 // (<= -pi y pi)
1235 // (= (sin y) (sin x))
1236 // (ite (<= -pi x pi) (= x y) (= x (+ y (* 2 pi s))))
1237 // )
1238 // Where x is the argument to sine, y is a new real skolem that is x shifted
1239 // into -pi..pi and s is a new integer skolem that is the number of phases y
1240 // is shifted.
1241 ARITH_TRANS_SINE_SHIFT,
1242 //======== Sine is symmetric with respect to negation of the argument
1243 // Children: none
1244 // Arguments: (t)
1245 // ---------------------
1246 // Conclusion: (= (- (sin t) (sin (- t))) 0)
1247 ARITH_TRANS_SINE_SYMMETRY,
1248 //======== Sine is bounded by the tangent at zero
1249 // Children: none
1250 // Arguments: (t)
1251 // ---------------------
1252 // Conclusion: (and
1253 // (=> (> t 0) (< (sin t) t))
1254 // (=> (< t 0) (> (sin t) t))
1255 // )
1256 ARITH_TRANS_SINE_TANGENT_ZERO,
1257 //======== Sine is bounded by the tangents at -pi and pi
1258 // Children: none
1259 // Arguments: (t)
1260 // ---------------------
1261 // Conclusion: (and
1262 // (=> (> t -pi) (> (sin t) (- -pi t)))
1263 // (=> (< t pi) (< (sin t) (- pi t)))
1264 // )
1265 ARITH_TRANS_SINE_TANGENT_PI,
1266 //======== Sine is approximated from above for negative values
1267 // Children: none
1268 // Arguments: (d, t, lb, ub, l, u)
1269 // ---------------------
1270 // Conclusion: (=> (and (>= t lb) (<= t ub)) (<= (sin t) (secant sin l u t))
1271 // Where d is an even positive number, t an arithmetic term, lb (ub) a
1272 // symbolic lower (upper) bound on t (possibly containing pi) and l (u) the
1273 // evaluated lower (upper) bound on t. Let p be the d'th taylor polynomial at
1274 // zero (also called the Maclaurin series) of the sine function. (secant sin l
1275 // u t) denotes the secant of p from (l, sin(l)) to (u, sin(u)) evaluated at
1276 // t, calculated as follows:
1277 // (p(l) - p(u)) / (l - u) * (t - l) + p(l)
1278 // The lemma states that if t is between l and u, then (sin t) is below the
1279 // secant of p from l to u.
1280 ARITH_TRANS_SINE_APPROX_ABOVE_NEG,
1281 //======== Sine is approximated from above for positive values
1282 // Children: none
1283 // Arguments: (d, t, c, lb, ub)
1284 // ---------------------
1285 // Conclusion: (=> (and (>= t lb) (<= t ub)) (<= (sin t) (upper sin c))
1286 // Where d is an even positive number, t an arithmetic term, c an arithmetic
1287 // constant, and lb (ub) a symbolic lower (upper) bound on t (possibly
1288 // containing pi). Let p be the d'th taylor polynomial at zero (also called
1289 // the Maclaurin series) of the sine function. (upper sin c) denotes the upper
1290 // bound on sin(c) given by p and lb,ub are such that sin(t) is the maximum of
1291 // the sine function on (lb,ub).
1292 ARITH_TRANS_SINE_APPROX_ABOVE_POS,
1293 //======== Sine is approximated from below for negative values
1294 // Children: none
1295 // Arguments: (d, t, c, lb, ub)
1296 // ---------------------
1297 // Conclusion: (=> (and (>= t lb) (<= t ub)) (>= (sin t) (lower sin c))
1298 // Where d is an even positive number, t an arithmetic term, c an arithmetic
1299 // constant, and lb (ub) a symbolic lower (upper) bound on t (possibly
1300 // containing pi). Let p be the d'th taylor polynomial at zero (also called
1301 // the Maclaurin series) of the sine function. (lower sin c) denotes the lower
1302 // bound on sin(c) given by p and lb,ub are such that sin(t) is the minimum of
1303 // the sine function on (lb,ub).
1304 ARITH_TRANS_SINE_APPROX_BELOW_NEG,
1305 //======== Sine is approximated from below for positive values
1306 // Children: none
1307 // Arguments: (d, t, lb, ub, l, u)
1308 // ---------------------
1309 // Conclusion: (=> (and (>= t lb) (<= t ub)) (>= (sin t) (secant sin l u t))
1310 // Where d is an even positive number, t an arithmetic term, lb (ub) a
1311 // symbolic lower (upper) bound on t (possibly containing pi) and l (u) the
1312 // evaluated lower (upper) bound on t. Let p be the d'th taylor polynomial at
1313 // zero (also called the Maclaurin series) of the sine function. (secant sin l
1314 // u t) denotes the secant of p from (l, sin(l)) to (u, sin(u)) evaluated at
1315 // t, calculated as follows:
1316 // (p(l) - p(u)) / (l - u) * (t - l) + p(l)
1317 // The lemma states that if t is between l and u, then (sin t) is above the
1318 // secant of p from l to u.
1319 ARITH_TRANS_SINE_APPROX_BELOW_POS,
1320
1321 // ================ CAD Lemmas
1322 // We use IRP for IndexedRootPredicate.
1323 //
1324 // A formula "Interval" describes that a variable (xn is none is given) is
1325 // within a particular interval whose bounds are given as IRPs. It is either
1326 // an open interval or a point interval:
1327 // (IRP k poly) < xn < (IRP k poly)
1328 // xn == (IRP k poly)
1329 //
1330 // A formula "Cell" describes a portion
1331 // of the real space in the following form:
1332 // Interval(x1) and Interval(x2) and ...
1333 // We implicitly assume a Cell to go up to n-1 (and can be empty).
1334 //
1335 // A formula "Covering" is a set of Intervals, implying that xn can be in
1336 // neither of these intervals. To be a covering (of the real line), the union
1337 // of these intervals should be the real numbers.
1338 // ======== CAD direct conflict
1339 // Children (Cell, A)
1340 // ---------------------
1341 // Conclusion: (false)
1342 // A direct interval is generated from an assumption A (in variables x1...xn)
1343 // over a Cell (in variables x1...xn). It derives that A evaluates to false
1344 // over the Cell. In the actual algorithm, it means that xn can not be in the
1345 // topmost interval of the Cell.
1346 ARITH_NL_CAD_DIRECT,
1347 // ======== CAD recursive interval
1348 // Children (Cell, Covering)
1349 // ---------------------
1350 // Conclusion: (false)
1351 // A recursive interval is generated from a Covering (for xn) over a Cell
1352 // (in variables x1...xn-1). It generates the conclusion that no xn exists
1353 // that extends the Cell and satisfies all assumptions.
1354 ARITH_NL_CAD_RECURSIVE,
1355
1356 //================================================= Unknown rule
1357 UNKNOWN,
1358 };
1359
1360 /**
1361 * Converts a proof rule to a string. Note: This function is also used in
1362 * `safe_print()`. Changing this function name or signature will result in
1363 * `safe_print()` printing "<unsupported>" instead of the proper strings for
1364 * the enum values.
1365 *
1366 * @param id The proof rule
1367 * @return The name of the proof rule
1368 */
1369 const char* toString(PfRule id);
1370
1371 /**
1372 * Writes a proof rule name to a stream.
1373 *
1374 * @param out The stream to write to
1375 * @param id The proof rule to write to the stream
1376 * @return The stream
1377 */
1378 std::ostream& operator<<(std::ostream& out, PfRule id);
1379
1380 /** Hash function for proof rules */
1381 struct PfRuleHashFunction
1382 {
1383 size_t operator()(PfRule id) const;
1384 }; /* struct PfRuleHashFunction */
1385
1386 } // namespace cvc5
1387
1388 #endif /* CVC5__EXPR__PROOF_RULE_H */