Nominal/Ex/Ex2.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 25 May 2010 10:43:19 +0200
changeset 2177 9b566c5dc1f5
parent 2120 2786ff1df475
child 2301 8732ff59068b
permissions -rw-r--r--
overlapping deep binders proof
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory Ex2
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
     2
imports "../NewParser"
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
text {* example 2 *}
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
atom_decl name
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
     9
nominal_datatype trm =
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
  Var "name"
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    11
| App "trm" "trm"
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    12
| Lam x::"name" t::"trm"          bind_set x in t
2177
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    13
| Let p::"pat" "trm" t::"trm"     bind "f p" in t
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    14
and pat =
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
  PN
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
| PS "name"
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
| PD "name" "name"
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
binder
2177
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    19
  f::"pat \<Rightarrow> atom list"
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
where
2177
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    21
  "f PN = []"
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    22
| "f (PS x) = [atom x]"
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    23
| "f (PD x y) = [atom x, atom y]"
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    24
2026
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    25
thm trm_pat.bn
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    26
thm trm_pat.perm
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    27
thm trm_pat.induct
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    28
thm trm_pat.distinct
7f504136149b Another example where only alpha_eqvt fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    29
thm trm_pat.fv[simplified trm_pat.supp(1-2)]
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
2177
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    31
lemma lets_overlap1:
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    32
  "atom a \<noteq> atom b \<Longrightarrow> Let (PD a a) x y \<noteq> Let (PD a b) x y"
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    33
  by (simp add: trm_pat.eq_iff alphas)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    34
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    35
lemma lets_overlap2:
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    36
  "atom a \<notin> supp y \<Longrightarrow> atom b \<notin> supp y \<Longrightarrow> Let (PD a a) x y = Let (PD b b) x y"
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    37
  apply (simp add: trm_pat.eq_iff alphas trm_pat.supp)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    38
  apply (rule_tac x="(a\<leftrightarrow>b)" in exI)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    39
  apply (simp add: eqvts)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    40
  apply (rule conjI)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    41
  prefer 2
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    42
  apply (rule Nominal2_Supp.supp_perm_eq)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    43
  apply (unfold fresh_star_def)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    44
  apply (unfold fresh_def)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    45
  apply (unfold flip_def)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    46
  apply (simp_all add: supp_swap)
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    47
  apply auto
9b566c5dc1f5 overlapping deep binders proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2120
diff changeset
    48
  done
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2030
diff changeset
    49
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
end
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53