src/Doc/Logics_ZF/ZF_examples.thy
author wenzelm
Sat, 28 Nov 2020 16:25:29 +0100
changeset 72759 bd5ee3148132
parent 69505 cc2d676d5395
permissions -rw-r--r--
more antiquotations (reverting 4df341249348);
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
     1
section\<open>Examples of Reasoning in ZF Set Theory\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
     2
65449
c82e63b11b8b clarified main ZF.thy / ZFC.thy, and avoid name clash with global HOL/Main.thy;
wenzelm
parents: 58889
diff changeset
     3
theory ZF_examples imports ZFC begin
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
     4
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
     5
subsection \<open>Binary Trees\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
     6
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
     7
consts
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
     8
  bt :: "i => i"
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
     9
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    10
datatype "bt(A)" =
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    11
  Lf | Br ("a \<in> A", "t1 \<in> bt(A)", "t2 \<in> bt(A)")
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    12
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    13
declare bt.intros [simp]
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    14
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
    15
text\<open>Induction via tactic emulation\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    16
lemma Br_neq_left [rule_format]: "l \<in> bt(A) ==> \<forall>x r. Br(x, l, r) \<noteq> l"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
    17
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    18
  apply (induct_tac l)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
    19
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    20
  apply auto
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    21
  done
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    22
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    23
(*
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    24
  apply (Inductive.case_tac l)
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    25
  apply (tactic {*exhaust_tac "l" 1*})
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    26
*)
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    27
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
    28
text\<open>The new induction method, which I don't understand\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    29
lemma Br_neq_left': "l \<in> bt(A) ==> (!!x r. Br(x, l, r) \<noteq> l)"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
    30
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    31
  apply (induct set: bt)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
    32
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    33
  apply auto
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    34
  done
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    35
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    36
lemma Br_iff: "Br(a,l,r) = Br(a',l',r') <-> a=a' & l=l' & r=r'"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
    37
  \<comment> \<open>Proving a freeness theorem.\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    38
  by (blast elim!: bt.free_elims)
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    39
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    40
inductive_cases Br_in_bt: "Br(a,l,r) \<in> bt(A)"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
    41
  \<comment> \<open>An elimination rule, for type-checking.\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    42
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
    43
text \<open>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    44
@{thm[display] Br_in_bt[no_vars]}
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
    45
\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
    46
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
    47
subsection\<open>Primitive recursion\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    48
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    49
consts  n_nodes :: "i => i"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    50
primrec
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    51
  "n_nodes(Lf) = 0"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    52
  "n_nodes(Br(a,l,r)) = succ(n_nodes(l) #+ n_nodes(r))"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    53
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    54
lemma n_nodes_type [simp]: "t \<in> bt(A) ==> n_nodes(t) \<in> nat"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    55
  by (induct_tac t, auto) 
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    56
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    57
consts  n_nodes_aux :: "i => i"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    58
primrec
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    59
  "n_nodes_aux(Lf) = (\<lambda>k \<in> nat. k)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    60
  "n_nodes_aux(Br(a,l,r)) = 
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    61
      (\<lambda>k \<in> nat. n_nodes_aux(r) `  (n_nodes_aux(l) ` succ(k)))"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    62
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    63
lemma n_nodes_aux_eq [rule_format]:
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    64
     "t \<in> bt(A) ==> \<forall>k \<in> nat. n_nodes_aux(t)`k = n_nodes(t) #+ k"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    65
  by (induct_tac t, simp_all) 
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    66
35416
d8d7d1b785af replaced a couple of constsdefs by definitions (also some old primrecs by modern ones)
haftmann
parents: 16417
diff changeset
    67
definition n_nodes_tail :: "i => i" where
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    68
   "n_nodes_tail(t) == n_nodes_aux(t) ` 0"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    69
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    70
lemma "t \<in> bt(A) ==> n_nodes_tail(t) = n_nodes(t)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    71
 by (simp add: n_nodes_tail_def n_nodes_aux_eq) 
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    72
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    73
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
    74
subsection \<open>Inductive definitions\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    75
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    76
consts  Fin       :: "i=>i"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    77
inductive
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    78
  domains   "Fin(A)" \<subseteq> "Pow(A)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    79
  intros
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    80
    emptyI:  "0 \<in> Fin(A)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    81
    consI:   "[| a \<in> A;  b \<in> Fin(A) |] ==> cons(a,b) \<in> Fin(A)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    82
  type_intros  empty_subsetI cons_subsetI PowI
46471
2289a3869c88 prefer high-level elim_format;
wenzelm
parents: 35416
diff changeset
    83
  type_elims   PowD [elim_format]
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    84
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    85
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    86
consts  acc :: "i => i"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    87
inductive
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    88
  domains "acc(r)" \<subseteq> "field(r)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    89
  intros
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    90
    vimage:  "[| r-``{a}: Pow(acc(r)); a \<in> field(r) |] ==> a \<in> acc(r)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    91
  monos      Pow_mono
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    92
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    93
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    94
consts
58860
fee7cfa69c50 eliminated spurious semicolons;
wenzelm
parents: 56451
diff changeset
    95
  llist  :: "i=>i"
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    96
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    97
codatatype
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    98
  "llist(A)" = LNil | LCons ("a \<in> A", "l \<in> llist(A)")
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
    99
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   100
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   101
(*Coinductive definition of equality*)
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   102
consts
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   103
  lleq :: "i=>i"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   104
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   105
(*Previously used <*> in the domain and variant pairs as elements.  But
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   106
  standard pairs work just as well.  To use variant pairs, must change prefix
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   107
  a q/Q to the Sigma, Pair and converse rules.*)
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   108
coinductive
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   109
  domains "lleq(A)" \<subseteq> "llist(A) * llist(A)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   110
  intros
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   111
    LNil:  "<LNil, LNil> \<in> lleq(A)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   112
    LCons: "[| a \<in> A; <l,l'> \<in> lleq(A) |] 
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   113
            ==> <LCons(a,l), LCons(a,l')> \<in> lleq(A)"
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   114
  type_intros  llist.intros
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   115
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   116
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
   117
subsection\<open>Powerset example\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   118
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   119
lemma Pow_mono: "A\<subseteq>B  ==>  Pow(A) \<subseteq> Pow(B)"
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   120
apply (rule subsetI)
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   121
apply (rule PowI)
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   122
apply (drule PowD)
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   123
apply (erule subset_trans, assumption)
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   124
done
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   125
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   126
lemma "Pow(A Int B) = Pow(A) Int Pow(B)"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   127
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   128
apply (rule equalityI)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   129
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   130
apply (rule Int_greatest)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   131
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   132
apply (rule Int_lower1 [THEN Pow_mono])
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   133
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   134
apply (rule Int_lower2 [THEN Pow_mono])
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   135
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   136
apply (rule subsetI)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   137
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   138
apply (erule IntE)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   139
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   140
apply (rule PowI)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   141
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   142
apply (drule PowD)+
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   143
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   144
apply (rule Int_greatest)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   145
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   146
apply (assumption+)
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   147
done
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   148
69505
cc2d676d5395 isabelle update_cartouches -t;
wenzelm
parents: 67443
diff changeset
   149
text\<open>Trying again from the beginning in order to use \<open>blast\<close>\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   150
lemma "Pow(A Int B) = Pow(A) Int Pow(B)"
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   151
by blast
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   153
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   154
lemma "C\<subseteq>D ==> Union(C) \<subseteq> Union(D)"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   155
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   156
apply (rule subsetI)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   157
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   158
apply (erule UnionE)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   159
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   160
apply (rule UnionI)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   161
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   162
apply (erule subsetD)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   163
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   164
apply assumption 
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   165
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   166
apply assumption 
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   167
done
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   168
67406
23307fd33906 isabelle update_cartouches -c;
wenzelm
parents: 65449
diff changeset
   169
text\<open>A more abstract version of the same proof\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   170
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   171
lemma "C\<subseteq>D ==> Union(C) \<subseteq> Union(D)"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   172
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   173
apply (rule Union_least)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   174
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   175
apply (rule Union_upper)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   176
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   177
apply (erule subsetD, assumption)
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   178
done
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   179
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   180
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   181
lemma "[| a \<in> A;  f \<in> A->B;  g \<in> C->D;  A \<inter> C = 0 |] ==> (f \<union> g)`a = f`a"
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   182
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   183
apply (rule apply_equality)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   184
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   185
apply (rule UnI1)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   186
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   187
apply (rule apply_Pair)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   188
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   189
apply assumption 
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   190
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   191
apply assumption 
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   192
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   193
apply (rule fun_disjoint_Un)
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   194
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   195
apply assumption 
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   196
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   197
apply assumption 
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67406
diff changeset
   198
  \<comment> \<open>@{subgoals[display,indent=0,margin=65]}\<close>
14159
e2eba24c8a2a final tweaks for Isar version
paulson
parents: 14152
diff changeset
   199
apply assumption 
14152
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   200
done
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   201
12f6f18e7afc For the Isar version of the ZF logics manual
paulson
parents:
diff changeset
   202
end