pyphi.conf.constraints#

Eager config-combination validation.

Single-field validity is enforced by each config dataclass’s __post_init__. This module adds the orthogonal layer of cross-field constraints: combinations of individually-valid options that together compute nonsense or a silently-different quantity. They are evaluated on every write to pyphi.config: after each assignment, and once after all the values of an override() or load_yaml call are applied (gated by config.infrastructure.validate_config). A wrong combination fails at the point of configuration with a ConfigurationError that names the two conflicting fields and a concrete fix, rather than at compute time, deep in the math, or not at all. Snapshots installed in parallel workers come from an already-checked configuration and are not checked again.

A constraint fires only on a combination that is wrong, not one that is merely inert. An option left at a default that the active formalism never consults is not flagged — for example, an IIT 3.0 config leaves system_phi_measure at its IIT 4.0 default, but IIT 3.0 never reads it.

The measure/version constraint reproduces the reactive check_measure_compatible boundary (each formalism’s compatible_measures) eagerly, so the two cannot diverge from what the compute path enforces.

Register a constraint by appending a ConfigConstraint to CONFIG_CONSTRAINTS, or with register_constraint(). A check returns a message for a combination that is wrong, and raises UnregisteredValueError for a name that nothing is registered under (a misspelt measure, scheme or strategy), which no other option can fix.

Notes

The intrinsic-information requirement (Eq. 23) is keyed on the system measure (applies_intrinsic_information_requirement), and each IIT 4.0 formalism declares whether it is defined by the requirement. The two must agree. IIT_4_0_2026 with a measure that lacks the requirement would compute the 2023 quantity while reporting version 2026; IIT_4_0_2023 with a measure that applies it would compute the 2026 quantity while reporting version 2023. Both are formalism mixtures matching no paper. The second is also what setting formalism.iit.version alone produces, since the default system measure applies the requirement.

The background_conditioning_compatible_with_version constraint pins IIT 3.0 to CONDITION_CURRENT_STATE (the shipped preset’s convention). The marginalized IIT 3.0 variant opts out via validate_config=False, which also disables the matching dispatch-boundary checks.

precision is not constrained against any other field.

The system_partition_scheme_compatible_with_version constraint binds only under formalisms that restrict their system partition schemes. IIT 3.0 accepts only DIRECTED_BIPARTITION / DIRECTED_BIPARTITION_CUT_ONE (its sia_partitions raises for any other scheme), so the constraint mirrors that boundary eagerly via the formalism’s compatible_system_partition_schemes. IIT 4.0 accepts any registered scheme — a non-default scheme computes a well-defined per-scheme phi — so it declares compatible_system_partition_schemes = None and its partition scheme is left unconstrained.

Functions

check_config_constraints(config)

Run every registered constraint against config.

register_constraint(name)

Decorator registering a constraint-check function under name.

Classes

ConfigConstraint(name, check)

A named cross-field config constraint.