deeplog.formula.deeplogformulafactory

Abstract factory for building DeepLog formulas.

Concrete implementations live alongside (e.g. symbolic_factory.py, circuit_factory.py).

Attributes

T

Classes

DeepLogFormulaFactory

The fold algebra over the formula AST.

Module Contents

T
class DeepLogFormulaFactory[source]

Bases: abc.ABC

Inheritance diagram of deeplog.formula.deeplogformulafactory.DeepLogFormulaFactory

The fold algebra over the formula AST.

Each method is an eliminator of one formula-AST node kind: it receives the already-built results (carrier type T) of that node’s children and returns a T. It does not operate on AST nodes directly — that is the job of fold(), which drives an instance of this class over a materialized tree.

Concrete algebras choose T: str for SymbolicFormulaFactory (→ text), FormulaNode for CircuitFactory (→ circuit lumps).

abstractmethod create_aggregation(
operation: str,
binders: list[Symbol],
params: Sequence[T],
child: T,
) → T[source]

Build an aggregation node over binders applying operation to child.

abstractmethod create_aggregation_op(operation: str, operands: Sequence[T]) → T[source]

Build an aggregation applying operation to operands, of which there is one at least.

abstractmethod create_transformation(structure: str, child: T) → T[source]

Build a structure-conversion node that maps child to structure.

abstractmethod create_binary_node(operator: str, lhs: T, rhs: T) → T[source]

Combine lhs and rhs with a binary operator.

abstractmethod create_unary_node(operator: str, operand: T) → T[source]

Apply a unary operator to operand.

abstractmethod create_atom(atom: Symbol) → T[source]

Build an atomic node.

abstractmethod embed_circuit(node: CircuitNode) → T[source]

Eliminate a CircuitNode lump.

A lump is a compiled region of a circuit, so it is spliced in as it is: the circuit builder returns it, and text interpreters reject it, since a compiled lump has no surface syntax.