問題4-42

嘘つきパズルを解きます。ある人が試験の結果について、二つの証言をしているわけですが、その証言のどちらかが本当でどちらかが嘘だという条件です。そのため(or (and 証言1 (not 証言2)) (and (not 証言1) 証言2))ということになるのではないかと思いました。それを表現すると、以下のような手続きになります。

(define (liar)
  (let ((Berry (amb 1 2 3 4 5))
        (Ethel (amb 1 2 3 4 5))
        (Joan (amb 1 2 3 4 5))
        (Kitty (amb 1 2 3 4 5))
        (Mary (amb 1 2 3 4 5)))
    (require
     (distinct? (list Berry Ethel Joan Kitty Mary)))
    (require (or (and (= Kitty 2) (not (= Betty 3)))
                 (and (not (= Kitty 2)) (= Betty 3))))
    (require (or (and (= Ethel 1) (not (= Joan 2)))
                 (and (not (= Ethel 1)) (= Joan 2))))
    (require (or (and (= Joan 3) (not (= Ethel 5)))
                 (and (not (= Joan 3)) (= Ethel 5))))
    (require (or (and (= Kitty 2) (not (= Marry 4)))
                 (and (not (= Kitty 2)) (= Marry 4))))
    (require (or (and (= Mary 4) (not (= Betty 1)))
                 (and (not (= Mary 4)) (= Betty 1))))
    (list (list 'Betty Betty)
          (list 'Ethel Ethel)
          (list 'Joan Joan)
          (list 'Kitty Kitty)
          (list 'Mary Mary))))

この結果がどうなるかは、頭がこんがらがってよくわかりませんでした。amb評価器を動かせるようになったら実験してみたいと思っています。
問題4-43〜44は、見るからに難しそうだったので飛ばしました。