o
    rZhZ                     @   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   sZ  |du rt  }|du rt  }t| tr.t| j|| jhB || jhB }|| jtt|dS t| t	rAt| j
||t| j||@ S t| trUtt| j
||t| j||S t| trjtt| j
 ||t| j||S t| trtt| j
 ||t| j||tt| j
||t| j ||@ S t| tr| S t| trt| j}t|trt|j |||jhB }|r||jt|S tt|d}||j|S t|t	rtt|j
 ||t|j ||S t|trt|j
 ||t|j ||@ S t|tr	t|j
||t|j ||@ S t|tr/tt|j
 ||t|j ||tt|j
||t|j||@ S t|tr7| S t|trDt|j||S t|trft|j ||jhB ||jhB }||jtt|dS t|trn| S td|  t| trt| j||| jhB }|r|| jt|S tt|d}|| j|S t| tr| S td|  )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   A/var/www/auris/lib/python3.10/site-packages/nltk/sem/skolemize.pyr      s   














r   c                 C   s\   t | trt| j|}t| j|}||@ S t |tr*t| |j}t| |j}||@ S | |B S )zI
    Convert this split disjunction to conjunctive normal form (CNF)
    )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