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