15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

which we can always do, since we have an axiom for this formula, then we apply the rule subst,<br />

where A is this result, B is C, and X is the variable P to obtain<br />

(C ⇒ Q ⇒ R) ⇒ (C ⇒ Q) ⇒ C ⇒ R (2.2)<br />

Next we apply the rule subst to this where B is C ⇒ C and X is the variable Q this time to<br />

obtain<br />

(C ⇒ (C ⇒ C) ⇒ R) ⇒ (C ⇒ C ⇒ C) ⇒ C ⇒ R (2.3)<br />

And again, we apply the rule subst this time, B is C and X is the variable R yielding the first<br />

formula in our proof on the slide. To conserve space, we have combined these three steps into one<br />

in the slide. The next steps are done in exactly the same way.<br />

2.6.2 A digression on Names and Logics<br />

The name MP comes from the Latin name “modus ponens” (the “mode of putting” [new facts]),<br />

this is one of the classical syllogisms discovered by the ancient Greeks. The name Subst is just<br />

short for substitution, since the rule allows to instantiate variables in formulae with arbitrary<br />

other formulae.<br />

Digression: To understand the reason for the names of K and S we have to understand much<br />

more logic. Here is what happens in a nutshell: There is a very tight connection between types<br />

of functional languages and propositional logic (google Curry/Howard Isomorphism). The K and<br />

S axioms are the types of the K and S combinators, which are functions that can make all other<br />

functions. In SML, we have already seen the K in Example 97<br />

val K = fn x => (fn y => x) : ‘a -> ‘b -> ‘a<br />

Note that the type ‘a -> ‘b -> ‘a looks like (is isomorphic under the Curry/Howard isomorphism)<br />

to our axiom P ⇒ Q ⇒ P . Note furthermore that K a function that takes an argument n<br />

and returns a constant function (the function that returns n on all arguments). Now the German<br />

name for “constant function” is “Konstante Function”, so you have letter K in the name. For the<br />

S aiom (which I do not know the naming of) you have<br />

val S = fn x => (fn y => (fn z => x z (y z))) : (‘a -> ‘b -> ‘c) - (‘a -> ‘c) -> ‘a -> ‘c<br />

Now, you can convince yourself that SKKx = x = Ix (i.e. the function S applied to two copies<br />

of K is the identity combinator I). Note that<br />

val I = x => x : ‘a -> ‘a<br />

where the type of the identity looks like the theorem C ⇒ C we proved. Moreover, under the<br />

Curry/Howard Isomorphism, proofs correspond to functions (axioms to combinators), and SKK<br />

is the function that corresponds to the proof we looked at in class.<br />

We will now generalize what we have seen in the example so that we can talk about calculi and<br />

proofs in other situations and see what was specific to the example.<br />

2.6.3 Logical Systems and Calculi<br />

Calculi: general<br />

A calculus is a systems of inference rules: A1 · · ·<br />

CR and Ax<br />

A<br />

A1: assumptions, C: conclusion (axioms have no assumptions)<br />

A Proof of A from hypotheses in H (H ⊢ A) is a tree, such that its<br />

nodes contain inference rules<br />

leaves contain formulae from H<br />

root contains A<br />

94<br />

An

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!