如果我想檢查一組中是否有另一組元素也是可能的?包含Z3中的兩組
例如(包含SET1 SET2):
contains [1,2] [3,5] -> is false
contains [1] [2,3, 1] -> is true
的集合是有限的。和集合的最大值是5,最小值爲0,則組可以不具有值大於5既不小於0
例如:
[1,5,3] -> valid set
[1,8,2] -> invalid set
假如它是用於一組並檢查該集合中是否存在值很容易。它是以下列方式:
(declare-sort Set 0)
(declare-fun contains (Set Int) bool)
(declare-const set Set)
(declare-const A Int)
(assert (contains set A))
(assert (not (contains set 0)))
(check-sat)
但是對於兩組我看不到它是如何完成的。
感謝您的關注。
我不想子集,因爲我可以有'包含[1,2] [3,4,2] - >是TRUE'。 – Robert 2013-03-14 20:02:46
我用一個表達式更新了答案,這個表達式可以用來檢查兩個集合是否有共同的元素。它基本上只是檢查交叉點是否爲空。 – 2013-03-14 21:06:57
感謝您的幫助 – Robert 2013-03-15 09:34:49