U
    —9%e·  ã                   @   s   d dl mZ ddd„ZdS )é    )Ú
EncodedCNFFc                    s®   dd l }tˆ tƒs&tƒ }| ˆ ¡ |‰ dhˆ jkrH|rDdd„ dD ƒS dS |sz| ˆ j¡}|dk}|sh|S ‡ fdd„|D ƒS | ˆ j¡}|dk}|s–|S ‡ fd	d
„}||ƒS d S )Nr   c                 s   s   | ]
}|V  qd S )N© )Ú.0Úfr   r   úe/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/sympy/logic/algorithms/pycosat_wrapper.pyÚ	<genexpr>   s     z&pycosat_satisfiable.<locals>.<genexpr>)FFZUNSATc                    s$   i | ]}ˆ j t|ƒd   |dk“qS ©é   r   ©ÚsymbolsÚabs©r   Zlit©Úexprr   r   Ú
<dictcomp>   s      z'pycosat_satisfiable.<locals>.<dictcomp>c                 3   sN   d}z&t | ƒ}‡ fdd„|D ƒV  d}qW n tk
rH   |sDdV  Y nX d S )NFc                    s$   i | ]}ˆ j t|ƒd   |dk“qS r   r
   r   r   r   r   r   #   s      z5pycosat_satisfiable.<locals>._gen.<locals>.<dictcomp>T)ÚnextÚStopIteration)ÚresultsZsatisfiableZsolr   r   r   Ú_gen   s    
z!pycosat_satisfiable.<locals>._gen)ÚpycosatÚ
isinstancer   Zadd_propÚdataZsolveZ	itersolve)r   Z
all_modelsr   ÚexprsÚrÚresultr   r   r   r   Úpycosat_satisfiable   s*    

r   N)F)Zsympy.assumptions.cnfr   r   r   r   r   r   Ú<module>   s   