src/HOLCF/Up1.ML
author nipkow
Sun, 22 Dec 2002 10:43:43 +0100
changeset 13763 f94b569cd610
parent 12030 46d57d0290a2
child 14981 e73f8140af78
permissions -rw-r--r--
added print translations tha avoid eta contraction for important binders.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
     1
(*  Title:      HOLCF/Up1.ML
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
     2
    ID:         $Id$
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
     3
    Author:     Franz Regensburger
12030
wenzelm
parents: 10834
diff changeset
     4
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
     5
12030
wenzelm
parents: 10834
diff changeset
     6
Lifting.
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
     7
*)
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
     8
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
     9
Goal "Rep_Up (Abs_Up y) = y";
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    10
by (simp_tac (simpset() addsimps [Up_def,Abs_Up_inverse]) 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    11
qed "Abs_Up_inverse2";
2640
ee4dfce170a0 Changes of HOLCF from Oscar Slotosch:
slotosch
parents: 2278
diff changeset
    12
9248
e1dee89de037 massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents: 9245
diff changeset
    13
Goalw [Iup_def] "z = Abs_Up(Inl ()) | (? x. z = Iup x)";
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    14
by (rtac (Rep_Up_inverse RS subst) 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    15
by (res_inst_tac [("s","Rep_Up z")] sumE 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    16
by (rtac disjI1 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    17
by (res_inst_tac [("f","Abs_Up")] arg_cong 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    18
by (rtac (unit_eq RS subst) 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    19
by (atac 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    20
by (rtac disjI2 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    21
by (rtac exI 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    22
by (res_inst_tac [("f","Abs_Up")] arg_cong 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    23
by (atac 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    24
qed "Exh_Up";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    25
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    26
Goal "inj(Abs_Up)";
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    27
by (rtac inj_inverseI 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    28
by (rtac Abs_Up_inverse2 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    29
qed "inj_Abs_Up";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    30
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    31
Goal "inj(Rep_Up)";
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    32
by (rtac inj_inverseI 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    33
by (rtac Rep_Up_inverse 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    34
qed "inj_Rep_Up";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    35
9248
e1dee89de037 massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents: 9245
diff changeset
    36
Goalw [Iup_def] "Iup x=Iup y ==> x=y";
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    37
by (rtac (inj_Inr RS injD) 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    38
by (rtac (inj_Abs_Up RS injD) 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    39
by (atac 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    40
qed "inject_Iup";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    41
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    42
AddSDs [inject_Iup];
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    43
9248
e1dee89de037 massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents: 9245
diff changeset
    44
Goalw [Iup_def] "Iup x~=Abs_Up(Inl ())";
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    45
by (rtac notI 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    46
by (rtac notE 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    47
by (rtac Inl_not_Inr 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    48
by (rtac sym 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    49
by (etac (inj_Abs_Up RS  injD) 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    50
qed "defined_Iup";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    51
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    52
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    53
val prems = Goal "[| p=Abs_Up(Inl ()) ==> Q; !!x. p=Iup(x)==>Q|] ==>Q";
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    54
by (rtac (Exh_Up RS disjE) 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    55
by (eresolve_tac prems 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    56
by (etac exE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    57
by (eresolve_tac prems 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    58
qed "upE";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    59
9248
e1dee89de037 massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents: 9245
diff changeset
    60
Goalw [Ifup_def] "Ifup(f)(Abs_Up(Inl ()))=UU";
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    61
by (stac Abs_Up_inverse2 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    62
by (stac sum_case_Inl 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    63
by (rtac refl 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    64
qed "Ifup1";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    65
9248
e1dee89de037 massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents: 9245
diff changeset
    66
Goalw [Ifup_def,Iup_def]
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 9248
diff changeset
    67
        "Ifup(f)(Iup(x))=f$x";
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    68
by (stac Abs_Up_inverse2 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    69
by (stac sum_case_Inr 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    70
by (rtac refl 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    71
qed "Ifup2";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    72
8161
bde1391fd0a5 added range_composition (also to simpset)
oheimb
parents: 7294
diff changeset
    73
val Up0_ss = (simpset_of Cfun3.thy) delsimps [range_composition] 
bde1391fd0a5 added range_composition (also to simpset)
oheimb
parents: 7294
diff changeset
    74
	     addsimps [Ifup1,Ifup2];
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    75
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    76
Addsimps [Ifup1,Ifup2];
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
    77
9248
e1dee89de037 massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents: 9245
diff changeset
    78
Goalw [less_up_def]
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    79
        "Abs_Up(Inl ())<< z";
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    80
by (stac Abs_Up_inverse2 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    81
by (stac sum_case_Inl 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    82
by (rtac TrueI 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    83
qed "less_up1a";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    84
9248
e1dee89de037 massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents: 9245
diff changeset
    85
Goalw [Iup_def,less_up_def]
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    86
        "~(Iup x) << (Abs_Up(Inl ()))";
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    87
by (rtac notI 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    88
by (rtac iffD1 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    89
by (atac 2);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    90
by (stac Abs_Up_inverse2 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    91
by (stac Abs_Up_inverse2 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    92
by (stac sum_case_Inr 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    93
by (stac sum_case_Inl 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    94
by (rtac refl 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    95
qed "less_up1b";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
    96
9248
e1dee89de037 massive tidy-up: goal -> Goal, remove use of prems, etc.
paulson
parents: 9245
diff changeset
    97
Goalw [Iup_def,less_up_def]
9245
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    98
        "(Iup x) << (Iup y)=(x<<y)";
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
    99
by (stac Abs_Up_inverse2 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
   100
by (stac Abs_Up_inverse2 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
   101
by (stac sum_case_Inr 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
   102
by (stac sum_case_Inr 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
   103
by (rtac refl 1);
428385c4bc50 removed most batch-style proofs
paulson
parents: 9169
diff changeset
   104
qed "less_up1c";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
   105
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   106
AddIffs [less_up1a, less_up1b, less_up1c];
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
   107
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   108
Goal "(p::'a u) << p";
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   109
by (res_inst_tac [("p","p")] upE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   110
by Auto_tac;
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   111
qed "refl_less_up";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
   112
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   113
Goal "[|(p1::'a u) << p2;p2 << p1|] ==> p1=p2";
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   114
by (res_inst_tac [("p","p1")] upE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   115
by (hyp_subst_tac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   116
by (res_inst_tac [("p","p2")] upE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   117
by (etac sym 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   118
by (hyp_subst_tac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   119
by (res_inst_tac [("P","(Iup x) << (Abs_Up(Inl ()))")] notE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   120
by (rtac less_up1b 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   121
by (atac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   122
by (hyp_subst_tac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   123
by (res_inst_tac [("p","p2")] upE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   124
by (hyp_subst_tac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   125
by (res_inst_tac [("P","(Iup x) << (Abs_Up(Inl ()))")] notE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   126
by (rtac less_up1b 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   127
by (atac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   128
by (blast_tac (claset() addIs [arg_cong, antisym_less, less_up1c RS iffD1]) 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   129
qed "antisym_less_up";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
   130
9169
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   131
Goal "[|(p1::'a u) << p2;p2 << p3|] ==> p1 << p3";
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   132
by (res_inst_tac [("p","p1")] upE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   133
by (hyp_subst_tac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   134
by (rtac less_up1a 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   135
by (hyp_subst_tac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   136
by (res_inst_tac [("p","p2")] upE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   137
by (hyp_subst_tac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   138
by (rtac notE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   139
by (rtac less_up1b 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   140
by (atac 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   141
by (res_inst_tac [("p","p3")] upE 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   142
by Auto_tac;
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   143
by (blast_tac (claset() addIs [trans_less]) 1);
85a47aa21f74 tidying and unbatchifying
paulson
parents: 8161
diff changeset
   144
qed "trans_less_up";
2278
d63ffafce255 *** empty log message ***
oheimb
parents:
diff changeset
   145