Functional Logic Kernels

jlnn.nn.functional.and_drastic(int_a: Array, int_b: Array) Array[source]

Computes a pure drastic t-norm (AND). Collapses to 0.0 unless one argument equals exactly 1.0.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Verified drastic conjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.and_godel(int_a: Array, int_b: Array) Array[source]

Computes a pure Gödel conjunction (AND) for two input intervals using minimum reduction.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Verified minimum truth interval [L, U] structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.and_kleene_dienes(int_a: Array, int_b: Array) Array[source]

Mathematical alias for and_godel (Kleene-Dienes utilizes Gödel Min t-norm).

jlnn.nn.functional.and_lukasiewicz(int_a: Array, int_b: Array) Array[source]

Computes a pure parameterless Łukasiewicz conjunction (AND) for two truth intervals.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Bounded, consistency-verified nilpotent t-norm interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.and_physical_kleene_dienes(int_a: Array, int_b: Array) Array[source]

Computes a PFL Conjunction (AND) based on entropic space-curved warping over Gödel Min logic.

jlnn.nn.functional.and_physical_lukasiewicz(int_a: Array, int_b: Array) Array[source]

Computes a PFL Conjunction (AND) based on entropic space-curved warping over Nilpotent Łukasiewicz logic.

jlnn.nn.functional.and_physical_reichenbach(int_a: Array, int_b: Array) Array[source]

Computes a PFL Conjunction (AND) based on entropic space-curved warping over Reichenbach Product logic.

jlnn.nn.functional.and_product(int_a: Array, int_b: Array) Array[source]

Computes a pure algebraic product conjunction (AND) for two input intervals: A * B.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Verified product truth interval [L, U] structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.and_reichenbach(int_a: Array, int_b: Array) Array[source]

Mathematical alias for and_product (Reichenbach utilizes Product t-norm).

jlnn.nn.functional.bulk_and_drastic(x: Array) Array[source]

Executes a bulk drastic AND reduction across the designated terminal axis.

Parameters:

x (jnp.ndarray) – Multi-variable truth interval tensor structured as (…, num_inputs, 2).

Returns:

Collapsed drastic conjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.bulk_and_godel(x: Array) Array[source]

Executes a bulk Gödel AND reduction across the designated terminal feature dimension.

Parameters:

x (jnp.ndarray) – Input multi-variable truth interval tensor structured as (…, num_inputs, 2).

Returns:

Single collapsed truth interval structured as (…, 2) containing minimum values.

Return type:

jnp.ndarray

jlnn.nn.functional.bulk_and_product(x: Array) Array[source]

Executes a bulk product AND reduction across the designated terminal feature dimension.

Parameters:

x (jnp.ndarray) – Input multi-variable truth interval tensor structured as (…, num_inputs, 2).

Returns:

Single collapsed truth interval containing cumulative products.

Return type:

jnp.ndarray

jlnn.nn.functional.bulk_or_drastic(x: Array) Array[source]

Executes a bulk drastic OR reduction across the designated terminal axis.

Parameters:

x (jnp.ndarray) – Multi-variable truth interval tensor structured as (…, num_inputs, 2).

Returns:

Collapsed drastic disjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.bulk_or_godel(x: Array) Array[source]

Executes a bulk Gödel OR reduction across the designated terminal feature dimension.

Parameters:

x (jnp.ndarray) – Input multi-variable truth interval tensor structured as (…, num_inputs, 2).

Returns:

Single collapsed truth interval structured as (…, 2) containing maximum values.

Return type:

jnp.ndarray

jlnn.nn.functional.bulk_or_product(x: Array) Array[source]

Executes a bulk product OR reduction across the designated terminal feature dimension.

Parameters:

x (jnp.ndarray) – Input multi-variable truth interval tensor structured as (…, num_inputs, 2).

Returns:

Single collapsed truth interval containing cumulative probabilistic sums.

Return type:

jnp.ndarray

jlnn.nn.functional.implication(int_a: Array, int_b: Array, method: str = 'lukasiewicz') Array[source]

Universal proxy routing for physical or standard implication evaluations. Maintains compatibility with parameter-free (PFL) gates.

jlnn.nn.functional.implication_godel(int_a: Array, int_b: Array) Array[source]

Dispatches and ensures intervals for a residuated Gödel implication.

jlnn.nn.functional.implication_goguen(int_a: Array, int_b: Array) Array[source]

Dispatches and ensures intervals for a residuated Goguen implication.

jlnn.nn.functional.implication_kleene_dienes(int_a: Array, int_b: Array) Array[source]

Dispatches and ensures intervals for a standard Kleene-Dienes implication.

jlnn.nn.functional.implication_lukasiewicz(int_a: Array, int_b: Array, weights: Array, beta: float) Array[source]

Dispatches and ensures intervals for a weighted Łukasiewicz implication.

jlnn.nn.functional.implication_physical_kleene_dienes(int_a: Array, int_b: Array) Array[source]

Dispatches and ensures intervals for an entropically modulated Physical Kleene-Dienes implication.

jlnn.nn.functional.implication_physical_lukasiewicz(int_a: Array, int_b: Array) Array[source]

Dispatches and ensures intervals for a singularity-bound Physical Gravitational Łukasiewicz implication.

jlnn.nn.functional.implication_physical_reichenbach(int_a: Array, int_b: Array) Array[source]

Dispatches and ensures intervals for a gravitational Physical Reichenbach implication.

jlnn.nn.functional.implication_reichenbach(int_a: Array, int_b: Array) Array[source]

Dispatches and ensures intervals for a smooth Reichenbach product implication.

jlnn.nn.functional.logical_not(x: Array) Array[source]

Parameter-free physical negation (NOT). Inverts intervals securely according to: NOT [L, U] = [1 - U, 1 - L]

jlnn.nn.functional.or_drastic(int_a: Array, int_b: Array) Array[source]

Computes a pure drastic t-conorm (OR). Saturates to 1.0 unless one argument equals exactly 0.0.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Verified drastic disjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.or_godel(int_a: Array, int_b: Array) Array[source]

Computes a pure Gödel disjunction (OR) for two input intervals using maximum reduction.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Verified maximum truth interval [L, U] structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.or_kleene_dienes(int_a: Array, int_b: Array) Array[source]

Mathematical alias for or_godel (Kleene-Dienes utilizes Gödel Max t-conorm).

jlnn.nn.functional.or_lukasiewicz(int_a: Array, int_b: Array) Array[source]

Computes a pure parameterless Łukasiewicz disjunction (OR) for two truth intervals.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Bounded, consistency-verified nilpotent t-conorm interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.or_physical_kleene_dienes(int_a: Array, int_b: Array) Array[source]

Computes a PFL Disjunction (OR) based on entropic space-curved warping over Gödel Max logic.

jlnn.nn.functional.or_physical_lukasiewicz(int_a: Array, int_b: Array) Array[source]

Computes a PFL Disjunction (OR) based on entropic space-curved warping over Nilpotent Łukasiewicz logic.

jlnn.nn.functional.or_physical_reichenbach(int_a: Array, int_b: Array) Array[source]

Computes a PFL Disjunction (OR) based on entropic space-curved warping over Reichenbach Probabilistic Sum logic.

jlnn.nn.functional.or_product(int_a: Array, int_b: Array) Array[source]

Computes a pure algebraic product disjunction (OR): A + B - (A * B).

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Bounded and verified probabilistic sum truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.or_reichenbach(int_a: Array, int_b: Array) Array[source]

Mathematical alias for or_product (Reichenbach utilizes Probabilistic Sum t-conorm).

jlnn.nn.functional.weighted_and(x: Array, weights: Array, beta: Array) Array[source]

Stateless weighted conjunction (AND) according to Łukasiewicz fuzzy logic.

Acts as a functional gateway to the underlying core logic layer. It evaluates the cumulative “negative evidence” across interval boundaries, where lower bounds of the input restrict the upper bound of the result and vice versa.

Parameters:
  • x (jnp.ndarray) – Input interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Input importance weights structured as (num_inputs,).

  • beta (jnp.ndarray) – Scalar activation sensitivity threshold parameter (bias).

Returns:

Bounded, consistency-verified truth interval [L, U] structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_and_godel(x: Array, weights: Array) Array[source]

Applies expert reliability weights to inputs, then reduces them via Gödel AND.

Scales boundaries using element-wise weights clipped at absolute truth (1.0), modeling rule-based reliability adjustments before executing minimum reduction.

Parameters:
  • x (jnp.ndarray) – Multi-variable input interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Reliability scaling weights structured as (num_inputs,).

Returns:

Verified truth interval representing the weighted minimum.

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_and_kleene_dienes(x: Array, weights: Array) Array[source]

Parametric alias routing to the underlying weighted Gödel conjunction.

jlnn.nn.functional.weighted_and_product(x: Array, weights: Array) Array[source]

Applies expert reliability weights to inputs, then reduces them via Product AND.

Parameters:
  • x (jnp.ndarray) – Multi-variable input interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Reliability scaling weights structured as (num_inputs,).

Returns:

Verified truth interval representing the weighted algebraic product.

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_and_reichenbach(x: Array, weights: Array) Array[source]

Parametric alias routing to the underlying weighted Product conjunction.

jlnn.nn.functional.weighted_implication(int_a: Array, int_b: Array, weights: Array, beta: Array, method: str = 'lukasiewicz') Array[source]

Functional gateway for calculating structural logical implications (A -> B).

Supports traditional parametric mechanisms as well as advanced Space-Curved Physical Fuzzy Logic (PFL) methods.

Parameters:
  • int_a (jnp.ndarray) – Antecedent interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Consequent interval tensor structured as (…, 2).

  • weights (jnp.ndarray) – Importance weights for traditional methods structured as (2,).

  • beta (jnp.ndarray) – Threshold/bias sensitivity parameter tensor.

  • method (str) – Logic framework selector string.

Returns:

Bounded and consistency-verified implication result interval.

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_nand(x: Array, weights: Array, beta: Array) Array[source]

Computes a weighted alternative denial (NAND) via the negation of a weighted Łukasiewicz AND.

Parameters:
  • x (jnp.ndarray) – Input interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Importance weight tensor structured as (num_inputs,).

  • beta (jnp.ndarray) – Threshold sensitivity parameter (bias).

Returns:

Bounded, consistency-verified inverted conjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_nand_kleene_dienes(x: Array, weights: Array) Array[source]

Computes a weighted alternative denial (NAND) under Kleene-Dienes semantics.

jlnn.nn.functional.weighted_nand_reichenbach(x: Array, weights: Array) Array[source]

Computes a weighted alternative denial (NAND) under Reichenbach semantics.

jlnn.nn.functional.weighted_nor(x: Array, weights: Array, beta: Array) Array[source]

Computes a weighted joint denial (NOR) via the negation of a weighted Łukasiewicz OR.

Parameters:
  • x (jnp.ndarray) – Input interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Importance weight tensor structured as (num_inputs,).

  • beta (jnp.ndarray) – Threshold saturation parameter (bias).

Returns:

Bounded, consistency-verified inverted disjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_nor_kleene_dienes(x: Array, weights: Array) Array[source]

Computes a weighted joint denial (NOR) under Kleene-Dienes semantics.

jlnn.nn.functional.weighted_nor_reichenbach(x: Array, weights: Array) Array[source]

Computes a weighted parametric joint denial (NOR) under Reichenbach semantics.

Parameters:
  • x (jnp.ndarray) – Input truth interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Input importance weights structured as (num_inputs,).

Returns:

Consistency-verified inverted probabilistic sum interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_not(x: Array, weight: Array) Array[source]

Computes a weighted logical negation (NOT) with parameterized confidence scaling.

First inverts the interval boundaries to simulate strict logical inversion: NOT [L, U] = [1 - U, 1 - L]. Subsequently performs a linear interpolation between the inverted results and the state of maximum systemic uncertainty [0.0, 1.0], proportionally guided by the confidence weight factor.

Parameters:
  • x (jnp.ndarray) – Input truth interval tensor structured as (…, 2).

  • weight (jnp.ndarray) – Confidence weight parameter scaling the strictness of the negation mapping.

Returns:

Bounded, consistency-verified truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_or(x: Array, weights: Array, beta: Array) Array[source]

Stateless weighted disjunction (OR) according to Łukasiewicz fuzzy logic.

Acts as a functional gateway accumulating positive validation across inputs. Preserves boundary orientation where input lower bounds determine output lower bounds and input upper bounds determine output upper bounds.

Parameters:
  • x (jnp.ndarray) – Input interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Input importance weights structured as (num_inputs,).

  • beta (jnp.ndarray) – Scalar activation saturation threshold parameter (bias).

Returns:

Bounded, consistency-verified truth interval [L, U] structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_or_godel(x: Array, weights: Array) Array[source]

Applies expert reliability weights to inputs, then reduces them via Gödel OR.

Scales boundaries using element-wise weights clipped at absolute truth (1.0), modeling rule-based reliability adjustments before executing maximum reduction.

Parameters:
  • x (jnp.ndarray) – Multi-variable input interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Reliability scaling weights structured as (num_inputs,).

Returns:

Verified truth interval representing the weighted maximum.

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_or_kleene_dienes(x: Array, weights: Array) Array[source]

Parametric alias routing to the underlying weighted Gödel disjunction.

jlnn.nn.functional.weighted_or_product(x: Array, weights: Array) Array[source]

Applies expert reliability weights to inputs, then reduces them via Product OR.

Parameters:
  • x (jnp.ndarray) – Multi-variable input interval tensor structured as (…, num_inputs, 2).

  • weights (jnp.ndarray) – Reliability scaling weights structured as (num_inputs,).

Returns:

Verified truth interval representing the weighted algebraic product disjunction.

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_or_reichenbach(x: Array, weights: Array) Array[source]

Parametric alias routing to the underlying weighted Product disjunction.

jlnn.nn.functional.weighted_xor_godel(int_a: Array, int_b: Array, weights: Array) Array[source]

Computes a weighted parametric Exclusive OR (XOR) under Gödel/Kleene-Dienes sémantics.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

  • weights (jnp.ndarray) – Input reliability importance scaling weights structured as (2,).

Returns:

Verified exclusive disjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_xor_lukasiewicz(int_a: Array, int_b: Array, weights: Array, beta: Array) Array[source]

Computes a weighted parametric Exclusive OR (XOR) under Łukasiewicz semantics.

Formulated compositionally using standard logical equivalence axioms:

(A AND NOT B) OR (NOT A AND B)

Parameters:
  • int_a (jnp.ndarray) – First input interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second input interval tensor structured as (…, 2).

  • weights (jnp.ndarray) – Input importance weights structured as (num_inputs,).

  • beta (jnp.ndarray) – Threshold parameter managing gate sensitivity.

Returns:

Verified, bounded exclusive disjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.weighted_xor_product(int_a: Array, int_b: Array, weights: Array) Array[source]

Computes a weighted parametric Exclusive OR (XOR) under Product/Reichenbach sémantics.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

  • weights (jnp.ndarray) – Input reliability importance scaling weights structured as (2,).

Returns:

Verified smooth exclusive disjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.xor_godel(int_a: Array, int_b: Array) Array[source]

Computes a pure Gödel Exclusive OR (XOR) operation over truth intervals.

Structurally formulated using the standard logical equivalence: (A AND NOT B) OR (NOT A AND B)

evaluated via strict non-cumulative Min-Max fuzzy operators.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Consistency-verified exclusive disjunction truth interval structured as (…, 2).

Return type:

jnp.ndarray

jlnn.nn.functional.xor_product(int_a: Array, int_b: Array) Array[source]

Computes a pure algebraic Product Exclusive OR (XOR) operation over truth intervals.

Defined smoothly as: (A * (1 - B)) + ((1 - A) * B) - Overlap Coefficient

which guarantees active, non-vanishing optimization gradients throughout the unit domain.

Parameters:
  • int_a (jnp.ndarray) – First truth interval tensor structured as (…, 2).

  • int_b (jnp.ndarray) – Second truth interval tensor structured as (…, 2).

Returns:

Consistency-verified polynomial exclusive disjunction truth interval.

Return type:

jnp.ndarray

This module provides a stateless functional interface to all logical operations supported by the JLNN framework. Unlike stateful objects (such as the t-norms in the gates module), these functions do not maintain any internal parameters or network states. All weights and threshold coefficients are passed to them directly as JAX tensors, making them ideal building blocks for functional programming.

Key features

  • JAX-Native architecture: All features are fully compatible with jax.jit (compilation on XLA/GPU), jax.vmap (automatic vectorization across batches), and jax.grad (automatic backpropagation derivation) transformations.

  • Guaranteed Consistency of Bounds: Each operation internally calls the intervals.ensure_interval mechanism at the end of the calculation, which enforces strict adherence to the mathematical axiom \(L \le U\) and prevents the occurrence of negative uncertainty widths.

  • Unified Weighting: For traditional parametric methods (outside Łukasiewicz logic), the module implements a unified preprocessing contract, where the boundaries of individual operands are adjusted using the product with the appropriate weight and saturated with an upper bound of 1.0.

The core of Łukasiewicz’s logic

These operations work with cumulative evaluation of logical potential and form standard building blocks for LNNs (Logical Neural Networks).

  • weighted_and: Evaluates the conjunction based on the accumulation of “negative evidence” of the inputs. Uses the parameter beta as a sensitivity threshold.

  • weighted_or: Accumulates positive logical evidence across the input tensor.

  • weighted_not: Performs an interval inversion. First, it applies a weighting coefficient to the boundaries and then performs a logical rotation: \([1.0 - U_w, 1.0 - L_L]\).

  • weighted_nand / weighted_nor: Compound operators implemented as a functional composition of negation over the result of the corresponding conjunction or disjunction.

Traditional and parametric operators

Alternative logical semantics that allow changing the character of the gradient flow and the behavior of the network at the edges of the truth space.

  • weighted_or_kleene_dienes / weighted_and_kleene_dienes: Max-min operators with weighted inputs, suitable for robust expert systems screening out extreme values.

  • weighted_or_reichenbach / weighted_and_reichenbach: Smooth probabilistic (product) operators with polynomial nonlinearity, ensuring continuous gradients without sharp breaks.

A complex apparatus of implications

The module provides a unified implication function, which serves as the main router for evaluating rules of the form \(A \rightarrow B\). It supports three distinct spheres of computation (method parameter):

  1. Pure atomic implications:

    • implication_lukasiewicz: Classical nilpotent implication.

    • implication_kleene_dienes: Pessimistic max-not implication.

    • implication_reichenbach: Fully differentiable algebraic implication.

    • implication_goguen: Residual implication using numerically safe division in JAX.

    • implication_godel: Positional residual implication built on conditional masks.

  2. Spacetime-curved PFL implications:

  • implication_physical_kleene_dienes, implication_physical_reichenbach, implication_physical_lukasiewicz. These functions dynamically deform the truth space depending on the local Shannon entropy of both operands. They ensure the stabilization of the system around points of extreme uncertainty.

  1. Weighted parametric implications:

  • If the traditional method is chosen and weights are passed, a safe transformation of the premise and conclusion boundaries will occur according to the framework’s unified weight contract before the actual calculation of the implication.