Guest User

Untitled

a guest
Feb 18th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. (declare-const c Int)
  2. (declare-const l Int)
  3. (declare-const a Int)
  4. (declare-const r Int)
  5. (declare-const k Int)
  6. (declare-const s Int)
  7. (declare-const o Int)
  8. (declare-const n Int)
  9.  
  10. (assert (and (>= c 0) (<= c 9)))
  11. (assert (and (>= l 0) (<= l 9)))
  12. (assert (and (>= a 0) (<= a 9)))
  13. (assert (and (>= r 0) (<= r 9)))
  14. (assert (and (>= k 0) (<= k 9)))
  15. (assert (and (>= s 0) (<= s 9)))
  16. (assert (and (>= o 0) (<= o 9)))
  17. (assert (and (>= n 0) (<= n 9)))
  18.  
  19. (assert (not (= c l)))
  20. (assert (not (= c a)))
  21. (assert (not (= c r)))
  22. (assert (not (= c k)))
  23. (assert (not (= c s)))
  24. (assert (not (= c o)))
  25. (assert (not (= c n)))
  26. (assert (not (= l a)))
  27. (assert (not (= l r)))
  28. (assert (not (= l k)))
  29. (assert (not (= l s)))
  30. (assert (not (= l o)))
  31. (assert (not (= l n)))
  32. (assert (not (= a r)))
  33. (assert (not (= a k)))
  34. (assert (not (= a s)))
  35. (assert (not (= a o)))
  36. (assert (not (= a n)))
  37. (assert (not (= r k)))
  38. (assert (not (= r s)))
  39. (assert (not (= r o)))
  40. (assert (not (= r n)))
  41. (assert (not (= k s)))
  42. (assert (not (= k o)))
  43. (assert (not (= k n)))
  44. (assert (not (= s o)))
  45. (assert (not (= s n)))
  46. (assert (not (= o n)))
  47.  
  48. ; r + n = s,
  49. ; or r + n = s + 10
  50. (assert (or (= (+ r n) s) (= (+ r n) (+ s 10))))
  51.  
  52. ; a + o = s,
  53. ; or a + o = s + 10,
  54. ; or r + n > 9 and a + o + 1 = s,
  55. ; or r + n > 9 and a + o + 1 = s + 10
  56. (assert (or
  57. (= (+ a o) s)
  58. (= (+ a o) (+ s 10))
  59. (and (> (+ r n) 9) (= (+ a o 1) s))
  60. (and (> (+ r n) 9) (= (+ a o 1) (+ s 10)))
  61. ))
  62.  
  63. ; l + s = a,
  64. ; or l + s = a + 10,
  65. ; or a + o > 9 and l + s + 1 = a,
  66. ; or a + o > 9 and l + s + 1 = a + 10
  67. (assert (or
  68. (= (+ l s) a)
  69. (= (+ l s) (+ a 10))
  70. (and (> (+ a o) 9) (= (+ l s 1) a))
  71. (and (> (+ a o) 9) (= (+ l s 1) (+ a 10)))
  72. ))
  73.  
  74. ; c + k = l + 10,
  75. ; or c + k + 1 = l + 10
  76. (assert (or
  77. (= (+ c k) (+ l 10))
  78. (and (> (+ l s) 9) (= (+ c k 1) (+ l 10)))
  79. ))
  80.  
  81. ; c must be 1 since the sum is a 5 digit number
  82. (assert (= c 1))
  83.  
  84. ; k cannot be 0 - no leading zeros
  85. (assert (not (= k 0)))
  86.  
  87. (check-sat)
  88. (get-model)
Add Comment
Please, Sign In to add comment