{ "cells": [ { "cell_type": "markdown", "id": "Nti1VE8-Dl_5", "metadata": { "id": "Nti1VE8-Dl_5" }, "source": [ "# BoolForge Tutorial #1: Working with Boolean functions\n", "\n", "In this tutorial, we will explore the `BooleanFunction` class — the foundation of BoolForge.\n", "You will learn how to:\n", "- create Boolean functions from truth tables and text expressions,\n", "- compute basic properties such as degree and bias, and\n", "- convert between truth tables, logical expressions, polynomials, and the CANA package." ] }, { "cell_type": "code", "execution_count": 3, "id": "d6aba3ec", "metadata": { "executionInfo": { "elapsed": 8118, "status": "ok", "timestamp": 1729274660920, "user": { "displayName": "Bernard Lidicky", "userId": "15999393152596956268" }, "user_tz": 300 }, "id": "d6aba3ec" }, "outputs": [], "source": [ "import boolforge\n", "import numpy as np" ] }, { "cell_type": "markdown", "id": "2901dee5", "metadata": { "id": "2901dee5" }, "source": [ "## Create a Boolean function \n", "\n", "Boolean functions can be described in logical form, as polynomials, or as truth tables. BoolForge treats Boolean functions as binary vectors of length $2^n$, where n is the number of inputs. The vectors describe the right side of the truth table. The left side of the truth table is not stored because it is the same for any function with n inputs. For example, the function f(A,B) = A AND B is stored as [0,0,0,1], which is exactly the right side of the truth table\n", "