Prolog


PART IV - Family

<< Previous  Main  Next >> 

Example #1: Family

parent[X,Y]:-father[X,Y].
parent[X,Y]:-mother[X,Y].
son[X,Y]:-parent[Y,X]*male[X].
father[phil,charlie].
mother[liz,charlie].
male[charlie].

Resolution Trace for Example #1:

son[X,Y]  parent[Y,X]  father[X,Y]  mother[X,Y]  male[X] 
son[A,B]        
  parent[B,A]      
    father[B,A]    
    B=phil,A=charlie    
        male[charlie]
        TRUE
        >>_son[charlie,phil]
        male[charlie] (#2)
        FALSE
    father[B,A] (#2)    
    FALSE    
  parent[B,A] (#2)      
      mother[B,A]  
      B=liz,A=charlie  
        male[charlie]
        TRUE
        >>_son[liz,phil]
        male[charlie] (#2)
        FALSE
      mother[B,A] (#2)  
      FALSE  
  parent[B,A] (#3)      
  FALSE      
son[A,B] (#2)        
FALSE        
<<_son[charlie,phil]        
>>son[charlie,phil]        
<<_son[liz,phil]        
>>_son[liz,phil]        
         

<Under Construction>

<< Previous  Main  Next >> 

Next: Sorting


Questions? Comments? Send them here. Or return to deXXed.