Documentation

LeanPool.InteractionCombinators.Core.Net

Nets, linearity and equivalence up to wires #

Contents, in the order of the file:

  1. Nets, their names and their cells: Net, eqVars, eqCells, Net.cells, Net.vars, Net.bind, Net.vars_bind.
  2. Linearity and bounds on names: Net.Linear, Net.Below, Term.Below, the below_ lemmas, Net.Linear.add_fresh.
  3. Wire substitution and equivalence: Wire, Equiv.
  4. One wire substitution: Wire.count_vars, Wire.free_iff, Wire.cells_eq, Wire.linear_right, Wire.add_right, Wire.below.
  5. Equivalence: Equiv.refl, Equiv.symm, Equiv.trans, Equiv.linear_iff, Equiv.free_iff, Equiv.cells_eq.
@[reducible, inline]
abbrev INet.Net (S : Signature) (ν : Type) :

A net: a multiset of unordered equations between trees.

Equations
Instances For
    def INet.eqVars {S : Signature} {ν : Type} :
    Sym2 (Term S ν) → Multiset ν

    The names of an equation, with multiplicity.

    Equations
    Instances For
      @[simp]
      theorem INet.eqVars_mk {S : Signature} {ν : Type} (a b : Term S ν) :

      The names of the equation a = b: those of a and those of b.

      def INet.eqCells {S : Signature} {ν : Type} :
      Sym2 (Term S ν) → Multiset S.Sym

      The cells of an equation, with multiplicity.

      Equations
      Instances For
        @[simp]
        theorem INet.eqCells_mk {S : Signature} {ν : Type} (a b : Term S ν) :

        The cells of the equation a = b: those of a and those of b.

        def INet.Net.cells {S : Signature} {ν : Type} (N : Net S ν) :

        The cells of a net: the symbols occurring in it, with multiplicity.

        Equations
        Instances For
          @[simp]
          theorem INet.Net.cells_cons {S : Signature} {ν : Type} (e : Sym2 (Term S ν)) (N : Net S ν) :

          The cells of a net with one more equation.

          def INet.Net.vars {S : Signature} {ν : Type} (N : Net S ν) :

          The names of a net, with multiplicity.

          Equations
          Instances For
            @[simp]
            theorem INet.Net.vars_zero {S : Signature} {ν : Type} :
            vars 0 = 0

            The empty net has no name.

            @[simp]
            theorem INet.Net.vars_cons {S : Signature} {ν : Type} (e : Sym2 (Term S ν)) (N : Net S ν) :
            vars (e ::ₘ N) = eqVars e + N.vars

            The names of a net with one more equation.

            @[simp]
            theorem INet.Net.vars_singleton {S : Signature} {ν : Type} (e : Sym2 (Term S ν)) :

            The names of a net of one equation.

            @[simp]
            theorem INet.Net.vars_add {S : Signature} {ν : Type} (N M : Net S ν) :
            (N + M).vars = N.vars + M.vars

            The names of two nets put side by side.

            def INet.Net.bind {S : Signature} {ν μ : Type} (f : ν → Term S μ) (N : Net S ν) :
            Net S μ

            Plug a tree into every name of the net.

            Equations
            Instances For
              theorem INet.Net.vars_bind {S : Signature} {ν μ : Type} (f : ν → Term S μ) (N : Net S ν) :
              (bind f N).vars = N.vars.bind fun (x : ν) => (f x).vars

              The names of a net after plugging: each name x is replaced by the names of f x.

              def INet.Net.Linear {S : Signature} {ν : Type} [DecidableEq ν] (N : Net S ν) :

              Every name occurs at most twice: once at each end of a wire, or once for a free port.

              Equations
              Instances For
                def INet.Net.Below {S : Signature} (k : ℕ) (N : Net S ℕ) :

                Every name of the net is below k: the names from k on are unused.

                Equations
                Instances For
                  theorem INet.Net.Below.notMem {S : Signature} {k x : ℕ} {N : Net S ℕ} (h : Below k N) (hx : k ≤ x) :
                  x ∉ N.vars

                  A name at or above the bound of a net does not occur in it.

                  theorem INet.Net.Below.mono {S : Signature} {k m : ℕ} {N : Net S ℕ} (h : Below k N) (hkm : k ≤ m) :
                  Below m N

                  A bound on the names of a net can be raised.

                  def INet.Term.Below {S : Signature} (k : ℕ) (t : Term S ℕ) :

                  Every name of the tree is below k.

                  Equations
                  Instances For
                    @[simp]
                    theorem INet.Term.below_var {S : Signature} {k x : ℕ} :
                    Below k (var x) ↔ x < k

                    A leaf is below k exactly when its name is.

                    theorem INet.Term.Below.mono {S : Signature} {k m : ℕ} {t : Term S ℕ} (h : Below k t) (hkm : k ≤ m) :
                    Below m t

                    A bound on the names of a tree can be raised.

                    @[simp]
                    theorem INet.Net.below_zero {S : Signature} {k : ℕ} :
                    Below k 0

                    The empty net is below every bound.

                    @[simp]
                    theorem INet.Net.below_cons {S : Signature} {k : ℕ} {a b : Term S ℕ} {N : Net S ℕ} :

                    A net with one more equation is below k exactly when both sides of the equation and the rest of the net are.

                    @[simp]
                    theorem INet.Net.below_singleton {S : Signature} {k : ℕ} {a b : Term S ℕ} :

                    A net of one equation is below k exactly when both sides of the equation are.

                    @[simp]
                    theorem INet.Net.below_add {S : Signature} {k : ℕ} {N M : Net S ℕ} :
                    Below k (N + M) ↔ Below k N ∧ Below k M

                    Two nets side by side are below k exactly when each of them is.

                    theorem INet.Net.Linear.cast {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : N.Linear) (e : N = M) :

                    Linearity carried along an equality of nets.

                    theorem INet.Net.Below.cast {S : Signature} {k : ℕ} {N M : Net S ℕ} (h : Below k N) (e : N = M) :
                    Below k M

                    A bound on the names carried along an equality of nets.

                    theorem INet.Net.Linear.add_fresh {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (hN : N.Linear) (F : Multiset ν) (hF : F.Nodup) (hfresh : ∀ x ∈ F, x ∉ N.vars) (hv : M.vars = N.vars + (F + F)) :

                    Adding both ends of some new wires to a linear net keeps it linear.

                    inductive INet.Wire {S : Signature} {ν : Type} [DecidableEq ν] :
                    Net S ν → Net S ν → Prop

                    One wire substitution. The wire x has one end on the root of t and its other end inside the equation a = b; plugging t there gives the same graph. Linearity of the net guarantees that x occurs nowhere else.

                    Instances For
                      def INet.Equiv {S : Signature} {ν : Type} [DecidableEq ν] :
                      Net S ν → Net S ν → Prop

                      Nets that are the same graph, spelled differently.

                      Equations
                      Instances For
                        theorem INet.Wire.linear_left {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Wire N M) :

                        The net a wire substitution starts from is linear.

                        theorem INet.Wire.count_vars {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Wire N M) (y : ν) :

                        A wire substitution removes both ends of the wire and changes no other name.

                        theorem INet.Wire.free_iff {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Wire N M) (y : ν) :

                        A wire substitution does not change which names are free ports.

                        theorem INet.Wire.cells_eq {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Wire N M) :

                        A wire substitution creates and destroys no cell.

                        theorem INet.Wire.linear_right {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Wire N M) :

                        The net a wire substitution arrives at is linear.

                        theorem INet.Wire.mem_vars {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Wire N M) {y : ν} (hy : y ∈ M.vars) :
                        y ∈ N.vars

                        A wire substitution brings no new name.

                        theorem INet.Wire.equiv {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Wire N M) :
                        Equiv N M

                        The two nets of a wire substitution are equivalent.

                        theorem INet.Wire.add_right {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Wire N M) (Γ : Net S ν) (hlin : (N + Γ).Linear) :
                        Wire (N + Γ) (M + Γ)

                        A wire substitution can be done inside a larger net, as long as the larger net is linear.

                        theorem INet.Wire.cast {S : Signature} {ν : Type} [DecidableEq ν] {N M N' M' : Net S ν} (h : Wire N M) (e : N = N') (e' : M = M') :
                        Wire N' M'

                        A wire substitution carried along equalities of nets.

                        theorem INet.Wire.below {S : Signature} {k : ℕ} {N M : Net S ℕ} (h : Wire N M) (hN : Net.Below k N) :

                        A wire substitution keeps a bound on the names.

                        theorem INet.Equiv.refl {S : Signature} {ν : Type} [DecidableEq ν] (N : Net S ν) :
                        Equiv N N

                        A net is equivalent to itself.

                        theorem INet.Equiv.of_eq {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : N = M) :
                        Equiv N M

                        Equal nets are equivalent.

                        theorem INet.Equiv.symm {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Equiv N M) :
                        Equiv M N

                        Equivalence is symmetric.

                        theorem INet.Equiv.trans {S : Signature} {ν : Type} [DecidableEq ν] {N M K : Net S ν} (h : Equiv N M) (h' : Equiv M K) :
                        Equiv N K

                        Equivalence is transitive.

                        theorem INet.Equiv.linear_iff {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Equiv N M) :

                        Equivalent nets are linear together.

                        theorem INet.Equiv.linear {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Equiv N M) (hN : N.Linear) :

                        A net equivalent to a linear net is linear.

                        theorem INet.Equiv.free_iff {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Equiv N M) (y : ν) :

                        Equivalent nets have the same free ports.

                        theorem INet.Equiv.cells_eq {S : Signature} {ν : Type} [DecidableEq ν] {N M : Net S ν} (h : Equiv N M) :

                        Equivalent nets have the same cells: the equivalence performs no interaction.