Nominal/Ex/CPS/CPS3_DanvyFilinski_FCB2.thy
author Christian Urban <urbanc@in.tum.de>
Sat, 17 Dec 2011 17:03:01 +0000
branchNominal2-Isabelle2011-1
changeset 3070 4b4742aa43f2
parent 2998 f0fab367453a
child 3186 425b4c406d80
permissions -rw-r--r--
cleaned all papers from the stable branch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2934
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
header {* CPS transformation of Danvy and Filinski *}
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     2
theory CPS3_DanvyFilinski imports Lt begin
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
nominal_primrec
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
  CPS1 :: "lt \<Rightarrow> (lt \<Rightarrow> lt) \<Rightarrow> lt" ("_*_"  [100,100] 100)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
and
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
  CPS2 :: "lt \<Rightarrow> lt \<Rightarrow> lt" ("_^_" [100,100] 100)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
where
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
  "eqvt k \<Longrightarrow> (x~)*k = k (x~)"
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2965
diff changeset
    10
| "eqvt k \<Longrightarrow> (M$N)*k = M*(%m. (N*(%n.((m $ n) $ (Lam c (k (c~)))))))"
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2965
diff changeset
    11
| "eqvt k \<Longrightarrow> atom c \<sharp> (x, M) \<Longrightarrow> (Lam x M)*k = k (Lam x (Lam c (M^(c~))))"
2934
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
| "\<not>eqvt k \<Longrightarrow> (CPS1 t k) = t"
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
| "(x~)^l = l $ (x~)"
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
| "(M$N)^l = M*(%m. (N*(%n.((m $ n) $ l))))"
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2965
diff changeset
    15
| "atom c \<sharp> (x, M) \<Longrightarrow> (Lam x M)^l = l $ (Lam x (Lam c (M^(c~))))"
2934
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
  apply (simp only: eqvt_def CPS1_CPS2_graph_def)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
  apply (rule, perm_simp, rule)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
  apply auto
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
  apply (case_tac x)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
  apply (case_tac a)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
  apply (case_tac "eqvt b")
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
  apply (rule_tac y="aa" in lt.strong_exhaust)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
  apply auto[4]
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
  apply (rule_tac x="(name, lt)" and ?'a="name" in obtain_fresh)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
  apply (simp add: fresh_at_base Abs1_eq_iff)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  apply (case_tac b)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
  apply (rule_tac y="a" in lt.strong_exhaust)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  apply auto[3]
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  apply blast
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
  apply (rule_tac x="(name, lt)" and ?'a="name" in obtain_fresh) 
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
  apply (simp add: fresh_at_base Abs1_eq_iff)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
  apply blast
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
--"-"
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2965
diff changeset
    34
  apply (subgoal_tac "Lam c (ka (c~)) = Lam ca (ka (ca~))")
2934
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
  apply (simp only:)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
  apply (simp add: Abs1_eq_iff)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
  apply (case_tac "c=ca")
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
  apply simp_all[2]
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
  apply rule
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
  apply (perm_simp)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
  apply (simp add: eqvt_def)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
  apply (simp add: fresh_def)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
  apply (rule contra_subsetD[OF supp_fun_app])
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
  back
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
  apply (simp add: supp_fun_eqvt lt.supp supp_at_base)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
--"-"
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
  apply (rule arg_cong)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
  back
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
  apply (thin_tac "eqvt ka")
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
  apply (rule_tac x="(c, ca, x, xa, M, Ma)" and ?'a="name" in obtain_fresh)
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2965
diff changeset
    51
  apply (subgoal_tac "Lam c (CPS1_CPS2_sumC (Inr (M, c~))) = Lam a (CPS1_CPS2_sumC (Inr (M, a~)))")
2934
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
  prefer 2
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
  apply (simp add: Abs1_eq_iff')
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
  apply (case_tac "c = a")
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
  apply simp_all[2]
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
  apply rule
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
  apply (simp add: eqvt_at_def)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
  apply (simp add: swap_fresh_fresh fresh_Pair_elim)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
  apply (erule fresh_eqvt_at)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
  apply (simp add: supp_Inr finite_supp)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
  apply (simp add: fresh_Inr fresh_Pair lt.fresh fresh_at_base)
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2965
diff changeset
    62
  apply (subgoal_tac "Lam ca (CPS1_CPS2_sumC (Inr (Ma, ca~))) = Lam a (CPS1_CPS2_sumC (Inr (Ma, a~)))")
2934
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
  prefer 2
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
  apply (simp add: Abs1_eq_iff')
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
  apply (case_tac "ca = a")
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
  apply simp_all[2]
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
  apply rule
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
  apply (simp add: eqvt_at_def)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
  apply (simp add: swap_fresh_fresh fresh_Pair_elim)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
  apply (erule fresh_eqvt_at)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    71
  apply (simp add: supp_Inr finite_supp)
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
  apply (simp add: fresh_Inr fresh_Pair lt.fresh fresh_at_base)
2965
d8a6b424f80a use eqvt_at_perm
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2964
diff changeset
    73
  apply (simp only:)
d8a6b424f80a use eqvt_at_perm
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2964
diff changeset
    74
  apply (simp (no_asm))
2964
0d95e19e4f93 Remove copy of FCB and cleanup
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2934
diff changeset
    75
  apply (erule_tac c="a" in Abs_lst1_fcb2')
0d95e19e4f93 Remove copy of FCB and cleanup
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2934
diff changeset
    76
  apply (simp add: Abs_fresh_iff lt.fresh)
2934
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
  apply (simp add: fresh_star_def fresh_Pair_elim lt.fresh fresh_at_base)
2964
0d95e19e4f93 Remove copy of FCB and cleanup
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2934
diff changeset
    78
  oops
2934
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
end
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
78fc2bd14d02 Added non-working CPS3 using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83