Hacker News new | past | comments | ask | show | jobs | submit login

They’re both inverses: one with respect to multiplication, the other with respect to function composition.

In abstract algebra, we observe that there are many types of “products”: multiplication, addition, function composition, composition of rotations, matrix multiplication, etc. A common, unified “power” notation for repeatedly taking the product of a single element, or of its inverse, has some value.

There is some ambiguity, since multiplication of functions can also often make sense. This is usually resolved by context, or by being explicit where the context isn’t clear.




> one with respect to multiplication, the other with respect to function composition

And, of course, multiplication is a function so one is just a specific instance of the other.

Infix notation is another blight on the mathematical notation landscape. The amount of human effort that has been put into figuring out how to parse a+b*c is staggering. All of this confusion could have been avoided if we'd just started with s-expressions in the first place.


Multiplication is a function of numbers, and function composition is a function of functions, so neither is an instance of the other (unless you take the unusual perspective of thinking of numbers themselves as functions, but I don’t think that’s what you meant).


> I don’t think that’s what you meant

Why not?

Multiplication is a composition of addition, and addition is a composition of the successor function. The successor function is not a composition of anything, but you can define it in terms of set theory if you don't want to simply accept it as a primitive. But sets are functions too.


In both of these instances, I think that you are using composition to mean iteration. Iterating is repeated self-composition, so it is composition, but it seems likely that you meant the more specific term. (For example, "the successor function is not a composition of anything" is definitely false in the literal sense of composition. It's also false in the literal sense of iteration, but there it's clear what you meant: there's no natural operation which we iterate some number of times greater than 1 to get the successor function.)


> you meant the more specific term

No, I meant what I said. The fact that iteration is a kind of composition is true, but it's a tangent from the point I was trying to make, which is that infix notation is a Really Bad Idea. No one in their right mind would use it if they were not indoctrinated into it.

> "the successor function is not a composition of anything" is definitely false

That's news to me. I genuinely thought that successor could legitimately be considered a primitive. What is successor a composition of?


> Multiplication is a composition of addition, and addition is a composition of the successor function. The successor function is not a composition of anything, but you can define it in terms of set theory if you don't want to simply accept it as a primitive. But sets are functions too.

> the point I was trying to make, which is that infix notation is a Really Bad Idea

Not to be snarky, but, reading these two (from your two thread-successive posts https://news.ycombinator.com/item?id=23312725 and https://news.ycombinator.com/item?id=23314776) in succession, I still can't see anything about the first one that indicates the point that infix notation is a bad idea. Not that I'm disagreeing with the point, just that I can't find it in the first post. Could you clarify the connection?

> What is successor a composition of?

It's a composition of, for example, itself and the identity function, like everything else; or you could view it as a composition (-1) . (+2). Those kind of silly solutions are why I thought you meant 'iteration'.

Iterative solutions are easy if you don't restrict yourself to natural numbers—for example, (+1) is (+(1/2)) composed with itself—but that's clearly not what you meant. (As soon as you leave the natural numbers, even the idea that addition is iterated successor becomes false.)

If you do so restrict yourself, then it becomes true that the successor is not a non-trivial iterate. (I just skated the edge of claiming the opposite in my post, but avoided error by not specifying what domain I meant. That's just luck, though; I meant a particular thing, and I was wrong. To prove it, supposing you start your natural numbers at 0 and that f is a function such that f^{\circ k} is the successor function for some k > 1, then note that f is injective (because a composition power is). If f(0) = 0, then succ(0) = f(f(0)) = f(0) = 0, which is a contradiction. Put n = f(0) and note that f^{\circ n k}(0) = succ^n(0) = n, but n k > 1.)

By the way, you quoted (https://news.ycombinator.com/item?id=23314776):

> > you meant the more specific term

Just to be clear, what I said (https://news.ycombinator.com/item?id=23314530) was "I think you meant the more specific term". And I was wrong, but I intentionally didn't just assume I knew you what you meant!


> I still can't see anything about the first one that indicates the point that infix notation is a bad idea.

I didn't make a very good argument for it. I really intended that to be more of a throwaway rant than a serious critique. But since you ask...

There are two problems with infix:

1. It's hard to parse. It requires precedence rules which are not apparent in the notation. In actual practice, the precedence rules vary from context to context and this causes real problems. It's an unnecessary cognitive burden that pays very little in the way of dividends (a few less pen strokes or key strokes).

2. It obscures the fact that infix operators are just syntactic sugar for function applications. It leads people to think that there is something fundamentally different about a+b that distinguishes it from sum(a,b) and this in turn leads to a ton of confusion.

> that's clearly not what you meant

Indeed not. I meant the successor operator as defined in the Peano axioms.

> you quoted

Yeah, sorry about that. When I first replied, I thought you were the same person who posted the grandparent comment. My first draft response turned out to be completely inappropriate when I realized you were a different person, but some of my initial mindset apparently leaked into the revised comment. My apologies.


I didn’t think you meant that numbers are functions because you said: “multiplication is a function so one [multiplication] is just a specific instance of the other [function composition]”.

Thus I thought your point was that, since multiplication is a function, it’s a form of function composition. But that wouldn’t follow, for the reasons I said.

As for multiplication being “composed” addition, addition being “composed” succession, etc.: The multiplication function (at least of integer arguments) is composed of addition. Function composition is a function that returns a composition of two other functions. The way you’re using the term blurs the distinction between the thing that is composed and the thing that does the composing.

Function composition is a specific operation that takes two functions, f and g, and returns the function f∘g defined by the behavior (f∘g)(x) = f(g(x)). The function which does function composition is not itself a composed function, and the act of multiplication is the act of a composed function, but not an act of function composition.


> The way you’re using the term blurs the distinction between the thing that is composed and the thing that does the composing.

Yes, that is intentional. Both of these things are functions. Even numbers are functions, they just happen to be functions of zero arguments, or functions that ignore their arguments, or functions whose value is constant regardless of what the argument(s) is(are). It's all the same thing. That is the whole point.

Numbers and addition and multiplication happen to be particularly important functions, but they are not structurally different from any other functions. Giving them special notation, especially when you are first introduced to them, obscures this fact. This kind of mental damage is very hard to recover from in later life. I believe it's one of the reasons so many people think they hate math. Math can be beautiful and elegant, but the standard notation used for school-book arithmetic is arbitrary and perverse, a bizarre accident of history with no actual merit.

IMHO of course.

[UPDATE:]

> Function composition is a specific operation that takes two functions, f and g, and returns the function f∘g defined by the behavior (f∘g)(x) = f(g(x)).

Function composition is a function, no different from any other function. There is no more reason to use infix notation for it than there is for any other function. In fact, if you drop the infix notation it immediately becomes obvious how ubiquitous and non-special function composition actually is:

  compose(f,g)(x) = compose(f)(g)(x) = f(g(x))
On that view, the COMPOSE function is actually the identity function!


You seem to be jumping around in terms of what position you're taking. Is times(a, b) function composition because a and b are functions, or is times(a, b) function composition because it's composition of the addition function, or is times(a, b) function composition because multiplication is a function? Those are very different assertions, with very different implications to the original discussion, and so far as I can tell you’ve made all three of them. Maybe they're all true, maybe one or two of them is true, maybe it's a matter of perspective which are true. But I don't think you're being clear or consistent in which assertion your position is based on.

And no matter what, there's still a difference between composing a with b, and composing b with itself a times, which is what I mean by the distinction between composition and iteration (sort of like the distinction between a brick and a brick wall).

At this point I feel we're going around in circles, so I'll bow out.


> Those are very different assertions

But they are not mutually exclusive. That's the whole point.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: