Interaction systems and reduction #
Rule S a b— the right-hand side of an interaction between a cell withaauxiliary ports and a cell withb: a net whose names are the auxiliary ports of the two cells and some internal wires.System S— at most one rule for each pair of symbols.Step,Steps— reduction. Only interactions are steps; wire substitution is not.
Contents, in the order of the file:
- Rules:
Rule,Rule.inst,Rule.Linear,Rule.Reduced,Rule.swap,Rule.count_vars_inst. - Systems and one interaction:
System,Step,Rule.symm_of_equiv,System.WellFormed. - One interaction and linearity:
Step.linear,Step.add_right. - Reduction:
Steps,Steps.single,Steps.cast,Steps.linear. - Reduction up to wires:
StepE,StepsE,Step.stepE,Steps.stepsE,StepE.linear,StepsE.linear. - The tactic
ms, which reorders a sum of multisets.
The right-hand side of a rule, with trees plugged into the auxiliary ports and the internal
wires named by f.
Equations
- r.inst as bs f = INet.Net.bind (Sum.elim as (Sum.elim bs fun (i : Fin r.internal) => INet.Term.var (f i))) r.net
Instances For
In the right-hand side of a rule, every auxiliary port of the two cells occurs exactly once and every internal wire exactly twice.
Instances For
The right-hand side is a reduced net, written as trees rooted at the auxiliary ports: every equation has an auxiliary port on one side. Together with linearity this excludes pairs of cells plugged by their principal ports, vicious circles and cyclic wires.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The count of an element in a Multiset.bind over a finite type, as a sum over the type.
One interaction: two cells plugged by their principal ports are replaced by the right-hand side of their rule. The wires the rule creates get names not used in the net.
- mk {S : Signature} {I : System S} (α β : S.Sym) (r : Rule S (S.arity α) (S.arity β)) (hr : I.rule α β = some r) (as : Fin (S.arity α) → Term S ℕ) (bs : Fin (S.arity β) → Term S ℕ) (Δ : Net S ℕ) (f : Fin r.internal → ℕ) (hf : Function.Injective f) (hfresh : ∀ (i : Fin r.internal), f i ∉ Net.vars (s(Term.app α as, Term.app β bs) ::ₘ Δ)) : Step I (s(Term.app α as, Term.app β bs) ::ₘ Δ) (r.inst as bs f + Δ)
Instances For
A rule that is the same net as its swap up to wires is symmetric in the sense of
System.WellFormed.symm, with the identity permutation.
An interaction system in the sense of Lafont: rules are linear and reduced, and can be applied without ambiguity.
Every rule is linear.
Every right-hand side is a reduced net.
- symm (α : S.Sym) (r : Rule S (S.arity α) (S.arity α)) : I.rule α α = some r → ∃ (π : Equiv.Perm (Fin r.internal)), Equiv r.swap.net (Net.bind (fun (x : Fin (S.arity α) ⊕ Fin (S.arity α) ⊕ Fin r.internal) => Term.var (Sum.map id (Sum.map id ⇑π) x)) r.net)
A rule of a symbol with itself is symmetric: read from the other cell it is the same graph (Lafont 1997, page 73), that is, the same net up to wires and up to a permutation of its internal wires. The permutation is needed because the internal wires of a rule are named by
Fin r.internal, which leaves no spare name through whichEquivcould exchange two of them.
Instances For
An interaction can be done inside a larger net, as long as the result is linear: the names given to the wires created by the rule are then unused in the rest of the net.
Reduction in any number of interactions.
Equations
Instances For
One interaction up to wires: the net is first rewritten into an equivalent one, then two
cells interact. This lets two cells interact when their principal ports are joined by a named
wire, as in x = α(…), x = β(…), which is an active pair of the graph.
Equations
- INet.StepE I N M = ∃ (N' : INet.Net S ℕ), INet.Equiv N N' ∧ INet.Step I N' M
Instances For
Reduction up to wires, in any number of interactions.
Equations
Instances For
Reorder a sum of multisets.
Equations
- INet.tacticMs = Lean.ParserDescr.node `INet.tacticMs 1024 (Lean.ParserDescr.nonReservedSymbol "ms" false)