caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Andrej.Bauer@andrej.com
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Equality of functional values
Date: Wed, 31 Jan 2007 11:15:55 +1100	[thread overview]
Message-ID: <1170202555.6391.161.camel@rosella.wigram> (raw)
In-Reply-To: <45BFCF7D.5010302@fmf.uni-lj.si>

On Wed, 2007-01-31 at 00:06 +0100, Andrej Bauer wrote:
> skaller wrote:
> > Actually the idea 'equality of functions is not computable'
> > is misleading .. IMHO. Equality of programmer written
> > 'functions' should always be computable: more precisely one hopes
> > every function could have a mechanically verifiable proof
> > of correctness and wished programming languages provided an 
> > easy way to prove one.
> 
> There are two major reasons why equality of functions might not be 
> computable in a specific situation:
> 
> 1) Sufficiently general functions are allowed so that various 
> diagonalization theorems kick in and we get a proof that equality is not 
> decidable.

You're right. Canonical example for me: my own Felix compiler :)
[Encodes functions as data .. Felix language is Turing complete .. :]

> 2) The functions are "simple", but they are represented in such a way 
> that they cannot be tested for equality.
> 
> The first reason is more "theoretical" (but still underappreciated by 
> "real" programmers),

:) I love this list because there are theoreticians who are
ready to educate us 'real' programmers. 

> To summarize what I wrote above: it may be a matter of how functions are 
> represented, not _which_ functions we are trying to compare.

You're right: that was a very nice explanation!

> > BTW: Felix is one of the few general languages around that
> > actually allows a statement of semantics:
> > 
> > typeclass SemiGroup[t with Eq[t]] {
> >   virtual fun add: t * t -> t;
> >   axiom assoc(x:t, y:t, z:t): add(x, add(y,z)) == add(add(x,y),z);
> > }
> > 
> > These axioms are checkable:
> > 
> > instance SemiGroup[int] {
> >   fun add:int * int -> int = "$1+$2";
> > }
> > 
> > axiom_check(1,2,3);
> 
> You are confusing checking of particular instances and checking the 
> general statement in which x, y and z, are universally quantified.

The 'axiom_check' facility clearly only checks particular
instances and would only provide a proof if you could
exhaustively elaborate all such instances.

> Checking of particular instances may still be valuable to a programmer, 
> though, as it is a form of run-time correctness checking.

Yes. My experience is that it catches quite a lot of errors.
Proof would be better .. but I don't know how to do that.

> > however there's currently no way to state and prove
> > theorems. It would be interesting if someone had some
> > idea how to use one of the existing theorem provers
> > to act as a proof assistant (verify user given proof,
> > filling in enough 'gaps' in the formal steps to make
> > it practical).
> 
> I would go further: it would be interesting to augment real programming 
> languages with ways of writing specifications that can then be tackled 
> by theorem provers and proof asistants. 

I don't think you're going further .. I'm actually asking that
question! I have looked at Coq, HOPL (light) etc, in the hope
there is some way of using them to complete programmer proof
sketches, but all still seem to need very heavy assistance
beyond the understanding of a non-expert.

> In the long run this might 
> educate programmers about the value of correct programs. Naturally, as 
> long as only Mars space probes and the occasional airplane crash because 
> of software errors, there won't be sufficient economic incentive to 
> wrote correct software.

I believe that this isn't so: there is plenty of incentive
to write correct software. Industry does monitor maintenance
cost of software compared to cost of creating it. We don't need
a plane crash to demonstrate the need for correctness,
in fact that wouldn't help much because the costs aren't
so easy to measure. Wages of people working on maintenance
are measured regularly by all large organisations.

Yet people still use PHP, Python, Java .. why?
Industry may be stupid but it isn't *entirely* stupid :)


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


      parent reply	other threads:[~2007-01-31  0:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 21:04 Simon Frost
2007-01-29 21:11 ` [Caml-list] " Tom
2007-01-29 21:23   ` Brian Hurt
2007-01-29 21:59 ` Gerd Stolpmann
2007-01-30  8:17   ` Christophe Raffalli
2007-01-30  8:45   ` David MENTRE
2007-01-30 13:24 ` Andrej Bauer
2007-01-30 13:55   ` skaller
2007-01-30 14:21     ` Brian Hurt
2007-01-30 15:21     ` Jeff Polakow
2007-01-30 15:49       ` Jacques Carette
2007-01-30 17:23         ` Chris King
2007-01-30 20:18           ` Tom
2007-01-30 20:30             ` Gerd Stolpmann
2007-01-30 20:41               ` Fernando Alegre
2007-01-30 21:01                 ` Christophe TROESTLER
2007-01-30 21:08                   ` Tom
2007-01-30 21:46                     ` Christophe TROESTLER
2007-01-30 22:05                       ` Fernando Alegre
2007-01-30 23:13                         ` skaller
2007-01-30 23:06     ` Andrej Bauer
2007-01-31  0:15       ` Jacques Carette
2007-01-31  7:03         ` Stefan Monnier
2007-01-31 12:54           ` [Caml-list] " Jacques Carette
2007-01-31  0:15       ` skaller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1170202555.6391.161.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=Andrej.Bauer@andrej.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).