Hi all,
> > can't you infer the type instance of $sum in TH0 because you have to specify
the type of sum_list/zipWith first, or am I overlooking something? Regardless, I
remember quite well I struggled with this ad-hoc polymorphism in Leo-III, so I'm
all for it.
> > In TH1, you could also write "$sum @ $int" if $sum gets a proper polymorphic
type signature.
That's what we have for equality, as Stephan asked ...
> I'm all for it, but don't we have the same problem with equality?
There is the @= in TH1 ...
? [B: bird] : ( (@= @ bird) @ tweety @ B )
... but that was not extended to the arithmetic functions/predicates.
> >> Currently it is technically permitted to partially apply arithmetic
> >> operators and pass them around as first-class objects, like this:
> >>
> >> thf(define_sum_of_list, definition, sum_list = zipWith @ $sum).
> >>
> >> This is tricky. One cannot tell locally what the type of the term $sum
> >> is, as it is ad-hoc polymorphic for each of $int/$rat/$real. We propose
> >> changing the grammar
I would prefer to no change the grammar, but instead make it a semantic
constraint. Changing the grammar can have far-reaching impacts. Also, it
allows weirdos to ignore the constraint in their own use of the TPTP
grammar.
> >> of TPTP to ensure that arithmetic functions must be
> >> treated as a special form and fully applied. This does not lead to any
> >> loss in expressive power as a partially applied function can still be
> >> written expanded:
> >>
> >> thf(define_sum_of_list, definition, sum_list = zipWith @ (^[X : $int, Y
> >> : $int]: $sum(X, Y))).
> >>
> >> ...but it is admittedly a little noisier. What do you think?
A middle ground would be to allow partial application, but not no-application,
e.g., allow ($sum @ 2) but not plain $sum. The partial application tells you
the type. But that's getting messy.
Cheers,
Geoff