U
    e                     @   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d ZdS )    )AllExpressionAndExpressionApplicationExpressionEqualityExpressionExistsExpressionIffExpressionImpExpressionNegatedExpressionOrExpressionVariableExpressionskolem_functionunique_variableNc                 C   sr  |dkrt  }|dkrt  }t| tr\t| j|| jhB || jhB }|| jtt|dS t| t	rt| j
||t| j||@ S t| trtt| j
||t| j||S t| trtt| j
 ||t| j||S t| tr tt| j
 ||t| j||tt| j
||t| j ||@ S t| tr0| S t| tr| j}t|trt|j |||jhB }|r~||jt|S tt|d}||j|S qnt|t	rtt|j
 ||t|j ||S t|trt|j
 ||t|j ||@ S t|tr"t|j
||t|j ||@ S t|trntt|j
 ||t|j ||tt|j
||t|j||@ S t|tr~| S t|trt|j||S t|trt|j ||jhB ||jhB }||jtt|dS t|tr| S td|  ntt| trRt| j||| jhB }|r4|| jt|S tt|d}|| j|S nt| trb| S td|  dS )zO
    Skolemize the expression and convert to conjunctive normal form (CNF)
    N)ignorez'%s' cannot be skolemized)set
isinstancer   	skolemizetermvariablereplacer   r   r   firstsecondr
   to_cnfr   r   r   r	   r   r   r   	Exception)Z
expressionZ
univ_scopeZused_variablesr   ZnegatedZskolem_constant r   S/var/www/html/assets/scripts/venv/lib/python3.8/site-packages/nltk/sem/skolemize.pyr      s    



  

  
    

  
r   c                 C   s`   t | tr*t| j|}t| j|}||@ S t |trTt| |j}t| |j}||@ S | |B S dS )zI
    Convert this split disjunction to conjunctive normal form (CNF)
    N)r   r   r   r   r   )r   r   Zr_firstZr_secondr   r   r   r      s    

r   )NN)Znltk.sem.logicr   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   <module>	   s   8
n