Nominal/Ex/LetPat.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 20 Dec 2011 16:49:03 +0900
changeset 3081 660a4f5adee8
parent 3029 6fd3fc3254ee
child 3071 11f6a561eb4b
permissions -rw-r--r--
Remove 'HERE1' and 'HERE3'.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2311
diff changeset
     1
theory LetPat
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
     2
imports "../Nominal2"
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
     7
nominal_datatype trm =
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
  Var "name"
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
     9
| App "trm" "trm"
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    10
| Lam x::"name" t::"trm"       binds x in t
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    11
| Let p::"pat" "trm" t::"trm"  binds "bn p" in t
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    12
and pat =
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    13
  PNil
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    14
| PVar "name"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    15
| PTup "pat" "pat"
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
binder
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    17
  bn::"pat \<Rightarrow> atom list"
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
where
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    19
  "bn PNil = []"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    20
| "bn (PVar x) = [atom x]"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    21
| "bn (PTup p1 p2) = bn p1 @ bn p2"
2300
9fb315392493 added FSet to the correct paper
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    22
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    23
thm trm_pat.eq_iff
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2311
diff changeset
    24
thm trm_pat.distinct
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    25
thm trm_pat.induct
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    26
thm trm_pat.strong_induct[no_vars]
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2311
diff changeset
    27
thm trm_pat.exhaust
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    28
thm trm_pat.strong_exhaust[no_vars]
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2311
diff changeset
    29
thm trm_pat.fv_defs
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2311
diff changeset
    30
thm trm_pat.bn_defs
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2311
diff changeset
    31
thm trm_pat.perm_simps
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2311
diff changeset
    32
thm trm_pat.eq_iff
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2311
diff changeset
    33
thm trm_pat.fv_bn_eqvt
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    34
thm trm_pat.size
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    35
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    36
(* Nominal_Abs test *)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    37
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    38
lemma alpha_res_alpha_set:
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    39
  "(bs, x) \<approx>res op = supp p (cs, y) \<longleftrightarrow> 
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    40
  (bs \<inter> supp x, x) \<approx>set op = supp p (cs \<inter> supp y, y)"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    41
  using alpha_abs_set_abs_res alpha_abs_res_abs_set by blast
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    42
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    43
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    44
lemma
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    45
  fixes x::"'a::fs"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    46
  assumes "(supp x - as) \<sharp>* p"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    47
      and "p \<bullet> x = y"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    48
      and "p \<bullet> (as \<inter> supp x) = bs \<inter> supp y"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    49
  shows "(as, x) \<approx>res (op =) supp p (bs, y)"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    50
  using assms
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    51
  unfolding alpha_res_alpha_set
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    52
  unfolding alphas
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    53
  apply simp
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    54
  apply rule
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    55
  apply (rule trans)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    56
  apply (rule supp_perm_eq[symmetric, of _ p])
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    57
  apply(subst supp_finite_atom_set)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    58
  apply (metis finite_Diff finite_supp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    59
  apply (simp add: fresh_star_def)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    60
  apply blast
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    61
  apply(perm_simp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    62
  apply(simp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    63
  done
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    64
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    65
lemma
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    66
  fixes x::"'a::fs"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    67
  assumes "(supp x - as) \<sharp>* p"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    68
      and "p \<bullet> x = y"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    69
      and "p \<bullet> as = bs"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    70
  shows "(as, x) \<approx>set (op =) supp p (bs, y)"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    71
  using assms
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    72
  unfolding alphas
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    73
  apply simp
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    74
  apply (rule trans)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    75
  apply (rule supp_perm_eq[symmetric, of _ p])
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    76
  apply(subst supp_finite_atom_set)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    77
  apply (metis finite_Diff finite_supp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    78
  apply(simp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    79
  apply(perm_simp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    80
  apply(simp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    81
  done
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    82
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    83
lemma
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    84
  fixes x::"'a::fs"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    85
  assumes "(supp x - set as) \<sharp>* p"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    86
      and "p \<bullet> x = y"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    87
      and "p \<bullet> as = bs"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    88
  shows "(as, x) \<approx>lst (op =) supp p (bs, y)"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    89
  using assms
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    90
  unfolding alphas
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    91
  apply simp
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    92
  apply (rule trans)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    93
  apply (rule supp_perm_eq[symmetric, of _ p])
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    94
  apply(subst supp_finite_atom_set)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    95
  apply (metis finite_Diff finite_supp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    96
  apply(simp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    97
  apply(perm_simp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    98
  apply(simp)
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    99
  done
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2030
diff changeset
   101
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
end
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105