Skip to content

Commit

Permalink
Remove duplicate entry in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ericbmerritt committed Dec 12, 2011
1 parent 883746c commit 8f3093b
Showing 1 changed file with 0 additions and 92 deletions.
92 changes: 0 additions & 92 deletions README.md
Expand Up @@ -429,98 +429,6 @@ and Anna's brothers, we can use the following function call:
[{brother,bob,alice},{brother,mark,alice},{brother,caesar,anna}]
8>

Deriving new concepts by means of rules
---------------------------------------

#### Concept: 'mother'

The rule to derive the concept of mother is quite straightforward:

if X is female and X is Y's parent then X is Y's mother.

From the point of view of SERESYE, since knowledge is stored in the
*knowledge base* of the engine, the rule above is translated into the
following one: *<u>if the facts *{female, X}* and *{parent, X, Y}* are
**asserted** in the knowledge base, then we assert the fact *{mother,
X, Y}*.</u>*

The rule *mother* can be thus written as follows:


%%
%% if (X is female) and (X is Y's parent) then (X is Y's mother)
%%
mother(Engine, {female, X}, {parent, X, Y}) ->
seresye:assert(Engine, {mother, X, Y}).

#### Concept: 'father'

This concept can be easily derived by means of the following rule:

%%
%% if (X is male) and (X is Y's parent) then (X is Y's father)
%%
father(Engine, {male, X}, {parent, X, Y}) ->
seresye:assert(Engine, {father, X, Y}).


#### Concept: 'sister'

This concept can be expressed by the following rule:

if Y and Z have the same parent and Z is female, then Z is the Y's
sister.

The SERESYE rule used to map this concept is:

%%
%% if (Y and Z have the same parent X) and (Z is female)
%% then (Z is Y's sister)
%%
sister(Engine, {parent, X, Y}, {parent, X, Z}, {female, Z}) when Y =/= Z ->
seresye:assert(Engine, {sister, Z, Y}).

Please note the guard, which is needed to ensure that when Y and Z are
bound to the same value, the rule is not activated (indeed this is possible
since the same fact can match both the first and second
'parent' pattern).

#### Concept: 'brother'

Given the previous one, this concept is now quite simple to
implement:

%%
%% if (Y and Z have the same parent X) and (Z is male)
%% then (Z is Y's brother)
%%
brother(Engine, {parent, X, Y}, {parent, X, Z}, {male, Z}) when Y =/= Z ->
seresye:assert(Engine, {brother, Z, Y}).


#### Concepts: 'grandmother' and 'grandfather'

The former concept can be expressed by means of the rule:

if X is Y's mother and Y is Z's parent, then X is Z's grandmother.

The latter concept is now obvious. Both can be implemented using the
following SERESYE rules:

%%
%% if (X is Y's mother) and (Y is Z's parent)
%% then (X is Z's grandmother)
%%
grandmother(Engine, {mother, X, Y}, {parent, Y, Z}) ->
seresye:assert(Engine, {grandmother, X, Z}).

%%
%% if (X is Y's father) and (Y is Z's parent)
%% then (X is Z's grandfather)
%%
grandfather(Engine, {father, X, Y}, {parent, Y, Z}) ->
seresye:assert(Engine, {grandfather, X, Z}).


Conclusions
-----------
Expand Down

0 comments on commit 8f3093b

Please sign in to comment.