cottax.relational.rewrites module

The rewrite that writes a relation: FixedPointCut, cuts closed by a problem on their copies.

check_cuts(op: FixedPointCut)[source]

Something is cut, and no variable twice: two copies of one place would assume two values for it.

Return type:

Iterator[Violation]

class FixedPointCut[N: Label, V: Place](cuts: tuple[Cut[N, V], ...], at: N)[source]

Bases: ComposedOp[N, V], Generic[N, V]

Several cuts and the problem that determines every copy they mint: ^copy.x = x per cut, so the condition is the next iterate and the loop is re-closed through it.

cuts: tuple[Cut[N, V], ...]
at: N

Where the problem closing the cuts is bound – a binding of its own.

checks: PerLevel[tuple[Callable[[Any], object], ...]] = (<function check_cuts>,)

Callable [self] -> iterable of violations, which are raised at construction unless skipped (see unchecked).

property vars: tuple[V, ...]

What was cut, in the order the cuts were given.

property copies: tuple[V, ...]

The copies the readers end up reading, one per cut.

property definition: RelationalCondition[V]

One relation per cut, paired by the order the cuts were given.

composed(graph: NestingGraph[N, V])[source]

The ops this one is. Takes a graph, so an expansion may depend on what it meets.

Return type:

Sequence[GraphOp[N, V]]

class NothingCut[source]

Bases: Violation

template: AbstractClassVar[str] = 'fixed_point_cut(): nothing cut'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class CutTwice(places: tuple)[source]

Bases: Violation

places: tuple
template: AbstractClassVar[str] = '{places!r} is cut twice in one closure -- two copies of one place would assume two values for it'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording