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