Nominal/Ex/SingleLet.thy
author Christian Urban <urbanc@in.tum.de>
Sun, 29 Aug 2010 01:17:36 +0800
changeset 2450 217ef3e4282e
parent 2449 6b51117b8955
child 2451 d2e929f51fa9
permissions -rw-r--r--
added proofs for fsupp properties
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1911
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
     1
theory SingleLet
2024
d974059827ad Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1911
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
atom_decl name
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
     7
declare [[STEPS = 100]]
2294
72ad4e766acf properly exported bn_descr
Christian Urban <urbanc@in.tum.de>
parents: 2293
diff changeset
     8
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
     9
nominal_datatype single_let: trm  =
1911
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    10
  Var "name"
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    11
| App "trm" "trm"
2424
621ebd8b13c4 changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents: 2410
diff changeset
    12
| Lam x::"name" t::"trm"  bind x in t
621ebd8b13c4 changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents: 2410
diff changeset
    13
| Let a::"assg" t::"trm"  bind (set) "bn a" in t
621ebd8b13c4 changed parser so that the binding mode is indicated as "bind (list)", "bind (set)" or "bind (res)"; if only "bind" is given, then bind (list) is assumed as default
Christian Urban <urbanc@in.tum.de>
parents: 2410
diff changeset
    14
| Foo x::"name" y::"name" t::"trm" t1::"trm" t2::"trm" bind (set) x in y t t1 t2
2296
45a69c9cc4cc alpha works now
Christian Urban <urbanc@in.tum.de>
parents: 2295
diff changeset
    15
| Bar x::"name" y::"name" t::"trm" bind y x in t x y
2316
08bbde090a17 also symmetry
Christian Urban <urbanc@in.tum.de>
parents: 2313
diff changeset
    16
| Baz x::"name" t1::"trm" t2::"trm" bind x in t1, bind x in t2 
1911
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    17
and assg =
2320
d835a2771608 prove that alpha implies alpha_bn (needed for rsp proofs)
Christian Urban <urbanc@in.tum.de>
parents: 2318
diff changeset
    18
  As "name" x::"name" t::"trm" bind x in t
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
binder
1911
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    20
  bn::"assg \<Rightarrow> atom set"
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
where
2320
d835a2771608 prove that alpha implies alpha_bn (needed for rsp proofs)
Christian Urban <urbanc@in.tum.de>
parents: 2318
diff changeset
    22
  "bn (As x y t) = {atom x}"
1911
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
    23
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    24
thm Ball_def Bex_def mem_def
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    25
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    26
thm single_let.distinct
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    27
thm single_let.induct
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    28
thm single_let.exhaust
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    29
thm single_let.fv_defs
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    30
thm single_let.bn_defs
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    31
thm single_let.perm_simps
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    32
thm single_let.eq_iff
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    33
thm single_let.fv_bn_eqvt
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
    34
thm single_let.size_eqvt
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    35
thm single_let.supports
2450
217ef3e4282e added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
    36
thm single_let.fsupp
2430
a746d49b0240 updated to new Isabelle
Christian Urban <urbanc@in.tum.de>
parents: 2428
diff changeset
    37
2450
217ef3e4282e added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
    38
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    39
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    40
instantiation trm and assg :: fs
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    41
begin
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    42
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    43
instance
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    44
apply(default)
2450
217ef3e4282e added proofs for fsupp properties
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
    45
apply(simp_all add: single_let.fsupp)
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    46
done
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    47
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    48
end
2406
428d9cb9a243 can also lift the various eqvt lemmas for bn, fv, fv_bn and size
Christian Urban <urbanc@in.tum.de>
parents: 2405
diff changeset
    49
2431
331873ebc5cd can now deal with type variables in nominal datatype definitions
Christian Urban <urbanc@in.tum.de>
parents: 2430
diff changeset
    50
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    51
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    52
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    53
lemma test: 
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    54
  "(\<exists>p. (bs, x) \<approx>lst (op=) f p (cs, y)) \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>lst (op=) supp p (cs, y))"
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    55
oops
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    56
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    57
lemma Abs_eq_iff:
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    58
  shows "Abs bs x = Abs cs y \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>gen (op =) supp p (cs, y))"
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    59
  and   "Abs_res bs x = Abs_res cs y \<longleftrightarrow> (\<exists>p. (bs, x) \<approx>res (op =) supp p (cs, y))"
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    60
  and   "Abs_lst bsl x = Abs_lst csl y \<longleftrightarrow> (\<exists>p. (bsl, x) \<approx>lst (op =) supp p (csl, y))"
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    61
  by (lifting alphas_abs)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    62
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    63
(*
2361
d73d4d151cce more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2359
diff changeset
    64
lemma supp_fv:
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    65
  "supp t = fv_trm t \<and> supp b = fv_bn b"
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    66
apply(rule single_let.induct)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    67
apply(simp_all only: single_let.fv_defs)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    68
apply(simp_all only: supp_def)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    69
apply(simp_all only: single_let.perm_simps)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    70
apply(simp_all only: single_let.eq_iff)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    71
apply(simp_all only: de_Morgan_conj)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    72
apply(simp_all only: Collect_disj_eq)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    73
apply(simp_all only: finite_Un)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    74
apply(simp_all only: de_Morgan_conj)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    75
apply(simp_all only: Collect_disj_eq)[2]
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    76
apply(subgoal_tac "supp (Lam name trm) = supp (Abs_lst [atom name] trm)")
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    77
apply(simp only: single_let.fv_defs)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    78
apply(simp only: supp_abs)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    79
apply(simp (no_asm) only: supp_def)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    80
apply(simp only: single_let.perm_simps)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    81
apply(simp only: single_let.eq_iff)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    82
apply(subst test)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    83
apply(simp only: Abs_eq_iff[symmetric])
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    84
apply(simp only: alphas_abs[symmetric])
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    85
apply(simp only: eqvts)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    86
thm Abs_eq_iff
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    87
apply(simp only: alphas)
2365
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    88
sorry
2448
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    89
*)
b9d9c4540265 proved supports lemmas
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    90
(*
2365
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    91
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    92
consts perm_bn_trm :: "perm \<Rightarrow> trm \<Rightarrow> trm"
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    93
consts perm_bn_assg :: "perm \<Rightarrow> assg \<Rightarrow> assg"
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    94
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    95
lemma y:
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    96
  "perm_bn_trm p (Var x) = (Var x)"
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    97
  "perm_bn_trm p (App t1 t2) = (App t1 t2)"
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    98
  "perm_bn_trm p ("
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
    99
Christian Urban <urbanc@in.tum.de>
parents: 2361
diff changeset
   100
2361
d73d4d151cce more on the paper
Christian Urban <urbanc@in.tum.de>
parents: 2359
diff changeset
   101
2336
f2d545b77b31 added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents: 2330
diff changeset
   102
typ trm
f2d545b77b31 added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents: 2330
diff changeset
   103
typ assg
f2d545b77b31 added definition of the quotient types
Christian Urban <urbanc@in.tum.de>
parents: 2330
diff changeset
   104
1911
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   105
thm trm_assg.fv
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   106
thm trm_assg.supp
2024
d974059827ad Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1911
diff changeset
   107
thm trm_assg.eq_iff
1911
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   108
thm trm_assg.bn
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   109
thm trm_assg.perm
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   110
thm trm_assg.induct
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   111
thm trm_assg.inducts
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   112
thm trm_assg.distinct
60b5c61d3de2 renamed Ex1.thy to SingleLet.thy
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   113
ML {* Sign.of_sort @{theory} (@{typ trm}, @{sort fs}) *}
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
   114
*)
2024
d974059827ad Equivariance fails for single let?
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1911
diff changeset
   115
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2434
diff changeset
   116
2064
2725853f43b9 solved the problem with equivariance by first eta-normalising the goal
Christian Urban <urbanc@in.tum.de>
parents: 2028
diff changeset
   117
1596
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   118
end
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   119
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   120
c69d9fb16785 Move Ex1 and Ex2 out of Test
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   121