.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/fib.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_fib.py: Fibonacci numbers example ========================= .. GENERATED FROM PYTHON SOURCE LINES 6-29 .. code-block:: Python from __future__ import annotations from egglog import * @function def fib(x: i64Like) -> i64: ... f0, f1, x = vars_("f0 f1 x", i64) check( eq(fib(i64(7))).to(i64(21)), ruleset( rule( eq(f0).to(fib(x)), eq(f1).to(fib(x + 1)), ).then(set_(fib(x + 2)).to(f0 + f1)), ) * 7, set_(fib(0)).to(i64(1)), set_(fib(1)).to(i64(1)), ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.158 seconds) .. _sphx_glr_download_auto_examples_fib.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: fib.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: fib.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_