Nominal/Ex/CPS/CPS2_DanvyNielsen.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Fri, 19 Aug 2011 12:49:38 +0900
changeset 2998 f0fab367453a
parent 2895 65efa1c7563c
child 3089 9bcf02a6eea9
permissions -rw-r--r--
Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
header {* CPS transformation of Danvy and Nielsen *}
2895
65efa1c7563c Theory name changes for JEdit
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2869
diff changeset
     2
theory CPS2_DanvyNielsen
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
imports Lt
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
begin
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
nominal_datatype cpsctxt =
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
  Hole
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
| CFun cpsctxt lt
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
| CArg lt cpsctxt
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2895
diff changeset
    10
| CAbs x::name c::cpsctxt binds x in c
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
nominal_primrec
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
  fill   :: "cpsctxt \<Rightarrow> lt \<Rightarrow> lt"         ("_<_>" [200, 200] 100)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
where
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
  fill_hole : "Hole<M> = M"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
| fill_fun  : "(CFun C N)<M> = (C<M>) $ N"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
| fill_arg  : "(CArg N C)<M> = N $ (C<M>)"
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2895
diff changeset
    18
| fill_abs  : "atom x \<sharp> M \<Longrightarrow> (CAbs x C)<M> = Lam x (C<M>)"
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
  unfolding eqvt_def fill_graph_def
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
  apply perm_simp
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
  apply auto
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
  apply (rule_tac y="a" and c="b" in cpsctxt.strong_exhaust)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
  apply (auto simp add: fresh_star_def)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
  apply (erule Abs_lst1_fcb)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
  apply (simp_all add: Abs_fresh_iff)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
  apply (erule fresh_eqvt_at)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
  apply (simp add: finite_supp)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  apply (simp add: fresh_Pair)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  apply (simp add: eqvt_at_def swap_fresh_fresh)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
  done
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2895
diff changeset
    32
termination (eqvt) by lexicographic_order
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
nominal_primrec
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
  ccomp :: "cpsctxt => cpsctxt => cpsctxt"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
where
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
  "ccomp Hole C  = C"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
| "atom x \<sharp> C' \<Longrightarrow> ccomp (CAbs x C) C' = CAbs x (ccomp C C')"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
| "ccomp (CArg N C) C' = CArg N (ccomp C C')"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
| "ccomp (CFun C N) C'  = CFun (ccomp C C') N"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
  unfolding eqvt_def ccomp_graph_def
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
  apply perm_simp
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
  apply auto
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
  apply (rule_tac y="a" and c="b" in cpsctxt.strong_exhaust)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
  apply (auto simp add: fresh_star_def)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
  apply blast+
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
  apply (erule Abs_lst1_fcb)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
  apply (simp_all add: Abs_fresh_iff)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
  apply (erule fresh_eqvt_at)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
  apply (simp add: finite_supp)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
  apply (simp add: fresh_Pair)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
  apply (simp add: eqvt_at_def swap_fresh_fresh)
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
  done
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2895
diff changeset
    55
termination (eqvt) by lexicographic_order
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
nominal_primrec
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
    CPSv :: "lt => lt"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
and CPS :: "lt => cpsctxt" where
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
  "CPSv (Var x) = x~"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
| "CPS (Var x) = CFun Hole (x~)"
2998
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2895
diff changeset
    62
| "atom b \<sharp> M \<Longrightarrow> CPSv (Lam y M) = Lam y (Lam b ((CPS M)<Var b>))"
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2895
diff changeset
    63
| "atom b \<sharp> M \<Longrightarrow> CPS (Lam y M) = CFun Hole (Lam y (Lam b ((CPS M)<Var b>)))"
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2895
diff changeset
    64
| "CPSv (M $ N) = Lam x (Var x)"
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
| "isValue M \<Longrightarrow> isValue N \<Longrightarrow> CPS (M $ N) = CArg (CPSv M $ CPSv N) Hole"
2869
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    66
| "isValue M \<Longrightarrow> ~isValue N \<Longrightarrow> atom a \<sharp> M \<Longrightarrow> CPS (M $ N) =
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
     ccomp (CPS N) (CAbs a (CArg (CPSv M $ Var a) Hole))"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
| "~isValue M \<Longrightarrow> isValue N \<Longrightarrow> atom a \<sharp> N \<Longrightarrow> CPS (M $ N) =
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
     ccomp (CPS M) (CAbs a (CArg (Var a $ (CPSv N)) Hole))"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
| "~isValue M \<Longrightarrow> ~isValue N \<Longrightarrow> atom a \<sharp> (N, b) \<Longrightarrow> CPS (M $ N) =
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    71
     ccomp (CPS M) (CAbs a (ccomp (CPS N) (CAbs b (CArg (Var a $ Var b) Hole))))"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
  apply auto
2869
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    73
  defer
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    74
  apply (case_tac x)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    75
  apply (rule_tac y="a" in lt.exhaust)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    76
  apply auto
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    77
  apply (rule_tac x="lt" and ?'a="name" in obtain_fresh)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    78
  apply (simp add: Abs1_eq_iff)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    79
  apply blast+
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    80
  apply (rule_tac y="b" in lt.exhaust)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    81
  apply auto
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    82
  apply (rule_tac x="lt" and ?'a="name" in obtain_fresh)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    83
  apply (simp add: Abs1_eq_iff)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    84
  apply blast
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    85
  apply (rule_tac ?'a="name" in obtain_fresh)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    86
  apply (rule_tac x="(lt1, lt2, a)" and ?'a="name" in obtain_fresh)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    87
  apply (simp add: fresh_Pair_elim)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    88
  apply (case_tac "isValue lt1", case_tac [!] "isValue lt2")[1]
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    89
  apply (simp_all add: fresh_Pair)[4]
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    90
--""
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    91
  apply (rule_tac x="(y, ya, b, ba, 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: 2895
diff changeset
    92
  apply (subgoal_tac "Lam b (Sum_Type.Projr (CPSv_CPS_sumC (Inr M))<(b~)>) = Lam a (Sum_Type.Projr (CPSv_CPS_sumC (Inr M))<(a~)>)")
f0fab367453a Use same constructor names as Lambda, remove copies of FCB, remove [eqvt].
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2895
diff changeset
    93
  apply (subgoal_tac "Lam ba (Sum_Type.Projr (CPSv_CPS_sumC (Inr Ma))<(ba~)>) = Lam a (Sum_Type.Projr (CPSv_CPS_sumC (Inr Ma))<(a~)>)")
2869
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    94
  apply (simp only:)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    95
  apply (erule Abs_lst1_fcb)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    96
  apply (simp add: Abs_fresh_iff)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    97
  apply (simp_all add: Abs_fresh_iff lt.fresh fresh_Pair_elim fresh_at_base swap_fresh_fresh)[2]
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    98
  (* need an invariant to get eqvt_at (Proj) *)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
    99
  defer defer
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   100
  apply simp
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   101
  apply (simp_all add: Abs1_eq_iff fresh_Pair_elim fresh_at_base)[2]
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   102
  defer defer
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   103
  defer
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   104
  apply (simp add: Abs1_eq_iff fresh_at_base lt.fresh)
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   105
  apply (rule arg_cong) back
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   106
  defer
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   107
  apply (rule arg_cong) back
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   108
  defer
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   109
  apply (rule arg_cong) back
9c0df9901acf little on cps2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2864
diff changeset
   110
  defer
2861
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   111
  oops --"The goals seem reasonable"
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   112
5635a968fd3f Added the CPS translation experiments. CPS1 comes with all the proofs, CPS2,3 just have the function and need eqvt_rhs to finish the obligations.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   113
end