src/HOL/Univ.ML
author clasohm
Fri, 03 Mar 1995 12:02:25 +0100
changeset 923 ff1574a81019
child 972 e61b058d58d2
permissions -rw-r--r--
new version of HOL with curried function application
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/univ
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 univ.thy
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 Univ;
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
(** LEAST -- the least number operator **)
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    14
val [prem1,prem2] = goalw Univ.thy [Least_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
    "[| P(k);  !!x. x<k ==> ~P(x) |] ==> (LEAST x.P(x)) = k";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
by (rtac select_equality 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
by (fast_tac (HOL_cs addSIs [prem1,prem2]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
by (cut_facts_tac [less_linear] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
by (fast_tac (HOL_cs addSIs [prem1] addSDs [prem2]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
qed "Least_equality";
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
val [prem] = goal Univ.thy "P(k) ==> P(LEAST x.P(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
by (rtac (prem RS rev_mp) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
by (res_inst_tac [("n","k")] less_induct 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
by (rtac impI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    26
by (rtac classical 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    27
by (res_inst_tac [("s","n")] (Least_equality RS ssubst) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
by (assume_tac 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
by (assume_tac 2);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
by (fast_tac HOL_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
qed "LeastI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    32
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    33
(*Proof is almost identical to the one above!*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    34
val [prem] = goal Univ.thy "P(k) ==> (LEAST x.P(x)) <= k";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
by (rtac (prem RS rev_mp) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
by (res_inst_tac [("n","k")] less_induct 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    37
by (rtac impI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
by (rtac classical 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    39
by (res_inst_tac [("s","n")] (Least_equality RS ssubst) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
by (assume_tac 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    41
by (rtac le_refl 2);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
by (fast_tac (HOL_cs addIs [less_imp_le,le_trans]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    43
qed "Least_le";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    44
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    45
val [prem] = goal Univ.thy "k < (LEAST x.P(x)) ==> ~P(k)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    46
by (rtac notI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    47
by (etac (rewrite_rule [le_def] Least_le RS notE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
by (rtac prem 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
qed "not_less_Least";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    51
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    52
(** apfst -- can be used in similar type definitions **)
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
goalw Univ.thy [apfst_def] "apfst f <a,b> = <f(a),b>";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    55
by (rtac split 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
qed "apfst";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    57
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
val [major,minor] = goal Univ.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    59
    "[| q = apfst f p;  !!x y. [| p = <x,y>;  q = <f(x),y> |] ==> R \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    60
\    |] ==> R";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
by (rtac PairE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    62
by (rtac minor 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
by (assume_tac 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    64
by (rtac (major RS trans) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
by (etac ssubst 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
by (rtac apfst 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
qed "apfstE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    68
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    69
(** Push -- an injection, analogous to Cons on lists **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    70
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
val [major] = goalw Univ.thy [Push_def] "Push i f =Push j g  ==> i=j";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
by (rtac (major RS fun_cong RS box_equals RS Suc_inject) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    73
by (rtac nat_case_0 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    74
by (rtac nat_case_0 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    75
qed "Push_inject1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    76
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
val [major] = goalw Univ.thy [Push_def] "Push i f =Push j g  ==> f=g";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
by (rtac (major RS fun_cong RS ext RS box_equals) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
by (rtac (nat_case_Suc RS ext) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    80
by (rtac (nat_case_Suc RS ext) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
qed "Push_inject2";
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
val [major,minor] = goal Univ.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
    "[| Push i f =Push j g;  [| i=j;  f=g |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
by (rtac ((major RS Push_inject2) RS ((major RS Push_inject1) RS minor)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    87
qed "Push_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    88
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
val [major] = goalw Univ.thy [Push_def] "Push k f =(%z.0) ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    90
by (rtac (major RS fun_cong RS box_equals RS Suc_neq_Zero) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    91
by (rtac nat_case_0 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
by (rtac refl 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
qed "Push_neq_K0";
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
(*** Isomorphisms ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
goal Univ.thy "inj(Rep_Node)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    98
by (rtac inj_inverseI 1);	(*cannot combine by RS: multiple unifiers*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    99
by (rtac Rep_Node_inverse 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   100
qed "inj_Rep_Node";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   101
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   102
goal Univ.thy "inj_onto Abs_Node Node";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   103
by (rtac inj_onto_inverseI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   104
by (etac Abs_Node_inverse 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   105
qed "inj_onto_Abs_Node";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   106
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   107
val Abs_Node_inject = inj_onto_Abs_Node RS inj_ontoD;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   108
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   109
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   110
(*** Introduction rules for Node ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   111
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   112
goalw Univ.thy [Node_def] "<%k. 0,a> : Node";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   113
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   114
qed "Node_K0_I";
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
goalw Univ.thy [Node_def,Push_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   117
    "!!p. p: Node ==> apfst (Push i) p : Node";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   118
by (fast_tac (set_cs addSIs [apfst, nat_case_Suc RS trans]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   119
qed "Node_Push_I";
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   122
(*** Distinctness of constructors ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   123
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   124
(** Scons vs Atom **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   125
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   126
goalw Univ.thy [Atom_def,Scons_def,Push_Node_def] "(M$N) ~= Atom(a)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   127
by (rtac notI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   128
by (etac (equalityD2 RS subsetD RS UnE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   129
by (rtac singletonI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   130
by (REPEAT (eresolve_tac [imageE, Abs_Node_inject RS apfstE, 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   131
			  Pair_inject, sym RS Push_neq_K0] 1
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   132
     ORELSE resolve_tac [Node_K0_I, Rep_Node RS Node_Push_I] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
qed "Scons_not_Atom";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   134
bind_thm ("Atom_not_Scons", (Scons_not_Atom RS not_sym));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   135
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   136
bind_thm ("Scons_neq_Atom", (Scons_not_Atom RS notE));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   137
val Atom_neq_Scons = sym RS Scons_neq_Atom;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   138
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   139
(*** Injectiveness ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   140
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   141
(** Atomic nodes **)
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
goalw Univ.thy [Atom_def] "inj(Atom)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   144
by (rtac injI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   145
by (etac (singleton_inject RS Abs_Node_inject RS Pair_inject) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   146
by (REPEAT (ares_tac [Node_K0_I] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   147
qed "inj_Atom";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   148
val Atom_inject = inj_Atom RS injD;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   149
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   150
goalw Univ.thy [Leaf_def,o_def] "inj(Leaf)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   151
by (rtac injI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   152
by (etac (Atom_inject RS Inl_inject) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   153
qed "inj_Leaf";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   154
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   155
val Leaf_inject = inj_Leaf RS injD;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   156
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   157
goalw Univ.thy [Numb_def,o_def] "inj(Numb)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   158
by (rtac injI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   159
by (etac (Atom_inject RS Inr_inject) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   160
qed "inj_Numb";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   161
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   162
val Numb_inject = inj_Numb RS injD;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   163
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   164
(** Injectiveness of Push_Node **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   165
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   166
val [major,minor] = goalw Univ.thy [Push_Node_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   167
    "[| Push_Node i m =Push_Node j n;  [| i=j;  m=n |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   168
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   169
by (rtac (major RS Abs_Node_inject RS apfstE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   170
by (REPEAT (resolve_tac [Rep_Node RS Node_Push_I] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   171
by (etac (sym RS apfstE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   172
by (rtac minor 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   173
by (etac Pair_inject 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   174
by (etac (Push_inject1 RS sym) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   175
by (rtac (inj_Rep_Node RS injD) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   176
by (etac trans 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   177
by (safe_tac (HOL_cs addSEs [Pair_inject,Push_inject,sym]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   178
qed "Push_Node_inject";
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   181
(** Injectiveness of Scons **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   182
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   183
val [major] = goalw Univ.thy [Scons_def] "M$N <= M'$N' ==> M<=M'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   184
by (cut_facts_tac [major] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   185
by (fast_tac (set_cs addSDs [Suc_inject]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   186
		     addSEs [Push_Node_inject, Zero_neq_Suc]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   187
qed "Scons_inject_lemma1";
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
val [major] = goalw Univ.thy [Scons_def] "M$N <= M'$N' ==> N<=N'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   190
by (cut_facts_tac [major] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   191
by (fast_tac (set_cs addSDs [Suc_inject]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   192
		     addSEs [Push_Node_inject, Suc_neq_Zero]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   193
qed "Scons_inject_lemma2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   194
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   195
val [major] = goal Univ.thy "M$N = M'$N' ==> M=M'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   196
by (rtac (major RS equalityE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   197
by (REPEAT (ares_tac [equalityI, Scons_inject_lemma1] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   198
qed "Scons_inject1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   199
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   200
val [major] = goal Univ.thy "M$N = M'$N' ==> N=N'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   201
by (rtac (major RS equalityE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   202
by (REPEAT (ares_tac [equalityI, Scons_inject_lemma2] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   203
qed "Scons_inject2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   204
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   205
val [major,minor] = goal Univ.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   206
    "[| M$N = M'$N';  [| M=M';  N=N' |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   207
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   208
by (rtac ((major RS Scons_inject2) RS ((major RS Scons_inject1) RS minor)) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   209
qed "Scons_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   210
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   211
(*rewrite rules*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   212
goal Univ.thy "(Atom(a)=Atom(b)) = (a=b)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   213
by (fast_tac (HOL_cs addSEs [Atom_inject]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   214
qed "Atom_Atom_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   215
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   216
goal Univ.thy "(M$N = M'$N') = (M=M' & N=N')";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   217
by (fast_tac (HOL_cs addSEs [Scons_inject]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   218
qed "Scons_Scons_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   219
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   220
(*** Distinctness involving Leaf and Numb ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   221
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   222
(** Scons vs Leaf **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   223
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   224
goalw Univ.thy [Leaf_def,o_def] "(M$N) ~= Leaf(a)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   225
by (rtac Scons_not_Atom 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   226
qed "Scons_not_Leaf";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   227
bind_thm ("Leaf_not_Scons", (Scons_not_Leaf RS not_sym));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   228
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   229
bind_thm ("Scons_neq_Leaf", (Scons_not_Leaf RS notE));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   230
val Leaf_neq_Scons = sym RS Scons_neq_Leaf;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   231
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   232
(** Scons vs Numb **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   233
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   234
goalw Univ.thy [Numb_def,o_def] "(M$N) ~= Numb(k)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   235
by (rtac Scons_not_Atom 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   236
qed "Scons_not_Numb";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   237
bind_thm ("Numb_not_Scons", (Scons_not_Numb RS not_sym));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   238
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   239
bind_thm ("Scons_neq_Numb", (Scons_not_Numb RS notE));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   240
val Numb_neq_Scons = sym RS Scons_neq_Numb;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   241
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   242
(** Leaf vs Numb **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   243
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   244
goalw Univ.thy [Leaf_def,Numb_def] "Leaf(a) ~= Numb(k)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   245
by (simp_tac (HOL_ss addsimps [Atom_Atom_eq,Inl_not_Inr]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   246
qed "Leaf_not_Numb";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   247
bind_thm ("Numb_not_Leaf", (Leaf_not_Numb RS not_sym));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   248
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   249
bind_thm ("Leaf_neq_Numb", (Leaf_not_Numb RS notE));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   250
val Numb_neq_Leaf = sym RS Leaf_neq_Numb;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   251
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   252
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   253
(*** ndepth -- the depth of a node ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   254
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   255
val univ_simps = [apfst,Scons_not_Atom,Atom_not_Scons,Scons_Scons_eq];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   256
val univ_ss = nat_ss addsimps univ_simps;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   257
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   258
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   259
goalw Univ.thy [ndepth_def] "ndepth (Abs_Node(<%k.0, x>)) = 0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   260
by (sstac [Node_K0_I RS Abs_Node_inverse, split] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   261
by (rtac Least_equality 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   262
by (rtac refl 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   263
by (etac less_zeroE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   264
qed "ndepth_K0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   265
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   266
goal Univ.thy "k < Suc(LEAST x. f(x)=0) --> nat_case (Suc i) f k ~= 0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   267
by (nat_ind_tac "k" 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   268
by (ALLGOALS (simp_tac nat_ss));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   269
by (rtac impI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   270
by (etac not_less_Least 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   271
qed "ndepth_Push_lemma";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   272
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   273
goalw Univ.thy [ndepth_def,Push_Node_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   274
    "ndepth (Push_Node i n) = Suc(ndepth(n))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   275
by (stac (Rep_Node RS Node_Push_I RS Abs_Node_inverse) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   276
by (cut_facts_tac [rewrite_rule [Node_def] Rep_Node] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   277
by (safe_tac set_cs);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   278
be ssubst 1;  (*instantiates type variables!*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   279
by (simp_tac univ_ss 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   280
by (rtac Least_equality 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   281
by (rewtac Push_def);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   282
by (rtac (nat_case_Suc RS trans) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   283
by (etac LeastI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   284
by (etac (ndepth_Push_lemma RS mp) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   285
qed "ndepth_Push_Node";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   286
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   287
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   288
(*** ntrunc applied to the various node sets ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   289
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   290
goalw Univ.thy [ntrunc_def] "ntrunc 0 M = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   291
by (safe_tac (set_cs addSIs [equalityI] addSEs [less_zeroE]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   292
qed "ntrunc_0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   293
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   294
goalw Univ.thy [Atom_def,ntrunc_def] "ntrunc (Suc k) (Atom a) = Atom(a)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   295
by (safe_tac (set_cs addSIs [equalityI]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   296
by (stac ndepth_K0 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   297
by (rtac zero_less_Suc 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   298
qed "ntrunc_Atom";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   299
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   300
goalw Univ.thy [Leaf_def,o_def] "ntrunc (Suc k) (Leaf a) = Leaf(a)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   301
by (rtac ntrunc_Atom 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   302
qed "ntrunc_Leaf";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   303
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   304
goalw Univ.thy [Numb_def,o_def] "ntrunc (Suc k) (Numb i) = Numb(i)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   305
by (rtac ntrunc_Atom 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   306
qed "ntrunc_Numb";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   307
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   308
goalw Univ.thy [Scons_def,ntrunc_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   309
    "ntrunc (Suc k) (M$N) = ntrunc k M $ ntrunc k N";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   310
by (safe_tac (set_cs addSIs [equalityI,imageI]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   311
by (REPEAT (stac ndepth_Push_Node 3 THEN etac Suc_mono 3));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   312
by (REPEAT (rtac Suc_less_SucD 1 THEN 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   313
	    rtac (ndepth_Push_Node RS subst) 1 THEN 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   314
	    assume_tac 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   315
qed "ntrunc_Scons";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   316
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   317
(** Injection nodes **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   318
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   319
goalw Univ.thy [In0_def] "ntrunc (Suc 0) (In0 M) = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   320
by (simp_tac (univ_ss addsimps [ntrunc_Scons,ntrunc_0]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   321
by (rewtac Scons_def);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   322
by (safe_tac (set_cs addSIs [equalityI]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   323
qed "ntrunc_one_In0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   324
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   325
goalw Univ.thy [In0_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   326
    "ntrunc (Suc (Suc k)) (In0 M) = In0 (ntrunc (Suc k) M)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   327
by (simp_tac (univ_ss addsimps [ntrunc_Scons,ntrunc_Numb]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   328
qed "ntrunc_In0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   329
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   330
goalw Univ.thy [In1_def] "ntrunc (Suc 0) (In1 M) = {}";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   331
by (simp_tac (univ_ss addsimps [ntrunc_Scons,ntrunc_0]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   332
by (rewtac Scons_def);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   333
by (safe_tac (set_cs addSIs [equalityI]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   334
qed "ntrunc_one_In1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   335
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   336
goalw Univ.thy [In1_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   337
    "ntrunc (Suc (Suc k)) (In1 M) = In1 (ntrunc (Suc k) M)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   338
by (simp_tac (univ_ss addsimps [ntrunc_Scons,ntrunc_Numb]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   339
qed "ntrunc_In1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   340
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   341
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   342
(*** Cartesian Product ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   343
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   344
goalw Univ.thy [uprod_def] "!!M N. [| M:A;  N:B |] ==> (M$N) : A<*>B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   345
by (REPEAT (ares_tac [singletonI,UN_I] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   346
qed "uprodI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   347
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   348
(*The general elimination rule*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   349
val major::prems = goalw Univ.thy [uprod_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   350
    "[| c : A<*>B;  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   351
\       !!x y. [| x:A;  y:B;  c=x$y |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   352
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   353
by (cut_facts_tac [major] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   354
by (REPEAT (eresolve_tac [asm_rl,singletonE,UN_E] 1
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   355
     ORELSE resolve_tac prems 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   356
qed "uprodE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   357
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   358
(*Elimination of a pair -- introduces no eigenvariables*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   359
val prems = goal Univ.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   360
    "[| (M$N) : A<*>B;      [| M:A;  N:B |] ==> P   \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   361
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   362
by (rtac uprodE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   363
by (REPEAT (ares_tac prems 1 ORELSE eresolve_tac [Scons_inject,ssubst] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   364
qed "uprodE2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   365
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   366
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   367
(*** Disjoint Sum ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   368
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   369
goalw Univ.thy [usum_def] "!!M. M:A ==> In0(M) : A<+>B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   370
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   371
qed "usum_In0I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   372
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   373
goalw Univ.thy [usum_def] "!!N. N:B ==> In1(N) : A<+>B";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   374
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   375
qed "usum_In1I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   376
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   377
val major::prems = goalw Univ.thy [usum_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   378
    "[| u : A<+>B;  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   379
\       !!x. [| x:A;  u=In0(x) |] ==> P; \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   380
\       !!y. [| y:B;  u=In1(y) |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   381
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   382
by (rtac (major RS UnE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   383
by (REPEAT (rtac refl 1 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   384
     ORELSE eresolve_tac (prems@[imageE,ssubst]) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   385
qed "usumE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   386
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   387
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   388
(** Injection **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   389
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   390
goalw Univ.thy [In0_def,In1_def] "In0(M) ~= In1(N)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   391
by (rtac notI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   392
by (etac (Scons_inject1 RS Numb_inject RS Zero_neq_Suc) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   393
qed "In0_not_In1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   394
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   395
bind_thm ("In1_not_In0", (In0_not_In1 RS not_sym));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   396
bind_thm ("In0_neq_In1", (In0_not_In1 RS notE));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   397
val In1_neq_In0 = sym RS In0_neq_In1;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   398
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   399
val [major] = goalw Univ.thy [In0_def] "In0(M) = In0(N) ==>  M=N";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   400
by (rtac (major RS Scons_inject2) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   401
qed "In0_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   402
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   403
val [major] = goalw Univ.thy [In1_def] "In1(M) = In1(N) ==>  M=N";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   404
by (rtac (major RS Scons_inject2) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   405
qed "In1_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   406
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   407
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   408
(*** proving equality of sets and functions using ntrunc ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   409
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   410
goalw Univ.thy [ntrunc_def] "ntrunc k M <= M";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   411
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   412
qed "ntrunc_subsetI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   413
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   414
val [major] = goalw Univ.thy [ntrunc_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   415
    "(!!k. ntrunc k M <= N) ==> M<=N";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   416
by (fast_tac (set_cs addIs [less_add_Suc1, less_add_Suc2, 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   417
			    major RS subsetD]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   418
qed "ntrunc_subsetD";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   419
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   420
(*A generalized form of the take-lemma*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   421
val [major] = goal Univ.thy "(!!k. ntrunc k M = ntrunc k N) ==> M=N";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   422
by (rtac equalityI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   423
by (ALLGOALS (rtac ntrunc_subsetD));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   424
by (ALLGOALS (rtac (ntrunc_subsetI RSN (2, subset_trans))));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   425
by (rtac (major RS equalityD1) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   426
by (rtac (major RS equalityD2) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   427
qed "ntrunc_equality";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   428
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   429
val [major] = goalw Univ.thy [o_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   430
    "[| !!k. (ntrunc(k) o h1) = (ntrunc(k) o h2) |] ==> h1=h2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   431
by (rtac (ntrunc_equality RS ext) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   432
by (rtac (major RS fun_cong) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   433
qed "ntrunc_o_equality";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   434
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   435
(*** Monotonicity ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   436
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   437
goalw Univ.thy [uprod_def] "!!A B. [| A<=A';  B<=B' |] ==> A<*>B <= A'<*>B'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   438
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   439
qed "uprod_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   440
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   441
goalw Univ.thy [usum_def] "!!A B. [| A<=A';  B<=B' |] ==> A<+>B <= A'<+>B'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   442
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   443
qed "usum_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   444
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   445
goalw Univ.thy [Scons_def] "!!M N. [| M<=M';  N<=N' |] ==> M$N <= M'$N'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   446
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   447
qed "Scons_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   448
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   449
goalw Univ.thy [In0_def] "!!M N. M<=N ==> In0(M) <= In0(N)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   450
by (REPEAT (ares_tac [subset_refl,Scons_mono] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   451
qed "In0_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   452
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   453
goalw Univ.thy [In1_def] "!!M N. M<=N ==> In1(M) <= In1(N)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   454
by (REPEAT (ares_tac [subset_refl,Scons_mono] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   455
qed "In1_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   456
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   457
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   458
(*** Split and Case ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   459
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   460
goalw Univ.thy [Split_def] "Split c (M$N) = c M N";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   461
by (fast_tac (set_cs addIs [select_equality] addEs [Scons_inject]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   462
qed "Split";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   463
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   464
goalw Univ.thy [Case_def] "Case c d (In0 M) = c(M)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   465
by (fast_tac (set_cs addIs [select_equality] 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   466
		     addEs [make_elim In0_inject, In0_neq_In1]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   467
qed "Case_In0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   468
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   469
goalw Univ.thy [Case_def] "Case c d (In1 N) = d(N)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   470
by (fast_tac (set_cs addIs [select_equality] 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   471
		     addEs [make_elim In1_inject, In1_neq_In0]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   472
qed "Case_In1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   473
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   474
(**** UN x. B(x) rules ****)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   475
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   476
goalw Univ.thy [ntrunc_def] "ntrunc k (UN x.f(x)) = (UN x. ntrunc k (f x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   477
by (fast_tac (set_cs addIs [equalityI]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   478
qed "ntrunc_UN1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   479
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   480
goalw Univ.thy [Scons_def] "(UN x.f(x)) $ M = (UN x. f(x) $ M)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   481
by (fast_tac (set_cs addIs [equalityI]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   482
qed "Scons_UN1_x";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   483
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   484
goalw Univ.thy [Scons_def] "M $ (UN x.f(x)) = (UN x. M $ f(x))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   485
by (fast_tac (set_cs addIs [equalityI]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   486
qed "Scons_UN1_y";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   487
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   488
goalw Univ.thy [In0_def] "In0(UN x.f(x)) = (UN x. In0(f(x)))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   489
br Scons_UN1_y 1;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   490
qed "In0_UN1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   491
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   492
goalw Univ.thy [In1_def] "In1(UN x.f(x)) = (UN x. In1(f(x)))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   493
br Scons_UN1_y 1;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   494
qed "In1_UN1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   495
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   496
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   497
(*** Equality : the diagonal relation ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   498
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   499
goalw Univ.thy [diag_def] "!!a A. [| a=b;  a:A |] ==> <a,b> : diag(A)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   500
by (fast_tac set_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   501
qed "diag_eqI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   502
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   503
val diagI = refl RS diag_eqI |> standard;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   504
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   505
(*The general elimination rule*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   506
val major::prems = goalw Univ.thy [diag_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   507
    "[| c : diag(A);  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   508
\       !!x y. [| x:A;  c = <x,x> |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   509
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   510
by (rtac (major RS UN_E) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   511
by (REPEAT (eresolve_tac [asm_rl,singletonE] 1 ORELSE resolve_tac prems 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   512
qed "diagE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   513
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   514
(*** Equality for Cartesian Product ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   515
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   516
goalw Univ.thy [dprod_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   517
    "!!r s. [| <M,M'>:r;  <N,N'>:s |] ==> <M$N, M'$N'> : r<**>s";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   518
by (fast_tac prod_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   519
qed "dprodI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   520
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   521
(*The general elimination rule*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   522
val major::prems = goalw Univ.thy [dprod_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   523
    "[| c : r<**>s;  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   524
\       !!x y x' y'. [| <x,x'> : r;  <y,y'> : s;  c = <x$y,x'$y'> |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   525
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   526
by (cut_facts_tac [major] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   527
by (REPEAT_FIRST (eresolve_tac [asm_rl, UN_E, mem_splitE, singletonE]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   528
by (REPEAT (ares_tac prems 1 ORELSE hyp_subst_tac 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   529
qed "dprodE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   530
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   531
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   532
(*** Equality for Disjoint Sum ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   533
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   534
goalw Univ.thy [dsum_def]  "!!r. <M,M'>:r ==> <In0(M), In0(M')> : r<++>s";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   535
by (fast_tac prod_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   536
qed "dsum_In0I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   537
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   538
goalw Univ.thy [dsum_def]  "!!r. <N,N'>:s ==> <In1(N), In1(N')> : r<++>s";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   539
by (fast_tac prod_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   540
qed "dsum_In1I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   541
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   542
val major::prems = goalw Univ.thy [dsum_def]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   543
    "[| w : r<++>s;  \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   544
\       !!x x'. [| <x,x'> : r;  w = <In0(x), In0(x')> |] ==> P; \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   545
\       !!y y'. [| <y,y'> : s;  w = <In1(y), In1(y')> |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   546
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   547
by (cut_facts_tac [major] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   548
by (REPEAT_FIRST (eresolve_tac [asm_rl, UN_E, UnE, mem_splitE, singletonE]));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   549
by (DEPTH_SOLVE (ares_tac prems 1 ORELSE hyp_subst_tac 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   550
qed "dsumE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   551
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   552
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   553
val univ_cs =
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   554
    prod_cs addSIs [diagI, uprodI, dprodI]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   555
            addIs  [usum_In0I, usum_In1I, dsum_In0I, dsum_In1I]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   556
            addSEs [diagE, uprodE, dprodE, usumE, dsumE];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   557
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   558
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   559
(*** Monotonicity ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   560
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   561
goal Univ.thy "!!r s. [| r<=r';  s<=s' |] ==> r<**>s <= r'<**>s'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   562
by (fast_tac univ_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   563
qed "dprod_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   564
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   565
goal Univ.thy "!!r s. [| r<=r';  s<=s' |] ==> r<++>s <= r'<++>s'";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   566
by (fast_tac univ_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   567
qed "dsum_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   568
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   569
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   570
(*** Bounding theorems ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   571
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   572
goal Univ.thy "diag(A) <= Sigma A (%x.A)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   573
by (fast_tac univ_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   574
qed "diag_subset_Sigma";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   575
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   576
goal Univ.thy "(Sigma A (%x.B) <**> Sigma C (%x.D)) <= Sigma (A<*>C) (%z. B<*>D)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   577
by (fast_tac univ_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   578
qed "dprod_Sigma";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   579
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   580
val dprod_subset_Sigma = [dprod_mono, dprod_Sigma] MRS subset_trans |>standard;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   581
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   582
(*Dependent version*)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   583
goal Univ.thy
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   584
    "(Sigma A B <**> Sigma C D) <= Sigma (A<*>C) (Split(%x y. B(x)<*>D(y)))";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   585
by (safe_tac univ_cs);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   586
by (stac Split 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   587
by (fast_tac univ_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   588
qed "dprod_subset_Sigma2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   589
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   590
goal Univ.thy "(Sigma A (%x.B) <++> Sigma C (%x.D)) <= Sigma (A<+>C) (%z. B<+>D)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   591
by (fast_tac univ_cs 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   592
qed "dsum_Sigma";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   593
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   594
val dsum_subset_Sigma = [dsum_mono, dsum_Sigma] MRS subset_trans |> standard;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   595
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   596
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   597
(*** Domain ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   598
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   599
goal Univ.thy "fst `` diag(A) = A";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   600
by (fast_tac (prod_cs addIs [equalityI, diagI] addSEs [diagE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   601
qed "fst_image_diag";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   602
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   603
goal Univ.thy "fst `` (r<**>s) = (fst``r) <*> (fst``s)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   604
by (fast_tac (prod_cs addIs [equalityI, uprodI, dprodI]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   605
                     addSEs [uprodE, dprodE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   606
qed "fst_image_dprod";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   607
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   608
goal Univ.thy "fst `` (r<++>s) = (fst``r) <+> (fst``s)";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   609
by (fast_tac (prod_cs addIs [equalityI, usum_In0I, usum_In1I, 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   610
			     dsum_In0I, dsum_In1I]
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   611
                     addSEs [usumE, dsumE]) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   612
qed "fst_image_dsum";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   613
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   614
val fst_image_simps = [fst_image_diag, fst_image_dprod, fst_image_dsum];
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   615
val fst_image_ss = univ_ss addsimps fst_image_simps;