src/HOL/Lambda/Eta.ML
author berghofe
Fri, 24 Jul 1998 13:19:38 +0200
changeset 5184 9b8547a9496a
parent 5146 1ea751ae62b2
child 5261 ce3c25c8a694
permissions -rw-r--r--
Adapted to new datatype package.
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
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    16
val eta_cases = map (eta.mk_cases dB.simps)
5146
nipkow
parents: 5117
diff changeset
    17
    ["Abs s -e> z","s $ t -e> u","Var i -e> t"];
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    18
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    19
val beta_cases = map (beta.mk_cases dB.simps)
5146
nipkow
parents: 5117
diff changeset
    20
    ["s $ t -> u","Var i -> t"];
1269
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
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    25
section "eta, subst and free";
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    26
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
    27
Goal "!i t u. ~free s i --> s[t/i] = s[u/i]";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5146
diff changeset
    28
by (induct_tac "s" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    29
by (ALLGOALS(simp_tac (addsplit (simpset()))));
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2159
diff changeset
    30
by (Blast_tac 1);
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2159
diff changeset
    31
by (Blast_tac 1);
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    32
qed_spec_mp "subst_not_free";
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    33
Addsimps [subst_not_free RS eqTrueI];
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    34
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    35
Goal "!i k. free (lift t k) i = (i < k & free t i | k < i & free t (i-1))";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5146
diff changeset
    36
by (induct_tac "t" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    37
by (ALLGOALS(asm_full_simp_tac (addsplit (simpset()) addcongs [conj_cong])));
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2159
diff changeset
    38
by (Blast_tac 2);
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5146
diff changeset
    39
by (simp_tac (simpset() addsimps [diff_Suc] addsplits [nat.split]) 1);
2116
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    40
by (safe_tac HOL_cs);
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    41
by (ALLGOALS trans_tac);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    42
qed "free_lift";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    43
Addsimps [free_lift];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    44
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
    45
Goal "!i k t. free (s[t/k]) i = \
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    46
\              (free s k & free t i | free s (if i<k then i else Suc i))";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5146
diff changeset
    47
by (induct_tac "s" 1);
2116
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    48
by (Asm_simp_tac 2);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2159
diff changeset
    49
by (Blast_tac 2);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    50
by (asm_full_simp_tac (addsplit (simpset())) 2);
4360
40e5c97e988d pred n -> n-1
nipkow
parents: 4162
diff changeset
    51
by (simp_tac (simpset() addsimps [diff_Suc,subst_Var]
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5146
diff changeset
    52
                      addsplits [nat.split]) 1);
2116
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
    53
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
    54
by (ALLGOALS trans_tac);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    55
qed "free_subst";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    56
Addsimps [free_subst];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    57
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    58
Goal "s -e> t ==> !i. free t i = free s i";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
    59
by (etac eta.induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    60
by (ALLGOALS(asm_simp_tac (simpset() addcongs [conj_cong])));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    61
qed_spec_mp "free_eta";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    62
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    63
Goal "[| s -e> t; ~free s i |] ==> ~free t i";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    64
by (asm_simp_tac (simpset() addsimps [free_eta]) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    65
qed "not_free_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    66
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    67
Goal "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
    68
by (etac eta.induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    69
by (ALLGOALS(asm_simp_tac (simpset() addsimps [subst_subst RS sym])));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
    70
qed_spec_mp "eta_subst";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    71
Addsimps [eta_subst];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    72
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
    73
section "Confluence of -e>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    74
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
    75
Goalw [square_def,id_def]  "square eta eta (eta^=) (eta^=)";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
    76
by (rtac (impI RS allI RS allI) 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
    77
by (Simp_tac 1);
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
    78
by (etac eta.induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    79
by (slow_tac (claset() addIs [subst_not_free,eta_subst]
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    80
                      addIs [free_eta RS iffD1] addss simpset()) 1);
4162
4c2da701b801 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
    81
by Safe_tac;
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    82
by (blast_tac (claset() addSIs [eta_subst] addIs [free_eta RS iffD1]) 5);
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
    83
by (ALLGOALS Blast_tac);
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    84
qed "square_eta";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    85
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
    86
Goal "confluent(eta)";
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    87
by (rtac (square_eta RS square_reflcl_confluent) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    88
qed "eta_confluent";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    89
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
    90
section "Congruence rules for -e>>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    91
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
    92
Goal "s -e>> s' ==> Abs s -e>> Abs s'";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
    93
by (etac rtrancl_induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    94
by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
    95
qed "rtrancl_eta_Abs";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
    96
5146
nipkow
parents: 5117
diff changeset
    97
Goal "s -e>> s' ==> s $ t -e>> s' $ t";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
    98
by (etac rtrancl_induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
    99
by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   100
qed "rtrancl_eta_AppL";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   101
5146
nipkow
parents: 5117
diff changeset
   102
Goal "t -e>> t' ==> s $ t -e>> s $ t'";
1465
5d7a7e439cec expanded tabs
clasohm
parents: 1431
diff changeset
   103
by (etac rtrancl_induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   104
by (ALLGOALS(blast_tac (claset() addIs [rtrancl_refl,rtrancl_into_rtrancl])));
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   105
qed "rtrancl_eta_AppR";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   106
5146
nipkow
parents: 5117
diff changeset
   107
Goal "[| s -e>> s'; t -e>> t' |] ==> s $ t -e>> s' $ t'";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   108
by (blast_tac (claset() addSIs [rtrancl_eta_AppL, rtrancl_eta_AppR]
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   109
                       addIs [rtrancl_trans]) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   110
qed "rtrancl_eta_App";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   111
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   112
section "Commutation of -> and -e>";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   113
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
   114
Goal "s -> t ==> (!i. free t i --> free s i)";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   115
by (etac beta.induct 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   116
by (ALLGOALS(Asm_full_simp_tac));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   117
qed_spec_mp "free_beta";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   118
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
   119
Goal "s -> t ==> !u i. s[u/i] -> t[u/i]";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   120
by (etac beta.induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   121
by (ALLGOALS(asm_full_simp_tac (simpset() addsimps [subst_subst RS sym])));
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   122
qed_spec_mp "beta_subst";
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   123
AddIs [beta_subst];
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   124
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   125
Goal "!i. t[Var i/i] = t[Var(i)/Suc i]";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5146
diff changeset
   126
by (induct_tac "t" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   127
by (ALLGOALS (asm_simp_tac (addsplit (simpset()))));
4162
4c2da701b801 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   128
by (safe_tac (HOL_cs addSEs [nat_neqE]));
4c2da701b801 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   129
by (ALLGOALS trans_tac);
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   130
qed_spec_mp "subst_Var_Suc";
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   131
Addsimps [subst_Var_Suc];
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   132
5117
7b5efef2ca74 Removed leading !! in goals.
nipkow
parents: 5069
diff changeset
   133
Goal "s -e> t ==> (!i. lift s i -e> lift t i)";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   134
by (etac eta.induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   135
by (ALLGOALS(asm_simp_tac (addsplit (simpset()))));
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   136
qed_spec_mp "eta_lift";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   137
Addsimps [eta_lift];
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   138
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   139
Goal "!s t i. s -e> t --> u[s/i] -e>> u[t/i]";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5146
diff changeset
   140
by (induct_tac "u" 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   141
by (ALLGOALS(asm_simp_tac (addsplit (simpset()))));
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   142
by (blast_tac (claset() addIs [r_into_rtrancl]) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   143
by (blast_tac (claset() addSIs [rtrancl_eta_App]) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   144
by (blast_tac (claset() addSIs [rtrancl_eta_Abs,eta_lift]) 1);
1486
7b95d7b49f7a Introduced qed_spec_mp.
nipkow
parents: 1465
diff changeset
   145
qed_spec_mp "rtrancl_eta_subst";
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   146
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   147
Goalw [square_def] "square beta eta (eta^*) (beta^=)";
1730
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   148
by (rtac (impI RS allI RS allI) 1);
1c7f793fc374 Updated for new form of induction rules
paulson
parents: 1673
diff changeset
   149
by (etac beta.induct 1);
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   150
by (slow_tac (claset() addIs [r_into_rtrancl,rtrancl_eta_subst,eta_subst]
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   151
                      addss simpset()) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   152
by (blast_tac (claset() addIs [r_into_rtrancl,rtrancl_eta_AppL]) 1);
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   153
by (blast_tac (claset() addIs [r_into_rtrancl,rtrancl_eta_AppR]) 1);
2922
580647a879cf Using Blast_tac
paulson
parents: 2891
diff changeset
   154
(*23 seconds?*)
2931
8658bf6c1a5b Mod because of "Turned Addsimps into AddIffs for datatype laws."
nipkow
parents: 2922
diff changeset
   155
DelIffs dB.distinct;
8658bf6c1a5b Mod because of "Turned Addsimps into AddIffs for datatype laws."
nipkow
parents: 2922
diff changeset
   156
Addsimps dB.distinct;
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   157
by (slow_tac (claset() addIs [r_into_rtrancl,rtrancl_eta_Abs,free_beta]
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   158
                      addss simpset()) 1);
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   159
qed "square_beta_eta";
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   160
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   161
Goal "confluent(beta Un eta)";
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   162
by (REPEAT(ares_tac [square_rtrancl_reflcl_commute,confluent_Un,
1269
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   163
                    beta_confluent,eta_confluent,square_beta_eta] 1));
ee011b365770 New version with eta reduction.
nipkow
parents:
diff changeset
   164
qed "confluent_beta_eta";
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   165
5146
nipkow
parents: 5117
diff changeset
   166
section "Implicit definition of -e>: Abs(lift s 0 $ Var 0) -e> s";
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   167
5069
3ea049f7979d isatool fixgoal;
wenzelm
parents: 4831
diff changeset
   168
Goal "!i. (~free s i) = (? t. s = lift t i)";
5184
9b8547a9496a Adapted to new datatype package.
berghofe
parents: 5146
diff changeset
   169
by (induct_tac "s" 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4360
diff changeset
   170
  by (Simp_tac 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   171
  by (SELECT_GOAL(safe_tac HOL_cs)1);
4162
4c2da701b801 Ran expandshort, especially to introduce Safe_tac
paulson
parents: 4089
diff changeset
   172
   by (etac nat_neqE 1);
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   173
    by (res_inst_tac [("x","Var nat")] exI 1);
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   174
    by (Asm_simp_tac 1);
4360
40e5c97e988d pred n -> n-1
nipkow
parents: 4162
diff changeset
   175
   by (res_inst_tac [("x","Var(nat-1)")] exI 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   176
   by (Asm_simp_tac 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   177
  by (rtac notE 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   178
   by (assume_tac 2);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   179
  by (etac thin_rl 1);
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   180
  by (res_inst_tac [("dB","t")] dB_case_distinction 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4360
diff changeset
   181
    by (Simp_tac 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2159
diff changeset
   182
    by (blast_tac (HOL_cs addDs [less_not_refl2]) 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   183
   by (Simp_tac 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   184
  by (Simp_tac 1);
2116
73bbf2cc7651 Used trans_tac (see Provers/nat_transitive.ML) to automate arithmetic.
nipkow
parents: 2083
diff changeset
   185
 by (Asm_simp_tac 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   186
 by (etac thin_rl 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   187
 by (etac thin_rl 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   188
 by (rtac allI 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   189
 by (rtac iffI 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   190
  by (REPEAT(eresolve_tac [conjE,exE] 1));
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   191
  by (rename_tac "u1 u2" 1);
5146
nipkow
parents: 5117
diff changeset
   192
  by (res_inst_tac [("x","u1$u2")] exI 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   193
  by (Asm_simp_tac 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   194
 by (etac exE 1);
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   195
 by (etac rev_mp 1);
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   196
 by (res_inst_tac [("dB","t")] dB_case_distinction 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4360
diff changeset
   197
   by (Simp_tac 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   198
  by (Simp_tac 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2159
diff changeset
   199
  by (Blast_tac 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   200
 by (Simp_tac 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   201
by (Asm_simp_tac 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   202
by (etac thin_rl 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   203
by (rtac allI 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   204
by (rtac iffI 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   205
 by (etac exE 1);
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   206
 by (res_inst_tac [("x","Abs t")] exI 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   207
 by (Asm_simp_tac 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   208
by (etac exE 1);
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   209
by (etac rev_mp 1);
2159
e650a3f6f600 Used nat_trans_tac. New Eta. various smaller changes.
nipkow
parents: 2116
diff changeset
   210
by (res_inst_tac [("dB","t")] dB_case_distinction 1);
4686
74a12e86b20b Removed `addsplits [expand_if]'
nipkow
parents: 4360
diff changeset
   211
  by (Simp_tac 1);
2057
4d7a4b25a11f Ran expandshort
paulson
parents: 2031
diff changeset
   212
 by (Simp_tac 1);
2031
03a843f0f447 Ran expandshort
paulson
parents: 1974
diff changeset
   213
by (Simp_tac 1);
2891
d8f254ad1ab9 Calls Blast_tac
paulson
parents: 2159
diff changeset
   214
by (Blast_tac 1);
1759
a42d6c537f4a Added comparison with implicit rule Fun(lift s 0 @ Var 0) -e> s
nipkow
parents: 1730
diff changeset
   215
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
   216
5146
nipkow
parents: 5117
diff changeset
   217
Goal "(!s u. (~free s 0) --> R(Abs(s $ Var 0))(s[u/0])) = \
nipkow
parents: 5117
diff changeset
   218
\     (!s. R(Abs(lift s 0 $ Var 0))(s))";
4089
96fba19bcbe2 isatool fixclasimp;
wenzelm
parents: 3919
diff changeset
   219
by (fast_tac (HOL_cs addss (simpset() addsimps [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
   220
qed "explicit_is_implicit";