summaryrefslogtreecommitdiff
path: root/proofs/signatures
diff options
context:
space:
mode:
Diffstat (limited to 'proofs/signatures')
-rw-r--r--proofs/signatures/Makefile.am3
-rwxr-xr-xproofs/signatures/th_arrays.plf2
-rw-r--r--proofs/signatures/th_bv.plf46
-rw-r--r--proofs/signatures/th_bv_bitblast.plf220
-rw-r--r--proofs/signatures/th_bv_rewrites.plf22
-rwxr-xr-xproofs/signatures/th_quant.plf5
6 files changed, 189 insertions, 109 deletions
diff --git a/proofs/signatures/Makefile.am b/proofs/signatures/Makefile.am
index 2b6d16cfd..5947ad3f0 100644
--- a/proofs/signatures/Makefile.am
+++ b/proofs/signatures/Makefile.am
@@ -3,7 +3,8 @@
# add support for more theories, just list them here in the same order
# you would to the LFSC proof-checker binary.
#
-CORE_PLFS = sat.plf smt.plf th_base.plf th_arrays.plf th_bv.plf th_bv_bitblast.plf th_real.plf th_int.plf
+
+CORE_PLFS = sat.plf smt.plf th_base.plf th_arrays.plf th_bv.plf th_bv_bitblast.plf th_bv_rewrites.plf th_real.plf th_int.plf
noinst_LTLIBRARIES = libsignatures.la
diff --git a/proofs/signatures/th_arrays.plf b/proofs/signatures/th_arrays.plf
index 5ed3d2f6f..b54a4ed5b 100755
--- a/proofs/signatures/th_arrays.plf
+++ b/proofs/signatures/th_arrays.plf
@@ -60,4 +60,4 @@
(! u1 (! k (term s1)
(! u2 (th_holds (or (= _ t1 t2) (not (= _ (apply _ _ (apply _ _ (read s1 s2) t1) k) (apply _ _ (apply _ _ (read s1 s2) t2) k)))))
(holds cln)))
- (holds cln)))))))
+ (holds cln))))))) \ No newline at end of file
diff --git a/proofs/signatures/th_bv.plf b/proofs/signatures/th_bv.plf
index c93541085..6012e052a 100644
--- a/proofs/signatures/th_bv.plf
+++ b/proofs/signatures/th_bv.plf
@@ -8,7 +8,7 @@
(program mp_ispos ((x mpz)) formula
(mp_ifneg x false true))
-
+
(program mpz_eq ((x mpz) (y mpz)) formula
(mp_ifzero (mpz_sub x y) true false))
@@ -21,7 +21,7 @@
(program mpz_ ((x mpz) (y mpz)) formula
(mp_ifzero (mpz_sub x y) true false))
-
+
; "bitvec" is a term of type "sort"
; (declare BitVec sort)
(declare BitVec (!n mpz sort))
@@ -37,7 +37,7 @@
(declare bvc (! b bit (! v bv bv)))
; calculate the length of a bitvector
-;; (program bv_len ((v bv)) mpz
+;; (program bv_len ((v bv)) mpz
;; (match v
;; (bvn 0)
;; ((bvc b v') (mp_add (bv_len v') 1))))
@@ -48,7 +48,26 @@
(! n mpz
(! v bv
(term (BitVec n)))))
-
+
+(program bv_constants_are_disequal ((x bv) (y bv)) formula
+ (match x
+ (bvn (fail formula))
+ ((bvc bx x')
+ (match y
+ (bvn (fail formula))
+ ((bvc by y') (match bx
+ (b0 (match by (b0 (bv_constants_are_disequal x' y')) (b1 (true))))
+ (b1 (match by (b0 (true)) (b1 (bv_constants_are_disequal x' y'))))
+ ))
+ ))
+))
+
+(declare bv_disequal_constants
+ (! n mpz
+ (! x bv
+ (! y bv
+ (! c (^ (bv_constants_are_disequal x y) true)
+ (th_holds (not (= (BitVec n) (a_bv n x) (a_bv n y)))))))))
; a bv variable
(declare var_bv type)
@@ -61,7 +80,7 @@
; bit vector binary operators
(define bvop2
(! n mpz
- (! x (term (BitVec n))
+ (! x (term (BitVec n))
(! y (term (BitVec n))
(term (BitVec n))))))
@@ -88,7 +107,7 @@
; bit vector unary operators
(define bvop1
(! n mpz
- (! x (term (BitVec n))
+ (! x (term (BitVec n))
(term (BitVec n)))))
@@ -111,8 +130,8 @@
(! t1 (term (BitVec m))
(! t2 (term (BitVec m'))
(term (BitVec n))))))))
-
-;; side-condition fails in signature only??
+
+;; side-condition fails in signature only??
;; (! s (^ (mp_add m m') n)
;; (declare repeat bvopp)
@@ -147,22 +166,22 @@
(term (BitVec n)))))))
-
-;; TODO: add checks for valid typing for these operators
+
+;; TODO: add checks for valid typing for these operators
;; (! c1 (^ (mpz_lte i j)
;; (! c2 (^ (mpz_lt i n) true)
;; (! c3 (^ (mp_ifneg i false true) true)
-;; (! c4 (^ (mp_ifneg j false true) true)
+;; (! c4 (^ (mp_ifneg j false true) true)
;; (! s (^ (mp_add (mpz_sub i j) 1) m)
-
+
; bit vector predicates
(define bvpred
(! n mpz
(! x (term (BitVec n))
(! y (term (BitVec n))
formula))))
-
+
(declare bvult bvpred)
(declare bvule bvpred)
(declare bvugt bvpred)
@@ -171,4 +190,3 @@
(declare bvsle bvpred)
(declare bvsgt bvpred)
(declare bvsge bvpred)
-
diff --git a/proofs/signatures/th_bv_bitblast.plf b/proofs/signatures/th_bv_bitblast.plf
index 8e8c51857..3cc1ec296 100644
--- a/proofs/signatures/th_bv_bitblast.plf
+++ b/proofs/signatures/th_bv_bitblast.plf
@@ -4,7 +4,7 @@
(declare bbltc (! f formula (! v bblt bblt)))
; calculate the length of a bit-blasted term
-(program bblt_len ((v bblt)) mpz
+(program bblt_len ((v bblt)) mpz
(match v
(bbltn 0)
((bbltc b v') (mp_add (bblt_len v') 1))))
@@ -25,6 +25,7 @@
(bblast_term n x y)))))
+; Binds a symbol to the bblast_term to be used later on.
(declare decl_bblast
(! n mpz
(! b bblt
@@ -34,6 +35,16 @@
(! u (! v (bblast_term n t b) (holds cln))
(holds cln))))))))
+(declare decl_bblast_with_alias
+ (! n mpz
+ (! b bblt
+ (! t (term (BitVec n))
+ (! a (term (BitVec n))
+ (! bb (bblast_term n t b)
+ (! e (th_holds (= _ t a))
+ (! s (^ (bblt_len b) n)
+ (! u (! v (bblast_term n a b) (holds cln))
+ (holds cln))))))))))
; a predicate to represent the n^th bit of a bitvector term
(declare bitof
@@ -46,31 +57,31 @@
;; BITBLASTING RULES
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST CONSTANT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(program bblast_const ((v bv) (n mpz)) bblt
- (mp_ifneg n (match v (bvn bbltn)
+ (mp_ifneg n (match v (bvn bbltn)
(default (fail bblt)))
(match v ((bvc b v') (bbltc (match b (b0 false) (b1 true)) (bblast_const v' (mp_add n (~ 1)))))
(default (fail bblt)))))
-
+
(declare bv_bbl_const (! n mpz
(! f bblt
(! v bv
(! c (^ (bblast_const v (mp_add n (~ 1))) f)
(bblast_term n (a_bv n v) f))))))
-
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST VARIABLE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(program bblast_var ((x var_bv) (n mpz)) bblt
- (mp_ifneg n bbltn
+ (mp_ifneg n bbltn
(bbltc (bitof x n) (bblast_var x (mp_add n (~ 1))))))
(declare bv_bbl_var (! n mpz
@@ -79,18 +90,16 @@
(! c (^ (bblast_var x (mp_add n (~ 1))) f)
(bblast_term n (a_var_bv n x) f))))))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST CONCAT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(program bblast_concat ((x bblt) (y bblt)) bblt
- (match x
+ (match x
(bbltn (match y ((bbltc by y') (bbltc by (bblast_concat x y')))
(bbltn bbltn)))
((bbltc bx x') (bbltc bx (bblast_concat x' y)))))
-
-
+
(declare bv_bbl_concat (! n mpz
(! m mpz
(! m1 mpz
@@ -104,36 +113,34 @@
(! c (^ (bblast_concat xb yb ) rb)
(bblast_term n (concat n m m1 x y) rb)))))))))))))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST EXTRACT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(program bblast_extract_rec ((x bblt) (i mpz) (j mpz) (n mpz)) bblt
- (match x
+ (match x
((bbltc bx x') (mp_ifneg (mpz_sub (mpz_sub j n) 1)
(mp_ifneg (mpz_sub (mpz_sub n i) 1)
(bbltc bx (bblast_extract_rec x' i j (mpz_sub n 1)))
(bblast_extract_rec x' i j (mpz_sub n 1)))
-
+
bbltn))
(bbltn bbltn)))
(program bblast_extract ((x bblt) (i mpz) (j mpz) (n mpz)) bblt
- (bblast_extract_rec x i j (mpz_sub n 1)))
+ (bblast_extract_rec x i j (mpz_sub n 1)))
(declare bv_bbl_extract (! n mpz
(! i mpz
(! j mpz
(! m mpz
- (! x (term (BitVec m))
+ (! x (term (BitVec m))
(! xb bblt
(! rb bblt
(! xbb (bblast_term m x xb)
(! c ( ^ (bblast_extract xb i j m) rb)
(bblast_term n (extract n i j m x) rb)))))))))))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST ZERO/SIGN EXTEND
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -148,42 +155,38 @@
(declare bv_bbl_zero_extend (! n mpz
(! k mpz
(! m mpz
- (! x (term (BitVec m))
+ (! x (term (BitVec m))
(! xb bblt
(! rb bblt
(! xbb (bblast_term m x xb)
(! c ( ^ (bblast_zextend xb k m) rb)
(bblast_term n (zero_extend n k m x) rb))))))))))
-
(program bblast_sextend ((x bblt) (i mpz)) bblt
(match x (bbltn (fail bblt))
- ((bbltc xb x') (extend_rec x (mpz_sub i 1) xb))))
+ ((bbltc xb x') (extend_rec x (mpz_sub i 1) xb))))
(declare bv_bbl_sign_extend (! n mpz
(! k mpz
(! m mpz
- (! x (term (BitVec m))
+ (! x (term (BitVec m))
(! xb bblt
(! rb bblt
(! xbb (bblast_term m x xb)
(! c ( ^ (bblast_sextend xb k m) rb)
(bblast_term n (sign_extend n k m x) rb))))))))))
-
-
-
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST BVAND
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
+
(program bblast_bvand ((x bblt) (y bblt)) bblt
- (match x
+ (match x
(bbltn (match y (bbltn bbltn) (default (fail bblt))))
- ((bbltc bx x') (match y
+ ((bbltc bx x') (match y
(bbltn (fail bblt))
((bbltc by y') (bbltc (and bx by) (bblast_bvand x' y')))))))
-
-
+
(declare bv_bbl_bvand (! n mpz
(! x (term (BitVec n))
(! y (term (BitVec n))
@@ -199,11 +202,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(program bblast_bvnot ((x bblt)) bblt
- (match x
- (bbltn bbltn)
+ (match x
+ (bbltn bbltn)
((bbltc bx x') (bbltc (not bx) (bblast_bvnot x')))))
-
-
+
(declare bv_bbl_bvnot (! n mpz
(! x (term (BitVec n))
(! xb bblt
@@ -215,15 +217,14 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST BVOR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
+
(program bblast_bvor ((x bblt) (y bblt)) bblt
- (match x
+ (match x
(bbltn (match y (bbltn bbltn) (default (fail bblt))))
- ((bbltc bx x') (match y
+ ((bbltc bx x') (match y
(bbltn (fail bblt))
((bbltc by y') (bbltc (or bx by) (bblast_bvor x' y')))))))
-
-
+
(declare bv_bbl_bvor (! n mpz
(! x (term (BitVec n))
(! y (term (BitVec n))
@@ -238,15 +239,14 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST BVXOR
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
+
(program bblast_bvxor ((x bblt) (y bblt)) bblt
- (match x
+ (match x
(bbltn (match y (bbltn bbltn) (default (fail bblt))))
- ((bbltc bx x') (match y
+ ((bbltc bx x') (match y
(bbltn (fail bblt))
((bbltc by y') (bbltc (xor bx by) (bblast_bvxor x' y')))))))
-
-
+
(declare bv_bbl_bvxor (! n mpz
(! x (term (BitVec n))
(! y (term (BitVec n))
@@ -262,8 +262,8 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST BVADD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;; return the carry bit after adding x y
+
+;; return the carry bit after adding x y
;; FIXME: not the most efficient thing in the world
(program bblast_bvadd_carry ((a bblt) (b bblt) (carry formula)) formula
(match a
@@ -272,7 +272,7 @@
(bbltn (fail formula))
((bbltc bi b') (or (and ai bi) (and (xor ai bi) (bblast_bvadd_carry a' b' carry))))))))
-;; ripple carry adder where carry is the initial carry bit
+;; ripple carry adder where carry is the initial carry bit
(program bblast_bvadd ((a bblt) (b bblt) (carry formula)) bblt
(match a
( bbltn (match b (bbltn bbltn) (default (fail bblt))))
@@ -280,8 +280,35 @@
(bbltn (fail bblt))
((bbltc bi b') (bbltc (xor (xor ai bi) (bblast_bvadd_carry a' b' carry))
(bblast_bvadd a' b' carry)))))))
-
-
+
+
+(program reverse_help ((x bblt) (acc bblt)) bblt
+(match x
+ (bbltn acc)
+ ((bbltc xi x') (reverse_help x' (bbltc xi acc)))))
+
+
+(program reverseb ((x bblt)) bblt
+ (reverse_help x bbltn))
+
+
+; AJR: use this version?
+;(program bblast_bvadd_2h ((a bblt) (b bblt) (carry formula)) bblt
+;(match a
+; ( bbltn (match b (bbltn bbltn) (default (fail bblt))))
+; ((bbltc ai a') (match b
+; (bbltn (fail bblt))
+; ((bbltc bi b')
+; (let carry' (or (and ai bi) (and (xor ai bi) carry))
+; (bbltc (xor (xor ai bi) carry)
+; (bblast_bvadd_2h a' b' carry'))))))))
+
+;(program bblast_bvadd_2 ((a bblt) (b bblt) (carry formula)) bblt
+;(let ar (reverseb a) ;; reverse a and b so that we can build the circuit
+;(let br (reverseb b) ;; from the least significant bit up
+;(let ret (bblast_bvadd_2h ar br carry)
+; (reverseb ret)))))
+
(declare bv_bbl_bvadd (! n mpz
(! x (term (BitVec n))
(! y (term (BitVec n))
@@ -293,7 +320,6 @@
(! c (^ (bblast_bvadd xb yb false) rb)
(bblast_term n (bvadd n x y) rb)))))))))))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST BVNEG
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -304,8 +330,8 @@
(program bblast_bvneg ((x bblt) (n mpz)) bblt
(bblast_bvadd (bblast_bvnot x) (bblast_zero n) true))
-
-
+
+
(declare bv_bbl_bvneg (! n mpz
(! x (term (BitVec n))
(! xb bblt
@@ -319,23 +345,14 @@
;; BITBLAST BVMUL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-;; shift add multiplier
-
-(program reverse_help ((x bblt) (acc bblt)) bblt
-(match x
- (bbltn acc)
- ((bbltc xi x') (reverse_help x' (bbltc xi acc)))))
-
-(program reverseb ((x bblt)) bblt
- (reverse_help x bbltn))
+;; shift add multiplier
;; (program concat ((a bblt) (b bblt)) bblt
;; (match a (bbltn b)
;; ((bbltc ai a') (bbltc ai (concat a' b)))))
-
+
(program top_k_bits ((a bblt) (k mpz)) bblt
(mp_ifzero k bbltn
(match a (bbltn (fail bblt))
@@ -344,7 +361,7 @@
(program bottom_k_bits ((a bblt) (k mpz)) bblt
(reverseb (top_k_bits (reverseb a) k)))
-;; assumes the least signigicant bit is at the beginning of the list
+;; assumes the least signigicant bit is at the beginning of the list
(program k_bit ((a bblt) (k mpz)) formula
(mp_ifneg k (fail formula)
(match a (bbltn (fail formula))
@@ -353,7 +370,7 @@
(program and_with_bit ((a bblt) (bt formula)) bblt
(match a (bbltn bbltn)
((bbltc ai a') (bbltc (and bt ai) (and_with_bit a' bt)))))
-
+
;; a is going to be the current result
;; carry is going to be false initially
;; b is the and of a and b[k]
@@ -377,19 +394,19 @@
(let ak (top_k_bits a k')
(let b' (and_with_bit ak (k_bit b k))
(mp_ifzero (mpz_sub k' 1)
- (mult_step_k_h res b' bbltn false k)
+ (mult_step_k_h res b' bbltn false k)
(let res' (mult_step_k_h res b' bbltn false k)
(mult_step a b (reverseb res') n (mp_add k 1))))))))
(program bblast_bvmul ((a bblt) (b bblt) (n mpz)) bblt
-(let ar (reverseb a) ;; reverse a and b so that we can build the circuit
+(let ar (reverseb a) ;; reverse a and b so that we can build the circuit
(let br (reverseb b) ;; from the least significant bit up
(let res (and_with_bit ar (k_bit br 0))
- (mp_ifzero (mpz_sub n 1) ;; if multiplying 1 bit numbers no need to call mult_step
+ (mp_ifzero (mpz_sub n 1) ;; if multiplying 1 bit numbers no need to call mult_step
res
(mult_step ar br res n 1))))))
-
+
(declare bv_bbl_bvmul (! n mpz
(! x (term (BitVec n))
(! y (term (BitVec n))
@@ -402,18 +419,18 @@
(bblast_term n (bvmul n x y) rb)))))))))))
-
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST EQUALS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
+
; bit blast x = y
; for x,y of size n, it will return a conjuction (x.0 = y.0 ^ ( ... ^ (x.{n-1} = y.{n-1})))
; f is the accumulator formula that builds the equality in the right order
(program bblast_eq_rec ((x bblt) (y bblt) (f formula)) formula
- (match x
+ (match x
(bbltn (match y (bbltn f) (default (fail formula))))
- ((bbltc fx x') (match y
+ ((bbltc fx x') (match y
(bbltn (fail formula))
((bbltc fy y') (bblast_eq_rec x' y' (and (iff fx fy) f)))))
(default (fail formula))))
@@ -423,7 +440,23 @@
((bbltc bx x') (match y ((bbltc by y') (bblast_eq_rec x' y' (iff bx by)))
(default (fail formula))))
(default (fail formula))))
-
+
+
+;; TODO: a temporary bypass for rewrites that we don't support yet. As soon
+;; as we do, remove this rule.
+
+(declare bv_bbl_=_false
+ (! n mpz
+ (! x (term (BitVec n))
+ (! y (term (BitVec n))
+ (! bx bblt
+ (! by bblt
+ (! f formula
+ (! bbx (bblast_term n x bx)
+ (! bby (bblast_term n y by)
+ (! c (^ (bblast_eq bx by) f)
+ (th_holds (iff (= (BitVec n) x y) false))))))))))))
+
(declare bv_bbl_=
(! n mpz
(! x (term (BitVec n))
@@ -436,11 +469,22 @@
(! c (^ (bblast_eq bx by) f)
(th_holds (iff (= (BitVec n) x y) f))))))))))))
-
+(declare bv_bbl_=_swap
+ (! n mpz
+ (! x (term (BitVec n))
+ (! y (term (BitVec n))
+ (! bx bblt
+ (! by bblt
+ (! f formula
+ (! bbx (bblast_term n x bx)
+ (! bby (bblast_term n y by)
+ (! c (^ (bblast_eq by bx) f)
+ (th_holds (iff (= (BitVec n) x y) f))))))))))))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST BVULT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
+
(program bblast_bvult ((x bblt) (y bblt) (n mpz)) formula
(match x
( bbltn (fail formula))
@@ -465,7 +509,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; BITBLAST BVSLT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
+
(program bblast_bvslt ((x bblt) (y bblt) (n mpz)) formula
(match x
( bbltn (fail formula))
@@ -488,7 +532,6 @@
(! bby (bblast_term n y by)
(! c (^ (bblast_bvslt bx by n) f)
(th_holds (iff (bvslt n x y) f))))))))))))
-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@@ -525,8 +568,8 @@
;; REWRITE RULES
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-
+
+
; rewrite rule :
; x + y = y + x
(declare bvadd_symm
@@ -534,7 +577,7 @@
(! x (term (BitVec n))
(! y (term (BitVec n))
(th_holds (= (BitVec n) (bvadd _ x y) (bvadd _ y x)))))))
-
+
;; (declare bvcrazy_rewrite
;; (! n mpz
;; (! x (term (BitVec n))
@@ -546,12 +589,12 @@
;; (! s (^ (rewrite_scc xn yn) true)
;; (! u (! x (term (BitVec n)) (holds cln))
;; (holds cln)))))))))))
-
+
;; (th_holds (= (BitVec n) (bvadd x y) (bvadd y x)))))))
-
-
-; necessary?
+
+
+; necessary?
;; (program calc_bvand ((a bv) (b bv)) bv
;; (match a
;; (bvn (match b (bvn bvn) (default (fail bv))))
@@ -560,7 +603,7 @@
;; (default (fail bv))))))
;; ; rewrite rule (w constants) :
-;; ; a & b = c
+;; ; a & b = c
;; (declare bvand_const (! c bv
;; (! a bv
;; (! b bv
@@ -568,7 +611,7 @@
;; (th_holds (= BitVec (bvand (a_bv a) (a_bv b)) (a_bv c))))))))
-;; making constant bit-vectors
+;; making constant bit-vectors
(program mk_ones ((n mpz)) bv
(mp_ifzero n bvn (bvc b1 (mk_ones (mpz_sub n 1)))))
@@ -576,7 +619,7 @@
(mp_ifzero n bvn (bvc b0 (mk_ones (mpz_sub n 1)))))
-
+
;; (bvxnor a b) => (bvnot (bvxor a b))
;; (declare bvxnor_elim
;; (! n mpz
@@ -603,7 +646,7 @@
;; (! rwb (rw_term _ b (a_bv _ zero_bits))
;; (rw_term _ (bvxor _ a b)
;; a'))))))))))
-
+
;; ;; (bvxor a 11) => (bvnot a)
;; (declare bvxor_one
;; (! n mpz
@@ -617,7 +660,7 @@
;; (rw_term _ (bvxor _ a b)
;; (bvnot _ a')))))))))))
-
+
;; ;; (bvnot (bvnot a)) => a
;; (declare bvnot_idemp
;; (! n mpz
@@ -626,4 +669,3 @@
;; (! rwa (rw_term _ a a')
;; (rw_term _ (bvnot _ (bvnot _ a))
;; a'))))))
-
diff --git a/proofs/signatures/th_bv_rewrites.plf b/proofs/signatures/th_bv_rewrites.plf
new file mode 100644
index 000000000..bf5dea9e9
--- /dev/null
+++ b/proofs/signatures/th_bv_rewrites.plf
@@ -0,0 +1,22 @@
+;
+; Equality swap
+;
+
+(declare rr_bv_eq
+ (! n mpz
+ (! t1 (term (BitVec n))
+ (! t2 (term (BitVec n))
+ (th_holds (iff (= (BitVec n) t2 t1) (= (BitVec n) t1 t2)))))))
+
+;
+; Additional rules...
+;
+
+;
+; Default, if nothing else applied
+;
+
+(declare rr_bv_default
+ (! t1 formula
+ (! t2 formula
+ (th_holds (iff t1 t2))))))
diff --git a/proofs/signatures/th_quant.plf b/proofs/signatures/th_quant.plf
index d85b2115c..e212f835d 100755
--- a/proofs/signatures/th_quant.plf
+++ b/proofs/signatures/th_quant.plf
@@ -14,10 +14,7 @@
(match ti
((apply si1 si2 ti1 ti2) (match (is_inst_t ti1 t1 k) (tt (is_inst_t ti2 t2 k)) (ff ff)))
(default ff)))
- (default
- (match ti
- ((apply si1 si2 ti1 ti2) ff)
- (default (eqterm ti (ifmarked t k t)))))))
+ (default (eqterm ti (ifmarked t k t)))))
(program is_inst_f ((fi formula) (f formula) (k term)) bool
(match f
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback