src/HOL/Lambda/Eta.ML
author nipkow
Wed, 22 May 1996 18:32:37 +0200
changeset 1759 a42d6c537f4a
parent 1730 1c7f793fc374
child 1910 6d572f96fb76
permissions -rw-r--r--
Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
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
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
    25
section "Arithmetic lemmas";
1269
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);
1673
d22110ddd0af repaired critical proofs depending on the order inside non-confluent SimpSets
oheimb
parents: 1486
diff changeset
    35
by(ALLGOALS(asm_simp_tac(simpset_of "Arith" addsimps [less_Suc_eq])));
1269
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")));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    38
qed_spec_mp "less_imp_pred_less";
1269
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);
1673
d22110ddd0af repaired critical proofs depending on the order inside non-confluent SimpSets
oheimb
parents: 1486
diff changeset
    42
by(ALLGOALS(asm_simp_tac(simpset_of "Arith" addsimps [less_Suc_eq])));
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    43
by(fast_tac (HOL_cs addDs [less_imp_pred_less]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    44
qed_spec_mp "less_imp_not_pred_less";
1269
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")));
1673
d22110ddd0af repaired critical proofs depending on the order inside non-confluent SimpSets
oheimb
parents: 1486
diff changeset
    50
by(simp_tac(simpset_of "Nat" addsimps [less_Suc_eq])1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    51
by(fast_tac (HOL_cs addDs [less_not_sym]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    52
qed_spec_mp "less_interval1";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    53
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    54
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
    55
section "decr and free";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    56
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    57
goal Eta.thy "!i k. free (lift t k) i = \
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    58
\                   (i < k & free t i | k < i & free t (pred i))";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    59
by(db.induct_tac "t" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    60
by(ALLGOALS(asm_full_simp_tac (addsplit (!simpset) addcongs [conj_cong])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    61
by(fast_tac HOL_cs 2);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    62
by(safe_tac (HOL_cs addSIs [iffI]));
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
    63
by (dtac Suc_mono 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    64
by(ALLGOALS(Asm_full_simp_tac));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    65
by(dtac less_trans_Suc 1 THEN atac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    66
by(dtac less_trans_Suc 2 THEN atac 2);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    67
by(ALLGOALS(Asm_full_simp_tac));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    68
qed "free_lift";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    69
Addsimps [free_lift];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    70
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    71
goal Eta.thy "!i k t. free (s[t/k]) i = \
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    72
\              (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
    73
by(db.induct_tac "s" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    74
by(ALLGOALS(asm_full_simp_tac (addsplit (!simpset) addsimps
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    75
[less_not_refl2,less_not_refl2 RS not_sym])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    76
by(fast_tac HOL_cs 2);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    77
by(safe_tac (HOL_cs addSIs [iffI]));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    78
by(ALLGOALS(Asm_simp_tac));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    79
by(fast_tac (HOL_cs addEs [less_imp_not_pred_less RS notE]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    80
by(fast_tac (HOL_cs addDs [less_not_sym]) 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
    81
by (dtac Suc_mono 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    82
by(dtac less_interval1 1 THEN atac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    83
by(asm_full_simp_tac (simpset_of "Nat" addsimps [eq_sym_conv]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    84
by(dtac less_trans_Suc 1 THEN atac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    85
by(Asm_full_simp_tac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    86
qed "free_subst";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    87
Addsimps [free_subst];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    88
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    89
goal Eta.thy "!!s. s -e> t ==> !i. free t i = free s i";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
    90
by (etac eta.induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    91
by(ALLGOALS(asm_simp_tac (!simpset addsimps [decr_def] addcongs [conj_cong])));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    92
qed_spec_mp "free_eta";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    93
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    94
goal Eta.thy "!!s. [| s -e> t; ~free s i |] ==> ~free t i";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    95
by(asm_simp_tac (!simpset addsimps [free_eta]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    96
qed "not_free_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    97
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    98
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
    99
by(db.induct_tac "s" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   100
by(ALLGOALS(simp_tac (addsplit (!simpset))));
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
by(fast_tac HOL_cs 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   103
qed_spec_mp "subst_not_free";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   104
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   105
goalw Eta.thy [decr_def] "!!s. ~free s i ==> s[t/i] = decr s i";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   106
by (etac subst_not_free 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   107
qed "subst_decr";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   108
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   109
goal Eta.thy "!!s. s -e> t ==> !u i. s[u/i] -e> t[u/i]";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   110
by (etac eta.induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   111
by(ALLGOALS(asm_simp_tac (!simpset addsimps [subst_subst RS sym,decr_def])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   112
by(asm_simp_tac (!simpset addsimps [subst_decr]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   113
qed_spec_mp "eta_subst";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   114
Addsimps [eta_subst];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   115
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   116
goalw Eta.thy [decr_def] "!!s. s -e> t ==> decr s i -e> decr t i";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   117
by (etac eta_subst 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   118
qed "eta_decr";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   119
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   120
section "Confluence of -e>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   121
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
   122
goalw Eta.thy [square_def,id_def]  "square eta eta (eta^=) (eta^=)";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   123
by (rtac (impI RS allI RS allI) 1);
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   124
by (etac eta.induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   125
by(ALLGOALS(fast_tac (eta_cs addSEs [eta_decr,not_free_eta] addss !simpset)));
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
   126
val lemma = result();
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   127
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   128
goal Eta.thy "confluent(eta)";
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
   129
by(rtac (lemma RS square_reflcl_confluent) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   130
qed "eta_confluent";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   131
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   132
section "Congruence rules for -e>>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   133
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   134
goal Eta.thy "!!s. s -e>> s' ==> Fun s -e>> Fun s'";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   135
by (etac rtrancl_induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   136
by (ALLGOALS(fast_tac (eta_cs addIs [rtrancl_refl,rtrancl_into_rtrancl])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   137
qed "rtrancl_eta_Fun";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   138
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   139
goal Eta.thy "!!s. s -e>> s' ==> s @ t -e>> s' @ t";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   140
by (etac rtrancl_induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   141
by (ALLGOALS(fast_tac (eta_cs addIs [rtrancl_refl,rtrancl_into_rtrancl])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   142
qed "rtrancl_eta_AppL";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   143
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   144
goal Eta.thy "!!s. t -e>> t' ==> s @ t -e>> s @ t'";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   145
by (etac rtrancl_induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   146
by (ALLGOALS(fast_tac (eta_cs addIs [rtrancl_refl,rtrancl_into_rtrancl])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   147
qed "rtrancl_eta_AppR";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   148
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   149
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
   150
by (fast_tac (eta_cs addSIs [rtrancl_eta_AppL,rtrancl_eta_AppR]
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   151
                     addIs [rtrancl_trans]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   152
qed "rtrancl_eta_App";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   153
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   154
section "Commutation of -> and -e>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   155
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   156
goal Eta.thy "!!s t. s -> t ==> (!i. free t i --> free s i)";
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   157
by (etac beta.induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   158
by(ALLGOALS(Asm_full_simp_tac));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   159
qed_spec_mp "free_beta";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   160
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   161
goalw Eta.thy [decr_def] "!!s t. s -> t ==> (!i. decr s i -> decr t i)";
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   162
by (etac beta.induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   163
by(ALLGOALS(asm_full_simp_tac (!simpset addsimps [subst_subst RS sym])));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   164
qed_spec_mp "beta_decr";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   165
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   166
goalw Eta.thy [decr_def]
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   167
  "decr (Var i) k = (if i<=k then Var i else Var(pred i))";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   168
by(simp_tac (addsplit (!simpset) addsimps [le_def]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   169
qed "decr_Var";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   170
Addsimps [decr_Var];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   171
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   172
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
   173
by(Simp_tac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   174
qed "decr_App";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   175
Addsimps [decr_App];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   176
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   177
goalw Eta.thy [decr_def] "decr (Fun s) i = Fun (decr s (Suc i))";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   178
by(Simp_tac 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   179
qed "decr_Fun";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   180
Addsimps [decr_Fun];
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 "!i. ~free t (Suc i) --> decr t i = decr t (Suc i)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   183
by(db.induct_tac "t" 1);
1673
d22110ddd0af repaired critical proofs depending on the order inside non-confluent SimpSets
oheimb
parents: 1486
diff changeset
   184
by(ALLGOALS(asm_simp_tac (addsplit (!simpset) addsimps [le_def, less_Suc_eq])));
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   185
by(fast_tac HOL_cs 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   186
qed "decr_not_free";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   187
Addsimps [decr_not_free];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   188
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   189
goal Eta.thy "!!s t. s -e> t ==> (!i. lift s i -e> lift t i)";
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   190
by (etac eta.induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   191
by(ALLGOALS(asm_simp_tac (addsplit (!simpset) addsimps [decr_def])));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   192
by(asm_simp_tac (addsplit (!simpset) addsimps [subst_decr]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   193
qed_spec_mp "eta_lift";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   194
Addsimps [eta_lift];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   195
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   196
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
   197
by(db.induct_tac "u" 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   198
by(ALLGOALS(asm_simp_tac (addsplit (!simpset))));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   199
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
   200
by(fast_tac (eta_cs addSIs [rtrancl_eta_App]) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   201
by(fast_tac (eta_cs addSIs [rtrancl_eta_Fun,eta_lift]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   202
qed_spec_mp "rtrancl_eta_subst";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   203
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   204
goalw Eta.thy [square_def] "square beta eta (eta^*) (beta^=)";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   205
by (rtac (impI RS allI RS allI) 1);
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   206
by (etac beta.induct 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   207
by(strip_tac 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   208
by (eresolve_tac eta_cases 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   209
by (eresolve_tac eta_cases 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   210
by(fast_tac (eta_cs addss (!simpset addsimps [subst_decr])) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   211
by(fast_tac (eta_cs addIs [r_into_rtrancl,eta_subst]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   212
by(fast_tac (eta_cs addIs [rtrancl_eta_subst]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   213
by(fast_tac (eta_cs addIs [r_into_rtrancl,rtrancl_eta_AppL]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   214
by(fast_tac (eta_cs addIs [r_into_rtrancl,rtrancl_eta_AppR]) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   215
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
   216
                  addss (!simpset addsimps[subst_decr,symmetric decr_def])) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   217
qed "square_beta_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   218
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   219
goal Eta.thy "confluent(beta Un eta)";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   220
by(REPEAT(ares_tac [square_rtrancl_reflcl_commute,confluent_Un,
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   221
                    beta_confluent,eta_confluent,square_beta_eta] 1));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   222
qed "confluent_beta_eta";
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   223
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   224
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   225
section "Implicit definition of -e>: Fun(lift s 0 @ Var 0) -e> s";
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   226
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   227
goal Eta.thy "!i. (~free s i) = (? t. s = lift t i)";
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   228
by(db.induct_tac "s" 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   229
  by(simp_tac (!simpset setloop (split_tac [expand_if])) 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   230
  by(SELECT_GOAL(safe_tac HOL_cs)1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   231
   by(res_inst_tac [("m","nat"),("n","i")] nat_less_cases 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   232
     by(res_inst_tac [("x","Var nat")] exI 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   233
     by(Asm_simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   234
    by(fast_tac HOL_cs 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   235
   by(res_inst_tac [("x","Var(pred nat)")] exI 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   236
   by(Asm_simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   237
  br notE 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   238
   ba 2;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   239
  be thin_rl 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   240
  by(res_inst_tac [("db","t")] db_case_distinction 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   241
    by(simp_tac (!simpset setloop (split_tac [expand_if])) 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   242
    by(fast_tac (HOL_cs addDs [less_not_refl2]) 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   243
   by(Simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   244
  by(Simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   245
 by(asm_simp_tac (!simpset addsimps [de_Morgan_disj]) 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   246
 be thin_rl 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   247
 be thin_rl 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   248
 br allI 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   249
 br iffI 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   250
  by(REPEAT(eresolve_tac [conjE,exE] 1));
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   251
  by(rename_tac "u1 u2" 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   252
  by(res_inst_tac [("x","u1@u2")] exI 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   253
  by(Asm_simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   254
 be exE 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   255
 be rev_mp 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   256
 by(res_inst_tac [("db","t")] db_case_distinction 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   257
   by(simp_tac (!simpset setloop (split_tac [expand_if])) 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   258
  by(Simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   259
  by(fast_tac HOL_cs 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   260
 by(Simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   261
by(Asm_simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   262
be thin_rl 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   263
br allI 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   264
br iffI 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   265
 be exE 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   266
 by(res_inst_tac [("x","Fun t")] exI 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   267
 by(Asm_simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   268
be exE 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   269
be rev_mp 1;
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   270
by(res_inst_tac [("db","t")] db_case_distinction 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   271
  by(simp_tac (!simpset setloop (split_tac [expand_if])) 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   272
 by(Simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   273
by(Simp_tac 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   274
by(fast_tac HOL_cs 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   275
qed_spec_mp "not_free_iff_lifted";
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   276
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   277
goalw Eta.thy [decr_def]
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   278
 "(!s. (~free s 0) --> R(Fun(s @ Var 0))(decr s 0)) = \
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   279
\ (!s. R(Fun(lift s 0 @ Var 0))(s))";
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   280
by(fast_tac (HOL_cs addss (!simpset addsimps [lemma,not_free_iff_lifted])) 1);
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   281
qed "explicit_is_implicit";