Converting typeset mathematics into Haskell ?

Does anyone know of any papers or projects, either for Haskell or any other language, that relate to what I am going to attempt to describe in the following: Go to any paper or book that includes some amount of calculation type mathematics. An example is the formula in the Description section of http://en.wikipedia.org/wiki/K-means_clustering. Think about how you would convert this into Haskell. You might then find yourself wondering why you have to convert it into Haskell at all. Given that most mathematics online is typeset using something like latex or mathml, why can't we parse this typesetting and convert it into Haskell code? In all likelyhood the conversion might be ambiguous so some rules might be needed to guide the conversion. Furthermore, if there are editors that allow you to edit these sorts of equations in a wysiwyg style, why not leverage these to edit the Haskell+Math code also in a wysiwyg style. I think this goes to the larger question of why are most programming languages (or to be more exact the way we write programs in those languages) is still based around a linear sequence of tokens rather than something that is more 2D (there is still some linearity as even in math formula there is still a top down and left to right flow). Mark

The purpose of mathematic syntax is to comunicate mathematical ideas between humans. Programmirng languages both communicate mathmatical ideas among humans and specify sequences of operations performed by computing machinery to achieve a goal. The trouble is is the first goal is often forgotten. The Haskell community tends to be less likely to forget the first goal. The fact is the dual purpose of programming languages causes conflicts. Let's focus on currying. I'm sure that most in this community think that currying is wonderful, but many pure mathematicians look at us quizically. What's all the excitent about? How does this help me communicate with other homosapians? Comunication appears to be a driving force of the Fortress languge http://projectfortress.sun.com. Personally, I think that Data Parallel Haskell (DPH) plus Haskell's commitment to currying is a viable approach to high performance computing. John

On Aug 22, 2009, at 11:49 AM, Mark Wassell wrote:
Think about how you would convert this into Haskell. You might then find yourself wondering why you have to convert it into Haskell at all.
But very quickly you realise that it is because a lot of mathematical notation is heavily ambiguous and requires fairly sophisticated N.I. to parse correctly. [N.I. = natural intelligence. I don't know how to program a computer to do it.] -1 For example, if x is a number, x is its reciprocal. But if x is a function, it's the inverse function. Some of the most appalling mathematical notation can be found in the Correspondence Analysis community, where the meaning of a subscript may depend not on the value of the subscript expression but its spelling. In that case, converting the mathematics to Haskell would be an act of great charity not for programmers but for _any_ mortals trying to make sense of the formulas.

Richard O'Keefe schrieb:
On Aug 22, 2009, at 11:49 AM, Mark Wassell wrote:
Think about how you would convert this into Haskell. You might then find yourself wondering why you have to convert it into Haskell at all.
But very quickly you realise that it is because a lot of mathematical notation is heavily ambiguous and requires fairly sophisticated N.I. to parse correctly.
Thus I had the idea to do it the other round: Typeset formulas as executable Haskell programs that can be converted and pretty printed by LaTeX. lhs2TeX allows a bit of this procedure.
participants (4)
-
Henning Thielemann
-
John D. Ramsdell
-
Mark Wassell
-
Richard O'Keefe