<?xml version="1.0" encoding="UTF-8"?>
<!-- RuleML 1.0: family relationship rules with ancestor derivation -->
<RuleML xmlns="http://ruleml.org/spec/RuleML/1.0/xsd/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Assert>
    <!-- parent(X,Y) :- father(X,Y) -->
    <Implies>
      <if>
        <Atom>
          <Rel>father</Rel>
          <Var>x</Var>
          <Var>y</Var>
        </Atom>
      </if>
      <then>
        <Atom>
          <Rel>parent</Rel>
          <Var>x</Var>
          <Var>y</Var>
        </Atom>
      </then>
    </Implies>
    <!-- parent(X,Y) :- mother(X,Y) -->
    <Implies>
      <if>
        <Atom>
          <Rel>mother</Rel>
          <Var>x</Var>
          <Var>y</Var>
        </Atom>
      </if>
      <then>
        <Atom>
          <Rel>parent</Rel>
          <Var>x</Var>
          <Var>y</Var>
        </Atom>
      </then>
    </Implies>
    <!-- ancestor(X,Y) :- parent(X,Y) -->
    <Implies>
      <if>
        <Atom>
          <Rel>parent</Rel>
          <Var>x</Var>
          <Var>y</Var>
        </Atom>
      </if>
      <then>
        <Atom>
          <Rel>ancestor</Rel>
          <Var>x</Var>
          <Var>y</Var>
        </Atom>
      </then>
    </Implies>
    <!-- ancestor(X,Z) :- parent(X,Y), ancestor(Y,Z) -->
    <Implies>
      <if>
        <And>
          <Atom>
            <Rel>parent</Rel>
            <Var>x</Var>
            <Var>y</Var>
          </Atom>
          <Atom>
            <Rel>ancestor</Rel>
            <Var>y</Var>
            <Var>z</Var>
          </Atom>
        </And>
      </if>
      <then>
        <Atom>
          <Rel>ancestor</Rel>
          <Var>x</Var>
          <Var>z</Var>
        </Atom>
      </then>
    </Implies>
    <!-- Facts -->
    <Atom>
      <Rel>father</Rel>
      <Ind>Tom</Ind>
      <Ind>Bob</Ind>
    </Atom>
    <Atom>
      <Rel>mother</Rel>
      <Ind>Sue</Ind>
      <Ind>Bob</Ind>
    </Atom>
    <Atom>
      <Rel>father</Rel>
      <Ind>Bob</Ind>
      <Ind>Alice</Ind>
    </Atom>
  </Assert>
</RuleML>
