+
    ‹°³j#  ã                   óž   € R t ^ RIHtHtHtHtHt ^ RIHt ^ RI	H
t
 ^ RIHt R tRR ltR tRR	 ltRR
 lt ! R R4      t ! R R]4      tR# )z Inference in propositional logic)ÚAndÚNotÚ	conjunctsÚto_cnfÚBooleanFunction)Úordered)Úsympify)Úimport_modulec                ó¸   € V RJ g   V RJ d   V # V P                   '       d   V # V P                  '       d   \        V P                  ^ ,          4      # \	        R4      h)zË
The symbol in this literal (without the negation).

Examples
========

>>> from sympy.abc import A
>>> from sympy.logic.inference import literal_symbol
>>> literal_symbol(A)
A
>>> literal_symbol(~A)
A

TFz#Argument must be a boolean literal.)Ú	is_SymbolÚis_NotÚliteral_symbolÚargsÚ
ValueError)Úliterals   &ÚV/home/luca/screen-checking/.venv/lib/python3.14/site-packages/sympy/logic/inference.pyr   r   	   sP   € ð  �$ƒ˜' UÓ*ØˆØ	×	×	Ð	ØˆØ	��ˆÜ˜gŸl™l¨1�oÓ.Ð.äÐ>Ó?Ð?ó    Nc                óð  € V'       d   Ve   VR8w  d   \        RV R24      hRpVe   VR8X  d'   \        R4      pVe   RpMVR8X  d   \        R4      hRpVR8X  d   \        R4      pVf   RpVR8X  d   \        R4      pVf   RpVR	8X  d   ^ R
IHp V! V 4      # VR8X  d   ^ R
IHp V! WVR7      # VR8X  d   ^ RIHp	 V	! W4      # VR8X  d   ^ RIH	p
 V
! WV4      # VR8X  d   ^ RI
Hp V! W4      # \        h)aJ  
Check satisfiability of a propositional sentence.
Returns a model when it succeeds.
Returns {true: true} for trivially true expressions.

On setting all_models to True, if given expr is satisfiable then
returns a generator of models. However, if expr is unsatisfiable
then returns a generator containing the single element False.

Examples
========

>>> from sympy.abc import A, B
>>> from sympy.logic.inference import satisfiable
>>> satisfiable(A & ~B)
{A: True, B: False}
>>> satisfiable(A & ~A)
False
>>> satisfiable(True)
{True: True}
>>> next(satisfiable(A & ~A, all_models=True))
False
>>> models = satisfiable((A >> B) & B, all_models=True)
>>> next(models)
{A: False, B: True}
>>> next(models)
{A: True, B: True}
>>> def use_models(models):
...     for model in models:
...         if model:
...             # Do something with the model.
...             print(model)
...         else:
...             # Given expr is unsatisfiable.
...             print("UNSAT")
>>> use_models(satisfiable(A >> ~A, all_models=True))
{A: False}
>>> use_models(satisfiable(A ^ A, all_models=True))
UNSAT

Údpll2z2Currently only dpll2 can handle using lra theory. z is not handled.Úpycosatzpycosat module is not presentÚ	minisat22ÚpysatÚz3Údpll)Údpll_satisfiable)Úuse_lra_theory)Úpycosat_satisfiable)Úminisat22_satisfiable)Úz3_satisfiable)r   r	   ÚImportErrorÚsympy.logic.algorithms.dpllr   Úsympy.logic.algorithms.dpll2Ú&sympy.logic.algorithms.pycosat_wrapperr   Ú(sympy.logic.algorithms.minisat22_wrapperr   Ú!sympy.logic.algorithms.z3_wrapperr   ÚNotImplementedError)ÚexprÚ	algorithmÚ
all_modelsÚminimalr   r   r   r   r   r   r   r   s   &&&&&       r   Úsatisfiabler*   #   s  € ÷T ØÒ  Y°'Ô%9ÜÐQÐR[ÐQ\Ð\lÐmÓnÐnØˆ	àÒ˜I¨Ô2Ü 	Ó*ˆØÒØ!‰Ià˜IÔ%Ü!Ð"AÓBÐBð  ˆIà�+ÔÜ˜gÓ&ˆØŠ=ØˆIà�$„Ü˜4Ó ˆØŠ:ØˆIà�FÔÝ@Ù Ó%Ð%Ø	�gÔ	ÝAÙ ÀÔPÐPØ	�iÔ	ÝNÙ" 4Ó4Ð4Ø	�kÔ	!ÝRÙ$ T°wÓ?Ð?Ø	�dÔ	ÝDÙ˜dÓ/Ð/ä
Ðr   c                ó4   € \        \        V 4      4      '       * # )a@  
Check validity of a propositional sentence.
A valid propositional sentence is True under every assignment.

Examples
========

>>> from sympy.abc import A, B
>>> from sympy.logic.inference import valid
>>> valid(A | ~A)
True
>>> valid(A | B)
False

References
==========

.. [1] https://en.wikipedia.org/wiki/Validity

)r*   r   )r&   s   &r   Úvalidr,   z   s   € ô* œ3˜t›9Ó%Ô%Ð%r   c                ó  aaa€ ^ RI Ho RoVVV3R loV S9   d   V # \        V 4      p S! V 4      '       g   \        RV ,          4      hV'       g   / pVP	                  4        UUu/ uF  w  r4VS9   g   K  W4bK  	  pppV P                  V4      pVS9   d   \        V4      # V'       d_   \        P                  VP                  4       R4      p\        WQ4      '       d   \        V4      '       d   R#  R# \        V4      '       g   R# R# u uppi )a³  
Returns whether the given assignment is a model or not.

If the assignment does not specify the value for every proposition,
this may return None to indicate 'not obvious'.

Parameters
==========

model : dict, optional, default: {}
    Mapping of symbols to boolean values to indicate assignment.
deep: boolean, optional, default: False
    Gives the value of the expression under partial assignments
    correctly. May still return None to indicate 'not obvious'.


Examples
========

>>> from sympy.abc import A, B
>>> from sympy.logic.inference import pl_true
>>> pl_true( A & B, {A: True, B: True})
True
>>> pl_true(A & B, {A: False})
False
>>> pl_true(A & B, {A: True})
>>> pl_true(A & B, {A: True}, deep=True)
>>> pl_true(A >> (B >> A))
>>> pl_true(A >> (B >> A), deep=True)
True
>>> pl_true(A & ~A)
>>> pl_true(A & ~A, deep=True)
False
>>> pl_true(A & B & (~A | ~B), {A: True})
>>> pl_true(A & B & (~A | ~B), {A: True}, deep=True)
False

)ÚSymbolTFc                 ó  <€ \        V S4      '       g   V S9   d   R # \        V \        4      '       g   R# \        ;QJ d)    V3R lV P                   4       F  '       d   K   R# 	  R # ! V3R lV P                   4       4      # )TFc              3   ó4   <"  € T F  pS! V4      x € K  	  R # 5i©N© )Ú.0ÚargÚ	_validates   & €r   Ú	<genexpr>Ú-pl_true.<locals>._validate.<locals>.<genexpr>Ã   s   øé € Ð7©Y c‘9˜S—>�>«Yùs   ƒ)Ú
isinstancer   Úallr   )r&   r.   r5   Úbooleans   &€€€r   r5   Úpl_true.<locals>._validate¾   sZ   ø€ Ü�d˜F×#Ò# t¨w¤ÙÜ˜$¤×0Ò0Ùß‹sÔ7¨T¯YªYÓ7�sŒsÐ7ŠsÐ7ˆsÔ7¨T¯YªYÓ7Ó7Ð7r   z$%s is not a valid boolean expressionN)TF)Úsympy.core.symbolr.   r   r   ÚitemsÚsubsÚboolÚdictÚfromkeysÚatomsÚpl_truer,   r*   )	r&   ÚmodelÚdeepÚkÚvÚresultr.   r5   r:   s	   &&&   @@@r   rC   rC   ’   sä   ú€ õP )à€G÷8ð ˆw„ØˆÜ�4‹=€DÙ�T�?Š?ÜÐ?À$ÕFÓGÐGßØˆØ#Ÿk™kœmÔ<™m‘d�a¨q°G©|ŒTˆQŠT™m€EÑ<Ø�Y‰Y�uÓ€FØ�ÔÜ�F‹|ÐßÜ—‘˜fŸl™l›n¨dÓ3ˆÜ�6×!Ò!Ü�V�}Š}Ùð ñ
 ô ˜v×&Ò&ÙÙùó =s   Á%D	Á5D	c                ó�   € V'       d   \        V4      pM. pVP                  \        V 4      4       \        \	        V!  4      '       * # )a°  
Check whether the given expr_set entail an expr.
If formula_set is empty then it returns the validity of expr.

Examples
========

>>> from sympy.abc import A, B, C
>>> from sympy.logic.inference import entails
>>> entails(A, [A >> B, B >> C])
False
>>> entails(C, [A >> B, B >> C, A])
True
>>> entails(A >> B)
False
>>> entails(A >> (B >> A))
True

References
==========

.. [1] https://en.wikipedia.org/wiki/Logical_consequence

)ÚlistÚappendr   r*   r   )r&   Úformula_sets   &&r   ÚentailsrM   Û   s;   € ÷2 Ü˜;Ó'‰àˆØ×Ñ”s˜4“yÔ!Üœ3 Ñ,Ó-Ô-Ð-r   c                   óP   a € ] tR t^üt o RtR	R ltR tR tR t]	R 4       t
RtV tR# )
ÚKBz"Base class for all knowledge basesNc                óZ   € \        4       V n        V'       d   V P                  V4       R # R # r1   )ÚsetÚclauses_Útell©ÚselfÚsentences   &&r   Ú__init__ÚKB.__init__þ   s   € Ü›ˆŒßØ�I‰I�hÖñ r   c                ó   € \         hr1   ©r%   rT   s   &&r   rS   ÚKB.tell  ó   € Ü!Ð!r   c                ó   € \         hr1   rZ   ©rU   Úquerys   &&r   ÚaskÚKB.ask  r\   r   c                ó   € \         hr1   rZ   rT   s   &&r   ÚretractÚ
KB.retract	  r\   r   c                ó>   € \        \        V P                  4      4      # r1   )rJ   r   rR   )rU   s   &r   ÚclausesÚ
KB.clauses  s   € ä”G˜DŸM™MÓ*Ó+Ð+r   )rR   r1   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rW   rS   r`   rc   Úpropertyrf   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   rO   rO   ü   s0   ø‡ € Ù,ô ò
"ò"ò"ð ñ,ó ö,r   rO   c                   ó6   a € ] tR tRt o RtR tR tR tRtV t	R# )ÚPropKBi  z=A KB for Propositional Logic.  Inefficient, with no indexing.c                ór   € \        \        V4      4       F  pV P                  P                  V4       K   	  R# )zùAdd the sentence's clauses to the KB

Examples
========

>>> from sympy.logic.inference import PropKB
>>> from sympy.abc import x, y
>>> l = PropKB()
>>> l.clauses
[]

>>> l.tell(x | y)
>>> l.clauses
[x | y]

>>> l.tell(y)
>>> l.clauses
[y, x | y]

N)r   r   rR   Úadd©rU   rV   Úcs   && r   rS   ÚPropKB.tell  s*   € ô* œ6 (Ó+Ö,ˆAØ�M‰M×Ñ˜aÖ ó -r   c                ó,   € \        WP                  4      # )zàChecks if the query is true given the set of clauses.

Examples
========

>>> from sympy.logic.inference import PropKB
>>> from sympy.abc import x, y
>>> l = PropKB()
>>> l.tell(x & ~y)
>>> l.ask(x)
True
>>> l.ask(y)
False

)rM   rR   r^   s   &&r   r`   Ú
PropKB.ask,  s   € ô  �uŸm™mÓ,Ð,r   c                ór   € \        \        V4      4       F  pV P                  P                  V4       K   	  R# )zýRemove the sentence's clauses from the KB

Examples
========

>>> from sympy.logic.inference import PropKB
>>> from sympy.abc import x, y
>>> l = PropKB()
>>> l.clauses
[]

>>> l.tell(x | y)
>>> l.clauses
[x | y]

>>> l.retract(x | y)
>>> l.clauses
[]

N)r   r   rR   Údiscardrv   s   && r   rc   ÚPropKB.retract>  s*   € ô* œ6 (Ó+Ö,ˆAØ�M‰M×!Ñ! !Ö$ó -r   r2   N)
rh   ri   rj   rk   rl   rS   r`   rc   rn   ro   rp   s   @r   rs   rs     s   ø‡ € ÙGò!ò0-÷$%ð %r   rs   )NFFF)NFr1   )rl   Úsympy.logic.boolalgr   r   r   r   r   Úsympy.core.sortingr   Úsympy.core.sympifyr   Úsympy.external.importtoolsr	   r   r*   r,   rC   rM   rO   rs   r2   r   r   Ú<module>r‚      sN   ðÙ &ç LÕ LÝ &Ý &Ý 4ò@ô4Tòn&ô0FôR.÷B,ñ ,ô*C%ˆRö C%r   