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