I have problem with that task:
Friends: Jarek, Frank, Stefanie, Albert, Simon, Robert, Marcin
they live in one building, each on a different level (0, 1, 2, …).
Each of them has a different animal:
dog, a cat, a fish, hamster, parrot, snake, canary.
In which floort each of them lives and what kind of animal does it have when bellow sentences are true?
Franek lives lower than Albert. The owner of the parrot lives on floor 6. The canary owner lives on floor 0. Franek has no snake. The snake owner lives on floor 1. Albert doesn’t have a canary. Jarek doesn’t have a parrot. Simon has no snake. Robert has no hamsters. The hamster owner lives on floor 3. Robert lives lower than Stefan. Szymon lives lower than Marcin. Marcin has no fish. The owner of the fish lives on floor 4. Franek doesn’t have a hamster. Albert lives lower than Stefan. The cat owner lives on floor 5. The dog owner lives on floor 2. Szymon lives lower than Jarek. Robert lives higher than Albert. Albert doesn’t have a dog. Franek doesn’t have a dog. Stefan doesn’t have a canary. Franek doesn’t have a cat. Marcin lives higher than Jarek. Stefan doesn’t have a parrot. Franek lives lower than Marcin. Marcin doesn’t have a snake. Marcin lives higher than Albert. Franek has no fish. Szymon lives higher than Stefan. Robert has no fish. Stefan lives higher than Franek. Simon lives higher than Albert. Robert doesn’t have a cat. Marcin lives higher than Robert. Franek lives lower than Szymon. Franek lives lower than Robert. Stefan lives lower than Jarek. Stefan doesn’t have a cat. Jarek lives higher than Franek. Stefan doesn’t have a dog. Jarek lives higher than Robert. Franek doesn’t have a parrot. Stefan has no snake. Albert has no fish. Robert lives lower than Simon. Jarek lives higher than Albert. Albert doesn’t have a cat. Stefan lives lower than Marcin. Albert doesn’t have a parrot. Stefan has no fish. Simon doesn’t have a parrot. Simon doesn’t have a cat. Albert doesn’t have a hamster. Jarek doesn’t have a dog. Simon doesn’t have a hamster. Marcin doesn’t have a dog. Simon doesn’t have a canary. Simon doesn’t have a dog.
I have idea to create two tables with animals and number of floors and then by select check all sentences but I dont know how to crate predicate to check if owner of any animal lives on given floor.