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