127bb8161355c24b31d716b9e3ff57c599617190
1 /******************************************************************************
2 * Top contributors (to current version):
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 * Enumeration of Alethe proof rules
16 #include "cvc5_private.h"
18 #ifndef CVC4__PROOF__ALETHE_PROOF_RULE_H
19 #define CVC4__PROOF__ALETHE_PROOF_RULE_H
27 enum class AletheRule
: uint32_t
29 // This enumeration lists all Alethe proof rules. For each rule a list of
30 // steps is given. The last step is the conclusion obtained by applying the
31 // rule in question. There might be zero or more steps occuring before the
32 // conclusion in the proof. A step has the form:
35 // where G is a context, i is an id and F is a formula. A context may include
36 // substitutions x->y and fixed variables x. For more details see
37 // https://verit.loria.fr/documentation/alethe-spec.pdf
39 //================================================= Special Rules: Commands
40 // These rules should be printed as commands
48 // ---------------------------------
49 // > k. (cl (not F1) ... (not Fn) F)
51 // Each subproof in Alethe begins with an anchor command. The outermost
52 // application of ANCHOR_SUBPROOF will not be printed.
55 // G,y1,...,yn,x1->y1,...,xn->yn > j. (= F1 F2)
56 // ------------------------------------------------------
57 // G > k. (= (forall (x1 ... xn) F1) (forall (y1 ... yn) F2))
59 // where y1,...,yn are not free in (forall (x1,...,xn) F2)
64 //================================================= Rules of the Alethe
74 // > i. (cl (not(not(not F))) F)
77 // > i. (cl (not(and F1 ... Fn)) Fi)
81 // > i. (cl (and F1 ... Fn) (not F1) ... (not Fn))
84 // > i. (cl (not (or F1 ... Fn)) (not F1) ... (not Fn))
87 // > i. (cl (or F1 ... Fn) (not Fi))
91 // > i. (cl (not (xor F1 F2)) F1 F2)
94 // > i. (cl (not (xor F1 F2)) (not F1) (not F2))
97 // > i. (cl (xor F1 F2) F1 (not F2))
100 // > i. (cl (xor F1 F2) (not F1) F2)
102 // ======== implies_pos
103 // > i. (cl (not (implies F1 F2)) (not F1) F2)
105 // ======== implies_neg1
106 // > i. (cl (implies F1 F2) F1)
108 // ======== implies_neg2
109 // > i. (cl (implies F1 F2) (not F2))
111 // ======== equiv_pos1
112 // > i. (cl (not (= F1 F2)) F1 (not F2))
114 // ======== equiv_pos2
115 // > i. (cl (not (= F1 F2)) (not F1) F2)
117 // ======== equiv_neg1
118 // > i. (cl (= F1 F2) (not F1) (not F2))
120 // ======== equiv_neg2
121 // > i. (cl (= F1 F2) F1 F2)
124 // > i. (cl (not (ite F1 F2 F3)) F1 F3)
127 // > i. (cl (not (ite F1 F2 F3)) (not F1) F2)
130 // > i. (cl (ite F1 F2 F3) F1 (not F3))
133 // > i. (cl (ite F1 F2 F3) (not F1) (not F2))
135 // ======== eq_reflexive
138 // ======== eq_transitive
139 // > i. (cl (not (= F1 F2)) ... (not (= F_{n-1} Fn)) (= F1 Fn))
141 // ======== eq_congruent
142 // > i. (cl (not (= F1 G1)) ... (not (= Fn Gn)) (= f(F1,...,Fn)
145 // ======== eq_congruent_pred
146 // > i. (cl (not (= F1 G1)) ... (not (= Fn Gn)) (= P(F1,...,Fn)
149 // ======== distinct_elim
150 // If called with one argument:
151 // > i. (= (distinct F) true)
152 // If applied to terms of type Bool more than two terms can never be distinct.
153 // Two cases can be possible:
154 // > i. (= (distinct F G) (not (= F G)))
156 // > i. (= (distinct F1 F2 F3 ...) false)
158 // > i. (= (distinct F1 ... Fn) (AND^n_i=1 (AND^n_j=i+1 (!= Fi Fj))))
161 // > i. (= (= F G) (and (<= F G) (<= G F)))
163 // Tautology of linear disequalities.
164 // > i. (cl F1 ... Fn)
166 // Tautology of linear integer arithmetic
167 // > i. (cl F1 ... Fn)
169 // ======== la_disequality
170 // > i. (= (= F G) (not (<= F G)) (not (<= G F)))
172 // ======== la_totality
173 // > i. (or (<= t1 t2) (<= t2 t1))
175 // ======== la_tautology
176 // Tautology of linear arithmetic that can be checked without sophisticated
179 // ======== forall_inst
180 // > i. (or (not (forall (x1 ... xn) P)) P[t1/x1]...[tn/xn])
181 // args = ((:= x_k1 tk1) ... (:= xkn tkn))
182 // where k1,...,kn is a permutation of 1,...,n and xi and ki have the same
186 // G > i. (= (Q (x1 ... xn) (Q (xn+1 ... xm) F)) (Q (xk1 ... xko) F))
187 // where m>n, Q in {forall,exist}, k1...ko is a monotonic map 1,...,m s.t.
188 // xk1,...,xko are pairwise distinct and {x1,...,xm} = {xk1,...,xko}.
190 // ======== qnt_tm_unused
191 // G > i. (= (Q (x1 ... xn) F) (Q (xk1 ... xkm) F))
192 // where m <= n, Q in {forall,exists}, k1,...,km is monotonic map to 1,...,n
193 // and if x in {xj | j in {1,...,n} and j not in {k1,...,km}} then x is not
196 // ======== th_resolution
197 // > i1. (cl F^1_1 ... F^1_k1)
199 // > in. (cl F^n_1 ... F^n_kn)
201 // > i1,...,in. (cl F^r1_s1 ... F^rm_sm)
202 // where (cl F^r1_s1 ... F^rm_sm) are from F^i_j and are the result of a chain
203 // of predicate resolution steps on the clauses i1 to in. This rule is used
204 // when the resolution step is not emitted by the SAT solver.
206 // ======== resolution
207 // This rule is equivalent to the th_resolution rule but is emitted by the SAT
225 // G > j. (= (f F1 ... Fn) (f G1 ... Gn))
226 // where f is an n-ary function symbol.
229 // > i. (and F1 ... Fn)
233 // ======== tautologic_clause
234 // > i. (cl F1 ... Fi ... Fj ... Fn)
240 // > i. (not (or F1 ... Fn))
245 // > i. (or F1 ... Fn)
247 // > j. (cl F1 ... Fn)
250 // > i. (not (and F1 ... Fn))
252 // > j. (cl (not F1) ... (not Fn))
262 // > j. (cl (not F1) (not F2))
265 // > i. (not (xor F1 F2))
267 // > j. (cl F1 (not F2))
270 // > i. (not (xor F1 F2))
272 // > j. (cl (not F1) F2)
277 // > j. (cl (not F1) F2)
279 // ======== not_implies1
280 // > i. (not (=> F1 F2))
284 // ======== not_implies2
285 // > i. (not (=> F1 F2))
292 // > j. (cl (not F1) F2)
297 // > j. (cl F1 (not F2))
299 // ======== not_equiv1
300 // > i. (not (= F1 F2))
304 // ======== not_equiv2
305 // > i. (not (= F1 F2))
307 // > j. (cl (not F1) (not F2))
310 // > i. (ite F1 F2 F3)
315 // > i. (ite F1 F2 F3)
317 // > j. (cl (not F1) F2)
320 // > i. (not (ite F1 F2 F3))
322 // > j. (cl F1 (not F3))
325 // > i. (not (ite F1 F2 F3))
327 // > j. (cl (not F1) (not F3))
329 // ======== ite_intro
330 // > i. (= F (and F F1 ... Fn))
331 // where F contains the ite operator. Let G1,...,Gn be the terms starting with
332 // ite, i.e. Gi := (ite Fi Hi Hi'), then Fi = (ite Fi (= Gi Hi) (= Gi Hi')) if
333 // Hi is of sort Bool
335 // ======== duplicated_literals
336 // > i. (cl F1 ... Fn)
338 // > j. (cl Fk1 ... Fkm)
339 // where m <= n and k1,...,km is a monotonic map to 1,...,n such that Fk1 ...
340 // Fkm are pairwise distinct and {F1,...,Fn} = {Fk1 ... Fkm}
342 // ======== connective_def
343 // G > i. (= (xor F1 F2) (or (and (not F1) F2) (and F1 (not F2))))
345 // G > i. (= (= F1 F2) (and (=> F1 F2) (=> F2 F1)))
347 // G > i. (= (ite F1 F2 F3) (and (=> F1 F2) (=> (not F1) (not F3))))
349 // ======== Simplify rules
350 // The following rules are simplifying rules introduced as tautologies that can be
351 // verified by a number of simple transformations
363 UNARY_MINUS_SIMPLIFY
,
370 // G,x1->F1,...,xn->Fn > j. (= G G')
371 // ---------------------------------
372 // G > k. (= (let (x1 := F1,...,xn := Fn.G) G')
375 // G,x1->(e x1.F),...,xn->(e xn.F) > j. (= F G)
376 // --------------------------------------------
377 // G > k. (exists (x1 ... xn) (= F G))
379 // ======== sko_forall
380 // G,x1->(e x1.(not F)),...,xn->(e xn.(not F)) > j. (= F G)
381 // --------------------------------------------------------
382 // G > k. (forall (x1 ... xn) (= F G))
390 // > i. (not (= F G))
392 // > j. (not (= G F))
398 // where set representation of F1 and F2 are the same and the number of
399 // literals in C2 is the same of that of C1.
401 // ======== undefined
402 // Used in case that a step in the proof rule could not be translated.
407 * Converts an Alethe proof rule to a string.
409 * @param id The Alethe proof rule
410 * @return The name of the Alethe proof rule
412 const char* aletheRuleToString(AletheRule id
);
415 * Writes an Alethe proof rule name to a stream.
417 * @param out The stream to write to
418 * @param id The Alethe proof rule to write to the stream
421 std::ostream
& operator<<(std::ostream
& out
, AletheRule id
);
427 #endif /* CVC4__PROOF__ALETHE_PROOF_RULE_H */