src/HOL/ex/MT.ML
author clasohm
Wed, 22 Mar 1995 12:42:34 +0100
changeset 969 b051e2fc2e34
child 972 e61b058d58d2
permissions -rw-r--r--
converted ex with curried function application
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
969
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     1
(*  Title: 	HOL/ex/mt.ML
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     2
    ID:         $Id$
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
     3
    Author: 	Jacob Frost, Cambridge University Computer Laboratory
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).
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    14
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    15
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    16
open MT;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    17
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    18
val prems = goal MT.thy "~a:{b} ==> ~a=b";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    19
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    20
by (rtac notI 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    21
by (dtac notE 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    22
by (hyp_subst_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    23
by (rtac singletonI 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    24
by (assume_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    25
qed "notsingletonI";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    26
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    27
val prems = goalw MT.thy [Un_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    28
  "[| c : A Un B; c : A & ~c : B ==> P; c : B ==> P |] ==> P";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    29
by (cut_facts_tac prems 1);bd CollectD 1;be disjE 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    30
by (cut_facts_tac [excluded_middle] 1);be disjE 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    31
by (resolve_tac prems 1);br conjI 1;ba 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    32
by (eresolve_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    33
by (eresolve_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    34
qed "UnSE";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    35
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    36
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    37
(* Inference systems                                            *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    38
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    39
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    40
val infsys_mono_tac =
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    41
  (rewtac subset_def) THEN (safe_tac HOL_cs) THEN (rtac ballI 1) THEN
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    42
  (rtac CollectI 1) THEN (dtac CollectD 1) THEN
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    43
  REPEAT 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    44
    ( (TRY ((etac disjE 1) THEN (rtac disjI2 2) THEN (rtac disjI1 1))) THEN
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    45
      (REPEAT (etac exE 1)) THEN (REPEAT (rtac exI 1)) THEN (fast_tac set_cs 1)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    46
    );
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    47
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    48
val prems = goal MT.thy "P a b ==> P (fst <a,b>) (snd <a,b>)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    49
by (rtac (fst_conv RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    50
by (rtac (snd_conv RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    51
by (resolve_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    52
qed "infsys_p1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    53
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    54
val prems = goal MT.thy "P (fst <a,b>) (snd <a,b>) ==> P a b";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    55
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    56
by (dtac (fst_conv RS subst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    57
by (dtac (snd_conv RS subst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    58
by (assume_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    59
qed "infsys_p2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    60
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    61
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    62
  "P a b c ==> P (fst(fst <<a,b>,c>)) (snd(fst <<a,b>,c>)) (snd <<a,b>,c>)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    63
by (rtac (fst_conv RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    64
by (rtac (fst_conv RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    65
by (rtac (snd_conv RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    66
by (rtac (snd_conv RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    67
by (resolve_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    68
qed "infsys_pp1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    69
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    70
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    71
  "P (fst(fst <<a,b>,c>)) (snd(fst <<a,b>,c>)) (snd <<a,b>,c>) ==> P a b c";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    72
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    73
by (dtac (fst_conv RS subst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    74
by (dtac (fst_conv RS subst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    75
by (dtac (snd_conv RS subst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    76
by (dtac (snd_conv RS subst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    77
by (assume_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    78
qed "infsys_pp2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    79
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    80
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    81
(* Fixpoints                                                    *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    82
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    83
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    84
(* Least fixpoints *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    85
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    86
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
    87
by (rtac subsetD 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    88
by (rtac lfp_lemma2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    89
by (resolve_tac prems 1);brs prems 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    90
qed "lfp_intro2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    91
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    92
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    93
  " [| x:lfp(f); mono(f); !!y. y:f(lfp(f)) ==> P(y) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    94
\   P(x)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    95
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    96
by (resolve_tac prems 1);br subsetD 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    97
by (rtac lfp_lemma3 1);ba 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    98
qed "lfp_elim2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
    99
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   100
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   101
  " [| x:lfp(f); mono(f); !!y. y:f(lfp(f) Int {x.P(x)}) ==> P(y) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   102
\   P(x)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   103
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   104
by (etac induct 1);ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   105
by (eresolve_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   106
qed "lfp_ind2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   107
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   108
(* Greatest fixpoints *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   109
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   110
(* 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
   111
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   112
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
   113
by (rtac (cih RSN (2,gfp_upperbound RS subsetD)) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   114
by (rtac (monoh RS monoD) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   115
by (rtac (UnE RS subsetI) 1);ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   116
by (fast_tac (set_cs addSIs [cih]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   117
by (rtac (monoh RS monoD RS subsetD) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   118
by (rtac Un_upper2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   119
by (etac (monoh RS gfp_lemma2 RS subsetD) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   120
qed "gfp_coind2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   121
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   122
val [gfph,monoh,caseh] = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   123
  "[| x:gfp(f); mono(f); !! y. y:f(gfp(f)) ==> P(y) |] ==> P(x)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   124
by (rtac caseh 1);br subsetD 1;br gfp_lemma2 1;br monoh 1;br gfph 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   125
qed "gfp_elim2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   126
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   127
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   128
(* Expressions                                                  *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   129
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   130
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   131
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
   132
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   133
val e_disjs = 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   134
  [ e_disj_const_var, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   135
    e_disj_const_fn, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   136
    e_disj_const_fix, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   137
    e_disj_const_app,
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   138
    e_disj_var_fn, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   139
    e_disj_var_fix, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   140
    e_disj_var_app, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   141
    e_disj_fn_fix, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   142
    e_disj_fn_app, 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   143
    e_disj_fix_app
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   144
  ];
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   145
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   146
val e_disj_si = e_disjs @ (e_disjs RL [not_sym]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   147
val e_disj_se = (e_disj_si RL [notE]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   148
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   149
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
   150
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   151
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   152
(* Values                                                      *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   153
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   154
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   155
val v_disjs = [v_disj_const_clos];
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   156
val v_disj_si = v_disjs @ (v_disjs RL [not_sym]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   157
val v_disj_se = (v_disj_si RL [notE]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   158
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   159
val v_injs = [v_const_inj, v_clos_inj];
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   160
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   161
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
   162
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   163
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   164
(* Evaluations                                                  *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   165
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   166
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   167
(* Monotonicity of eval_fun *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   168
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   169
goalw MT.thy [mono_def, eval_fun_def] "mono(eval_fun)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   170
by infsys_mono_tac;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   171
qed "eval_fun_mono";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   172
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   173
(* Introduction rules *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   174
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   175
goalw MT.thy [eval_def, eval_rel_def] "ve |- e_const(c) ---> v_const(c)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   176
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   177
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   178
by (rewtac eval_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   179
by (rtac CollectI 1);br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   180
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   181
qed "eval_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   182
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   183
val prems = goalw MT.thy [eval_def, eval_rel_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   184
  "ev:ve_dom(ve) ==> ve |- e_var(ev) ---> ve_app ve ev";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   185
by (cut_facts_tac prems 1);
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);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   189
by (rtac CollectI 1);br disjI2 1;br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   190
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   191
qed "eval_var";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   192
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   193
val prems = goalw MT.thy [eval_def, eval_rel_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   194
  "ve |- fn ev => e ---> v_clos(<|ev,e,ve|>)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   195
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   196
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   197
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   198
by (rewtac eval_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   199
by (rtac CollectI 1);br disjI2 1;br disjI2 1;br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   200
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   201
qed "eval_fn";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   202
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   203
val prems = goalw MT.thy [eval_def, eval_rel_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   204
  " cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   205
\   ve |- fix ev2(ev1) = e ---> v_clos(cl)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   206
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   207
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   208
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   209
by (rewtac eval_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   210
by (rtac CollectI 1);br disjI2 1;br disjI2 1;br disjI2 1;br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   211
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   212
qed "eval_fix";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   213
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   214
val prems = goalw MT.thy [eval_def, eval_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   215
  " [| ve |- e1 ---> v_const(c1); ve |- e2 ---> v_const(c2) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   216
\   ve |- e1 @ e2 ---> v_const(c_app c1 c2)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   217
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   218
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   219
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   220
by (rewtac eval_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   221
by (rtac CollectI 1);br disjI2 1;br disjI2 1;br disjI2 1;br disjI2 1;br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   222
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   223
qed "eval_app1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   224
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   225
val prems = goalw MT.thy [eval_def, eval_rel_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   226
  " [|  ve |- e1 ---> v_clos(<|xm,em,vem|>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   227
\       ve |- e2 ---> v2; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   228
\       vem + {xm |-> v2} |- em ---> v \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   229
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   230
\   ve |- e1 @ e2 ---> v";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   231
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   232
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   233
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   234
by (rewtac eval_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   235
by (rtac CollectI 1);br disjI2 1;br disjI2 1;br disjI2 1;br disjI2 1;br disjI2 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   236
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   237
qed "eval_app2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   238
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   239
(* Strong elimination, induction on evaluations *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   240
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   241
val prems = goalw MT.thy [eval_def, eval_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   242
  " [| ve |- e ---> v; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   243
\      !!ve c. P(<<ve,e_const(c)>,v_const(c)>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   244
\      !!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
   245
\      !!ev ve e. P(<<ve,fn ev => e>,v_clos(<|ev,e,ve|>)>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   246
\      !!ev1 ev2 ve cl e. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   247
\        cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   248
\        P(<<ve,fix ev2(ev1) = e>,v_clos(cl)>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   249
\      !!ve c1 c2 e1 e2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   250
\        [| P(<<ve,e1>,v_const(c1)>); P(<<ve,e2>,v_const(c2)>) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   251
\        P(<<ve,e1 @ e2>,v_const(c_app c1 c2)>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   252
\      !!ve vem xm e1 e2 em v v2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   253
\        [|  P(<<ve,e1>,v_clos(<|xm,em,vem|>)>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   254
\            P(<<ve,e2>,v2>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   255
\            P(<<vem + {xm |-> v2},em>,v>) \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   256
\        |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   257
\        P(<<ve,e1 @ e2>,v>) \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   258
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   259
\   P(<<ve,e>,v>)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   260
by (resolve_tac (prems RL [lfp_ind2]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   261
by (rtac eval_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   262
by (rewtac eval_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   263
by (dtac CollectD 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   264
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   265
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   266
by (ALLGOALS (fast_tac set_cs));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   267
qed "eval_ind0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   268
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   269
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   270
  " [| ve |- e ---> v; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   271
\      !!ve c. P ve (e_const c) (v_const c); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   272
\      !!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
   273
\      !!ev ve e. P ve (fn ev => e) (v_clos <|ev,e,ve|>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   274
\      !!ev1 ev2 ve cl e. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   275
\        cl = <| ev1, e, ve + {ev2 |-> v_clos(cl)} |> ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   276
\        P ve (fix ev2(ev1) = e) (v_clos cl); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   277
\      !!ve c1 c2 e1 e2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   278
\        [| P ve e1 (v_const c1); P ve e2 (v_const c2) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   279
\        P ve (e1 @ e2) (v_const(c_app c1 c2)); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   280
\      !!ve vem evm e1 e2 em v v2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   281
\        [|  P ve e1 (v_clos <|evm,em,vem|>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   282
\            P ve e2 v2; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   283
\            P (vem + {evm |-> v2}) em v \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   284
\        |] ==> P ve (e1 @ e2) v \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   285
\   |] ==> P ve e v";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   286
by (res_inst_tac [("P","P")] infsys_pp2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   287
by (rtac eval_ind0 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   288
by (ALLGOALS (rtac infsys_pp1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   289
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   290
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   291
qed "eval_ind";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   292
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   293
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   294
(* Elaborations                                                 *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   295
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   296
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   297
goalw MT.thy [mono_def, elab_fun_def] "mono(elab_fun)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   298
by infsys_mono_tac;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   299
qed "elab_fun_mono";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   300
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   301
(* Introduction rules *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   302
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   303
val prems = goalw MT.thy [elab_def, elab_rel_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   304
  "c isof ty ==> te |- e_const(c) ===> ty";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   305
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   306
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   307
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   308
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   309
by (rtac CollectI 1);br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   310
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   311
qed "elab_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   312
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   313
val prems = goalw MT.thy [elab_def, elab_rel_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   314
  "x:te_dom(te) ==> te |- e_var(x) ===> te_app te x";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   315
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   316
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   317
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   318
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   319
by (rtac CollectI 1);br disjI2 1;br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   320
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   321
qed "elab_var";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   322
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   323
val prems = goalw MT.thy [elab_def, elab_rel_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   324
  "te + {x |=> ty1} |- e ===> ty2 ==> te |- fn x => e ===> ty1->ty2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   325
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   326
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   327
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   328
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   329
by (rtac CollectI 1);br disjI2 1;br disjI2 1;br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   330
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   331
qed "elab_fn";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   332
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   333
val prems = goalw MT.thy [elab_def, elab_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   334
  " te + {f |=> ty1->ty2} + {x |=> ty1} |- e ===> ty2 ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   335
\   te |- fix f(x) = e ===> ty1->ty2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   336
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   337
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   338
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   339
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   340
by (rtac CollectI 1);br disjI2 1;br disjI2 1;br disjI2 1;br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   341
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   342
qed "elab_fix";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   343
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   344
val prems = goalw MT.thy [elab_def, elab_rel_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   345
  " [| te |- e1 ===> ty1->ty2; te |- e2 ===> ty1 |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   346
\   te |- e1 @ e2 ===> ty2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   347
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   348
by (rtac lfp_intro2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   349
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   350
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   351
by (rtac CollectI 1);br disjI2 1;br disjI2 1;br disjI2 1;br disjI2 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   352
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   353
qed "elab_app";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   354
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   355
(* Strong elimination, induction on elaborations *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   356
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   357
val prems = goalw MT.thy [elab_def, elab_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   358
  " [| te |- e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   359
\      !!te c t. c isof t ==> P(<<te,e_const(c)>,t>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   360
\      !!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
   361
\      !!te x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   362
\        [| te + {x |=> t1} |- e ===> t2; P(<<te + {x |=> t1},e>,t2>) |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   363
\        P(<<te,fn x => e>,t1->t2>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   364
\      !!te f x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   365
\        [| te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   366
\           P(<<te + {f |=> t1->t2} + {x |=> t1},e>,t2>) \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   367
\        |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   368
\        P(<<te,fix f(x) = e>,t1->t2>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   369
\      !!te e1 e2 t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   370
\        [| te |- e1 ===> t1->t2; P(<<te,e1>,t1->t2>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   371
\           te |- e2 ===> t1; P(<<te,e2>,t1>) \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   372
\        |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   373
\        P(<<te,e1 @ e2>,t2>) \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   374
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   375
\   P(<<te,e>,t>)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   376
by (resolve_tac (prems RL [lfp_ind2]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   377
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   378
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   379
by (dtac CollectD 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   380
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   381
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   382
by (ALLGOALS (fast_tac set_cs));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   383
qed "elab_ind0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   384
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   385
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   386
  " [| te |- e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   387
\       !!te c t. c isof t ==> P te (e_const c) t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   388
\      !!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
   389
\      !!te x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   390
\        [| te + {x |=> t1} |- e ===> t2; P (te + {x |=> t1}) e t2 |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   391
\        P te (fn x => e) (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   392
\      !!te f x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   393
\        [| te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   394
\           P (te + {f |=> t1->t2} + {x |=> t1}) e t2 \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   395
\        |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   396
\        P te (fix f(x) = e) (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   397
\      !!te e1 e2 t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   398
\        [| te |- e1 ===> t1->t2; P te e1 (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   399
\           te |- e2 ===> t1; P te e2 t1 \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   400
\        |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   401
\        P te (e1 @ e2) t2 \ 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   402
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   403
\   P te e t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   404
by (res_inst_tac [("P","P")] infsys_pp2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   405
by (rtac elab_ind0 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   406
by (ALLGOALS (rtac infsys_pp1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   407
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   408
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   409
qed "elab_ind";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   410
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   411
(* Weak elimination, case analysis on elaborations *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   412
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   413
val prems = goalw MT.thy [elab_def, elab_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   414
  " [| te |- e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   415
\      !!te c t. c isof t ==> P(<<te,e_const(c)>,t>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   416
\      !!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
   417
\      !!te x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   418
\        te + {x |=> t1} |- e ===> t2 ==> P(<<te,fn x => e>,t1->t2>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   419
\      !!te f x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   420
\        te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2 ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   421
\        P(<<te,fix f(x) = e>,t1->t2>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   422
\      !!te e1 e2 t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   423
\        [| te |- e1 ===> t1->t2; te |- e2 ===> t1 |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   424
\        P(<<te,e1 @ e2>,t2>) \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   425
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   426
\   P(<<te,e>,t>)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   427
by (resolve_tac (prems RL [lfp_elim2]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   428
by (rtac elab_fun_mono 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   429
by (rewtac elab_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   430
by (dtac CollectD 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   431
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   432
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   433
by (ALLGOALS (fast_tac set_cs));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   434
qed "elab_elim0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   435
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   436
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   437
  " [| te |- e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   438
\       !!te c t. c isof t ==> P te (e_const c) t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   439
\      !!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
   440
\      !!te x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   441
\        te + {x |=> t1} |- e ===> t2 ==> P te (fn x => e) (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   442
\      !!te f x e t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   443
\        te + {f |=> t1->t2} + {x |=> t1} |- e ===> t2 ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   444
\        P te (fix f(x) = e) (t1->t2); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   445
\      !!te e1 e2 t1 t2. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   446
\        [| te |- e1 ===> t1->t2; te |- e2 ===> t1 |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   447
\        P te (e1 @ e2) t2 \ 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   448
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   449
\   P te e t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   450
by (res_inst_tac [("P","P")] infsys_pp2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   451
by (rtac elab_elim0 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   452
by (ALLGOALS (rtac infsys_pp1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   453
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   454
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_pp2 1)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   455
qed "elab_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   456
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   457
(* Elimination rules for each expression *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   458
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   459
fun elab_e_elim_tac p = 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   460
  ( (rtac elab_elim 1) THEN 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   461
    (resolve_tac p 1) THEN 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   462
    (REPEAT (fast_tac (e_ext_cs HOL_cs) 1))
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   463
  );
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   464
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   465
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
   466
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   467
qed "elab_const_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   468
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   469
val prems = goal MT.thy "te |- e_const(c) ===> t ==> c isof t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   470
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   471
by (dtac elab_const_elim_lem 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   472
by (fast_tac prop_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   473
qed "elab_const_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   474
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   475
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   476
  "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
   477
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   478
qed "elab_var_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   479
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   480
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   481
  "te |- e_var(ev) ===> t ==> t=te_app te ev & ev : te_dom(te)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   482
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   483
by (dtac elab_var_elim_lem 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   484
by (fast_tac prop_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   485
qed "elab_var_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   486
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   487
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   488
  " te |- e ===> t ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   489
\   ( e = fn x1 => e1 --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   490
\     (? t1 t2.t=t_fun t1 t2 & te + {x1 |=> t1} |- e1 ===> t2) \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   491
\   )";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   492
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   493
qed "elab_fn_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   494
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   495
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   496
  " te |- fn x1 => e1 ===> t ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   497
\   (? t1 t2. t=t1->t2 & te + {x1 |=> t1} |- e1 ===> t2)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   498
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   499
by (dtac elab_fn_elim_lem 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   500
by (fast_tac prop_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   501
qed "elab_fn_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   502
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   503
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   504
  " te |- e ===> t ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   505
\   (e = fix f(x) = e1 --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   506
\   (? t1 t2. t=t1->t2 & te + {f |=> t1->t2} + {x |=> t1} |- e1 ===> t2))"; 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   507
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   508
qed "elab_fix_elim_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   509
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   510
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   511
  " te |- fix ev1(ev2) = e1 ===> t ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   512
\   (? t1 t2. t=t1->t2 & te + {ev1 |=> t1->t2} + {ev2 |=> t1} |- e1 ===> t2)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   513
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   514
by (dtac elab_fix_elim_lem 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   515
by (fast_tac prop_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   516
qed "elab_fix_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   517
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   518
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   519
  " te |- e ===> t2 ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   520
\   (e = e1 @ e2 --> (? t1 . te |- e1 ===> t1->t2 & te |- e2 ===> t1))"; 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   521
by (elab_e_elim_tac prems);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   522
qed "elab_app_elim_lem";
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 = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   525
  "te |- e1 @ e2 ===> t2 ==> (? t1 . te |- e1 ===> t1->t2 & te |- e2 ===> t1)"; 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   526
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   527
by (dtac elab_app_elim_lem 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   528
by (fast_tac prop_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   529
qed "elab_app_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   530
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   531
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   532
(* The extended correspondence relation                       *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   533
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   534
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   535
(* Monotonicity of hasty_fun *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   536
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   537
goalw MT.thy [mono_def,MT.hasty_fun_def] "mono(hasty_fun)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   538
by infsys_mono_tac;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   539
bind_thm("mono_hasty_fun",  result());
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   540
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   541
(* 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   542
  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
   543
  enjoys two strong indtroduction (co-induction) rules and an elimination rule.
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   544
*)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   545
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   546
(* First strong indtroduction (co-induction) rule for hasty_rel *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   547
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   548
val prems = goalw MT.thy [hasty_rel_def] "c isof t ==> <v_const(c),t> : hasty_rel";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   549
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   550
by (rtac gfp_coind2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   551
by (rewtac MT.hasty_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   552
by (rtac CollectI 1);br disjI1 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   553
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   554
by (rtac mono_hasty_fun 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   555
qed "hasty_rel_const_coind";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   556
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   557
(* Second strong introduction (co-induction) rule for hasty_rel *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   558
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   559
val prems = goalw MT.thy [hasty_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   560
  " [|  te |- fn ev => e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   561
\       ve_dom(ve) = te_dom(te); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   562
\       ! ev1. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   563
\         ev1:ve_dom(ve) --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   564
\         <ve_app ve ev1,te_app te ev1> : {<v_clos(<|ev,e,ve|>),t>} Un hasty_rel \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   565
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   566
\   <v_clos(<|ev,e,ve|>),t> : hasty_rel";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   567
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   568
by (rtac gfp_coind2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   569
by (rewtac hasty_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   570
by (rtac CollectI 1);br disjI2 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   571
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   572
by (rtac mono_hasty_fun 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   573
qed "hasty_rel_clos_coind";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   574
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   575
(* Elimination rule for hasty_rel *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   576
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   577
val prems = goalw MT.thy [hasty_rel_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   578
  " [| !! c t.c isof t ==> P(<v_const(c),t>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   579
\      !! te ev e t ve. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   580
\        [| te |- fn ev => e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   581
\           ve_dom(ve) = te_dom(te); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   582
\           !ev1.ev1:ve_dom(ve) --> <ve_app ve ev1,te_app te ev1> : hasty_rel \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   583
\        |] ==> P(<v_clos(<|ev,e,ve|>),t>); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   584
\      <v,t> : hasty_rel \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   585
\   |] ==> P(<v,t>)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   586
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   587
by (etac gfp_elim2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   588
by (rtac mono_hasty_fun 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   589
by (rewtac hasty_fun_def);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   590
by (dtac CollectD 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   591
by (fold_goals_tac [hasty_fun_def]);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   592
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   593
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   594
by (ALLGOALS (fast_tac set_cs));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   595
qed "hasty_rel_elim0";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   596
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   597
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   598
  " [| <v,t> : hasty_rel; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   599
\      !! c t.c isof t ==> P (v_const c) t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   600
\      !! te ev e t ve. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   601
\        [| te |- fn ev => e ===> t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   602
\           ve_dom(ve) = te_dom(te); \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   603
\           !ev1.ev1:ve_dom(ve) --> <ve_app ve ev1,te_app te ev1> : hasty_rel \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   604
\        |] ==> P (v_clos <|ev,e,ve|>) t \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   605
\   |] ==> P v t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   606
by (res_inst_tac [("P","P")] infsys_p2 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   607
by (rtac hasty_rel_elim0 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   608
by (ALLGOALS (rtac infsys_p1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   609
by (ALLGOALS (resolve_tac prems));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   610
by (REPEAT ((assume_tac 1) ORELSE (dtac infsys_p2 1)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   611
qed "hasty_rel_elim";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   612
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   613
(* Introduction rules for hasty *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   614
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   615
val prems = goalw MT.thy [hasty_def] "c isof t ==> v_const(c) hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   616
by (resolve_tac (prems RL [hasty_rel_const_coind]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   617
qed "hasty_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   618
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   619
val prems = goalw MT.thy [hasty_def,hasty_env_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   620
  "te |- fn ev => e ===> t & ve hastyenv te ==> v_clos(<|ev,e,ve|>) hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   621
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   622
by (rtac hasty_rel_clos_coind 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   623
by (ALLGOALS (fast_tac set_cs));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   624
qed "hasty_clos";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   625
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   626
(* Elimination on constants for hasty *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   627
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   628
val prems = goalw MT.thy [hasty_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   629
  "v hasty t ==> (!c.(v = v_const(c) --> c isof t))";  
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   630
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   631
by (rtac hasty_rel_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   632
by (ALLGOALS (fast_tac (v_ext_cs HOL_cs)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   633
qed "hasty_elim_const_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   634
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   635
val prems = goal MT.thy "v_const(c) hasty t ==> c isof t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   636
by (cut_facts_tac (prems RL [hasty_elim_const_lem]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   637
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   638
qed "hasty_elim_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   639
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   640
(* Elimination on closures for hasty *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   641
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   642
val prems = goalw MT.thy [hasty_env_def,hasty_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   643
  " v hasty t ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   644
\   ! x e ve. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   645
\     v=v_clos(<|x,e,ve|>) --> (? te.te |- fn x => e ===> t & ve hastyenv te)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   646
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   647
by (rtac hasty_rel_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   648
by (ALLGOALS (fast_tac (v_ext_cs HOL_cs)));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   649
qed "hasty_elim_clos_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   650
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   651
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   652
  "v_clos(<|ev,e,ve|>) hasty t ==> ? te.te |- fn ev => e ===> t & ve hastyenv te ";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   653
by (cut_facts_tac (prems RL [hasty_elim_clos_lem]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   654
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   655
qed "hasty_elim_clos";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   656
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   657
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   658
(* The pointwise extension of hasty to environments             *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   659
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   660
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   661
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   662
  "[| ve hastyenv te; v hasty t |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   663
\  ve + {ev |-> v} hastyenv te + {ev |=> t}";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   664
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   665
by (SELECT_GOAL (rewtac hasty_env_def) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   666
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   667
by (rtac (ve_dom_owr RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   668
by (rtac (te_dom_owr RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   669
by (etac subst 1);br refl 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   670
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   671
by (dtac (ve_dom_owr RS subst) 1);back();back();back();
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   672
by (etac UnSE 1);be conjE 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   673
by (dtac notsingletonI 1);bd not_sym 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   674
by (rtac (ve_app_owr2 RS ssubst) 1);ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   675
by (rtac (te_app_owr2 RS ssubst) 1);ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   676
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   677
by (dtac singletonD 1);by (hyp_subst_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   678
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   679
by (rtac (ve_app_owr1 RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   680
by (rtac (te_app_owr1 RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   681
by (assume_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   682
qed "hasty_env1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   683
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   684
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   685
(* The Consistency theorem                                      *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   686
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   687
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   688
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   689
  "[| ve hastyenv te ; te |- e_const(c) ===> t |] ==> v_const(c) hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   690
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   691
by (dtac elab_const_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   692
by (etac hasty_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   693
qed "consistency_const";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   694
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   695
val prems = goalw MT.thy [hasty_env_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   696
  " [| ev : ve_dom(ve); ve hastyenv te ; te |- e_var(ev) ===> t |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   697
\   ve_app ve ev hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   698
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   699
by (dtac elab_var_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   700
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   701
qed "consistency_var";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   702
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   703
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   704
  " [| ve hastyenv te ; te |- fn ev => e ===> t |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   705
\   v_clos(<| ev, e, ve |>) hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   706
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   707
by (rtac hasty_clos 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   708
by (fast_tac prop_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   709
qed "consistency_fn";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   710
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   711
val prems = goalw MT.thy [hasty_env_def,hasty_def]
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   712
  " [| cl = <| ev1, e, ve + { ev2 |-> v_clos(cl) } |>; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   713
\      ve hastyenv te ; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   714
\      te |- fix ev2  ev1  = e ===> t \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   715
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   716
\   v_clos(cl) hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   717
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   718
by (dtac elab_fix_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   719
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   720
by ((forward_tac [ssubst] 1) THEN (assume_tac 2) THEN 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   721
    (rtac hasty_rel_clos_coind 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   722
by (etac elab_fn 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   723
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   724
by (rtac (ve_dom_owr RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   725
by (rtac (te_dom_owr RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   726
by ((etac subst 1) THEN (rtac refl 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   727
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   728
by (rtac (ve_dom_owr RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   729
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   730
by (dtac (Un_commute RS subst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   731
by (etac UnSE 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   732
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   733
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   734
by (dtac notsingletonI 1);bd not_sym 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   735
by (rtac (ve_app_owr2 RS ssubst) 1);ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   736
by (rtac (te_app_owr2 RS ssubst) 1);ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   737
by (fast_tac set_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   738
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   739
by (etac singletonE 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   740
by (hyp_subst_tac 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   741
by (rtac (ve_app_owr1 RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   742
by (rtac (te_app_owr1 RS ssubst) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   743
by (etac subst 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   744
by (fast_tac set_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   745
qed "consistency_fix";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   746
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   747
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   748
  " [| ! t te. ve hastyenv te  --> te |- e1 ===> t --> v_const(c1) hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   749
\      ! t te. ve hastyenv te  --> te |- e2 ===> t --> v_const(c2) hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   750
\      ve hastyenv te ; te |- e1 @ e2 ===> t \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   751
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   752
\   v_const(c_app c1 c2) hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   753
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   754
by (dtac elab_app_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   755
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   756
by (rtac hasty_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   757
by (rtac isof_app 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   758
by (rtac hasty_elim_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   759
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   760
by (rtac hasty_elim_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   761
by (fast_tac HOL_cs 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   762
qed "consistency_app1";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   763
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   764
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   765
  " [| ! t te. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   766
\        ve hastyenv te  --> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   767
\        te |- e1 ===> t --> v_clos(<|evm, em, vem|>) hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   768
\      ! t te. ve hastyenv te  --> te |- e2 ===> t --> v2 hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   769
\      ! t te. \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   770
\        vem + { evm |-> v2 } hastyenv te  --> te |- em ===> t --> v hasty t; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   771
\      ve hastyenv te ; \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   772
\      te |- e1 @ e2 ===> t \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   773
\   |] ==> \
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   774
\   v hasty t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   775
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   776
by (dtac elab_app_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   777
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   778
by ((etac allE 1) THEN (etac allE 1) THEN (etac impE 1));ba 1;be impE 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   779
by ((etac allE 1) THEN (etac allE 1) THEN (etac impE 1));ba 1;be impE 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   780
by (dtac hasty_elim_clos 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   781
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   782
by (dtac elab_fn_elim 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   783
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   784
by (dtac t_fun_inj 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   785
by (safe_tac prop_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   786
by ((dtac hasty_env1 1) THEN (assume_tac 1) THEN (fast_tac HOL_cs 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   787
qed "consistency_app2";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   788
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   789
val prems = goal MT.thy 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   790
  "ve |- e ---> v ==> (! t te. ve hastyenv te --> te |- e ===> t --> v hasty t)";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   791
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   792
(* Proof by induction on the structure of evaluations *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   793
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   794
by (resolve_tac (prems RL [eval_ind]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   795
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   796
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   797
by (rtac consistency_const 1);ba 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   798
by (rtac consistency_var 1);ba 1;ba 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   799
by (rtac consistency_fn 1);ba 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   800
by (rtac consistency_fix 1);ba 1;ba 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   801
by (rtac consistency_app1 1);ba 1;ba 1;ba 1;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   802
by (rtac consistency_app2 1);ba 5;ba 4;ba 3;ba 2;ba 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   803
qed "consistency";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   804
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   805
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   806
(* The Basic Consistency theorem                                *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   807
(* ############################################################ *)
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   808
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   809
val prems = goalw MT.thy [isof_env_def,hasty_env_def] 
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   810
  "ve isofenv te ==> ve hastyenv te";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   811
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   812
by (safe_tac HOL_cs);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   813
by (etac allE 1);be impE 1;ba 1;be exE 1;be conjE 1;
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   814
by (dtac hasty_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   815
by ((rtac ssubst 1) THEN (assume_tac 1) THEN (assume_tac 1));
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   816
qed "basic_consistency_lem";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   817
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   818
val prems = goal MT.thy
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   819
  "[| ve isofenv te; ve |- e ---> v_const(c); te |- e ===> t |] ==> c isof t";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   820
by (cut_facts_tac prems 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   821
by (rtac hasty_elim_const 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   822
by (dtac consistency 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   823
by (fast_tac (HOL_cs addSIs [basic_consistency_lem]) 1);
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   824
qed "basic_consistency";
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   825
b051e2fc2e34 converted ex with curried function application
clasohm
parents:
diff changeset
   826