packages feed

smcdel-1.3.0: Examples/CherylsBirthday.smcdel.txt

-- Cheryls Birthday in SMCDEL

VARS 5,6,7,8,           -- month
     14,15,16,17,18,19  -- day of the month

LAW  AND (
  -- birthday is one of these ten possibilities:
  OR ( (15 & 5), (16 & 5) , (19 & 5)
     , (17 & 6), (18 & 6)
     , (14 & 7), (16 & 7)
     , (14 & 8), (15 & 8), (17 & 8)
     ),
  -- month must be unique:
  ONEOF ( 5, 6, 7, 8 ),
  -- day must be unique:
  ONEOF ( 14, 15, 16, 17, 18, 19 )
  )

OBS  albert:  5,6,7,8            -- knows month
     bernard: 14,15,16,17,18,19  -- knows day

-- list all states
WHERE?
  Top

-- the dialogue
WHERE?
   -- Albert: I don't know when Cheryl's birthday is, ...
   < ! ~ albert knows whether (5,6,7,8,14,15,16,17,18,19) >
   -- ... but I know that Bernard doesn't know too.
   < ! albert knows that (~ (bernard knows whether (5,6,7,8,14,15,16,17,18,19))) >
   -- Bernard: First I did not know when Cheryl's birthday is, but now I know.
   < ! bernard knows whether (5,6,7,8,14,15,16,17,18,19) >
   -- Albert: Then I also know when Cheryl's birthday is.
   < ! albert knows whether (5,6,7,8,14,15,16,17,18,19) >
   -- (show all states where these announcements can be made in this order)
   Top