Skip to content

groups · SchreierTree

6 accepted declarations. Python and Rust forms, contracts, evidence, failure boundaries, and checked usages are kept together below.

Worked example

The complete checked program Exact affine systems and canonical submodules over Z and Z/nZ uses this API directly.

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Benjamin Antieau and Deven Manam
"""Exact affine systems and canonical submodules over Z and Z/nZ."""

from __future__ import annotations

from noether import IntegerRing, Z
from noether.commalg import ResidueRing
from noether.homalg import FreeModule, ModuleElement, ModuleHomomorphism, Submodule
from noether.linalg import Matrix, Vector

operator = Matrix.from_rows(Z, [[2, 4, 0], [0, 0, 3]])
right_hand_side = Vector.from_values(Z, [6, 9])
integer_result = operator.solve_exact(right_hand_side)
assert integer_result.is_consistent
integer_solutions = integer_result.solutions
assert integer_solutions is not None
assert operator @ integer_solutions.particular_solution == right_hand_side
assert operator @ integer_solutions.homogeneous_generators == Matrix.zeros(Z, (2, 1))
integer_result.verify()

# Empty systems retain a replayable divisibility obstruction.
impossible = Matrix.from_rows(Z, [[6]]).solve_exact(Vector.from_values(Z, [9]))
assert not impossible.is_consistent
assert impossible.obstruction is not None
assert impossible.obstruction.left_gcd == 6
assert abs(impossible.obstruction.combined_rhs) == 9
impossible.obstruction.verify()

# Composite moduli are not treated as fields.  The result is an affine module,
# including all homogeneous torsion directions.
z12 = ResidueRing(12)
congruence = Matrix.from_rows(z12, [[8]]).solve_exact(Vector.from_values(z12, [4]))
assert congruence.is_consistent
congruence_solutions = congruence.solutions
assert congruence_solutions is not None
assert {
    (int(congruence_solutions.particular_solution[0]) + 3 * offset) % 12 for offset in range(4)
} == {
    2,
    5,
    8,
    11,
}
congruence.verify()

# Submodules retain a canonical normal form, so equality and lattice operations
# compare mathematics rather than the supplied generating lists.
ambient = FreeModule(Z, 2)


def element(x: int, y: int) -> ModuleElement[IntegerRing]:
    return ModuleElement(ambient, Vector.from_values(Z, [x, y]))


lattice = Submodule.from_generators(ambient, [element(2, 0), element(0, 3)])
assert lattice.finite_index() == 6
witness = lattice.membership_witness(element(6, 9))
assert witness is not None
witness.verify()
assert lattice.saturation().finite_index() == 1

homomorphism = ModuleHomomorphism(
    FreeModule(Z, 3),
    ambient,
    operator,
)
kernel_result = homomorphism.kernel()
image_result = homomorphism.image()
kernel = kernel_result.submodule
image = image_result.submodule
assert kernel.generator_count == 1
assert image.contains(element(2, 0))
kernel_result.verify()
image_result.verify()

print(
    "exact systems: integer affine rank 1; four Z/12Z solutions; "
    "index-6 lattice saturated and verified"
)

Run it with .venv/bin/python examples/38_exact_linear_systems.py.

groups.SchreierTree

The Schreier tree of a base point under the full group.

class SchreierTree

noether::groups::SchreierTree · Direct Rust declaration

pub struct SchreierTree { pub root: u32, pub orbit: Vec<u32>, pub pred: Vec<Option<(u32, u32)>>, pub generators_used: Vec<Perm>, }
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, perm-core
GIL attached / bounded

Executable usage: validation/unit/groups/test_acceptance_workload.py:17 · validation/unit/groups/test_acceptance_workload.py:54

groups.SchreierTree.contains

True iff p is in the orbit.

Detailed contract

true if p is in the orbit.

(self, point: int) -> bool

noether::groups::SchreierTree::contains · Direct Rust declaration

pub fn contains(&self, p: u32) -> bool
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, perm-core
GIL attached / bounded

Executable usage: examples/38_exact_linear_systems.py:73 · validation/unit/commalg/test_local_algebra.py:63 · validation/unit/commalg/test_prime_localization.py:50 · validation/unit/commalg/test_prime_localization.py:55 · validation/unit/groups/test_acceptance_workload.py:56 · validation/unit/groups/test_permutation_group_facade.py:81

groups.SchreierTree.generators_used

The generators the generator_index slots refer to — list[Permutation].

Detailed contract

The generators the generator_index slots refer to — list[Permutation].

(self) -> list[Permutation]

noether::groups::SchreierTree · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, perm-core
GIL attached / bounded

Executable usage: validation/unit/groups/test_acceptance_workload.py:58 · validation/parity/_noether_bsgs.py:115

groups.SchreierTree.orbit

Orbit in BFS-from-root discovery order.

Detailed contract

Orbit in BFS-from-root discovery order. list[int].

(self) -> list[int]

noether::groups::SchreierTree · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, perm-core
GIL attached / bounded

Executable usage: examples/20_conjugacy_classes.py:3 · validation/unit/groups/test_acceptance_workload.py:125 · validation/unit/groups/test_acceptance_workload.py:126 · validation/unit/groups/test_acceptance_workload.py:127 · validation/unit/groups/test_acceptance_workload.py:128 · validation/unit/groups/test_acceptance_workload.py:129

groups.SchreierTree.pred

Predecessor table — pred[p] is None for the root and any non-orbit point, else (parent, generator_index) such that generators[generator_index].apply(parent) == p.

Detailed contract

Predecessor table — pred[p] is None for the root and any non-orbit point, else (parent, generator_index) such that generators[generator_index].apply(parent) == p. Returned as list[tuple[int, int] | None] of length degree.

(self) -> list[tuple[int, int] | None]

noether::groups::SchreierTree · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, perm-core
GIL attached / bounded

Executable usage: validation/unit/groups/test_acceptance_workload.py:57 · validation/parity/_noether_bsgs.py:119

groups.SchreierTree.root

Root of the tree.

(self) -> int

noether::groups::SchreierTree · Python projection

Python projection convenience over this Rust mathematical type
Contract Value
Guarantee checked deterministic result
Determinism deterministic
Availability default CPU build
Domain implementation crates noether, perm-core
GIL attached / bounded

Executable usage: examples/10_padic_hensel_lifting.py:14 · examples/10_padic_hensel_lifting.py:15 · examples/10_padic_hensel_lifting.py:16 · examples/10_padic_hensel_lifting.py:3 · examples/distributed/f2_linear_algebra.py:21 · examples/distributed/f2_linear_algebra.py:40