reperiendi

Syntactic string diagrams

Posted in Uncategorized by reperiendi on 2009 January 24

I hit on the idea of making lambda a node in a string diagram, where its inputs are an antivariable and a term in which the variable is free, and its output is the same term, but in which the variable is bound.  This allows a string diagram notation for lambda calculus that is much closer to the syntactical description than the stuff in our Rosetta Stone paper. Doing it this way makes it easy to also do pi calculus and blue calculus.

There are two types, V (for variable) and T (for term). I’ve done untyped lambda calculus, but it’s straightforward to add subscripts to the types V and T to do typed lambda calculus.

There are six function symbols:

  • \lambda:V^* \times T \to T. Lambda takes an antivariable and a term that may use the corresponding variable.
  • \cap:1 \to V^* \times T. This turns an antivariable “x” introduced by lambda into the term “x”.
  • A:T \times T \to T. (Application) This takes f and x and produces f(x).
  • {\rm swap}:T \times T \to T \times T
  • !:T \to 1
  • \Delta:T \to T \times T. These two mean we can duplicate and delete terms.

The \beta-\eta rule is the real meat of the computation. The “P” is an arbitrary subdiagram. The effect is replacing the “A” application node with the “P” subdiagram, modulo some wiring.

I label the upwards arrows out of lambdas with a variable name in parentheses; this is just to assist in matching up the syntactical representation with the string diagram.

In the example, I surround part of the diagram with a dashed line; this is the part to which the \beta-\eta rule applies. Within that, I surround part with a dash-dot line; this is the subdiagram P in the rule.

When I do blue calculus this way, there are a few more function symbols and the relations aren’t confluent, but the flavor is very much the same.

String diagrams for untyped lambda calculus

String diagrams for untyped lambda calculus


An example calculation

An example calculation

Imaginary time

Posted in General physics by reperiendi on 2009 January 9
Statics (geometric = no time):
s [xlength] x coordinate
m [X] proportionality constant
q(s) [ylength] y coordinate
v(s) = \frac{dq(s)}{ds} [ylength / xlength] slope
T(s) = \int mv(s) dv(s) = mv(s)^2/2 [X ylength^2 / xlength^2] proportional to curvature
V(s) [X ylength^2 / xlength^2] original shape
S = \int (T + V)(s) ds
= \int \left[ \frac{m}{2} \left(\frac{dq(s)}{ds}\right)^2 + V(s) \right] ds
[X ylength^2 / xlength] distortion
Statics (with energy):
s [xlength] x coordinate
F [mass xlength / time^2] force due to stretching spring by dx
q(s) [ylength] y coordinate
v(s) = \frac{dq(s)}{ds} [ylength / xlength] slope at s
T(s) = \int Fv(s) dv(s) = Fv(s)^2/2 [mass ylength^2 / time^2 xlength] stretching energy density
V(s) [mass ylength^2 / time^2 xlength] gravitational energy density
S = \int (T + V)(s) ds
= \int \left[ \frac{F}{2} \left(\frac{dq(s)}{ds}\right)^2 + V(s) \right] ds
[mass ylength^2 / time^2] energy (dS = 0 at equilibrium)
Dynamics (\underline{s \mapsto t, ds \mapsto i\, dt}):
t [time] time
m [mass] mass
q(t) [ylength] y coordinate
v(t) = \frac{dq(t)}{i dt} [ylength / i time] i * velocity
T(t) = mv(t)^2/2 [mass ylength^2 / time^2] kinetic energy
V(t) [mass ylength^2 / time^2] potential energy
S = \int (T + V)(t) (i dt)
= \int \left[ \frac{m}{2} \left(\frac{dq(t)}{i dt}\right)^2 + V(t) \right] (i dt)
= -i \int \left[ \frac{m}{2} \left(\frac{dq(t)}{dt}\right)^2 - V(t) \right] dt
[mass ylength^2 / i time] i * action

See also Toby Bartels‘ sci.physics post.