diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/polys/numberfields/tests/__pycache__/test_minpoly.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/polys/numberfields/tests/__pycache__/test_minpoly.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..31801d78dc603979ca9b4a9859fa9a6656c4d7e4 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/polys/numberfields/tests/__pycache__/test_minpoly.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/__init__.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7311fb89ac35ac21d3e6c506ddbadae3e347ca7a Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/__init__.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/aesaracode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/aesaracode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ff6f6eb6587a65c0f27e3115cfc81fcd2d00ee82 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/aesaracode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/c.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/c.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e39c4920680d83a5c3e27f075c67c87e4792a63b Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/c.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/codeprinter.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/codeprinter.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6875502aa492f79085c354615ebe7b1e35e60141 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/codeprinter.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/conventions.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/conventions.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6c201ff5538501f02533972683bda185de717000 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/conventions.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/cxx.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/cxx.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7253cbc043601c552a43902d463eb59d5e8e6ad0 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/cxx.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/defaults.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/defaults.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0386696d739f211bfb1985039a2926a9e882dd1f Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/defaults.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/dot.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/dot.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..059565954fddc84bc5a1d3f279a88aece9053c9a Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/dot.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/fortran.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/fortran.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..453253f1260a88620cacbb23f553a5aed469c948 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/fortran.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/glsl.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/glsl.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..22b6f20e94b96fdcf35fed3ba1ffc89c2bdeaa35 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/glsl.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/gtk.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/gtk.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..515dc849d19078bba79f60d4eeabb3341e7f14f2 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/gtk.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/jscode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/jscode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e826843baf92a1d034f83b3df37f161da406abdc Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/jscode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/julia.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/julia.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dfab4742f25f811233060cfcee2910128e2ed304 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/julia.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/lambdarepr.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/lambdarepr.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d01aafc210ee63216981874b5600877336563c7e Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/lambdarepr.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/latex.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/latex.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b0fbd3326fb1cc28b3d881ae1d295f67556fad14 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/latex.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/llvmjitcode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/llvmjitcode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3796d288201ef50fe4df246d34cdb4aab57f4bc4 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/llvmjitcode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/maple.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/maple.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d9849bee1afa463cb3828398e088978556077ca Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/maple.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/mathematica.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/mathematica.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e270876a4e4c797ec212db3b813c4b95c9d5d86b Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/mathematica.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/mathml.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/mathml.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be38e12243e07e9accee86ed0b289a2ee8db863a Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/mathml.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/numpy.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/numpy.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f8974c6feb4fb80f7bc71b51dd349ea969d79e4e Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/numpy.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/octave.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/octave.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..beb56d07cfa833cc29a4185821bb5924051a1942 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/octave.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/precedence.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/precedence.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f613611d6be3765c57b8898a39c33df7e01595a9 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/precedence.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/preview.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/preview.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49a76b26ade2b8bd00d81e7aa109b2a5289bf546 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/preview.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/printer.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/printer.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0a977e540a9ecc2799551e6755f8804de2bd6dbd Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/printer.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/pycode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/pycode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..82abcf2455507ee13c39f1b45dd8b0685c723f81 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/pycode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/python.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/python.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..11b38f6defcd63195f4a87943815d603844ea748 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/python.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/rcode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/rcode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..942ed17ee1107b162166622c2684ff0b51206be8 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/rcode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/repr.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/repr.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e2173e1301804214ab9e6314dad5ffb0d35565d9 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/repr.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/rust.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/rust.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9c3696989316c002e2505a567f7e838a3813e1c Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/rust.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/smtlib.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/smtlib.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c25e482b40dd17285e0d55059b8597fda064d9c4 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/smtlib.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/str.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/str.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b242b14c7844eb2a2e829dcdd0ba8379a54014df Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/str.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tableform.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tableform.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..618e064ca89d3f1df5a6e47b1fb3126886d229ea Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tableform.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tensorflow.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tensorflow.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a8fad77281bba04a75327e11c825a277ef93840e Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tensorflow.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/theanocode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/theanocode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6d399f779a2f52505412a51f1b27c073374a0fb9 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/theanocode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tree.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tree.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..337cce932331778331ff30713f290b102d480318 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/__pycache__/tree.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/__init__.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..21e18c9aae609cab8382012a972e36541e0a5e63 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/__init__.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/test_pretty.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/test_pretty.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81de8638155b1ed092462c84308d936e967688ef Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/pretty/tests/__pycache__/test_pretty.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/__init__.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8cf23b0cfe03c0341d1303165aeeb1c80135a0be Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/__init__.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_aesaracode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_aesaracode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..03947de419dafe7e984a58227a0a71efc1220cbb Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_aesaracode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_codeprinter.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_codeprinter.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..45cb783104919ace72c886a99b8a9b39820c49a1 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_codeprinter.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_dot.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_dot.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..72e8cb7d4341a4ca5ca4222c81cbe8ba797d9261 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_dot.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_gtk.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_gtk.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..31cc4616a0120d084bc1955f86a270a76f19052a Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_gtk.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_jax.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_jax.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aa71748eb9364bac1871828c35c86179154b46ee Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_jax.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_lambdarepr.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_lambdarepr.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..808c0c3c06828d1db9f014f9e820e371988f864f Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_lambdarepr.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_numpy.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_numpy.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8ad9e72847696a573be6d9f6fa0ead483a7c172f Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_numpy.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_precedence.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_precedence.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..31101a8f4d802c0d28cfbe0e45d7976d8d980f48 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_precedence.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_preview.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_preview.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..054b4921e4e9e0aad91b4c5a0fc0cf2cce8d9efd Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_preview.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_pycode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_pycode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..81fa323358f33078547d9d716ced914c266ecec9 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_pycode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_rcode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_rcode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e731abf9f4667256293049c5928970e8537dda6b Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_rcode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_repr.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_repr.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..8224929060e1445972bb2eecade9d0b2fe1ff18f Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_repr.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_smtlib.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_smtlib.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e821a987dc432c73f2e78b37c0a8d7c86d35779f Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_smtlib.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_theanocode.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_theanocode.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..889e03f1fc7f85d40f111961991b6de9575de1b6 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/printing/tests/__pycache__/test_theanocode.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__init__.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bb4c5aa8afe6fd818e136ec0797b7429e2da76cf --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__init__.py @@ -0,0 +1,50 @@ +""" Rewrite Rules + +DISCLAIMER: This module is experimental. The interface is subject to change. + +A rule is a function that transforms one expression into another + + Rule :: Expr -> Expr + +A strategy is a function that says how a rule should be applied to a syntax +tree. In general strategies take rules and produce a new rule + + Strategy :: [Rules], Other-stuff -> Rule + +This allows developers to separate a mathematical transformation from the +algorithmic details of applying that transformation. The goal is to separate +the work of mathematical programming from algorithmic programming. + +Submodules + +strategies.rl - some fundamental rules +strategies.core - generic non-SymPy specific strategies +strategies.traverse - strategies that traverse a SymPy tree +strategies.tools - some conglomerate strategies that do depend on SymPy +""" + +from . import rl +from . import traverse +from .rl import rm_id, unpack, flatten, sort, glom, distribute, rebuild +from .util import new +from .core import ( + condition, debug, chain, null_safe, do_one, exhaust, minimize, tryit) +from .tools import canon, typed +from . import branch + +__all__ = [ + 'rl', + + 'traverse', + + 'rm_id', 'unpack', 'flatten', 'sort', 'glom', 'distribute', 'rebuild', + + 'new', + + 'condition', 'debug', 'chain', 'null_safe', 'do_one', 'exhaust', + 'minimize', 'tryit', + + 'canon', 'typed', + + 'branch', +] diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/__init__.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..69aea5800948bf251363107078fa7ace3fe16f8f Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/__init__.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/core.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/core.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ee524dbc4760cf43ffd88b904d4b3f00873ddafa Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/core.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/rl.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/rl.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9238b5fe0d59090d2e7e9812c74b583ebb3cdfd Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/rl.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/tools.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/tools.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..87ca1146685c093393c77ed34a83f1cd19df2b2a Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/tools.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/traverse.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/traverse.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..acd0b1b44bd32b1c58cb7dd8b2037eee6d204491 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/traverse.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/tree.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/tree.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0726a09e0c7bb5ef3640cbc7f537bb97dd8e995 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/tree.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/util.cpython-310.pyc b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/util.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..189d09cadf1cb8fc39d015f9fd5c880573331bb2 Binary files /dev/null and b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/__pycache__/util.cpython-310.pyc differ diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/__init__.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fec5afe84a58f3d887a8c762692a3673a2b6d4c8 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/__init__.py @@ -0,0 +1,14 @@ +from . import traverse +from .core import ( + condition, debug, multiplex, exhaust, notempty, + chain, onaction, sfilter, yieldify, do_one, identity) +from .tools import canon + +__all__ = [ + 'traverse', + + 'condition', 'debug', 'multiplex', 'exhaust', 'notempty', 'chain', + 'onaction', 'sfilter', 'yieldify', 'do_one', 'identity', + + 'canon', +] diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/core.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/core.py new file mode 100644 index 0000000000000000000000000000000000000000..2dabaef69b60d994799f71414699223f84e1809b --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/core.py @@ -0,0 +1,116 @@ +""" Generic SymPy-Independent Strategies """ + + +def identity(x): + yield x + + +def exhaust(brule): + """ Apply a branching rule repeatedly until it has no effect """ + def exhaust_brl(expr): + seen = {expr} + for nexpr in brule(expr): + if nexpr not in seen: + seen.add(nexpr) + yield from exhaust_brl(nexpr) + if seen == {expr}: + yield expr + return exhaust_brl + + +def onaction(brule, fn): + def onaction_brl(expr): + for result in brule(expr): + if result != expr: + fn(brule, expr, result) + yield result + return onaction_brl + + +def debug(brule, file=None): + """ Print the input and output expressions at each rule application """ + if not file: + from sys import stdout + file = stdout + + def write(brl, expr, result): + file.write("Rule: %s\n" % brl.__name__) + file.write("In: %s\nOut: %s\n\n" % (expr, result)) + + return onaction(brule, write) + + +def multiplex(*brules): + """ Multiplex many branching rules into one """ + def multiplex_brl(expr): + seen = set() + for brl in brules: + for nexpr in brl(expr): + if nexpr not in seen: + seen.add(nexpr) + yield nexpr + return multiplex_brl + + +def condition(cond, brule): + """ Only apply branching rule if condition is true """ + def conditioned_brl(expr): + if cond(expr): + yield from brule(expr) + else: + pass + return conditioned_brl + + +def sfilter(pred, brule): + """ Yield only those results which satisfy the predicate """ + def filtered_brl(expr): + yield from filter(pred, brule(expr)) + return filtered_brl + + +def notempty(brule): + def notempty_brl(expr): + yielded = False + for nexpr in brule(expr): + yielded = True + yield nexpr + if not yielded: + yield expr + return notempty_brl + + +def do_one(*brules): + """ Execute one of the branching rules """ + def do_one_brl(expr): + yielded = False + for brl in brules: + for nexpr in brl(expr): + yielded = True + yield nexpr + if yielded: + return + return do_one_brl + + +def chain(*brules): + """ + Compose a sequence of brules so that they apply to the expr sequentially + """ + def chain_brl(expr): + if not brules: + yield expr + return + + head, tail = brules[0], brules[1:] + for nexpr in head(expr): + yield from chain(*tail)(nexpr) + + return chain_brl + + +def yieldify(rl): + """ Turn a rule into a branching rule """ + def brl(expr): + yield rl(expr) + return brl diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/__init__.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_core.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_core.py new file mode 100644 index 0000000000000000000000000000000000000000..ac620b0afb6dbadc4d97b29ddbb341cd920b6588 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_core.py @@ -0,0 +1,117 @@ +from sympy.strategies.branch.core import ( + exhaust, debug, multiplex, condition, notempty, chain, onaction, sfilter, + yieldify, do_one, identity) + + +def posdec(x): + if x > 0: + yield x - 1 + else: + yield x + + +def branch5(x): + if 0 < x < 5: + yield x - 1 + elif 5 < x < 10: + yield x + 1 + elif x == 5: + yield x + 1 + yield x - 1 + else: + yield x + + +def even(x): + return x % 2 == 0 + + +def inc(x): + yield x + 1 + + +def one_to_n(n): + yield from range(n) + + +def test_exhaust(): + brl = exhaust(branch5) + assert set(brl(3)) == {0} + assert set(brl(7)) == {10} + assert set(brl(5)) == {0, 10} + + +def test_debug(): + from io import StringIO + file = StringIO() + rl = debug(posdec, file) + list(rl(5)) + log = file.getvalue() + file.close() + + assert posdec.__name__ in log + assert '5' in log + assert '4' in log + + +def test_multiplex(): + brl = multiplex(posdec, branch5) + assert set(brl(3)) == {2} + assert set(brl(7)) == {6, 8} + assert set(brl(5)) == {4, 6} + + +def test_condition(): + brl = condition(even, branch5) + assert set(brl(4)) == set(branch5(4)) + assert set(brl(5)) == set() + + +def test_sfilter(): + brl = sfilter(even, one_to_n) + assert set(brl(10)) == {0, 2, 4, 6, 8} + + +def test_notempty(): + def ident_if_even(x): + if even(x): + yield x + + brl = notempty(ident_if_even) + assert set(brl(4)) == {4} + assert set(brl(5)) == {5} + + +def test_chain(): + assert list(chain()(2)) == [2] # identity + assert list(chain(inc, inc)(2)) == [4] + assert list(chain(branch5, inc)(4)) == [4] + assert set(chain(branch5, inc)(5)) == {5, 7} + assert list(chain(inc, branch5)(5)) == [7] + + +def test_onaction(): + L = [] + + def record(fn, input, output): + L.append((input, output)) + + list(onaction(inc, record)(2)) + assert L == [(2, 3)] + + list(onaction(identity, record)(2)) + assert L == [(2, 3)] + + +def test_yieldify(): + yinc = yieldify(lambda x: x + 1) + assert list(yinc(3)) == [4] + + +def test_do_one(): + def bad(expr): + raise ValueError + + assert list(do_one(inc)(3)) == [4] + assert list(do_one(inc, bad)(3)) == [4] + assert list(do_one(inc, posdec)(3)) == [4] diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_tools.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_tools.py new file mode 100644 index 0000000000000000000000000000000000000000..c2bd224030c337f0a000d94f6e7e65f3b8bd118f --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_tools.py @@ -0,0 +1,42 @@ +from sympy.strategies.branch.tools import canon +from sympy.core.basic import Basic +from sympy.core.numbers import Integer +from sympy.core.singleton import S + + +def posdec(x): + if isinstance(x, Integer) and x > 0: + yield x - 1 + else: + yield x + + +def branch5(x): + if isinstance(x, Integer): + if 0 < x < 5: + yield x - 1 + elif 5 < x < 10: + yield x + 1 + elif x == 5: + yield x + 1 + yield x - 1 + else: + yield x + + +def test_zero_ints(): + expr = Basic(S(2), Basic(S(5), S(3)), S(8)) + expected = {Basic(S(0), Basic(S(0), S(0)), S(0))} + + brl = canon(posdec) + assert set(brl(expr)) == expected + + +def test_split5(): + expr = Basic(S(2), Basic(S(5), S(3)), S(8)) + expected = { + Basic(S(0), Basic(S(0), S(0)), S(10)), + Basic(S(0), Basic(S(10), S(0)), S(10))} + + brl = canon(branch5) + assert set(brl(expr)) == expected diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_traverse.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_traverse.py new file mode 100644 index 0000000000000000000000000000000000000000..e051928210981223004de28b8c617d0438e11ac6 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tests/test_traverse.py @@ -0,0 +1,53 @@ +from sympy.core.basic import Basic +from sympy.core.numbers import Integer +from sympy.core.singleton import S +from sympy.strategies.branch.traverse import top_down, sall +from sympy.strategies.branch.core import do_one, identity + + +def inc(x): + if isinstance(x, Integer): + yield x + 1 + + +def test_top_down_easy(): + expr = Basic(S(1), S(2)) + expected = Basic(S(2), S(3)) + brl = top_down(inc) + + assert set(brl(expr)) == {expected} + + +def test_top_down_big_tree(): + expr = Basic(S(1), Basic(S(2)), Basic(S(3), Basic(S(4)), S(5))) + expected = Basic(S(2), Basic(S(3)), Basic(S(4), Basic(S(5)), S(6))) + brl = top_down(inc) + + assert set(brl(expr)) == {expected} + + +def test_top_down_harder_function(): + def split5(x): + if x == 5: + yield x - 1 + yield x + 1 + + expr = Basic(Basic(S(5), S(6)), S(1)) + expected = {Basic(Basic(S(4), S(6)), S(1)), Basic(Basic(S(6), S(6)), S(1))} + brl = top_down(split5) + + assert set(brl(expr)) == expected + + +def test_sall(): + expr = Basic(S(1), S(2)) + expected = Basic(S(2), S(3)) + brl = sall(inc) + + assert list(brl(expr)) == [expected] + + expr = Basic(S(1), S(2), Basic(S(3), S(4))) + expected = Basic(S(2), S(3), Basic(S(3), S(4))) + brl = sall(do_one(inc, identity)) + + assert list(brl(expr)) == [expected] diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tools.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tools.py new file mode 100644 index 0000000000000000000000000000000000000000..a6c9097323a7962080ae4497ead976818e386518 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/tools.py @@ -0,0 +1,12 @@ +from .core import exhaust, multiplex +from .traverse import top_down + + +def canon(*rules): + """ Strategy for canonicalization + + Apply each branching rule in a top-down fashion through the tree. + Multiplex through all branching rule traversals + Keep doing this until there is no change. + """ + return exhaust(multiplex(*map(top_down, rules))) diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/traverse.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/traverse.py new file mode 100644 index 0000000000000000000000000000000000000000..28b7098dbda401fc0f0b6d27988d8c37e2f231ae --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/branch/traverse.py @@ -0,0 +1,25 @@ +""" Branching Strategies to Traverse a Tree """ +from itertools import product +from sympy.strategies.util import basic_fns +from .core import chain, identity, do_one + + +def top_down(brule, fns=basic_fns): + """ Apply a rule down a tree running it on the top nodes first """ + return chain(do_one(brule, identity), + lambda expr: sall(top_down(brule, fns), fns)(expr)) + + +def sall(brule, fns=basic_fns): + """ Strategic all - apply rule to args """ + op, new, children, leaf = map(fns.get, ('op', 'new', 'children', 'leaf')) + + def all_rl(expr): + if leaf(expr): + yield expr + else: + myop = op(expr) + argss = product(*map(brule, children(expr))) + for args in argss: + yield new(myop, *args) + return all_rl diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/core.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/core.py new file mode 100644 index 0000000000000000000000000000000000000000..75b75cb5f2e0693eea98a7b1c9b3e7f036ec26f6 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/core.py @@ -0,0 +1,151 @@ +""" Generic SymPy-Independent Strategies """ +from __future__ import annotations +from collections.abc import Callable, Mapping +from typing import TypeVar +from sys import stdout + + +_S = TypeVar('_S') +_T = TypeVar('_T') + + +def identity(x: _T) -> _T: + return x + + +def exhaust(rule: Callable[[_T], _T]) -> Callable[[_T], _T]: + """ Apply a rule repeatedly until it has no effect """ + def exhaustive_rl(expr: _T) -> _T: + new, old = rule(expr), expr + while new != old: + new, old = rule(new), new + return new + return exhaustive_rl + + +def memoize(rule: Callable[[_S], _T]) -> Callable[[_S], _T]: + """Memoized version of a rule + + Notes + ===== + + This cache can grow infinitely, so it is not recommended to use this + than ``functools.lru_cache`` unless you need very heavy computation. + """ + cache: dict[_S, _T] = {} + + def memoized_rl(expr: _S) -> _T: + if expr in cache: + return cache[expr] + else: + result = rule(expr) + cache[expr] = result + return result + return memoized_rl + + +def condition( + cond: Callable[[_T], bool], rule: Callable[[_T], _T] +) -> Callable[[_T], _T]: + """ Only apply rule if condition is true """ + def conditioned_rl(expr: _T) -> _T: + if cond(expr): + return rule(expr) + return expr + return conditioned_rl + + +def chain(*rules: Callable[[_T], _T]) -> Callable[[_T], _T]: + """ + Compose a sequence of rules so that they apply to the expr sequentially + """ + def chain_rl(expr: _T) -> _T: + for rule in rules: + expr = rule(expr) + return expr + return chain_rl + + +def debug(rule, file=None): + """ Print out before and after expressions each time rule is used """ + if file is None: + file = stdout + + def debug_rl(*args, **kwargs): + expr = args[0] + result = rule(*args, **kwargs) + if result != expr: + file.write("Rule: %s\n" % rule.__name__) + file.write("In: %s\nOut: %s\n\n" % (expr, result)) + return result + return debug_rl + + +def null_safe(rule: Callable[[_T], _T | None]) -> Callable[[_T], _T]: + """ Return original expr if rule returns None """ + def null_safe_rl(expr: _T) -> _T: + result = rule(expr) + if result is None: + return expr + return result + return null_safe_rl + + +def tryit(rule: Callable[[_T], _T], exception) -> Callable[[_T], _T]: + """ Return original expr if rule raises exception """ + def try_rl(expr: _T) -> _T: + try: + return rule(expr) + except exception: + return expr + return try_rl + + +def do_one(*rules: Callable[[_T], _T]) -> Callable[[_T], _T]: + """ Try each of the rules until one works. Then stop. """ + def do_one_rl(expr: _T) -> _T: + for rl in rules: + result = rl(expr) + if result != expr: + return result + return expr + return do_one_rl + + +def switch( + key: Callable[[_S], _T], + ruledict: Mapping[_T, Callable[[_S], _S]] +) -> Callable[[_S], _S]: + """ Select a rule based on the result of key called on the function """ + def switch_rl(expr: _S) -> _S: + rl = ruledict.get(key(expr), identity) + return rl(expr) + return switch_rl + + +# XXX Untyped default argument for minimize function +# where python requires SupportsRichComparison type +def _identity(x): + return x + + +def minimize( + *rules: Callable[[_S], _T], + objective=_identity +) -> Callable[[_S], _T]: + """ Select result of rules that minimizes objective + + >>> from sympy.strategies import minimize + >>> inc = lambda x: x + 1 + >>> dec = lambda x: x - 1 + >>> rl = minimize(inc, dec) + >>> rl(4) + 3 + + >>> rl = minimize(inc, dec, objective=lambda x: -x) # maximize + >>> rl(4) + 5 + """ + def minrule(expr: _S) -> _T: + return min([rule(expr) for rule in rules], key=objective) + return minrule diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/rl.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/rl.py new file mode 100644 index 0000000000000000000000000000000000000000..c002f8b9aeb73015c1246b44ab0c11710c4d5a72 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/rl.py @@ -0,0 +1,176 @@ +""" Generic Rules for SymPy + +This file assumes knowledge of Basic and little else. +""" +from sympy.utilities.iterables import sift +from .util import new + + +# Functions that create rules +def rm_id(isid, new=new): + """ Create a rule to remove identities. + + isid - fn :: x -> Bool --- whether or not this element is an identity. + + Examples + ======== + + >>> from sympy.strategies import rm_id + >>> from sympy import Basic, S + >>> remove_zeros = rm_id(lambda x: x==0) + >>> remove_zeros(Basic(S(1), S(0), S(2))) + Basic(1, 2) + >>> remove_zeros(Basic(S(0), S(0))) # If only identites then we keep one + Basic(0) + + See Also: + unpack + """ + def ident_remove(expr): + """ Remove identities """ + ids = list(map(isid, expr.args)) + if sum(ids) == 0: # No identities. Common case + return expr + elif sum(ids) != len(ids): # there is at least one non-identity + return new(expr.__class__, + *[arg for arg, x in zip(expr.args, ids) if not x]) + else: + return new(expr.__class__, expr.args[0]) + + return ident_remove + + +def glom(key, count, combine): + """ Create a rule to conglomerate identical args. + + Examples + ======== + + >>> from sympy.strategies import glom + >>> from sympy import Add + >>> from sympy.abc import x + + >>> key = lambda x: x.as_coeff_Mul()[1] + >>> count = lambda x: x.as_coeff_Mul()[0] + >>> combine = lambda cnt, arg: cnt * arg + >>> rl = glom(key, count, combine) + + >>> rl(Add(x, -x, 3*x, 2, 3, evaluate=False)) + 3*x + 5 + + Wait, how are key, count and combine supposed to work? + + >>> key(2*x) + x + >>> count(2*x) + 2 + >>> combine(2, x) + 2*x + """ + def conglomerate(expr): + """ Conglomerate together identical args x + x -> 2x """ + groups = sift(expr.args, key) + counts = {k: sum(map(count, args)) for k, args in groups.items()} + newargs = [combine(cnt, mat) for mat, cnt in counts.items()] + if set(newargs) != set(expr.args): + return new(type(expr), *newargs) + else: + return expr + + return conglomerate + + +def sort(key, new=new): + """ Create a rule to sort by a key function. + + Examples + ======== + + >>> from sympy.strategies import sort + >>> from sympy import Basic, S + >>> sort_rl = sort(str) + >>> sort_rl(Basic(S(3), S(1), S(2))) + Basic(1, 2, 3) + """ + + def sort_rl(expr): + return new(expr.__class__, *sorted(expr.args, key=key)) + return sort_rl + + +def distribute(A, B): + """ Turns an A containing Bs into a B of As + + where A, B are container types + + >>> from sympy.strategies import distribute + >>> from sympy import Add, Mul, symbols + >>> x, y = symbols('x,y') + >>> dist = distribute(Mul, Add) + >>> expr = Mul(2, x+y, evaluate=False) + >>> expr + 2*(x + y) + >>> dist(expr) + 2*x + 2*y + """ + + def distribute_rl(expr): + for i, arg in enumerate(expr.args): + if isinstance(arg, B): + first, b, tail = expr.args[:i], expr.args[i], expr.args[i + 1:] + return B(*[A(*(first + (arg,) + tail)) for arg in b.args]) + return expr + return distribute_rl + + +def subs(a, b): + """ Replace expressions exactly """ + def subs_rl(expr): + if expr == a: + return b + else: + return expr + return subs_rl + + +# Functions that are rules +def unpack(expr): + """ Rule to unpack singleton args + + >>> from sympy.strategies import unpack + >>> from sympy import Basic, S + >>> unpack(Basic(S(2))) + 2 + """ + if len(expr.args) == 1: + return expr.args[0] + else: + return expr + + +def flatten(expr, new=new): + """ Flatten T(a, b, T(c, d), T2(e)) to T(a, b, c, d, T2(e)) """ + cls = expr.__class__ + args = [] + for arg in expr.args: + if arg.__class__ == cls: + args.extend(arg.args) + else: + args.append(arg) + return new(expr.__class__, *args) + + +def rebuild(expr): + """ Rebuild a SymPy tree. + + Explanation + =========== + + This function recursively calls constructors in the expression tree. + This forces canonicalization and removes ugliness introduced by the use of + Basic.__new__ + """ + if expr.is_Atom: + return expr + else: + return expr.func(*list(map(rebuild, expr.args))) diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/tools.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/tools.py new file mode 100644 index 0000000000000000000000000000000000000000..e6a94c16db57206d7c83c8a5e13930c4cffdde47 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/tools.py @@ -0,0 +1,53 @@ +from . import rl +from .core import do_one, exhaust, switch +from .traverse import top_down + + +def subs(d, **kwargs): + """ Full simultaneous exact substitution. + + Examples + ======== + + >>> from sympy.strategies.tools import subs + >>> from sympy import Basic, S + >>> mapping = {S(1): S(4), S(4): S(1), Basic(S(5)): Basic(S(6), S(7))} + >>> expr = Basic(S(1), Basic(S(2), S(3)), Basic(S(4), Basic(S(5)))) + >>> subs(mapping)(expr) + Basic(4, Basic(2, 3), Basic(1, Basic(6, 7))) + """ + if d: + return top_down(do_one(*map(rl.subs, *zip(*d.items()))), **kwargs) + else: + return lambda x: x + + +def canon(*rules, **kwargs): + """ Strategy for canonicalization. + + Explanation + =========== + + Apply each rule in a bottom_up fashion through the tree. + Do each one in turn. + Keep doing this until there is no change. + """ + return exhaust(top_down(exhaust(do_one(*rules)), **kwargs)) + + +def typed(ruletypes): + """ Apply rules based on the expression type + + inputs: + ruletypes -- a dict mapping {Type: rule} + + Examples + ======== + + >>> from sympy.strategies import rm_id, typed + >>> from sympy import Add, Mul + >>> rm_zeros = rm_id(lambda x: x==0) + >>> rm_ones = rm_id(lambda x: x==1) + >>> remove_idents = typed({Add: rm_zeros, Mul: rm_ones}) + """ + return switch(type, ruletypes) diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/traverse.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/traverse.py new file mode 100644 index 0000000000000000000000000000000000000000..869361f443742b5b7346c9c970f103b955e8473e --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/traverse.py @@ -0,0 +1,37 @@ +"""Strategies to Traverse a Tree.""" +from sympy.strategies.util import basic_fns +from sympy.strategies.core import chain, do_one + + +def top_down(rule, fns=basic_fns): + """Apply a rule down a tree running it on the top nodes first.""" + return chain(rule, lambda expr: sall(top_down(rule, fns), fns)(expr)) + + +def bottom_up(rule, fns=basic_fns): + """Apply a rule down a tree running it on the bottom nodes first.""" + return chain(lambda expr: sall(bottom_up(rule, fns), fns)(expr), rule) + + +def top_down_once(rule, fns=basic_fns): + """Apply a rule down a tree - stop on success.""" + return do_one(rule, lambda expr: sall(top_down(rule, fns), fns)(expr)) + + +def bottom_up_once(rule, fns=basic_fns): + """Apply a rule up a tree - stop on success.""" + return do_one(lambda expr: sall(bottom_up(rule, fns), fns)(expr), rule) + + +def sall(rule, fns=basic_fns): + """Strategic all - apply rule to args.""" + op, new, children, leaf = map(fns.get, ('op', 'new', 'children', 'leaf')) + + def all_rl(expr): + if leaf(expr): + return expr + else: + args = map(rule, children(expr)) + return new(op(expr), *args) + + return all_rl diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/tree.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/tree.py new file mode 100644 index 0000000000000000000000000000000000000000..c2006fde4fc5d09f3d38baae4d7335b4cbd971b7 --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/tree.py @@ -0,0 +1,139 @@ +from functools import partial +from sympy.strategies import chain, minimize +from sympy.strategies.core import identity +import sympy.strategies.branch as branch +from sympy.strategies.branch import yieldify + + +def treeapply(tree, join, leaf=identity): + """ Apply functions onto recursive containers (tree). + + Explanation + =========== + + join - a dictionary mapping container types to functions + e.g. ``{list: minimize, tuple: chain}`` + + Keys are containers/iterables. Values are functions [a] -> a. + + Examples + ======== + + >>> from sympy.strategies.tree import treeapply + >>> tree = [(3, 2), (4, 1)] + >>> treeapply(tree, {list: max, tuple: min}) + 2 + + >>> add = lambda *args: sum(args) + >>> def mul(*args): + ... total = 1 + ... for arg in args: + ... total *= arg + ... return total + >>> treeapply(tree, {list: mul, tuple: add}) + 25 + """ + for typ in join: + if isinstance(tree, typ): + return join[typ](*map(partial(treeapply, join=join, leaf=leaf), + tree)) + return leaf(tree) + + +def greedy(tree, objective=identity, **kwargs): + """ Execute a strategic tree. Select alternatives greedily + + Trees + ----- + + Nodes in a tree can be either + + function - a leaf + list - a selection among operations + tuple - a sequence of chained operations + + Textual examples + ---------------- + + Text: Run f, then run g, e.g. ``lambda x: g(f(x))`` + Code: ``(f, g)`` + + Text: Run either f or g, whichever minimizes the objective + Code: ``[f, g]`` + + Textx: Run either f or g, whichever is better, then run h + Code: ``([f, g], h)`` + + Text: Either expand then simplify or try factor then foosimp. Finally print + Code: ``([(expand, simplify), (factor, foosimp)], print)`` + + Objective + --------- + + "Better" is determined by the objective keyword. This function makes + choices to minimize the objective. It defaults to the identity. + + Examples + ======== + + >>> from sympy.strategies.tree import greedy + >>> inc = lambda x: x + 1 + >>> dec = lambda x: x - 1 + >>> double = lambda x: 2*x + + >>> tree = [inc, (dec, double)] # either inc or dec-then-double + >>> fn = greedy(tree) + >>> fn(4) # lowest value comes from the inc + 5 + >>> fn(1) # lowest value comes from dec then double + 0 + + This function selects between options in a tuple. The result is chosen + that minimizes the objective function. + + >>> fn = greedy(tree, objective=lambda x: -x) # maximize + >>> fn(4) # highest value comes from the dec then double + 6 + >>> fn(1) # highest value comes from the inc + 2 + + Greediness + ---------- + + This is a greedy algorithm. In the example: + + ([a, b], c) # do either a or b, then do c + + the choice between running ``a`` or ``b`` is made without foresight to c + """ + optimize = partial(minimize, objective=objective) + return treeapply(tree, {list: optimize, tuple: chain}, **kwargs) + + +def allresults(tree, leaf=yieldify): + """ Execute a strategic tree. Return all possibilities. + + Returns a lazy iterator of all possible results + + Exhaustiveness + -------------- + + This is an exhaustive algorithm. In the example + + ([a, b], [c, d]) + + All of the results from + + (a, c), (b, c), (a, d), (b, d) + + are returned. This can lead to combinatorial blowup. + + See sympy.strategies.greedy for details on input + """ + return treeapply(tree, {list: branch.multiplex, tuple: branch.chain}, + leaf=leaf) + + +def brute(tree, objective=identity, **kwargs): + return lambda expr: min(tuple(allresults(tree, **kwargs)(expr)), + key=objective) diff --git a/env-llmeval/lib/python3.10/site-packages/sympy/strategies/util.py b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/util.py new file mode 100644 index 0000000000000000000000000000000000000000..13aab5f6a49650c5ded9cd913c23c6682f18d40a --- /dev/null +++ b/env-llmeval/lib/python3.10/site-packages/sympy/strategies/util.py @@ -0,0 +1,17 @@ +from sympy.core.basic import Basic + +new = Basic.__new__ + + +def assoc(d, k, v): + d = d.copy() + d[k] = v + return d + + +basic_fns = {'op': type, + 'new': Basic.__new__, + 'leaf': lambda x: not isinstance(x, Basic) or x.is_Atom, + 'children': lambda x: x.args} + +expr_fns = assoc(basic_fns, 'new', lambda op, *args: op(*args))