;---------------------- A KenKen Puzzle from a book ---------------------- ; 3 2 4 5 1 ; 2 5 1 4 3 ; 1 3 5 2 4 ; 5 4 3 1 2 ; 4 1 2 3 5 ; ; -- ; ; operators ; ; b11 : 6+ ; b12 : 8* ; b14 : 4- ; ; b22: 15+ ; b23: 14- ; b24: 1- ; ; b34: 4x ; b35: 4 ; ; b41: 1- ; b52: 2/ ; b54: 2- ; ; -- ; ; Plots ; ; b11,b21,b31 ; b12,b13 ; b14,b15 ; b22,b32,b42,b43 ; b23,b33 ; b24,b25 ; b34,b44,b45 ; b34 ; b41,b51 ; b52,b53 ; b54,b55 ; ; ; -- ; ; b11+b21+b31 = 6 ; b121*b13 = 4 ; b14-b15=4 OR b15-b14=4 ; b22+b32+b42+b43=15 ; b32-b33=4 OR b33-b32=4 ; b24-b25=1 OR b25-b24=1 ; b34+b44*b45=4 ; b35=4 ; b41-b51=1 OR b51-b41=1 ; b53/b52=2 OR b52/b53=2 ; b54-b55=2 OR b55-b54=2 ;---------------------- The above is encoded below ---------------------- (declare-const b11 Int) (declare-const b12 Int) (declare-const b13 Int) (declare-const b14 Int) (declare-const b15 Int) (declare-const b21 Int) (declare-const b22 Int) (declare-const b23 Int) (declare-const b24 Int) (declare-const b25 Int) (declare-const b31 Int) (declare-const b32 Int) (declare-const b33 Int) (declare-const b34 Int) (declare-const b35 Int) (declare-const b41 Int) (declare-const b42 Int) (declare-const b43 Int) (declare-const b44 Int) (declare-const b45 Int) (declare-const b51 Int) (declare-const b52 Int) (declare-const b53 Int) (declare-const b54 Int) (declare-const b55 Int) (assert (> b11 0)) (assert (> b12 0)) (assert (> b13 0)) (assert (> b14 0)) (assert (> b15 0)) (assert (> b21 0)) (assert (> b22 0)) (assert (> b23 0)) (assert (> b24 0)) (assert (> b25 0)) (assert (> b31 0)) (assert (> b32 0)) (assert (> b33 0)) (assert (> b34 0)) (assert (> b35 0)) (assert (> b41 0)) (assert (> b42 0)) (assert (> b43 0)) (assert (> b44 0)) (assert (> b45 0)) (assert (> b51 0)) (assert (> b52 0)) (assert (> b53 0)) (assert (> b54 0)) (assert (> b55 0)) (assert (<= b11 5)) (assert (<= b12 5)) (assert (<= b13 5)) (assert (<= b14 5)) (assert (<= b15 5)) (assert (<= b21 5)) (assert (<= b22 5)) (assert (<= b23 5)) (assert (<= b24 5)) (assert (<= b25 5)) (assert (<= b31 5)) (assert (<= b32 5)) (assert (<= b33 5)) (assert (<= b34 5)) (assert (<= b35 5)) (assert (<= b41 5)) (assert (<= b42 5)) (assert (<= b43 5)) (assert (<= b44 5)) (assert (<= b45 5)) (assert (<= b51 5)) (assert (<= b52 5)) (assert (<= b53 5)) (assert (<= b54 5)) (assert (<= b55 5)) (assert (not (= b11 b12))) (assert (not (= b11 b13))) (assert (not (= b11 b14))) (assert (not (= b11 b15 ))) (assert (not (= b12 b13))) (assert (not (= b12 b14))) (assert (not (= b12 b15))) (assert (not (= b13 b14))) (assert (not (= b13 b15))) (assert (not (= b14 b15))) (assert (not (= b21 b22))) (assert (not (= b21 b23))) (assert (not (= b21 b24))) (assert (not (= b21 b25 ))) (assert (not (= b22 b23))) (assert (not (= b22 b24))) (assert (not (= b22 b25))) (assert (not (= b23 b24))) (assert (not (= b23 b25))) (assert (not (= b24 b25))) (assert (not (= b31 b32))) (assert (not (= b31 b33))) (assert (not (= b31 b34))) (assert (not (= b31 b35 ))) (assert (not (= b32 b33))) (assert (not (= b32 b34))) (assert (not (= b32 b35))) (assert (not (= b33 b34))) (assert (not (= b33 b35))) (assert (not (= b34 b35))) (assert (not (= b41 b42))) (assert (not (= b41 b43))) (assert (not (= b41 b44))) (assert (not (= b41 b45 ))) (assert (not (= b42 b43))) (assert (not (= b42 b44))) (assert (not (= b42 b45))) (assert (not (= b43 b44))) (assert (not (= b43 b45))) (assert (not (= b44 b45))) (assert (not (= b51 b52))) (assert (not (= b51 b53))) (assert (not (= b51 b54))) (assert (not (= b51 b55 ))) (assert (not (= b52 b53))) (assert (not (= b52 b54))) (assert (not (= b52 b55))) (assert (not (= b53 b54))) (assert (not (= b53 b55))) (assert (not (= b54 b55))) (assert (not (= b11 b21))) (assert (not (= b11 b31))) (assert (not (= b11 b41))) (assert (not (= b11 b51))) (assert (not (= b21 b31))) (assert (not (= b21 b41))) (assert (not (= b21 b51))) (assert (not (= b31 b41))) (assert (not (= b31 b51))) (assert (not (= b41 b51))) (assert (not (= b12 b22))) (assert (not (= b12 b32))) (assert (not (= b12 b42))) (assert (not (= b12 b52))) (assert (not (= b22 b32))) (assert (not (= b22 b42))) (assert (not (= b22 b52))) (assert (not (= b32 b42))) (assert (not (= b32 b52))) (assert (not (= b42 b52))) (assert (not (= b13 b23))) (assert (not (= b13 b33))) (assert (not (= b13 b43))) (assert (not (= b13 b53))) (assert (not (= b23 b33))) (assert (not (= b23 b43))) (assert (not (= b23 b53))) (assert (not (= b33 b43))) (assert (not (= b33 b53))) (assert (not (= b43 b53))) (assert (not (= b14 b24))) (assert (not (= b14 b34))) (assert (not (= b14 b44))) (assert (not (= b14 b54))) (assert (not (= b24 b34))) (assert (not (= b24 b44))) (assert (not (= b24 b54))) (assert (not (= b34 b44))) (assert (not (= b34 b54))) (assert (not (= b44 b54))) (assert (not (= b15 b25))) (assert (not (= b15 b35))) (assert (not (= b15 b45))) (assert (not (= b15 b55))) (assert (not (= b25 b35))) (assert (not (= b25 b45))) (assert (not (= b25 b55))) (assert (not (= b35 b45))) (assert (not (= b35 b55))) (assert (not (= b45 b55))) (check-sat) (get-model) (assert (= (+ b11 b21 b31) 6)) (assert (= (* b12 b13) 8)) (assert (= (+ b22 b32 b42 b43) 15)) (assert (= (* b34 b44 b45) 4)) (assert (= b35 4)) (check-sat) (get-model) (assert (or (= (- b14 b15) 4) (= (- b15 b14) 4))) (check-sat) (get-model) (assert (or (= (- b23 b33) 4) (= (- b33 b23) 4))) (check-sat) (get-model) (assert (or (= (- b24 b25) 1) (= (- b25 b24) 1))) (check-sat) (get-model) (assert (or (= (- b41 b51) 1) (= (- b51 b41) 1))) (check-sat) (get-model) (assert (or (= (div b52 b53) 2) (= (div b53 b52) 2))) (check-sat) (get-model) (assert (or (= (- b54 b55) 2) (= (- b55 b54) 2))) (check-sat) (get-model) (check-sat) (get-model)