Home More Samples
```///////////////////////////////////////////////////////////////////////////////
//
// Title: Arch Friends
// Author: Mark T. Zegarelli
// Publication: Dell Logic Puzzles
// Issue: April, 1998
// Page: 7
// Stars: 1
//
// Harriet, upon returning from the mall, is happily describing her four shoe
// purchases to her friend Aurora. Aurora just loves the four different kinds
// of shoes that Harriet bought (ecru espadrilles, fuchsia flats, purple
// pumps, and suede sandals), but Harriet can't recall at which different store
// (Foot Farm, Heels in a Handcart, The Shoe Palace, or Tootsies) she got each
// pair. Can you help these two figure out the order in which Harriet bought
// each pair of shoes, and where she bought each?
//
// 1. Harriet bought fuchsia flats at Heels in a Handcart.
// 2. The store she visited just after buying her purple pumps was not Tootsies.
// 3. The Foot Farm was Harriet's second stop.
// 4. Two stops after leaving The Shoe Place, Harriet bought her suede sandals.
//
///////////////////////////////////////////////////////////////////////////////
//
// query:
//          all ArchFriends(store,order)
//
///////////////////////////////////////////////////////////////////////////////
//
// result:
//
// store = [ {Ecru_Espadrilles} Foot_Farm, {Fuchsia_Flats} Heels_in_a_Handcart,
//           {Purple_Pumps} Shoe_Palace, {Suede_Sandals} Tootsies]
//
// order = [ {Foot_Farm} 2, {Heels_in_a_Handcart} 4, {Shoe_Palace} 1,
//           {Tootsies} 3]
//
///////////////////////////////////////////////////////////////////////////////

ShoeBrands = Ecru_Espadrilles | Fuchsia_Flats | Purple_Pumps | Suede_Sandals
ShoeStore = Foot_Farm | Heels_in_a_Handcart | Shoe_Palace | Tootsies

Store = ShoeBrands->>ShoeStore
Order = ShoeStore->>I[1..4]

pred ArchFriends(store::Store,order::Order) iff
{1} store(Fuchsia_Flats) = Heels_in_a_Handcart &
{2} order(Tootsies) = x & order(store(Purple_Pumps)) = y & x <> y + 1 &
{3} order(Foot_Farm) = 2 &
{4} order(store(Suede_Sandals)) = order(Shoe_Palace) + 2

```