Nominal/Ex/Lambda_F_T_FCB2.thy
author Christian Urban <urbanc@in.tum.de>
Tue, 10 Apr 2012 16:02:30 +0100
changeset 3158 89f9d7e85e88
parent 2935 2f81b4677a01
child 3235 5ebd327ffb96
permissions -rw-r--r--
moved lift_raw_const from Quotient to Nominal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2935
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory Lambda
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     2
imports "../Nominal2" 
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
nominal_datatype lam =
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
  Var "name"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
| App "lam" "lam"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
| Lam x::"name" l::"lam"  bind x in l ("Lam [_]. _" [100, 100] 100)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
lemma fresh_fun_eqvt_app3:
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
  assumes a: "eqvt f"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
  and b: "a \<sharp> x" "a \<sharp> y" "a \<sharp> z"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
  shows "a \<sharp> f x y z"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
  using fresh_fun_eqvt_app[OF a b(1)] a b
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
  by (metis fresh_fun_app)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
lemma fresh_fun_eqvt_app4:
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
  assumes a: "eqvt f"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
  and b: "a \<sharp> x" "a \<sharp> y" "a \<sharp> z" "a \<sharp> w"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
  shows "a \<sharp> f x y z w"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
  using fresh_fun_eqvt_app[OF a b(1)] a b
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
  by (metis fresh_fun_app)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
lemma the_default_pty:
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
  assumes f_def: "f == (\<lambda>x::'a. THE_default d (G x))"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
  and unique: "\<exists>!y. G x y"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
  and pty: "\<And>x y. G x y \<Longrightarrow> P x y"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
  shows "P x (f x)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
  apply(subst f_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
  apply (rule ex1E[OF unique])
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
  apply (subst THE_default1_equality[OF unique])
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
  apply assumption
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
  apply (rule pty)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
  apply assumption
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
  done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
lemma Abs_lst1_fcb2:
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
  fixes a b :: "'a :: at"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
    and S T :: "'b :: fs"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
    and c::"'c::fs"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
  assumes e: "(Abs_lst [atom a] T) = (Abs_lst [atom b] S)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
  and fcb: "\<And>a T. atom a \<sharp> f a T c"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
  and fresh: "{atom a, atom b} \<sharp>* c"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
  and perm1: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f a T c) = f (p \<bullet> a) (p \<bullet> T) c"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
  and perm2: "\<And>p. supp p \<sharp>* c \<Longrightarrow> p \<bullet> (f b S c) = f (p \<bullet> b) (p \<bullet> S) c"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
  shows "f a T c = f b S c"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
proof -
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
  have fin1: "finite (supp (f a T c))"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
    apply(rule_tac S="supp (a, T, c)" in supports_finite)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
    apply(simp add: supports_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
    apply(simp add: fresh_def[symmetric])
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
    apply(clarify)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
    apply(subst perm1)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
    apply(simp add: supp_swap fresh_star_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
    apply(simp add: swap_fresh_fresh fresh_Pair)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
    apply(simp add: finite_supp)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
  have fin2: "finite (supp (f b S c))"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
    apply(rule_tac S="supp (b, S, c)" in supports_finite)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
    apply(simp add: supports_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
    apply(simp add: fresh_def[symmetric])
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
    apply(clarify)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
    apply(subst perm2)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
    apply(simp add: supp_swap fresh_star_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
    apply(simp add: swap_fresh_fresh fresh_Pair)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
    apply(simp add: finite_supp)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
  obtain d::"'a::at" where fr: "atom d \<sharp> (a, b, S, T, c, f a T c, f b S c)" 
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    71
    using obtain_fresh'[where x="(a, b, S, T, c, f a T c, f b S c)"]
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
    apply(auto simp add: finite_supp supp_Pair fin1 fin2)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
  have "(a \<leftrightarrow> d) \<bullet> (Abs_lst [atom a] T) = (b \<leftrightarrow> d) \<bullet> (Abs_lst [atom b] S)" 
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    75
    apply(simp (no_asm_use) only: flip_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
    apply(subst swap_fresh_fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
    apply(simp add: Abs_fresh_iff)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78
    using fr
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
    apply(simp add: Abs_fresh_iff)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
    apply(subst swap_fresh_fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
    apply(simp add: Abs_fresh_iff)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
    using fr
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83
    apply(simp add: Abs_fresh_iff)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
    apply(rule e)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    85
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    86
  then have "Abs_lst [atom d] ((a \<leftrightarrow> d) \<bullet> T) = Abs_lst [atom d] ((b \<leftrightarrow> d) \<bullet> S)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87
    apply (simp add: swap_atom flip_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    88
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    89
  then have eq: "(a \<leftrightarrow> d) \<bullet> T = (b \<leftrightarrow> d) \<bullet> S"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    90
    by (simp add: Abs1_eq_iff)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    91
  have "f a T c = (a \<leftrightarrow> d) \<bullet> f a T c"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    92
    unfolding flip_def
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    93
    apply(rule sym)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    94
    apply(rule swap_fresh_fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    95
    using fcb[where a="a"] 
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    96
    apply(simp)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    97
    using fr
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    98
    apply(simp add: fresh_Pair)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    99
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
  also have "... = f d ((a \<leftrightarrow> d) \<bullet> T) c"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   101
    unfolding flip_def
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
    apply(subst perm1)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
    using fresh fr
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
    apply(simp add: supp_swap fresh_star_def fresh_Pair)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105
    apply(simp)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   106
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   107
  also have "... = f d ((b \<leftrightarrow> d) \<bullet> S) c" using eq by simp
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   108
  also have "... = (b \<leftrightarrow> d) \<bullet> f b S c"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   109
    unfolding flip_def
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   110
    apply(subst perm2)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   111
    using fresh fr
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   112
    apply(simp add: supp_swap fresh_star_def fresh_Pair)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   113
    apply(simp)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   114
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   115
  also have "... = f b S c"   
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   116
    apply(rule flip_fresh_fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   117
    using fcb[where a="b"] 
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   118
    apply(simp)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   119
    using fr
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   120
    apply(simp add: fresh_Pair)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   121
    done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   122
  finally show ?thesis by simp
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   123
qed
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   124
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   125
locale test =
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   126
  fixes f1::"name \<Rightarrow> name list \<Rightarrow> ('a::pt)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   127
    and f2::"lam \<Rightarrow> lam \<Rightarrow> 'a \<Rightarrow> 'a \<Rightarrow> name list \<Rightarrow> ('a::pt)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   128
    and f3::"name \<Rightarrow> lam \<Rightarrow> 'a \<Rightarrow> name list \<Rightarrow> ('a::pt)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   129
  assumes fs: "finite (supp (f1, f2, f3))"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   130
    and eq: "eqvt f1" "eqvt f2" "eqvt f3"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   131
    and fcb1: "\<And>l n. atom ` set l \<sharp>* f1 n l"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   132
    and fcb2: "\<And>l t1 t2 r1 r2. atom ` set l \<sharp>* (r1, r2) \<Longrightarrow> atom ` set l \<sharp>* f2 t1 t2 r1 r2 l"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   133
    and fcb3: "\<And>t l r. atom ` set (x # l) \<sharp>* r \<Longrightarrow> atom ` set (x # l) \<sharp>* f3 x t r l"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   134
begin
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   135
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   136
nominal_primrec (invariant "\<lambda>(x, l) y. atom ` set l \<sharp>* y")
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   137
  f
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   138
where
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   139
  "f (Var x) l = f1 x l"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   140
| "f (App t1 t2) l = f2 t1 t2 (f t1 l) (f t2 l) l"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   141
| "atom x \<sharp> l \<Longrightarrow> (f (Lam [x].t) l) = f3 x t (f t (x # l)) l"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   142
  apply (simp add: eqvt_def f_graph_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   143
  apply (rule, perm_simp)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   144
  apply (simp only: eq[unfolded eqvt_def])
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   145
  apply (erule f_graph.induct)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   146
  apply (simp add: fcb1)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   147
  apply (simp add: fcb2 fresh_star_Pair)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   148
  apply simp
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   149
  apply (subgoal_tac "atom ` set (xa # l) \<sharp>* f3 xa t (f_sum (t, xa # l)) l")
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   150
  apply (simp add: fresh_star_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   151
  apply (rule fcb3)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   152
  apply (simp add: fresh_star_def fresh_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   153
  apply simp_all
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   154
  apply(case_tac x)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   155
  apply(rule_tac y="a" and c="b" in lam.strong_exhaust)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   156
  apply(auto simp add: fresh_star_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   157
  apply(erule_tac Abs_lst1_fcb2)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   158
--"?"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   159
  apply (subgoal_tac "atom ` set (a # la) \<sharp>* f3 a T (f_sumC (T, a # la)) la")
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   160
  apply (simp add: fresh_star_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   161
  apply (rule fcb3)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   162
  apply (simp add: fresh_star_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   163
  apply (rule fresh_fun_eqvt_app4[OF eq(3)])
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   164
  apply (simp add: fresh_at_base)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   165
  apply assumption
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   166
  apply (erule fresh_eqvt_at)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   167
  apply (simp add: finite_supp)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   168
  apply (simp add: fresh_Pair fresh_Cons fresh_at_base)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   169
  apply assumption
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   170
  apply (subgoal_tac "\<And>p y r l. p \<bullet> (f3 x y r l) = f3 (p \<bullet> x) (p \<bullet> y) (p \<bullet> r) (p \<bullet> l)")
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   171
  apply (subgoal_tac "(atom x \<rightleftharpoons> atom xa) \<bullet> la = la")
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   172
  apply (simp add: eqvt_at_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   173
  apply (simp add: swap_fresh_fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   174
  apply (simp add: permute_fun_app_eq eq[unfolded eqvt_def])
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   175
  apply simp
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   176
  done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   177
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   178
termination
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   179
  by (relation "measure (\<lambda>(x,_). size x)") (auto simp add: lam.size)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   180
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
end
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   182
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   183
section {* Locally Nameless Terms *}
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   184
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   185
nominal_datatype ln = 
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   186
  LNBnd nat
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   187
| LNVar name
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   188
| LNApp ln ln
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   189
| LNLam ln
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   190
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   191
fun
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   192
  lookup :: "name list \<Rightarrow> nat \<Rightarrow> name \<Rightarrow> ln" 
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   193
where
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   194
  "lookup [] n x = LNVar x"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   195
| "lookup (y # ys) n x = (if x = y then LNBnd n else (lookup ys (n + 1) x))"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   196
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   197
lemma lookup_eqvt[eqvt]:
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   198
  shows "(p \<bullet> lookup xs n x) = lookup (p \<bullet> xs) (p \<bullet> n) (p \<bullet> x)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   199
  by (induct xs arbitrary: n) (simp_all add: permute_pure)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   200
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   201
lemma fresh_at_list: "atom x \<sharp> xs \<longleftrightarrow> x \<notin> set xs"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   202
  unfolding fresh_def supp_set[symmetric]
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   203
  apply (induct xs)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   204
  apply (simp add: supp_set_empty)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   205
  apply simp
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   206
  apply auto
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   207
  apply (simp_all add: insert_absorb UnI2 finite_set supp_of_finite_insert supp_at_base)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   208
  done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   209
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   210
interpretation trans: test
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   211
  "%x l. lookup l 0 x"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   212
  "%t1 t2 r1 r2 l. LNApp r1 r2"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   213
  "%n t r l. LNLam r"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   214
  apply default
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   215
  apply (auto simp add: pure_fresh supp_Pair)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   216
  apply (simp_all add: fresh_def supp_def permute_fun_def permute_pure lookup_eqvt)[3]
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   217
  apply (simp_all add: eqvt_def permute_fun_def permute_pure lookup_eqvt)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   218
  apply (simp add: fresh_star_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   219
  apply (rule_tac x="0 :: nat" in spec)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   220
  apply (induct_tac l)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   221
  apply (simp add: ln.fresh pure_fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   222
  apply (auto simp add: ln.fresh pure_fresh)[1]
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   223
  apply (case_tac "a \<in> set list")
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   224
  apply simp
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   225
  apply (rule_tac f="lookup" in fresh_fun_eqvt_app3)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   226
  unfolding eqvt_def
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   227
  apply rule
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   228
  using eqvts_raw(35)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   229
  apply auto[1]
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   230
  apply (simp add: fresh_at_list)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   231
  apply (simp add: pure_fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   232
  apply (simp add: fresh_at_base)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   233
  apply (simp add: fresh_star_Pair fresh_star_def ln.fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   234
  apply (simp add: fresh_star_def ln.fresh)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   235
  done
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   236
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   237
thm trans.f.simps
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   238
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   239
lemma lam_strong_exhaust2:
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   240
  "\<lbrakk>\<And>name. y = Var name \<Longrightarrow> P; 
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   241
    \<And>lam1 lam2. y = App lam1 lam2 \<Longrightarrow> P;
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   242
    \<And>name lam. \<lbrakk>{atom name} \<sharp>* c; y = Lam [name]. lam\<rbrakk> \<Longrightarrow> P;
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   243
    finite (supp c)\<rbrakk>
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   244
    \<Longrightarrow> P"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   245
sorry
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   246
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   247
nominal_primrec
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   248
  g
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   249
where
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   250
  "(~finite (supp (g1, g2, g3))) \<Longrightarrow> g g1 g2 g3 t = t"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   251
| "finite (supp (g1, g2, g3)) \<Longrightarrow> g g1 g2 g3 (Var x) = g1 x"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   252
| "finite (supp (g1, g2, g3)) \<Longrightarrow> g g1 g2 g3 (App t1 t2) = g2 t1 t2 (g g1 g2 g3 t1) (g g1 g2 g3 t2)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   253
| "finite (supp (g1, g2, g3)) \<Longrightarrow> atom x \<sharp> (g1,g2,g3) \<Longrightarrow> (g g1 g2 g3 (Lam [x].t)) = g3 x t (g g1 g2 g3 t)"
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   254
  apply (simp add: eqvt_def g_graph_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   255
  apply (rule, perm_simp, rule)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   256
  apply simp_all
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   257
  apply (case_tac x)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   258
  apply (case_tac "finite (supp (a, b, c))")
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   259
  prefer 2
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   260
  apply simp
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   261
  apply(rule_tac y="d" and c="(a,b,c)" in lam_strong_exhaust2)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   262
  apply auto
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   263
  apply blast
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   264
  apply (simp add: Abs1_eq_iff fresh_star_def)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   265
  sorry
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   266
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   267
termination
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   268
  by (relation "measure (\<lambda>(_,_,_,t). size t)") (simp_all add: lam.size)
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   269
2f81b4677a01 Add non-working Lambda_F_T using FCB2
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   270
end