Transforms
iitx.transforms
Macro-level transforms: coarse-graining and black-boxing.
Both transforms are pure functions from a :class:~iitx.system.System to a
:class:~iitx.system.System — the resulting macro system feeds the unchanged Φ
pipeline, with no special macro code path (docs/design.md §10). This is what forces
the core's generality: coarse-graining produces multi-valued macro units even from
binary micro-units, and macro TPMs need not factorize (conditional independence stays a
checked property, verified when a measure derives the factored view).
- Coarse-graining (Hoel et al. 2013; Hoel et al. 2016) aggregates: a partition of
the micro-units into macro-units, with a per-macro-unit state grouping, and the macro
TPM as the fiber average
D⁻¹ Gᵀ Tᵗ Gof the (τ-step) micro TPM under maximum- entropy perturbation within each fiber. - Black-boxing (Marshall et al. 2018) projects: boxes of micro-units with designated output units; the macro state is the output units' state at the end of a τ-step window; hidden initial states are uniformly noised and boxes cannot read each other's hidden units. Following the oracle, cross-box connections beyond the first micro-step are severed entirely, and the black-box TPM is the conditionally independent factorization (per-unit marginals) of the window dynamics — the Markovian projection Marshall et al. leave implicit and PyPhi makes by construction.
Both transforms are jittable, differentiable in the TPM entries, and batchable over same-shaped candidate mappings; the mappings themselves (partitions, groupings, outputs, τ) are static structure.
coarse_grain(system, partition, groupings, steps=1)
Coarse-grain a system into macro-units.
The macro transition probability is the uniform ("maximum-entropy") average over
each fiber of micro-states mapping to a macro-state:
T_M(m, m') = mean over s in fiber(m) of sum over s' in fiber(m') of T^steps(s, s').
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
System
|
The micro system. |
required |
partition
|
tuple[tuple[int, ...], ...]
|
Disjoint blocks of micro-units, jointly covering the system; block
|
required |
groupings
|
tuple[tuple[int, ...], ...]
|
For each block, the macro value of each of its joint micro-states
(indexed little-endian within the block, units in ascending order). Macro
values must cover |
required |
steps
|
int
|
Temporal grain: the number of micro-steps per macro-step. |
1
|
Returns:
| Type | Description |
|---|---|
System
|
The macro system (state-by-state; conditional independence is not implied — it |
System
|
is checked downstream when a measure derives the factored view). |
Source code in src/iitx/transforms.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
coarse_grain_state(system, partition, groupings, state)
Map a micro state to its macro state under a coarse-graining.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
System
|
The micro system. |
required |
partition
|
tuple[tuple[int, ...], ...]
|
The unit partition of the coarse-graining. |
required |
groupings
|
tuple[tuple[int, ...], ...]
|
The state groupings of the coarse-graining. |
required |
state
|
Array
|
Micro state, shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Macro state, shape |
Source code in src/iitx/transforms.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
black_box(system, partition, outputs, steps=1)
Black-box a system: hide within-box micro-units behind designated outputs.
The macro state is the joint state of the output units at the end of a steps-
long micro window. Within the window, boxes may read other boxes' outputs only at
the first micro-step (later steps sever all cross-box connections); hidden units'
initial states are uniformly noised; and the resulting window dynamics is factorized
per unit — all following the oracle's semantics for the conventions the papers leave
open (docs/notes/macro.md §6).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
System
|
The micro system. Must be conditionally independent (the window is composed from its factored view). |
required |
partition
|
tuple[tuple[int, ...], ...]
|
Disjoint boxes of micro-units, jointly covering the system. Static. |
required |
outputs
|
tuple[tuple[int, ...], ...]
|
For each box, its designated output units (a nonempty subset of the box). Hidden units are the rest. Static. |
required |
steps
|
int
|
Temporal grain: the number of micro-steps per macro-step. |
1
|
Returns:
| Type | Description |
|---|---|
System
|
The macro system over the output units (in ascending micro-unit order), with |
System
|
their micro alphabets. |
Source code in src/iitx/transforms.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
black_box_state(outputs, state)
Map a micro state to its black-box macro state (the outputs' projection).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outputs
|
tuple[tuple[int, ...], ...]
|
The per-box output units of the black-boxing. |
required |
state
|
Array
|
Micro state, shape |
required |
Returns:
| Type | Description |
|---|---|
Array
|
Macro state: the state of the output units in ascending micro-unit order. |
Source code in src/iitx/transforms.py
179 180 181 182 183 184 185 186 187 188 189 190 191 | |