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