src/HOLCF/sprod2.ML
author paulson
Mon Dec 07 18:26:25 1998 +0100 (1998-12-07)
changeset 6019 0e55c2fb2ebb
parent 243 c22b85994e17
permissions -rw-r--r--
tidying
nipkow@243
     1
(*  Title: 	HOLCF/sprod2.ML
nipkow@243
     2
    ID:         $Id$
nipkow@243
     3
    Author: 	Franz Regensburger
nipkow@243
     4
    Copyright   1993 Technische Universitaet Muenchen
nipkow@243
     5
nipkow@243
     6
Lemmas for sprod2.thy
nipkow@243
     7
*)
nipkow@243
     8
nipkow@243
     9
nipkow@243
    10
open Sprod2;
nipkow@243
    11
nipkow@243
    12
(* ------------------------------------------------------------------------ *)
nipkow@243
    13
(* access to less_sprod in class po                                         *)
nipkow@243
    14
(* ------------------------------------------------------------------------ *)
nipkow@243
    15
nipkow@243
    16
val less_sprod3a = prove_goal Sprod2.thy 
nipkow@243
    17
	"p1=Ispair(UU,UU) ==> p1 << p2"
nipkow@243
    18
(fn prems =>
nipkow@243
    19
	[
nipkow@243
    20
	(cut_facts_tac prems 1),
nipkow@243
    21
	(rtac (inst_sprod_po RS ssubst) 1),
nipkow@243
    22
	(etac less_sprod1a 1)
nipkow@243
    23
	]);
nipkow@243
    24
nipkow@243
    25
nipkow@243
    26
val less_sprod3b = prove_goal Sprod2.thy
nipkow@243
    27
 "~p1=Ispair(UU,UU) ==>\
nipkow@243
    28
\	(p1<<p2) = (Isfst(p1)<<Isfst(p2) & Issnd(p1)<<Issnd(p2))" 
nipkow@243
    29
(fn prems =>
nipkow@243
    30
	[
nipkow@243
    31
	(cut_facts_tac prems 1),
nipkow@243
    32
	(rtac (inst_sprod_po RS ssubst) 1),
nipkow@243
    33
	(etac less_sprod1b 1)
nipkow@243
    34
	]);
nipkow@243
    35
nipkow@243
    36
val less_sprod4b = prove_goal Sprod2.thy 
nipkow@243
    37
	"p << Ispair(UU,UU) ==> p = Ispair(UU,UU)"
nipkow@243
    38
(fn prems =>
nipkow@243
    39
	[
nipkow@243
    40
	(cut_facts_tac prems 1),
nipkow@243
    41
	(rtac less_sprod2b 1),
nipkow@243
    42
	(etac (inst_sprod_po RS subst) 1)
nipkow@243
    43
	]);
nipkow@243
    44
nipkow@243
    45
val less_sprod4a = (less_sprod4b RS defined_Ispair_rev);
nipkow@243
    46
(* Ispair(?a,?b) << Ispair(UU,UU) ==> ?a = UU | ?b = UU *)
nipkow@243
    47
nipkow@243
    48
val less_sprod4c = prove_goal Sprod2.thy
nipkow@243
    49
 "[|Ispair(xa,ya)<<Ispair(x,y);~xa=UU;~ya=UU;~x=UU;~y=UU|] ==>\
nipkow@243
    50
\		xa<<x & ya << y"
nipkow@243
    51
(fn prems =>
nipkow@243
    52
	[
nipkow@243
    53
	(cut_facts_tac prems 1),
nipkow@243
    54
	(rtac less_sprod2c 1),
nipkow@243
    55
	(etac (inst_sprod_po RS subst) 1),
nipkow@243
    56
	(REPEAT (atac 1))
nipkow@243
    57
	]);
nipkow@243
    58
nipkow@243
    59
(* ------------------------------------------------------------------------ *)
nipkow@243
    60
(* type sprod is pointed                                                    *)
nipkow@243
    61
(* ------------------------------------------------------------------------ *)
nipkow@243
    62
nipkow@243
    63
val minimal_sprod = prove_goal Sprod2.thy  "Ispair(UU,UU)<<p"
nipkow@243
    64
(fn prems =>
nipkow@243
    65
	[
nipkow@243
    66
	(rtac less_sprod3a 1),
nipkow@243
    67
	(rtac refl 1)
nipkow@243
    68
	]);
nipkow@243
    69
nipkow@243
    70
(* ------------------------------------------------------------------------ *)
nipkow@243
    71
(* Ispair is monotone in both arguments                                     *)
nipkow@243
    72
(* ------------------------------------------------------------------------ *)
nipkow@243
    73
nipkow@243
    74
val monofun_Ispair1 = prove_goalw Sprod2.thy [monofun] "monofun(Ispair)"
nipkow@243
    75
(fn prems =>
nipkow@243
    76
	[
nipkow@243
    77
	(strip_tac 1),
nipkow@243
    78
	(rtac (less_fun RS iffD2) 1),
nipkow@243
    79
	(strip_tac 1),
nipkow@243
    80
	(res_inst_tac [("Q",
nipkow@243
    81
	" Ispair(y,xa) =Ispair(UU,UU)")] (excluded_middle RS disjE) 1),
nipkow@243
    82
	(res_inst_tac [("Q",
nipkow@243
    83
	" Ispair(x,xa) =Ispair(UU,UU)")] (excluded_middle RS disjE) 1),
nipkow@243
    84
	(rtac (less_sprod3b RS iffD2) 1),
nipkow@243
    85
	(atac 1),
nipkow@243
    86
	(rtac conjI 1),
nipkow@243
    87
	(rtac (Isfst RS ssubst) 1),
nipkow@243
    88
	(etac (strict_Ispair_rev RS conjunct1) 1),
nipkow@243
    89
	(etac (strict_Ispair_rev RS conjunct2) 1),
nipkow@243
    90
	(rtac (Isfst RS ssubst) 1),
nipkow@243
    91
	(etac (strict_Ispair_rev RS conjunct1) 1),
nipkow@243
    92
	(etac (strict_Ispair_rev RS conjunct2) 1),
nipkow@243
    93
	(atac 1),
nipkow@243
    94
	(rtac (Issnd RS ssubst) 1),
nipkow@243
    95
	(etac (strict_Ispair_rev RS conjunct1) 1),
nipkow@243
    96
	(etac (strict_Ispair_rev RS conjunct2) 1),
nipkow@243
    97
	(rtac (Issnd RS ssubst) 1),
nipkow@243
    98
	(etac (strict_Ispair_rev RS conjunct1) 1),
nipkow@243
    99
	(etac (strict_Ispair_rev RS conjunct2) 1),
nipkow@243
   100
	(rtac refl_less 1),
nipkow@243
   101
	(etac less_sprod3a 1),
nipkow@243
   102
	(res_inst_tac [("Q",
nipkow@243
   103
	" Ispair(x,xa) =Ispair(UU,UU)")] (excluded_middle RS disjE) 1),
nipkow@243
   104
	(etac less_sprod3a 2),
nipkow@243
   105
	(res_inst_tac [("P","Ispair(y,xa) = Ispair(UU,UU)")] notE 1),
nipkow@243
   106
	(atac 2),
nipkow@243
   107
	(rtac defined_Ispair 1),
nipkow@243
   108
	(etac notUU_I 1),
nipkow@243
   109
	(etac (strict_Ispair_rev RS  conjunct1) 1),
nipkow@243
   110
	(etac (strict_Ispair_rev RS  conjunct2) 1)
nipkow@243
   111
	]);
nipkow@243
   112
nipkow@243
   113
nipkow@243
   114
val monofun_Ispair2 = prove_goalw Sprod2.thy [monofun] "monofun(Ispair(x))"
nipkow@243
   115
(fn prems =>
nipkow@243
   116
	[
nipkow@243
   117
	(strip_tac 1),
nipkow@243
   118
	(res_inst_tac [("Q",
nipkow@243
   119
	" Ispair(x,y) =Ispair(UU,UU)")] (excluded_middle RS disjE) 1),
nipkow@243
   120
	(res_inst_tac [("Q",
nipkow@243
   121
	" Ispair(x,xa) =Ispair(UU,UU)")] (excluded_middle RS disjE) 1),
nipkow@243
   122
	(rtac (less_sprod3b RS iffD2) 1),
nipkow@243
   123
	(atac 1),
nipkow@243
   124
	(rtac conjI 1),
nipkow@243
   125
	(rtac (Isfst RS ssubst) 1),
nipkow@243
   126
	(etac (strict_Ispair_rev RS conjunct1) 1),
nipkow@243
   127
	(etac (strict_Ispair_rev RS conjunct2) 1),
nipkow@243
   128
	(rtac (Isfst RS ssubst) 1),
nipkow@243
   129
	(etac (strict_Ispair_rev RS conjunct1) 1),
nipkow@243
   130
	(etac (strict_Ispair_rev RS conjunct2) 1),
nipkow@243
   131
	(rtac refl_less 1),
nipkow@243
   132
	(rtac (Issnd RS ssubst) 1),
nipkow@243
   133
	(etac (strict_Ispair_rev RS conjunct1) 1),
nipkow@243
   134
	(etac (strict_Ispair_rev RS conjunct2) 1),
nipkow@243
   135
	(rtac (Issnd RS ssubst) 1),
nipkow@243
   136
	(etac (strict_Ispair_rev RS conjunct1) 1),
nipkow@243
   137
	(etac (strict_Ispair_rev RS conjunct2) 1),
nipkow@243
   138
	(atac 1),
nipkow@243
   139
	(etac less_sprod3a 1),
nipkow@243
   140
	(res_inst_tac [("Q",
nipkow@243
   141
	" Ispair(x,xa) =Ispair(UU,UU)")] (excluded_middle RS disjE) 1),
nipkow@243
   142
	(etac less_sprod3a 2),
nipkow@243
   143
	(res_inst_tac [("P","Ispair(x,y) = Ispair(UU,UU)")] notE 1),
nipkow@243
   144
	(atac 2),
nipkow@243
   145
	(rtac defined_Ispair 1),
nipkow@243
   146
	(etac (strict_Ispair_rev RS  conjunct1) 1),
nipkow@243
   147
	(etac notUU_I 1),
nipkow@243
   148
	(etac (strict_Ispair_rev RS  conjunct2) 1)
nipkow@243
   149
	]);
nipkow@243
   150
nipkow@243
   151
val  monofun_Ispair = prove_goal Sprod2.thy 
nipkow@243
   152
 "[|x1<<x2; y1<<y2|] ==> Ispair(x1,y1)<<Ispair(x2,y2)"
nipkow@243
   153
(fn prems =>
nipkow@243
   154
	[
nipkow@243
   155
	(cut_facts_tac prems 1),
nipkow@243
   156
	(rtac trans_less 1),
nipkow@243
   157
	(rtac (monofun_Ispair1 RS monofunE RS spec RS spec RS mp RS 
nipkow@243
   158
	(less_fun RS iffD1 RS spec)) 1),
nipkow@243
   159
	(rtac (monofun_Ispair2 RS monofunE RS spec RS spec RS mp) 2),
nipkow@243
   160
	(atac 1),
nipkow@243
   161
	(atac 1)
nipkow@243
   162
	]);
nipkow@243
   163
nipkow@243
   164
nipkow@243
   165
(* ------------------------------------------------------------------------ *)
nipkow@243
   166
(* Isfst and Issnd are monotone                                             *)
nipkow@243
   167
(* ------------------------------------------------------------------------ *)
nipkow@243
   168
nipkow@243
   169
val  monofun_Isfst = prove_goalw Sprod2.thy [monofun] "monofun(Isfst)"
nipkow@243
   170
(fn prems =>
nipkow@243
   171
	[
nipkow@243
   172
	(strip_tac 1),
nipkow@243
   173
	(res_inst_tac [("p","x")] IsprodE 1),
nipkow@243
   174
	(hyp_subst_tac 1),
nipkow@243
   175
	(rtac trans_less 1),
nipkow@243
   176
	(rtac minimal 2),
nipkow@243
   177
	(rtac (strict_Isfst1 RS ssubst) 1),
nipkow@243
   178
	(rtac refl_less 1),
nipkow@243
   179
	(hyp_subst_tac 1),
nipkow@243
   180
	(res_inst_tac [("p","y")] IsprodE 1),
nipkow@243
   181
	(hyp_subst_tac 1),
nipkow@243
   182
	(res_inst_tac [("t","Isfst(Ispair(xa,ya))")] subst 1),
nipkow@243
   183
	(rtac refl_less 2),
nipkow@243
   184
	(etac (less_sprod4b RS sym RS arg_cong) 1),
nipkow@243
   185
	(hyp_subst_tac 1),
nipkow@243
   186
	(rtac (Isfst RS ssubst) 1),
nipkow@243
   187
	(atac 1),
nipkow@243
   188
	(atac 1),
nipkow@243
   189
	(rtac (Isfst RS ssubst) 1),
nipkow@243
   190
	(atac 1),
nipkow@243
   191
	(atac 1),
nipkow@243
   192
	(etac (less_sprod4c RS  conjunct1) 1),
nipkow@243
   193
	(REPEAT (atac 1))
nipkow@243
   194
	]);
nipkow@243
   195
nipkow@243
   196
val monofun_Issnd = prove_goalw Sprod2.thy [monofun] "monofun(Issnd)"
nipkow@243
   197
(fn prems =>
nipkow@243
   198
	[
nipkow@243
   199
	(strip_tac 1),
nipkow@243
   200
	(res_inst_tac [("p","x")] IsprodE 1),
nipkow@243
   201
	(hyp_subst_tac 1),
nipkow@243
   202
	(rtac trans_less 1),
nipkow@243
   203
	(rtac minimal 2),
nipkow@243
   204
	(rtac (strict_Issnd1 RS ssubst) 1),
nipkow@243
   205
	(rtac refl_less 1),
nipkow@243
   206
	(hyp_subst_tac 1),
nipkow@243
   207
	(res_inst_tac [("p","y")] IsprodE 1),
nipkow@243
   208
	(hyp_subst_tac 1),
nipkow@243
   209
	(res_inst_tac [("t","Issnd(Ispair(xa,ya))")] subst 1),
nipkow@243
   210
	(rtac refl_less 2),
nipkow@243
   211
	(etac (less_sprod4b RS sym RS arg_cong) 1),
nipkow@243
   212
	(hyp_subst_tac 1),
nipkow@243
   213
	(rtac (Issnd RS ssubst) 1),
nipkow@243
   214
	(atac 1),
nipkow@243
   215
	(atac 1),
nipkow@243
   216
	(rtac (Issnd RS ssubst) 1),
nipkow@243
   217
	(atac 1),
nipkow@243
   218
	(atac 1),
nipkow@243
   219
	(etac (less_sprod4c RS  conjunct2) 1),
nipkow@243
   220
	(REPEAT (atac 1))
nipkow@243
   221
	]);
nipkow@243
   222
nipkow@243
   223
nipkow@243
   224
(* ------------------------------------------------------------------------ *)
nipkow@243
   225
(* the type 'a ** 'b is a cpo                                               *)
nipkow@243
   226
(* ------------------------------------------------------------------------ *)
nipkow@243
   227
nipkow@243
   228
val lub_sprod = prove_goal Sprod2.thy 
nipkow@243
   229
"[|is_chain(S)|] ==> range(S) <<| \
nipkow@243
   230
\ Ispair(lub(range(%i.Isfst(S(i)))),lub(range(%i.Issnd(S(i)))))"
nipkow@243
   231
(fn prems =>
nipkow@243
   232
	[
nipkow@243
   233
	(cut_facts_tac prems 1),
nipkow@243
   234
	(rtac is_lubI 1),
nipkow@243
   235
	(rtac conjI 1),
nipkow@243
   236
	(rtac ub_rangeI 1),
nipkow@243
   237
	(rtac allI 1),
nipkow@243
   238
	(res_inst_tac [("t","S(i)")] (surjective_pairing_Sprod RS ssubst) 1),
nipkow@243
   239
	(rtac monofun_Ispair 1),
nipkow@243
   240
	(rtac is_ub_thelub 1),
nipkow@243
   241
	(etac (monofun_Isfst RS ch2ch_monofun) 1),
nipkow@243
   242
	(rtac is_ub_thelub 1),
nipkow@243
   243
	(etac (monofun_Issnd RS ch2ch_monofun) 1),
nipkow@243
   244
	(strip_tac 1),
nipkow@243
   245
	(res_inst_tac [("t","u")] (surjective_pairing_Sprod RS ssubst) 1),
nipkow@243
   246
	(rtac monofun_Ispair 1),
nipkow@243
   247
	(rtac is_lub_thelub 1),
nipkow@243
   248
	(etac (monofun_Isfst RS ch2ch_monofun) 1),
nipkow@243
   249
	(etac (monofun_Isfst RS ub2ub_monofun) 1),
nipkow@243
   250
	(rtac is_lub_thelub 1),
nipkow@243
   251
	(etac (monofun_Issnd RS ch2ch_monofun) 1),
nipkow@243
   252
	(etac (monofun_Issnd RS ub2ub_monofun) 1)
nipkow@243
   253
	]);
nipkow@243
   254
nipkow@243
   255
val thelub_sprod = (lub_sprod RS thelubI);
nipkow@243
   256
(* is_chain(?S1) ==> lub(range(?S1)) =                                     *)
nipkow@243
   257
(* Ispair(lub(range(%i. Isfst(?S1(i)))),lub(range(%i. Issnd(?S1(i)))))     *)
nipkow@243
   258
nipkow@243
   259
val cpo_sprod = prove_goal Sprod2.thy 
nipkow@243
   260
	"is_chain(S::nat=>'a**'b)==>? x.range(S)<<| x"
nipkow@243
   261
(fn prems =>
nipkow@243
   262
	[
nipkow@243
   263
	(cut_facts_tac prems 1),
nipkow@243
   264
	(rtac exI 1),
nipkow@243
   265
	(etac lub_sprod 1)
nipkow@243
   266
	]);
nipkow@243
   267
nipkow@243
   268
nipkow@243
   269
nipkow@243
   270
nipkow@243
   271
nipkow@243
   272
nipkow@243
   273
nipkow@243
   274