PasteRack.org
Paste # 46697
2023-03-14 19:22:15

Fork as a new paste.

Paste viewed 205 times.


Embed:

  1. #lang racket
  2. (require rackunit)
  3. (require rackunit/text-ui)
  4. (require racket/format) ; needed to use ~a to convert integers to strings
  5.  
  6. ; Pre-defined functions
  7. (define (is-constant? E) (or (equal? E 'TRUE) (equal? E 'FALSE)))
  8. (define (is-variable? E) (not (or (list? E) (is-constant? E) (equal? E 'OR) (equal? E 'AND)
  9.                                   (equal? E 'NOT) (equal? E 'IMPLIES) (equal? E 'EQUIV))))
  10. (define (is-OR? E) (and (list? E) (equal? (length E) 3)(equal? (first E) 'OR) (legal? (second E)) (legal? (third E))))
  11. (define (is-XOR? E) (and (list? E) (equal? (length E) 3)(equal? (first E) 'XOR)(legal? (second E)) (legal? (third E))))
  12. (define (is-AND? E) (and (list? E) (equal? (length E) 3) (equal? 'AND (first E))(legal? (second E)) (legal? (third E))))
  13. (define (is-NOT? E) (and (list? E) (equal? (length E) 2)(equal? 'NOT (first E))(legal? (second E))))
  14. (define (is-IMPLIES? E) (and (list? E) (equal? (length E) 3)(equal? 'IMPLIES (first E))(legal? (second E)) (legal? (third E))))
  15. (define (is-EQUIV? E) (and (list? E) (equal? (length E) 3)(equal? 'EQUIV (first E))(legal? (second E)) (legal? (third E))))
  16. (define (legal? E)(or (is-constant? E)(is-variable? E)(is-OR? E)(is-XOR? E)(is-AND? E)(is-NOT? E)(is-IMPLIES? E)(is-EQUIV? E)))
  17.  
  18. #|
  19. Also, here is an example of a useful utility function (you may
  20. also wish to use it in the cnf function you implement yourself)
  21.  
  22. input contract: E is the representation of the logical expression, expr
  23. output contract: (noANDs? E) returns #t if there are no conjunctions in expr, and #f otherwise.
  24. |#
  25. (define/contract (noANDs? E)
  26.   (-> legal? boolean?)
  27.   (cond
  28.     [(or (is-variable? E) (is-constant? E)) #t]
  29.     [(is-AND? E) #f]
  30.     [(is-NOT? E) (noANDs? (second E))]
  31.     [else (and (noANDs? (second E)) (noANDs? (third E)))]))
  32.  
  33. ; Question 1: write a function according to the specifications below
  34. ; input contract: E is the representation of the logical expression, expr
  35. ; output contract: (cnf? E) returns #t if expr is CNF, and #f otherwise
  36. ; Examples: (cnf? '(AND (OR X (OR Y (NOT Z))) (AND (NOT X) TRUE))) should return #t since "(x  y  ¬z)  x  true" is in CNF,
  37. ; also, (cnf? '(AND (OR X Y) (OR X (AND Y Z)))) should return #f since "(x  y)  (x  (y  z))" is not in CNF
  38.  
  39. (define (and? expr)
  40.   (and (pair? expr) (eq? (car expr) 'AND) (= (length expr) 3)))
  41.  
  42. (define (or? expr)
  43.   (and (pair? expr) (eq? (car expr) 'OR) (= (length expr) 3)))
  44.  
  45. (define (cnf? expr)
  46.   (and-level expr))
  47.  
  48. (define (and-level expr)
  49.   (cond ((and? expr)
  50.          (and (and-level (car expr))
  51.               (and-level (cdr expr))))
  52.         (else (or-level expr))))
  53.  
  54. (define (or-level expr)
  55.   (cond ((or? expr)
  56.          (or (or-level (car expr))
  57.              (or-level (cdr expr))))
  58.         (else (literal-level expr))))
  59.  
  60. (define (literal-level expr)
  61.   (cond ((not (pair? expr))
  62.          #t)
  63.         ((eq? (car expr) 'NOT)
  64.          (not (var-or-const (cadr expr))))
  65.         (else (var-or-const expr))))
  66.  
  67. (define (var-or-const expr)
  68.   (cond ((eq? expr 'VARIABLE) #t)
  69.         ((eq? expr 'CONSTANT) #t)
  70.         (else #f)))
  71.  
  72.  
  73. ; Question 2: write a function according to the specifications below
  74. ; input contract: E is the representation of the logical expression, expr
  75. ; output contract: (makeCNF E) returns a representation of expr in CNF
  76. ; Examples:  (makeCNF '(IMPLIES P (AND Q R))) would be '(AND (OR (NOT P) Q) (OR (NOT P) R))
  77.  
  78. (define (makeCNF E)
  79.   #t)
  80.  
  81. (define-test-suite cnf?-suite
  82.   (test-equal? "" (cnf? 'P) #t)
  83.   (test-equal? "" (cnf? 'FALSE) #t)
  84.   (test-equal? "" (cnf? '(NOT FALSE)) #t)
  85.   (test-equal? "" (cnf? '(NOT P)) #t)
  86.   (test-equal? "" (cnf? '(NOT (NOT P))) #f)
  87.   (test-equal? "" (cnf? '(OR P Q)) #t)
  88.   (test-equal? "" (cnf? '(XOR P Q)) #f)
  89.   (test-equal? "" (cnf? '(AND P Q)) #t)
  90.   (test-equal? "" (cnf? '(IMPLIES P Q)) #f)
  91.   (test-equal? "" (cnf? '(EQUIV P Q)) #f)
  92.   (test-equal? "" (cnf? '(OR P (NOT Q))) #t)
  93.   (test-equal? "" (cnf? '(NOT (OR P Q))) #f)
  94.   (test-equal? "" (cnf? '(AND (AND (OR L (OR M N)) (OR P (OR Q R))) (OR S (OR T W)))) #t)
  95.   (test-equal? "" (cnf? '(AND (OR (OR L M) N) (AND (OR (OR P Q) R) (OR (OR S T) W)))) #t)
  96.   (test-equal? "" (cnf? '(AND (OR (OR L M) N) (AND (OR (OR P Q) R) (OR (AND S T) W)))) #f)
  97.   (test-equal? "" (cnf? '(OR (OR (OR (XOR P Q) R) S) T)) #f)
  98.   (test-equal? "" (cnf? '(AND (AND (AND (AND P (NOT Q)) R) S) T)) #t)
  99.   (test-equal? "" (cnf? '(AND (AND (AND (AND P (NOT (NOT Q))) R) S) T)) #f)
  100.   (test-equal? "" (cnf? '(AND (OR x (OR y (NOT z))) (AND (NOT x) TRUE))) #t)
  101.   (test-equal? "" (cnf? '(AND (OR x y) (OR x (AND y z)))) #f))
  102. (define Q1Pts (- 20 (run-tests cnf?-suite 'verbose)))
  103.  
  104. (define-test-suite cnf-suite
  105.   (test-equal? "" (makeCNF 'TRUE) 'TRUE)
  106.   (test-equal? "" (makeCNF 'P) 'P)
  107.   (test-equal? "" (makeCNF '(NOT P)) '(NOT P))
  108.   (test-equal? "" (makeCNF '(NOT TRUE)) 'FALSE)
  109.   (test-equal? "" (makeCNF '(NOT (NOT P))) 'P)
  110.   (test-equal? "" (makeCNF '(OR P Q)) '(OR P Q))
  111.   (test-equal? "" (makeCNF '(AND P Q)) '(AND P Q))
  112.   (test-equal? "" (makeCNF '(NOT (AND P Q))) '(OR (NOT P) (NOT Q)))
  113.   (test-equal? "" (makeCNF '(XOR P Q)) '(AND (OR P Q) (OR (NOT P) (NOT Q))))
  114.   (test-equal? "" (makeCNF '(NOT (XOR (XOR P Q) R)))
  115.                '(AND(AND(OR(OR(NOT P)Q)R)(OR(OR(NOT Q)P)R))(AND(OR(NOT R)(OR P Q))(OR(NOT R)(OR(NOT P)(NOT Q))))))
  116.   (test-equal? "" (makeCNF '(IMPLIES P Q)) '(OR (NOT P) Q))
  117.   (test-equal? "" (makeCNF '(NOT (IMPLIES P Q))) '(AND P (NOT Q)))
  118.   (test-equal? "" (makeCNF '(IMPLIES P (IMPLIES Q R))) '(OR (NOT P) (OR (NOT Q) R)))
  119.   (test-equal? "" (makeCNF '(IMPLIES (IMPLIES P Q) R)) '(AND (OR P R) (OR (NOT Q) R)))
  120.   (test-equal? "" (makeCNF '(EQUIV P Q)) '(AND (OR (NOT P) Q) (OR (NOT Q) P)))
  121.   (test-equal? "" (makeCNF '(NOT (XOR P Q))) '(AND (OR (NOT P) Q) (OR (NOT Q) P)))
  122.   (test-equal? "" (makeCNF '(NOT (EQUIV P Q))) '(AND (OR P Q) (OR (NOT P) (NOT Q))))
  123.   (test-equal? "" (makeCNF '(OR (AND S (NOT FALSE)) (IMPLIES Q (EQUIV TRUE (NOT (NOT (NOT Q))))))) '(AND(AND(OR S(OR(NOT Q)(OR FALSE(NOT Q))))(OR S(OR(NOT Q)(OR Q TRUE))))(AND(OR TRUE(OR(NOT Q)(OR FALSE(NOT Q))))(OR TRUE(OR(NOT Q)(OR Q TRUE))))))
  124.   (test-equal? "" (makeCNF '(OR (OR (OR (AND L M) (AND N P)) (AND Q R)) (AND S T))) '(AND(AND(AND(AND(OR(OR(OR L N)Q)S)(OR(OR(OR L N)Q)T))(AND(OR(OR(OR L N)R)S)(OR(OR(OR L N)R)T)))(AND(AND(OR(OR(OR L P)Q)S)(OR(OR(OR L P)Q)T))(AND(OR(OR(OR L P)R)S)(OR(OR(OR L P)R)T))))(AND(AND(AND(OR(OR(OR M N)Q)S)(OR(OR(OR M N)Q)T))(AND(OR(OR(OR M N)R)S)(OR(OR(OR M N)R)T)))(AND(AND(OR(OR(OR M P)Q)S)(OR(OR(OR M P)Q)T))(AND(OR(OR(OR M P)R)S)(OR(OR(OR M P)R)T))))))
  125.   (test-equal? "" (makeCNF '(OR (OR (AND X (AND P Q)) (AND Y (AND R S))) (AND A (AND B C)))) '(AND(AND(AND(OR(OR X Y)A)(AND(OR(OR X Y)B)(OR(OR X Y)C)))(AND(AND(OR(OR X R)A)(AND(OR(OR X R)B)(OR(OR X R)C)))(AND(OR(OR X S)A)(AND(OR(OR X S)B)(OR(OR X S)C)))))(AND(AND(AND(OR(OR P Y)A)(AND(OR(OR P Y)B)(OR(OR P Y)C)))(AND(AND(OR(OR P R)A)(AND(OR(OR P R)B)(OR(OR P R)C)))(AND(OR(OR P S)A)(AND(OR(OR P S)B)(OR(OR P S)C)))))(AND(AND(OR(OR Q Y)A)(AND(OR(OR Q Y)B)(OR(OR Q Y)C)))(AND(AND(OR(OR Q R)A)(AND(OR(OR Q R)B)(OR(OR Q R)C)))(AND(OR(OR Q S)A)(AND(OR(OR Q S)B)(OR(OR Q S)C)))))))))
  126. (define cnfPts (- 20 (run-tests cnf-suite 'verbose)))
  127. (display "Q1 passed ")
  128. (display Q1Pts)
  129. (display "/20\n")
  130. (display "Q2 passed ")(display cnfPts)(display "/20\n")

=>

--------------------

cnf?-suite >

FAILURE

name:        check-equal?

location:    eval:20:0

expression:  (check-equal? (cnf? (quote (NOT (NOT P)))) #f)

params:      '(#t #f)

actual:      #t

expected:    #f

--------------------

--------------------

cnf?-suite >

FAILURE

name:        check-equal?

location:    eval:20:0

expression:  (check-equal? (cnf? (quote (AND P Q))) #t)

params:      '(#f #t)

actual:      #f

expected:    #t

--------------------

--------------------

cnf?-suite >

FAILURE

name:        check-equal?

location:    eval:20:0

expression:  (check-equal? (cnf? (quote (NOT (OR P Q)))) #f)

params:      '(#t #f)

actual:      #t

expected:    #f

--------------------

--------------------

cnf?-suite >

FAILURE

name:        check-equal?

location:    eval:20:0

expression:

  (check-equal? (cnf? (quote (AND (AND (OR L (OR M N)) (OR P (OR Q R))) (OR S (OR T W))))) #t)

params:      '(#f #t)

actual:      #f

expected:    #t

--------------------

--------------------

cnf?-suite >

FAILURE

name:        check-equal?

location:    eval:20:0

expression:

  (check-equal? (cnf? (quote (AND (OR (OR L M) N) (AND (OR (OR P Q) R) (OR (OR S T) W))))) #t)

params:      '(#f #t)

actual:      #f

expected:    #t

--------------------

--------------------

cnf?-suite >

FAILURE

name:        check-equal?

location:    eval:20:0

expression:  (check-equal? (cnf? (quote (OR (OR (OR (XOR P Q) R) S) T))) #f)

params:      '(#t #f)

actual:      #t

expected:    #f

--------------------

--------------------

cnf?-suite >

FAILURE

name:        check-equal?

location:    eval:20:0

expression:

  (check-equal? (cnf? (quote (AND (AND (AND (AND P (NOT Q)) R) S) T))) #t)

params:      '(#f #t)

actual:      #f

expected:    #t

--------------------

--------------------

cnf?-suite >

FAILURE

name:        check-equal?

location:    eval:20:0

expression:

  (check-equal? (cnf? (quote (AND (OR x (OR y (NOT z))) (AND (NOT x) TRUE)))) #t)

params:      '(#f #t)

actual:      #f

expected:    #t

--------------------

12 success(es) 8 failure(s) 0 error(s) 20 test(s) run

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:  (check-equal? (makeCNF (quote TRUE)) (quote TRUE))

params:      '(#t TRUE)

actual:      #t

expected:    'TRUE

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:  (check-equal? (makeCNF (quote P)) (quote P))

params:      '(#t P)

actual:      #t

expected:    'P

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:  (check-equal? (makeCNF (quote (NOT P))) (quote (NOT P)))

params:      '(#t (NOT P))

actual:      #t

expected:    '(NOT P)

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:  (check-equal? (makeCNF (quote (NOT TRUE))) (quote FALSE))

params:      '(#t FALSE)

actual:      #t

expected:    'FALSE

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:  (check-equal? (makeCNF (quote (NOT (NOT P)))) (quote P))

params:      '(#t P)

actual:      #t

expected:    'P

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:  (check-equal? (makeCNF (quote (OR P Q))) (quote (OR P Q)))

params:      '(#t (OR P Q))

actual:      #t

expected:    '(OR P Q)

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:  (check-equal? (makeCNF (quote (AND P Q))) (quote (AND P Q)))

params:      '(#t (AND P Q))

actual:      #t

expected:    '(AND P Q)

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (NOT (AND P Q)))) (quote (OR (NOT P) (NOT Q))))

params:      '(#t (OR (NOT P) (NOT Q)))

actual:      #t

expected:    '(OR (NOT P) (NOT Q))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (XOR P Q))) (quote (AND (OR P Q) (OR (NOT P) (NOT Q)))))

params:      '(#t (AND (OR P Q) (OR (NOT P) (NOT Q))))

actual:      #t

expected:    '(AND (OR P Q) (OR (NOT P) (NOT Q)))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (NOT (XOR (XOR P Q) R)))) (quote (AND (AND (OR (OR (NOT P) Q) R) (OR (OR (NOT Q) P) R)) (AND (OR (NOT R) (OR P Q)) (OR (NOT R) (OR (NOT P) (NOT Q)))))))

params:

  '(#t

    (AND

     (AND (OR (OR (NOT P) Q) R) (OR (OR (NOT Q) P) R))

     (AND (OR (NOT R) (OR P Q)) (OR (NOT R) (OR (NOT P) (NOT Q))))))

actual:      #t

expected:

  '(AND

    (AND (OR (OR (NOT P) Q) R) (OR (OR (NOT Q) P) R))

    (AND (OR (NOT R) (OR P Q)) (OR (NOT R) (OR (NOT P) (NOT Q)))))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (IMPLIES P Q))) (quote (OR (NOT P) Q)))

params:      '(#t (OR (NOT P) Q))

actual:      #t

expected:    '(OR (NOT P) Q)

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (NOT (IMPLIES P Q)))) (quote (AND P (NOT Q))))

params:      '(#t (AND P (NOT Q)))

actual:      #t

expected:    '(AND P (NOT Q))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (IMPLIES P (IMPLIES Q R)))) (quote (OR (NOT P) (OR (NOT Q) R))))

params:      '(#t (OR (NOT P) (OR (NOT Q) R)))

actual:      #t

expected:    '(OR (NOT P) (OR (NOT Q) R))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (IMPLIES (IMPLIES P Q) R))) (quote (AND (OR P R) (OR (NOT Q) R))))

params:      '(#t (AND (OR P R) (OR (NOT Q) R)))

actual:      #t

expected:    '(AND (OR P R) (OR (NOT Q) R))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (EQUIV P Q))) (quote (AND (OR (NOT P) Q) (OR (NOT Q) P))))

params:      '(#t (AND (OR (NOT P) Q) (OR (NOT Q) P)))

actual:      #t

expected:    '(AND (OR (NOT P) Q) (OR (NOT Q) P))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (NOT (XOR P Q)))) (quote (AND (OR (NOT P) Q) (OR (NOT Q) P))))

params:      '(#t (AND (OR (NOT P) Q) (OR (NOT Q) P)))

actual:      #t

expected:    '(AND (OR (NOT P) Q) (OR (NOT Q) P))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (NOT (EQUIV P Q)))) (quote (AND (OR P Q) (OR (NOT P) (NOT Q)))))

params:      '(#t (AND (OR P Q) (OR (NOT P) (NOT Q))))

actual:      #t

expected:    '(AND (OR P Q) (OR (NOT P) (NOT Q)))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (OR (AND S (NOT FALSE)) (IMPLIES Q (EQUIV TRUE (NOT (NOT (NOT Q)))))))) (quote (AND (AND (OR S (OR (NOT Q) (OR FALSE (NOT Q)))) (OR S (OR (NOT Q) (OR Q TRUE)))) (AND (OR TRUE (OR (NOT Q) (OR FALSE (NOT Q)))) (OR TRUE (OR (NOT Q) (OR Q TRUE)))))))

params:

  '(#t

    (AND

     (AND (OR S (OR (NOT Q) (OR FALSE (NOT Q)))) (OR S (OR (NOT Q) (OR Q TRUE))))

     (AND

      (OR TRUE (OR (NOT Q) (OR FALSE (NOT Q))))

      (OR TRUE (OR (NOT Q) (OR Q TRUE))))))

actual:      #t

expected:

  '(AND

    (AND (OR S (OR (NOT Q) (OR FALSE (NOT Q)))) (OR S (OR (NOT Q) (OR Q TRUE))))

    (AND

     (OR TRUE (OR (NOT Q) (OR FALSE (NOT Q))))

     (OR TRUE (OR (NOT Q) (OR Q TRUE)))))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (OR (OR (OR (AND L M) (AND N P)) (AND Q R)) (AND S T)))) (quote (AND (AND (AND (AND (OR (OR (OR L N) Q) S) (OR (OR (OR L N) Q) T)) (AND (OR (OR (OR L N) R) S) (OR (OR (OR L N) R) T))) (AND (AND (OR (OR (OR L P) Q) S) (OR (OR (OR L P) Q) T)) (AND (OR (OR (OR L P) R) S) (OR (OR (OR L P) R) T)))) (AND (AND (AND (OR (OR (OR M N) Q) S) (OR (OR (OR M N) Q) T)) (AND (OR (OR (OR M N) R) S) (OR (OR (OR M N) R) T))) (AND (AND (OR (OR (OR M P) Q) S) (OR (OR (OR M P) Q) T)) (AND (OR (OR (OR M P) R) S) (OR (OR (OR M P) R) T)))))))

params:

  '(#t

    (AND

     (AND

      (AND

       (AND (OR (OR (OR L N) Q) S) (OR (OR (OR L N) Q) T))

       (AND (OR (OR (OR L N) R) S) (OR (OR (OR L N) R) T)))

      (AND

       (AND (OR (OR (OR L P) Q) S) (OR (OR (OR L P) Q) T))

       (AND (OR (OR (OR L P) R) S) (OR (OR (OR L P) R) T))))

     (AND

      (AND

       (AND (OR (OR (OR M N) Q) S) (OR (OR (OR M N) Q) T))

       (AND (OR (OR (OR M N) R) S) (OR (OR (OR M N) R) T)))

      (AND

       (AND (OR (OR (OR M P) Q) S) (OR (OR (OR M P) Q) T))

       (AND (OR (OR (OR M P) R) S) (OR (OR (OR M P) R) T))))))

actual:      #t

expected:

  '(AND

    (AND

     (AND

      (AND (OR (OR (OR L N) Q) S) (OR (OR (OR L N) Q) T))

      (AND (OR (OR (OR L N) R) S) (OR (OR (OR L N) R) T)))

     (AND

      (AND (OR (OR (OR L P) Q) S) (OR (OR (OR L P) Q) T))

      (AND (OR (OR (OR L P) R) S) (OR (OR (OR L P) R) T))))

    (AND

     (AND

      (AND (OR (OR (OR M N) Q) S) (OR (OR (OR M N) Q) T))

      (AND (OR (OR (OR M N) R) S) (OR (OR (OR M N) R) T)))

     (AND

      (AND (OR (OR (OR M P) Q) S) (OR (OR (OR M P) Q) T))

      (AND (OR (OR (OR M P) R) S) (OR (OR (OR M P) R) T)))))

--------------------

--------------------

cnf-suite >

FAILURE

name:        check-equal?

location:    eval:22:0

expression:

  (check-equal? (makeCNF (quote (OR (OR (AND X (AND P Q)) (AND Y (AND R S))) (AND A (AND B C))))) (quote (AND (AND (AND (OR (OR X Y) A) (AND (OR (OR X Y) B) (OR (OR X Y) C))) (AND (AND (OR (OR X R) A) (AND (OR (OR X R) B) (OR (OR X R) C))) (AND (OR (OR X S) A) (AND (OR (OR X S) B) (OR (OR X S) C))))) (AND (AND (AND (OR (OR P Y) A) (AND (OR (OR P Y) B) (OR (OR P Y) C))) (AND (AND (OR (OR P R) A) (AND (OR (OR P R) B) (OR (OR P R) C))) (AND (OR (OR P S) A) (AND (OR (OR P S) B) (OR (OR P S) C))))) (AND (AND (OR (OR Q Y) A) (AND (OR (OR Q Y) B) (OR (OR Q Y) C))) (AND (AND (OR (OR Q R) A) (AND (OR (OR Q R) B) (OR (OR Q R) C))) (AND (OR (OR Q S) A) (AND (OR (OR Q S) B) (OR (OR Q S) C)))))))))

params:

  '(#t

    (AND

     (AND

      (AND (OR (OR X Y) A) (AND (OR (OR X Y) B) (OR (OR X Y) C)))

      (AND

       (AND (OR (OR X R) A) (AND (OR (OR X R) B) (OR (OR X R) C)))

       (AND (OR (OR X S) A) (AND (OR (OR X S) B) (OR (OR X S) C)))))

     (AND

      (AND

       (AND (OR (OR P Y) A) (AND (OR (OR P Y) B) (OR (OR P Y) C)))

       (AND

        (AND (OR (OR P R) A) (AND (OR (OR P R) B) (OR (OR P R) C)))

        (AND (OR (OR P S) A) (AND (OR (OR P S) B) (OR (OR P S) C)))))

      (AND

       (AND (OR (OR Q Y) A) (AND (OR (OR Q Y) B) (OR (OR Q Y) C)))

       (AND

        (AND (OR (OR Q R) A) (AND (OR (OR Q R) B) (OR (OR Q R) C)))

        (AND (OR (OR Q S) A) (AND (OR (OR Q S) B) (OR (OR Q S) C))))))))

actual:      #t

expected:

  '(AND

    (AND

     (AND (OR (OR X Y) A) (AND (OR (OR X Y) B) (OR (OR X Y) C)))

     (AND

      (AND (OR (OR X R) A) (AND (OR (OR X R) B) (OR (OR X R) C)))

      (AND (OR (OR X S) A) (AND (OR (OR X S) B) (OR (OR X S) C)))))

    (AND

     (AND

      (AND (OR (OR P Y) A) (AND (OR (OR P Y) B) (OR (OR P Y) C)))

      (AND

       (AND (OR (OR P R) A) (AND (OR (OR P R) B) (OR (OR P R) C)))

       (AND (OR (OR P S) A) (AND (OR (OR P S) B) (OR (OR P S) C)))))

     (AND

      (AND (OR (OR Q Y) A) (AND (OR (OR Q Y) B) (OR (OR Q Y) C)))

      (AND

       (AND (OR (OR Q R) A) (AND (OR (OR Q R) B) (OR (OR Q R) C)))

       (AND (OR (OR Q S) A) (AND (OR (OR Q S) B) (OR (OR Q S) C)))))))

--------------------

0 success(es) 20 failure(s) 0 error(s) 20 test(s) run

Q1 passed

12

/20

Q2 passed

0

/20