-- | see https://groups.google.com/forum/#!msg/minisat/dTlDd4JKfnA/cphy4zYALlYJ

module CO4.Prelude.Nat.Opt where

import Prelude hiding (not)
import Satchmo.Core.Primitive  (assert,not)

plus3 [x1,x2,x3] [x4,x5,x6] [x7,x8,x9] = do
    assert [not x3 , not x6]
    assert [not x3 , x9]
    assert [not x6 , x9]
    assert [not x2 , not x3 , x8]
    assert [not x2 , not x6 , x8]
    assert [not x2 , x8 , x9]
    assert [x1 , not x4 , x7]
    assert [x1 , x4 , not x7]
    assert [not x1 , not x4 , not x7]
    assert [x1 , x2 , not x5 , x8]
    assert [x2 , x4 , not x5 , x8]
    assert [x1 , x2 , x5 , not x8]
    assert [x1 , not x2 , not x5 , not x8]
    assert [x2 , x4 , x5 , not x8]
    assert [not x2 , x4 , not x5 , not x8]
    assert [not x1 , not x3 , not x5 , x7]
    assert [not x1 , not x5 , not x6 , x7]
    assert [not x1 , not x5 , x7 , x9]
    assert [x1 , x3 , x5 , x6 , not x9]
    assert [x3 , x4 , x5 , x6 , not x9]
    assert [x2 , x3 , x6 , not x8 , not x9]
    assert [not x1 , x2 , x5 , x7 , x8]
    assert [not x1 , not x2 , not x5 , x7 , x8]
    assert [not x1 , not x2 , x5 , x7 , not x8]


times3 [x1,x2,x3] [x4,x5,x6] [x7,x8,x9] = do
    assert [not x3 , not x6]
    assert [not x2 , not x6]
    assert [not x3 , not x5]
    assert [x1 , not x7]
    assert [x4 , not x7]
    assert [not x1 , not x6 , x9]
    assert [not x2 , not x5 , x9]
    assert [not x3 , not x4 , x9]
    assert [x1 , not x6 , not x9]
    assert [not x3 , x4 , not x9]
    assert [not x1 , not x5 , x8]
    assert [not x2 , not x4 , x8]
    assert [x1 , x2 , not x8]
    assert [x2 , x5 , not x8]
    assert [x1 , x4 , not x8]
    assert [x4 , x5 , not x8]
    assert [not x1 , not x4 , x7]
    assert [not x2 , not x5 , not x7]
    assert [x3 , x5 , x6 , not x9]
    assert [x2 , not x5 , x6 , not x9]

plus4 [x1,x2,x3,x4] [x5,x6,x7,x8] [x9,x10,x11,x12] = do
    assert [not x4 , not x8]
    assert [not x4 , x12]
    assert [not x8 , x12]
    assert [not x3 , not x4 , x11]
    assert [not x3 , not x8 , x11]
    assert [not x3 , x11 , x12]
    assert [not x1 , x5 , x9]
    assert [x1 , x5 , not x9]
    assert [not x1 , not x5 , not x9]
    assert [not x2 , not x4 , not x7 , x10]
    assert [not x2 , not x7 , not x8 , x10]
    assert [x1 , x2 , not x6 , x10]
    assert [not x2 , not x7 , x10 , x12]
    assert [x1 , x2 , x6 , not x10]
    assert [x1 , not x2 , not x6 , not x10]
    assert [not x2 , x5 , not x6 , not x10]
    assert [x2 , not x6 , not x9 , x10]
    assert [x2 , x6 , not x9 , not x10]
    assert [x1 , x3 , x6 , not x7 , x11]
    assert [x3 , x5 , x6 , not x7 , x11]
    assert [x1 , x3 , x6 , x7 , not x11]
    assert [x1 , not x3 , x6 , not x7 , not x11]
    assert [x3 , x5 , x6 , x7 , not x11]
    assert [x3 , x4 , x8 , not x11 , not x12]
    assert [not x2 , x3 , x7 , x10 , x11]
    assert [not x2 , not x3 , not x7 , x10 , x11]
    assert [not x2 , not x3 , x7 , x10 , not x11]
    assert [x2 , x3 , not x7 , not x10 , x11]
    assert [x2 , x3 , x7 , not x10 , not x11]
    assert [x2 , not x3 , not x7 , not x10 , not x11]
    assert [not x4 , not x5 , not x6 , not x7 , x9]
    assert [not x5 , not x6 , not x7 , not x8 , x9]
    assert [not x5 , not x6 , not x7 , x9 , x12]
    assert [x2 , not x5 , x6 , x9 , x10]
    assert [not x2 , not x5 , not x6 , x9 , x10]
    assert [not x2 , not x5 , x6 , x9 , not x10]
    assert [not x3 , x6 , not x7 , not x9 , not x11]
    assert [x1 , x4 , x6 , x7 , x8 , not x12]
    assert [x2 , x4 , x7 , x8 , not x10 , not x12]
    assert [x3 , not x5 , not x6 , x7 , x9 , x11]
    assert [not x3 , not x5 , not x6 , not x7 , x9 , x11]
    assert [not x3 , not x5 , not x6 , x7 , x9 , not x11]
    assert [x4 , x6 , x7 , x8 , not x9 , not x12]


times4 [x1,x2,x3,x4] [x5,x6,x7,x8] [x9,x10,x11,x12] = do
    assert [not x4 , not x8]
    assert [not x3 , not x8]
    assert [not x2 , not x8]
    assert [not x4 , not x7]
    assert [not x3 , not x7]
    assert [not x4 , not x6]
    assert [x1 , not x9]
    assert [x5 , not x9]
    assert [not x1 , not x8 , x12]
    assert [not x2 , not x7 , x12]
    assert [not x3 , not x6 , x12]
    assert [not x4 , not x5 , x12]
    assert [not x1 , not x7 , x11]
    assert [not x3 , not x5 , x11]
    assert [x1 , x2 , not x10]
    assert [x2 , x6 , not x10]
    assert [x1 , x5 , not x10]
    assert [x5 , x6 , not x10]
    assert [not x1 , not x5 , x9]
    assert [x1 , x2 , not x7 , not x12]
    assert [not x2 , not x6 , x11 , x12]
    assert [x1 , x2 , x3 , not x11]
    assert [x1 , x3 , x6 , not x11]
    assert [x2 , x5 , x7 , not x11]
    assert [x5 , x6 , x7 , not x11]
    assert [not x2 , not x5 , x6 , x10]
    assert [not x2 , not x5 , x10 , not x11]
    assert [not x2 , not x6 , x9 , x11]
    assert [not x1 , not x6 , x9 , x10]
    assert [x3 , x7 , not x9 , not x11]
    assert [x2 , not x6 , not x9 , x10]
    assert [x1 , x3 , x4 , x7 , not x12]
    assert [x2 , x4 , x6 , x8 , not x12]
    assert [x5 , x6 , x7 , x8 , not x12]
    assert [not x1 , x3 , not x6 , x8 , not x10 , not x12]
    assert [not x2 , x4 , not x5 , x7 , not x10 , not x12]


plus5 [x1,x2,x3,x4,x5] [x6,x7,x8,x9,x10] [x11,x12,x13,x14,x15] = do
    assert [not x5 , not x10]
    assert [not x5 , x15]
    assert [not x10 , x15]
    assert [not x4 , not x5 , not x9]
    assert [not x4 , not x9 , not x10]
    assert [not x4 , not x9 , x15]
    assert [not x4 , not x5 , x14]
    assert [not x4 , not x10 , x14]
    assert [not x5 , not x9 , x14]
    assert [not x9 , not x10 , x14]
    assert [not x4 , x14 , x15]
    assert [not x9 , x14 , x15]
    assert [x1 , not x6 , x11]
    assert [x1 , x6 , not x11]
    assert [not x1 , not x6 , not x11]
    assert [x1 , not x2 , x7 , x12]
    assert [not x2 , x6 , x7 , x12]
    assert [x1 , x2 , x7 , not x12]
    assert [x2 , x6 , x7 , not x12]
    assert [not x2 , x6 , not x7 , not x12]
    assert [not x2 , not x7 , not x11 , not x12]
    assert [x4 , x5 , x9 , x10 , not x15]
    assert [x3 , not x4 , x8 , x9 , x14]
    assert [x3 , x4 , x8 , not x9 , x14]
    assert [x3 , x4 , x8 , x9 , not x14]
    assert [x1 , x2 , not x3 , x8 , x13]
    assert [x1 , x2 , x3 , not x8 , x13]
    assert [x2 , not x3 , x6 , x8 , x13]
    assert [x2 , x3 , x6 , not x8 , x13]
    assert [x4 , not x8 , x9 , x13 , x14]
    assert [not x4 , not x8 , not x9 , x13 , x14]
    assert [not x4 , not x8 , x9 , x13 , not x14]
    assert [x4 , not x8 , not x9 , x13 , not x14]
    assert [x1 , x2 , not x3 , not x8 , not x13]
    assert [x2 , x3 , x6 , x8 , not x13]
    assert [x2 , not x3 , x6 , not x8 , not x13]
    assert [x3 , not x4 , x9 , not x13 , x14]
    assert [x3 , x4 , not x9 , not x13 , x14]
    assert [not x4 , x8 , x9 , not x13 , x14]
    assert [x4 , x8 , not x9 , not x13 , x14]
    assert [x3 , x4 , x9 , not x13 , not x14]
    assert [x4 , x8 , x9 , not x13 , not x14]
    assert [x3 , not x7 , x8 , x12 , x13]
    assert [not x3 , not x7 , not x8 , x12 , x13]
    assert [x3 , not x7 , not x8 , x12 , not x13]
    assert [not x3 , x7 , x8 , not x12 , x13]
    assert [x3 , x7 , not x8 , not x12 , x13]
    assert [x3 , x7 , x8 , not x12 , not x13]
    assert [not x3 , x7 , not x8 , not x12 , not x13]
    assert [not x1 , x2 , x7 , x11 , x12]
    assert [not x1 , not x2 , not x7 , x11 , x12]
    assert [not x1 , x2 , not x7 , x11 , not x12]
    assert [x2 , x3 , x8 , not x11 , not x13]
    assert [x3 , x5 , x8 , x10 , not x14 , not x15]
    assert [x3 , x5 , x10 , not x13 , not x14 , not x15]
    assert [x5 , x8 , x10 , not x13 , not x14 , not x15]
    assert [not x3 , x4 , not x7 , x9 , x12 , x14]
    assert [not x3 , not x4 , not x7 , not x9 , x12 , x14]
    assert [not x3 , not x4 , not x7 , x9 , x12 , not x14]
    assert [not x3 , x4 , not x7 , not x9 , x12 , not x14]
    assert [not x1 , not x2 , x3 , x8 , x11 , x13]
    assert [not x1 , not x2 , not x3 , not x8 , x11 , x13]
    assert [not x1 , not x2 , x3 , not x8 , x11 , not x13]
    assert [not x1 , not x2 , not x3 , x4 , x9 , x11 , x14]
    assert [not x1 , not x2 , not x3 , not x4 , not x9 , x11 , x14]
    assert [not x1 , not x2 , not x3 , not x4 , x9 , x11 , not x14]
    assert [not x1 , not x2 , not x3 , x4 , not x9 , x11 , not x14]

times5 [x1,x2,x3,x4,x5] [x6,x7,x8,x9,x10] [x11,x12,x13,x14,x15] = do
    assert [not x5 , not x10]
    assert [not x5 , x15]
    assert [not x10 , x15]
    assert [not x4 , not x5 , not x9]
    assert [not x4 , not x9 , not x10]
    assert [not x4 , not x9 , x15]
    assert [not x4 , not x5 , x14]
    assert [not x4 , not x10 , x14]
    assert [not x5 , not x9 , x14]
    assert [not x9 , not x10 , x14]
    assert [not x4 , x14 , x15]
    assert [not x9 , x14 , x15]
    assert [not x1 , x6 , x11]
    assert [x1 , x6 , not x11]
    assert [not x1 , not x6 , not x11]
    assert [x1 , x2 , not x7 , x12]
    assert [x1 , x2 , x7 , not x12]
    assert [x1 , not x2 , not x7 , not x12]
    assert [x2 , x6 , x7 , not x12]
    assert [x2 , not x7 , not x11 , x12]
    assert [not x2 , not x7 , not x11 , not x12]
    assert [x4 , x5 , x9 , x10 , not x15]
    assert [x3 , not x4 , x8 , x9 , x14]
    assert [x3 , x4 , x8 , not x9 , x14]
    assert [not x3 , x4 , not x8 , x9 , x14]
    assert [not x3 , not x4 , not x8 , not x9 , x14]
    assert [x3 , x4 , x8 , x9 , not x14]
    assert [not x3 , not x4 , not x8 , x9 , not x14]
    assert [not x3 , x4 , not x8 , not x9 , not x14]
    assert [x1 , not x3 , x7 , x8 , x13]
    assert [x1 , x3 , x7 , not x8 , x13]
    assert [not x3 , x6 , x7 , x8 , x13]
    assert [not x3 , x4 , x9 , x13 , x14]
    assert [not x3 , not x4 , not x9 , x13 , x14]
    assert [x4 , not x8 , x9 , x13 , x14]
    assert [not x4 , not x8 , not x9 , x13 , x14]
    assert [not x3 , not x4 , x9 , x13 , not x14]
    assert [not x3 , x4 , not x9 , x13 , not x14]
    assert [not x4 , not x8 , x9 , x13 , not x14]
    assert [x4 , not x8 , not x9 , x13 , not x14]
    assert [x1 , x3 , x7 , x8 , not x13]
    assert [x1 , not x3 , x7 , not x8 , not x13]
    assert [x3 , x6 , x7 , x8 , not x13]
    assert [not x3 , x6 , x7 , not x8 , not x13]
    assert [x3 , not x4 , x9 , not x13 , x14]
    assert [x3 , x4 , not x9 , not x13 , x14]
    assert [not x4 , x8 , x9 , not x13 , x14]
    assert [x4 , x8 , not x9 , not x13 , x14]
    assert [x3 , x4 , x9 , not x13 , not x14]
    assert [x4 , x8 , x9 , not x13 , not x14]
    assert [not x2 , x3 , x8 , x12 , x13]
    assert [not x2 , not x3 , not x8 , x12 , x13]
    assert [not x2 , not x3 , x8 , x12 , not x13]
    assert [not x2 , x3 , not x8 , x12 , not x13]
    assert [x2 , not x3 , x8 , not x12 , x13]
    assert [x2 , x3 , not x8 , not x12 , x13]
    assert [x2 , x3 , x8 , not x12 , not x13]
    assert [x2 , not x3 , not x8 , not x12 , not x13]
    assert [x2 , not x6 , x7 , x11 , x12]
    assert [not x2 , not x6 , not x7 , x11 , x12]
    assert [not x2 , not x6 , x7 , x11 , not x12]
    assert [x3 , x7 , not x8 , not x11 , x13]
    assert [x3 , x5 , x8 , x10 , not x14 , not x15]
    assert [x3 , x5 , x10 , not x13 , not x14 , not x15]
    assert [x5 , x8 , x10 , not x13 , not x14 , not x15]
    assert [x3 , not x6 , not x7 , x8 , x11 , x13]
    assert [not x3 , not x6 , not x7 , not x8 , x11 , x13]
    assert [not x3 , not x6 , not x7 , x8 , x11 , not x13]
    assert [x3 , not x6 , not x7 , not x8 , x11 , not x13]
