LamEx.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 30 Oct 2009 15:32:04 +0100
changeset 245 55b156ac4a40
parent 243 22715cab3995
parent 242 47de63a883c2
child 246 6da7d538e5e0
permissions -rw-r--r--
merged
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
243
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
     7
thm abs_fresh(1)
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
     8
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
nominal_datatype rlam =
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
  rVar "name"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
| rApp "rlam" "rlam"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
| rLam "name" "rlam"
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
inductive 
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  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
    16
where
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
  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
    18
| a2: "\<lbrakk>t1 \<approx> t2; s1 \<approx> s2\<rbrakk> \<Longrightarrow> rApp t1 s1 \<approx> rApp t2 s2"
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    19
| a3: "\<lbrakk>t \<approx> ([(a,b)]\<bullet>s); a\<sharp>[b].s\<rbrakk> \<Longrightarrow> rLam a t \<approx> rLam b s"
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
243
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    21
function
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    22
  rfv :: "rlam \<Rightarrow> name set"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    23
where
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    24
  rfv_var: "rfv (rVar a) = {a}"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    25
| rfv_app: "rfv (rApp t1 t2) = (rfv t1) \<union> (rfv t2)"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    26
| rfv_lam: "rfv (rLam a t) = (rfv t) - {a}"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    27
sorry
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    28
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    29
termination rfv sorry 
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    30
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
quotient lam = rlam / alpha
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
sorry
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
203
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 201
diff changeset
    34
print_quotients
7384115df9fd added equiv-thm to the quot_info
Christian Urban <urbanc@in.tum.de>
parents: 201
diff changeset
    35
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    36
quotient_def (for lam)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    37
  Var :: "name \<Rightarrow> lam"
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    38
where
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    39
  "Var \<equiv> rVar"
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    40
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    41
quotient_def (for lam)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    42
  App :: "lam \<Rightarrow> lam \<Rightarrow> lam"
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    43
where
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    44
  "App \<equiv> rApp"
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    45
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    46
quotient_def (for lam)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    47
  Lam :: "name \<Rightarrow> lam \<Rightarrow> lam"
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    48
where
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    49
  "Lam \<equiv> rLam"
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
218
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    51
thm Var_def
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    52
thm App_def
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    53
thm Lam_def
df05cd030d2f added infrastructure for defining lifted constants
Christian Urban <urbanc@in.tum.de>
parents: 203
diff changeset
    54
243
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    55
quotient_def (for lam)
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    56
  fv :: "lam \<Rightarrow> name set"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    57
where
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    58
  "fv \<equiv> rfv"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    59
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    60
thm fv_def
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    61
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    62
(* definition of overloaded permutation function *)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    63
(* for the lifted type lam                       *)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    64
overloading
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    65
  perm_lam    \<equiv> "perm :: 'x prm \<Rightarrow> lam \<Rightarrow> lam"   (unchecked)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    66
begin
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    67
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    68
quotient_def (for lam)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    69
  perm_lam :: "'x prm \<Rightarrow> lam \<Rightarrow> lam"
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    70
where
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    71
  "perm_lam \<equiv> (perm::'x prm \<Rightarrow> rlam \<Rightarrow> rlam)"
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    72
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    73
end
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    74
238
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
    75
(*quotient_def (for lam)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
    76
  abs_fun_lam :: "'x prm \<Rightarrow> lam \<Rightarrow> lam"
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
    77
where
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
    78
  "perm_lam \<equiv> (perm::'x prm \<Rightarrow> rlam \<Rightarrow> rlam)"*)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
    79
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
    80
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    81
thm perm_lam_def
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    82
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    83
(* lemmas that need to lift *)
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
    84
lemma pi_var_com:
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    85
  fixes pi::"'x prm"
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
    86
  shows "(pi\<bullet>rVar a) \<approx> rVar (pi\<bullet>a)"
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    87
  sorry
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    88
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
    89
lemma pi_app_com:
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    90
  fixes pi::"'x prm"
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
    91
  shows "(pi\<bullet>rApp t1 t2) \<approx> rApp (pi\<bullet>t1) (pi\<bullet>t2)"
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    92
  sorry
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    93
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
    94
lemma pi_lam_com:
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    95
  fixes pi::"'x prm"
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
    96
  shows "(pi\<bullet>rLam a t) \<approx> rLam (pi\<bullet>a) (pi\<bullet>t)"
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    97
  sorry
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
    98
243
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
    99
lemma fv_var:
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   100
  shows "fv (Var a) = {a}"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   101
sorry
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   102
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   103
lemma fv_app:
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   104
  shows "fv (App t1 t2) = (fv t1) \<union> (fv t2)"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   105
sorry
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   106
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   107
lemma fv_lam:
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   108
  shows "fv (Lam a t) = (fv t) - {a}"
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   109
sorry 
22715cab3995 added fv-function
Christian Urban <urbanc@in.tum.de>
parents: 240
diff changeset
   110
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
lemma real_alpha:
242
47de63a883c2 The proper real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 240
diff changeset
   112
  assumes "t = [(a,b)]\<bullet>s" "a\<sharp>[b].s"
201
1ac36993cc71 added an example about lambda-terms
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
  shows "Lam a t = Lam b s"
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   114
sorry
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   115
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   116
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   117
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   118
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   119
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   120
(* Construction Site code *)
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   121
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   122
lemma perm_rsp: "(op = ===> alpha ===> alpha) op \<bullet> op \<bullet>"
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   123
  apply(auto)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   124
  (* this is propably true if some type conditions are imposed ;o) *)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   125
  sorry
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   126
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   127
lemma fresh_rsp: "(op = ===> alpha ===> op =) fresh fresh" 
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   128
  apply(auto)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   129
  (* this is probably only true if some type conditions are imposed *)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   130
  sorry
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   131
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   132
lemma rVar_rsp: "(op = ===> alpha) rVar rVar"
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   133
  apply(auto)
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   134
  apply(rule a1)
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   135
  apply(simp)
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   136
  done
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   137
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   138
lemma rApp_rsp: "(alpha ===> alpha ===> alpha) rApp rApp"
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   139
  apply(auto)
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   140
  apply(rule a2)
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   141
  apply (assumption)
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   142
  apply (assumption)
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   143
  done
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   144
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   145
lemma rLam_rsp: "(op = ===> alpha ===> alpha) rLam rLam"
229
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   146
  apply(auto)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   147
  apply(rule a3)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   148
  apply(rule_tac t="[(x,x)]\<bullet>y" and s="y" in subst)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   149
  apply(rule sym)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   150
  apply(rule trans)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   151
  apply(rule pt_name3)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   152
  apply(rule at_ds1[OF at_name_inst])
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   153
  apply(simp add: pt_name1)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   154
  apply(assumption)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   155
  apply(simp add: abs_fresh)
13f985a93dbc fixed the definition of alpha; this *breaks* some of the experiments
Christian Urban <urbanc@in.tum.de>
parents: 225
diff changeset
   156
  done
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   157
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   158
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   159
ML {* val qty = @{typ "lam"} *}
240
6cff34032a00 Cleaning also in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 238
diff changeset
   160
ML {* val (rty, rel, rel_refl, rel_eqv) = lookup_quot_data @{context} qty *}
6cff34032a00 Cleaning also in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 238
diff changeset
   161
ML {* val defs = @{thms Var_def App_def Lam_def perm_lam_def} *}
6cff34032a00 Cleaning also in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 238
diff changeset
   162
ML {* val consts = lookup_quot_consts defs *}
6cff34032a00 Cleaning also in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 238
diff changeset
   163
ML {* val (trans2, reps_same, quot) = lookup_quot_thms @{context} "lam" *}
234
811f17de4031 Lifting of the 3 lemmas in LamEx
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 233
diff changeset
   164
ML {* val rsp_thms = @{thms perm_rsp fresh_rsp rVar_rsp rApp_rsp rLam_rsp} @ @{thms ho_all_prs ho_ex_prs} *}
240
6cff34032a00 Cleaning also in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 238
diff changeset
   165
ML {* fun lift_thm_lam lthy t = lift_thm lthy qty "lam" rsp_thms defs t *}
237
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   166
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   167
ML {* lift_thm_lam @{context} @{thm pi_var_com} *}
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   168
ML {* lift_thm_lam @{context} @{thm pi_app_com} *}
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   169
ML {* lift_thm_lam @{context} @{thm pi_lam_com} *}
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   170
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   171
fun
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   172
  option_map::"('a \<Rightarrow> 'b) \<Rightarrow> ('a noption) \<Rightarrow> ('b noption)"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   173
where
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   174
  "option_map f (nSome x) = nSome (f x)"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   175
| "option_map f nNone = nNone"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   176
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   177
fun
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   178
  option_rel
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   179
where
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   180
  "option_rel r (nSome x) (nSome y) = r x y"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   181
| "option_rel r _ _ = False"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   182
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   183
declare [[map noption = (option_map, option_rel)]]
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   184
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   185
lemma OPT_QUOTIENT:
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   186
  assumes q: "QUOTIENT R Abs Rep"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   187
  shows "QUOTIENT (option_rel R) (option_map Abs) (option_map Rep)"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   188
  apply (unfold QUOTIENT_def)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   189
  apply (auto)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   190
  using q
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   191
  apply (unfold QUOTIENT_def)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   192
  apply (case_tac "a :: 'b noption")
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   193
  apply (simp)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   194
  apply (simp)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   195
  apply (case_tac "a :: 'b noption")
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   196
  apply (simp only: option_map.simps)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   197
  apply (subst option_rel.simps)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   198
  (* Simp starts hanging so don't know how to continue *)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   199
  sorry
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   200
240
6cff34032a00 Cleaning also in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 238
diff changeset
   201
(* Not sure if it make sense or if it will be needed *)
237
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   202
lemma abs_fun_rsp: "(op = ===> alpha ===> op = ===> op =) abs_fun abs_fun"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   203
sorry
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   204
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   205
(* Should not be needed *)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   206
lemma eq_rsp2: "((op = ===> op =) ===> (op = ===> op =) ===> op =) op = op ="
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   207
apply auto
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   208
apply (rule ext)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   209
apply auto
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   210
apply (rule ext)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   211
apply auto
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   212
done
217
9cc87d02190a First experiments with Lambda
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 203
diff changeset
   213
237
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   214
(* Should not be needed *)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   215
lemma perm_rsp_eq: "(op = ===> (op = ===> op =) ===> op = ===> op =) op \<bullet> op \<bullet>"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   216
apply auto
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   217
thm arg_cong2
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   218
apply (rule_tac f="perm x" in arg_cong2)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   219
apply (auto)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   220
apply (rule ext)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   221
apply (auto)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   222
done
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   223
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   224
(* Should not be needed *)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   225
lemma fresh_rsp_eq: "(op = ===> (op = ===> op =) ===> op =) fresh fresh"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   226
apply (simp add: FUN_REL.simps)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   227
apply (metis ext)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   228
done
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   229
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   230
(* It is just a test, it doesn't seem true... *)
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   231
lemma quotient_cheat: "QUOTIENT op = (option_map ABS_lam) (option_map REP_lam)"
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   232
sorry
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   233
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   234
ML {* val rsp_thms = @{thms abs_fun_rsp OPT_QUOTIENT eq_rsp2 quotient_cheat perm_rsp_eq fresh_rsp_eq} @ rsp_thms *}
240
6cff34032a00 Cleaning also in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 238
diff changeset
   235
ML {* fun lift_thm_lam lthy t = lift_thm lthy qty "lam" rsp_thms defs t *}
237
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   236
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   237
thm a3
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   238
ML {* Toplevel.program (fn () => lift_thm_lam @{context} @{thm a3}) *}
238
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   239
thm a3
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   240
ML {* val t_u1 = eqsubst_thm @{context} @{thms abs_fresh(1)} (atomize_thm @{thm a3}) *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   241
ML {* val t_u = MetaSimplifier.rewrite_rule @{thms fresh_def supp_def} t_u1 *}
237
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   242
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   243
ML {* val t_a = atomize_thm t_u *}
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   244
ML {* val t_r = regularize t_a rty rel rel_eqv @{context} *}
238
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   245
ML {* fun r_mk_comb_tac_lam ctxt =
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   246
  r_mk_comb_tac ctxt rty quot rel_refl trans2 rsp_thms
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   247
*}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   248
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   249
instance lam :: fs_name
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   250
apply(intro_classes)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   251
sorry
237
80f1df49b940 More tests in Lam
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 234
diff changeset
   252
238
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   253
prove asdf: {* Logic.mk_implies (concl_of t_r, (@{term "Trueprop (\<forall>t\<Colon>rlam\<in>Respects
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   254
          alpha.
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   255
         \<forall>(a\<Colon>name) b\<Colon>name.
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   256
            \<forall>s\<Colon>rlam\<in>Respects
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   257
                alpha.
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   258
               t \<approx> ([(a,
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   259
                 b)] \<bullet> s) \<longrightarrow>
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   260
               a = b \<or>
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   261
               a
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   262
               \<notin> {a\<Colon>name.
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   263
                infinite
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   264
                 {b\<Colon>name. Not
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   265
                  (([(a, b)] \<bullet>
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   266
                  s) \<approx>
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   267
                  s)}} \<longrightarrow>
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   268
               rLam a
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   269
                t \<approx> rLam
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   270
                 b s)"})) *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   271
apply (tactic {* full_simp_tac ((Simplifier.context @{context} HOL_ss) addsimps
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   272
        [(@{thm equiv_res_forall} OF [rel_eqv]),
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   273
         (@{thm equiv_res_exists} OF [rel_eqv])]) 1 *})
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   274
apply (rule allI)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   275
apply (drule_tac x="t" in spec)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   276
apply (rule allI)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   277
apply (drule_tac x="a" in spec)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   278
apply (rule allI)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   279
apply (drule_tac x="b" in spec)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   280
apply (rule allI)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   281
apply (drule_tac x="s" in spec)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   282
apply (rule impI)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   283
apply (drule_tac mp)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   284
apply (simp)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   285
apply (simp)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   286
apply (rule impI)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   287
apply (rule a3)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   288
apply (simp)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   289
apply (simp add: abs_fresh(1))
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   290
apply (case_tac "a = b")
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   291
apply (simp)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   292
apply (simp)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   293
apply (auto)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   294
apply (unfold fresh_def)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   295
apply (unfold supp_def)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   296
apply (simp)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   297
prefer 2
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   298
apply (simp)
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   299
sorry
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   300
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   301
ML {* val abs = findabs rty (prop_of t_a) *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   302
ML {* val simp_lam_prs_thms = map (make_simp_lam_prs_thm @{context} quot) abs *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   303
ML {* val t_defs_sym = add_lower_defs @{context} defs *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   304
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   305
ML {* val t_r' = @{thm asdf} OF [t_r] *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   306
ML {* val t_t = repabs @{context} t_r' consts rty qty quot rel_refl trans2 rsp_thms *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   307
ML {* val t_l = repeat_eqsubst_thm @{context} simp_lam_prs_thms t_t *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   308
ML {* val t_a = simp_allex_prs @{context} quot t_l *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   309
ML {* val t_d = repeat_eqsubst_thm @{context} t_defs_sym t_a *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   310
ML {* val t_r = MetaSimplifier.rewrite_rule [reps_same] t_d *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   311
ML {* val tt = MetaSimplifier.rewrite_rule [symmetric @{thm supp_def}, symmetric @{thm fresh_def}] t_r *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   312
ML {* val rr = @{thm sym} OF @{thms abs_fresh(1)} *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   313
ML {* val ttt = eqsubst_thm @{context} [rr] tt *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   314
ML {* ObjectLogic.rulify ttt *}
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   315
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   316
lemma
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   317
  assumes a: "a \<notin> {a\<Colon>name. infinite {b\<Colon>name. \<not> ([(a, b)] \<bullet> s) \<approx> s}}"
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   318
  shows "a \<notin> {a\<Colon>name. infinite {b\<Colon>name. [(a, b)] \<bullet> s \<noteq> s}}"
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   319
  using a apply simp
e9cc3a3aa5d1 Tried manually lifting real_alpha
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 237
diff changeset
   320
  sorry (* Not true... *)