src/HOL/Isar_Examples/Peirce.thy
author wenzelm
Wed, 04 Nov 2015 23:27:00 +0100
changeset 61578 6623c81cb15a
parent 61541 846c72206207
child 61932 2e48182cc82c
permissions -rw-r--r--
avoid ligatures;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33026
8f35633c4922 modernized session Isar_Examples;
wenzelm
parents: 31758
diff changeset
     1
(*  Title:      HOL/Isar_Examples/Peirce.thy
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     2
    Author:     Markus Wenzel, TU Muenchen
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     3
*)
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     4
58882
6e2010ab8bd9 modernized header;
wenzelm
parents: 58614
diff changeset
     5
section \<open>Peirce's Law\<close>
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
     6
31758
3edd5f813f01 observe standard theory naming conventions;
wenzelm
parents: 23373
diff changeset
     7
theory Peirce
3edd5f813f01 observe standard theory naming conventions;
wenzelm
parents: 23373
diff changeset
     8
imports Main
3edd5f813f01 observe standard theory naming conventions;
wenzelm
parents: 23373
diff changeset
     9
begin
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    10
61541
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    11
text \<open>We consider Peirce's Law: \<open>((A \<longrightarrow> B) \<longrightarrow> A) \<longrightarrow> A\<close>. This is an inherently
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    12
  non-intuitionistic statement, so its proof will certainly involve some
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    13
  form of classical contradiction.
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    14
61541
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    15
  The first proof is again a well-balanced combination of plain backward and
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    16
  forward reasoning. The actual classical step is where the negated goal may
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    17
  be introduced as additional assumption. This eventually leads to a
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    18
  contradiction.\footnote{The rule involved there is negation elimination;
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    19
  it holds in intuitionistic logic as well.}\<close>
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    20
55640
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    21
theorem "((A \<longrightarrow> B) \<longrightarrow> A) \<longrightarrow> A"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    22
proof
55640
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    23
  assume "(A \<longrightarrow> B) \<longrightarrow> A"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    24
  show A
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    25
  proof (rule classical)
55640
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    26
    assume "\<not> A"
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    27
    have "A \<longrightarrow> B"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    28
    proof
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    29
      assume A
58614
7338eb25226c more cartouches;
wenzelm
parents: 55640
diff changeset
    30
      with \<open>\<not> A\<close> show B by contradiction
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    31
    qed
58614
7338eb25226c more cartouches;
wenzelm
parents: 55640
diff changeset
    32
    with \<open>(A \<longrightarrow> B) \<longrightarrow> A\<close> show A ..
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    33
  qed
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    34
qed
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    35
61541
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    36
text \<open>In the subsequent version the reasoning is rearranged by means of
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    37
  ``weak assumptions'' (as introduced by \isacommand{presume}). Before
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    38
  assuming the negated goal \<open>\<not> A\<close>, its intended consequence \<open>A \<longrightarrow> B\<close> is put
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    39
  into place in order to solve the main problem. Nevertheless, we do not get
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    40
  anything for free, but have to establish \<open>A \<longrightarrow> B\<close> later on. The overall
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    41
  effect is that of a logical \<^emph>\<open>cut\<close>.
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    42
61541
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    43
  Technically speaking, whenever some goal is solved by \isacommand{show} in
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    44
  the context of weak assumptions then the latter give rise to new subgoals,
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    45
  which may be established separately. In contrast, strong assumptions (as
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    46
  introduced by \isacommand{assume}) are solved immediately.\<close>
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    47
55640
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    48
theorem "((A \<longrightarrow> B) \<longrightarrow> A) \<longrightarrow> A"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    49
proof
55640
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    50
  assume "(A \<longrightarrow> B) \<longrightarrow> A"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    51
  show A
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    52
  proof (rule classical)
55640
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    53
    presume "A \<longrightarrow> B"
58614
7338eb25226c more cartouches;
wenzelm
parents: 55640
diff changeset
    54
    with \<open>(A \<longrightarrow> B) \<longrightarrow> A\<close> show A ..
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    55
  next
55640
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    56
    assume "\<not> A"
abc140f21caa tuned proofs;
wenzelm
parents: 37671
diff changeset
    57
    show "A \<longrightarrow> B"
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    58
    proof
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    59
      assume A
58614
7338eb25226c more cartouches;
wenzelm
parents: 55640
diff changeset
    60
      with \<open>\<not> A\<close> show B by contradiction
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    61
    qed
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    62
  qed
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    63
qed
6444
2ebe9e630cab Miscellaneous Isabelle/Isar examples for Higher-Order Logic.
wenzelm
parents:
diff changeset
    64
61541
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    65
text \<open>Note that the goals stemming from weak assumptions may be even left
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    66
  until qed time, where they get eventually solved ``by assumption'' as
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    67
  well. In that case there is really no fundamental difference between the
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    68
  two kinds of assumptions, apart from the order of reducing the individual
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    69
  parts of the proof configuration.
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    70
61541
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    71
  Nevertheless, the ``strong'' mode of plain assumptions is quite important
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    72
  in practice to achieve robustness of proof text interpretation. By forcing
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    73
  both the conclusion \<^emph>\<open>and\<close> the assumptions to unify with the pending goal
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    74
  to be solved, goal selection becomes quite deterministic. For example,
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    75
  decomposition with rules of the ``case-analysis'' type usually gives rise
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    76
  to several goals that only differ in there local contexts. With strong
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    77
  assumptions these may be still solved in any order in a predictable way,
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    78
  while weak ones would quickly lead to great confusion, eventually
846c72206207 tuned document;
wenzelm
parents: 58882
diff changeset
    79
  demanding even some backtracking.\<close>
7860
7819547df4d8 improved presentation;
wenzelm
parents: 7748
diff changeset
    80
10007
64bf7da1994a isar-strip-terminators;
wenzelm
parents: 7982
diff changeset
    81
end