Debian Codegraph @

src/theory/booleans/rewrites

raw
1 (define-rule bool-double-not-elim ((t Bool)) (not (not t)) t)
2 (define-cond-rule bool-not-true ((t Bool))
3 (= t false) (not t) true)
4 (define-cond-rule bool-not-false ((t Bool))
5 (= t true) (not t) false)
6
7 (define-rule bool-eq-true ((t Bool)) (= t true) t)
8 (define-rule bool-eq-false ((t Bool)) (= t false) (not t))
9 (define-rule bool-eq-nrefl ((x Bool)) (= x (not x)) false)
10
11 (define-rule bool-impl-false1 ((t Bool)) (=> t false) (not t))
12 (define-rule bool-impl-false2 ((t Bool)) (=> false t) true)
13 (define-rule bool-impl-true1 ((t Bool)) (=> t true) true)
14 (define-rule bool-impl-true2 ((t Bool)) (=> true t) t)
15 (define-rule bool-impl-elim ((t Bool) (s Bool)) (=> t s) (or (not t) s))
16
17 ; used in proof elaboration
18 (define-rule bool-dual-impl-eq ((t Bool) (s Bool)) (and (=> t s) (=> s t)) (= t s))
19
20 (define-rule bool-and-conf ((xs Bool :list) (w Bool) (ys Bool :list) (zs Bool :list)) (and xs w ys (not w) zs) false)
21 (define-rule bool-and-conf2 ((xs Bool :list) (w Bool) (ys Bool :list) (zs Bool :list)) (and xs (not w) ys w zs) false)
22 (define-rule bool-or-taut ((xs Bool :list) (w Bool) (ys Bool :list) (zs Bool :list)) (or xs w ys (not w) zs) true)
23 (define-rule bool-or-taut2 ((xs Bool :list) (w Bool) (ys Bool :list) (zs Bool :list)) (or xs (not w) ys w zs) true)
24
25 (define-rule* bool-or-de-morgan ((x Bool) (y Bool) (zs Bool :list))
26 (not (or x y zs))
27 (not (or y zs))
28 (and (not x) _))
29 (define-rule bool-implies-de-morgan ((x Bool) (y Bool))
30 (not (=> x y))
31 (and x (not y)))
32 (define-rule* bool-and-de-morgan ((x Bool) (y Bool) (zs Bool :list))
33 (not (and x y zs))
34 (not (and y zs))
35 (or (not x) _))
36
37 ; We only permit distributing from the first child, or otherwise this rule
38 ; could apply to fix point on all AND children of an OR at once.
39 (define-rule* bool-or-and-distrib ((y1 Bool) (y2 Bool) (ys Bool :list) (z1 Bool) (zs Bool :list))
40 (or (and y1 y2 ys) z1 zs)
41 (or (and y2 ys) z1 zs)
42 (and (or y1 z1 zs) _))
43
44 ; Used for diamonds preprocessing
45 (define-rule* bool-implies-or-distrib ((y1 Bool) (y2 Bool) (ys Bool :list) (z Bool))
46 (=> (or y1 y2 ys) z)
47 (=> (or y2 ys) z)
48 (and (=> y1 z) _))
49
50 (define-rule bool-xor-refl ((x Bool)) (xor x x) false)
51 (define-rule bool-xor-nrefl ((x Bool)) (xor x (not x)) true)
52 (define-rule bool-xor-false ((x Bool)) (xor x false) x)
53 (define-rule bool-xor-true ((x Bool)) (xor x true) (not x))
54 (define-rule bool-xor-comm ((x Bool) (y Bool)) (xor x y) (xor y x))
55 (define-rule bool-xor-elim ((x Bool) (y Bool)) (xor x y) (= (not x) y))
56 (define-rule bool-not-xor-elim ((x Bool) (y Bool)) (not (xor x y)) (= x y))
57
58 (define-rule bool-not-eq-elim1 ((x Bool) (y Bool)) (not (= x y)) (= (not x) y))
59 (define-rule bool-not-eq-elim2 ((x Bool) (y Bool)) (not (= x y)) (= x (not y)))
60
61 (define-cond-rule ite-neg-branch ((c Bool) (x Bool) (y Bool)) (= (not y) x) (ite c x y) (= c x))
62
63 (define-rule ite-then-true ((c Bool) (x Bool)) (ite c true x) (or c x))
64 (define-rule ite-else-false ((c Bool) (x Bool)) (ite c x false) (and c x))
65 (define-rule ite-then-false ((c Bool) (x Bool)) (ite c false x) (and (not c) x))
66 (define-rule ite-else-true ((c Bool) (x Bool)) (ite c x true) (or (not c) x))
67
68 (define-rule ite-then-lookahead-self ((c Bool) (x Bool)) (ite c c x) (ite c true x))
69 (define-rule ite-else-lookahead-self ((c Bool) (x Bool)) (ite c x c) (ite c x false))
70
71 (define-rule ite-then-lookahead-not-self ((c Bool) (x Bool)) (ite c (not c) x) (ite c false x))
72 (define-rule ite-else-lookahead-not-self ((c Bool) (x Bool)) (ite c x (not c)) (ite c x true))
73
74 (define-rule ite-expand ((c Bool) (x Bool) (y Bool)) (ite c x y) (and (or (not c) x) (or c y)))
75
76 (define-rule bool-not-ite-elim ((c Bool) (x Bool) (y Bool)) (not (ite c x y)) (ite c (not x) (not y)))