src/HOL/Sum.ML
author lcp
Tue, 25 Jul 1995 16:59:08 +0200
changeset 1188 0443e4dc8511
parent 923 ff1574a81019
child 1264 3eb91524b938
permissions -rw-r--r--
Added Part_Int and Part_Collect for inductive definitions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     1
(*  Title: 	HOL/Sum.ML
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1991  University of Cambridge
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     5
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     6
For Sum.thy.  The disjoint sum of two types
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     9
open Sum;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    11
(** Inl_Rep and Inr_Rep: Representations of the constructors **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    13
(*This counts as a non-emptiness result for admitting 'a+'b as a type*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
goalw Sum.thy [Sum_def] "Inl_Rep(a) : Sum";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
by (EVERY1 [rtac CollectI, rtac disjI1, rtac exI, rtac refl]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
qed "Inl_RepI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
goalw Sum.thy [Sum_def] "Inr_Rep(b) : Sum";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
by (EVERY1 [rtac CollectI, rtac disjI2, rtac exI, rtac refl]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
qed "Inr_RepI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    21
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    22
goal Sum.thy "inj_onto Abs_Sum Sum";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
by (rtac inj_onto_inverseI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
by (etac Abs_Sum_inverse 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
qed "inj_onto_Abs_Sum";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
(** Distinctness of Inl and Inr **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
goalw Sum.thy [Inl_Rep_def, Inr_Rep_def] "Inl_Rep(a) ~= Inr_Rep(b)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
by (EVERY1 [rtac notI,
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
	    etac (fun_cong RS fun_cong RS fun_cong RS iffE), 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
	    rtac (notE RS ccontr),  etac (mp RS conjunct2), 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
	    REPEAT o (ares_tac [refl,conjI]) ]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
qed "Inl_Rep_not_Inr_Rep";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
goalw Sum.thy [Inl_def,Inr_def] "Inl(a) ~= Inr(b)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    37
by (rtac (inj_onto_Abs_Sum RS inj_onto_contraD) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
by (rtac Inl_Rep_not_Inr_Rep 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
by (rtac Inl_RepI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
by (rtac Inr_RepI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    41
qed "Inl_not_Inr";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
bind_thm ("Inl_neq_Inr", (Inl_not_Inr RS notE));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    44
val Inr_neq_Inl = sym RS Inl_neq_Inr;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    45
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    46
goal Sum.thy "(Inl(a)=Inr(b)) = False";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
by (simp_tac (HOL_ss addsimps [Inl_not_Inr]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
qed "Inl_Inr_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
goal Sum.thy "(Inr(b)=Inl(a))  =  False";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
by (simp_tac (HOL_ss addsimps [Inl_not_Inr RS not_sym]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
qed "Inr_Inl_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    54
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
(** Injectiveness of Inl and Inr **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    57
val [major] = goalw Sum.thy [Inl_Rep_def] "Inl_Rep(a) = Inl_Rep(c) ==> a=c";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
by (rtac (major RS fun_cong RS fun_cong RS fun_cong RS iffE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
by (fast_tac HOL_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
qed "Inl_Rep_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
val [major] = goalw Sum.thy [Inr_Rep_def] "Inr_Rep(b) = Inr_Rep(d) ==> b=d";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
by (rtac (major RS fun_cong RS fun_cong RS fun_cong RS iffE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
by (fast_tac HOL_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
qed "Inr_Rep_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
goalw Sum.thy [Inl_def] "inj(Inl)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    68
by (rtac injI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
by (etac (inj_onto_Abs_Sum RS inj_ontoD RS Inl_Rep_inject) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
by (rtac Inl_RepI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
by (rtac Inl_RepI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
qed "inj_Inl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
val Inl_inject = inj_Inl RS injD;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    74
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    75
goalw Sum.thy [Inr_def] "inj(Inr)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    76
by (rtac injI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
by (etac (inj_onto_Abs_Sum RS inj_ontoD RS Inr_Rep_inject) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
by (rtac Inr_RepI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
by (rtac Inr_RepI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    80
qed "inj_Inr";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
val Inr_inject = inj_Inr RS injD;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    82
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    83
goal Sum.thy "(Inl(x)=Inl(y)) = (x=y)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
by (fast_tac (HOL_cs addSEs [Inl_inject]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
qed "Inl_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    87
goal Sum.thy "(Inr(x)=Inr(y)) = (x=y)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
by (fast_tac (HOL_cs addSEs [Inr_inject]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
qed "Inr_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    90
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    91
(*** Rules for the disjoint sum of two SETS ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
(** Introduction rules for the injections **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    94
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    95
goalw Sum.thy [sum_def] "!!a A B. a : A ==> Inl(a) : A plus B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
by (REPEAT (ares_tac [UnI1,imageI] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
qed "InlI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    99
goalw Sum.thy [sum_def] "!!b A B. b : B ==> Inr(b) : A plus B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   100
by (REPEAT (ares_tac [UnI2,imageI] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   101
qed "InrI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   102
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   103
(** Elimination rules **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   104
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   105
val major::prems = goalw Sum.thy [sum_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   106
    "[| u: A plus B;  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   107
\       !!x. [| x:A;  u=Inl(x) |] ==> P; \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   108
\       !!y. [| y:B;  u=Inr(y) |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   109
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   110
by (rtac (major RS UnE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   111
by (REPEAT (rtac refl 1
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   112
     ORELSE eresolve_tac (prems@[imageE,ssubst]) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   113
qed "plusE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   114
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   115
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   116
val sum_cs = set_cs addSIs [InlI, InrI] 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   117
                    addSEs [plusE, Inl_neq_Inr, Inr_neq_Inl]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   118
                    addSDs [Inl_inject, Inr_inject];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   119
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   120
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   121
(** sum_case -- the selection operator for sums **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   122
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   123
goalw Sum.thy [sum_case_def] "sum_case f g (Inl x) = f(x)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   124
by (fast_tac (sum_cs addIs [select_equality]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   125
qed "sum_case_Inl";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   126
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   127
goalw Sum.thy [sum_case_def] "sum_case f g (Inr x) = g(x)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   128
by (fast_tac (sum_cs addIs [select_equality]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   129
qed "sum_case_Inr";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   130
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   131
(** Exhaustion rule for sums -- a degenerate form of induction **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   132
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
val prems = goalw Sum.thy [Inl_def,Inr_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   134
    "[| !!x::'a. s = Inl(x) ==> P;  !!y::'b. s = Inr(y) ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   135
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   136
by (rtac (rewrite_rule [Sum_def] Rep_Sum RS CollectE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   137
by (REPEAT (eresolve_tac [disjE,exE] 1
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   138
     ORELSE EVERY1 [resolve_tac prems, 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   139
		    etac subst,
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   140
		    rtac (Rep_Sum_inverse RS sym)]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   141
qed "sumE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   142
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   143
goal Sum.thy "sum_case (%x::'a. f(Inl x)) (%y::'b. f(Inr y)) s = f(s)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   144
by (EVERY1 [res_inst_tac [("s","s")] sumE, 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   145
	    etac ssubst, rtac sum_case_Inl,
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   146
	    etac ssubst, rtac sum_case_Inr]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   147
qed "surjective_sum";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   148
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   149
goal Sum.thy "R(sum_case f g s) = \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   150
\             ((! x. s = Inl(x) --> R(f(x))) & (! y. s = Inr(y) --> R(g(y))))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   151
by (rtac sumE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   152
by (etac ssubst 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   153
by (stac sum_case_Inl 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   154
by (fast_tac (set_cs addSEs [make_elim Inl_inject, Inl_neq_Inr]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   155
by (etac ssubst 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   156
by (stac sum_case_Inr 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   157
by (fast_tac (set_cs addSEs [make_elim Inr_inject, Inr_neq_Inl]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   158
qed "expand_sum_case";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   159
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   160
val sum_ss = prod_ss addsimps [Inl_eq, Inr_eq, Inl_Inr_eq, Inr_Inl_eq, 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   161
			       sum_case_Inl, sum_case_Inr];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   162
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   163
(*Prevents simplification of f and g: much faster*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   164
qed_goal "sum_case_weak_cong" Sum.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   165
  "s=t ==> sum_case f g s = sum_case f g t"
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   166
  (fn [prem] => [rtac (prem RS arg_cong) 1]);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   167
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   168
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   169
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   170
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   171
(** Rules for the Part primitive **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   172
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   173
goalw Sum.thy [Part_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   174
    "!!a b A h. [| a : A;  a=h(b) |] ==> a : Part A h";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   175
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   176
qed "Part_eqI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   177
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   178
val PartI = refl RSN (2,Part_eqI);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   179
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   180
val major::prems = goalw Sum.thy [Part_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   181
    "[| a : Part A h;  !!z. [| a : A;  a=h(z) |] ==> P  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   182
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   183
by (rtac (major RS IntE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   184
by (etac CollectE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   185
by (etac exE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   186
by (REPEAT (ares_tac prems 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   187
qed "PartE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   188
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   189
goalw Sum.thy [Part_def] "Part A h <= A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   190
by (rtac Int_lower1 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   191
qed "Part_subset";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   192
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   193
goal Sum.thy "!!A B. A<=B ==> Part A h <= Part B h";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   194
by (fast_tac (set_cs addSIs [PartI] addSEs [PartE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   195
qed "Part_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   196
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   197
goalw Sum.thy [Part_def] "!!a. a : Part A h ==> a : A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   198
by (etac IntD1 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   199
qed "PartD1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   200
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   201
goal Sum.thy "Part A (%x.x) = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   202
by (fast_tac (set_cs addIs [PartI,equalityI] addSEs [PartE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   203
qed "Part_id";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   204
1188
0443e4dc8511 Added Part_Int and Part_Collect for inductive definitions
lcp
parents: 923
diff changeset
   205
goal Sum.thy "Part (A Int B) h = (Part A h) Int (Part B h)";
0443e4dc8511 Added Part_Int and Part_Collect for inductive definitions
lcp
parents: 923
diff changeset
   206
by (fast_tac (set_cs addIs [PartI,equalityI] addSEs [PartE]) 1);
0443e4dc8511 Added Part_Int and Part_Collect for inductive definitions
lcp
parents: 923
diff changeset
   207
qed "Part_Int";
0443e4dc8511 Added Part_Int and Part_Collect for inductive definitions
lcp
parents: 923
diff changeset
   208
0443e4dc8511 Added Part_Int and Part_Collect for inductive definitions
lcp
parents: 923
diff changeset
   209
(*For inductive definitions*)
0443e4dc8511 Added Part_Int and Part_Collect for inductive definitions
lcp
parents: 923
diff changeset
   210
goal Sum.thy "Part (A Int {x.P x}) h = (Part A h) Int {x.P x}";
0443e4dc8511 Added Part_Int and Part_Collect for inductive definitions
lcp
parents: 923
diff changeset
   211
by (fast_tac (set_cs addIs [PartI,equalityI] addSEs [PartE]) 1);
0443e4dc8511 Added Part_Int and Part_Collect for inductive definitions
lcp
parents: 923
diff changeset
   212
qed "Part_Collect";