doc-src/TutorialI/Sets/Relations.thy
author wenzelm
Tue, 28 Nov 2000 01:09:13 +0100
changeset 10526 ced4f4ec917e
parent 10341 6eb91805a012
child 10864 f0b0a125ae4b
permissions -rw-r--r--
consumes0/1;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10341
6eb91805a012 added the $Id:$ line
paulson
parents: 10294
diff changeset
     1
(* ID:         $Id$ *)
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     2
theory Relations = Main:
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     3
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     4
ML "Pretty.setmargin 64"
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     5
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     6
(*Id is only used in UNITY*)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     7
(*refl, antisym,trans,univalent,\<dots> ho hum*)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     8
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     9
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    10
@{thm[display]"Id_def"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    11
\rulename{Id_def}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    12
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    13
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    14
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    15
@{thm[display]"comp_def"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    16
\rulename{comp_def}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    17
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    18
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    19
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    20
@{thm[display]"R_O_Id"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    21
\rulename{R_O_Id}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    22
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    23
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    24
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    25
@{thm[display]"comp_mono"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    26
\rulename{comp_mono}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    27
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    28
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    29
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    30
@{thm[display]"converse_iff"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    31
\rulename{converse_iff}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    32
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    33
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    34
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    35
@{thm[display]"converse_comp"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    36
\rulename{converse_comp}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    37
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    38
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    39
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    40
@{thm[display]"Image_iff"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    41
\rulename{Image_iff}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    42
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    43
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    44
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    45
@{thm[display]"Image_UN"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    46
\rulename{Image_UN}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    47
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    48
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    49
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    50
@{thm[display]"Domain_iff"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    51
\rulename{Domain_iff}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    52
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    53
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    54
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    55
@{thm[display]"Range_iff"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    56
\rulename{Range_iff}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    57
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    58
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    59
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    60
@{thm[display]"relpow.simps"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    61
\rulename{relpow.simps}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    62
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    63
@{thm[display]"rtrancl_unfold"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    64
\rulename{rtrancl_unfold}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    65
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    66
@{thm[display]"rtrancl_refl"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    67
\rulename{rtrancl_refl}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    68
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    69
@{thm[display]"r_into_rtrancl"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    70
\rulename{r_into_rtrancl}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    71
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    72
@{thm[display]"rtrancl_trans"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    73
\rulename{rtrancl_trans}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    74
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    75
@{thm[display]"rtrancl_induct"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    76
\rulename{rtrancl_induct}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    77
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    78
@{thm[display]"rtrancl_idemp"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    79
\rulename{rtrancl_idemp}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    80
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    81
@{thm[display]"r_into_trancl"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    82
\rulename{r_into_trancl}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    83
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    84
@{thm[display]"trancl_trans"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    85
\rulename{trancl_trans}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    86
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    87
@{thm[display]"trancl_into_rtrancl"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    88
\rulename{trancl_into_rtrancl}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    89
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    90
@{thm[display]"trancl_converse"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    91
\rulename{trancl_converse}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    92
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    93
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    94
text{*Relations.  transitive closure*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    95
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    96
lemma rtrancl_converseD: "(x,y) \<in> (r^-1)^* \<Longrightarrow> (y,x) \<in> r^*"
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    97
  apply (erule rtrancl_induct)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    98
   apply (rule rtrancl_refl)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    99
  apply (blast intro: r_into_rtrancl rtrancl_trans)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   100
  done
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   101
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   102
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   103
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ \isadigit{1}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   104
\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   105
goal\ {\isacharparenleft}lemma\ rtrancl{\isacharunderscore}converseD{\isacharparenright}{\isacharcolon}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   106
{\isacharparenleft}x{\isacharcomma}\ y{\isacharparenright}\ {\isasymin}\ {\isacharparenleft}r{\isacharcircum}{\isacharminus}\isadigit{1}{\isacharparenright}{\isacharcircum}{\isacharasterisk}\ {\isasymLongrightarrow}\ {\isacharparenleft}y{\isacharcomma}\ x{\isacharparenright}\ {\isasymin}\ r{\isacharcircum}{\isacharasterisk}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   107
\ \isadigit{1}{\isachardot}\ {\isacharparenleft}x{\isacharcomma}\ x{\isacharparenright}\ {\isasymin}\ r{\isacharcircum}{\isacharasterisk}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   108
\ \isadigit{2}{\isachardot}\ {\isasymAnd}y\ z{\isachardot}\ {\isasymlbrakk}{\isacharparenleft}x{\isacharcomma}\ y{\isacharparenright}\ {\isasymin}\ {\isacharparenleft}r{\isacharcircum}{\isacharminus}\isadigit{1}{\isacharparenright}{\isacharcircum}{\isacharasterisk}{\isacharsemicolon}\ {\isacharparenleft}y{\isacharcomma}\ z{\isacharparenright}\ {\isasymin}\ r{\isacharcircum}{\isacharminus}\isadigit{1}{\isacharsemicolon}\ {\isacharparenleft}y{\isacharcomma}\ x{\isacharparenright}\ {\isasymin}\ r{\isacharcircum}{\isacharasterisk}{\isasymrbrakk}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   109
\ \ \ \ \ \ \ \ \ \ {\isasymLongrightarrow}\ {\isacharparenleft}z{\isacharcomma}\ x{\isacharparenright}\ {\isasymin}\ r{\isacharcircum}{\isacharasterisk}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   110
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   111
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   112
lemma rtrancl_converseI: "(y,x) \<in> r^* \<Longrightarrow> (x,y) \<in> (r^-1)^*"
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   113
  apply (erule rtrancl_induct)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   114
   apply (rule rtrancl_refl)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   115
  apply (blast intro: r_into_rtrancl rtrancl_trans)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   116
  done
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   117
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   118
lemma rtrancl_converse: "(r^-1)^* = (r^*)^-1"
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   119
  apply (auto intro: rtrancl_converseI dest: rtrancl_converseD)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   120
  done
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   121
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   122
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   123
lemma "A \<subseteq> Id"
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   124
  apply (rule subsetI)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   125
  apply (auto)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   126
  oops
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   127
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   128
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   129
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ \isadigit{1}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   130
\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   131
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   132
A\ {\isasymsubseteq}\ Id\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   133
\ \isadigit{1}{\isachardot}\ {\isasymAnd}x{\isachardot}\ x\ {\isasymin}\ A\ {\isasymLongrightarrow}\ x\ {\isasymin}\ Id
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   134
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   135
proof\ {\isacharparenleft}prove{\isacharparenright}{\isacharcolon}\ step\ \isadigit{2}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   136
\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   137
goal\ {\isacharparenleft}lemma{\isacharparenright}{\isacharcolon}\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   138
A\ {\isasymsubseteq}\ Id\isanewline
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   139
\ \isadigit{1}{\isachardot}\ {\isasymAnd}a\ b{\isachardot}\ {\isacharparenleft}a{\isacharcomma}\ b{\isacharparenright}\ {\isasymin}\ A\ {\isasymLongrightarrow}\ a\ {\isacharequal}\ b
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   140
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   141
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   142
text{*questions: do we cover force?  (Why not?)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   143
Do we include tables of operators in ASCII and X-symbol notation like in the Logics manuals?*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   144
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   145
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   146
text{*rejects*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   147
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   148
lemma "(a \<in> {z. P z} \<union> {y. Q y}) = P a \<or> Q a"
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   149
  apply (blast)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   150
  done
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   151
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   152
text{*Pow, Inter too little used*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   153
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   154
lemma "(A \<subset> B) = (A \<subseteq> B \<and> A \<noteq> B)"
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   155
  apply (simp add: psubset_def)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   156
  done
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   157
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   158
(*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   159
text{*
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   160
@{thm[display]"DD"}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   161
\rulename{DD}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   162
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   163
*)
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   164
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   165
end