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