
    Qdf                     b   d Z ddlmZmZ ddlmZ ddlmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZ  e            Z G d de          Z G d de          Z G d	 d
e          Z G d d          Z G d d          Z G d d          Zd Zd Z ddZ!d Z"e#dk    r e"             dS dS )z8
Module for a tableau-based First Order theorem prover.
    )BaseProverCommandProver)Counter)AbstractVariableExpressionAllExpressionAndExpressionApplicationExpressionEqualityExpressionExistsExpression
ExpressionFunctionVariableExpressionIffExpressionImpExpressionLambdaExpressionNegatedExpressionOrExpressionVariableVariableExpressionunique_variablec                       e Zd ZdS )ProverParseErrorN)__name__
__module____qualname__     6lib/python3.11/site-packages/nltk/inference/tableau.pyr   r   %   s        Dr   r   c                       e Zd ZdZddZd Zd Zd Zd Zd Z	d	 Z
d
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zed             ZdS )TableauProverFNc                    |sg }d }	 t                      }|r|                    |            |                    |           t          |          }|                     |t                      t                      |          }nW# t          $ rJ}| j        r%t          |          	                    d          rd}n|rt          |           n|Y d }~nd }~ww xY w|d                    |j                  fS )Nz maximum recursion depth exceededF
)Agendaputput_allDebug_attempt_proofsetRuntimeError_assume_falsestr
startswithprintjoinlines)selfgoalassumptionsverboseresultagendadebuggeres           r   _provezTableauProver._prove,   s    	K	XXF "

D5!!!NN;'''W~~H((xHHFF 		 		 		! c!ff&7&72' '   !HHHHG		 		(.1122s   A:B 
CA CCc           	         |                                 \  \  }}}|s|                    d           dS i t          j        | j        t          j        | j        t          j        | j        t          j	        | j
        t          j        | j        t          j        | j        t          j        | j        t          j        | j        t          j        | j        t          j        | j        t          j        | j        t          j        | j        t          j        | j        t          j        | j        t          j        | j         t          j!        | j"        t          j#        | j$        t          j%        | j&        t          j'        | j(        t          j)        | j*        t          j+        | j,        i|         }|                    ||f            |||||||          S )NzAGENDA EMPTYF)-	pop_firstline
CategoriesATOM_attempt_proof_atomPROP_attempt_proof_propN_ATOM_attempt_proof_n_atomN_PROP_attempt_proof_n_propAPP_attempt_proof_appN_APP_attempt_proof_n_appN_EQ_attempt_proof_n_eqD_NEG_attempt_proof_d_negN_ALL_attempt_proof_n_allN_EXISTS_attempt_proof_n_someAND_attempt_proof_andN_OR_attempt_proof_n_orN_IMP_attempt_proof_n_impOR_attempt_proof_orIMP_attempt_proof_impN_AND_attempt_proof_n_andIFF_attempt_proof_iffN_IFF_attempt_proof_n_iffEQ_attempt_proof_eqEXISTS_attempt_proof_someALL_attempt_proof_all)	r/   r4   accessible_varsatomsdebugcurrentcontextcategoryproof_methods	            r   r&   zTableauProver._attempt_proofD   s   '-'7'7'9'9$'H  	JJ~&&&5
OT5
OT5
 t9
 t9	

 ND3
 d7
 OT5
 d7
 d7
 !;
 ND3
 OT5
 d7
 M41
 ND3
  d7!
" ND3#
$ d7M41t7ND3+
 
, -0 	

GW%&&&|GWfoueTTTr   c                    |df|v r|                     dd           dS |ryt          |j        t                    r|                                }|                     ||                                                     |                     ||||dz             S |                                 |                     ||t          |j
                  z  ||dfhz  |dz             S NTCLOSED   F)r:   
isinstancetermr   negater#   simplifyr&   mark_alls_freshr'   argsr/   ri   rj   r4   rf   rg   rh   s          r   r=   z!TableauProver._attempt_proof_atomg   s     T?e##JJx###4 	',(9:: +!..**JJwww''0022333&&vuqyQQQ ""$$$&&#gl"3"33'5)**		  r   c                    |j         df|v r|                    dd           dS |ryt          |j         t                    r|                                }|                     ||                                                     |                     ||||dz             S |                                 |                     ||t          |j         j
                  z  ||j         dfhz  |dz             S NFro   rp   T)rr   r:   rq   r   rs   r#   rt   r&   ru   r'   rv   rw   s          r   rA   z#TableauProver._attempt_proof_n_atom~   s     L% E))JJx###4 	',(9:: +!..**JJwww''0022333&&vuqyQQQ ""$$$&&#gl&7"8"88',-..		  r   c                     |df|v r|                     dd           dS |                                 |                     ||||dfhz  |dz             S rn   )r:   ru   r&   rw   s          r   r?   z!TableauProver._attempt_proof_prop   sr     T?e##JJx###4 	   ""OUw.>-?%?
 
 	
r   c                     |j         df|v r|                    dd           dS |                                 |                     ||||j         dfhz  |dz             S ry   )rr   r:   ru   r&   rw   s          r   rC   z#TableauProver._attempt_proof_n_prop   sw     L% E))JJx###4 	   ""OUw|T.B-C%CUQY
 
 	
r   c                 B   |                                 \  }}t          |          D ]\  }	}
t                              |
          s|}t	          dt
                                          z            }t          |          D ].\  }}|	|k    r |t          |                    n
 ||          }/|r ||                                          }t          ||          }|
                    |
|           |                     ||||dz             c S t          d          NzX%srp   z=If this method is called, there must be a non-atomic argument)uncurry	enumerater   is_atomr   _countergetr   rt   r   r#   r&   	Exceptionr/   ri   rj   r4   rf   rg   rh   frv   iargctxnvjas                  r   rE   z TableauProver._attempt_proof_app   s2    //##4oo 
	V 
	VFAs ((-- 	Vehllnn455%dOO L LDAq9:a##044555SSVVCC 2!'#,,//11C&r3//

3$$$**6?E5ST9UUUUU	V WXXXr   c                 P   |j                                         \  }}t          |          D ]\  }	}
t                              |
          s|}t          dt                                          z            }t          |          D ].\  }}|	|k    r |t          |                    n
 ||          }/|r ||          	                                }t          ||           }|                    |
 |           |                     ||||dz             c S t          d          r}   )rr   r~   r   r   r   r   r   r   r   rt   r   r#   r&   r   r   s                  r   rG   z"TableauProver._attempt_proof_n_app   s:    ,&&((4oo 	V 	VFAs ((-- 
Vehllnn455%dOO L LDAq9:a##044555SSVVCC 2!'#,,//11C&rC400

C4%%%**6?E5ST9UUUUU
V WXXXr   c                 *   |j         j        |j         j        k    r|                    dd           dS |t          j                                     ||f           d|_        |                     |||j         j        |j         j        hz  ||dz             S )Nro   rp   T)	rr   firstsecondr:   r;   rH   add
_exhaustedr&   rw   s          r   rI   z!TableauProver._attempt_proof_n_eq   s     <!444JJx###4z##Wg$6777!""w|17<3FGGAI	
 
 	
r   c                 x    |                     |j        j        |           |                     ||||dz             S Nrp   )r#   rr   r&   rw   s          r   rK   z"TableauProver._attempt_proof_d_neg   s;     	

7<$g...""6?E519MMMr   c                     |t           j                                     t          |j        j        |j        j                   |f           |                     ||||dz             S r   )r;   rb   r   r   rr   variabler&   rw   s          r   rM   z"TableauProver._attempt_proof_n_all   sc     	z !%%gl3gl6G5GHH'R	
 	
 	
 ""6?E519MMMr   c                     |t           j                                     t          |j        j        |j        j                   |f           |                     ||||dz             S r   )r;   rd   r   r   rr   r   r&   rw   s          r   rO   z#TableauProver._attempt_proof_n_some   sb     	z~""7<07<3D2DEEwO	
 	
 	
 ""6?E519MMMr   c                     |                     |j        |           |                     |j        |           |                     ||||dz             S r   )r#   r   r   r&   rw   s          r   rQ   z TableauProver._attempt_proof_and   sN     	

7='***

7>7+++""6?E519MMMr   c                     |                     |j        j         |           |                     |j        j         |           |                     ||||dz             S r   r#   rr   r   r   r&   rw   s          r   rS   z!TableauProver._attempt_proof_n_or  sZ     	

GL&&000

GL''111""6?E519MMMr   c                     |                     |j        j        |           |                     |j        j         |           |                     ||||dz             S r   r   rw   s          r   rU   z"TableauProver._attempt_proof_n_imp  sW     	

7<%w///

GL''111""6?E519MMMr   c                    |                                 }|                    |j        |           |                    |j        |           |                     ||||dz             o|                     ||||dz             S r   cloner#   r   r   r&   r/   ri   rj   r4   rf   rg   rh   
new_agendas           r   rW   zTableauProver._attempt_proof_or  s     \\^^


7='***w~w///""OUEAI
 
 Q!!*oueaiPP	Qr   c                    |                                 }|                    |j         |           |                    |j        |           |                     ||||dz             o|                     ||||dz             S r   r   r   s           r   rY   z TableauProver._attempt_proof_imp  s     \\^^


GM>7+++w~w///""OUEAI
 
 Q!!*oueaiPP	Qr   c                    |                                 }|                    |j        j         |           |                    |j        j         |           |                     ||||dz             o|                     ||||dz             S r   r   r#   rr   r   r   r&   r   s           r   r[   z"TableauProver._attempt_proof_n_and&  s     \\^^


GL&&000++W555""OUEAI
 
 Q!!*oueaiPP	Qr   c                 r   |                                 }|                    |j        |           |                    |j        |           |                    |j         |           |                    |j         |           |                     ||||dz             o|                     ||||dz             S r   r   r   s           r   r]   z TableauProver._attempt_proof_iff0  s     \\^^


7='***

7>7+++~w///000""OUEAI
 
 Q!!*oueaiPP	Qr   c                    |                                 }|                    |j        j        |           |                    |j        j         |           |                    |j        j         |           |                    |j        j        |           |                     ||||dz             o|                     ||||dz             S r   r   r   s           r   r_   z"TableauProver._attempt_proof_n_iff<  s     \\^^


7<%w///

GL''111**G444w|*G444""OUEAI
 
 Q!!*oueaiPP	Qr   c                    |                     |           |                    |j        |j                   |                    |j                   |                                 |                     ||t                      |dz             S r   )	put_atomsreplace_allr   r   discardmark_neqs_freshr&   r'   rw   s          r   ra   zTableauProver._attempt_proof_eqH  s|     	7='.999...   ""6?CEE519MMMr   c                    t          t                                }|                    |j                            |j        |          |           |                                 |                     |||hz  ||dz             S r   )r   r   r#   rr   replacer   ru   r&   )r/   ri   rj   r4   rf   rg   rh   new_unique_variables           r   rc   z!TableauProver._attempt_proof_someU  s     11B1BCC

7<''(8:MNNPWXXX   ""O':&;;UEAI
 
 	
r   c                 F   	 |j          n## t          $ r t                      |_         Y nw xY w|r ||j         z
  }|rt          |          d         }|                    d|z  d           |xj         |hz  c_         |                    |j                            |j        |          |           |t          j
                                     ||f           |                     ||||dz             S |                    dd           d|_        |t          j
                                     ||f           |                     ||||dz             S t          t                                }	|                    d|	z  d           |xj         |	hz  c_         |                    |j                            |j        |	          |           |t          j
                                     ||f           |                                 |                     |||	hz  ||dz             S )Nr   z--> Using '%s'   rp   z--> Variables ExhaustedT)
_used_varsAttributeErrorr'   listr:   r#   rr   r   r   r;   rd   r   r&   r   r   r   ru   )
r/   ri   rj   r4   rf   rg   rh   bv_availablevariable_to_user   s
             r   re   z TableauProver._attempt_proof_all_  sO   	' 	' 	' 	'!$G	'   	*W-??L V"&|"4"4Q"7

+o=qAAA""&77""

L(()9?KKW   z~&**GW+=>>>**6?E5ST9UUU 

4a888%)"z~&**GW+=>>>**6?E5ST9UUU #5_5F5F"G"GJJ'*==qAAA#6"77JJ$$W%57JKKW   :>"&&'9:::""$$$&&+>*??PQ	  s   
 **c                    t          | t                    r| j        } t          | t                    r)| j        D ]}t
                              |          s dS  dS t          | t                    st          | t                    rdS dS )NFT)	rq   r   rr   r	   rv   r   r   r   r   )r6   r   s     r   r   zTableauProver.is_atom  s    a*++ 	Aa.// 
	v ! !$,,S11 ! 55!4566 	*;
 ;
 	 45r   )NNF)r   r   r   r)   r7   r&   r=   rA   r?   rC   rE   rG   rI   rK   rM   rO   rQ   rS   rU   rW   rY   r[   r]   r_   ra   rc   re   staticmethodr   r   r   r   r   r   )   s       M3 3 3 30!U !U !UF  .  .
 
 

 
 
Y Y Y"Y Y Y$
 
 
&N N NN N NN N NN N NN N NN N NQ Q QQ Q QQ Q Q
Q 
Q 
Q
Q 
Q 
QN N N
 
 
) ) )V   \  r   r   c                       e Zd ZddZdS )TableauProverCommandNc                     |t          |t                    sJ nt                      }t          j        | |||           dS )z
        :param goal: Input expression to prove
        :type goal: sem.Expression
        :param assumptions: Input expressions to use as assumptions in
            the proof.
        :type assumptions: list(sem.Expression)
        N)rq   r   r   __init__)r/   r0   r1   provers       r   r   zTableauProverCommand.__init__  sI     fm444444"__F"4{CCCCCr   )NNN)r   r   r   r   r   r   r   r   r     s.        D D D D D Dr   r   c                   X    e Zd Zd Zd Zd ZddZd Zd Zd Z	d	 Z
d
 Zd Zd Zd ZdS )r"   c                 \    t          d t          d          D                       | _        d S )Nc              3   2   K   | ]}t                      V  d S N)r'   ).0r   s     r   	<genexpr>z"Agenda.__init__.<locals>.<genexpr>  s&      33A#%%333333r      )tuplerangesets)r/   s    r   r   zAgenda.__init__  s*    33r33333			r   c                     t                      }d | j        D             }t                      }|t          j                 D ]q\  }}t          |j        |j                  }	 d |j        D             |_        n## t          $ r t                      |_        Y nw xY w|
                    |d f           r||t          j        <   d |t          j                 D             |t          j        <   t          |          |_        |S )Nc                 6    g | ]}|                                 S r   )copy)r   ss     r   
<listcomp>z Agenda.clone.<locals>.<listcomp>  s     000AFFHH000r   c                     h | ]}|S r   r   r   useds     r   	<setcomp>zAgenda.clone.<locals>.<setcomp>  s    'J'J'J'J'J'Jr   c                 @    h | ]\  }}t          |j                  |fS r   )r   rr   )r   n_eqr   s      r   r   zAgenda.clone.<locals>.<setcomp>  s;     %
 %
 %
s ty))3/%
 %
 %
r   )r"   r   r'   r;   rd   r   r   rr   r   r   r   rH   r   )r/   r   set_list
new_allExsallEx_	new_allExs          r   r   zAgenda.clone  s   XX
00di000UU
 0 	. 	.HE1%enejAAI-'J'J9I'J'J'J	$$! - - -'*uu	$$$-NNIt,----#- %
 %
'
8%
 %
 %
!
  //
s    A77BBc                     | j         |         S r   )r   )r/   indexs     r   __getitem__zAgenda.__getitem__  s    yr   Nc                 H   t          |t                    rUt          |j        |j                  }	 d |j        D             |_        n%# t
          $ r t                      |_        Y nw xY w|}| j        |                     |                   	                    ||f           d S )Nc                     h | ]}|S r   r   r   s     r   r   zAgenda.put.<locals>.<setcomp>  s    'O'O'O'O'O'Or   )
rq   r   r   rr   r   r   r'   r   _categorize_expressionr   )r/   
expressionrj   	ex_to_adds       r   r#   z
Agenda.put  s    j-00 	#%j&9:?KKI-'O'O9N'O'O'O	$$! - - -'*uu	$$$- #I	$--i889==y'>RSSSSSs   A A('A(c                 :    |D ]}|                      |           d S r   )r#   )r/   expressionsr   s      r   r$   zAgenda.put_all  s0    % 	! 	!JHHZ    	! 	!r   c                     |D ]W\  }}|r)| t           j                                     | d f           0| t           j                                     |d f           Xd S r   )r;   r@   r   r<   )r/   rg   atomnegs       r   r   zAgenda.put_atoms  sn     	8 	8ID# 8Z&'++dUDM::::Z_%))4,7777		8 	8r   c                 ^   t          | j                  D ]\  }}|r|t          j        t          j        fv r^|D ]Z}	 |d         j        s|                    |           ||fc c S .# t          $ r  |                    |           ||fcY c c S w xY w|                                |fc S dS )z3Pop the first expression that appears in the agendar   ))NNN)	r   r   r;   rH   rd   r   remover   pop)r/   r   r   exs       r   r9   zAgenda.pop_first  s    di(( 	( 	(DAq (*.999 + ++#%a5#3 / !(*Aw/  . + + +HHRLLL$&7NNNNNNN++ EEGGQ<'''( $#s   %A&&#BBc                     | j         D ]B}|D ]=\  }}|                    |j        |           ||                    |j        |           >Cd S r   )r   r   r   )r/   oldnewr   r   r   s         r   r   zAgenda.replace_all  sg     	3 	3A 3 3C

3<---?KKc2223	3 	3r   c                 N    | j         t          j                 D ]\  }}d|_        d S NF)r   r;   rd   r   )r/   ur   s      r   ru   zAgenda.mark_alls_fresh  s1    Ijn- 	! 	!DAq ALL	! 	!r   c                 N    | j         t          j                 D ]\  }}d|_        d S r   )r   r;   rH   r   )r/   neqr   s      r   r   zAgenda.mark_neqs_fresh  s1    i
0 	# 	#FC"CNN	# 	#r   c                 ,   t          |t                    r|                     |          S t          |t                    rt          j        S t                              |          rt          j        S t          |t                    rt          j
        S t          |t                    rt          j        S t          |t                    rt          j        S t          |t                    rt          j        S t          |t"                    rt          j        S t          |t&                    rt          j        S t          |t*                    rt          j        S t          |t.                    rt          j        S t3          d|j        j        z            Nzcannot categorize %s)rq   r   _categorize_NegatedExpressionr   r;   r>   r   r   r<   r   rd   r   rP   r   rV   r   rX   r   r\   r
   r`   r   rb   r	   rD   r   	__class__r   )r/   ri   s     r   r   zAgenda._categorize_expression   s[   g011 	X55g>>>!;<< 	X?"""7++ 	X?"// 	X>!// 	X>!.. 	X= // 	X>!// 		X>!!344 	X= !122 	X$$!677 	X>!"#9G<M<V#VWWWr   c                 (   |j         }t          |t                    rt          j        S t          |t
                    rt          j        S t                              |          rt          j	        S t          |t                    rt          j        S t          |t                    rt          j        S t          |t                    rt          j        S t          |t                     rt          j        S t          |t$                    rt          j        S t          |t(                    rt          j        S t          |t,                    rt          j        S t          |t0                    rt          j        S t5          d|j        j        z            r   )rr   rq   r   r;   rJ   r   rB   r   r   r@   r   rL   r   rZ   r   rR   r   rT   r   r^   r
   rH   r   rN   r	   rF   r   r   r   )r/   ri   negateds      r   r   z$Agenda._categorize_NegatedExpression  s^   ,g011 	X##!;<< 	X$$""7++ 	X$$// 	X##// 	X##.. 	X?"// 	X##// 		X##!344 	X?"!122 	X&&!677 	X##"#9G<M<V#VWWWr   r   )r   r   r   r   r   r   r#   r$   r   r9   r   ru   r   r   r   r   r   r   r"   r"     s        4 4 4  ,     	T 	T 	T 	T! ! !8 8 8$ $ $"3 3 3! ! !# # #X X X4X X X X Xr   r"   c                   $    e Zd ZddZd ZddZdS )r%   r   Nc                 8    || _         || _        |sg }|| _        d S r   )r2   indentr.   )r/   r2   r   r.   s       r   r   zDebug.__init__8  s(     	E


r   c                 H    t          | j        | j        dz   | j                  S r   )r%   r2   r   r.   )r/   	increments     r   __add__zDebug.__add__@  s    T\4;?DJ???r   c                    t          |t                    ro|\  }}|r| d| }nd|z  }t          |t                    rF	 dd                    d |j        D                       z  }|d|z  z  }n# t
          $ r |dz  }Y nw xY wd                    d	| j        |z   z  |          }| j        	                    |           | j
        rt          |           d S d S )
N, %sz[%s],c              3   4   K   | ]}d |j         j        z  V  dS )r   N)r   name)r   ves     r   r   zDebug.line.<locals>.<genexpr>N  s,       Q QR(8!8 Q Q Q Q Q Qr   z:   %sz:   []z{}{}z   )rq   r   r   r-   r   r   formatr   r.   appendr2   r,   )r/   datar   r   r   	used_varsnewlines          r   r:   z
Debug.lineC  s   dE"" 	%GB !~~~~by"m,, %% & Q Q2= Q Q QQQ!I Hy00DD% % % %H$DDD% --v)= >EE
'"""< 	'NNNNN	 	s    /A0 0BB)r   N)r   )r   r   r   r   r   r:   r   r   r   r%   r%   7  sN           @ @ @     r   r%   c                   b    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdS )r;   r   rp   r                     	   
                                 N)r   r   r   r<   r>   r@   rB   rD   rF   rH   rJ   rL   rN   rP   rR   rT   rV   rX   rZ   r\   r^   r`   rb   rd   r   r   r   r;   r;   [  sw        DDFF
CEDEEH
CDE	B
CE
CE	BF
CCCr   r;   c                  
   t          d           t          d           t          dddg           t          d           t          d           t          d           t          d	           t          d
           t          d           t          d	           t          d
           t          d           t          d           t          d           t          d           t          d           t          d           d} d}d}t          || |g           d} d}d}t          || |g           d}d}t          ||g           d}d}t          ||g           d}d}t          ||g           d}t          |           d S )NzP | -PzP & -PQPz(P -> Q)zman(x)z(man(x) -> man(x))z(man(x) -> --man(x))z-(man(x) and -man(x))z(man(x) or -man(x))z(man(x) iff man(x))z-(man(x) iff -man(x))zall x.man(x)z all x.all y.((x = y) -> (y = x))z2all x.all y.all z.(((x = y) & (y = z)) -> (x = z))zall x.(man(x) -> mortal(x))zman(Socrates)zmortal(Socrates)zall x.(man(x) -> walks(x))z	man(John)zsome y.walks(y)z((x = y) & walks(y))zwalks(x)z((x = y) & ((y = z) & (z = w)))z(x = w)z5some e1.some e2.(believe(e1,john,e2) & walk(e2,mary))zsome e0.walk(e0,mary)z(exists x.exists z3.((x = Mary) & ((z3 = John) & sees(z3,x))) <-> exists x.exists z4.((x = John) & ((z4 = Mary) & sees(x,z4))))tableau_test)p1p2cps       r   testTableauProverr"  s  s   sJ'(((%&&&'(((()))&'''%&&&()))&'''%&&&&'''()))   3444EFFF 
'B	BARH	%B	BARHAAQC)AAQC?AAQC 	JAOOOOOr   c                      t          ddg           t          ddg           t          ddg           t          ddg           t          dd	g           t          d
dg           t          ddg           d S )Nzbelieve(j, -lie(b))zbelieve(j, -lie(b) & -cheat(b))zbelieve(j, lie(b) & cheat(b))zbelieve(j, lie(b))zlie(b)zbelieve(j, know(b, cheat(b)))z;believe(j, know(b, lie(b)) & know(b, steals(b) & cheat(b)))zP(Q(y), R(y) & R(z))zP(Q(x) & Q(y), R(y) & R(z))zbelieve(j, cheat(b) & lie(b))zbelieve(j, -cheat(b) & -lie(b))r  r   r   r   testHigherOrderTableauProverr$    s    &)J(KLLL03G2HIIIxj   '	FG   '*G)HIII03R2STTT25V4WXXXXXr   NFc                     t          j        |           }|rd |D             ng }|sg }t          d                    |          d|dt	                                          |||                     d S )Nc                 6    g | ]}t          j        |          S r   )r   
fromstring)r   r!  s     r   r   z tableau_test.<locals>.<listcomp>  s#    
0
0
0: ##
0
0
0r   r   z |- z: )r2   )r   r'  r,   r-   r   prove)r   psr2   pcppss        r   r  r    s    		q	!	!B46
>
0
0R
0
0
0
0BC 	99R===="""moo33BW3MMM	O    r   c                  >    t                       t                       d S r   )r"  r$  r   r   r   demor-    s      """""r   __main__r   )$__doc__nltk.inference.apir   r   nltk.internalsr   nltk.sem.logicr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r"   r%   r;   r"  r$  r  r-  r   r   r   r   <module>r3     s    9 8 8 8 8 8 8 8 " " " " " "                                   & 799	 	 	 	 	y 	 	 	p p p p pF p p pfD D D D D, D D D"GX GX GX GX GX GX GX GXT! ! ! ! ! ! ! !H       0, , ,hY Y Y    # # #
 zDFFFFF r   