Skip to main content

Boolean Synchronization Operators

A family of operators that perform logical operations on synchronized boolean streams with multiple inputs.

Common Properties

All operators:

  • Accept n input ports (default: 2) of type BooleanData
  • Produce one output port (0) of type BooleanData
  • Synchronize input messages based on timestamps
  • Output messages only when all inputs have matching timestamps
  • Inherit buffering behavior from ReduceJoin

Available Operators

LogicalAnd (∧)

Emits true only if all inputs are true. Initial value: true.

y(t_n) = x₀(t_n) ∧ x₁(t_n) ∧ ... ∧ xₙ(t_n)

LogicalOr (∨)

Emits true if any input is true. Initial value: false.

y(t_n) = x₀(t_n) ∨ x₁(t_n) ∨ ... ∨ xₙ(t_n)

LogicalXor (⊕)

Emits true if odd number of inputs are true. Initial value: false.

y(t_n) = x₀(t_n) ⊕ x₁(t_n) ⊕ ... ⊕ xₙ(t_n)

LogicalNand (↑)

Emits false only if all inputs are true. Initial value: true.

y(t_n) = ¬(x₀(t_n) ∧ x₁(t_n) ∧ ... ∧ xₙ(t_n))

LogicalNor (↓)

Emits true only if all inputs are false. Initial value: true.

y(t_n) = ¬(x₀(t_n) ∨ x₁(t_n) ∨ ... ∨ xₙ(t_n))

LogicalXnor (↔)

Emits true if even number of inputs are true. Initial value: true.

y(t_n) = x₀(t_n) ↔ x₁(t_n) ↔ ... ↔ xₙ(t_n)

LogicalImplication (→)

Chains implications: a → b → c. Initial value: true. For two inputs, emits true unless first is true and second is false.

y(t_n) = x₀(t_n) → x₁(t_n) → ... → xₙ(t_n)

Example Message Flow

Consider a LogicalAnd operator with three inputs:

TimePort 0Port 1Port 2Output
1true-true-
2-falsetrue-
3truetruetruetrue
4truefalsetruefalse
5false-true-
6truetruetruetrue

Note that output is only produced when all three inputs have messages with matching timestamps (t=3, t=4, and t=6).

Usage

// Create operators using factory functions
auto and_op = make_logical_and("and1", 3); // 3 inputs
auto or_op = make_logical_or("or1"); // default 2 inputs
auto xor_op = make_logical_xor("xor1", 4); // 4 inputs

// Example usage with three inputs
and_op->receive_data(create_message<BooleanData>(1, BooleanData{true}), 0);
and_op->receive_data(create_message<BooleanData>(1, BooleanData{true}), 1);
and_op->receive_data(create_message<BooleanData>(1, BooleanData{false}), 2);
and_op->execute(); // Will output false