1 /******************************************************************************
2 * Top contributors (to current version):
3 * Andrew Reynolds, Gereon Kremer, Andres Noetzli
5 * This file is part of the cvc5 project.
7 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8 * in the top-level source directory and their institutional affiliations.
9 * All rights reserved. See the file COPYING in the top-level source
10 * directory for licensing information.
11 * ****************************************************************************
13 * Inference enumeration.
16 #include "cvc5_private.h"
18 #ifndef CVC5__THEORY__INFERENCE_ID_H
19 #define CVC5__THEORY__INFERENCE_ID_H
26 /** Types of inferences used in the procedure
28 * Note: The order in this enum matters in certain cases (e.g. inferences
29 * related to normal forms in strings), where inferences that come first are
30 * generally preferred.
32 * Notice that an inference is intentionally distinct from PfRule. An
33 * inference captures *why* we performed a reasoning step, and a PfRule
34 * rule captures *what* reasoning step was used. For instance, the inference
35 * LEN_SPLIT translates to PfRule::SPLIT. The use of stats on inferences allows
36 * us to know that we performed N splits (PfRule::SPLIT) because we wanted
37 * to split on lengths for string equalities (Inference::LEN_SPLIT).
39 enum class InferenceId
41 // ---------------------------------- core
42 // a conflict when two constants merge in the equality engine (of any theory)
44 // ---------------------------------- arith theory
45 //-------------------- linear core
46 // black box conflicts. It's magic.
48 // conflicting equality
50 // conflicting lower bound
52 // conflict due to trichotomy
53 ARITH_CONF_TRICHOTOMY
,
54 // conflicting upper bound
56 // conflict from simplex
58 // conflict from sum-of-infeasibility simplex
59 ARITH_CONF_SOI_SIMPLEX
,
60 // introduces split on a disequality
62 // tighten integer inequalities to ceiling
64 // tighten integer inequalities to floor
69 ARITH_DIO_DECOMPOSITION
,
70 // unate lemma during presolve
74 // a split that occurs when the non-linear solver changes values of arithmetic
75 // variables in a model, but those variables are inconsistent with assignments
76 // from another theory
77 ARITH_SPLIT_FOR_NL_MODEL
,
78 //-------------------- preprocessing
79 // equivalence of term and its preprocessed form
80 ARITH_PP_ELIM_OPERATORS
,
81 // a lemma from arithmetic preprocessing
82 ARITH_PP_ELIM_OPERATORS_LEMMA
,
83 //-------------------- nonlinear core
84 // simple congruence x=y => f(x)=f(y)
86 // shared term value split (for naive theory combination)
87 ARITH_NL_SHARED_TERM_VALUE_SPLIT
,
88 // checkModel found a conflict with a quadratic equality
89 ARITH_NL_CM_QUADRATIC_EQ
,
90 //-------------------- nonlinear incremental linearization solver
91 // splitting on zero (NlSolver::checkSplitZero)
93 // based on sign (NlSolver::checkMonomialSign)
95 // based on comparing (abs) model values (NlSolver::checkMonomialMagnitude)
97 // based on inferring bounds (NlSolver::checkMonomialInferBounds)
98 ARITH_NL_INFER_BOUNDS
,
99 // same as above, for inferences that introduce new terms
100 ARITH_NL_INFER_BOUNDS_NT
,
101 // factoring (NlSolver::checkFactoring)
103 // resolution bound inferences (NlSolver::checkMonomialInferResBounds)
104 ARITH_NL_RES_INFER_BOUNDS
,
105 // tangent planes (NlSolver::checkTangentPlanes)
106 ARITH_NL_TANGENT_PLANE
,
107 //-------------------- nonlinear transcendental solver
108 // purification of arguments to transcendental functions
109 ARITH_NL_T_PURIFY_ARG
,
110 // initial refinement (TranscendentalSolver::checkTranscendentalInitialRefine)
111 ARITH_NL_T_INIT_REFINE
,
114 // monotonicity (TranscendentalSolver::checkTranscendentalMonotonic)
115 ARITH_NL_T_MONOTONICITY
,
116 // tangent refinement (TranscendentalSolver::checkTranscendentalTangentPlanes)
118 // secant refinement, the dual of the above inference
120 //-------------------- nonlinear iand solver
121 // initial refinements (IAndSolver::checkInitialRefine)
122 ARITH_NL_IAND_INIT_REFINE
,
123 // value refinements (IAndSolver::checkFullRefine)
124 ARITH_NL_IAND_VALUE_REFINE
,
125 // sum refinements (IAndSolver::checkFullRefine)
126 ARITH_NL_IAND_SUM_REFINE
,
127 // bitwise refinements (IAndSolver::checkFullRefine)
128 ARITH_NL_IAND_BITWISE_REFINE
,
129 //-------------------- nonlinear pow2 solver
130 // initial refinements (Pow2Solver::checkInitialRefine)
131 ARITH_NL_POW2_INIT_REFINE
,
132 // value refinements (Pow2Solver::checkFullRefine)
133 ARITH_NL_POW2_VALUE_REFINE
,
134 //-------------------- nonlinear cad solver
135 // conflict / infeasible subset obtained from cad
136 ARITH_NL_CAD_CONFLICT
,
137 // excludes an interval for a single variable
138 ARITH_NL_CAD_EXCLUDED_INTERVAL
,
139 //-------------------- nonlinear icp solver
140 // conflict obtained from icp
141 ARITH_NL_ICP_CONFLICT
,
142 // propagation / contraction of variable bounds from icp
143 ARITH_NL_ICP_PROPAGATION
,
144 // ---------------------------------- end arith theory
146 // ---------------------------------- arrays theory
148 ARRAYS_READ_OVER_WRITE
,
149 ARRAYS_READ_OVER_WRITE_1
,
150 ARRAYS_READ_OVER_WRITE_CONTRA
,
151 // ---------------------------------- end arrays theory
153 // ---------------------------------- bags theory
154 BAG_NON_NEGATIVE_COUNT
,
155 BAG_MK_BAG_SAME_ELEMENT
,
162 BAG_INTERSECTION_MIN
,
163 BAG_DIFFERENCE_SUBTRACT
,
164 BAG_DIFFERENCE_REMOVE
,
165 BAG_DUPLICATE_REMOVAL
,
166 // ---------------------------------- end bags theory
168 // ---------------------------------- bitvector theory
169 BV_BITBLAST_CONFLICT
,
173 BV_SIMPLE_BITBLAST_LEMMA
,
176 // ---------------------------------- end bitvector theory
178 // ---------------------------------- datatypes theory
179 // (= k t) for fresh k
181 // (= (C t1 ... tn) (C s1 .. sn)) => (= ti si)
183 // ((_ is Ci) t) => (= t (Ci (sel_1 t) ... (sel_n t)))
185 // (or ((_ is C1) t) V ... V ((_ is Cn) t))
187 // (or ((_ is Ci) t) V (not ((_ is Ci) t)))
188 DATATYPES_BINARY_SPLIT
,
189 // (not ((_ is C1) t)) ^ ... [j] ... ^ (not ((_ is Cn) t)) => ((_ is Cj) t)
191 // (= t (Ci t1 ... tn)) => (= (sel_j t) rewrite((sel_j (Ci t1 ... tn))))
192 DATATYPES_COLLAPSE_SEL
,
193 // (= (Ci t1...tn) (Cj t1...tn)) => false
194 DATATYPES_CLASH_CONFLICT
,
195 // ((_ is Ci) t) ^ (= t (Cj t1 ... tn)) => false
196 DATATYPES_TESTER_CONFLICT
,
197 // ((_ is Ci) t) ^ ((_ is Cj) s) ^ (= t s) => false
198 DATATYPES_TESTER_MERGE_CONFLICT
,
199 // bisimilarity for codatatypes
201 // corecursive singleton equality
202 DATATYPES_REC_SINGLETON_EQ
,
203 // corecursive singleton equality (not (= k1 k2)) for fresh k1, k2
204 DATATYPES_REC_SINGLETON_FORCE_DEQ
,
205 // cycle conflict for datatypes
207 //-------------------- datatypes size/height
208 // (>= (dt.size t) 0)
210 // (=> (= (dt.height t) 0) => (and (= (dt.height (sel_1 t)) 0) .... ))
211 DATATYPES_HEIGHT_ZERO
,
212 //-------------------- sygus extension
213 // a sygus symmetry breaking lemma (or ~is-C1( t1 ) V ... V ~is-Cn( tn ) )
214 // where t1 ... tn are unique shared selector chains. For details see
215 // Reynolds et al CAV 2019
216 DATATYPES_SYGUS_SYM_BREAK
,
217 // a conjecture-dependent symmetry breaking lemma, which may be used to
218 // exclude constructors for variables that irrelevant for a synthesis
220 DATATYPES_SYGUS_CDEP_SYM_BREAK
,
221 // an enumerator-specific symmetry breaking lemma, which are used e.g. for
222 // excluding certain kinds of constructors
223 DATATYPES_SYGUS_ENUM_SYM_BREAK
,
224 // a simple static symmetry breaking lemma (see Reynolds et al CAV 2019)
225 DATATYPES_SYGUS_SIMPLE_SYM_BREAK
,
226 // (dt.size t) <= N, to implement fair enumeration when sygus-fair=dt-size
227 DATATYPES_SYGUS_FAIR_SIZE
,
228 // (dt.size t) <= N => (or ~is-C1( t1 ) V ... V ~is-Cn( tn ) ) if using
230 DATATYPES_SYGUS_FAIR_SIZE_CONFLICT
,
231 // used for implementing variable agnostic enumeration
232 DATATYPES_SYGUS_VAR_AGNOSTIC
,
233 // handles case the model value for a sygus term violates the size bound
234 DATATYPES_SYGUS_SIZE_CORRECTION
,
235 // handles case the model value for a sygus term does not exist
236 DATATYPES_SYGUS_VALUE_CORRECTION
,
237 // s <= (dt.size t), where s is a term that must be less than the current
238 // size bound based on our fairness strategy. For instance, s may be
239 // (dt.size e) for (each) enumerator e when multiple enumerators are present.
240 DATATYPES_SYGUS_MT_BOUND
,
242 DATATYPES_SYGUS_MT_POS
,
243 // ---------------------------------- end datatypes theory
245 //-------------------------------------- floating point theory
246 // a lemma sent during TheoryFp::ppRewrite
248 // a lemma sent during TheoryFp::convertAndEquateTerm
250 // a lemma sent during TheoryFp::registerTerm
252 //-------------------------------------- end floating point theory
254 //-------------------------------------- quantifiers theory
255 //-------------------- types of instantiations.
256 // Notice the identifiers in this section cover all the techniques used for
257 // quantifier instantiation. The subcategories below are for specific lemmas
258 // that are not instantiation lemmas added, per technique.
259 // instantiation from E-matching
260 QUANTIFIERS_INST_E_MATCHING
,
261 // E-matching using simple trigger implementation
262 QUANTIFIERS_INST_E_MATCHING_SIMPLE
,
263 // E-matching using multi-triggers
264 QUANTIFIERS_INST_E_MATCHING_MT
,
265 // E-matching using linear implementation of multi-triggers
266 QUANTIFIERS_INST_E_MATCHING_MTL
,
267 // instantiation due to higher-order matching on top of e-matching
268 QUANTIFIERS_INST_E_MATCHING_HO
,
269 // E-matching based on variable triggers
270 QUANTIFIERS_INST_E_MATCHING_VAR_GEN
,
271 // conflicting instantiation from conflict-based instantiation
272 QUANTIFIERS_INST_CBQI_CONFLICT
,
273 // propagating instantiation from conflict-based instantiation
274 QUANTIFIERS_INST_CBQI_PROP
,
275 // instantiation from naive exhaustive instantiation in finite model finding
276 QUANTIFIERS_INST_FMF_EXH
,
277 // instantiation from finite model finding based on its model-based algorithm
278 QUANTIFIERS_INST_FMF_FMC
,
279 // instantiation from running exhaustive instantiation on a subdomain of
280 // the quantified formula in finite model finding based on its model-based
282 QUANTIFIERS_INST_FMF_FMC_EXH
,
283 // instantiations from counterexample-guided instantiation
284 QUANTIFIERS_INST_CEGQI
,
285 // instantiations from syntax-guided instantiation
286 QUANTIFIERS_INST_SYQI
,
287 // instantiations from enumerative instantiation
288 QUANTIFIERS_INST_ENUM
,
289 // instantiations from pool instantiation
290 QUANTIFIERS_INST_POOL
,
291 //-------------------- bounded integers
292 // a proxy lemma from bounded integers, used to control bounds on ground terms
293 QUANTIFIERS_BINT_PROXY
,
294 // a proxy lemma to minimize an instantiation of non-ground terms
295 QUANTIFIERS_BINT_MIN_NG
,
296 //-------------------- counterexample-guided instantiation
297 // a counterexample lemma
298 QUANTIFIERS_CEGQI_CEX
,
299 // an auxiliary lemma from counterexample lemma
300 QUANTIFIERS_CEGQI_CEX_AUX
,
301 // a reduction lemma for nested quantifier elimination
302 QUANTIFIERS_CEGQI_NESTED_QE
,
303 // G2 => G1 where G2 is a counterexample literal for a nested quantifier whose
304 // counterexample literal is G1.
305 QUANTIFIERS_CEGQI_CEX_DEP
,
307 QUANTIFIERS_CEGQI_VTS_LB_DELTA
,
308 // delta < c, for positive c
309 QUANTIFIERS_CEGQI_VTS_UB_DELTA
,
311 QUANTIFIERS_CEGQI_VTS_LB_INF
,
312 //-------------------- syntax-guided instantiation
313 // a counterexample lemma
314 QUANTIFIERS_SYQI_CEX
,
315 // evaluation unfolding for syntax-guided instantiation
316 QUANTIFIERS_SYQI_EVAL_UNFOLD
,
317 //-------------------- sygus solver
318 // preprocessing a sygus conjecture based on quantifier elimination, of the
319 // form Q <=> Q_preprocessed
320 QUANTIFIERS_SYGUS_QE_PREPROC
,
321 // G or ~G where G is the active guard for a sygus enumerator
322 QUANTIFIERS_SYGUS_ENUM_ACTIVE_GUARD_SPLIT
,
323 // manual exclusion of a current solution
324 QUANTIFIERS_SYGUS_EXCLUDE_CURRENT
,
325 // manual exclusion of a current solution for sygus-stream
326 QUANTIFIERS_SYGUS_STREAM_EXCLUDE_CURRENT
,
327 // ~Q where Q is a PBE conjecture with conflicting examples
328 QUANTIFIERS_SYGUS_EXAMPLE_INFER_CONTRA
,
329 //-------------------- dynamic splitting
330 // a dynamic split from quantifiers
332 //-------------------- miscellaneous
334 QUANTIFIERS_SKOLEMIZE
,
335 // Q1 <=> Q2, where Q1 and Q2 are alpha equivalent
336 QUANTIFIERS_REDUCE_ALPHA_EQ
,
337 // a higher-order match predicate lemma
338 QUANTIFIERS_HO_MATCH_PRED
,
339 // reduction of quantifiers that don't have triggers that cover all variables
340 QUANTIFIERS_PARTIAL_TRIGGER_REDUCE
,
341 //-------------------------------------- end quantifiers theory
343 // ---------------------------------- sep theory
344 // ensures that pto is a function: (pto x y) ^ ~(pto z w) ^ x = z => y != w
346 // enforces injectiveness of pto: (pto x y) ^ (pto y w) ^ x = y => y = w
348 // introduces a label for a heap, of the form U => L, where U is an
349 // unlabelled separation logic predicate and L is its labelled form
351 // introduces the set constraints for a label
355 // positive reduction for sep constraint
357 // negative reduction for sep constraint
359 // model-based refinement for negated star/wand
361 // sep.nil is not in the heap
363 // a symmetry breaking lemma
365 // finite witness data lemma
366 SEP_WITNESS_FINITE_DATA
,
367 // element distinctness lemma
369 // reference bound lemma
371 // ---------------------------------- end sep theory
373 // ---------------------------------- sets theory
374 //-------------------- sets core solver
379 SETS_EQ_MEM_CONFLICT
,
381 SETS_MEM_EQ_CONFLICT
,
383 SETS_PROXY_SINGLETON
,
389 //-------------------- sets cardinality solver
391 SETS_CARD_SPLIT_EMPTY
,
392 // cycle of cardinalities, hence all sets have the same
394 // two sets have the same cardinality
397 SETS_CARD_GRAPH_EMP_PARENT
,
398 SETS_CARD_GRAPH_EQ_PARENT
,
399 SETS_CARD_GRAPH_EQ_PARENT_2
,
400 SETS_CARD_GRAPH_PARENT_SINGLETON
,
401 // cardinality is at least the number of elements we already know
403 // negative members are part of the universe
404 SETS_CARD_NEGATIVE_MEMBER
,
405 // all sets have non-negative cardinality
407 // the universe is a superset of every set
408 SETS_CARD_UNIV_SUPERSET
,
409 // cardinality of the universe is at most cardinality of the type
411 //-------------------- sets relations solver
412 SETS_RELS_IDENTITY_DOWN
,
413 SETS_RELS_IDENTITY_UP
,
414 SETS_RELS_JOIN_COMPOSE
,
415 SETS_RELS_JOIN_IMAGE_DOWN
,
416 SETS_RELS_JOIN_SPLIT_1
,
417 SETS_RELS_JOIN_SPLIT_2
,
418 SETS_RELS_PRODUCE_COMPOSE
,
419 SETS_RELS_PRODUCT_SPLIT
,
420 SETS_RELS_TCLOSURE_FWD
,
421 SETS_RELS_TCLOSURE_UP
,
422 SETS_RELS_TRANSPOSE_EQ
,
423 SETS_RELS_TRANSPOSE_REV
,
424 SETS_RELS_TUPLE_REDUCTION
,
425 //-------------------------------------- end sets theory
427 //-------------------------------------- strings theory
428 //-------------------- base solver
429 // initial normalize singular
430 // x1 = "" ^ ... ^ x_{i-1} = "" ^ x_{i+1} = "" ^ ... ^ xn = "" =>
431 // x1 ++ ... ++ xn = xi
433 // initial constant merge
434 // explain_constant(x, c) => x = c
435 // Above, explain_constant(x,c) is a basic explanation of why x must be equal
436 // to string constant c, which is computed by taking arguments of
437 // concatenation terms that are entailed to be constants. For example:
438 // ( y = "AB" ^ z = "C" ) => y ++ z = "ABC"
439 STRINGS_I_CONST_MERGE
,
440 // initial constant conflict
441 // ( explain_constant(x, c1) ^ explain_constant(x, c2) ^ x = y) => false
443 STRINGS_I_CONST_CONFLICT
,
445 // Given two concatenation terms, this is applied when we find that they are
446 // equal after e.g. removing strings that are currently empty. For example:
447 // y = "" ^ z = "" => x ++ y = z ++ x
449 // injectivity of seq.unit
450 // (seq.unit x) = (seq.unit y) => x=y, or
451 // (seq.unit x) = (seq.unit c) => x=c
453 // unit constant conflict
454 // (seq.unit x) = C => false if |C| != 1.
455 STRINGS_UNIT_CONST_CONFLICT
,
456 // injectivity of seq.unit for disequality
457 // (seq.unit x) != (seq.unit y) => x != y, or
458 // (seq.unit x) != (seq.unit c) => x != c
459 STRINGS_UNIT_INJ_DEQ
,
460 // A split due to cardinality
462 // The cardinality inference for strings, see Liang et al CAV 2014.
464 //-------------------- core solver
465 // A cycle in the empty string equivalence class, e.g.:
466 // x ++ y = "" => x = ""
467 // This is typically not applied due to length constraints implying emptiness.
469 // A cycle in the containment ordering.
470 // x = y ++ x => y = "" or
471 // x = y ++ z ^ y = x ++ w => z = "" ^ w = ""
472 // This is typically not applied due to length constraints implying emptiness.
474 // Flat form constant
475 // x = y ^ x = z ++ c ... ^ y = z ++ d => false
476 // where c and d are distinct constants.
479 // x = y ^ x = z ++ x' ... ^ y = z ++ y' ^ len(x') = len(y') => x' = y'
480 // Notice flat form instances are similar to normal form inferences but do
481 // not involve recursive explanations.
483 // Flat form endpoint empty
484 // x = y ^ x = z ^ y = z ++ y' => y' = ""
485 STRINGS_F_ENDPOINT_EMP
,
486 // Flat form endpoint equal
487 // x = y ^ x = z ++ x' ^ y = z ++ y' => x' = y'
488 STRINGS_F_ENDPOINT_EQ
,
489 // Flat form not contained
490 // x = c ^ x = y => false when rewrite( contains( y, c ) ) = false
492 // Normal form equality conflict
493 // x = N[x] ^ y = N[y] ^ x=y => false
494 // where Rewriter::rewrite(N[x]=N[y]) = false.
496 // Given two normal forms, infers that the remainder one of them has to be
497 // empty. For example:
498 // If x1 ++ x2 = y1 and x1 = y1, then x2 = ""
499 STRINGS_N_ENDPOINT_EMP
,
500 // Given two normal forms, infers that two components have to be the same if
501 // they have the same length. For example:
502 // If x1 ++ x2 = x3 ++ x4 and len(x1) = len(x3) then x1 = x3
504 // Given two normal forms, infers that the endpoints have to be the same. For
506 // If x1 ++ x2 = x3 ++ x4 ++ x5 and x1 = x3 then x2 = x4 ++ x5
507 STRINGS_N_ENDPOINT_EQ
,
508 // Given two normal forms with constant endpoints, infers a conflict if the
509 // endpoints do not agree. For example:
510 // If "abc" ++ ... = "bc" ++ ... then conflict
512 // infer empty, for example:
514 // This is inferred when we encounter an x such that x = "" rewrites to a
515 // constant. This inference is used for instance when we otherwise would have
516 // split on the emptiness of x but the rewriter tells us the emptiness of x
519 // string split constant propagation, for example:
520 // x = y, x = "abc", y = y1 ++ "b" ++ y2
521 // implies y1 = "a" ++ y1'
522 STRINGS_SSPLIT_CST_PROP
,
523 // string split variable propagation, for example:
524 // x = y, x = x1 ++ x2, y = y1 ++ y2, len( x1 ) >= len( y1 )
525 // implies x1 = y1 ++ x1'
526 // This is inspired by Zheng et al CAV 2015.
527 STRINGS_SSPLIT_VAR_PROP
,
528 // length split, for example:
529 // len( x1 ) = len( y1 ) V len( x1 ) != len( y1 )
530 // This is inferred when e.g. x = y, x = x1 ++ x2, y = y1 ++ y2.
532 // length split empty, for example:
534 // This is inferred when, e.g. x = y, x = z ++ x1, y = y1 ++ z
535 STRINGS_LEN_SPLIT_EMP
,
536 // string split constant
537 // x = y, x = "c" ++ x2, y = y1 ++ y2, y1 != ""
538 // implies y1 = "c" ++ y1'
539 // This is a special case of F-Split in Figure 5 of Liang et al CAV 2014.
541 // string split variable, for example:
542 // x = y, x = x1 ++ x2, y = y1 ++ y2
543 // implies x1 = y1 ++ x1' V y1 = x1 ++ y1'
544 // This is rule F-Split in Figure 5 of Liang et al CAV 2014.
546 // flat form loop, for example:
547 // x = y, x = x1 ++ z, y = z ++ y2
548 // implies z = u2 ++ u1, u in ( u1 ++ u2 )*, x1 = u2 ++ u, y2 = u ++ u1
549 // for fresh u, u1, u2.
550 // This is the rule F-Loop from Figure 5 of Liang et al CAV 2014.
553 STRINGS_FLOOP_CONFLICT
,
554 // Normal form inference
555 // x = y ^ z = y => x = z
556 // This is applied when y is the normal form of both x and z.
558 // Normal form not contained, same as FFROM_NCTN but for normal forms
560 // Length normalization
561 // x = y => len( x ) = len( y )
562 // Typically applied when y is the normal form of x.
564 // When x ++ x' ++ ... != "abc" ++ y' ++ ... ^ len(x) != len(y), we apply the
567 STRINGS_DEQ_DISL_EMP_SPLIT
,
568 // When x ++ x' ++ ... != "abc" ++ y' ++ ... ^ len(x) = 1, we apply the
570 // x = "a" v x != "a"
571 STRINGS_DEQ_DISL_FIRST_CHAR_EQ_SPLIT
,
572 // When x ++ x' ++ ... != "abc" ++ y' ++ ... ^ len(x) != "", we apply the
574 // ni = x ++ x' ++ ... ^ nj = "abc" ++ y' ++ ... ^ x != "" --->
575 // x = k1 ++ k2 ^ len(k1) = 1 ^ (k1 != "a" v x = "a" ++ k2)
576 STRINGS_DEQ_DISL_FIRST_CHAR_STRING_SPLIT
,
577 // When x ++ x' ++ ... != y ++ y' ++ ... ^ len(x) != len(y), we apply the
579 // ni = x ++ x' ++ ... ^ nj = y ++ y' ++ ... ^ ni != nj ^ len(x) != len(y)
581 // len(k1) = len(x) ^ len(k2) = len(y) ^ (y = k1 ++ k3 v x = k1 ++ k2)
582 STRINGS_DEQ_DISL_STRINGS_SPLIT
,
583 // When x ++ x' ++ ... != y ++ y' ++ ... ^ len(x) = len(y), we apply the
586 STRINGS_DEQ_STRINGS_EQ
,
587 // When x ++ x' ++ ... != y ++ y' ++ ... and we do not know how the lengths
588 // of x and y compare, we apply the inference:
589 // len(x) = len(y) v len(x) != len(y)
591 // When px ++ x ++ ... != py ^ len(px ++ x ++ ...) = len(py), we apply the
592 // following inference that infers that the remainder of the longer normal
593 // form must be empty:
594 // ni = px ++ x ++ ... ^ nj = py ^ len(ni) = len(nj) --->
596 STRINGS_DEQ_NORM_EMP
,
597 // When two strings are disequal s != t and the comparison of their lengths
598 // is unknown, we apply the inference:
599 // len(s) != len(t) V len(s) = len(t)
600 STRINGS_DEQ_LENGTH_SP
,
601 //-------------------- codes solver
602 // str.to_code( v ) = rewrite( str.to_code(c) )
603 // where v is the proxy variable for c.
605 // str.code(x) = -1 V str.code(x) != str.code(y) V x = y
607 //-------------------- regexp solver
608 // regular expression normal form conflict
609 // ( x in R ^ x = y ^ rewrite((str.in_re y R)) = false ) => false
610 // where y is the normal form computed for x.
611 STRINGS_RE_NF_CONFLICT
,
612 // regular expression unfolding
613 // This is a general class of inferences of the form:
615 // where F is formula expressing the next step of checking whether x is in
618 // x = "" V x in R V ( x = x1 ++ x2 ++ x3 ^ x1 in R ^ x2 in (R)* ^ x3 in R)
619 STRINGS_RE_UNFOLD_POS
,
620 // Same as above, for negative memberships
621 STRINGS_RE_UNFOLD_NEG
,
622 // intersection inclusion conflict
623 // (x in R1 ^ ~ x in R2) => false where [[includes(R2,R1)]]
624 // Where includes(R2,R1) is a heuristic check for whether R2 includes R1.
625 STRINGS_RE_INTER_INCLUDE
,
626 // intersection conflict, using regexp intersection computation
627 // (x in R1 ^ x in R2) => false where [[intersect(R1, R2) = empty]]
628 STRINGS_RE_INTER_CONF
,
629 // intersection inference
630 // (x in R1 ^ y in R2 ^ x = y) => (x in re.inter(R1,R2))
631 STRINGS_RE_INTER_INFER
,
632 // regular expression delta
633 // (x = "" ^ x in R) => C
634 // where "" in R holds if and only if C holds.
636 // regular expression delta conflict
637 // (x = "" ^ x in R) => false
638 // where R does not accept the empty string.
639 STRINGS_RE_DELTA_CONF
,
640 // regular expression derive ???
642 //-------------------- extended function solver
643 // Standard extended function inferences from context-dependent rewriting
644 // produced by constant substitutions. See Reynolds et al CAV 2017. These are
645 // inferences of the form:
646 // X = Y => f(X) = t when rewrite( f(Y) ) = t
647 // where X = Y is a vector of equalities, where some of Y may be constants.
649 // Same as above, for normal form substitutions.
651 // Decompositions based on extended function inferences from context-dependent
652 // rewriting produced by constant substitutions. This is like the above, but
653 // handles cases where the inferred predicate is not necessarily an equality
654 // involving f(X). For example:
655 // x = "A" ^ contains( y ++ x, "B" ) => contains( y, "B" )
656 // This is generally only inferred if contains( y, "B" ) is a known term in
657 // the current context.
659 // Same as above, for normal form substitutions.
661 // Extended function equality rewrite. This is an inference of the form:
663 // where P is a predicate implied by rewrite( t = s ).
664 // Typically, t is an application of an extended function and s is a constant.
665 // It is generally only inferred if P is a predicate over known terms.
667 // contain transitive
668 // ( str.contains( s, t ) ^ ~contains( s, r ) ) => ~contains( t, r ).
671 // str.contains( x, str.++( y1, ..., yn ) ) => str.contains( x, yi ) or
672 // ~str.contains( str.++( x1, ..., xn ), y ) => ~str.contains( xi, y )
673 STRINGS_CTN_DECOMPOSE
,
675 // ( len( x ) = len( s ) ^ ~contains( x, s ) ) => x != s
676 STRINGS_CTN_NEG_EQUAL
,
678 // str.contains( x, y ) => x = w1 ++ y ++ w2
679 // where w1 and w2 are skolem variables.
681 // All reduction inferences of the form:
682 // f(x1, .., xn) = y ^ P(x1, ..., xn, y)
683 // where f is an extended function, y is the purification variable for
684 // f(x1, .., xn) and P is the reduction predicate for f
685 // (see theory_strings_preprocess).
687 //-------------------- prefix conflict
688 // prefix conflict (coarse-grained)
689 STRINGS_PREFIX_CONFLICT
,
690 //-------------------- other
691 // a lemma added during term registration for an atomic term
692 STRINGS_REGISTER_TERM_ATOMIC
,
693 // a lemma added during term registration
694 STRINGS_REGISTER_TERM
,
695 // a split during collect model info
697 //-------------------------------------- end strings theory
699 //-------------------------------------- uf theory
700 // Clause from the uf symmetry breaker
702 //-------------------- cardinality extension to UF
703 // The inferences below are described in Reynolds' thesis 2013.
704 // conflict of the form (card_T n) => (not (distinct t1 ... tn))
706 // conflict of the form (not (card_T1 n1)) ^ ... (not (card_Tk nk)) ^ (card n)
707 // where n1 + ... + nk >= n, where (card n) is a combined cardinality
710 // (not (card_T n)) => (distinct t1 ... tn)
711 UF_CARD_ENFORCE_NEGATIVE
,
712 // used to make the index terms in cardinality constraints equal
714 // conflict of the form (not (card_T1 n)) ^ (card_T2 m) where the cardinality
715 // of T2 can be assumed to be without loss of generality larger than T1 due to
716 // monotonicity reasoning (Claessen et al 2011).
717 UF_CARD_MONOTONE_COMBINED
,
718 // conflict of the form (not (card_T n)) ^ (card_T m) where n>m
719 UF_CARD_SIMPLE_CONFLICT
,
720 // equality split requested by cardinality solver
721 // (or (= t1 t2) (not (= t1 t2))
722 // to satisfy the cardinality constraints on the type of t1, t2.
724 //-------------------- end cardinality extension to UF
725 //-------------------- HO extension to UF
726 // Encodes an n-ary application as a chain of binary HO_APPLY applications
727 // (= (f t1 ... tn) (@ (@ ... (@ f t1) ...) tn))
729 // A lemma corresponding to the definition of a skolem k used to convert
730 // HO_APPLY terms to APPLY_UF terms. This is of the form:
731 // (forall x1 ... xn) (@ (@ k x1) ... xn) = t
732 // where notice that t is a function whose free variables (if any) are
734 UF_HO_APP_CONV_SKOLEM
,
735 // Adds an extensionality lemma to witness that disequal functions have
736 // different applications
737 // (not (= (f sk1 .. skn) (g sk1 .. skn))
738 UF_HO_EXTENSIONALITY
,
739 //-------------------- model-construction specific part
740 // These rules are necessary to ensure that we build models properly. For more
741 // details see Section 3.3 of Barbosa et al. CADE'19.
743 // Enforces that a regular APPLY_UF term in the model is equal to its HO_APPLY
744 // equivalent by adding the equality as a lemma
745 // (= (f t1 ... tn) (@ (@ ... (@ f t1) ...) tn))
746 UF_HO_MODEL_APP_ENCODE
,
747 // Adds an extensionality lemma to witness that disequal functions have
748 // different applications
749 // (not (= (f sk1 .. skn) (g sk1 .. skn))
750 UF_HO_MODEL_EXTENSIONALITY
,
751 //-------------------- end model-construction specific part
752 //-------------------- end HO extension to UF
753 //-------------------------------------- end uf theory
755 //-------------------------------------- unknown
760 * Converts an inference to a string. Note: This function is also used in
761 * `safe_print()`. Changing this functions name or signature will result in
762 * `safe_print()` printing "<unsupported>" instead of the proper strings for
765 * @param i The inference
766 * @return The name of the inference
768 const char* toString(InferenceId i
);
771 * Writes an inference name to a stream.
773 * @param out The stream to write to
774 * @param i The inference to write to the stream
777 std::ostream
& operator<<(std::ostream
& out
, InferenceId i
);
779 } // namespace theory
782 #endif /* CVC5__THEORY__INFERENCE_H */