src/HOL/Lambda/Eta.ML
author nipkow
Mon, 21 Oct 1996 09:51:18 +0200
changeset 2116 73bbf2cc7651
parent 2083 b56425a385b9
child 2159 e650a3f6f600
permissions -rw-r--r--
Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
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
1974
b50f96543dec Removed refs to clasets like rel_cs etc. Used implicit claset.
nipkow
parents: 1910
diff changeset
    22
AddIs eta.intrs;
b50f96543dec Removed refs to clasets like rel_cs etc. Used implicit claset.
nipkow
parents: 1910
diff changeset
    23
AddSEs (beta_cases@eta_cases);
1269
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 "decr and free";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    26
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    27
goal Eta.thy "!i k. free (lift t k) i = \
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    28
\                   (i < k & free t i | k < i & free t (pred i))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    29
by (db.induct_tac "t" 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    30
by (ALLGOALS(asm_full_simp_tac (addsplit (!simpset) addcongs [conj_cong])));
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    31
by (fast_tac HOL_cs 2);
2116
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    32
by(simp_tac (!simpset addsimps [pred_def]
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    33
                      setloop (split_tac [expand_nat_case])) 1);
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    34
by (safe_tac HOL_cs);
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    35
by (ALLGOALS trans_tac);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    36
qed "free_lift";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    37
Addsimps [free_lift];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    38
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    39
goal Eta.thy "!i k t. free (s[t/k]) i = \
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    40
\              (free s k & free t i | free s (if i<k then i else Suc i))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    41
by (db.induct_tac "s" 1);
2116
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    42
by (Asm_simp_tac 2);
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    43
by (Fast_tac 2);
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    44
by (asm_full_simp_tac (addsplit (!simpset)) 2);
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    45
by(simp_tac (!simpset addsimps [pred_def,subst_Var]
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    46
                      setloop (split_tac [expand_if,expand_nat_case])) 1);
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    47
by (safe_tac (HOL_cs addSEs [nat_neqE]));
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    48
by (ALLGOALS trans_tac);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    49
qed "free_subst";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    50
Addsimps [free_subst];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    51
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    52
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
    53
by (etac eta.induct 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    54
by (ALLGOALS(asm_simp_tac (!simpset addsimps [decr_def] addcongs [conj_cong])));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    55
qed_spec_mp "free_eta";
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 "!!s. [| s -e> t; ~free s i |] ==> ~free t i";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    58
by (asm_simp_tac (!simpset addsimps [free_eta]) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    59
qed "not_free_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    60
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    61
goal Eta.thy "!i t u. ~free s i --> s[t/i] = s[u/i]";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    62
by (db.induct_tac "s" 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    63
by (ALLGOALS(simp_tac (addsplit (!simpset))));
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    64
by (fast_tac HOL_cs 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    65
by (fast_tac HOL_cs 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    66
qed_spec_mp "subst_not_free";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    67
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    68
goalw Eta.thy [decr_def] "!!s. ~free s i ==> s[t/i] = decr s i";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
    69
by (etac subst_not_free 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    70
qed "subst_decr";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    71
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    72
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
    73
by (etac eta.induct 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    74
by (ALLGOALS(asm_simp_tac (!simpset addsimps [subst_subst RS sym,decr_def])));
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    75
by (asm_simp_tac (!simpset addsimps [subst_decr]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    76
qed_spec_mp "eta_subst";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    77
Addsimps [eta_subst];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    78
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    79
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
    80
by (etac eta_subst 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    81
qed "eta_decr";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    82
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
    83
section "Confluence of -e>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    84
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    85
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
    86
by (rtac (impI RS allI RS allI) 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
    87
by (Simp_tac 1);
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
    88
by (etac eta.induct 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
    89
by (best_tac (!claset addSIs [eta_decr]
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
    90
                      addIs [free_eta RS iffD1] addss !simpset) 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
    91
by (slow_tac (!claset) 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
    92
by (slow_tac (!claset) 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
    93
by (slow_tac (!claset addSIs [eta_decr]
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
    94
                     addIs [free_eta RS iffD1]) 1);
1431
be7c6d77e19c Polished proofs.
nipkow
parents: 1302
diff changeset
    95
val lemma = result();
1269
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 "confluent(eta)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
    98
by (rtac (lemma RS square_reflcl_confluent) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    99
qed "eta_confluent";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   100
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   101
section "Congruence rules for -e>>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   102
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   103
goal Eta.thy "!!s. s -e>> s' ==> Fun s -e>> Fun s'";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   104
by (etac rtrancl_induct 1);
1974
b50f96543dec Removed refs to clasets like rel_cs etc. Used implicit claset.
nipkow
parents: 1910
diff changeset
   105
by (ALLGOALS(fast_tac (!claset addIs [rtrancl_refl,rtrancl_into_rtrancl])));
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   106
qed "rtrancl_eta_Fun";
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>> s' ==> s @ t -e>> s' @ t";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   109
by (etac rtrancl_induct 1);
1974
b50f96543dec Removed refs to clasets like rel_cs etc. Used implicit claset.
nipkow
parents: 1910
diff changeset
   110
by (ALLGOALS(fast_tac (!claset addIs [rtrancl_refl,rtrancl_into_rtrancl])));
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   111
qed "rtrancl_eta_AppL";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   112
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   113
goal Eta.thy "!!s. t -e>> t' ==> s @ t -e>> s @ t'";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   114
by (etac rtrancl_induct 1);
1974
b50f96543dec Removed refs to clasets like rel_cs etc. Used implicit claset.
nipkow
parents: 1910
diff changeset
   115
by (ALLGOALS(fast_tac (!claset addIs [rtrancl_refl,rtrancl_into_rtrancl])));
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   116
qed "rtrancl_eta_AppR";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   117
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   118
goal Eta.thy "!!s. [| s -e>> s'; t -e>> t' |] ==> s @ t -e>> s' @ t'";
1974
b50f96543dec Removed refs to clasets like rel_cs etc. Used implicit claset.
nipkow
parents: 1910
diff changeset
   119
by (deepen_tac (!claset addSIs [rtrancl_eta_AppL,rtrancl_eta_AppR]
b50f96543dec Removed refs to clasets like rel_cs etc. Used implicit claset.
nipkow
parents: 1910
diff changeset
   120
                     addIs [rtrancl_trans]) 2 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   121
qed "rtrancl_eta_App";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   122
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   123
section "Commutation of -> and -e>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   124
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   125
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
   126
by (etac beta.induct 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   127
by (ALLGOALS(Asm_full_simp_tac));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   128
qed_spec_mp "free_beta";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   129
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   130
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
   131
by (etac beta.induct 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   132
by (ALLGOALS(asm_full_simp_tac (!simpset addsimps [subst_subst RS sym])));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   133
qed_spec_mp "beta_decr";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   134
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   135
goalw Eta.thy [decr_def]
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   136
  "decr (Var i) k = (if i<=k then Var i else Var(pred i))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   137
by (simp_tac (addsplit (!simpset) addsimps [le_def]) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   138
qed "decr_Var";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   139
Addsimps [decr_Var];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   140
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   141
goalw Eta.thy [decr_def] "decr (s@t) i = (decr s i)@(decr t i)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   142
by (Simp_tac 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   143
qed "decr_App";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   144
Addsimps [decr_App];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   145
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   146
goalw Eta.thy [decr_def] "decr (Fun s) i = Fun (decr s (Suc i))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   147
by (Simp_tac 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   148
qed "decr_Fun";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   149
Addsimps [decr_Fun];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   150
2083
b56425a385b9 Tidied some proofs: changed needed for de Morgan laws
paulson
parents: 2057
diff changeset
   151
goal Eta.thy "!i. ~free t (Suc i) --> decr t (Suc i) = decr t i";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   152
by (db.induct_tac "t" 1);
2083
b56425a385b9 Tidied some proofs: changed needed for de Morgan laws
paulson
parents: 2057
diff changeset
   153
by (ALLGOALS
b56425a385b9 Tidied some proofs: changed needed for de Morgan laws
paulson
parents: 2057
diff changeset
   154
    (asm_simp_tac (addsplit (!simpset) addsimps [le_def, less_Suc_eq])));
b56425a385b9 Tidied some proofs: changed needed for de Morgan laws
paulson
parents: 2057
diff changeset
   155
qed_spec_mp "decr_not_free";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   156
Addsimps [decr_not_free];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   157
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   158
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
   159
by (etac eta.induct 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   160
by (ALLGOALS(asm_simp_tac (addsplit (!simpset) addsimps [decr_def])));
2083
b56425a385b9 Tidied some proofs: changed needed for de Morgan laws
paulson
parents: 2057
diff changeset
   161
by (asm_simp_tac (!simpset addsimps [subst_decr]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   162
qed_spec_mp "eta_lift";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   163
Addsimps [eta_lift];
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 t i. s -e> t --> u[s/i] -e>> u[t/i]";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   166
by (db.induct_tac "u" 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   167
by (ALLGOALS(asm_simp_tac (addsplit (!simpset))));
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   168
by (fast_tac (!claset addIs [r_into_rtrancl]) 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   169
by (fast_tac (!claset addSIs [rtrancl_eta_App]) 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   170
by (fast_tac (!claset addSIs [rtrancl_eta_Fun,eta_lift]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   171
qed_spec_mp "rtrancl_eta_subst";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   172
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   173
goalw Eta.thy [square_def] "square beta eta (eta^*) (beta^=)";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   174
by (rtac (impI RS allI RS allI) 1);
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   175
by (etac beta.induct 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   176
by (strip_tac 1);
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   177
by (eresolve_tac eta_cases 1);
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   178
by (eresolve_tac eta_cases 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   179
by (fast_tac (!claset addss (!simpset addsimps [subst_decr])) 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   180
by (slow_tac (!claset addIs [r_into_rtrancl,eta_subst]) 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   181
by (slow_tac (!claset addIs [rtrancl_eta_subst]) 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   182
by (slow_tac (!claset addIs [r_into_rtrancl,rtrancl_eta_AppL]) 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   183
by (slow_tac (!claset addIs [r_into_rtrancl,rtrancl_eta_AppR]) 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   184
by (slow_tac (!claset addIs [r_into_rtrancl,rtrancl_eta_Fun,free_beta,beta_decr]
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   185
                  addss (!simpset addsimps[subst_decr,symmetric decr_def])) 1);
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   186
qed "square_beta_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   187
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   188
goal Eta.thy "confluent(beta Un eta)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   189
by (REPEAT(ares_tac [square_rtrancl_reflcl_commute,confluent_Un,
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   190
                    beta_confluent,eta_confluent,square_beta_eta] 1));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   191
qed "confluent_beta_eta";
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   192
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   193
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   194
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
   195
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   196
goal Eta.thy "!i. (~free s i) = (? t. s = lift t i)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   197
by (db.induct_tac "s" 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   198
  by (simp_tac (!simpset setloop (split_tac [expand_if])) 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   199
  by (SELECT_GOAL(safe_tac HOL_cs)1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   200
   by (res_inst_tac [("m","nat"),("n","i")] nat_less_cases 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   201
     by (res_inst_tac [("x","Var nat")] exI 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   202
     by (Asm_simp_tac 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   203
    by (fast_tac HOL_cs 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   204
   by (res_inst_tac [("x","Var(pred nat)")] exI 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   205
   by (Asm_simp_tac 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   206
  by (rtac notE 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   207
   by (assume_tac 2);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   208
  by (etac thin_rl 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   209
  by (res_inst_tac [("db","t")] db_case_distinction 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   210
    by (simp_tac (!simpset setloop (split_tac [expand_if])) 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   211
    by (fast_tac (HOL_cs addDs [less_not_refl2]) 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   212
   by (Simp_tac 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   213
  by (Simp_tac 1);
2116
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
   214
 by (Asm_simp_tac 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   215
 by (etac thin_rl 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   216
 by (etac thin_rl 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   217
 by (rtac allI 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   218
 by (rtac iffI 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   219
  by (REPEAT(eresolve_tac [conjE,exE] 1));
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   220
  by (rename_tac "u1 u2" 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   221
  by (res_inst_tac [("x","u1@u2")] exI 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   222
  by (Asm_simp_tac 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   223
 by (etac exE 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   224
 by (etac rev_mp 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   225
 by (res_inst_tac [("db","t")] db_case_distinction 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   226
   by (simp_tac (!simpset setloop (split_tac [expand_if])) 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   227
  by (Simp_tac 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   228
  by (fast_tac HOL_cs 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   229
 by (Simp_tac 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   230
by (Asm_simp_tac 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   231
by (etac thin_rl 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   232
by (rtac allI 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   233
by (rtac iffI 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   234
 by (etac exE 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   235
 by (res_inst_tac [("x","Fun t")] exI 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   236
 by (Asm_simp_tac 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   237
by (etac exE 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   238
by (etac rev_mp 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   239
by (res_inst_tac [("db","t")] db_case_distinction 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   240
  by (simp_tac (!simpset setloop (split_tac [expand_if])) 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   241
 by (Simp_tac 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   242
by (Simp_tac 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   243
by (fast_tac HOL_cs 1);
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   244
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
   245
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   246
goalw Eta.thy [decr_def]
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   247
 "(!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
   248
\ (!s. R(Fun(lift s 0 @ Var 0))(s))";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   249
by (fast_tac (HOL_cs addss (!simpset addsimps [lemma,not_free_iff_lifted])) 1);
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   250
qed "explicit_is_implicit";