403Webshell
Server IP : 54.37.205.81  /  Your IP : 216.73.216.76
Web Server : nginx/1.22.1
System : Linux vps-249481fa 6.1.0-50-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.176-1 (2026-07-02) x86_64
User : debian ( 1000)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/nltk/inference/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/nltk/inference/__pycache__/api.cpython-311.pyc
�

 T�cJ����dZddlZddlZddlmZmZGd�de���ZGd�de���ZGd	�d
e���ZGd�de��Z	Gd
�de��Z
Gd�de��ZGd�dee	��ZGd�dee
��Z
Gd�de��ZGd�dee	��ZGd�dee
��ZGd�dee��ZGd�dee
��ZGd�d ej��ZdS)!a
Interfaces and base classes for theorem provers and model builders.

``Prover`` is a standard interface for a theorem prover which tries to prove a goal from a
list of assumptions.

``ModelBuilder`` is a standard interface for a model builder. Given just a set of assumptions.
the model builder tries to build a model for the assumptions. Given a set of assumptions and a
goal *G*, the model builder tries to find a counter-model, in the sense of a model that will satisfy
the assumptions plus the negation of *G*.
�N)�ABCMeta�abstractmethodc�2�eZdZdZdd�Zedd���ZdS)�Proverz�
    Interface for trying to prove a goal from assumptions.  Both the goal and
    the assumptions are constrained to be formulas of ``logic.Expression``.
    NFc�<�|�|||��dS)zX
        :return: Whether the proof was successful or not.
        :rtype: bool
        r)�_prove��self�goal�assumptions�verboses    �4/usr/lib/python3/dist-packages/nltk/inference/api.py�provezProver.prove s��
�{�{�4��g�6�6�q�9�9�c��dS)z{
        :return: Whether the proof was successful or not, along with the proof
        :rtype: tuple: (bool, str)
        N�r	s    rrz
Prover._prove'����r�NNF)�__name__�
__module__�__qualname__�__doc__rrrrrrrrsR��������
:�:�:�:������^���rr)�	metaclassc�2�eZdZdZdd�Zedd���ZdS)�ModelBuilderz�
    Interface for trying to build a model of set of formulas.
    Open formulas are assumed to be universally quantified.
    Both the goal and the assumptions are constrained to be formulas
    of ``logic.Expression``.
    NFc�<�|�|||��dS)zx
        Perform the actual model building.
        :return: Whether a model was generated
        :rtype: bool
        r)�_build_modelr	s    r�build_modelzModelBuilder.build_model7s!��� � ��{�G�<�<�Q�?�?rc��dS)z�
        Perform the actual model building.
        :return: Whether a model was generated, and the model itself
        :rtype: tuple(bool, sem.Valuation)
        Nrr	s    rrzModelBuilder._build_model?rrr)rrrrrrrrrrrr/sV��������@�@�@�@������^���rrc��eZdZdZed���Zed	d���Zed���Zed���Zed���Z	dS)
�TheoremToolCommand�h
    This class holds a goal and a list of assumptions to be used in proving
    or model building.
    c��dS�z�
        Add new assumptions to the assumption list.

        :param new_assumptions: new assumptions
        :type new_assumptions: list(sem.Expression)
        Nr�r
�new_assumptionss  r�add_assumptionsz"TheoremToolCommand.add_assumptionsNrrFc��dS)�-
        Retract assumptions from the assumption list.

        :param debug: If True, give warning when ``retracted`` is not present on
            assumptions list.
        :type debug: bool
        :param retracted: assumptions to be retracted
        :type retracted: list(sem.Expression)
        Nr�r
�	retracted�debugs   r�retract_assumptionsz&TheoremToolCommand.retract_assumptionsWrrc��dS)�X
        List the current assumptions.

        :return: list of ``Expression``
        Nr�r
s rrzTheoremToolCommand.assumptionscrrc��dS)�B
        Return the goal

        :return: ``Expression``
        Nrr0s rrzTheoremToolCommand.goalkrrc��dS�z<
        Print the list of the current assumptions.
        Nrr0s r�print_assumptionsz$TheoremToolCommand.print_assumptionssrrN�F)
rrrrrr'r-rrr5rrrr!r!Hs���������
����^���	�	�	��^�	�����^������^������^���rr!c�X�eZdZdZedd���Zed	d���Zed���ZdS)
�
ProverCommand��
    This class holds a ``Prover``, a goal, and a list of assumptions.  When
    prove() is called, the ``Prover`` is executed with the goal and assumptions.
    Fc��dS)z+
        Perform the actual proof.
        Nr�r
r
s  rrzProverCommand.prove�rrTc��dS)�p
        Return the proof string
        :param simplify: bool simplify the proof?
        :return: str
        Nr�r
�simplifys  r�proofzProverCommand.proof�rrc��dS)zF
        Return the prover object
        :return: ``Prover``
        Nrr0s r�
get_proverzProverCommand.get_prover�rrNr6�T)rrrrrrr@rBrrrr8r8zsy��������
�����^��
�����^������^���rr8c�X�eZdZdZedd���Zedd���Zed���ZdS)	�ModelBuilderCommandz�
    This class holds a ``ModelBuilder``, a goal, and a list of assumptions.
    When build_model() is called, the ``ModelBuilder`` is executed with the goal
    and assumptions.
    Fc��dS)z�
        Perform the actual model building.
        :return: A model if one is generated; None otherwise.
        :rtype: sem.Valuation
        Nrr;s  rrzModelBuilderCommand.build_model�rrNc��dS)��
        Return a string representation of the model

        :param simplify: bool simplify the proof?
        :return: str
        Nr�r
�formats  r�modelzModelBuilderCommand.model�rrc��dS)zS
        Return the model builder object
        :return: ``ModelBuilder``
        Nrr0s r�get_model_builderz%ModelBuilderCommand.get_model_builder�rrr6�N)rrrrrrrKrMrrrrErE�sy�������������^�������^������^���rrEc�:�eZdZdZd
d�Zd�Zdd�Zd�Zd�Zd	�Z	dS)�BaseTheoremToolCommandr"Nc�^�||_|sg|_nt|��|_d|_dS)z�
        :param goal: Input expression to prove
        :type goal: sem.Expression
        :param assumptions: Input expressions to use as assumptions in
            the proof.
        :type assumptions: list(sem.Expression)
        N)�_goal�_assumptions�list�_result)r
rrs   r�__init__zBaseTheoremToolCommand.__init__�s;����
��	2� "�D��� $�[� 1� 1�D�����H�Hrc�H�|j�|��d|_dSr$)rS�extendrUr%s  rr'z&BaseTheoremToolCommand.add_assumptions�s&��	
�� � ��1�1�1�����rFc���t����tt�fd�|j����}|r;||jkr0t	td����|���||_d|_dS)r)c���|�vSrNr)�ar+s �r�<lambda>z<BaseTheoremToolCommand.retract_assumptions.<locals>.<lambda>�s���A�Y�,>�rz&Assumptions list has not been changed:N)�setrT�filterrS�print�Warningr5rU)r
r+r,�result_lists `  rr-z*BaseTheoremToolCommand.retract_assumptions�s�����	�N�N�	��6�">�">�">�">��@Q�R�R�S�S���	%�[�D�$5�5�5��'�B�C�C�D�D�D��"�"�$�$�$�'�������rc��|jS)r/)rSr0s rrz"BaseTheoremToolCommand.assumptions�s
��� � rc��|jS)r2)rRr0s rrzBaseTheoremToolCommand.goal�s���z�rc�R�|���D]}t|���dSr4)rr_)r
r[s  rr5z(BaseTheoremToolCommand.print_assumptions�s6���!�!�#�#�	�	�A��!�H�H�H�H�	�	r�NNr6)
rrrrrVr'r-rrr5rrrrPrP�s���������
I�I�I�I�$�������(!�!�!��������rrPc�8�eZdZdZd
d�Zdd�Zdd�Zdd�Zd	�ZdS)
�BaseProverCommandr9Nc�\�||_	t�|||��d|_dS)z�
        :param prover: The theorem tool to execute with the assumptions
        :type prover: Prover
        :see: ``BaseTheoremToolCommand``
        N)�_proverrPrV�_proof)r
�proverrrs    rrVzBaseProverCommand.__init__
s1�����>��'�'��d�K�@�@�@�����rFc��|j�M|j�|���|���|��\|_|_|jS)zh
        Perform the actual proof.  Store the result to prevent unnecessary
        re-proving.
        )rUrirrrrjr;s  rrzBaseProverCommand.provesQ��
�<��(,��(;�(;��	�	���T�-�-�/�/��)�)�%�D�L�$�+��|�rTc�d�|j�td���|�|j|��S�r=Nz.You have to call prove() first to get a proof!�rU�LookupError�decorate_proofrjr>s  rr@zBaseProverCommand.proof"�3���<���N�O�O�O��&�&�t�{�H�=�=�=rc��|S�z�
        Modify and return the proof string
        :param proof_string: str the proof to decorate
        :param simplify: bool simplify the proof?
        :return: str
        r�r
�proof_stringr?s   rrqz BaseProverCommand.decorate_proof-s
���rc��|jSrN)rir0s rrBzBaseProverCommand.get_prover6s
���|�rrer6rC�	rrrrrVrr@rqrBrrrrgrgs}��������
����	�	�	�	�	>�	>�	>�	>���������rrgc�8�eZdZdZd	d�Zd
d�Zdd�Zdd�Zd�ZdS)�BaseModelBuilderCommandz�
    This class holds a ``ModelBuilder``, a goal, and a list of assumptions.  When
    build_model() is called, the ``ModelBuilder`` is executed with the goal and
    assumptions.
    Nc�\�||_	t�|||��d|_dS)z�
        :param modelbuilder: The theorem tool to execute with the assumptions
        :type modelbuilder: ModelBuilder
        :see: ``BaseTheoremToolCommand``
        N)�
_modelbuilderrPrV�_model)r
�modelbuilderrrs    rrVz BaseModelBuilderCommand.__init__As2��*���>��'�'��d�K�@�@�@�����rFc��|j�M|j�|���|���|��\|_|_|jS�zi
        Attempt to build a model.  Store the result to prevent unnecessary
        re-building.
        )rUr|rrrr}r;s  rrz#BaseModelBuilderCommand.build_modelNsR��
�<��(,�(:�(G�(G��	�	���T�-�-�/�/��)�)�%�D�L�$�+��|�rc�d�|j�td���|�|j|��S�rHNz4You have to call build_model() first to get a model!�rUrp�_decorate_modelr}rIs  rrKzBaseModelBuilderCommand.modelY�3���<���W�X�X�X��'�'���V�<�<�<rc��|S)z�
        :param valuation_str: str with the model builder's output
        :param format: str indicating the format for displaying
        :return: str
        r�r
�
valuation_strrJs   rr�z'BaseModelBuilderCommand._decorate_modeles
���rc��|jSrN)r|r0s rrMz)BaseModelBuilderCommand.get_model_builderms���!�!rrer6rN�	rrrrrVrrKr�rMrrrrzrz:s}������������	�	�	�	�
=�
=�
=�
=�����"�"�"�"�"rrzc�8�eZdZdZd�Zd�Zd�Zd�Zd
d�Zd�Z	d	S)�TheoremToolCommandDecoratorz�
    A base decorator for the ``ProverCommandDecorator`` and
    ``ModelBuilderCommandDecorator`` classes from which decorators can extend.
    c�"�||_d|_dS)zD
        :param command: ``TheoremToolCommand`` to decorate
        N)�_commandrU)r
�commands  rrVz$TheoremToolCommandDecorator.__init__ws�� ��
�����rc�4�|j���SrN)r�rr0s rrz'TheoremToolCommandDecorator.assumptions�s���}�(�(�*�*�*rc�4�|j���SrN)r�rr0s rrz TheoremToolCommandDecorator.goal�s���}�!�!�#�#�#rc�H�|j�|��d|_dSrN)r�r'rUr%s  rr'z+TheoremToolCommandDecorator.add_assumptions�s#���
�%�%�o�6�6�6�����rFc�J�|j�||��d|_dSrN)r�r-rUr*s   rr-z/TheoremToolCommandDecorator.retract_assumptions�s%���
�)�)�)�U�;�;�;�����rc�8�|j���dSrN)r�r5r0s rr5z-TheoremToolCommandDecorator.print_assumptions�s���
�'�'�)�)�)�)�)rNr6)
rrrrrVrrr'r-r5rrrr�r�qs}��������
���+�+�+�$�$�$��������*�*�*�*�*rr�c�6�eZdZdZd�Zd
d�Zdd�Zdd�Zd�Zd	S)�ProverCommandDecoratorzu
    A base decorator for the ``ProverCommand`` class from which other
    prover command decorators can extend.
    c�J�t�||��d|_dS)zE
        :param proverCommand: ``ProverCommand`` to decorate
        N)r�rVrj)r
�
proverCommands  rrVzProverCommandDecorator.__init__�s'��	$�,�,�T�=�A�A�A�����rFc���|j�\|���}|�|���|���|��\|_|_|jSrN)rUrBrrrrj)r
r
rks   rrzProverCommandDecorator.prove�sZ���<���_�_�&�&�F�(.�
�
��	�	���T�-�-�/�/��)�)�%�D�L�$�+��|�rTc�d�|j�td���|�|j|��Srnror>s  rr@zProverCommandDecorator.proof�rrrc�8�|j�||��Srt)r�rqrus   rrqz%ProverCommandDecorator.decorate_proof�s���}�+�+�L�(�C�C�Crc�4�|j���SrN�r�rBr0s rrBz!ProverCommandDecorator.get_prover�����}�'�'�)�)�)rNr6rCrxrrrr�r��s|��������
�������	>�	>�	>�	>�D�D�D�D�*�*�*�*�*rr�c�6�eZdZdZd�Zd	d�Zd
d�Zd
d�Zd�ZdS)�ModelBuilderCommandDecoratorz{
    A base decorator for the ``ModelBuilderCommand`` class from which other
    prover command decorators can extend.
    c�J�t�||��d|_dS)zQ
        :param modelBuilderCommand: ``ModelBuilderCommand`` to decorate
        N)r�rVr})r
�modelBuilderCommands  rrVz%ModelBuilderCommandDecorator.__init__�s(��	$�,�,�T�3F�G�G�G�����rFc���|j�\|���}|�|���|���|��\|_|_|jSr�)rUrMrrrr})r
r
r~s   rrz(ModelBuilderCommandDecorator.build_model�s`��
�<���1�1�3�3�L�(4�(A�(A��	�	���T�-�-�/�/��)�)�%�D�L�$�+��|�rNc�d�|j�td���|�|j|��Sr�r�rIs  rrKz"ModelBuilderCommandDecorator.model�r�rc�8�|j�||��S)z�
        Modify and return the proof string
        :param valuation_str: str with the model builder's output
        :param format: str indicating the format for displaying
        :return: str
        )r�r�r�s   rr�z,ModelBuilderCommandDecorator._decorate_model�s���}�,�,�]�F�C�C�Crc�4�|j���SrNr�r0s rrMz.ModelBuilderCommandDecorator.get_model_builder�r�rr6rNr�rrrr�r��s|��������
���
�
�
�
�
=�
=�
=�
=�D�D�D�D�*�*�*�*�*rr�c�.�eZdZdZd�Zdd�Zdd�Zd�ZdS)	�ParallelProverBuildera
    This class stores both a prover and a model builder and when either
    prove() or build_model() is called, then both theorem tools are run in
    parallel.  Whichever finishes first, the prover or the model builder, is the
    result that will be used.
    c�"�||_||_dSrN)rir|)r
rkr~s   rrVzParallelProverBuilder.__init__s�����)����rNFc�4�|�|||��dfS�N���_runr	s    rrzParallelProverBuilder._proves���y�y��{�G�4�4�b�8�8rc�6�|�|||��dfSr�r�r	s    rrz"ParallelProverBuilder._build_models ���9�9�T�;��8�8�8�"�<�<rc������t����fd��d��}t����fd��d��}|���|���|���r=|���r)	|���r|����)|j�|jS|j�|jSdS)Nc�<���j������SrN)rir�rrr
r
s����rr\z,ParallelProverBuilder._run.<locals>.<lambda>
s���D�L�&�&�t�[�'�B�B�r�TPc�<���j������SrN)r|rr�s����rr\z,ParallelProverBuilder._run.<locals>.<lambda>s���D�&�2�2�4��g�N�N�r�MB)�TheoremToolThread�start�is_alive�result)r
rrr
�	tp_thread�	mb_threads````  rr�zParallelProverBuilder._run
s�������%�B�B�B�B�B�B�B�G�T�
�
�	�&�N�N�N�N�N�N�N���
�
�	�	������������� � �"�"�	�y�'9�'9�';�';�	��� � �"�"�	�y�'9�'9�';�';�	���'��#�#�
�
�
)� �'�'�'��4rr)rrrrrVrrr�rrrr�r��sd��������*�*�*�9�9�9�9�=�=�=�=�����rr�c�0�eZdZdZdd�Zd	d�Zd	d�Zd�ZdS)
�ParallelProverBuilderCommanda�
    This command stores both a prover and a model builder and when either
    prove() or build_model() is called, then both theorem tools are run in
    parallel.  Whichever finishes first, the prover or the model builder, is the
    result that will be used.

    Because the theorem prover result is the opposite of the model builder
    result, we will treat self._result as meaning "proof found/no model found".
    Nc�z�t�||||��t�||||��dSrN)rgrVrz)r
rkr~rrs     rrVz%ParallelProverBuilderCommand.__init__/s<���"�"�4���{�C�C�C��(�(��|�T�;�O�O�O�O�OrFc�,�|�|��SrNr�r;s  rrz"ParallelProverBuilderCommand.prove3s���y�y��!�!�!rc�.�|�|��SrNr�r;s  rrz(ParallelProverBuilderCommand.build_model6s���9�9�W�%�%�%�%rc����t��fd��d��}t��fd��d��}|���|���|���r=|���r)	|���r|����)|j�
|j�_n|j�
|j�_�jS)Nc�:��t�����SrN)rgrr;s��rr\z3ParallelProverBuilderCommand._run.<locals>.<lambda><s���%�+�+�D�'�:�:�rr�c�:��t�����SrN)rzrr;s��rr\z3ParallelProverBuilderCommand._run.<locals>.<lambda>?s���+�7�7��g�F�F�rr�)r�r�r�r�rU)r
r
r�r�s``  rr�z!ParallelProverBuilderCommand._run9s�����%�:�:�:�:�:�G�T�
�
�	�&�F�F�F�F�F��QU�
�
�	�	������������� � �"�"�	�y�'9�'9�';�';�	��� � �"�"�	�y�'9�'9�';�';�	���'�$�+�D�L�L�
�
�
)�(�/�/�D�L��|�rrer6)rrrrrVrrr�rrrr�r�$sm��������P�P�P�P�"�"�"�"�&�&�&�&�����rr�c�2�eZdZdd�Zd�Zed���ZdS)r�Nc�|�tj�|��||_d|_||_||_dSrN)�	threading�ThreadrVr�rU�_verbose�_name)r
r�r
�names    rrVzTheoremToolThread.__init__Qs9����!�!�$�'�'�'���
������
���
�
�
rc�R�	|���|_|jrGtd|j�d|j�dtjtj��������dSdS#t$r1}t|��td|jz��Yd}~dSd}~wwxYw)NzThread z finished with result z at zThread %s completed abnormally)r�rUr�r_r��time�	localtime�	Exception)r
�es  r�runzTheoremToolThread.runXs���		C��=�=�?�?�D�L��}�
����z�z�z�4�<�<�<����	���1L�1L�1L�N������
�
��
�	C�	C�	C��!�H�H�H��2�d�j�A�B�B�B�B�B�B�B�B�B�����	C���s�A%A+�+
B&�5&B!�!B&c��|jSrN)rUr0s rr�zTheoremToolThread.resultds
���|�rrN)rrrrVr��propertyr�rrrr�r�PsU����������
C�
C�
C�����X���rr�)rr�r��abcrrrrr!r8rErPrgrzr�r�r�r�r�r�r�rrr�<module>r�s���
�
���������'�'�'�'�'�'�'�'������w�����*�����W�����2/�/�/�/�/�7�/�/�/�/�d�����&����8�����,����@K�K�K�K�K�/�K�K�K�\3�3�3�3�3�.�
�3�3�3�l4"�4"�4"�4"�4"�4�6I�4"�4"�4"�n*�*�*�*�*�"4�*�*�*�D-*�-*�-*�-*�-*�8�-�-*�-*�-*�`2*�2*�2*�2*�2*�#>�@S�2*�2*�2*�j)�)�)�)�)�F�L�)�)�)�X)�)�)�)�)�#4�6M�)�)�)�X�����	�(�����r

Youez - 2016 - github.com/yon3zu
LinuXploit