在之前的帖子中Z3 group使用名爲S的排序來證明某些組公理集。請運行代碼code with sort named S但現在,當排序的名稱更改爲G時,代碼不起作用。請在線上查找問題code with sort named G有必要使用名稱S進行排序,或者這是Z3的問題?請告訴我。Z3中的排序名稱問題
0
A
回答
0
請讓ne知道以下代碼與名爲G的排序是否正確。非常感謝
(declare-sort G)
(declare-fun f (G G) G)
(declare-const a G)
(declare-const b G)
(declare-const c G)
(assert (forall ((x G) (y G))
(= (f x y) (f y x))))
(assert (forall ((x G))
(= (f x a) x)))
(assert (= (f b b) c))
(assert (= (f b c) a))
(assert (= (f c c) b))
(check-sat)
(get-model)
(push)
;; prove the left-module axiom
(assert (not (forall ((x G)) (= (f a x) x))))
(check-sat)
(pop)
(push)
;; prove the right-module axiom
(assert (not (forall ((x G)) (= (f x a) x))))
(check-sat)
(pop)
(declare-fun x() G)
(declare-fun y() G)
(declare-fun z() G)
(push)
;; prove the right-inverse axiom
(assert (not (=> (and (or (= x a) (= x b) (= x c))) (exists ((y G)) (= (f x y) a)))))
(check-sat)
(pop)
(push)
;; prove the left-inverse axiom
(assert (not (=> (and (or (= x a) (= x b) (= x c))) (exists ((y G)) (= (f y x ) a)))))
(check-sat)
(pop)
(push)
;; prove the associativity axiom
(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)
(pop)
(push)
;; prove the commutative property
(assert (not (=> (and (or (= x a) (= x b) (= x c)) (or (= y a) (= y b) (= y c)))
(= (f x y) (f y x)))))
(check-sat)
(pop)
和相應的輸出是預期
sat unsat unsat unsat unsat unsat unsat
請運行該代碼在線here
+0
如果這是您正在使用的代碼,請將其添加到問題本身而不是作爲答案。謝謝! –
1
問題的簡化版本。
$ z3 -version
Z3 version 4.3.1
使用名稱S:
$ cat S.smt
(declare-sort S)
(declare-fun f (S S) S)
(declare-const a S)
(declare-const b S)
(assert (= (f a a) a))
(assert (= (f a b) b))
(assert (= (f b a) b))
(assert (= (f b b) a))
(check-sat)
;; Restrict the search to models of size at most 2.
(assert (forall ((x S)) (or (= x a) (= x b))))
;; Associativity
(assert (not (forall ((x S) (y S) (z S)) (= (f x (f y z)) (f (f x y) z)))))
(check-sat)
$ z3 -smt2 S.smt
sat
unsat
使用名稱G:
$ cat G.smt
(declare-sort G)
(declare-fun f (G G) G)
(declare-const a G)
(declare-const b G)
(assert (= (f a a) a))
(assert (= (f a b) b))
(assert (= (f b a) b))
(assert (= (f b b) a))
(check-sat)
;; Restrict the search to models of size at most 2
(assert (forall ((x G)) (or (= x a) (= x b))))
;; Associativity
(assert (not (forall ((x G) (y G) (z G)) (= (f x (f y z)) (f (f x y) z)))))
(check-sat)
$ z3 -smt2 G.smt
sat
unknown
+0
這是非常有趣和值得注意的是,沒有必要產生一個模型,目的是證明公理。 –
相關問題
- 1. 訪問按名稱排序
- 2. 在Z3中使用排序
- 3. 在z3中排序繼承
- 4. Z3 QBVF問題
- 5. 排序名稱
- 6. Z3:關於Z3 int2bv的問題?
- 7. jqGrid排序問題id名稱和索引是不同的
- 8. Android應用程序的名稱問題
- 9. 按名稱排序升序
- 10. .NET中的排序問題
- 11. Java中的排序問題
- 12. 需要按排序順序排序在java中的名稱
- 13. LINQ排序排序問題
- 14. 排序鏈接列表中的名稱
- 15. Plist按Xcode中的名稱排序?
- 16. 前5名排名問題
- 17. 排序問題..
- 18. 排序問題?
- 19. 排序問題
- 20. 排序問題
- 21. 排序問題
- 22. 問題排序
- 23. 排序問題
- 24. 排序問題?
- 25. Android程序包名稱問題
- 26. 應用程序名稱問題
- 27. 序列化DataMember(名稱)覆蓋問題
- 28. 在Z3觸發問題
- 29. JavaScript的問題,ID名稱
- 30. Xcode的名稱問題
奇怪,但這似乎本地的網絡版,我們實行超時。在本地運行您的示例沒有任何問題。 –
我想在本地運行示例:排序命名爲S時的示例運行速度非常快,並生成正確的輸出;但排序命名爲G的示例運行速度非常慢,並且不會停止。你能告訴我會發生什麼嗎? –
在我使用Z3版本4.3.1的Ubuntu盒子中,我可以在4秒內使用名稱S運行代碼,但使用名稱G運行代碼在15分鐘後不會產生任何結果。 – asr