src/HOL/Univ.ML
author berghofe
Tue, 30 May 2000 18:02:49 +0200
changeset 9001 93af64f54bf2
parent 8790 c4aaa5936e0c
child 9108 9fff97d29837
permissions -rw-r--r--
the is now defined using primrec, avoiding explicit use of arbitrary.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 2891
diff changeset
     1
(*  Title:      HOL/Univ
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
923
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     7
(** apfst -- can be used in similar type definitions **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
     8
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
     9
Goalw [apfst_def] "apfst f (a,b) = (f(a),b)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    10
by (rtac split 1);
976
14b55f7fbf15 renamed theorem "apfst" to "apfst_conv" to avoid conflict with function
clasohm
parents: 972
diff changeset
    11
qed "apfst_conv";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    12
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
    13
val [major,minor] = Goal
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
    14
    "[| q = apfst f p;  !!x y. [| p = (x,y);  q = (f(x),y) |] ==> R \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    15
\    |] ==> R";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    16
by (rtac PairE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    17
by (rtac minor 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    18
by (assume_tac 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    19
by (rtac (major RS trans) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    20
by (etac ssubst 1);
976
14b55f7fbf15 renamed theorem "apfst" to "apfst_conv" to avoid conflict with function
clasohm
parents: 972
diff changeset
    21
by (rtac apfst_conv 1);
14b55f7fbf15 renamed theorem "apfst" to "apfst_conv" to avoid conflict with function
clasohm
parents: 972
diff changeset
    22
qed "apfst_convE";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    23
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    24
(** Push -- an injection, analogous to Cons on lists **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    25
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
    26
Goalw [Push_def] "Push i f = Push j g  ==> i=j";
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
    27
by (etac (fun_cong RS box_equals) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    28
by (rtac nat_case_0 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    29
by (rtac nat_case_0 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    30
qed "Push_inject1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    31
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
    32
Goalw [Push_def] "Push i f = Push j g  ==> f=g";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
    33
by (rtac (ext RS box_equals) 1);
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
    34
by (etac fun_cong 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    35
by (rtac (nat_case_Suc RS ext) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    36
by (rtac (nat_case_Suc RS ext) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    37
qed "Push_inject2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    38
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
    39
val [major,minor] = Goal
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    40
    "[| Push i f =Push j g;  [| i=j;  f=g |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    41
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    42
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
    43
qed "Push_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    44
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
    45
Goalw [Push_def] "Push (Inr (Suc k)) f = (%z. Inr 0) ==> P";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
    46
by (rtac Suc_neq_Zero 1);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
    47
by (etac (fun_cong RS box_equals RS Inr_inject) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    48
by (rtac nat_case_0 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    49
by (rtac refl 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    50
qed "Push_neq_K0";
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
(*** Isomorphisms ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    53
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
    54
Goal "inj(Rep_Node)";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    55
by (rtac inj_inverseI 1);       (*cannot combine by RS: multiple unifiers*)
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    56
by (rtac Rep_Node_inverse 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    57
qed "inj_Rep_Node";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    58
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
    59
Goal "inj_on Abs_Node Node";
4830
bd73675adbed Added a few lemmas.
nipkow
parents: 4535
diff changeset
    60
by (rtac inj_on_inverseI 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    61
by (etac Abs_Node_inverse 1);
4830
bd73675adbed Added a few lemmas.
nipkow
parents: 4535
diff changeset
    62
qed "inj_on_Abs_Node";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    63
4830
bd73675adbed Added a few lemmas.
nipkow
parents: 4535
diff changeset
    64
val Abs_Node_inject = inj_on_Abs_Node RS inj_onD;
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    65
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    66
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    67
(*** Introduction rules for Node ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    68
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
    69
Goalw [Node_def] "(%k. Inr 0, a) : Node";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
    70
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    71
qed "Node_K0_I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    72
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
    73
Goalw [Node_def,Push_def]
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
    74
    "p: Node ==> apfst (Push i) p : Node";
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
    75
by (fast_tac (claset() addSIs [apfst_conv, nat_case_Suc RS trans]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    76
qed "Node_Push_I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    77
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    78
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    79
(*** Distinctness of constructors ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    80
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    81
(** Scons vs Atom **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    82
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
    83
Goalw [Atom_def,Scons_def,Push_Node_def] "Scons M N ~= Atom(a)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    84
by (rtac notI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    85
by (etac (equalityD2 RS subsetD RS UnE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    86
by (rtac singletonI 1);
976
14b55f7fbf15 renamed theorem "apfst" to "apfst_conv" to avoid conflict with function
clasohm
parents: 972
diff changeset
    87
by (REPEAT (eresolve_tac [imageE, Abs_Node_inject RS apfst_convE, 
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
    88
                          Pair_inject, sym RS Push_neq_K0] 1
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    89
     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
    90
qed "Scons_not_Atom";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
    91
bind_thm ("Atom_not_Scons", Scons_not_Atom RS not_sym);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    92
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    93
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    94
(*** Injectiveness ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    95
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    96
(** Atomic nodes **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
    97
6171
cd237a10cbf8 inj is now a translation of inj_on
paulson
parents: 5978
diff changeset
    98
Goalw [Atom_def] "inj(Atom)";
cd237a10cbf8 inj is now a translation of inj_on
paulson
parents: 5978
diff changeset
    99
by (blast_tac (claset() addSIs [injI, Node_K0_I] addSDs [Abs_Node_inject]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   100
qed "inj_Atom";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   101
val Atom_inject = inj_Atom RS injD;
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   102
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   103
Goal "(Atom(a)=Atom(b)) = (a=b)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   104
by (blast_tac (claset() addSDs [Atom_inject]) 1);
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   105
qed "Atom_Atom_eq";
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   106
AddIffs [Atom_Atom_eq];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   107
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   108
Goalw [Leaf_def,o_def] "inj(Leaf)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   109
by (rtac injI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   110
by (etac (Atom_inject RS Inl_inject) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   111
qed "inj_Leaf";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   112
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   113
bind_thm ("Leaf_inject", inj_Leaf RS injD);
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   114
AddSDs [Leaf_inject];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   115
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   116
Goalw [Numb_def,o_def] "inj(Numb)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   117
by (rtac injI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   118
by (etac (Atom_inject RS Inr_inject) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   119
qed "inj_Numb";
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
val Numb_inject = inj_Numb RS injD;
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   122
AddSDs [Numb_inject];
923
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
(** Injectiveness of Push_Node **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   125
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   126
val [major,minor] = Goalw [Push_Node_def]
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   127
    "[| 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
   128
\    |] ==> P";
976
14b55f7fbf15 renamed theorem "apfst" to "apfst_conv" to avoid conflict with function
clasohm
parents: 972
diff changeset
   129
by (rtac (major RS Abs_Node_inject RS apfst_convE) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   130
by (REPEAT (resolve_tac [Rep_Node RS Node_Push_I] 1));
976
14b55f7fbf15 renamed theorem "apfst" to "apfst_conv" to avoid conflict with function
clasohm
parents: 972
diff changeset
   131
by (etac (sym RS apfst_convE) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   132
by (rtac minor 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   133
by (etac Pair_inject 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   134
by (etac (Push_inject1 RS sym) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   135
by (rtac (inj_Rep_Node RS injD) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   136
by (etac trans 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   137
by (safe_tac (claset() addSEs [Push_inject,sym]));
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   138
qed "Push_Node_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   139
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
(** Injectiveness of Scons **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   142
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   143
Goalw [Scons_def] "Scons M N <= Scons M' N' ==> M<=M'";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   144
by (blast_tac (claset() addSDs [Push_Node_inject]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   145
qed "Scons_inject_lemma1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   146
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   147
Goalw [Scons_def] "Scons M N <= Scons M' N' ==> N<=N'";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   148
by (blast_tac (claset() addSDs [Push_Node_inject]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   149
qed "Scons_inject_lemma2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   150
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   151
Goal "Scons M N = Scons M' N' ==> M=M'";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   152
by (etac equalityE 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   153
by (REPEAT (ares_tac [equalityI, Scons_inject_lemma1] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   154
qed "Scons_inject1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   155
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   156
Goal "Scons M N = Scons M' N' ==> N=N'";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   157
by (etac equalityE 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   158
by (REPEAT (ares_tac [equalityI, Scons_inject_lemma2] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   159
qed "Scons_inject2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   160
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   161
val [major,minor] = Goal
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   162
    "[| Scons M N = Scons M' N';  [| M=M';  N=N' |] ==> P \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   163
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   164
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
   165
qed "Scons_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   166
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   167
Goal "(Scons M N = Scons M' N') = (M=M' & N=N')";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   168
by (blast_tac (claset() addSEs [Scons_inject]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   169
qed "Scons_Scons_eq";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   170
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   171
(*** Distinctness involving Leaf and Numb ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   172
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   173
(** Scons vs Leaf **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   174
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   175
Goalw [Leaf_def,o_def] "Scons M N ~= Leaf(a)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   176
by (rtac Scons_not_Atom 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   177
qed "Scons_not_Leaf";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   178
bind_thm ("Leaf_not_Scons", Scons_not_Leaf RS not_sym);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   179
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   180
AddIffs [Scons_not_Leaf, Leaf_not_Scons];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   181
923
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
(** Scons vs Numb **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   184
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   185
Goalw [Numb_def,o_def] "Scons M N ~= Numb(k)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   186
by (rtac Scons_not_Atom 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   187
qed "Scons_not_Numb";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   188
bind_thm ("Numb_not_Scons", Scons_not_Numb RS not_sym);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   189
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   190
AddIffs [Scons_not_Numb, Numb_not_Scons];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   191
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   192
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   193
(** Leaf vs Numb **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   194
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   195
Goalw [Leaf_def,Numb_def] "Leaf(a) ~= Numb(k)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   196
by (simp_tac (simpset() addsimps [Inl_not_Inr]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   197
qed "Leaf_not_Numb";
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   198
bind_thm ("Numb_not_Leaf", Leaf_not_Numb RS not_sym);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   199
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   200
AddIffs [Leaf_not_Numb, Numb_not_Leaf];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   201
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   202
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   203
(*** ndepth -- the depth of a node ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   204
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   205
Addsimps [apfst_conv];
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   206
AddIffs  [Scons_not_Atom, Atom_not_Scons, Scons_Scons_eq];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   207
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   208
8114
09a7a180cc99 tidied parentheses
paulson
parents: 7255
diff changeset
   209
Goalw [ndepth_def] "ndepth (Abs_Node(%k. Inr 0, x)) = 0";
1485
240cc98b94a7 Added qed_spec_mp to avoid renaming of bound vars in 'th RS spec'
nipkow
parents: 1465
diff changeset
   210
by (EVERY1[stac (Node_K0_I RS Abs_Node_inverse), stac split]);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   211
by (rtac Least_equality 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   212
by (rtac refl 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   213
by (etac less_zeroE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   214
qed "ndepth_K0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   215
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   216
Goal "k < Suc(LEAST x. f x = Inr 0) --> nat_case (Inr (Suc i)) f k ~= Inr 0";
8709
483a3eb96c7e stopped using the obsolete "nat_ind_tac"
paulson
parents: 8703
diff changeset
   217
by (induct_tac "k" 1);
1264
3eb91524b938 added local simpsets; removed IOA from 'make test'
clasohm
parents: 976
diff changeset
   218
by (ALLGOALS Simp_tac);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   219
by (rtac impI 1);
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   220
by (etac not_less_Least 1);
4356
0dfd34f0d33d Replaced n ~= 0 by 0 < n
nipkow
parents: 4153
diff changeset
   221
val lemma = result();
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   222
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   223
Goalw [ndepth_def,Push_Node_def]
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   224
    "ndepth (Push_Node (Inr (Suc i)) n) = Suc(ndepth(n))";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   225
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
   226
by (cut_facts_tac [rewrite_rule [Node_def] Rep_Node] 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   227
by Safe_tac;
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
   228
by (etac ssubst 1);  (*instantiates type variables!*)
1264
3eb91524b938 added local simpsets; removed IOA from 'make test'
clasohm
parents: 976
diff changeset
   229
by (Simp_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   230
by (rtac Least_equality 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   231
by (rewtac Push_def);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   232
by (rtac (nat_case_Suc RS trans) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   233
by (etac LeastI 1);
4356
0dfd34f0d33d Replaced n ~= 0 by 0 < n
nipkow
parents: 4153
diff changeset
   234
by (asm_simp_tac (simpset() addsimps [lemma]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   235
qed "ndepth_Push_Node";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   236
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   237
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   238
(*** ntrunc applied to the various node sets ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   239
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   240
Goalw [ntrunc_def] "ntrunc 0 M = {}";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   241
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   242
qed "ntrunc_0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   243
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   244
Goalw [Atom_def,ntrunc_def] "ntrunc (Suc k) (Atom a) = Atom(a)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   245
by (fast_tac (claset() addss (simpset() addsimps [ndepth_K0])) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   246
qed "ntrunc_Atom";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   247
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   248
Goalw [Leaf_def,o_def] "ntrunc (Suc k) (Leaf a) = Leaf(a)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   249
by (rtac ntrunc_Atom 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   250
qed "ntrunc_Leaf";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   251
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   252
Goalw [Numb_def,o_def] "ntrunc (Suc k) (Numb i) = Numb(i)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   253
by (rtac ntrunc_Atom 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   254
qed "ntrunc_Numb";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   255
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   256
Goalw [Scons_def,ntrunc_def]
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   257
    "ntrunc (Suc k) (Scons M N) = Scons (ntrunc k M) (ntrunc k N)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   258
by (safe_tac (claset() addSIs [imageI]));
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   259
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
   260
by (REPEAT (rtac Suc_less_SucD 1 THEN 
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
   261
            rtac (ndepth_Push_Node RS subst) 1 THEN 
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
   262
            assume_tac 1));
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   263
qed "ntrunc_Scons";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   264
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   265
Addsimps [ntrunc_0, ntrunc_Atom, ntrunc_Leaf, ntrunc_Numb, ntrunc_Scons];
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   266
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   267
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   268
(** Injection nodes **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   269
8790
c4aaa5936e0c Suc 0 -> 1
paulson
parents: 8709
diff changeset
   270
Goalw [In0_def] "ntrunc 1 (In0 M) = {}";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   271
by (Simp_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   272
by (rewtac Scons_def);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   273
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   274
qed "ntrunc_one_In0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   275
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   276
Goalw [In0_def]
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   277
    "ntrunc (Suc (Suc k)) (In0 M) = In0 (ntrunc (Suc k) M)";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   278
by (Simp_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   279
qed "ntrunc_In0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   280
8790
c4aaa5936e0c Suc 0 -> 1
paulson
parents: 8709
diff changeset
   281
Goalw [In1_def] "ntrunc 1 (In1 M) = {}";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   282
by (Simp_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   283
by (rewtac Scons_def);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   284
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   285
qed "ntrunc_one_In1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   286
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   287
Goalw [In1_def]
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   288
    "ntrunc (Suc (Suc k)) (In1 M) = In1 (ntrunc (Suc k) M)";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   289
by (Simp_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   290
qed "ntrunc_In1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   291
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   292
Addsimps [ntrunc_one_In0, ntrunc_In0, ntrunc_one_In1, ntrunc_In1];
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   293
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   294
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   295
(*** Cartesian Product ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   296
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   297
Goalw [uprod_def] "[| M:A;  N:B |] ==> Scons M N : uprod A B";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   298
by (REPEAT (ares_tac [singletonI,UN_I] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   299
qed "uprodI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   300
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   301
(*The general elimination rule*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   302
val major::prems = Goalw [uprod_def]
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   303
    "[| c : uprod A B;  \
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   304
\       !!x y. [| x:A;  y:B;  c = Scons x y |] ==> P \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   305
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   306
by (cut_facts_tac [major] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   307
by (REPEAT (eresolve_tac [asm_rl,singletonE,UN_E] 1
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   308
     ORELSE resolve_tac prems 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   309
qed "uprodE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   310
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   311
(*Elimination of a pair -- introduces no eigenvariables*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   312
val prems = Goal
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   313
    "[| Scons M N : uprod A B;      [| M:A;  N:B |] ==> P   \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   314
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   315
by (rtac uprodE 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   316
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
   317
qed "uprodE2";
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   320
(*** Disjoint Sum ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   321
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   322
Goalw [usum_def] "M:A ==> In0(M) : usum A B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   323
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   324
qed "usum_In0I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   325
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   326
Goalw [usum_def] "N:B ==> In1(N) : usum A B";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   327
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   328
qed "usum_In1I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   329
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   330
val major::prems = Goalw [usum_def]
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   331
    "[| u : usum A B;  \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   332
\       !!x. [| x:A;  u=In0(x) |] ==> P; \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   333
\       !!y. [| y:B;  u=In1(y) |] ==> P \
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   334
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   335
by (rtac (major RS UnE) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   336
by (REPEAT (rtac refl 1 
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   337
     ORELSE eresolve_tac (prems@[imageE,ssubst]) 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   338
qed "usumE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   339
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
(** Injection **)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   342
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   343
Goalw [In0_def,In1_def] "In0(M) ~= In1(N)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   344
by (rtac notI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   345
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
   346
qed "In0_not_In1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   347
1985
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   348
bind_thm ("In1_not_In0", In0_not_In1 RS not_sym);
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   349
84cf16192e03 Tidied many proofs, using AddIffs to let equivalences take
paulson
parents: 1786
diff changeset
   350
AddIffs [In0_not_In1, In1_not_In0];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   351
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   352
Goalw [In0_def] "In0(M) = In0(N) ==>  M=N";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   353
by (etac (Scons_inject2) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   354
qed "In0_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   355
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   356
Goalw [In1_def] "In1(M) = In1(N) ==>  M=N";
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   357
by (etac (Scons_inject2) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   358
qed "In1_inject";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   359
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   360
Goal "(In0 M = In0 N) = (M=N)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   361
by (blast_tac (claset() addSDs [In0_inject]) 1);
3421
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   362
qed "In0_eq";
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   363
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   364
Goal "(In1 M = In1 N) = (M=N)";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   365
by (blast_tac (claset() addSDs [In1_inject]) 1);
3421
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   366
qed "In1_eq";
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   367
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   368
AddIffs [In0_eq, In1_eq];
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   369
6171
cd237a10cbf8 inj is now a translation of inj_on
paulson
parents: 5978
diff changeset
   370
Goal "inj In0";
cd237a10cbf8 inj is now a translation of inj_on
paulson
parents: 5978
diff changeset
   371
by (blast_tac (claset() addSIs [injI]) 1);
3421
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   372
qed "inj_In0";
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   373
6171
cd237a10cbf8 inj is now a translation of inj_on
paulson
parents: 5978
diff changeset
   374
Goal "inj In1";
cd237a10cbf8 inj is now a translation of inj_on
paulson
parents: 5978
diff changeset
   375
by (blast_tac (claset() addSIs [injI]) 1);
3421
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   376
qed "inj_In1";
be777156c7e9 New facts about In0/1 by Burkhart Wolff
paulson
parents: 2949
diff changeset
   377
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   378
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   379
(*** Function spaces ***)
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   380
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   381
Goalw [Lim_def] "Lim f = Lim g ==> f = g";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   382
by (rtac ext 1);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   383
by (rtac ccontr 1);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   384
by (etac equalityE 1);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   385
by (subgoal_tac "? y. y : f x & y ~: g x | y ~: f x & y : g x" 1);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   386
by (Blast_tac 2);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   387
by (etac exE 1);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   388
by (etac disjE 1);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   389
by (REPEAT (EVERY [
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   390
  dtac subsetD 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   391
  Fast_tac 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   392
  etac UnionE 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   393
  dtac CollectD 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   394
  etac exE 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   395
  hyp_subst_tac 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   396
  etac imageE 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   397
  etac Push_Node_inject 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   398
  Asm_full_simp_tac 1,
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   399
  TRY (thin_tac "?S <= ?T" 1)]));
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   400
qed "Lim_inject";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   401
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   402
Goalw [Funs_def] "S <= T ==> Funs S <= Funs T";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   403
by (Blast_tac 1);
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   404
qed "Funs_mono";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   405
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   406
val [p] = goalw thy [Funs_def] "(!!x. f x : S) ==> f : Funs S";
7088
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   407
by (rtac CollectI 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   408
by (rtac subsetI 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   409
by (etac rangeE 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   410
by (etac ssubst 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   411
by (rtac p 1);
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   412
qed "FunsI";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   413
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   414
Goalw [Funs_def] "f : Funs S ==> f x : S";
7088
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   415
by (etac CollectE 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   416
by (etac subsetD 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   417
by (rtac rangeI 1);
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   418
qed "FunsD";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   419
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   420
val [p1, p2] = goalw thy [o_def]
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   421
  "[| f : Funs R; !!x. x : R ==> r (a x) = x |] ==> r o (a o f) = f";
7088
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   422
by (rtac (p2 RS ext) 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   423
by (rtac (p1 RS FunsD) 1);
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   424
qed "Funs_inv";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   425
7088
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   426
val [p1, p2] = Goalw [o_def]
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   427
     "[| f : Funs (range g); !!h. f = g o h ==> P |] ==> P";
8292
93e125b21220 workaround res_inst_tac/lift_inst_rule bug by explicit type contraint;
wenzelm
parents: 8114
diff changeset
   428
by (res_inst_tac [("h", "%x. @y. (f::'a=>'b) x = g y")] p2 1);
7088
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   429
by (rtac ext 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   430
by (rtac (p1 RS FunsD RS rangeE) 1);
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   431
by (etac (exI RS (select_eq_Ex RS iffD2)) 1);
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   432
qed "Funs_rangeE";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   433
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   434
Goal "a : S ==> (%x. a) : Funs S";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   435
by (rtac FunsI 1);
7088
a94c9e226c20 expandshort; tidied
paulson
parents: 7014
diff changeset
   436
by (assume_tac 1);
7014
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   437
qed "Funs_nonempty";
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   438
11ee650edcd2 Added some definitions and theorems needed for the
berghofe
parents: 6171
diff changeset
   439
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   440
(*** proving equality of sets and functions using ntrunc ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   441
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   442
Goalw [ntrunc_def] "ntrunc k M <= M";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   443
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   444
qed "ntrunc_subsetI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   445
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   446
val [major] = Goalw [ntrunc_def] "(!!k. ntrunc k M <= N) ==> M<=N";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   447
by (blast_tac (claset() addIs [less_add_Suc1, less_add_Suc2, 
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   448
			       major RS subsetD]) 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   449
qed "ntrunc_subsetD";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   450
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   451
(*A generalized form of the take-lemma*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   452
val [major] = Goal "(!!k. ntrunc k M = ntrunc k N) ==> M=N";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   453
by (rtac equalityI 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   454
by (ALLGOALS (rtac ntrunc_subsetD));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   455
by (ALLGOALS (rtac (ntrunc_subsetI RSN (2, subset_trans))));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   456
by (rtac (major RS equalityD1) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   457
by (rtac (major RS equalityD2) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   458
qed "ntrunc_equality";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   459
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   460
val [major] = Goalw [o_def]
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   461
    "[| !!k. (ntrunc(k) o h1) = (ntrunc(k) o h2) |] ==> h1=h2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   462
by (rtac (ntrunc_equality RS ext) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   463
by (rtac (major RS fun_cong) 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   464
qed "ntrunc_o_equality";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   465
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   466
(*** Monotonicity ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   467
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   468
Goalw [uprod_def] "[| A<=A';  B<=B' |] ==> uprod A B <= uprod A' B'";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   469
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   470
qed "uprod_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   471
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   472
Goalw [usum_def] "[| A<=A';  B<=B' |] ==> usum A B <= usum A' B'";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   473
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   474
qed "usum_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   475
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   476
Goalw [Scons_def] "[| M<=M';  N<=N' |] ==> Scons M N <= Scons M' N'";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   477
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   478
qed "Scons_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   479
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   480
Goalw [In0_def] "M<=N ==> In0(M) <= In0(N)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   481
by (REPEAT (ares_tac [subset_refl,Scons_mono] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   482
qed "In0_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   483
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   484
Goalw [In1_def] "M<=N ==> In1(M) <= In1(N)";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   485
by (REPEAT (ares_tac [subset_refl,Scons_mono] 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   486
qed "In1_mono";
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   489
(*** Split and Case ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   490
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   491
Goalw [Split_def] "Split c (Scons M N) = c M N";
4535
f24cebc299e4 added select_equality to the implicit claset
oheimb
parents: 4521
diff changeset
   492
by (Blast_tac  1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   493
qed "Split";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   494
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   495
Goalw [Case_def] "Case c d (In0 M) = c(M)";
4535
f24cebc299e4 added select_equality to the implicit claset
oheimb
parents: 4521
diff changeset
   496
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   497
qed "Case_In0";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   498
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   499
Goalw [Case_def] "Case c d (In1 N) = d(N)";
4535
f24cebc299e4 added select_equality to the implicit claset
oheimb
parents: 4521
diff changeset
   500
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   501
qed "Case_In1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   502
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   503
Addsimps [Split, Case_In0, Case_In1];
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   504
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   505
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   506
(**** UN x. B(x) rules ****)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   507
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   508
Goalw [ntrunc_def] "ntrunc k (UN x. f(x)) = (UN x. ntrunc k (f x))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   509
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   510
qed "ntrunc_UN1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   511
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   512
Goalw [Scons_def] "Scons (UN x. f x) M = (UN x. Scons (f x) M)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   513
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   514
qed "Scons_UN1_x";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   515
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   516
Goalw [Scons_def] "Scons M (UN x. f x) = (UN x. Scons M (f x))";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   517
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   518
qed "Scons_UN1_y";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   519
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   520
Goalw [In0_def] "In0(UN x. f(x)) = (UN x. In0(f(x)))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
   521
by (rtac Scons_UN1_y 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   522
qed "In0_UN1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   523
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   524
Goalw [In1_def] "In1(UN x. f(x)) = (UN x. In1(f(x)))";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1264
diff changeset
   525
by (rtac Scons_UN1_y 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   526
qed "In1_UN1";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   527
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   528
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   529
(*** Equality for Cartesian Product ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   530
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4830
diff changeset
   531
Goalw [dprod_def]
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   532
    "[| (M,M'):r;  (N,N'):s |] ==> (Scons M N, Scons M' N') : dprod r s";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   533
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   534
qed "dprodI";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   535
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   536
(*The general elimination rule*)
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   537
val major::prems = Goalw [dprod_def]
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   538
    "[| c : dprod r s;  \
5191
8ceaa19f7717 Renamed '$' to 'Scons' because of clashes with constants of the same
berghofe
parents: 5148
diff changeset
   539
\       !!x y x' y'. [| (x,x') : r;  (y,y') : s;  c = (Scons x y, Scons x' y') |] ==> P \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   540
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   541
by (cut_facts_tac [major] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   542
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
   543
by (REPEAT (ares_tac prems 1 ORELSE hyp_subst_tac 1));
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   544
qed "dprodE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   545
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   546
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   547
(*** Equality for Disjoint Sum ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   548
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   549
Goalw [dsum_def]  "(M,M'):r ==> (In0(M), In0(M')) : dsum r s";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   550
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   551
qed "dsum_In0I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   552
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   553
Goalw [dsum_def]  "(N,N'):s ==> (In1(N), In1(N')) : dsum r s";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   554
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   555
qed "dsum_In1I";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   556
5316
7a8975451a89 even more tidying of Goal commands
paulson
parents: 5278
diff changeset
   557
val major::prems = Goalw [dsum_def]
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   558
    "[| w : dsum r s;  \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   559
\       !!x x'. [| (x,x') : r;  w = (In0(x), In0(x')) |] ==> P; \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 923
diff changeset
   560
\       !!y y'. [| (y,y') : s;  w = (In1(y), In1(y')) |] ==> P \
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   561
\    |] ==> P";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   562
by (cut_facts_tac [major] 1);
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   563
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
   564
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
   565
qed "dsumE";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   566
5978
fa2c2dd74f8c moved diag (diagonal relation) from Univ to Relation
paulson
parents: 5809
diff changeset
   567
AddSIs [uprodI, dprodI];
fa2c2dd74f8c moved diag (diagonal relation) from Univ to Relation
paulson
parents: 5809
diff changeset
   568
AddIs  [usum_In0I, usum_In1I, dsum_In0I, dsum_In1I];
fa2c2dd74f8c moved diag (diagonal relation) from Univ to Relation
paulson
parents: 5809
diff changeset
   569
AddSEs [uprodE, dprodE, usumE, dsumE];
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   570
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
(*** Monotonicity ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   573
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   574
Goal "[| r<=r';  s<=s' |] ==> dprod r s <= dprod r' s'";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   575
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   576
qed "dprod_mono";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   577
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   578
Goal "[| r<=r';  s<=s' |] ==> dsum r s <= dsum r' s'";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   579
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   580
qed "dsum_mono";
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
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   583
(*** Bounding theorems ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   584
8703
816d8f6513be Times -> <*>
nipkow
parents: 8292
diff changeset
   585
Goal "(dprod (A <*> B) (C <*> D)) <= (uprod A C) <*> (uprod B D)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   586
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   587
qed "dprod_Sigma";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   588
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   589
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
   590
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   591
(*Dependent version*)
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   592
Goal "(dprod (Sigma A B) (Sigma C D)) <= Sigma (uprod A C) (Split (%x y. uprod (B x) (D y)))";
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   593
by Safe_tac;
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   594
by (stac Split 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   595
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   596
qed "dprod_subset_Sigma2";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   597
8703
816d8f6513be Times -> <*>
nipkow
parents: 8292
diff changeset
   598
Goal "(dsum (A <*> B) (C <*> D)) <= (usum A C) <*> (usum B D)";
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 1985
diff changeset
   599
by (Blast_tac 1);
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   600
qed "dsum_Sigma";
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   601
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   602
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
   603
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   604
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   605
(*** Domain ***)
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   606
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   607
Goal "Domain (dprod r s) = uprod (Domain r) (Domain s)";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   608
by Auto_tac;
5788
e3a98a7c0634 Domain r, Range r replace fst``r, snd``r
paulson
parents: 5316
diff changeset
   609
qed "Domain_dprod";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   610
7255
853bdbe9973d Eliminated some infixes.
berghofe
parents: 7088
diff changeset
   611
Goal "Domain (dsum r s) = usum (Domain r) (Domain s)";
4521
c7f56322a84b Tidied by adding more default simprules
paulson
parents: 4356
diff changeset
   612
by Auto_tac;
5788
e3a98a7c0634 Domain r, Range r replace fst``r, snd``r
paulson
parents: 5316
diff changeset
   613
qed "Domain_dsum";
923
ff1574a81019 new version of HOL with curried function application
clasohm
parents:
diff changeset
   614
5978
fa2c2dd74f8c moved diag (diagonal relation) from Univ to Relation
paulson
parents: 5809
diff changeset
   615
Addsimps [Domain_dprod, Domain_dsum];