src/HOL/ex/MT.ML
author dixon
Wed, 02 Mar 2005 10:33:10 +0100
changeset 15560 c862d556fb18
parent 15386 06757406d8cf
child 17289 8608f7a881eb
permissions -rw-r--r--
lucas - fixed bug with name capture variables bound outside redex could (previously)conflict with scheme variables that occur in the conditions of an equation, and which were renamed to avoid conflict with another instantiation. This has now been fixed.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1266
diff changeset
     1
(*  Title:      HOL/ex/MT.ML
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1266
diff changeset
     3
    Author:     Jacob Frost, Cambridge University Computer Laboratory
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     5
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     6
Based upon the article
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     7
    Robin Milner and Mads Tofte,
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     8
    Co-induction in Relational Semantics,
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     9
    Theoretical Computer Science 87 (1991), pages 209-220.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    10
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    11
Written up as
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    12
    Jacob Frost, A Case Study of Co-induction in Isabelle/HOL
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    13
    Report 308, Computer Lab, University of Cambridge (1993).
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    14
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    15
NEEDS TO USE INDUCTIVE DEFS PACKAGE
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    16
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    17
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    18
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    19
(* Inference systems                                            *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    20
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    21
15386
06757406d8cf converted Lfp to new-style theory
paulson
parents: 10202
diff changeset
    22
val lfp_lemma2 = thm "lfp_lemma2";
06757406d8cf converted Lfp to new-style theory
paulson
parents: 10202
diff changeset
    23
val lfp_lemma3 = thm "lfp_lemma3";
06757406d8cf converted Lfp to new-style theory
paulson
parents: 10202
diff changeset
    24
val gfp_lemma2 = thm "gfp_lemma2";
06757406d8cf converted Lfp to new-style theory
paulson
parents: 10202
diff changeset
    25
val gfp_lemma3 = thm "gfp_lemma3";
06757406d8cf converted Lfp to new-style theory
paulson
parents: 10202
diff changeset
    26
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
    27
val infsys_mono_tac = (REPEAT (ares_tac (basic_monos@[allI,impI]) 1));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    28
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
    29
val prems = goal MT.thy "P a b ==> P (fst (a,b)) (snd (a,b))";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
    30
by (simp_tac (simpset() addsimps prems) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    31
qed "infsys_p1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    32
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
    33
Goal "P (fst (a,b)) (snd (a,b)) ==> P a b";
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 1047
diff changeset
    34
by (Asm_full_simp_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    35
qed "infsys_p2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    36
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
    37
Goal "P a b c ==> P (fst(fst((a,b),c))) (snd(fst ((a,b),c))) (snd ((a,b),c))";
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 1047
diff changeset
    38
by (Asm_full_simp_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    39
qed "infsys_pp1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    40
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
    41
Goal "P (fst(fst((a,b),c))) (snd(fst((a,b),c))) (snd((a,b),c)) ==> P a b c";
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 1047
diff changeset
    42
by (Asm_full_simp_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    43
qed "infsys_pp2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    44
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    45
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    46
(* Fixpoints                                                    *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    47
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    48
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    49
(* Least fixpoints *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    50
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    51
val prems = goal MT.thy "[| mono(f); x:f(lfp(f)) |] ==> x:lfp(f)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    52
by (rtac subsetD 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    53
by (rtac lfp_lemma2 1);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    54
by (resolve_tac prems 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    55
by (resolve_tac prems 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    56
qed "lfp_intro2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    57
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    58
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    59
  " [| x:lfp(f); mono(f); !!y. y:f(lfp(f)) ==> P(y) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    60
\   P(x)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    61
by (cut_facts_tac prems 1);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    62
by (resolve_tac prems 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    63
by (rtac subsetD 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    64
by (rtac lfp_lemma3 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    65
by (assume_tac 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    66
by (assume_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    67
qed "lfp_elim2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    68
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    69
val prems = goal MT.thy
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2935
diff changeset
    70
  " [| x:lfp(f); mono(f); !!y. y:f(lfp(f) Int {x. P(x)}) ==> P(y) |] ==> \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    71
\   P(x)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    72
by (cut_facts_tac prems 1);
10202
9e8b4bebc940 induct -> lfp_induct
nipkow
parents: 8114
diff changeset
    73
by (etac lfp_induct 1);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    74
by (assume_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    75
by (eresolve_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    76
qed "lfp_ind2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    77
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    78
(* Greatest fixpoints *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    79
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    80
(* Note : "[| x:S; S <= f(S Un gfp(f)); mono(f) |] ==> x:gfp(f)" *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    81
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    82
val [cih,monoh] = goal MT.thy "[| x:f({x} Un gfp(f)); mono(f) |] ==> x:gfp(f)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    83
by (rtac (cih RSN (2,gfp_upperbound RS subsetD)) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    84
by (rtac (monoh RS monoD) 1);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    85
by (rtac (UnE RS subsetI) 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    86
by (assume_tac 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
    87
by (blast_tac (claset() addSIs [cih]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    88
by (rtac (monoh RS monoD RS subsetD) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    89
by (rtac Un_upper2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    90
by (etac (monoh RS gfp_lemma2 RS subsetD) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    91
qed "gfp_coind2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    92
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    93
val [gfph,monoh,caseh] = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    94
  "[| x:gfp(f); mono(f); !! y. y:f(gfp(f)) ==> P(y) |] ==> P(x)";
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    95
by (rtac caseh 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    96
by (rtac subsetD 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    97
by (rtac gfp_lemma2 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    98
by (rtac monoh 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
    99
by (rtac gfph 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   100
qed "gfp_elim2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   101
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   102
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   103
(* Expressions                                                  *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   104
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   105
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   106
val e_injs = [e_const_inj, e_var_inj, e_fn_inj, e_fix_inj, e_app_inj];
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   107
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   108
val e_disjs = 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   109
  [ e_disj_const_var, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   110
    e_disj_const_fn, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   111
    e_disj_const_fix, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   112
    e_disj_const_app,
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   113
    e_disj_var_fn, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   114
    e_disj_var_fix, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   115
    e_disj_var_app, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   116
    e_disj_fn_fix, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   117
    e_disj_fn_app, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   118
    e_disj_fix_app
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   119
  ];
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   120
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   121
val e_disj_si = e_disjs @ (e_disjs RL [not_sym]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   122
val e_disj_se = (e_disj_si RL [notE]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   123
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   124
fun e_ext_cs cs = cs addSIs e_disj_si addSEs e_disj_se addSDs e_injs;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   125
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   126
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   127
(* Values                                                      *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   128
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   129
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   130
val v_disjs = [v_disj_const_clos];
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   131
val v_disj_si = v_disjs @ (v_disjs RL [not_sym]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   132
val v_disj_se = (v_disj_si RL [notE]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   133
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   134
val v_injs = [v_const_inj, v_clos_inj];
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   135
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   136
fun v_ext_cs cs  = cs addSIs v_disj_si addSEs v_disj_se addSDs v_injs;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   137
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   138
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   139
(* Evaluations                                                  *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   140
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   141
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   142
(* Monotonicity of eval_fun *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   143
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   144
Goalw [mono_def, eval_fun_def] "mono(eval_fun)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   145
by infsys_mono_tac;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   146
qed "eval_fun_mono";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   147
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   148
(* Introduction rules *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   149
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   150
Goalw [eval_def, eval_rel_def] "ve |- e_const(c) ---> v_const(c)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   151
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   152
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   153
by (rewtac eval_fun_def);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   154
	(*Naughty!  But the quantifiers are nested VERY deeply...*)
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   155
by (blast_tac (claset() addSIs [exI]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   156
qed "eval_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   157
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   158
Goalw [eval_def, eval_rel_def] 
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   159
  "ev:ve_dom(ve) ==> ve |- e_var(ev) ---> ve_app ve ev";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   160
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   161
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   162
by (rewtac eval_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   163
by (blast_tac (claset() addSIs [exI]) 1);
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 1047
diff changeset
   164
qed "eval_var2";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   165
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   166
Goalw [eval_def, eval_rel_def] 
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   167
  "ve |- fn ev => e ---> v_clos(<|ev,e,ve|>)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   168
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   169
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   170
by (rewtac eval_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   171
by (blast_tac (claset() addSIs [exI]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   172
qed "eval_fn";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   173
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   174
Goalw [eval_def, eval_rel_def] 
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   175
  " cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   176
\   ve |- fix ev2(ev1) = e ---> v_clos(cl)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   177
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   178
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   179
by (rewtac eval_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   180
by (blast_tac (claset() addSIs [exI]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   181
qed "eval_fix";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   182
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   183
Goalw [eval_def, eval_rel_def]
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   184
  " [| ve |- e1 ---> v_const(c1); ve |- e2 ---> v_const(c2) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   185
\   ve |- e1 @ e2 ---> v_const(c_app c1 c2)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   186
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   187
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   188
by (rewtac eval_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   189
by (blast_tac (claset() addSIs [exI]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   190
qed "eval_app1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   191
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   192
Goalw [eval_def, eval_rel_def] 
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   193
  " [|  ve |- e1 ---> v_clos(<|xm,em,vem|>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   194
\       ve |- e2 ---> v2; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   195
\       vem + {xm |-> v2} |- em ---> v \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   196
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   197
\   ve |- e1 @ e2 ---> v";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   198
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   199
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   200
by (rewtac eval_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   201
by (blast_tac (claset() addSIs [disjI2]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   202
qed "eval_app2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   203
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   204
(* Strong elimination, induction on evaluations *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   205
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   206
val prems = goalw MT.thy [eval_def, eval_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   207
  " [| ve |- e ---> v; \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   208
\      !!ve c. P(((ve,e_const(c)),v_const(c))); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   209
\      !!ev ve. ev:ve_dom(ve) ==> P(((ve,e_var(ev)),ve_app ve ev)); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   210
\      !!ev ve e. P(((ve,fn ev => e),v_clos(<|ev,e,ve|>))); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   211
\      !!ev1 ev2 ve cl e. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   212
\        cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   213
\        P(((ve,fix ev2(ev1) = e),v_clos(cl))); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   214
\      !!ve c1 c2 e1 e2. \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   215
\        [| P(((ve,e1),v_const(c1))); P(((ve,e2),v_const(c2))) |] ==> \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   216
\        P(((ve,e1 @ e2),v_const(c_app c1 c2))); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   217
\      !!ve vem xm e1 e2 em v v2. \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   218
\        [|  P(((ve,e1),v_clos(<|xm,em,vem|>))); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   219
\            P(((ve,e2),v2)); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   220
\            P(((vem + {xm |-> v2},em),v)) \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   221
\        |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   222
\        P(((ve,e1 @ e2),v)) \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   223
\   |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   224
\   P(((ve,e),v))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   225
by (resolve_tac (prems RL [lfp_ind2]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   226
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   227
by (rewtac eval_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   228
by (dtac CollectD 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   229
by Safe_tac;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   230
by (ALLGOALS (resolve_tac prems));
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   231
by (ALLGOALS (Blast_tac));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   232
qed "eval_ind0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   233
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   234
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   235
  " [| ve |- e ---> v; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   236
\      !!ve c. P ve (e_const c) (v_const c); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   237
\      !!ev ve. ev:ve_dom(ve) ==> P ve (e_var ev) (ve_app ve ev); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   238
\      !!ev ve e. P ve (fn ev => e) (v_clos <|ev,e,ve|>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   239
\      !!ev1 ev2 ve cl e. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   240
\        cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   241
\        P ve (fix ev2(ev1) = e) (v_clos cl); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   242
\      !!ve c1 c2 e1 e2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   243
\        [| P ve e1 (v_const c1); P ve e2 (v_const c2) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   244
\        P ve (e1 @ e2) (v_const(c_app c1 c2)); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   245
\      !!ve vem evm e1 e2 em v v2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   246
\        [|  P ve e1 (v_clos <|evm,em,vem|>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   247
\            P ve e2 v2; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   248
\            P (vem + {evm |-> v2}) em v \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   249
\        |] ==> P ve (e1 @ e2) v \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   250
\   |] ==> P ve e v";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   251
by (res_inst_tac [("P","P")] infsys_pp2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   252
by (rtac eval_ind0 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   253
by (ALLGOALS (rtac infsys_pp1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   254
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   255
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   256
qed "eval_ind";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   257
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   258
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   259
(* Elaborations                                                 *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   260
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   261
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   262
Goalw [mono_def, elab_fun_def] "mono(elab_fun)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   263
by infsys_mono_tac;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   264
qed "elab_fun_mono";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   265
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   266
(* Introduction rules *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   267
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   268
Goalw [elab_def, elab_rel_def] 
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   269
  "c isof ty ==> te |- e_const(c) ===> ty";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   270
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   271
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   272
by (rewtac elab_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   273
by (blast_tac (claset() addSIs [exI]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   274
qed "elab_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   275
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   276
Goalw [elab_def, elab_rel_def] 
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   277
  "x:te_dom(te) ==> te |- e_var(x) ===> te_app te x";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   278
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   279
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   280
by (rewtac elab_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   281
by (blast_tac (claset() addSIs [exI]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   282
qed "elab_var";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   283
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   284
Goalw [elab_def, elab_rel_def] 
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   285
  "te + {x |=> ty1} |- e ===> ty2 ==> te |- fn x => e ===> ty1->ty2";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   286
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   287
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   288
by (rewtac elab_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   289
by (blast_tac (claset() addSIs [exI]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   290
qed "elab_fn";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   291
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   292
Goalw [elab_def, elab_rel_def]
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   293
  "te + {f |=> ty1->ty2} + {x |=> ty1} |- e ===> ty2 ==> \
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   294
\        te |- fix f(x) = e ===> ty1->ty2";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   295
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   296
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   297
by (rewtac elab_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   298
by (blast_tac (claset() addSIs [exI]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   299
qed "elab_fix";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   300
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   301
Goalw [elab_def, elab_rel_def] 
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   302
  "[| te |- e1 ===> ty1->ty2; te |- e2 ===> ty1 |] ==> \
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   303
\        te |- e1 @ e2 ===> ty2";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   304
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   305
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   306
by (rewtac elab_fun_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   307
by (blast_tac (claset() addSIs [disjI2]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   308
qed "elab_app";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   309
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   310
(* Strong elimination, induction on elaborations *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   311
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   312
val prems = goalw MT.thy [elab_def, elab_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   313
  " [| te |- e ===> t; \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   314
\      !!te c t. c isof t ==> P(((te,e_const(c)),t)); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   315
\      !!te x. x:te_dom(te) ==> P(((te,e_var(x)),te_app te x)); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   316
\      !!te x e t1 t2. \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   317
\        [| te + {x |=> t1} |- e ===> t2; P(((te + {x |=> t1},e),t2)) |] ==> \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   318
\        P(((te,fn x => e),t1->t2)); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   319
\      !!te f x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   320
\        [| te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2; \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   321
\           P(((te + {f |=> t1->t2} + {x |=> t1},e),t2)) \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   322
\        |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   323
\        P(((te,fix f(x) = e),t1->t2)); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   324
\      !!te e1 e2 t1 t2. \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   325
\        [| te |- e1 ===> t1->t2; P(((te,e1),t1->t2)); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   326
\           te |- e2 ===> t1; P(((te,e2),t1)) \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   327
\        |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   328
\        P(((te,e1 @ e2),t2)) \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   329
\   |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   330
\   P(((te,e),t))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   331
by (resolve_tac (prems RL [lfp_ind2]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   332
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   333
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   334
by (dtac CollectD 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   335
by Safe_tac;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   336
by (ALLGOALS (resolve_tac prems));
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   337
by (ALLGOALS (Blast_tac));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   338
qed "elab_ind0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   339
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   340
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   341
  " [| te |- e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   342
\       !!te c t. c isof t ==> P te (e_const c) t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   343
\      !!te x. x:te_dom(te) ==> P te (e_var x) (te_app te x); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   344
\      !!te x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   345
\        [| te + {x |=> t1} |- e ===> t2; P (te + {x |=> t1}) e t2 |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   346
\        P te (fn x => e) (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   347
\      !!te f x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   348
\        [| te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   349
\           P (te + {f |=> t1->t2} + {x |=> t1}) e t2 \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   350
\        |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   351
\        P te (fix f(x) = e) (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   352
\      !!te e1 e2 t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   353
\        [| te |- e1 ===> t1->t2; P te e1 (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   354
\           te |- e2 ===> t1; P te e2 t1 \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   355
\        |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   356
\        P te (e1 @ e2) t2 \ 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   357
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   358
\   P te e t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   359
by (res_inst_tac [("P","P")] infsys_pp2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   360
by (rtac elab_ind0 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   361
by (ALLGOALS (rtac infsys_pp1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   362
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   363
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   364
qed "elab_ind";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   365
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   366
(* Weak elimination, case analysis on elaborations *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   367
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   368
val prems = goalw MT.thy [elab_def, elab_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   369
  " [| te |- e ===> t; \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   370
\      !!te c t. c isof t ==> P(((te,e_const(c)),t)); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   371
\      !!te x. x:te_dom(te) ==> P(((te,e_var(x)),te_app te x)); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   372
\      !!te x e t1 t2. \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   373
\        te + {x |=> t1} |- e ===> t2 ==> P(((te,fn x => e),t1->t2)); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   374
\      !!te f x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   375
\        te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2 ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   376
\        P(((te,fix f(x) = e),t1->t2)); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   377
\      !!te e1 e2 t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   378
\        [| te |- e1 ===> t1->t2; te |- e2 ===> t1 |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   379
\        P(((te,e1 @ e2),t2)) \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   380
\   |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   381
\   P(((te,e),t))";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   382
by (resolve_tac (prems RL [lfp_elim2]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   383
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   384
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   385
by (dtac CollectD 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   386
by Safe_tac;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   387
by (ALLGOALS (resolve_tac prems));
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   388
by (ALLGOALS (Blast_tac));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   389
qed "elab_elim0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   390
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   391
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   392
  " [| te |- e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   393
\       !!te c t. c isof t ==> P te (e_const c) t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   394
\      !!te x. x:te_dom(te) ==> P te (e_var x) (te_app te x); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   395
\      !!te x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   396
\        te + {x |=> t1} |- e ===> t2 ==> P te (fn x => e) (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   397
\      !!te f x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   398
\        te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2 ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   399
\        P te (fix f(x) = e) (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   400
\      !!te e1 e2 t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   401
\        [| te |- e1 ===> t1->t2; te |- e2 ===> t1 |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   402
\        P te (e1 @ e2) t2 \ 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   403
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   404
\   P te e t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   405
by (res_inst_tac [("P","P")] infsys_pp2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   406
by (rtac elab_elim0 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   407
by (ALLGOALS (rtac infsys_pp1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   408
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   409
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   410
qed "elab_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   411
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   412
(* Elimination rules for each expression *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   413
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   414
fun elab_e_elim_tac p = 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   415
  ( (rtac elab_elim 1) THEN 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   416
    (resolve_tac p 1) THEN 
4353
d565d2197a5f updated for latest Blast_tac, which treats equality differently
paulson
parents: 4153
diff changeset
   417
    (REPEAT (fast_tac (e_ext_cs HOL_cs) 1))
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   418
  );
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   419
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   420
val prems = goal MT.thy "te |- e ===> t ==> (e = e_const(c) --> c isof t)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   421
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   422
qed "elab_const_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   423
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   424
Goal "te |- e_const(c) ===> t ==> c isof t";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   425
by (dtac elab_const_elim_lem 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   426
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   427
qed "elab_const_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   428
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   429
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   430
  "te |- e ===> t ==> (e = e_var(x) --> t=te_app te x & x:te_dom(te))";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   431
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   432
qed "elab_var_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   433
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   434
Goal "te |- e_var(ev) ===> t ==> t=te_app te ev & ev : te_dom(te)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   435
by (dtac elab_var_elim_lem 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   436
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   437
qed "elab_var_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   438
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   439
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   440
  " te |- e ===> t ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   441
\   ( e = fn x1 => e1 --> \
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2935
diff changeset
   442
\     (? t1 t2. t=t_fun t1 t2 & te + {x1 |=> t1} |- e1 ===> t2) \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   443
\   )";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   444
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   445
qed "elab_fn_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   446
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   447
Goal " te |- fn x1 => e1 ===> t ==> \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   448
\   (? t1 t2. t=t1->t2 & te + {x1 |=> t1} |- e1 ===> t2)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   449
by (dtac elab_fn_elim_lem 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   450
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   451
qed "elab_fn_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   452
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   453
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   454
  " te |- e ===> t ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   455
\   (e = fix f(x) = e1 --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   456
\   (? t1 t2. t=t1->t2 & te + {f |=> t1->t2} + {x |=> t1} |- e1 ===> t2))"; 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   457
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   458
qed "elab_fix_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   459
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   460
Goal " te |- fix ev1(ev2) = e1 ===> t ==> \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   461
\   (? t1 t2. t=t1->t2 & te + {ev1 |=> t1->t2} + {ev2 |=> t1} |- e1 ===> t2)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   462
by (dtac elab_fix_elim_lem 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   463
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   464
qed "elab_fix_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   465
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   466
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   467
  " te |- e ===> t2 ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   468
\   (e = e1 @ e2 --> (? t1 . te |- e1 ===> t1->t2 & te |- e2 ===> t1))"; 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   469
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   470
qed "elab_app_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   471
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   472
Goal "te |- e1 @ e2 ===> t2 ==> (? t1 . te |- e1 ===> t1->t2 & te |- e2 ===> t1)"; 
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   473
by (dtac elab_app_elim_lem 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   474
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   475
qed "elab_app_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   476
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   477
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   478
(* The extended correspondence relation                       *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   479
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   480
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   481
(* Monotonicity of hasty_fun *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   482
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   483
Goalw [mono_def,MT.hasty_fun_def] "mono(hasty_fun)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   484
by infsys_mono_tac;
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   485
by (Blast_tac 1);
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   486
qed "mono_hasty_fun";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   487
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   488
(* 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   489
  Because hasty_rel has been defined as the greatest fixpoint of hasty_fun it 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   490
  enjoys two strong indtroduction (co-induction) rules and an elimination rule.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   491
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   492
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   493
(* First strong indtroduction (co-induction) rule for hasty_rel *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   494
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   495
Goalw [hasty_rel_def] "c isof t ==> (v_const(c),t) : hasty_rel";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   496
by (rtac gfp_coind2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   497
by (rewtac MT.hasty_fun_def);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   498
by (rtac CollectI 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   499
by (rtac disjI1 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   500
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   501
by (rtac mono_hasty_fun 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   502
qed "hasty_rel_const_coind";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   503
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   504
(* Second strong introduction (co-induction) rule for hasty_rel *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   505
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   506
Goalw [hasty_rel_def]
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   507
  " [|  te |- fn ev => e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   508
\       ve_dom(ve) = te_dom(te); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   509
\       ! ev1. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   510
\         ev1:ve_dom(ve) --> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   511
\         (ve_app ve ev1,te_app te ev1) : {(v_clos(<|ev,e,ve|>),t)} Un hasty_rel \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   512
\   |] ==> \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   513
\   (v_clos(<|ev,e,ve|>),t) : hasty_rel";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   514
by (rtac gfp_coind2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   515
by (rewtac hasty_fun_def);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   516
by (rtac CollectI 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   517
by (rtac disjI2 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   518
by (blast_tac HOL_cs 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   519
by (rtac mono_hasty_fun 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   520
qed "hasty_rel_clos_coind";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   521
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   522
(* Elimination rule for hasty_rel *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   523
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   524
val prems = goalw MT.thy [hasty_rel_def]
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2935
diff changeset
   525
  " [| !! c t. c isof t ==> P((v_const(c),t)); \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   526
\      !! te ev e t ve. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   527
\        [| te |- fn ev => e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   528
\           ve_dom(ve) = te_dom(te); \
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2935
diff changeset
   529
\           !ev1. ev1:ve_dom(ve) --> (ve_app ve ev1,te_app te ev1) : hasty_rel \
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   530
\        |] ==> P((v_clos(<|ev,e,ve|>),t)); \
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   531
\      (v,t) : hasty_rel \
8114
09a7a180cc99 tidied parentheses
paulson
parents: 7499
diff changeset
   532
\   |] ==> P(v,t)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   533
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   534
by (etac gfp_elim2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   535
by (rtac mono_hasty_fun 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   536
by (rewtac hasty_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   537
by (dtac CollectD 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   538
by (fold_goals_tac [hasty_fun_def]);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   539
by Safe_tac;
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   540
by (REPEAT (ares_tac prems 1));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   541
qed "hasty_rel_elim0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   542
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   543
val prems = goal MT.thy 
972
e61b058d58d2 changed syntax of tuples from <..., ...> to (..., ...)
clasohm
parents: 969
diff changeset
   544
  " [| (v,t) : hasty_rel; \
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2935
diff changeset
   545
\      !! c t. c isof t ==> P (v_const c) t; \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   546
\      !! te ev e t ve. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   547
\        [| te |- fn ev => e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   548
\           ve_dom(ve) = te_dom(te); \
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2935
diff changeset
   549
\           !ev1. ev1:ve_dom(ve) --> (ve_app ve ev1,te_app te ev1) : hasty_rel \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   550
\        |] ==> P (v_clos <|ev,e,ve|>) t \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   551
\   |] ==> P v t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   552
by (res_inst_tac [("P","P")] infsys_p2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   553
by (rtac hasty_rel_elim0 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   554
by (ALLGOALS (rtac infsys_p1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   555
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   556
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_p2 1)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   557
qed "hasty_rel_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   558
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   559
(* Introduction rules for hasty *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   560
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   561
Goalw [hasty_def] "c isof t ==> v_const(c) hasty t";
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   562
by (etac hasty_rel_const_coind 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   563
qed "hasty_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   564
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   565
Goalw [hasty_def,hasty_env_def] 
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   566
 "te |- fn ev => e ===> t & ve hastyenv te ==> v_clos(<|ev,e,ve|>) hasty t";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   567
by (rtac hasty_rel_clos_coind 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   568
by (ALLGOALS (blast_tac (claset() delrules [equalityI])));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   569
qed "hasty_clos";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   570
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   571
(* Elimination on constants for hasty *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   572
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   573
Goalw [hasty_def] 
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   574
  "v hasty t ==> (!c.(v = v_const(c) --> c isof t))";  
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   575
by (rtac hasty_rel_elim 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   576
by (ALLGOALS (blast_tac (v_ext_cs HOL_cs)));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   577
qed "hasty_elim_const_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   578
5143
b94cd208f073 Removal of leading "\!\!..." from most Goal commands
paulson
parents: 5069
diff changeset
   579
Goal "v_const(c) hasty t ==> c isof t";
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   580
by (dtac hasty_elim_const_lem 1);
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   581
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   582
qed "hasty_elim_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   583
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   584
(* Elimination on closures for hasty *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   585
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   586
Goalw [hasty_env_def,hasty_def] 
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   587
  " v hasty t ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   588
\   ! x e ve. \
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2935
diff changeset
   589
\     v=v_clos(<|x,e,ve|>) --> (? te. te |- fn x => e ===> t & ve hastyenv te)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   590
by (rtac hasty_rel_elim 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   591
by (ALLGOALS (blast_tac (v_ext_cs HOL_cs)));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   592
qed "hasty_elim_clos_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   593
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   594
Goal "v_clos(<|ev,e,ve|>) hasty t ==>  \
3842
b55686a7b22c fixed dots;
wenzelm
parents: 2935
diff changeset
   595
\       ? te. te |- fn ev => e ===> t & ve hastyenv te ";
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   596
by (dtac hasty_elim_clos_lem 1);
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   597
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   598
qed "hasty_elim_clos";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   599
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   600
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   601
(* The pointwise extension of hasty to environments             *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   602
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   603
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   604
Goal "[| ve hastyenv te; v hasty t |] ==> \
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   605
\        ve + {ev |-> v} hastyenv te + {ev |=> t}";
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   606
by (rewtac hasty_env_def);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   607
by (asm_full_simp_tac (simpset() delsimps mem_simps
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 1047
diff changeset
   608
                                addsimps [ve_dom_owr, te_dom_owr]) 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   609
by (safe_tac HOL_cs);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   610
by (excluded_middle_tac "ev=x" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   611
by (asm_full_simp_tac (simpset() addsimps [ve_app_owr2, te_app_owr2]) 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   612
by (Blast_tac 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   613
by (asm_simp_tac (simpset() addsimps [ve_app_owr1, te_app_owr1]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   614
qed "hasty_env1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   615
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   616
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   617
(* The Consistency theorem                                      *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   618
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   619
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   620
Goal "[| ve hastyenv te ; te |- e_const(c) ===> t |] ==> v_const(c) hasty t";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   621
by (dtac elab_const_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   622
by (etac hasty_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   623
qed "consistency_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   624
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   625
Goalw [hasty_env_def]
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   626
  "[| ev : ve_dom(ve); ve hastyenv te ; te |- e_var(ev) ===> t |] ==> \
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   627
\       ve_app ve ev hasty t";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   628
by (dtac elab_var_elim 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   629
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   630
qed "consistency_var";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   631
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   632
Goal "[| ve hastyenv te ; te |- fn ev => e ===> t |] ==> \
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   633
\       v_clos(<| ev, e, ve |>) hasty t";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   634
by (rtac hasty_clos 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   635
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   636
qed "consistency_fn";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   637
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4353
diff changeset
   638
Goalw [hasty_env_def,hasty_def]
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   639
  "[| cl = <| ev1, e, ve + { ev2 |-> v_clos(cl) } |>; \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   640
\      ve hastyenv te ; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   641
\      te |- fix ev2  ev1  = e ===> t \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   642
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   643
\   v_clos(cl) hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   644
by (dtac elab_fix_elim 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   645
by (safe_tac HOL_cs);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   646
(*Do a single unfolding of cl*)
7499
23e090051cb8 isatool expandshort;
wenzelm
parents: 5278
diff changeset
   647
by ((ftac ssubst 1) THEN (assume_tac 2));
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   648
by (rtac hasty_rel_clos_coind 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   649
by (etac elab_fn 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   650
by (asm_simp_tac (simpset() addsimps [ve_dom_owr, te_dom_owr]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   651
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   652
by (asm_simp_tac (simpset() delsimps mem_simps addsimps [ve_dom_owr]) 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   653
by (safe_tac HOL_cs);
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   654
by (excluded_middle_tac "ev2=ev1a" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   655
by (asm_full_simp_tac (simpset() addsimps [ve_app_owr2, te_app_owr2]) 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   656
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   657
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   658
by (asm_simp_tac (simpset() delsimps mem_simps
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 1047
diff changeset
   659
                           addsimps [ve_app_owr1, te_app_owr1]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   660
by (hyp_subst_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   661
by (etac subst 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   662
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   663
qed "consistency_fix";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   664
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   665
Goal "[| ! t te. ve hastyenv te --> te |- e1 ===> t --> v_const(c1) hasty t;\
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   666
\      ! t te. ve hastyenv te  --> te |- e2 ===> t --> v_const(c2) hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   667
\      ve hastyenv te ; te |- e1 @ e2 ===> t \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   668
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   669
\   v_const(c_app c1 c2) hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   670
by (dtac elab_app_elim 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   671
by Safe_tac;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   672
by (rtac hasty_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   673
by (rtac isof_app 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   674
by (rtac hasty_elim_const 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   675
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   676
by (rtac hasty_elim_const 1);
2935
998cb95fdd43 Yet more fast_tac->blast_tac, and other tidying
paulson
parents: 1820
diff changeset
   677
by (Blast_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   678
qed "consistency_app1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   679
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   680
Goal "[| ! t te. \
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   681
\        ve hastyenv te  --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   682
\        te |- e1 ===> t --> v_clos(<|evm, em, vem|>) hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   683
\      ! t te. ve hastyenv te  --> te |- e2 ===> t --> v2 hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   684
\      ! t te. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   685
\        vem + { evm |-> v2 } hastyenv te  --> te |- em ===> t --> v hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   686
\      ve hastyenv te ; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   687
\      te |- e1 @ e2 ===> t \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   688
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   689
\   v hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   690
by (dtac elab_app_elim 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   691
by Safe_tac;
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   692
by ((etac allE 1) THEN (etac allE 1) THEN (etac impE 1));
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   693
by (assume_tac 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   694
by (etac impE 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   695
by (assume_tac 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   696
by ((etac allE 1) THEN (etac allE 1) THEN (etac impE 1));
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   697
by (assume_tac 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   698
by (etac impE 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   699
by (assume_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   700
by (dtac hasty_elim_clos 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   701
by Safe_tac;
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   702
by (dtac elab_fn_elim 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   703
by (blast_tac (claset() addIs [hasty_env1] addSDs [t_fun_inj]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   704
qed "consistency_app2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   705
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   706
Goal "ve |- e ---> v ==> \
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   707
\  (! t te. ve hastyenv te --> te |- e ===> t --> v hasty t)";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   708
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   709
(* Proof by induction on the structure of evaluations *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   710
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   711
by (etac eval_ind 1);
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   712
by Safe_tac;
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   713
by (DEPTH_SOLVE 
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   714
    (ares_tac [consistency_const, consistency_var, consistency_fn,
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1266
diff changeset
   715
               consistency_fix, consistency_app1, consistency_app2] 1));
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   716
qed "consistency";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   717
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   718
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   719
(* The Basic Consistency theorem                                *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   720
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   721
5148
74919e8f221c More tidying and removal of "\!\!... from Goal commands
paulson
parents: 5143
diff changeset
   722
Goalw [isof_env_def,hasty_env_def] 
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   723
  "ve isofenv te ==> ve hastyenv te";
4153
e534c4c32d54 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   724
by Safe_tac;
1047
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   725
by (etac allE 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   726
by (etac impE 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   727
by (assume_tac 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   728
by (etac exE 1);
5133479a37cf Simplified some proofs and made them work for new hyp_subst_tac.
lcp
parents: 972
diff changeset
   729
by (etac conjE 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   730
by (dtac hasty_const 1);
1266
3ae9fe3c0f68 added local simpsets
clasohm
parents: 1047
diff changeset
   731
by (Asm_simp_tac 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   732
qed "basic_consistency_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   733
5278
a903b66822e2 even more tidying of Goal commands
paulson
parents: 5227
diff changeset
   734
Goal "[| ve isofenv te; ve |- e ---> v_const(c); te |- e ===> t |] ==> c isof t";
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   735
by (rtac hasty_elim_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   736
by (dtac consistency 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3842
diff changeset
   737
by (blast_tac (claset() addSIs [basic_consistency_lem]) 1);
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   738
qed "basic_consistency";
1584
3d59c407bd36 Sets a lower value of Unify.search_bound
paulson
parents: 1465
diff changeset
   739
3d59c407bd36 Sets a lower value of Unify.search_bound
paulson
parents: 1465
diff changeset
   740
writeln"Reached end of file.";