src/FOLP/ex/prop.ML
author nipkow
Wed, 07 Feb 1996 12:22:32 +0100
changeset 1481 03f096efa26d
parent 1464 a608f83e3421
child 5061 f947332d5465
permissions -rw-r--r--
Modified datatype com. Added (part of) relative completeness proof for Hoare logic.

(*  Title:      FOLP/ex/prop.ML
    ID:         $Id$
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
    Copyright   1991  University of Cambridge

First-Order Logic: propositional examples (intuitionistic and classical)
Needs declarations of the theory "thy" and the tactic "tac"
*)

writeln"File FOLP/ex/prop.ML";


writeln"commutative laws of & and | ";
goal thy "?p : P & Q  -->  Q & P";
by tac;
result();

goal thy "?p : P | Q  -->  Q | P";
by tac;
result();


writeln"associative laws of & and | ";
goal thy "?p : (P & Q) & R  -->  P & (Q & R)";
by tac;
result();

goal thy "?p : (P | Q) | R  -->  P | (Q | R)";
by tac;
result();



writeln"distributive laws of & and | ";
goal thy "?p : (P & Q) | R  --> (P | R) & (Q | R)";
by tac;
result();

goal thy "?p : (P | R) & (Q | R)  --> (P & Q) | R";
by tac;
result();

goal thy "?p : (P | Q) & R  --> (P & R) | (Q & R)";
by tac;
result();


goal thy "?p : (P & R) | (Q & R)  --> (P | Q) & R";
by tac;
result();


writeln"Laws involving implication";

goal thy "?p : (P-->R) & (Q-->R) <-> (P|Q --> R)";
by tac;
result();


goal thy "?p : (P & Q --> R) <-> (P--> (Q-->R))";
by tac;
result();


goal thy "?p : ((P-->R)-->R) --> ((Q-->R)-->R) --> (P&Q-->R) --> R";
by tac;
result();

goal thy "?p : ~(P-->R) --> ~(Q-->R) --> ~(P&Q-->R)";
by tac;
result();

goal thy "?p : (P --> Q & R) <-> (P-->Q)  &  (P-->R)";
by tac;
result();


writeln"Propositions-as-types";

(*The combinator K*)
goal thy "?p : P --> (Q --> P)";
by tac;
result();

(*The combinator S*)
goal thy "?p : (P-->Q-->R)  --> (P-->Q) --> (P-->R)";
by tac;
result();


(*Converse is classical*)
goal thy "?p : (P-->Q) | (P-->R)  -->  (P --> Q | R)";
by tac;
result();

goal thy "?p : (P-->Q)  -->  (~Q --> ~P)";
by tac;
result();


writeln"Schwichtenberg's examples (via T. Nipkow)";

(* stab-imp *)
goal thy "?p : (((Q-->R)-->R)-->Q) --> (((P-->Q)-->R)-->R)-->P-->Q";
by tac;
result();

(* stab-to-peirce *)
goal thy "?p : (((P --> R) --> R) --> P) --> (((Q --> R) --> R) --> Q) \
\             --> ((P --> Q) --> P) --> P";
by tac;
result();

(* peirce-imp1 *)
goal thy "?p : (((Q --> R) --> Q) --> Q) \
\              --> (((P --> Q) --> R) --> P --> Q) --> P --> Q";
by tac;
result();
  
(* peirce-imp2 *)
goal thy "?p : (((P --> R) --> P) --> P) --> ((P --> Q --> R) --> P) --> P";
by tac;
result();

(* mints  *)
goal thy "?p : ((((P --> Q) --> P) --> P) --> Q) --> Q";
by tac;
result();

(* mints-solovev *)
goal thy "?p : (P --> (Q --> R) --> Q) --> ((P --> Q) --> R) --> R";
by tac;
result();

(* tatsuta *)
goal thy "?p : (((P7 --> P1) --> P10) --> P4 --> P5) \
\         --> (((P8 --> P2) --> P9) --> P3 --> P10) \
\         --> (P1 --> P8) --> P6 --> P7 \
\         --> (((P3 --> P2) --> P9) --> P4) \
\         --> (P1 --> P3) --> (((P6 --> P1) --> P2) --> P9) --> P5";
by tac;
result();

(* tatsuta1 *)
goal thy "?p : (((P8 --> P2) --> P9) --> P3 --> P10) \
\    --> (((P3 --> P2) --> P9) --> P4) \
\    --> (((P6 --> P1) --> P2) --> P9) \
\    --> (((P7 --> P1) --> P10) --> P4 --> P5) \
\    --> (P1 --> P3) --> (P1 --> P8) --> P6 --> P7 --> P5";
by tac;
result();

writeln"Reached end of file.";