src/HOL/Lambda/Eta.ML
author nipkow
Fri, 06 Oct 1995 10:45:11 +0100
changeset 1269 ee011b365770
child 1302 ddfdcc9ce667
permissions -rw-r--r--
New version with eta reduction.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Lambda/Eta.ML
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     2
    ID:         $Id$
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     3
    Author:     Tobias Nipkow
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     4
    Copyright   1995 TU Muenchen
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     5
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     6
Eta reduction,
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     7
confluence ot eta,
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     8
commutation of beta/eta,
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
     9
confluence of beta+eta
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    10
*)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    11
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    12
open Eta;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    13
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    14
(* FIXME: add Suc_pred glovbally *)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    15
Addsimps (Suc_pred :: eta.intrs);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    16
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    17
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    18
val eta_cases = map (eta.mk_cases db.simps)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    19
    ["Fun s -e> z","s @ t -e> u","Var i -e> t"];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    20
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    21
val beta_cases = map (beta.mk_cases db.simps)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    22
    ["s @ t -> u","Var i -> t"];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    23
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    24
(* FIXME: add r_into_rtrancl to trancl_cs ???
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    25
          build on lambda_ss which should build on trancl_cs *)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    26
val eta_cs = trancl_cs addIs (beta.intrs@eta.intrs)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    27
                       addSEs (beta_cases@eta_cases);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    28
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    29
(*** Arithmetic lemmas ***)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    30
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    31
goal Nat.thy "~ Suc n <= n";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    32
by(simp_tac (simpset_of "Nat" addsimps [le_def]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    33
qed "Suc_n_not_le_n";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    34
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    35
(* FIXME: move into Nat.ML *)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    36
goalw Nat.thy [le_def] "(i <= 0) = (i = 0)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    37
by(nat_ind_tac "i" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    38
by(ALLGOALS(Asm_simp_tac));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    39
qed "le_0";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    40
Addsimps [le_0];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    41
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    42
goal HOL.thy "!!P. P ==> P=True";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    43
by(fast_tac HOL_cs 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    44
qed "True_eq";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    45
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    46
Addsimps [less_not_sym RS True_eq];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    47
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    48
(* FIXME: move into Nat.ML *)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    49
goal Arith.thy "!!i. i<j ==> j<k --> Suc i < k";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    50
by(nat_ind_tac "k" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    51
by(ALLGOALS(asm_simp_tac(simpset_of "Arith")));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    52
by(fast_tac (HOL_cs addDs [Suc_lessD]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    53
bind_thm("less_trans_Suc",result() RS mp);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    54
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    55
goal Arith.thy "i < j --> pred i < j";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    56
by(nat_ind_tac "j" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    57
by(ALLGOALS(asm_simp_tac(simpset_of "Arith")));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    58
by(nat_ind_tac "j1" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    59
by(ALLGOALS(asm_simp_tac(simpset_of "Arith")));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    60
bind_thm("less_imp_pred_less",result() RS mp);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    61
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    62
goal Arith.thy "i<j --> ~ pred j < i";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    63
by(nat_ind_tac "j" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    64
by(ALLGOALS(asm_simp_tac(simpset_of "Arith")));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    65
by(fast_tac (HOL_cs addDs [less_imp_pred_less]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    66
bind_thm("less_imp_not_pred_less", result() RS mp);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    67
Addsimps [less_imp_not_pred_less];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    68
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    69
goal Nat.thy "i < j --> j < Suc(Suc i) --> j = Suc i";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    70
by(nat_ind_tac "j" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    71
by(ALLGOALS(simp_tac(simpset_of "Nat")));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    72
by(fast_tac (HOL_cs addDs [less_not_sym]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    73
bind_thm("less_interval1", result() RS mp RS mp);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    74
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    75
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    76
(*** decr and free ***)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    77
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    78
goal Eta.thy "!i k. free (lift t k) i = \
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    79
\                   (i < k & free t i | k < i & free t (pred i))";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    80
by(db.induct_tac "t" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    81
by(ALLGOALS(asm_full_simp_tac (addsplit (!simpset) addcongs [conj_cong])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    82
by(fast_tac HOL_cs 2);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    83
by(safe_tac (HOL_cs addSIs [iffI]));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    84
bd Suc_mono 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    85
by(ALLGOALS(Asm_full_simp_tac));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    86
by(dtac less_trans_Suc 1 THEN atac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    87
by(dtac less_trans_Suc 2 THEN atac 2);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    88
by(ALLGOALS(Asm_full_simp_tac));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    89
qed "free_lift";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    90
Addsimps [free_lift];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    91
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    92
goal Eta.thy "!i k t. free (s[t/k]) i = \
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    93
\              (free s k & free t i | free s (if i<k then i else Suc i))";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    94
by(db.induct_tac "s" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    95
by(ALLGOALS(asm_full_simp_tac (addsplit (!simpset) addsimps
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    96
[less_not_refl2,less_not_refl2 RS not_sym])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    97
by(fast_tac HOL_cs 2);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    98
by(safe_tac (HOL_cs addSIs [iffI]));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    99
by(ALLGOALS(Asm_simp_tac));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   100
by(fast_tac (HOL_cs addEs [less_imp_not_pred_less RS notE]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   101
by(fast_tac (HOL_cs addDs [less_not_sym]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   102
bd Suc_mono 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   103
by(dtac less_interval1 1 THEN atac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   104
by(asm_full_simp_tac (simpset_of "Nat" addsimps [eq_sym_conv]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   105
by(dtac less_trans_Suc 1 THEN atac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   106
by(Asm_full_simp_tac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   107
qed "free_subst";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   108
Addsimps [free_subst];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   109
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   110
goal Eta.thy "!!s. s -e> t ==> !i. free t i = free s i";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   111
be (eta.mutual_induct RS spec RS spec RSN (2,rev_mp)) 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   112
by(ALLGOALS(asm_simp_tac (!simpset addsimps [decr_def] addcongs [conj_cong])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   113
bind_thm("free_eta",result() RS spec);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   114
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   115
goal Eta.thy "!!s. [| s -e> t; ~free s i |] ==> ~free t i";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   116
by(asm_simp_tac (!simpset addsimps [free_eta]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   117
qed "not_free_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   118
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   119
goal Eta.thy "!i t u. ~free s i --> s[t/i] = s[u/i]";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   120
by(db.induct_tac "s" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   121
by(ALLGOALS(simp_tac (addsplit (!simpset))));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   122
by(fast_tac HOL_cs 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   123
by(fast_tac HOL_cs 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   124
bind_thm("subst_not_free", result() RS spec RS spec RS spec RS mp);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   125
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   126
goalw Eta.thy [decr_def] "!!s. ~free s i ==> s[t/i] = decr s i";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   127
be subst_not_free 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   128
qed "subst_decr";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   129
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   130
goal Eta.thy "!!s. s -e> t ==> !u i. s[u/i] -e> t[u/i]";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   131
be (eta.mutual_induct RS spec RS spec RSN (2,rev_mp)) 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   132
by(ALLGOALS(asm_simp_tac (!simpset addsimps [subst_subst RS sym,decr_def])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   133
by(asm_simp_tac (!simpset addsimps [subst_decr]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   134
bind_thm("eta_subst",result() RS spec RS spec);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   135
Addsimps [eta_subst];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   136
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   137
goalw Eta.thy [decr_def] "!!s. s -e> t ==> decr s i -e> decr t i";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   138
be eta_subst 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   139
qed "eta_decr";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   140
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   141
(*** Confluence of eta ***)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   142
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   143
goalw Eta.thy [id_def]
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   144
  "!x y. x-e> y --> (!z. x-e>z --> (? u. y -e>= u & z -e>= u))";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   145
br eta.mutual_induct 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   146
by(ALLGOALS(fast_tac (eta_cs addSEs [eta_decr,not_free_eta] addss !simpset)));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   147
val lemma = result() RS spec RS spec RS mp RS spec RS mp;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   148
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   149
goalw Eta.thy [diamond_def,commute_def,square_def] "diamond(eta^=)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   150
by(fast_tac (eta_cs addEs [lemma]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   151
qed "diamond_refl_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   152
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   153
goal Eta.thy "confluent(eta)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   154
by(stac (rtrancl_reflcl RS sym) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   155
by(rtac (diamond_refl_eta RS diamond_confluent) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   156
qed "eta_confluent";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   157
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   158
(*** Congruence rules for ->> ***)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   159
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   160
goal Eta.thy "!!s. s -e>> s' ==> Fun s -e>> Fun s'";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   161
be rtrancl_induct 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   162
by (ALLGOALS(fast_tac (eta_cs addIs [rtrancl_refl,rtrancl_into_rtrancl])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   163
qed "rtrancl_eta_Fun";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   164
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   165
goal Eta.thy "!!s. s -e>> s' ==> s @ t -e>> s' @ t";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   166
be rtrancl_induct 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   167
by (ALLGOALS(fast_tac (eta_cs addIs [rtrancl_refl,rtrancl_into_rtrancl])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   168
qed "rtrancl_eta_AppL";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   169
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   170
goal Eta.thy "!!s. t -e>> t' ==> s @ t -e>> s @ t'";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   171
be rtrancl_induct 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   172
by (ALLGOALS(fast_tac (eta_cs addIs [rtrancl_refl,rtrancl_into_rtrancl])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   173
qed "rtrancl_eta_AppR";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   174
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   175
goal Eta.thy "!!s. [| s -e>> s'; t -e>> t' |] ==> s @ t -e>> s' @ t'";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   176
by (fast_tac (eta_cs addSIs [rtrancl_eta_AppL,rtrancl_eta_AppR]
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   177
                     addIs [rtrancl_trans]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   178
qed "rtrancl_eta_App";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   179
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   180
(*** Commutation of beta and eta ***)
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   181
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   182
goal Eta.thy "!!s. s -> t ==> !i. free t i --> free s i";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   183
be (beta.mutual_induct RS spec RS spec RSN (2,rev_mp)) 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   184
by(ALLGOALS(Asm_full_simp_tac));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   185
bind_thm("free_beta", result() RS spec RS mp);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   186
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   187
goalw Eta.thy [decr_def] "!s t. s -> t --> (!i. decr s i -> decr t i)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   188
br beta.mutual_induct 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   189
by(ALLGOALS(asm_full_simp_tac (!simpset addsimps [subst_subst RS sym])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   190
bind_thm("beta_decr", result() RS spec RS spec RS mp RS spec);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   191
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   192
goalw Eta.thy [decr_def]
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   193
  "decr (Var i) k = (if i<=k then Var i else Var(pred i))";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   194
by(simp_tac (addsplit (!simpset) addsimps [le_def]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   195
qed "decr_Var";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   196
Addsimps [decr_Var];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   197
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   198
goalw Eta.thy [decr_def] "decr (s@t) i = (decr s i)@(decr t i)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   199
by(Simp_tac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   200
qed "decr_App";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   201
Addsimps [decr_App];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   202
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   203
goalw Eta.thy [decr_def] "decr (Fun s) i = Fun (decr s (Suc i))";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   204
by(Simp_tac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   205
qed "decr_Fun";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   206
Addsimps [decr_Fun];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   207
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   208
goal Eta.thy "!i. ~free t (Suc i) --> decr t i = decr t (Suc i)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   209
by(db.induct_tac "t" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   210
by(ALLGOALS(asm_simp_tac (addsplit (!simpset) addsimps [le_def])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   211
by(fast_tac (HOL_cs addDs [less_interval1]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   212
by(fast_tac HOL_cs 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   213
qed "decr_not_free";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   214
Addsimps [decr_not_free];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   215
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   216
goal Eta.thy "!s t. s -e> t --> (!i. lift s i -e> lift t i)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   217
br eta.mutual_induct 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   218
by(ALLGOALS(asm_simp_tac (addsplit (!simpset) addsimps [decr_def])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   219
by(asm_simp_tac (addsplit (!simpset) addsimps [subst_decr]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   220
bind_thm("eta_lift",result() RS spec RS spec RS mp RS spec);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   221
Addsimps [eta_lift];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   222
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   223
goal Eta.thy "!s t i. s -e> t --> u[s/i] -e>> u[t/i]";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   224
by(db.induct_tac "u" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   225
by(ALLGOALS(asm_simp_tac (addsplit (!simpset))));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   226
by(fast_tac (eta_cs addIs [r_into_rtrancl]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   227
by(fast_tac (eta_cs addIs [rtrancl_eta_App]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   228
by(fast_tac (eta_cs addSIs [rtrancl_eta_Fun,eta_lift]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   229
bind_thm("rtrancl_eta_subst", result() RS spec RS spec RS spec RS mp);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   230
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   231
goalw Eta.thy [square_def] "square beta eta (eta^*) (beta^=)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   232
br beta.mutual_induct 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   233
by(strip_tac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   234
bes eta_cases 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   235
bes eta_cases 1;
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   236
by(fast_tac (eta_cs addss (!simpset addsimps [subst_decr])) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   237
by(fast_tac (eta_cs addIs [r_into_rtrancl,eta_subst]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   238
by(fast_tac (eta_cs addIs [rtrancl_eta_subst]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   239
by(fast_tac (eta_cs addIs [r_into_rtrancl,rtrancl_eta_AppL]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   240
by(fast_tac (eta_cs addIs [r_into_rtrancl,rtrancl_eta_AppR]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   241
by(fast_tac (eta_cs addIs [r_into_rtrancl,rtrancl_eta_Fun,free_beta,beta_decr]
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   242
                  addss (!simpset addsimps[subst_decr,symmetric decr_def])) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   243
qed "square_beta_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   244
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   245
goal Eta.thy "confluent(beta Un eta)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   246
by(REPEAT(ares_tac [square_rtrancl_reflcl_commute,confluent_Un,
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   247
                    beta_confluent,eta_confluent,square_beta_eta] 1));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   248
qed "confluent_beta_eta";