如何用Z3-SMT-LIB证明Z3群满足结合律
我试图用下面的Z3-SMT-LIB代码证明Z3群满足结合定律如何用Z3-SMT-LIB证明Z3群满足结合律,z3,Z3,我试图用下面的Z3-SMT-LIB代码证明Z3群满足结合定律 (set-option :mbqi true) (declare-sort S) (declare-fun f (S S) S) (declare-const a S) (declare-const b S) (declare-const c S) (assert (forall ((x S) (y S)) (= (f x y) (f y x)))) (assert (forall ((x S))
(set-option :mbqi true)
(declare-sort S)
(declare-fun f (S S) S)
(declare-const a S)
(declare-const b S)
(declare-const c S)
(assert (forall ((x S) (y S))
(= (f x y) (f y x))))
(assert (forall ((x S))
(= (f x a) x)))
(assert (= (f b b) c))
(assert (= (f b c) a))
(assert (= (f c c) b))
(check-sat)
(get-model)
(declare-fun x () S)
(declare-fun y () S)
(declare-fun z () S)
(assert (not (=> (and (or (= x a) (= x b) (= x c)) (or (= y a) (= y b) (= y c))
(or (= z a) (= z b) (= z c)))
(= (f x (f y z)) (f (f x y) z)))))
(check-sat)
相应的输出是
sat
(model
;; universe for S:
;; S!val!1 S!val!0 S!val!2
;; -----------
;; definitions for universe elements:
(declare-fun S!val!1 () S)
(declare-fun S!val!0 () S)
(declare-fun S!val!2 () S)
;; cardinality constraint:
(forall ((x S)) (or (= x S!val!1) (= x S!val!0) (= x S!val!2)))
;; -----------
(define-fun b () S S!val!0)
(define-fun c () S S!val!1)
(define-fun a () S S!val!2)
(define-fun f ((x!1 S) (x!2 S)) S
(ite (and (= x!1 S!val!0) (= x!2 S!val!0)) S!val!1
(ite (and (= x!1 S!val!0) (= x!2 S!val!1)) S!val!2
(ite (and (= x!1 S!val!1) (= x!2 S!val!1)) S!val!0
(ite (and (= x!1 S!val!1) (= x!2 S!val!0)) S!val!2
(ite (and (= x!1 S!val!0) (= x!2 S!val!2)) S!val!0
(ite (and (= x!1 S!val!2) (= x!2 S!val!0)) S!val!0
(ite (and (= x!1 S!val!2) (= x!2 S!val!1)) S!val!1
(ite (and (= x!1 S!val!1) (= x!2 S!val!2)) S!val!1 x!1)))))))))
)
unsat
在线运行此示例
问题是:
每个群都必须满足结合性公理。我猜您是在试图证明第一组断言的每个模型都满足关联性公理。为了完成这个例子,我们还应该证明逆元素公理 为了证明这两个属性,我们可以使用以下命令:
(push)
;; prove the inverse axiom
(assert (not (forall ((x S)) (exists ((y S)) (= (f x y) a)))))
(check-sat)
(pop)
(push)
;; prove the associativity axiom
(assert (not (forall ((x S) (y S) (z S)) (= (f x (f y z)) (f (f x y) z)))))
(check-sat)
(pop)
Z3无法证明它们。然而,如果我们断言我们只对大小不超过3的模型感兴趣,它就会成功
(assert (forall ((x S)) (or (= x a) (= x b) (= x c))))
是完整的示例。在尺寸不超过4英寸的车型中,可以使用相同的策略?。我正在尝试使用Z4,但输出是
timeout