71 points dmit 2 days ago 8 comments

mjfisher 2 hours ago | parent

This looks really interesting but I'm falling down on the first piece of maths (and the linked pdf that attempts to clarify in the article).

Until this point, a derivative for me has been a derivative of an continuous function.

Is this arbitrarily defining the derivative of a particular set? (e.g. "The derivative of a set of strings S with respect to a symbol a is the set of strings gener- ated by stripping the leading a from the strings in S that start with a")

Is that analogous to regular differential calculus, or a completely different species of derivatives and it just shares the same name?

convolvatron 2 hours ago | parent

you missed the reference to the Brzozowski derivative, which has a wiki page

yorwba 2 hours ago | parent

It is analogous to regular calculus in some ways but not others. For example, the derivative of xyz with respect to x is yz in either case. The derivative of yz with respect to x is 0 or the empty set, respectively. But the analogy stops working when you have the symbol appear somewhere other than the beginning, because multiplication of numbers is order-independent and string concatenation is not.

dapperdrake 1 hour ago | parent

Matrix derivatives

abe27342 1 hour ago | parent

There are some other good answers pointing to concrete leads. There is the formal notion of a derivation (see https://en.wikipedia.org/wiki/Derivation_(differential_algeb... ) which generalizes the derivatives in differential calculus you are familiar with to other more exotic objects. For example, this allows defining derivatives on combinatorial species.

The Brzozowski derivative is not strictly one of these, due to its odd product rule expression for concatenation. https://math.stackexchange.com/questions/5024248/are-brzozow... has some good explanations if you have any algebra background.

edit: The comments on the math stack exchange link seem to point out that while the Brzozowski derivative is not a derivation over some algebra, it is over a certain (f,g)-bimodule, so works in some even more general sense. Interesting!

dapperdrake 1 hour ago | parent

Or Radon-Nikodym for measurable functions.

ufo 41 minutes ago | parent

The name _derivative_ is sometimes used to describe operators that resemble calculus derivatives: here, the operator is linear and there are analogues of the chain and product rule. You might also see the name _formal derivative_ when they want to emphasize that the similarity is mainly algebraic and about physical rates of change.

ky3 40 minutes ago | parent

You could search for "brzozowski left inverse" as those links might contain better explanations for you.

The gist of the adjunction < R, aS > = < a\R, S >, where R is a regex and S is a string, is that: R matches aS (that is, the string S but prepended with 'a') iff the left inverse of R wrt 'a', matches S.

The left inverse here is the unconcatenation of R on the left with 'a'.

(Recall that the algebra of regexes builds them up from unions, concatenations, and kleene stars on the constants of the empty set, the null string, and the alphabets of your language. The novelty is that you can invert concatenation—on both ends!)