LamEx.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Wed, 28 Oct 2009 16:05:59 +0100
changeset 221 f219011a5e3c
parent 219 329111e1c4ba
child 225 9b8e039ae960
permissions -rw-r--r--
Fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory LamEx
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
imports Nominal QuotMain
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
atom_decl name
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
nominal_datatype rlam =
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
  rVar "name"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
| rApp "rlam" "rlam"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
| rLam "name" "rlam"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
inductive 
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  alpha :: "rlam \<Rightarrow> rlam \<Rightarrow> bool" ("_ \<approx> _" [100, 100] 100)
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
where
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  a1: "a = b \<Longrightarrow> (rVar a) \<approx> (rVar b)"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
| a2: "\<lbrakk>t1 \<approx> t2; s1 \<approx> s2\<rbrakk> \<Longrightarrow> rApp t1 s1 \<approx> rApp t2 s2"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
| a3: "\<lbrakk>t \<approx> ([(a,b)]\<bullet>s); a\<sharp>s\<rbrakk> \<Longrightarrow> rLam a t \<approx> rLam b s"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
quotient lam = rlam / alpha
203
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 201
diff changeset
    20
apply -
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
sorry
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
203
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 201
diff changeset
    23
print_quotients
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 201
diff changeset
    24
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
local_setup {*
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    26
  old_make_const_def @{binding Var} @{term "rVar"} NoSyn @{typ "rlam"} @{typ "lam"} #> snd #>
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    27
  old_make_const_def @{binding App} @{term "rApp"} NoSyn @{typ "rlam"} @{typ "lam"} #> snd #>
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    28
  old_make_const_def @{binding Lam} @{term "rLam"} NoSyn @{typ "rlam"} @{typ "lam"} #> snd
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
*}
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    31
thm Var_def
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    32
thm App_def
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    33
thm Lam_def
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    34
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
lemma real_alpha:
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  assumes "t = ([(a,b)]\<bullet>s)" "a\<sharp>s"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
  shows "Lam a t = Lam b s"
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    38
sorry
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    39
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    40
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    41
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    42
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    43
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    44
(* Construction Site code *)
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    45
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    46
lemma perm_rsp: "op = ===> alpha ===> alpha op \<bullet> op \<bullet>" sorry
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    47
lemma fresh_rsp: "op = ===> (alpha ===> op =) fresh fresh" sorry
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    48
lemma rLam_rsp: "op = ===> (alpha ===> alpha) rLam rLam" sorry
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    49
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    50
ML {* val defs = @{thms Var_def App_def Lam_def} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    51
ML {* val consts = [@{const_name "rVar"}, @{const_name "rApp"}, @{const_name "rLam"}]; *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    52
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    53
ML {* val rty = @{typ "rlam"} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    54
ML {* val qty = @{typ "lam"} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    55
ML {* val rel = @{term "alpha"} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    56
ML {* val rel_eqv = (#equiv_thm o hd) (quotdata_lookup @{theory}) *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    57
ML {* val rel_refl = @{thm EQUIV_REFL} OF [rel_eqv] *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    58
ML {* val quot = @{thm QUOTIENT_lam} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    59
ML {* val rsp_thms = @{thms perm_rsp fresh_rsp rLam_rsp} @ @{thms ho_all_prs ho_ex_prs} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    60
ML {* val trans2 = @{thm QUOT_TYPE_I_lam.R_trans2} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    61
ML {* val reps_same = @{thm QUOT_TYPE_I_lam.REPS_same} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    62
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    63
thm a3
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    64
ML {* val t_a = atomize_thm @{thm a3} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    65
ML {* val t_r = regularize t_a rty rel rel_eqv @{context} *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    66
ML {* val t_t = repabs @{context} t_r consts rty qty quot rel_refl trans2 rsp_thms *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    67
ML {* val abs = findabs rty (prop_of t_a) *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    68
ML {* val simp_lam_prs_thms = map (make_simp_lam_prs_thm @{context} quot) abs *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    69
ML {* val t_l = repeat_eqsubst_thm @{context} simp_lam_prs_thms t_t *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    70
ML {* val t_c = simp_allex_prs @{context} quot t_l *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    71
ML {* val t_defs_sym = add_lower_defs @{context} defs *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    72
ML {* val t_d = repeat_eqsubst_thm @{context} t_defs_sym t_c *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    73
ML {* val t_b = MetaSimplifier.rewrite_rule [reps_same] t_d *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    74
ML {* ObjectLogic.rulify t_b *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    75
221
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    76
thm fresh_def
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    77
thm supp_def
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    78
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    79
local_setup {*
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    80
  make_const_def @{binding lperm} @{term "perm :: ('a \<times> 'a) list \<Rightarrow> rlam \<Rightarrow> rlam"} NoSyn @{typ "rlam"} @{typ "lam"} #> snd
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    81
*}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
    82
221
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    83
ML {* val consts = @{const_name perm} :: consts *}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    84
ML {* val defs = @{thms lperm_def} @ defs *}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    85
ML {* val t_u = MetaSimplifier.rewrite_rule @{thms fresh_def supp_def} @{thm a3} *}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    86
ML {* val t_a = atomize_thm t_u *}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    87
ML {* val t_r = regularize t_a rty rel rel_eqv @{context} *}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    88
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    89
ML {*
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    90
fun r_mk_comb_tac_lam ctxt = r_mk_comb_tac ctxt rty quot rel_refl trans2 rsp_thms
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    91
*}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    92
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    93
prove {* build_repabs_goal @{context} t_r consts rty qty *}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    94
apply (atomize(full))
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    95
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    96
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    97
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    98
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
    99
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   100
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   101
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   102
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   103
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   104
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   105
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   106
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   107
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   108
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   109
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   110
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   111
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   112
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   113
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   114
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   115
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   116
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   117
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   118
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   119
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   120
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   121
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   122
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   123
prefer 2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   124
apply (tactic {* REPEAT_ALL_NEW (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   125
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   126
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   127
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   128
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   129
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   130
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   131
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   132
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   133
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   134
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   135
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   136
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   137
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   138
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   139
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   140
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   141
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   142
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   143
nitpick
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   144
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   145
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   146
apply (tactic {* (r_mk_comb_tac_lam @{context}) 1 *})
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   147
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   148
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   149
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   150
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   151
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   152
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   153
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   154
ML {* val t_t = Toplevel.program (fn () => repabs @{context} t_r consts rty qty quot rel_refl trans2 rsp_thms) *}
221
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   155
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   156
ML {* val t_t = repabs @{context} t_r consts rty qty quot rel_refl trans2 rsp_thms *}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   157
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   158
ML {* val t_l = repeat_eqsubst_thm @{context} simp_lam_prs_thms t_t *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   159
ML {* val t_c = simp_allex_prs @{context} quot t_l *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   160
ML {* val t_defs_sym = add_lower_defs @{context} defs *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   161
ML {* val t_d = repeat_eqsubst_thm @{context} t_defs_sym t_c *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   162
ML {* val t_b = MetaSimplifier.rewrite_rule [reps_same] t_d *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   163
ML {* ObjectLogic.rulify t_b *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   164
ML {* val rr =  (add_lower_defs @{context} @{thms lperm_def}) *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   165
ML {* val rrr = @{thm eq_reflection} OF [rr] *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   166
ML {* MetaSimplifier.rewrite_rule [rrr] t_b *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   167
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   168
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   169
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   170
221
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   171
local_setup {*
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   172
  make_const_def @{binding lfresh} @{term "fresh :: 'a \<Rightarrow> rlam \<Rightarrow> bool"} NoSyn @{typ "rlam"} @{typ "lam"} #> snd #>
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   173
*}
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   174
@{const_name fresh} :: 
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 219
diff changeset
   175
lfresh_def 
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   176
ML {*
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   177
fun lift_thm_lam lthy t =
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   178
  lift_thm lthy consts rty qty rel rel_eqv rel_refl quot rsp_thms trans2 reps_same defs t
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   179
*}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   180
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   181
ML {* Toplevel.program (fn () => lift_thm_lam @{context} @{thm a3}) *}
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   182