doc-src/TutorialI/Sets/Relations.thy
author blanchet
Mon, 30 Apr 2012 21:59:10 +0200
changeset 47845 2a2bc13669bd
parent 47508 85c6268b4071
child 48611 b34ff75c23a7
permissions -rw-r--r--
export more symbols
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16417
9bc16273c2d4 migrated theory headers to new format
haftmann
parents: 12489
diff changeset
     1
theory Relations imports Main begin
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
     2
36745
403585a89772 unified/simplified Pretty.margin_default;
wenzelm
parents: 26806
diff changeset
     3
ML "Pretty.margin_default := 64"
10294
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{*
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
     9
@{thm[display] Id_def[no_vars]}
10294
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{*
47508
85c6268b4071 updated rel_comp ~> relcomp (cf. e1b761c216ac);
wenzelm
parents: 42637
diff changeset
    14
@{thm[display] relcomp_unfold[no_vars]}
85c6268b4071 updated rel_comp ~> relcomp (cf. e1b761c216ac);
wenzelm
parents: 42637
diff changeset
    15
\rulename{relcomp_unfold}
10294
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{*
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    19
@{thm[display] R_O_Id[no_vars]}
10294
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{*
47508
85c6268b4071 updated rel_comp ~> relcomp (cf. e1b761c216ac);
wenzelm
parents: 42637
diff changeset
    24
@{thm[display] relcomp_mono[no_vars]}
85c6268b4071 updated rel_comp ~> relcomp (cf. e1b761c216ac);
wenzelm
parents: 42637
diff changeset
    25
\rulename{relcomp_mono}
10294
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{*
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    29
@{thm[display] converse_iff[no_vars]}
10294
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{*
47508
85c6268b4071 updated rel_comp ~> relcomp (cf. e1b761c216ac);
wenzelm
parents: 42637
diff changeset
    34
@{thm[display] converse_relcomp[no_vars]}
85c6268b4071 updated rel_comp ~> relcomp (cf. e1b761c216ac);
wenzelm
parents: 42637
diff changeset
    35
\rulename{converse_relcomp}
10294
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{*
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    39
@{thm[display] Image_iff[no_vars]}
10294
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{*
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    44
@{thm[display] Image_UN[no_vars]}
10294
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{*
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    49
@{thm[display] Domain_iff[no_vars]}
10294
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{*
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    54
@{thm[display] Range_iff[no_vars]}
10294
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{*
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    59
@{thm[display] relpow.simps[no_vars]}
10294
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
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    62
@{thm[display] rtrancl_refl[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    63
\rulename{rtrancl_refl}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    64
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    65
@{thm[display] r_into_rtrancl[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    66
\rulename{r_into_rtrancl}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    67
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    68
@{thm[display] rtrancl_trans[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    69
\rulename{rtrancl_trans}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    70
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    71
@{thm[display] rtrancl_induct[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    72
\rulename{rtrancl_induct}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    73
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    74
@{thm[display] rtrancl_idemp[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    75
\rulename{rtrancl_idemp}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    76
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    77
@{thm[display] r_into_trancl[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    78
\rulename{r_into_trancl}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    79
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    80
@{thm[display] trancl_trans[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    81
\rulename{trancl_trans}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    82
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    83
@{thm[display] trancl_into_rtrancl[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    84
\rulename{trancl_into_rtrancl}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    85
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    86
@{thm[display] trancl_converse[no_vars]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    87
\rulename{trancl_converse}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    88
*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    89
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    90
text{*Relations.  transitive closure*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
    91
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10864
diff changeset
    92
lemma rtrancl_converseD: "(x,y) \<in> (r\<inverse>)\<^sup>* \<Longrightarrow> (y,x) \<in> r\<^sup>*"
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    93
apply (erule rtrancl_induct)
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    94
txt{*
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    95
@{subgoals[display,indent=0,margin=65]}
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    96
*};
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    97
 apply (rule rtrancl_refl)
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10864
diff changeset
    98
apply (blast intro: rtrancl_trans)
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
    99
done
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   100
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   101
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10864
diff changeset
   102
lemma rtrancl_converseI: "(y,x) \<in> r\<^sup>* \<Longrightarrow> (x,y) \<in> (r\<inverse>)\<^sup>*"
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   103
apply (erule rtrancl_induct)
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   104
 apply (rule rtrancl_refl)
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10864
diff changeset
   105
apply (blast intro: rtrancl_trans)
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   106
done
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   107
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10864
diff changeset
   108
lemma rtrancl_converse: "(r\<inverse>)\<^sup>* = (r\<^sup>*)\<inverse>"
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   109
by (auto intro: rtrancl_converseI dest: rtrancl_converseD)
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   110
11080
22855d091249 various revisions in response to comments from Tobias
paulson
parents: 10864
diff changeset
   111
lemma rtrancl_converse: "(r\<inverse>)\<^sup>* = (r\<^sup>*)\<inverse>"
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   112
apply (intro equalityI subsetI)
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   113
txt{*
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   114
after intro rules
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   115
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   116
@{subgoals[display,indent=0,margin=65]}
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   117
*};
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   118
apply clarify
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   119
txt{*
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   120
after splitting
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   121
@{subgoals[display,indent=0,margin=65]}
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   122
*};
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   123
oops
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   124
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   125
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   126
lemma "(\<forall>u v. (u,v) \<in> A \<longrightarrow> u=v) \<Longrightarrow> A \<subseteq> Id"
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   127
apply (rule subsetI)
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   128
txt{*
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   129
@{subgoals[display,indent=0,margin=65]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   130
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   131
after subsetI
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   132
*};
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   133
apply clarify
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   134
txt{*
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   135
@{subgoals[display,indent=0,margin=65]}
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   136
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   137
subgoals after clarify
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   138
*};
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   139
by blast
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   140
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   141
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   142
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   143
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   144
text{*rejects*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   145
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   146
lemma "(a \<in> {z. P z} \<union> {y. Q y}) = P a \<or> Q a"
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   147
apply (blast)
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   148
done
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   149
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   150
text{*Pow, Inter too little used*}
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   151
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   152
lemma "(A \<subset> B) = (A \<subseteq> B \<and> A \<noteq> B)"
26806
40b411ec05aa Adapted to encoding of sets as predicates
berghofe
parents: 16417
diff changeset
   153
apply (simp add: psubset_eq)
10864
f0b0a125ae4b revisions corresponding to the new version of sets.tex
paulson
parents: 10341
diff changeset
   154
done
10294
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   155
2ec9c808a8a7 the Sets chapter and theories
paulson
parents:
diff changeset
   156
end