
theory Genealogy

  type person

  type gender = Male | Female

  function gender person : gender

  function father person : person
  function mother person : person

  axiom Father_gender : forall p : person. gender (father p) = Male
  axiom Mother_gender : forall p : person. gender (mother p) = Female

  predicate parent (p : person) (c : person) = p = father c \/ p = mother c

  predicate son (s : person) (p : person) = gender s = Male /\ parent p s
  predicate daughter (d : person) (p : person) = gender d = Female /\ parent p d

  predicate child (c : person) (p : person) = parent p c

  goal Child_is_son_or_daughter:
    forall c p : person. child c p <-> son c p \/ daughter c p

  predicate sibling (p1 : person) (p2 : person) =
    p1 <> p2 /\ (father p1 = father p2 \/ mother p1 = mother p2)

  goal Sibling_sym : forall p1 p2 : person. sibling p1 p2 -> sibling p2 p1

  predicate brother (b : person) (p : person) = sibling b p /\ gender b = Male
  predicate sister  (s : person) (p : person) = sibling s p /\ gender s = Female

  goal Sibling_is_brother_or_sister:
    forall p1 p2 : person. sibling p1 p2 <-> brother p1 p2 \/ sister p1 p2

  predicate grandparent (g : person) ( p : person) =
    parent g (father p) \/ parent g (mother p)

  predicate grandfather (g : person) (p : person) =
    g = father (father p) \/ g = father (mother p)
  predicate grandmother (g : person) (p : person) =
    g = mother (father p) \/ g = mother (mother p)

  goal Grandparent_is_grandfather_or_grandmother:
    forall g p : person. grandparent g p <-> grandfather g p \/ grandmother g p

  goal Grandfather_male:
    forall g p : person. grandfather g p -> gender g = Male
  goal Grandmother_female:
    forall g p : person. grandmother g p -> gender g = Female

  goal Only_two_grandfathers:
     forall g1 g2 g3 p : person.
     grandfather g1 p ->
     grandfather g2 p ->
     grandfather g3 p ->
     (g1 = g2 \/ g2 = g3 \/ g1 = g3)

end
