src/HOL/Isar_examples/Peirce.thy
author wenzelm
Thu, 14 Oct 1999 16:02:39 +0200
changeset 7869 c007f801cd59
parent 7860 7819547df4d8
child 7874 180364256231
permissions -rw-r--r--
improved presentation;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     1
(*  Title:      HOL/Isar_examples/Peirce.thy
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     3
    Author:     Markus Wenzel, TU Muenchen
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     4
*)
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     5
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
     6
header {* Peirce's Law *};
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     7
7748
5b9c45b21782 improved presentation;
wenzelm
parents: 7740
diff changeset
     8
theory Peirce = Main:;
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     9
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    10
text {*
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    11
 We consider Peirce's Law: $((A \impl B) \impl A) \impl A$.  This is
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    12
 an inherently non-intuitionistic statement, so its proof will
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    13
 certainly involve some form of classical contradiction.
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    14
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    15
 The first proof is again a well-balanced combination of plain
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    16
 backward and forward reasoning.  The actual classical reasoning step
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    17
 is where the negated goal is introduced as additional assumption.
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    18
 This eventually leads to a contradiction.\footnote{The rule involved
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    19
 here is negation elimination; it holds in intuitionistic logic as
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    20
 well.}
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    21
*};
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    22
6493
wenzelm
parents: 6444
diff changeset
    23
theorem "((A --> B) --> A) --> A";
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    24
proof;
6892
wenzelm
parents: 6854
diff changeset
    25
  assume aba: "(A --> B) --> A";
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    26
  show A;
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    27
  proof (rule classical);
7448
wenzelm
parents: 7153
diff changeset
    28
    assume "~ A";
wenzelm
parents: 7153
diff changeset
    29
    have "A --> B";
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    30
    proof;
7448
wenzelm
parents: 7153
diff changeset
    31
      assume A;
wenzelm
parents: 7153
diff changeset
    32
      thus B; by contradiction;
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    33
    qed;
7448
wenzelm
parents: 7153
diff changeset
    34
    with aba; show A; ..;
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    35
  qed;
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    36
qed;
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    37
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    38
text {*
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    39
 The subsequent version rearranges the reasoning by means of ``weak
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    40
 assumptions'' (as introduced by \isacommand{presume}).  Before
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    41
 assuming the negated goal $\neg A$, its intended consequence $A \impl
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    42
 B$ is put into place in order to solve the main problem.
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    43
 Nevertheless, we do not get anything for free, but have to establish
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    44
 $A \impl B$ later on.  The overall effect is that of a \emph{cut}.
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    45
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    46
 Technically speaking, whenever some goal is solved by
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    47
 \isacommand{show} in the context of weak assumptions then the latter
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    48
 give rise to new subgoals, which may be established separately.  In
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    49
 contrast, strong assumptions (as introduced by \isacommand{assume})
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    50
 are solved immediately.
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    51
*};
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    52
6493
wenzelm
parents: 6444
diff changeset
    53
theorem "((A --> B) --> A) --> A";
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    54
proof;
6892
wenzelm
parents: 6854
diff changeset
    55
  assume aba: "(A --> B) --> A";
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    56
  show A;
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    57
  proof (rule classical);
7448
wenzelm
parents: 7153
diff changeset
    58
    presume "A --> B";
wenzelm
parents: 7153
diff changeset
    59
    with aba; show A; ..;
6854
60a5ee0ca81d updated;
wenzelm
parents: 6746
diff changeset
    60
  next;
6892
wenzelm
parents: 6854
diff changeset
    61
    assume not_a: "~ A";
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    62
    show "A --> B";
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    63
    proof;
7448
wenzelm
parents: 7153
diff changeset
    64
      assume A;
wenzelm
parents: 7153
diff changeset
    65
      with not_a; show B; ..;
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    66
    qed;
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    67
  qed;
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    68
qed;
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    69
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    70
text {*
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    71
 Note that the goals stemming from weak assumptions may be even left
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    72
 until qed time, where they get eventually solved ``by assumption'' as
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    73
 well.  In that case there is really no big difference between the two
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    74
 kinds of assumptions, apart from the order of reducing the individual
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    75
 parts of the proof configuration.
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    76
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    77
 Nevertheless, the ``strong'' mode of plain assumptions is quite
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    78
 important in practice to achieve robustness of proof document
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    79
 interpretation.  By forcing both the conclusion \emph{and} the
7869
c007f801cd59 improved presentation;
wenzelm
parents: 7860
diff changeset
    80
 assumptions to unify with the pending goal to be solved, goal
c007f801cd59 improved presentation;
wenzelm
parents: 7860
diff changeset
    81
 selection becomes quite deterministic.  For example, decomposition
c007f801cd59 improved presentation;
wenzelm
parents: 7860
diff changeset
    82
 with ``case-analysis'' type rules usually give rise to several goals
c007f801cd59 improved presentation;
wenzelm
parents: 7860
diff changeset
    83
 that only differ in there local contexts.  With strong assumptions
c007f801cd59 improved presentation;
wenzelm
parents: 7860
diff changeset
    84
 these may be still solved in any order in a predictable way, while
c007f801cd59 improved presentation;
wenzelm
parents: 7860
diff changeset
    85
 weak ones would quickly lead to great confusion, eventually demanding
c007f801cd59 improved presentation;
wenzelm
parents: 7860
diff changeset
    86
 even some backtracking.
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    87
*};
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    88
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    89
end;