src/HOL/Lambda/Commutation.thy
author wenzelm
Sat, 30 Dec 2006 16:08:06 +0100
changeset 21966 edab0ecfbd7c
parent 21669 c68717c16013
child 22270 4ccb7e6be929
permissions -rw-r--r--
removed misleading OuterLex.eq_token;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1302
diff changeset
     1
(*  Title:      HOL/Lambda/Commutation.thy
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     2
    ID:         $Id$
1476
608483c2122a expanded tabs; incorporated Konrad's changes
clasohm
parents: 1302
diff changeset
     3
    Author:     Tobias Nipkow
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     4
    Copyright   1995  TU Muenchen
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     5
*)
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
     6
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
     7
header {* Abstract commutation and confluence notions *}
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
     8
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 13550
diff changeset
     9
theory Commutation imports Main begin
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    10
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    11
subsection {* Basic definitions *}
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    12
19086
1b3780be6cc2 new-style definitions/abbreviations;
wenzelm
parents: 18513
diff changeset
    13
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 19363
diff changeset
    14
  square :: "[('a \<times> 'a) set, ('a \<times> 'a) set, ('a \<times> 'a) set, ('a \<times> 'a) set] => bool" where
19086
1b3780be6cc2 new-style definitions/abbreviations;
wenzelm
parents: 18513
diff changeset
    15
  "square R S T U =
1b3780be6cc2 new-style definitions/abbreviations;
wenzelm
parents: 18513
diff changeset
    16
    (\<forall>x y. (x, y) \<in> R --> (\<forall>z. (x, z) \<in> S --> (\<exists>u. (y, u) \<in> T \<and> (z, u) \<in> U)))"
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    17
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 19363
diff changeset
    18
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 19363
diff changeset
    19
  commute :: "[('a \<times> 'a) set, ('a \<times> 'a) set] => bool" where
19086
1b3780be6cc2 new-style definitions/abbreviations;
wenzelm
parents: 18513
diff changeset
    20
  "commute R S = square R S S R"
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    21
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 19363
diff changeset
    22
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 19363
diff changeset
    23
  diamond :: "('a \<times> 'a) set => bool" where
19086
1b3780be6cc2 new-style definitions/abbreviations;
wenzelm
parents: 18513
diff changeset
    24
  "diamond R = commute R R"
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    25
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 19363
diff changeset
    26
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 19363
diff changeset
    27
  Church_Rosser :: "('a \<times> 'a) set => bool" where
19086
1b3780be6cc2 new-style definitions/abbreviations;
wenzelm
parents: 18513
diff changeset
    28
  "Church_Rosser R =
1b3780be6cc2 new-style definitions/abbreviations;
wenzelm
parents: 18513
diff changeset
    29
    (\<forall>x y. (x, y) \<in> (R \<union> R^-1)^* --> (\<exists>z. (x, z) \<in> R^* \<and> (y, z) \<in> R^*))"
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    30
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19086
diff changeset
    31
abbreviation
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 19363
diff changeset
    32
  confluent :: "('a \<times> 'a) set => bool" where
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19086
diff changeset
    33
  "confluent R == diamond (R^*)"
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    34
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    35
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    36
subsection {* Basic lemmas *}
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    37
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    38
subsubsection {* square *}
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    39
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    40
lemma square_sym: "square R S T U ==> square S R U T"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    41
  apply (unfold square_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    42
  apply blast
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    43
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    44
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    45
lemma square_subset:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    46
    "[| square R S T U; T \<subseteq> T' |] ==> square R S T' U"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    47
  apply (unfold square_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    48
  apply blast
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    49
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    50
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    51
lemma square_reflcl:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    52
    "[| square R S T (R^=); S \<subseteq> T |] ==> square (R^=) S T (R^=)"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    53
  apply (unfold square_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    54
  apply blast
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    55
  done
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    56
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    57
lemma square_rtrancl:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    58
    "square R S S T ==> square (R^*) S S (T^*)"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    59
  apply (unfold square_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    60
  apply (intro strip)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    61
  apply (erule rtrancl_induct)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    62
   apply blast
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    63
  apply (blast intro: rtrancl_into_rtrancl)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    64
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    65
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    66
lemma square_rtrancl_reflcl_commute:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    67
    "square R S (S^*) (R^=) ==> commute (R^*) (S^*)"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    68
  apply (unfold commute_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    69
  apply (fastsimp dest: square_reflcl square_sym [THEN square_rtrancl]
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    70
    elim: r_into_rtrancl)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    71
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    72
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
    73
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    74
subsubsection {* commute *}
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    75
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    76
lemma commute_sym: "commute R S ==> commute S R"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    77
  apply (unfold commute_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    78
  apply (blast intro: square_sym)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    79
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    80
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    81
lemma commute_rtrancl: "commute R S ==> commute (R^*) (S^*)"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    82
  apply (unfold commute_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    83
  apply (blast intro: square_rtrancl square_sym)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    84
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    85
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    86
lemma commute_Un:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    87
    "[| commute R T; commute S T |] ==> commute (R \<union> S) T"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    88
  apply (unfold commute_def square_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    89
  apply blast
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    90
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    91
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    92
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    93
subsubsection {* diamond, confluence, and union *}
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    94
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    95
lemma diamond_Un:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    96
    "[| diamond R; diamond S; commute R S |] ==> diamond (R \<union> S)"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    97
  apply (unfold diamond_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    98
  apply (assumption | rule commute_Un commute_sym)+
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
    99
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   100
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   101
lemma diamond_confluent: "diamond R ==> confluent R"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   102
  apply (unfold diamond_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   103
  apply (erule commute_rtrancl)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   104
  done
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
   105
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   106
lemma square_reflcl_confluent:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   107
    "square R R (R^=) (R^=) ==> confluent R"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   108
  apply (unfold diamond_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   109
  apply (fast intro: square_rtrancl_reflcl_commute r_into_rtrancl
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   110
    elim: square_subset)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   111
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   112
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   113
lemma confluent_Un:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   114
    "[| confluent R; confluent S; commute (R^*) (S^*) |] ==> confluent (R \<union> S)"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   115
  apply (rule rtrancl_Un_rtrancl [THEN subst])
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   116
  apply (blast dest: diamond_Un intro: diamond_confluent)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   117
  done
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
   118
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   119
lemma diamond_to_confluence:
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   120
    "[| diamond R; T \<subseteq> R; R \<subseteq> T^* |] ==> confluent T"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   121
  apply (force intro: diamond_confluent
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   122
    dest: rtrancl_subset [symmetric])
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   123
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   124
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   125
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   126
subsection {* Church-Rosser *}
1278
7e6189fc833c Commutation replaces Confluence
nipkow
parents:
diff changeset
   127
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   128
lemma Church_Rosser_confluent: "Church_Rosser R = confluent R"
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   129
  apply (unfold square_def commute_def diamond_def Church_Rosser_def)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   130
  apply (tactic {* safe_tac HOL_cs *})
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   131
   apply (tactic {*
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   132
     blast_tac (HOL_cs addIs
21669
c68717c16013 removed legacy ML bindings;
wenzelm
parents: 21404
diff changeset
   133
       [thm "Un_upper2" RS thm "rtrancl_mono" RS thm "subsetD" RS thm "rtrancl_trans",
c68717c16013 removed legacy ML bindings;
wenzelm
parents: 21404
diff changeset
   134
        thm "rtrancl_converseI", thm "converseI",
c68717c16013 removed legacy ML bindings;
wenzelm
parents: 21404
diff changeset
   135
        thm "Un_upper1" RS thm "rtrancl_mono" RS thm "subsetD"]) 1 *})
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   136
  apply (erule rtrancl_induct)
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   137
   apply blast
10212
33fe2d701ddd *** empty log message ***
nipkow
parents: 10179
diff changeset
   138
  apply (blast del: rtrancl_refl intro: rtrancl_trans)
9811
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   139
  done
39ffdb8cab03 HOL/Lambda: converted into new-style theory and document;
wenzelm
parents: 8624
diff changeset
   140
13089
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   141
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   142
subsection {* Newman's lemma *}
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   143
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   144
text {* Proof by Stefan Berghofer *}
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   145
13343
3b2b18c58d80 *** empty log message ***
nipkow
parents: 13331
diff changeset
   146
theorem newman:
13089
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   147
  assumes wf: "wf (R\<inverse>)"
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   148
  and lc: "\<And>a b c. (a, b) \<in> R \<Longrightarrow> (a, c) \<in> R \<Longrightarrow>
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   149
    \<exists>d. (b, d) \<in> R\<^sup>* \<and> (c, d) \<in> R\<^sup>*"
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   150
  shows "\<And>b c. (a, b) \<in> R\<^sup>* \<Longrightarrow> (a, c) \<in> R\<^sup>* \<Longrightarrow>
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   151
    \<exists>d. (b, d) \<in> R\<^sup>* \<and> (c, d) \<in> R\<^sup>*"
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   152
  using wf
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   153
proof induct
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   154
  case (less x b c)
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   155
  have xc: "(x, c) \<in> R\<^sup>*" .
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   156
  have xb: "(x, b) \<in> R\<^sup>*" . thus ?case
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   157
  proof (rule converse_rtranclE)
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   158
    assume "x = b"
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   159
    with xc have "(b, c) \<in> R\<^sup>*" by simp
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 16417
diff changeset
   160
    thus ?thesis by iprover
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   161
  next
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   162
    fix y
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   163
    assume xy: "(x, y) \<in> R"
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   164
    assume yb: "(y, b) \<in> R\<^sup>*"
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   165
    from xc show ?thesis
13089
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   166
    proof (rule converse_rtranclE)
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   167
      assume "x = c"
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   168
      with xb have "(c, b) \<in> R\<^sup>*" by simp
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 16417
diff changeset
   169
      thus ?thesis by iprover
13089
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   170
    next
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   171
      fix y'
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   172
      assume y'c: "(y', c) \<in> R\<^sup>*"
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   173
      assume xy': "(x, y') \<in> R"
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   174
      with xy have "\<exists>u. (y, u) \<in> R\<^sup>* \<and> (y', u) \<in> R\<^sup>*" by (rule lc)
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 16417
diff changeset
   175
      then obtain u where yu: "(y, u) \<in> R\<^sup>*" and y'u: "(y', u) \<in> R\<^sup>*" by iprover
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   176
      from xy have "(y, x) \<in> R\<inverse>" ..
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   177
      from this and yb yu have "\<exists>d. (b, d) \<in> R\<^sup>* \<and> (u, d) \<in> R\<^sup>*" by (rule less)
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 16417
diff changeset
   178
      then obtain v where bv: "(b, v) \<in> R\<^sup>*" and uv: "(u, v) \<in> R\<^sup>*" by iprover
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   179
      from xy' have "(y', x) \<in> R\<inverse>" ..
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   180
      moreover from y'u and uv have "(y', v) \<in> R\<^sup>*" by (rule rtrancl_trans)
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   181
      moreover note y'c
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   182
      ultimately have "\<exists>d. (v, d) \<in> R\<^sup>* \<and> (c, d) \<in> R\<^sup>*" by (rule less)
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 16417
diff changeset
   183
      then obtain w where vw: "(v, w) \<in> R\<^sup>*" and cw: "(c, w) \<in> R\<^sup>*" by iprover
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   184
      from bv vw have "(b, w) \<in> R\<^sup>*" by (rule rtrancl_trans)
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 16417
diff changeset
   185
      with cw show ?thesis by iprover
13089
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   186
    qed
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   187
  qed
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   188
qed
c8c28a1dc787 Added proof of Newman's lemma.
berghofe
parents: 10212
diff changeset
   189
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   190
text {*
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   191
  \medskip Alternative version.  Partly automated by Tobias
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   192
  Nipkow. Takes 2 minutes (2002).
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   193
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   194
  This is the maximal amount of automation possible at the moment.
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   195
*}
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   196
13349
7d4441c8c46a Added "using" to the beginning of original newman proof again, because
berghofe
parents: 13346
diff changeset
   197
theorem newman':
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   198
  assumes wf: "wf (R\<inverse>)"
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   199
  and lc: "\<And>a b c. (a, b) \<in> R \<Longrightarrow> (a, c) \<in> R \<Longrightarrow>
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   200
    \<exists>d. (b, d) \<in> R\<^sup>* \<and> (c, d) \<in> R\<^sup>*"
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   201
  shows "\<And>b c. (a, b) \<in> R\<^sup>* \<Longrightarrow> (a, c) \<in> R\<^sup>* \<Longrightarrow>
18513
791b53bf4073 tuned proofs;
wenzelm
parents: 18241
diff changeset
   202
    \<exists>d. (b, d) \<in> R\<^sup>* \<and> (c, d) \<in> R\<^sup>*"
18241
afdba6b3e383 tuned induction proofs;
wenzelm
parents: 17589
diff changeset
   203
  using wf
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   204
proof induct
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   205
  case (less x b c)
18241
afdba6b3e383 tuned induction proofs;
wenzelm
parents: 17589
diff changeset
   206
  note IH = `\<And>y b c. \<lbrakk>(y,x) \<in> R\<inverse>; (y,b) \<in> R\<^sup>*; (y,c) \<in> R\<^sup>*\<rbrakk>
afdba6b3e383 tuned induction proofs;
wenzelm
parents: 17589
diff changeset
   207
                     \<Longrightarrow> \<exists>d. (b,d) \<in> R\<^sup>* \<and> (c,d) \<in> R\<^sup>*`
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   208
  have xc: "(x, c) \<in> R\<^sup>*" .
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   209
  have xb: "(x, b) \<in> R\<^sup>*" .
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   210
  thus ?case
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   211
  proof (rule converse_rtranclE)
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   212
    assume "x = b"
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   213
    with xc have "(b, c) \<in> R\<^sup>*" by simp
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 16417
diff changeset
   214
    thus ?thesis by iprover
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   215
  next
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   216
    fix y
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   217
    assume xy: "(x, y) \<in> R"
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   218
    assume yb: "(y, b) \<in> R\<^sup>*"
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   219
    from xc show ?thesis
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   220
    proof (rule converse_rtranclE)
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   221
      assume "x = c"
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   222
      with xb have "(c, b) \<in> R\<^sup>*" by simp
17589
58eeffd73be1 renamed rules to iprover
nipkow
parents: 16417
diff changeset
   223
      thus ?thesis by iprover
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   224
    next
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   225
      fix y'
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   226
      assume y'c: "(y', c) \<in> R\<^sup>*"
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   227
      assume xy': "(x, y') \<in> R"
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   228
      with xy obtain u where u: "(y, u) \<in> R\<^sup>*" "(y', u) \<in> R\<^sup>*"
18241
afdba6b3e383 tuned induction proofs;
wenzelm
parents: 17589
diff changeset
   229
        by (blast dest: lc)
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   230
      from yb u y'c show ?thesis
18241
afdba6b3e383 tuned induction proofs;
wenzelm
parents: 17589
diff changeset
   231
        by (blast del: rtrancl_refl
afdba6b3e383 tuned induction proofs;
wenzelm
parents: 17589
diff changeset
   232
            intro: rtrancl_trans
afdba6b3e383 tuned induction proofs;
wenzelm
parents: 17589
diff changeset
   233
            dest: IH [OF xy [symmetric]] IH [OF xy' [symmetric]])
13346
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   234
    qed
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   235
  qed
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   236
qed
6918b6d5192b Added partly automated version of Newman.
nipkow
parents: 13343
diff changeset
   237
10179
9d5678e6bf34 added rtranclIs
nipkow
parents: 9811
diff changeset
   238
end