ó
ù`]c           @   sn   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 d d d „ Z d „  Z d S(   iÿÿÿÿ(   t   AllExpressiont   AndExpressiont   ApplicationExpressiont   EqualityExpressiont   ExistsExpressiont   IffExpressiont   ImpExpressiont   NegatedExpressiont   OrExpressiont   VariableExpressiont   skolem_functiont   unique_variablec         C   sÈ  | d k r t ƒ  } n  | d k r0 t ƒ  } n  t |  t ƒ r– t |  j | t |  j g ƒ B| t |  j g ƒ Bƒ } | j |  j t t	 d | ƒ ƒ ƒ St |  t
 ƒ rË t |  j | | ƒ t |  j | | ƒ @St |  t ƒ rt t |  j | | ƒ t |  j | | ƒ ƒ St |  t ƒ r@t t |  j | | ƒ t |  j | | ƒ ƒ St |  t ƒ r§t t |  j | | ƒ t |  j | | ƒ ƒ t t |  j | | ƒ t |  j | | ƒ ƒ @St |  t ƒ rº|  St |  t ƒ r#|  j } t | t ƒ rQt | j | | t | j g ƒ Bƒ } | r&| j | j t | ƒ ƒ St t	 d | ƒ ƒ } | j | j | ƒ SqÄt | t
 ƒ rt t | j | | ƒ t | j | | ƒ ƒ St | t ƒ rÄt | j | | ƒ t | j | | ƒ @St | t ƒ rút | j | | ƒ t | j | | ƒ @St | t ƒ rat t | j | | ƒ t | j | | ƒ ƒ t t | j | | ƒ t | j | | ƒ ƒ @St | t ƒ rt|  St | t ƒ r–t | j | | ƒ St | t ƒ rýt | j | t | j g ƒ B| t | j g ƒ Bƒ } | j | j t t	 d | ƒ ƒ ƒ St | t ƒ r|  St d |  ƒ ‚ n¡ t |  t ƒ r¡t |  j | | t |  j g ƒ Bƒ } | rv| j |  j t | ƒ ƒ St t	 d | ƒ ƒ } | j |  j | ƒ Sn# t |  t ƒ r´|  St d |  ƒ ‚ d S(   sO   
    Skolemize the expression and convert to conjunctive normal form (CNF)
    t   ignores   '%s' cannot be skolemizedN(   t   Nonet   sett
   isinstanceR    t	   skolemizet   termt   variablet   replaceR	   R   R   t   firstt   secondR   t   to_cnfR   R   R   R   R
   R   R   t	   Exception(   t
   expressiont
   univ_scopet   used_variablesR   t   negatedt   skolem_constant(    (    s1   lib/python2.7/site-packages/nltk/sem/skolemize.pyR      s¨    	#"c         C   s‚   t  |  t ƒ r; t |  j | ƒ } t |  j | ƒ } | | @St  | t ƒ rv t |  | j ƒ } t |  | j ƒ } | | @S|  | BSd S(   sI   
    Convert this split disjunction to conjunctive normal form (CNF)
    N(   R   R   R   R   R   (   R   R   t   r_firstt   r_second(    (    s1   lib/python2.7/site-packages/nltk/sem/skolemize.pyR   ‡   s    N(   t   nltk.sem.logicR    R   R   R   R   R   R   R   R   R	   R
   R   R   R   R   (    (    (    s1   lib/python2.7/site-packages/nltk/sem/skolemize.pyt   <module>	   s   Rn