GrandfatherNotation

From Dyna

Jump to: navigation, search

Grandfather example: A note about the notation

We used a star (*) in

grandfather(F, G) += father(F, C) * father(C, G).  

The reason is that the probabilities multiply:

father(Wilhelm, Karl) * father(Karl, Kaspar) = 0.6 * 0.7 = 0.42

And why the += instead of a single equal sign (=)? That's because Dyna actually adds up all the different possibilities of someone being someone's grandfather. Suppose we had asserted that Wilhelm is not only Karl's father, but also Ludwig's father:

   c.assert(father("Karl", "Kaspar), 0.7);   
   c.assert(father("Ludwig", "Kaspar), 0.3); 
   c.assert(father("Wilhelm", "Karl), 0.6);  // Wilhelm is Karl's father
   c.assert(father("Georg", "Karl"), 0.4);    
   c.assert(father("Wilhelm", "Ludwig"), 1);  // Wilhelm is also Ludwig's father

Then, there would be two possibilities for Wilhelm to be Kaspar's grandfather: as Karl's father or as Ludwig's father. (Yes, Karl and Ludwig are brothers, then.)

father("Wilhelm", "Karl") * father("Karl", "Kaspar") = 0.6 * 0.7.  
father("Wilhelm", "Ludwig") * father("Ludwig", "Kaspar") = 1 * 0.3.  

Therefore, in this case, Dyna would give the answer

 grandfather("Wilhelm", "Kaspar") =  father("Wilhelm", "Karl") * father("Karl", "Kaspar") 
                                     + father("Wilhelm", "Ludwig") * father("Ludwig", "Kaspar")
                                  =  0.6 * 0.7 + 1 * 0.3
                                  =  0.72

Try it out!

Personal tools