Documentation

RoleFlow.Discrete

A discrete instance (TODO.md, discrete sorts) #

The generic development needs a σ-finite reference measure per sort and nothing else, so discrete sorts under counting measure fit as they are: there a density is a probability mass function. This module is a minimal instance with two sorts, int (ℤ) and bool, both under counting measure:

operationinv = falseinv = truelog-weight
addx + qx - q0
xorx ^^ q(itself)0

and the conditioners mul and parity, which have no semi-inverse. Every leaf is a bijection of a countable type, which preserves counting measure (measurePreserving_count). The examples at the end are integer and binary additive couplings (as in integer discrete flows); their densities are pmfs by Prog.density.

Sorts #

The sorts: integers and booleans, each under counting measure.

Instances For
    @[implicit_reducible]
    Equations
    @[reducible, inline]

    The space of a sort.

    Equations
    Instances For
      @[implicit_reducible]
      noncomputable instance RoleFlow.Discrete.instSortsDS :
      Equations
      • One or more equations did not get rendered due to their size.

      A bijection of a countable type preserves counting measure.

      Operations #

      Instances For
        @[reducible, inline]
        abbrev RoleFlow.Discrete.si1 {a b c : DS} (o : DOp [c, b] [a]) :

        A semi-inverse solving the first argument from the result and the second argument.

        Equations
        Instances For

          The model #

          @[reducible, inline]
          noncomputable abbrev RoleFlow.Discrete.one {a : DS} (x : X a) :
          Equations
          Instances For

            The integer operations, at the type of the sort.

            Equations
            Instances For
              Equations
              Instances For
                noncomputable def RoleFlow.Discrete.semOp {as bs : List DS} :
                DOp as bs → Val as → Val bs
                Equations
                Instances For
                  theorem RoleFlow.Discrete.measurable_val {Γ : List DS} {Y : Type u_1} [MeasurableSpace Y] (f : Val Γ → Y) :

                  On a discrete sort, a measurable map is any map.

                  theorem RoleFlow.Discrete.eq_one {a : DS} (v : Val [a]) :
                  one v.head = v
                  theorem RoleFlow.Discrete.left1 {a b c : DS} {o : DOp [a, b] [c]} {o' : DOp [c, b] [a]} (F : X a → X b → X c) (G : X c → X b → X a) (hF : ∀ (v : Val [a, b]), semOp o v = one (F v.head v.tail.head)) (hG : ∀ (v : Val [c, b]), semOp o' v = one (G v.head v.tail.head)) (h : ∀ (x : X a) (q : X b), G (F x q) q = x) (c✝ : Val (si1 o').cs) (p : Val (si1 o').ps) :
                  semOp (si1 o').op ((semOp o ((si1 o').glue c✝ p)).append p) = c✝

                  The left law of an operation that consumes its first argument.

                  theorem RoleFlow.Discrete.leaf1 {a b : DS} {o : DOp [a, b] [a]} (F : X a → X b → X a) (hF : ∀ (v : Val [a, b]), semOp o v = one (F v.head v.tail.head)) (e : X b → X a ≃ X a) (he : ∀ (q : X b) (x : X a), (e q) x = F x q) (p : Val [b]) :
                  Cov (vol [a]) (vol [a]) (fun (c : Val [a]) => semOp o (Val.cast ⋯ (c.append p))) fun (x : Val [a]) => expw 0

                  A leaf of weight 1 from a bijection of the consumed argument at each parameter.

                  @[reducible, inline]
                  abbrev RoleFlow.Discrete.LeftLaw {as bs : List DS} (o : DOp as bs) (si : SemiInv DOp as bs) :

                  The left law of o with the semi-inverse si.

                  Equations
                  Instances For

                    · ^^ q as a bijection.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        Examples #

                        def RoleFlow.Discrete.ln {as bs : List DS} (o : DOp as bs) (args : List ℕ) :
                        Equations
                        Instances For

                          Integer additive coupling: θ : int (0), x₁ x₂ : int (1, 2); t = mul(θ, x₁) (3), y = add(x₂, t) (4); returns (x₁, y).

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Binary coupling across sorts: x : int (0), b : bool (1); p = parity(x) (2), c = xor(b, p) (3); returns (x, c).

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For