Advertisement
Guest User

pactex3ii-model

a guest
May 26th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. (set-option :produce-models true)
  2.  
  3.  
  4. ;;; The universe (the elements)
  5. (declare-datatypes () ((Element a b c d)))
  6.  
  7.  
  8.  
  9. ;;; The predicates:
  10. (declare-fun IsZero (Element) Bool) ;; (IsZero x) should be true iff x is the zero element
  11. (declare-fun Successor (Element Element) Bool) ;; (Successor x y) should be true iff y is the successor of x (x is the predecessor of y)
  12. (declare-fun Sum (Element Element Element) Bool) ;; (Sum x y z) should be true iff x+y=z
  13. (declare-fun Predicate (Element) Bool)
  14.  
  15.  
  16.  
  17. ;;; The formulas:
  18.  
  19.  
  20. ;;; (1) every element has exactly one successor
  21. (assert (forall((x Element))( exists((y Element))(and (Successor x y)( forall ((z Element))(=>(Successor x z)(= z y)))))))
  22.  
  23.  
  24. ;;; (2) successor relation is asymmetric
  25. (assert(forall((x Element)(y Element))(=>(Successor x y)(not (Successor y x)))))
  26.  
  27.  
  28. ;;; (3) there is exactly one zero element
  29. (assert(exists ((x Element))(and (IsZero x)(forall((y Element))(=>(IsZero y)(= y x))))))
  30.  
  31.  
  32. ;;; (4) adding the zero element to any other element gives the element again
  33. (assert(forall((x Element) (y Element) (z Element))(=>(and (Sum x y z) (IsZero x))(= y z))))
  34.  
  35.  
  36. ;;; (5) summing is commutative
  37. (assert(forall ((x Element)(y Element)(z Element))(=>(Sum x y z)(Sum y x z))))
  38.  
  39.  
  40. ;;; (6) summing two elements has at most one result
  41. (assert(forall ((x Element)(y Element))(exists ((z Element))(and (Sum x y z)(forall((w Element))(=>(Sum x y w)(= w z)))))))
  42.  
  43. ;;; (7) if element z is the sum of elements x y, x' is the successor of x, then
  44. ;;; the successor of z is the result of the sum of x' and y
  45. (assert(forall((x Element)(y Element)(z Element)(w Element) (v Element))(=>(and(Sum x y z)(Successor x v))(=>(Successor z w)(Sum v y w))) ))
  46.  
  47. ;;; (8) the predicate holds for an element iff it does not hold for its the successor
  48. (assert(forall((x Element))(exists((y Element))(and(Successor x y)(=(Predicate x)(not (Predicate y)))))))
  49.  
  50. ;;; (9) the zero element satisfies the predicate
  51. (assert(exists((x Element))(=>(and (IsZero x)(forall((y Element))(=>(IsZero y)(= y x))))(Predicate x))))
  52.  
  53. ;;; (10) there exists an element whose sum with itself does not satisfy the predicate
  54. (assert (exists ((x Element) (y Element)) (and (Sum x x y) (not (Predicate y)))))
  55.  
  56.  
  57.  
  58.  
  59. (check-sat)
  60. ;(get-model)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement