Skip to main content

omnibias.core.ftc

0.5.0rc1Release candidatePython >=3.10Apache-2.0

Coefficient recurrences, activation contracts, jet algebra, and verified arithmetic shared by the numerical backends.

import omnibias.core.ftc
Module contract & mathematical conventions

1-D fundamental-theorem cell (theory 09-03 + 09-17).

The cell is the unused integral role I = S(w x + b_hi) - S(w x + b_lo) with S' = sigma. The derivative head is FTC of that window, not a second pack. The founding bias collapse (delta -> 0) of the same window is I / delta -> sigma(w x + b). Temperature collapse (beta -> inf, feasibility) does not appear. Do not conflate the two.

This is a 1-D FTC identity, not a VPINN / weak form, and with explicit local scope.

Shared formulas do not imply universal floating-point identity. Verify dtype, shape, derivative-order support, and the stated numerical assumptions for the path you use.

CONSTANT

DEFAULT_DUAL​

omnibias.core.ftc.DEFAULT_DUALSource ↗
DEFAULT_DUAL = DualFTCConfig()

This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.

Read the implementation
DEFAULT_DUAL = DualFTCConfig()
CONSTANT

DISCLAIMER​

omnibias.core.ftc.DISCLAIMERSource ↗
DISCLAIMER = '1-D FTC integral cell; not a VPINN, not a weak form, with explicit local scope'

This exported constant is defined by the expression above. Its exact value and annotation come from the pinned source; use it with the module contract.

Regression example · g3 honesty

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g3_honesty() -> None:
    payload = honesty_payload()
    assert payload["claimed_weak_form"] is False
    assert payload["claimed_vpinn"] is False
    assert payload["theorem_prover_verified"] is False
    assert "not a VPINN" in DISCLAIMER
python -m pytest packages/omnibias-core/tests/test_ftc.py -k test_g3_honesty -q
Read the implementation
DISCLAIMER = (
    "1-D FTC integral cell; not a VPINN, not a weak form, with explicit local scope"
)
Other public import paths
  • omnibias.core.ftc.DISCLAIMER
  • omnibias.jax.architectures.ftc_net.DISCLAIMER
  • omnibias.torch.architectures.ftc_net.DISCLAIMER
CLASS

DualFTCConfig​

omnibias.core.ftc.DualFTCConfigSource ↗
class DualFTCConfig

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
w_derivdataclass fieldfloatDefault: 1.0See the operation contract and implementation below.
w_intdataclass fieldfloatDefault: 1.0See the operation contract and implementation below.

Fields & methods

w_derivfield
w_deriv: float = 1.0

Declared float field on DualFTCConfig. Default expression: 1.0.

View source ↗
w_intfield
w_int: float = 1.0

Declared float field on DualFTCConfig. Default expression: 1.0.

View source ↗
Read the implementation
class DualFTCConfig:
    w_deriv: float = 1.0
    w_int: float = 1.0
Other public import paths
  • omnibias.core.ftc.DualFTCConfig
  • omnibias.jax.architectures.DualFTCConfig
  • omnibias.torch.architectures.DualFTCConfig
  • omnibias.jax.architectures.ftc_net.DualFTCConfig
  • omnibias.torch.architectures.ftc_net.DualFTCConfig
CLASS

DualFTCResult​

omnibias.core.ftc.DualFTCResultSource ↗
class DualFTCResult

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
lossdataclass fieldfloatRequiredSee the operation contract and implementation below.
r_Ddataclass fieldlist[float]RequiredSee the operation contract and implementation below.
r_Idataclass fieldlist[float]RequiredSee the operation contract and implementation below.
max_r_Ddataclass fieldfloatRequiredSee the operation contract and implementation below.
max_r_Idataclass fieldfloatRequiredSee the operation contract and implementation below.

Fields & methods

lossfield
loss: float

Declared float field on DualFTCResult. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
r_Dfield
r_D: list[float]

Declared list[float] field on DualFTCResult. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
r_Ifield
r_I: list[float]

Declared list[float] field on DualFTCResult. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
max_r_Dfield
max_r_D: float

Declared float field on DualFTCResult. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
max_r_Ifield
max_r_I: float

Declared float field on DualFTCResult. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
Read the implementation
class DualFTCResult:
    loss: float
    r_D: list[float]
    r_I: list[float]
    max_r_D: float
    max_r_I: float
CLASS

FTCNetConfig​

omnibias.core.ftc.FTCNetConfigSource ↗
class FTCNetConfig

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
n_blocksdataclass fieldintDefault: 2See the operation contract and implementation below.
widthdataclass fieldintDefault: 12See the operation contract and implementation below.
windowdataclass fieldfloatDefault: 0.6See the operation contract and implementation below.
Regression example · g1 matches core

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g1_matches_core() -> None:
    x = jnp.asarray(0.0)
    w = jnp.asarray(1.0)
    lo = jnp.asarray(-0.1)
    hi = jnp.asarray(0.1)
    integral, deriv, collapse = ftc_block(x, w, lo, hi)
    ex = worked_example()
    assert float(integral) == ex["I"]
    assert float(deriv) == ex["dI"]
    assert float(collapse) == ex["collapse"]
    assert FTCNet(FTCNetConfig()).config.window == 0.6
python -m pytest packages/omnibias-jax/tests/test_ftc_net.py -k test_g1_matches_core -q
Regression example · g1 and g4 matches core

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g1_and_g4_matches_core() -> None:
    torch.set_default_dtype(torch.float64)
    x = torch.tensor(0.0)
    w = torch.tensor(1.0)
    lo = torch.tensor(-0.1)
    hi = torch.tensor(0.1)
    integral, deriv, collapse = ftc_block(x, w, lo, hi)
    ex = worked_example()
    assert float(integral) == ex["I"]
    assert float(deriv) == ex["dI"]
    assert float(collapse) == ex["collapse"]
    net = FTCNet(FTCNetConfig())
    assert net.config.width == 12
    loss = dual_ftc_loss([float(integral)], [float(deriv)], [float(deriv)], [0.0], I_a=float(integral))
    assert loss.max_r_D < 1e-12
python -m pytest packages/omnibias-torch/tests/test_ftc_net.py -k test_g1_and_g4_matches_core -q

Fields & methods

n_blocksfield
n_blocks: int = 2

Declared int field on FTCNetConfig. Default expression: 2.

View source ↗
widthfield
width: int = 12

Declared int field on FTCNetConfig. Default expression: 12.

View source ↗
windowfield
window: float = 0.6

Declared float field on FTCNetConfig. Default expression: 0.6.

View source ↗
Read the implementation
class FTCNetConfig:
    n_blocks: int = 2
    width: int = 12
    window: float = 0.6
Other public import paths
  • omnibias.core.ftc.FTCNetConfig
  • omnibias.jax.architectures.FTCNetConfig
  • omnibias.torch.architectures.FTCNetConfig
  • omnibias.jax.architectures.ftc_net.FTCNetConfig
  • omnibias.torch.architectures.ftc_net.FTCNetConfig
CLASS

Pack​

omnibias.core.ftc.PackSource ↗
class Pack

Dataclass constructor fields; inherited fields, if any, are declared by the base class. A field(...) expression describes a default factory or field options, not a literal argument default.

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
wdataclass fieldfloatRequiredSee the operation contract and implementation below.
centerdataclass fieldfloatRequiredSee the operation contract and implementation below.
half_windowdataclass fieldfloatRequiredSee the operation contract and implementation below.
ampdataclass fieldfloatDefault: 1.0See the operation contract and implementation below.

Fields & methods

wfield
w: float

Declared float field on Pack. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
centerfield
center: float

Declared float field on Pack. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
half_windowfield
half_window: float

Declared float field on Pack. A value must be provided when constructing the configuration, unless an inherited constructor supplies it.

View source ↗
ampfield
amp: float = 1.0

Declared float field on Pack. Default expression: 1.0.

View source ↗
Read the implementation
class Pack:
    w: float
    center: float
    half_window: float
    amp: float = 1.0
FUNCTION

dual_ftc_loss​

omnibias.core.ftc.dual_ftc_lossSource ↗
dual_ftc_loss(I_vals: Sequence[float], dI_vals: Sequence[float], f_vals: Sequence[float], F_vals: Sequence[float], *, config: DualFTCConfig=DEFAULT_DUAL, I_a: float | None=None) -> DualFTCResult

r_D = dI - f, r_I = I - I(a) - Integral_a^x f. I_a defaults to I[0].

Parameters

NameType & defaultContract
I_valspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
dI_valspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
f_valspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
F_valspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
configkeyword-onlyDualFTCConfigDefault: DEFAULT_DUALSee the operation contract and implementation below.
I_akeyword-onlyfloat | NoneDefault: NoneSee the operation contract and implementation below.
ReturnsDualFTCResult
Explicit validation & failure cases
  • When not len(I_vals) == len(dI_vals) == len(f_vals) == len(F_vals), raises ValueError('dual_ftc_loss requires aligned sequences').

These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.

Executed regression · g2 dual reduces integral residual

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_dual_reduces_integral_residual() -> None:
    report = dual_skill_report()
    assert report["below_1e4"] is True
    assert report["ri_below_deriv_only"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_vpinn"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_dual_reduces_integral_residual" -q
Regression example · g1 worked example

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g1_worked_example() -> None:
    ex = worked_example()
    assert ex["collapse_err"] < 1e-12
    assert ex["ftc_err"] < 1e-12
    assert abs(ex["I"] - 0.1) < 1e-12
    integral, deriv, collapse = ftc_block(0.0, 1.0, -0.1, 0.1)
    loss = dual_ftc_loss([integral], [deriv], [deriv], [0.0], I_a=integral)
    assert loss.max_r_D < 1e-12
    assert loss.max_r_I < 1e-12
    loss0 = dual_ftc_loss([integral], [deriv], [0.0], [0.0], I_a=integral)
    assert loss0.max_r_D > 0.04
python -m pytest packages/omnibias-core/tests/test_ftc.py -k test_g1_worked_example -q
Read the implementation
def dual_ftc_loss(
    I_vals: Sequence[float],
    dI_vals: Sequence[float],
    f_vals: Sequence[float],
    F_vals: Sequence[float],
    *,
    config: DualFTCConfig = DEFAULT_DUAL,
    I_a: float | None = None,
) -> DualFTCResult:
    """``r_D = dI - f``, ``r_I = I - I(a) - Integral_a^x f``. ``I_a`` defaults to ``I[0]``."""
    if not (len(I_vals) == len(dI_vals) == len(f_vals) == len(F_vals)):
        raise ValueError("dual_ftc_loss requires aligned sequences")
    ia = float(I_vals[0] if I_a is None else I_a)
    r_d = [di - fi for di, fi in zip(dI_vals, f_vals, strict=True)]
    r_i = [iv - ia - Fv for iv, Fv in zip(I_vals, F_vals, strict=True)]
    loss = config.w_deriv * sum(v * v for v in r_d) + config.w_int * sum(v * v for v in r_i)
    n = float(len(r_d))
    return DualFTCResult(loss / n, r_d, r_i, max_abs(r_d), max_abs(r_i))
FUNCTION

dual_skill_report​

omnibias.core.ftc.dual_skill_reportSource ↗
dual_skill_report(*, seeds: int=5, n_grid: int=129) -> dict[str, object]

G2 for 09-17: dual residual vs derivative-only on f = cos.

Parameters

NameType & defaultContract
seedskeyword-onlyintDefault: 5See the operation contract and implementation below.
n_gridkeyword-onlyintDefault: 129See the operation contract and implementation below.
Returnsdict[str, object]
Executed regression · g2 dual reduces integral residual

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_dual_reduces_integral_residual() -> None:
    report = dual_skill_report()
    assert report["below_1e4"] is True
    assert report["ri_below_deriv_only"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_vpinn"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_dual_reduces_integral_residual" -q
Regression example · g2 skill beats identity

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest packages/omnibias-core/tests/test_ftc.py -k test_g2_skill_beats_identity -q
Read the implementation
def dual_skill_report(*, seeds: int = 5, n_grid: int = 129) -> dict[str, object]:
    """G2 for 09-17: dual residual vs derivative-only on ``f = cos``."""
    xs = _grid(n_grid)
    f = [math.cos(x) for x in xs]
    F = [math.sin(x) - math.sin(xs[0]) for x in xs]
    cfg = FTCNetConfig()
    dual_rd: list[float] = []
    dual_ri: list[float] = []
    only_ri: list[float] = []
    zero_i = max_abs(F)
    for seed in range(seeds):
        packs = _seed_packs(cfg, seed)
        deriv_only = fit_ftc_deriv(xs, f, packs)
        dual = fit_dual(xs, f, F, packs)
        d_only_I = evaluate_sum(xs, deriv_only, "integral")
        d_only_dI = evaluate_sum(xs, deriv_only, "deriv")
        dual_I = evaluate_sum(xs, dual, "integral")
        dual_dI = evaluate_sum(xs, dual, "deriv")
        only = dual_ftc_loss(d_only_I, d_only_dI, f, F, I_a=0.0)
        both = dual_ftc_loss(dual_I, dual_dI, f, F, I_a=0.0)
        dual_rd.append(both.max_r_D)
        dual_ri.append(both.max_r_I)
        only_ri.append(only.max_r_I)
    med_rd = sorted(dual_rd)[len(dual_rd) // 2]
    med_ri = sorted(dual_ri)[len(dual_ri) // 2]
    med_only = sorted(only_ri)[len(only_ri) // 2]
    return {
        "dual_max_r_D": dual_rd,
        "dual_max_r_I": dual_ri,
        "deriv_only_max_r_I": only_ri,
        "median_r_D": med_rd,
        "median_r_I": med_ri,
        "median_deriv_only_r_I": med_only,
        "skill": 1.0 - med_ri / zero_i if zero_i else 0.0,
        "ri_below_deriv_only": med_ri < med_only,
        "below_1e4": med_rd < 1e-4 and med_ri < 1e-4,
        "claimed_vpinn": False,
    }
FUNCTION

evaluate_sum​

omnibias.core.ftc.evaluate_sumSource ↗
evaluate_sum(xs: Sequence[float], packs: Sequence[Pack], kind: str) -> list[float]

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
xspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
packspositional-or-keywordSequence[Pack]RequiredSee the operation contract and implementation below.
kindpositional-or-keywordstrRequiredSee the operation contract and implementation below.
Returnslist[float]
Executed regression · g2 skill beats identity

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_skill_beats_identity" -q
Read the implementation
def evaluate_sum(
    xs: Sequence[float],
    packs: Sequence[Pack],
    kind: str,
) -> list[float]:
    fn = {
        "integral": pack_integral,
        "deriv": pack_deriv,
        "identity": identity_value,
        "identity_deriv": identity_deriv,
    }[kind]
    return [sum(fn(x, p) for p in packs) for x in xs]
FUNCTION

fit_dual​

omnibias.core.ftc.fit_dualSource ↗
fit_dual(xs: Sequence[float], f: Sequence[float], F: Sequence[float], packs: Sequence[Pack], *, config: DualFTCConfig=DEFAULT_DUAL) -> list[Pack]

Stacked [sqrt(w_d) dI; sqrt(w_I) I] against [f; F].

Parameters

NameType & defaultContract
xspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
fpositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
Fpositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
packspositional-or-keywordSequence[Pack]RequiredSee the operation contract and implementation below.
configkeyword-onlyDualFTCConfigDefault: DEFAULT_DUALSee the operation contract and implementation below.
Returnslist[Pack]
Executed regression · g2 dual reduces integral residual

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_dual_reduces_integral_residual() -> None:
    report = dual_skill_report()
    assert report["below_1e4"] is True
    assert report["ri_below_deriv_only"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_vpinn"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_dual_reduces_integral_residual" -q
Read the implementation
def fit_dual(
    xs: Sequence[float],
    f: Sequence[float],
    F: Sequence[float],
    packs: Sequence[Pack],
    *,
    config: DualFTCConfig = DEFAULT_DUAL,
) -> list[Pack]:
    """Stacked ``[sqrt(w_d) dI; sqrt(w_I) I]`` against ``[f; F]``."""
    wd = math.sqrt(config.w_deriv)
    wi = math.sqrt(config.w_int)
    cols: list[list[float]] = []
    for p in packs:
        unit = Pack(p.w, p.center, p.half_window, 1.0)
        col = [wd * pack_deriv(x, unit) for x in xs]
        col.extend(wi * pack_integral(x, unit) for x in xs)
        cols.append(col)
    target = [wd * v for v in f]
    target.extend(wi * v for v in F)
    return _with_amps(packs, _lstsq(cols, target))
FUNCTION

fit_ftc_deriv​

omnibias.core.ftc.fit_ftc_derivSource ↗
fit_ftc_deriv(xs: Sequence[float], target: Sequence[float], packs: Sequence[Pack]) -> list[Pack]

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
xspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
targetpositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
packspositional-or-keywordSequence[Pack]RequiredSee the operation contract and implementation below.
Returnslist[Pack]
Executed regression · g2 skill beats identity

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_skill_beats_identity" -q
Read the implementation
def fit_ftc_deriv(
    xs: Sequence[float],
    target: Sequence[float],
    packs: Sequence[Pack],
) -> list[Pack]:
    cols = [[pack_deriv(x, Pack(p.w, p.center, p.half_window, 1.0)) for x in xs] for p in packs]
    return _with_amps(packs, _lstsq(cols, target))
FUNCTION

fit_identity_deriv​

omnibias.core.ftc.fit_identity_derivSource ↗
fit_identity_deriv(xs: Sequence[float], target: Sequence[float], packs: Sequence[Pack]) -> list[Pack]

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
xspositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
targetpositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
packspositional-or-keywordSequence[Pack]RequiredSee the operation contract and implementation below.
Returnslist[Pack]
Executed regression · g2 skill beats identity

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_skill_beats_identity" -q
Read the implementation
def fit_identity_deriv(
    xs: Sequence[float],
    target: Sequence[float],
    packs: Sequence[Pack],
) -> list[Pack]:
    cols = [[identity_deriv(x, Pack(p.w, p.center, p.half_window, 1.0)) for x in xs] for p in packs]
    return _with_amps(packs, _lstsq(cols, target))
FUNCTION

ftc_block​

omnibias.core.ftc.ftc_blockSource ↗
ftc_block(x: float, w: float, b_lo: float, b_hi: float, *, activation: str='sigmoid') -> tuple[float, float, float]

Closed-form integral cell, FTC derivative, and collapse head.

Parameters

NameType & defaultContract
xpositional-or-keywordfloatRequiredSee the operation contract and implementation below.
wpositional-or-keywordfloatRequiredSee the operation contract and implementation below.
b_lopositional-or-keywordfloatRequiredSee the operation contract and implementation below.
b_hipositional-or-keywordfloatRequiredSee the operation contract and implementation below.
activationkeyword-onlystrDefault: 'sigmoid'See the operation contract and implementation below.
Returnstuple[float, float, float]
Explicit validation & failure cases
  • When activation != 'sigmoid', raises ValueError(f'only sigmoid is implemented, got {activation!r}').
  • When b_hi == b_lo, raises ValueError('window is degenerate; collapse is a separate head').

These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.

Executed regression · g2 skill beats identity

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_skill_beats_identity" -q
Regression example · band embed interior bin matches ftc block

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_band_embed_interior_bin_matches_ftc_block() -> None:
    """The one finite (non-open-tail) bin of a 2-threshold grid == ftc_block's deriv."""
    t_lo, t_hi, beta, x = -0.4, 0.9, 2.5, 0.37
    interior = band_embed(np.array([x]), np.array([t_lo, t_hi]), beta=beta)[0, 1]
    b_hi = -beta * t_lo
    b_lo = -beta * t_hi
    _integral, deriv, _collapse = ftc_block(beta * x, 1.0, b_lo, b_hi)
    assert abs(float(interior) - deriv) < 1e-12
python -m pytest packages/omnibias-core/tests/test_band_embed.py -k test_band_embed_interior_bin_matches_ftc_block -q
Read the implementation
def ftc_block(
    x: float,
    w: float,
    b_lo: float,
    b_hi: float,
    *,
    activation: str = "sigmoid",
) -> tuple[float, float, float]:
    """Closed-form integral cell, FTC derivative, and collapse head."""
    if activation != "sigmoid":
        raise ValueError(f"only sigmoid is implemented, got {activation!r}")
    if b_hi == b_lo:
        raise ValueError("window is degenerate; collapse is a separate head")
    z_lo = w * x + b_lo
    z_hi = w * x + b_hi
    integral = softplus(z_hi) - softplus(z_lo)
    deriv = w * (sigmoid(z_hi) - sigmoid(z_lo))
    collapse = integral / (b_hi - b_lo)
    return integral, deriv, collapse
FUNCTION

honesty_payload​

omnibias.core.ftc.honesty_payloadSource ↗
honesty_payload() -> dict[str, bool]

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Returnsdict[str, bool]
Executed regression · g3 honesty

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g3_honesty() -> None:
    payload = honesty_payload()
    assert payload["claimed_weak_form"] is False
    assert payload["claimed_vpinn"] is False
    assert payload["theorem_prover_verified"] is False
    assert "not a VPINN" in DISCLAIMER
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g3_honesty" -q
Read the implementation
def honesty_payload() -> dict[str, bool]:
    return {
        "claimed_weak_form": False,
        "claimed_vpinn": False,
        "global_convergence_claim": False,
        "theorem_prover_verified": False,
    }
Other public import paths
  • omnibias.core.ftc.honesty_payload
  • omnibias.jax.architectures.ftc_net.honesty_payload
  • omnibias.torch.architectures.ftc_net.honesty_payload
FUNCTION

identity_deriv​

omnibias.core.ftc.identity_derivSource ↗
identity_deriv(x: float, pack: Pack) -> float

d/dx sigma(w x + c) of an identity cell, not an integral window.

Parameters

NameType & defaultContract
xpositional-or-keywordfloatRequiredSee the operation contract and implementation below.
packpositional-or-keywordPackRequiredSee the operation contract and implementation below.
Returnsfloat
Executed regression · g2 skill beats identity

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_skill_beats_identity" -q
Read the implementation
def identity_deriv(x: float, pack: Pack) -> float:
    """``d/dx sigma(w x + c)`` of an identity cell, not an integral window."""
    s = sigmoid(pack.w * x + pack.center)
    return pack.amp * pack.w * s * (1.0 - s)
FUNCTION

identity_value​

omnibias.core.ftc.identity_valueSource ↗
identity_value(x: float, pack: Pack) -> float

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
xpositional-or-keywordfloatRequiredSee the operation contract and implementation below.
packpositional-or-keywordPackRequiredSee the operation contract and implementation below.
Returnsfloat
Read the implementation
def identity_value(x: float, pack: Pack) -> float:
    return pack.amp * sigmoid(pack.w * x + pack.center)
FUNCTION

max_abs​

omnibias.core.ftc.max_absSource ↗
max_abs(values: Sequence[float]) -> float

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
valuespositional-or-keywordSequence[float]RequiredSee the operation contract and implementation below.
Returnsfloat
Executed regression · g2 skill beats identity

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_skill_beats_identity" -q
Read the implementation
def max_abs(values: Sequence[float]) -> float:
    return max(abs(v) for v in values) if values else 0.0
FUNCTION

pack_deriv​

omnibias.core.ftc.pack_derivSource ↗
pack_deriv(x: float, pack: Pack) -> float

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
xpositional-or-keywordfloatRequiredSee the operation contract and implementation below.
packpositional-or-keywordPackRequiredSee the operation contract and implementation below.
Returnsfloat
Executed regression · g2 skill beats identity

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_skill_beats_identity" -q
Read the implementation
def pack_deriv(x: float, pack: Pack) -> float:
    b_lo, b_hi = _lo_hi(pack)
    _i, deriv, _c = ftc_block(x, pack.w, b_lo, b_hi)
    return pack.amp * deriv
FUNCTION

pack_integral​

omnibias.core.ftc.pack_integralSource ↗
pack_integral(x: float, pack: Pack) -> float

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
xpositional-or-keywordfloatRequiredSee the operation contract and implementation below.
packpositional-or-keywordPackRequiredSee the operation contract and implementation below.
Returnsfloat
Executed regression · g2 dual reduces integral residual

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_dual_reduces_integral_residual() -> None:
    report = dual_skill_report()
    assert report["below_1e4"] is True
    assert report["ri_below_deriv_only"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_vpinn"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_dual_reduces_integral_residual" -q
Read the implementation
def pack_integral(x: float, pack: Pack) -> float:
    b_lo, b_hi = _lo_hi(pack)
    integral, _d, _c = ftc_block(x, pack.w, b_lo, b_hi)
    return pack.amp * integral
FUNCTION

sigmoid​

omnibias.core.ftc.sigmoidSource ↗
sigmoid(z: float) -> float

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Parameters

NameType & defaultContract
zpositional-or-keywordfloatRequiredSee the operation contract and implementation below.
Returnsfloat
Executed regression · g2 antiderivative

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_antiderivative() -> None:
    report = antiderivative_skill()
    assert report["below_1e3"] is True
    assert report["skill_positive"] is True
    assert float(report["skill"]) > 0.0
python -m pytest "packages/omnibias-core/tests/test_integral_kernel.py::test_g2_antiderivative" -q
Read the implementation
def sigmoid(z: float) -> float:
    if z >= 0.0:
        return float(1.0 / (1.0 + math.exp(-z)))
    ez = math.exp(z)
    return float(ez / (1.0 + ez))
FUNCTION

skill_report​

omnibias.core.ftc.skill_reportSource ↗
skill_report(*, seeds: int=5, n_grid: int=129) -> dict[str, object]

G2 for 09-03: fit dI/dx = cos x vs identity-cell sigma'.

Parameters

NameType & defaultContract
seedskeyword-onlyintDefault: 5See the operation contract and implementation below.
n_gridkeyword-onlyintDefault: 129See the operation contract and implementation below.
Returnsdict[str, object]
Executed regression · g2 skill beats identity

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g2_skill_beats_identity() -> None:
    report = skill_report()
    assert report["below_1e4"] is True
    assert report["beats_identity"] is True
    assert float(report["skill"]) > 0.0
    assert report["claimed_weak_form"] is False
python -m pytest "packages/omnibias-core/tests/test_ftc.py::test_g2_skill_beats_identity" -q
Read the implementation
def skill_report(*, seeds: int = 5, n_grid: int = 129) -> dict[str, object]:
    """G2 for 09-03: fit ``dI/dx = cos x`` vs identity-cell ``sigma'``."""
    xs = _grid(n_grid)
    target = [math.cos(x) for x in xs]
    zero_err = max_abs(target)
    ftc_errs: list[float] = []
    id_errs: list[float] = []
    cfg = FTCNetConfig()
    for seed in range(seeds):
        packs = _seed_packs(cfg, seed)
        ftc = fit_ftc_deriv(xs, target, packs)
        ident = fit_identity_deriv(xs, target, packs)
        ftc_errs.append(max_abs([a - b for a, b in zip(evaluate_sum(xs, ftc, "deriv"), target, strict=True)]))
        id_errs.append(
            max_abs([a - b for a, b in zip(evaluate_sum(xs, ident, "identity_deriv"), target, strict=True)])
        )
    ftc_med = sorted(ftc_errs)[len(ftc_errs) // 2]
    id_med = sorted(id_errs)[len(id_errs) // 2]
    return {
        "ftc_errors": ftc_errs,
        "identity_errors": id_errs,
        "ftc_median": ftc_med,
        "identity_median": id_med,
        "zero_error": zero_err,
        "skill": 1.0 - ftc_med / zero_err if zero_err else 0.0,
        "beats_identity": ftc_med < id_med,
        "below_1e4": ftc_med < 1e-4,
        "claimed_weak_form": False,
    }
FUNCTION

softplus​

omnibias.core.ftc.softplusSource ↗
softplus(z: float) -> float

log(1 + exp(z)) with the stable z + log1p(exp(-z)) branch.

Parameters

NameType & defaultContract
zpositional-or-keywordfloatRequiredSee the operation contract and implementation below.
Returnsfloat
Executed regression · g1

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g1() -> None:
    ex = worked_example()
    assert ex["g1_err"] < 1e-12
    z = jnp.asarray([0.5])
    cell = float(integral_cell(z, -0.5, 0.5)[0])
    assert abs(cell - core_cell(0.5, -0.5, 0.5)) < 1e-12
python -m pytest "packages/omnibias-jax/tests/test_integral_kernel.py::test_g1" -q
Regression example · g1 cell

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g1_cell() -> None:
    ex = worked_example()
    assert ex["g1_err"] < 1e-12
    assert abs(integral_cell(0.5, -0.5, 0.5) - (softplus(1.0) - softplus(0.0))) < 1e-12
    assert abs(ex["mass"] - 0.5) < 1e-12
python -m pytest packages/omnibias-core/tests/test_integral_kernel.py -k test_g1_cell -q
Read the implementation
def softplus(z: float) -> float:
    """``log(1 + exp(z))`` with the stable ``z + log1p(exp(-z))`` branch."""
    if z >= 0.0:
        return float(z + math.log1p(math.exp(-z)))
    return float(math.log1p(math.exp(z)))
FUNCTION

worked_example​

omnibias.core.ftc.worked_exampleSource ↗
worked_example() -> dict[str, float]

Spec 09-03 / 09-17 numbers at x=0, delta=0.2.

Returnsdict[str, float]
Executed regression · g1 matches core

Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g1_matches_core() -> None:
    x = jnp.asarray(0.0)
    w = jnp.asarray(1.0)
    lo = jnp.asarray(-0.1)
    hi = jnp.asarray(0.1)
    integral, deriv, collapse = ftc_block(x, w, lo, hi)
    ex = worked_example()
    assert float(integral) == ex["I"]
    assert float(deriv) == ex["dI"]
    assert float(collapse) == ex["collapse"]
    assert FTCNet(FTCNetConfig()).config.window == 0.6
python -m pytest "packages/omnibias-jax/tests/test_ftc_net.py::test_g1_matches_core" -q
Regression example · g1 worked example

This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.

def test_g1_worked_example() -> None:
    ex = worked_example()
    assert ex["collapse_err"] < 1e-12
    assert ex["ftc_err"] < 1e-12
    assert abs(ex["I"] - 0.1) < 1e-12
    integral, deriv, collapse = ftc_block(0.0, 1.0, -0.1, 0.1)
    loss = dual_ftc_loss([integral], [deriv], [deriv], [0.0], I_a=integral)
    assert loss.max_r_D < 1e-12
    assert loss.max_r_I < 1e-12
    loss0 = dual_ftc_loss([integral], [deriv], [0.0], [0.0], I_a=integral)
    assert loss0.max_r_D > 0.04
python -m pytest packages/omnibias-core/tests/test_ftc.py -k test_g1_worked_example -q
Read the implementation
def worked_example() -> dict[str, float]:
    """Spec 09-03 / 09-17 numbers at ``x=0``, ``delta=0.2``."""
    integral, deriv, collapse = ftc_block(0.0, 1.0, -0.1, 0.1)
    sig_hi = sigmoid(0.1)
    sig_lo = sigmoid(-0.1)
    return {
        "I": integral,
        "dI": deriv,
        "collapse": collapse,
        "sigmoid_0": sigmoid(0.0),
        "ftc_band": sig_hi - sig_lo,
        "collapse_err": abs(collapse - sigmoid(0.0)),
        "ftc_err": abs(deriv - (sig_hi - sig_lo)),
    }
Other public import paths
  • omnibias.core.ftc.worked_example
  • omnibias.jax.architectures.ftc_net.worked_example
  • omnibias.torch.architectures.ftc_net.worked_example