> how is a user to find out whether square really accepts a matrix?
How do you find out that a function exists, what it accepts, and what it does normally?
> From comments? They are again limited by the authors imagination.
Sure, but an author which much experience with duck typing will typically write documentation that specified that expected methods (informal structural “types”) rather than nominal types.
With the static equivalent (protocols), it’s conceivable that this is also discoverable via tooling.
Using maths to either oppose or support generic duck typing is just pointless, because it's easy to come up with counterexamples where a mathematical operation would or would not behave as expected.
In quite a few cases where one would overload a mathematical operation to, say, sum two objects of certain type, it'd be better to explicitly type out the operation as a functor/lambda.
From comments? They are again limited by the authors imagination. From reading the source?