src/FOLP/ex/Intro.thy
author haftmann
Mon, 01 Mar 2010 13:40:23 +0100
changeset 35416 d8d7d1b785af
parent 25991 31b38a39e589
child 35762 af3ff2ba4c54
permissions -rw-r--r--
replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25991
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     1
(*  Title:      FOLP/ex/Intro.thy
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     4
    Copyright   1992  University of Cambridge
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     5
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     6
Derives some inference rules, illustrating the use of definitions.
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     7
*)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     8
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
     9
header {* Examples for the manual ``Introduction to Isabelle'' *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    10
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    11
theory Intro
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    12
imports FOLP
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    13
begin
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    14
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    15
subsubsection {* Some simple backward proofs *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    16
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    17
lemma mythm: "?p : P|P --> P"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    18
apply (rule impI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    19
apply (rule disjE)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    20
prefer 3 apply (assumption)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    21
prefer 2 apply (assumption)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    22
apply assumption
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    23
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    24
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    25
lemma "?p : (P & Q) | R --> (P | R)"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    26
apply (rule impI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    27
apply (erule disjE)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    28
apply (drule conjunct1)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    29
apply (rule disjI1)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    30
apply (rule_tac [2] disjI2)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    31
apply assumption+
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    32
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    33
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    34
(*Correct version, delaying use of "spec" until last*)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    35
lemma "?p : (ALL x y. P(x,y)) --> (ALL z w. P(w,z))"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    36
apply (rule impI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    37
apply (rule allI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    38
apply (rule allI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    39
apply (drule spec)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    40
apply (drule spec)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    41
apply assumption
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    42
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    43
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    44
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    45
subsubsection {* Demonstration of @{text "fast"} *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    46
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    47
lemma "?p : (EX y. ALL x. J(y,x) <-> ~J(x,x))
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    48
        -->  ~ (ALL x. EX y. ALL z. J(z,y) <-> ~ J(z,x))"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    49
apply (tactic {* fast_tac FOLP_cs 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    50
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    51
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    52
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    53
lemma "?p : ALL x. P(x,f(x)) <->
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    54
        (EX y. (ALL z. P(z,y) --> P(z,f(x))) & P(x,y))"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    55
apply (tactic {* fast_tac FOLP_cs 1 *})
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    56
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    57
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    58
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    59
subsubsection {* Derivation of conjunction elimination rule *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    60
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    61
lemma
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    62
  assumes major: "p : P&Q"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    63
    and minor: "!!x y. [| x : P; y : Q |] ==> f(x, y) : R"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    64
  shows "?p : R"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    65
apply (rule minor)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    66
apply (rule major [THEN conjunct1])
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    67
apply (rule major [THEN conjunct2])
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    68
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    69
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    70
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    71
subsection {* Derived rules involving definitions *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    72
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    73
text {* Derivation of negation introduction *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    74
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    75
lemma
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    76
  assumes "!!x. x : P ==> f(x) : False"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    77
  shows "?p : ~ P"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    78
apply (unfold not_def)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    79
apply (rule impI)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    80
apply (rule prems)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    81
apply assumption
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    82
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    83
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    84
lemma
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    85
  assumes major: "p : ~P"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    86
    and minor: "q : P"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    87
  shows "?p : R"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    88
apply (rule FalseE)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    89
apply (rule mp)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    90
apply (rule major [unfolded not_def])
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    91
apply (rule minor)
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    92
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    93
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    94
text {* Alternative proof of the result above *}
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    95
lemma
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    96
  assumes major: "p : ~P"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    97
    and minor: "q : P"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    98
  shows "?p : R"
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
    99
apply (rule minor [THEN major [unfolded not_def, THEN mp, THEN FalseE]])
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
   100
done
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
   101
31b38a39e589 eliminated some legacy ML files;
wenzelm
parents:
diff changeset
   102
end