.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/bool.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_bool.py: Boolean data type example and test ================================== .. GENERATED FROM PYTHON SOURCE LINES 6-39 .. code-block:: Python from __future__ import annotations from egglog import * T = Bool(True) F = Bool(False) check(eq(T & T).to(T)) check(eq(T & F).to(F)) check(eq(T | F).to(T)) check(ne(T | F).to(F)) check(eq(i64(1).bool_lt(2)).to(T)) check(eq(i64(2).bool_lt(1)).to(F)) check(eq(i64(1).bool_lt(1)).to(F)) check(eq(i64(1).bool_le(2)).to(T)) check(eq(i64(2).bool_le(1)).to(F)) check(eq(i64(1).bool_le(1)).to(T)) R = relation("R", i64) @function def f(i: i64Like) -> Bool: ... i = var("i", i64) check( eq(f(0)).to(T), ruleset(rule(R(i)).then(set_(f(i)).to(T))) * 3, R(i64(0)), ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.023 seconds) .. _sphx_glr_download_auto_examples_bool.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: bool.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: bool.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_