src/HOLCF/cprod2.ML
author wenzelm
Thu Aug 27 20:46:36 1998 +0200 (1998-08-27)
changeset 5400 645f46a24c72
parent 243 c22b85994e17
permissions -rw-r--r--
made tutorial first;
nipkow@243
     1
(*  Title: 	HOLCF/cprod2.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 cprod2.thy 
nipkow@243
     7
*)
nipkow@243
     8
nipkow@243
     9
open Cprod2;
nipkow@243
    10
nipkow@243
    11
val less_cprod3a = prove_goal Cprod2.thy 
nipkow@243
    12
	"p1=<UU,UU> ==> p1 << p2"
nipkow@243
    13
 (fn prems =>
nipkow@243
    14
	[
nipkow@243
    15
	(cut_facts_tac prems 1),
nipkow@243
    16
	(rtac (inst_cprod_po RS ssubst) 1),
nipkow@243
    17
	(rtac (less_cprod1b RS ssubst) 1),
nipkow@243
    18
	(hyp_subst_tac 1),
nipkow@243
    19
	(asm_simp_tac pair_ss  1),
nipkow@243
    20
	(rtac conjI 1),
nipkow@243
    21
	(rtac minimal 1),
nipkow@243
    22
	(rtac minimal 1)
nipkow@243
    23
	]);
nipkow@243
    24
nipkow@243
    25
val less_cprod3b = prove_goal Cprod2.thy
nipkow@243
    26
 "(p1 << p2) = (fst(p1)<<fst(p2) & snd(p1)<<snd(p2))"
nipkow@243
    27
 (fn prems =>
nipkow@243
    28
	[
nipkow@243
    29
	(rtac (inst_cprod_po RS ssubst) 1),
nipkow@243
    30
	(rtac less_cprod1b 1)
nipkow@243
    31
	]);
nipkow@243
    32
nipkow@243
    33
val less_cprod4a = prove_goal Cprod2.thy 
nipkow@243
    34
	"<x1,x2> << <UU,UU> ==> x1=UU & x2=UU"
nipkow@243
    35
 (fn prems =>
nipkow@243
    36
	[
nipkow@243
    37
	(cut_facts_tac prems 1),
nipkow@243
    38
	(rtac less_cprod2a 1),
nipkow@243
    39
	(etac (inst_cprod_po RS subst) 1)
nipkow@243
    40
	]);
nipkow@243
    41
nipkow@243
    42
val less_cprod4b = prove_goal Cprod2.thy 
nipkow@243
    43
	"p << <UU,UU> ==> p = <UU,UU>"
nipkow@243
    44
(fn prems =>
nipkow@243
    45
	[
nipkow@243
    46
	(cut_facts_tac prems 1),
nipkow@243
    47
	(rtac less_cprod2b 1),
nipkow@243
    48
	(etac (inst_cprod_po RS subst) 1)
nipkow@243
    49
	]);
nipkow@243
    50
nipkow@243
    51
val less_cprod4c = prove_goal Cprod2.thy
nipkow@243
    52
 " <xa,ya> << <x,y> ==> xa<<x & ya << y"
nipkow@243
    53
(fn prems =>
nipkow@243
    54
	[
nipkow@243
    55
	(cut_facts_tac prems 1),
nipkow@243
    56
	(rtac less_cprod2c 1),
nipkow@243
    57
	(etac (inst_cprod_po RS subst) 1),
nipkow@243
    58
	(REPEAT (atac 1))
nipkow@243
    59
	]);
nipkow@243
    60
nipkow@243
    61
(* ------------------------------------------------------------------------ *)
nipkow@243
    62
(* type cprod is pointed                                                    *)
nipkow@243
    63
(* ------------------------------------------------------------------------ *)
nipkow@243
    64
nipkow@243
    65
val minimal_cprod = prove_goal Cprod2.thy  "<UU,UU><<p"
nipkow@243
    66
(fn prems =>
nipkow@243
    67
	[
nipkow@243
    68
	(rtac less_cprod3a 1),
nipkow@243
    69
	(rtac refl 1)
nipkow@243
    70
	]);
nipkow@243
    71
nipkow@243
    72
(* ------------------------------------------------------------------------ *)
nipkow@243
    73
(* Pair <_,_>  is monotone in both arguments                                *)
nipkow@243
    74
(* ------------------------------------------------------------------------ *)
nipkow@243
    75
nipkow@243
    76
val monofun_pair1 = prove_goalw Cprod2.thy [monofun] "monofun(Pair)"
nipkow@243
    77
 (fn prems =>
nipkow@243
    78
	[
nipkow@243
    79
	(strip_tac 1),
nipkow@243
    80
	(rtac (less_fun RS iffD2) 1),
nipkow@243
    81
	(strip_tac 1),
nipkow@243
    82
	(rtac (less_cprod3b RS iffD2) 1),
nipkow@243
    83
	(simp_tac pair_ss 1),
nipkow@243
    84
	(asm_simp_tac Cfun_ss 1)
nipkow@243
    85
	]);
nipkow@243
    86
nipkow@243
    87
val monofun_pair2 = prove_goalw Cprod2.thy [monofun] "monofun(Pair(x))"
nipkow@243
    88
 (fn prems =>
nipkow@243
    89
	[
nipkow@243
    90
	(strip_tac 1),
nipkow@243
    91
	(rtac (less_cprod3b RS iffD2) 1),
nipkow@243
    92
	(simp_tac pair_ss 1),
nipkow@243
    93
	(asm_simp_tac Cfun_ss 1)
nipkow@243
    94
	]);
nipkow@243
    95
nipkow@243
    96
val monofun_pair = prove_goal Cprod2.thy 
nipkow@243
    97
 "[|x1<<x2; y1<<y2|] ==> <x1,y1> << <x2,y2>"
nipkow@243
    98
 (fn prems =>
nipkow@243
    99
	[
nipkow@243
   100
	(cut_facts_tac prems 1),
nipkow@243
   101
	(rtac trans_less 1),
nipkow@243
   102
	(rtac (monofun_pair1 RS monofunE RS spec RS spec RS mp RS 
nipkow@243
   103
	(less_fun RS iffD1 RS spec)) 1),
nipkow@243
   104
	(rtac (monofun_pair2 RS monofunE RS spec RS spec RS mp) 2),
nipkow@243
   105
	(atac 1),
nipkow@243
   106
	(atac 1)
nipkow@243
   107
	]);
nipkow@243
   108
nipkow@243
   109
(* ------------------------------------------------------------------------ *)
nipkow@243
   110
(* fst and snd are monotone                                                 *)
nipkow@243
   111
(* ------------------------------------------------------------------------ *)
nipkow@243
   112
nipkow@243
   113
val monofun_fst = prove_goalw Cprod2.thy [monofun] "monofun(fst)"
nipkow@243
   114
 (fn prems =>
nipkow@243
   115
	[
nipkow@243
   116
	(strip_tac 1),
nipkow@243
   117
	(res_inst_tac [("p","x")] PairE 1),
nipkow@243
   118
	(hyp_subst_tac 1),
nipkow@243
   119
	(res_inst_tac [("p","y")] PairE 1),
nipkow@243
   120
	(hyp_subst_tac 1),
nipkow@243
   121
	(asm_simp_tac pair_ss  1),
nipkow@243
   122
	(etac (less_cprod4c RS conjunct1) 1)
nipkow@243
   123
	]);
nipkow@243
   124
nipkow@243
   125
val monofun_snd = prove_goalw Cprod2.thy [monofun] "monofun(snd)"
nipkow@243
   126
 (fn prems =>
nipkow@243
   127
	[
nipkow@243
   128
	(strip_tac 1),
nipkow@243
   129
	(res_inst_tac [("p","x")] PairE 1),
nipkow@243
   130
	(hyp_subst_tac 1),
nipkow@243
   131
	(res_inst_tac [("p","y")] PairE 1),
nipkow@243
   132
	(hyp_subst_tac 1),
nipkow@243
   133
	(asm_simp_tac pair_ss  1),
nipkow@243
   134
	(etac (less_cprod4c RS conjunct2) 1)
nipkow@243
   135
	]);
nipkow@243
   136
nipkow@243
   137
(* ------------------------------------------------------------------------ *)
nipkow@243
   138
(* the type 'a * 'b is a cpo                                                *)
nipkow@243
   139
(* ------------------------------------------------------------------------ *)
nipkow@243
   140
nipkow@243
   141
val lub_cprod = prove_goal Cprod2.thy 
nipkow@243
   142
" is_chain(S) ==> range(S) <<| \
nipkow@243
   143
\   < lub(range(%i.fst(S(i)))),lub(range(%i.snd(S(i))))> "
nipkow@243
   144
 (fn prems =>
nipkow@243
   145
	[
nipkow@243
   146
	(cut_facts_tac prems 1),
nipkow@243
   147
	(rtac is_lubI 1),
nipkow@243
   148
	(rtac conjI 1),
nipkow@243
   149
	(rtac ub_rangeI 1),
nipkow@243
   150
	(rtac allI 1),
nipkow@243
   151
	(res_inst_tac [("t","S(i)")] (surjective_pairing RS ssubst) 1),
nipkow@243
   152
	(rtac monofun_pair 1),
nipkow@243
   153
	(rtac is_ub_thelub 1),
nipkow@243
   154
	(etac (monofun_fst RS ch2ch_monofun) 1),
nipkow@243
   155
	(rtac is_ub_thelub 1),
nipkow@243
   156
	(etac (monofun_snd RS ch2ch_monofun) 1),
nipkow@243
   157
	(strip_tac 1),
nipkow@243
   158
	(res_inst_tac [("t","u")] (surjective_pairing RS ssubst) 1),
nipkow@243
   159
	(rtac monofun_pair 1),
nipkow@243
   160
	(rtac is_lub_thelub 1),
nipkow@243
   161
	(etac (monofun_fst RS ch2ch_monofun) 1),
nipkow@243
   162
	(etac (monofun_fst RS ub2ub_monofun) 1),
nipkow@243
   163
	(rtac is_lub_thelub 1),
nipkow@243
   164
	(etac (monofun_snd RS ch2ch_monofun) 1),
nipkow@243
   165
	(etac (monofun_snd RS ub2ub_monofun) 1)
nipkow@243
   166
	]);
nipkow@243
   167
nipkow@243
   168
val thelub_cprod = (lub_cprod RS thelubI);
nipkow@243
   169
(* "is_chain(?S1) ==> lub(range(?S1)) =                                *)
nipkow@243
   170
(*  <lub(range(%i. fst(?S1(i)))), lub(range(%i. snd(?S1(i))))>"        *)
nipkow@243
   171
nipkow@243
   172
nipkow@243
   173
val cpo_cprod = prove_goal Cprod2.thy 
nipkow@243
   174
	"is_chain(S::nat=>'a*'b)==>? x.range(S)<<| x"
nipkow@243
   175
(fn prems =>
nipkow@243
   176
	[
nipkow@243
   177
	(cut_facts_tac prems 1),
nipkow@243
   178
	(rtac exI 1),
nipkow@243
   179
	(etac lub_cprod 1)
nipkow@243
   180
	]);
nipkow@243
   181