By S. Sokolowski

Show description

Read or Download Applicative High Order Programming: Standard ML in Practice PDF

Best languages & tools books

Threaded Interpretive Languages: Their Design and Implementation

Introduces participants possessing microcomputers or minicomputers with minimum peripherals to the layout and implementation of a threaded interpreter as an method of constructing a regular, nonstandard programming language.

Extra info for Applicative High Order Programming: Standard ML in Practice

Example text

You might think that all proofs of disjunctions (“or” statements) and existential statements are like that, and hence that all reasoning must be constructive. Here is a well-known clever proof, first brought to the attention of logicians by Roger Hindley [9], that shows this is not the case. 1. There exist irrational numbers a and b such that ab is rational. Proof. We have to remember that a rational number is one which can be described p as a fraction q , where p and q are integers, with q ✘ 0; and an irrational number is one that lacks such a description.

Note that the spaces around the equality symbol are required; you will get an error if you write if_then_else_{A=B}. 1 has a proof of a very similar example about disjunction (“or”). We have an implicit boolean argument b, which we pattern match on by writing the patterns in curly braces, on the left-hand sides of the defining equations. In each case, the equality type refines to something which Agda can see is trivial. 1: A proof about disjunction (“or”) first equation, where b is instantiated to tt, the equality we are trying to prove is refined by Agda to tt || tt ✑ tt This is definitionally equal to tt ✑ tt and so we can trivially prove it with refl.

But still, you may be curious: can we prove our ˜˜-elim theorem another way? Could we use our ˜˜tt and ˜˜ff theorems to prove the two cases? We 34 Theorem Proving with the Booleans certainly can do that. agda): ˜˜-elim2 : ❅ (b : B) ˜˜-elim2 tt = ˜˜tt ˜˜-elim2 ff = ˜˜ff Ñ ˜ ˜ b ✑ b This makes sense, since ˜˜tt and ˜˜ff have exactly the types we need for their respective cases. Is this really a different proof? Not really, because ˜˜tt and ˜˜ff are both defined to equal refl, so this proof is equal to the first proof we wrote.

Download PDF sample

Rated 4.91 of 5 – based on 28 votes