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