<jupyter_start><jupyter_text>Xor Library This library contains some nice abstractions for the Xor theory. This library helps separate out the specific Xor theory aspects in order to keep the term library general.  Setting up<jupyter_code>from symcollab.algebra import *
from symcollab.xor import *<jupyter_output><empty_output><jupyter_text>It's recommended that you set up your constants, variables, and functions ahead of time<jupyter_code>f = Function("f", arity = 2)
g = Function("g", 1)
x = Variable("x")
y = Variable("y")
z = Variable("z")
a = Constant("a")
b = Constant("b")
c = Constant("c")<jupyter_output><empty_output><jupyter_text>Description and Example This library makes use of several properties of Xor to make the presentation of terms simpler to the user. First, Xor is associative and commutative. This makes it so that the order at which we apply things don't matter. It also obeys the rule `xor(x, x) = id` for all `x`.<jupyter_code>term = xor(a,b,c,a,a,x,y)
print(term)<jupyter_output>a ⊕ b ⊕ c ⊕ x ⊕ y<jupyter_text>As you can see, it is printed using ⊕ as an infix operator. It is internally represented, however, just as you come to expect from the term library.<jupyter_code>term.__repr__()
term.flatten()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0992063492063492, 'fraction_numerical': 0.0015873015873015873, 'mean_word_length': 5.853260869565218, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '365031', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 427, 'n_tokens_neox': 407, 'n_words': 159, 'path': 'examples/notebooks/xor.ipynb', 'repo_name': 'symcollab/CryptoSolve', 'size': '1260'}