Nominal/Test.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Thu, 18 Mar 2010 10:12:41 +0100
changeset 1502 cc0dcf248da3
parent 1500 212e7a3494eb
child 1510 be911e869fde
permissions -rw-r--r--
Which proofs need a 'sorry'.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory Test
1335
c3dfd4193b42 Experiments with proving weird transp
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1331
diff changeset
     2
imports "Parser" "../Attic/Prove"
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
begin
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
     5
text {* example 1, equivalent to example 2 from Terms *}
1316
0577afdb1732 Porting from Lift to Parser; until defining the Quotient type.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1309
diff changeset
     6
1428
4029105011ca Show that the new types are in finite support typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1418
diff changeset
     7
atom_decl name
4029105011ca Show that the new types are in finite support typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1418
diff changeset
     8
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
     9
(* maybe should be added to Infinite.thy *)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    10
lemma infinite_Un:
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    11
  shows "infinite (S \<union> T) \<longleftrightarrow> infinite S \<or> infinite T"
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    12
  by simp
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    13
1454
7c8cd6eae8e2 FV_bn generated for recursive functions as well, and used in main fv for bindings.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1453
diff changeset
    14
ML {* val _ = cheat_alpha_eqvt := false *}
7c8cd6eae8e2 FV_bn generated for recursive functions as well, and used in main fv for bindings.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1453
diff changeset
    15
ML {* val _ = cheat_fv_eqvt := false *}
7c8cd6eae8e2 FV_bn generated for recursive functions as well, and used in main fv for bindings.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1453
diff changeset
    16
ML {* val _ = recursive := false *}
1445
3246c5e1a9d7 cheat_alpha_eqvt no longer needed; the proofs work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1441
diff changeset
    17
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    18
nominal_datatype lm =
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    19
  Vr "name"
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    20
| Ap "lm" "lm"
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    21
| Lm x::"name" l::"lm"  bind x in l
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    22
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    23
lemma finite_fv:
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    24
  shows "finite (fv_lm t)"
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    25
apply(induct t rule: lm_induct)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    26
apply(simp_all add: lm_fv)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    27
done
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    28
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    29
lemma supp_fn:
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    30
  shows "supp t = fv_lm t"
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    31
apply(induct t rule: lm_induct)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    32
apply(simp_all add: lm_fv)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    33
apply(simp only: supp_def)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    34
apply(simp only: lm_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
    35
apply(simp only: lm_eq_iff)
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    36
apply(simp only: supp_def[symmetric])
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    37
apply(simp only: supp_at_base)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    38
apply(simp (no_asm) only: supp_def)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    39
apply(simp only: lm_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
    40
apply(simp only: lm_eq_iff)
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    41
apply(simp only: de_Morgan_conj)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    42
apply(simp only: Collect_disj_eq)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    43
apply(simp only: infinite_Un)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    44
apply(simp only: Collect_disj_eq)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    45
apply(simp only: supp_def[symmetric])
1498
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
    46
apply(rule_tac t="supp (Lm name lm)" and s="supp (Abs {atom name} lm)" in subst)
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    47
apply(simp (no_asm) only: supp_def)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    48
apply(simp only: lm_perm)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    49
apply(simp only: permute_ABS)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
    50
apply(simp only: lm_eq_iff)
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    51
apply(simp only: Abs_eq_iff)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    52
apply(simp only: insert_eqvt atom_eqvt empty_eqvt)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    53
apply(simp only: alpha_gen)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    54
apply(simp only: supp_eqvt[symmetric])
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    55
apply(simp only: eqvts)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    56
apply(simp only: supp_Abs)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    57
done
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    58
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    59
lemmas supp_fn' = lm_fv[simplified supp_fn[symmetric]]
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    60
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    61
lemma
1499
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    62
  fixes c::"'a::fs"
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    63
  assumes a1: "\<And>name c. P c (Vr name)"
1500
212e7a3494eb vixed variable names
Christian Urban <urbanc@in.tum.de>
parents: 1499
diff changeset
    64
  and     a2: "\<And>lm1 lm2 c. \<lbrakk>\<And>d. P d lm1; \<And>d. P d lm2\<rbrakk> \<Longrightarrow> P c (Ap lm1 lm2)"
212e7a3494eb vixed variable names
Christian Urban <urbanc@in.tum.de>
parents: 1499
diff changeset
    65
  and     a3: "\<And>name lm c. \<lbrakk>\<And>d. P d lm\<rbrakk> \<Longrightarrow> P c (Lm name lm)"
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    66
  shows "P c lm"
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    67
proof -
1499
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    68
  have "\<And>p. P c (p \<bullet> lm)"
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    69
    apply(induct lm arbitrary: c rule: lm_induct)
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    70
    apply(simp only: lm_perm)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    71
    apply(rule a1)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    72
    apply(simp only: lm_perm)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    73
    apply(rule a2)
1499
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    74
    apply(blast)[1]
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    75
    apply(assumption)
1500
212e7a3494eb vixed variable names
Christian Urban <urbanc@in.tum.de>
parents: 1499
diff changeset
    76
    apply(subgoal_tac "\<exists>new::name. (atom new) \<sharp> (c, Lm (p \<bullet> name) (p \<bullet> lm))")
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    77
    apply(erule exE)
1500
212e7a3494eb vixed variable names
Christian Urban <urbanc@in.tum.de>
parents: 1499
diff changeset
    78
    apply(rule_tac t="p \<bullet> Lm name lm" and 
212e7a3494eb vixed variable names
Christian Urban <urbanc@in.tum.de>
parents: 1499
diff changeset
    79
                   s="(((p \<bullet> name) \<leftrightarrow> new) + p) \<bullet> Lm name lm" in subst)
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    80
    apply(simp)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    81
    apply(subst lm_perm)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    82
    apply(subst (2) lm_perm)
1499
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    83
    apply(rule flip_fresh_fresh)
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    84
    apply(simp add: fresh_def)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    85
    apply(simp only: supp_fn')
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    86
    apply(simp)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    87
    apply(simp add: fresh_Pair)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    88
    apply(simp add: lm_perm)
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    89
    apply(rule a3)
1499
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    90
    apply(drule_tac x="((p \<bullet> name) \<leftrightarrow> new) + p" in meta_spec)
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    91
    apply(simp)
1499
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    92
    apply(simp add: fresh_def)
1500
212e7a3494eb vixed variable names
Christian Urban <urbanc@in.tum.de>
parents: 1499
diff changeset
    93
    apply(rule_tac X="supp (c, Lm (p \<bullet> name) (p \<bullet> lm))" in obtain_at_base)
1499
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    94
    apply(simp add: supp_Pair finite_supp)
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    95
    apply(blast)
21dda372fb11 simplified strong induction proof by using flip
Christian Urban <urbanc@in.tum.de>
parents: 1498
diff changeset
    96
    done
1483
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    97
  then have "P c (0 \<bullet> lm)" by blast
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    98
  then show "P c lm" by simp
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
    99
qed
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
   100
2ca8e43b53c5 added partial proof for the strong induction principle
Christian Urban <urbanc@in.tum.de>
parents: 1478
diff changeset
   101
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
nominal_datatype lam =
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
  VAR "name"
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
| APP "lam" "lam"
1449
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   105
| LAM x::"name" t::"lam" bind x in t
1287
8557af71724e slight simplification of the raw-decl generation
Christian Urban <urbanc@in.tum.de>
parents: 1285
diff changeset
   106
| LET bp::"bp" t::"lam"   bind "bi bp" in t
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   107
and bp =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   108
  BP "name" "lam"
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
binder
1295
0ecc775e5fce Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1290
diff changeset
   110
  bi::"bp \<Rightarrow> atom set"
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
where
1295
0ecc775e5fce Link calls to Raw permutations, FV definition and alpha_definition into the parser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1290
diff changeset
   112
  "bi (BP x t) = {atom x}"
1228
c179ad9d2446 declarartion of the raw datatype already works; raw binding functions throw an exception about mutual recursive types
Christian Urban <urbanc@in.tum.de>
parents: 1223
diff changeset
   113
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   114
thm lam_bp_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   115
thm lam_bp_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   116
thm lam_bp_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   117
thm lam_bp_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   118
thm lam_bp_induct
1447
378b8c791de8 derive "inducts" from "induct" instead of lifting again is much faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1445
diff changeset
   119
thm lam_bp_inducts
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   120
thm lam_bp_distinct
1428
4029105011ca Show that the new types are in finite support typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1418
diff changeset
   121
ML {* Sign.of_sort @{theory} (@{typ lam}, @{sort fs}) *}
4029105011ca Show that the new types are in finite support typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1418
diff changeset
   122
4029105011ca Show that the new types are in finite support typeclass.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1418
diff changeset
   123
term "supp (x :: lam)"
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   124
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   125
lemma bi_eqvt:
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   126
  shows "(p \<bullet> (bi b)) = bi (p \<bullet> b)"
1441
14b850159df1 Use eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1439
diff changeset
   127
  by (rule eqvts)
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   128
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   129
lemma supp_fv:
1461
c79bcbe1983d added the final unfolded result
Christian Urban <urbanc@in.tum.de>
parents: 1460
diff changeset
   130
  shows "supp t = fv_lam t" 
c79bcbe1983d added the final unfolded result
Christian Urban <urbanc@in.tum.de>
parents: 1460
diff changeset
   131
  and "supp bp = fv_bp bp \<and> fv_bi bp = {a. infinite {b. \<not>alpha_bi ((a \<rightleftharpoons> b) \<bullet> bp) bp}}"
1460
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   132
apply(induct t and bp rule: lam_bp_inducts)
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   133
apply(simp_all add: lam_bp_fv)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   134
(* VAR case *)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   135
apply(simp only: supp_def)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   136
apply(simp only: lam_bp_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   137
apply(simp only: lam_bp_eq_iff)
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   138
apply(simp only: supp_def[symmetric])
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   139
apply(simp only: supp_at_base)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   140
(* APP case *)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   141
apply(simp only: supp_def)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   142
apply(simp only: lam_bp_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   143
apply(simp only: lam_bp_eq_iff)
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   144
apply(simp only: de_Morgan_conj)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   145
apply(simp only: Collect_disj_eq)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   146
apply(simp only: infinite_Un)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   147
apply(simp only: Collect_disj_eq)
1449
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   148
(* LAM case *)
1498
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   149
apply(rule_tac t="supp (LAM name lam)" and s="supp (Abs {atom name} lam)" in subst)
1449
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   150
apply(simp (no_asm) only: supp_def)
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   151
apply(simp only: lam_bp_perm)
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   152
apply(simp only: permute_ABS)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   153
apply(simp only: lam_bp_eq_iff)
1449
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   154
apply(simp only: Abs_eq_iff)
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   155
apply(simp only: insert_eqvt atom_eqvt empty_eqvt)
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   156
apply(simp only: alpha_gen)
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   157
apply(simp only: supp_eqvt[symmetric])
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   158
apply(simp only: eqvts)
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   159
apply(simp only: supp_Abs)
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   160
(* LET case *)
1498
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   161
apply(rule_tac t="supp (LET bp lam)" and s="supp (Abs (bi bp) lam) \<union> fv_bi bp" in subst)
1449
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   162
apply(simp (no_asm) only: supp_def)
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   163
apply(simp only: lam_bp_perm)
1460
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   164
apply(simp only: permute_ABS)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   165
apply(simp only: lam_bp_eq_iff)
1460
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   166
apply(simp only: eqvts)
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   167
apply(simp only: Abs_eq_iff)
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   168
apply(simp only: ex_simps)
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   169
apply(simp only: de_Morgan_conj)
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   170
apply(simp only: Collect_disj_eq)
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   171
apply(simp only: infinite_Un)
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   172
apply(simp only: Collect_disj_eq)
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1428
diff changeset
   173
apply(simp only: alpha_gen)
1449
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   174
apply(simp only: supp_eqvt[symmetric])
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   175
apply(simp only: eqvts)
1460
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   176
apply(blast)
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   177
apply(simp add: supp_Abs)
0fd03936dedb merge and proof of support for non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1457
diff changeset
   178
apply(blast)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   179
(* BP case *)
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   180
apply(simp only: supp_def)
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   181
apply(simp only: lam_bp_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   182
apply(simp only: lam_bp_eq_iff)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   183
apply(simp only: de_Morgan_conj)
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   184
apply(simp only: Collect_disj_eq)
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   185
apply(simp only: infinite_Un)
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   186
apply(simp only: Collect_disj_eq)
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   187
apply(simp only: supp_def[symmetric])
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   188
apply(simp only: supp_at_base)
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   189
apply(simp)
1449
b66d754bf1c2 proof for support when bn-function is present, but fb_function is empty
Christian Urban <urbanc@in.tum.de>
parents: 1439
diff changeset
   190
done
1367
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   191
1461
c79bcbe1983d added the final unfolded result
Christian Urban <urbanc@in.tum.de>
parents: 1460
diff changeset
   192
thm lam_bp_fv[simplified supp_fv(1)[symmetric] supp_fv(2)[THEN conjunct1, symmetric]]
c79bcbe1983d added the final unfolded result
Christian Urban <urbanc@in.tum.de>
parents: 1460
diff changeset
   193
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   194
ML {* val _ = recursive := true *}
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   195
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   196
nominal_datatype lam' =
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   197
  VAR' "name"
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   198
| APP' "lam'" "lam'"
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   199
| LAM' x::"name" t::"lam'"  bind x in t
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   200
| LET' bp::"bp'" t::"lam'"   bind "bi' bp" in t
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   201
and bp' =
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   202
  BP' "name" "lam'"
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   203
binder
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   204
  bi'::"bp' \<Rightarrow> atom set"
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   205
where
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   206
  "bi' (BP' x t) = {atom x}"
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   207
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   208
thm lam'_bp'_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   209
thm lam'_bp'_eq_iff[no_vars]
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   210
thm lam'_bp'_bn
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   211
thm lam'_bp'_perm
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   212
thm lam'_bp'_induct
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   213
thm lam'_bp'_inducts
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   214
thm lam'_bp'_distinct
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   215
ML {* Sign.of_sort @{theory} (@{typ lam'}, @{sort fs}) *}
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   216
1472
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   217
lemma supp_fv':
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   218
  shows "supp t = fv_lam' t" 
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   219
  and "supp bp = fv_bp' bp"
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   220
apply(induct t and bp rule: lam'_bp'_inducts)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   221
apply(simp_all add: lam'_bp'_fv)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   222
(* VAR case *)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   223
apply(simp only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   224
apply(simp only: lam'_bp'_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   225
apply(simp only: lam'_bp'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   226
apply(simp only: supp_def[symmetric])
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   227
apply(simp only: supp_at_base)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   228
(* APP case *)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   229
apply(simp only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   230
apply(simp only: lam'_bp'_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   231
apply(simp only: lam'_bp'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   232
apply(simp only: de_Morgan_conj)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   233
apply(simp only: Collect_disj_eq)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   234
apply(simp only: infinite_Un)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   235
apply(simp only: Collect_disj_eq)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   236
(* LAM case *)
1498
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   237
apply(rule_tac t="supp (LAM' name lam')" and s="supp (Abs {atom name} lam')" in subst)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   238
apply(simp (no_asm) only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   239
apply(simp only: lam'_bp'_perm)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   240
apply(simp only: permute_ABS)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   241
apply(simp only: lam'_bp'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   242
apply(simp only: Abs_eq_iff)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   243
apply(simp only: insert_eqvt atom_eqvt empty_eqvt)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   244
apply(simp only: alpha_gen)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   245
apply(simp only: supp_eqvt[symmetric])
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   246
apply(simp only: eqvts)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   247
apply(simp only: supp_Abs)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   248
(* LET case *)
1498
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   249
apply(rule_tac t="supp (LET' bp' lam')" and 
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   250
               s="supp (Abs (bi' bp') (bp', lam'))" in subst)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   251
apply(simp (no_asm) only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   252
apply(simp only: lam'_bp'_perm)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   253
apply(simp only: permute_ABS)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   254
apply(simp only: lam'_bp'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   255
apply(simp only: Abs_eq_iff)
1471
7fe643ad19e4 The recursive supp just has one equation too much.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1466
diff changeset
   256
apply(simp only: alpha_gen)
7fe643ad19e4 The recursive supp just has one equation too much.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1466
diff changeset
   257
apply(simp only: eqvts split_def fst_conv snd_conv)
7fe643ad19e4 The recursive supp just has one equation too much.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1466
diff changeset
   258
apply(simp only: eqvts[symmetric] supp_Pair)
7fe643ad19e4 The recursive supp just has one equation too much.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1466
diff changeset
   259
apply(simp only: eqvts Pair_eq)
1472
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   260
apply(simp add: supp_Abs supp_Pair)
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   261
apply blast
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   262
apply(simp only: supp_def)
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   263
apply(simp only: lam'_bp'_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   264
apply(simp only: lam'_bp'_eq_iff)
1472
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   265
apply(simp only: de_Morgan_conj)
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   266
apply(simp only: Collect_disj_eq)
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   267
apply(simp only: infinite_Un)
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   268
apply(simp only: Collect_disj_eq)
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   269
apply(simp only: supp_def[symmetric])
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   270
apply(simp only: supp_at_base supp_atom)
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   271
apply simp
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   272
done
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   273
1472
4fa5365cd871 Fix in alpha; support of the recursive Let works :)
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1471
diff changeset
   274
thm lam'_bp'_fv[simplified supp_fv'[symmetric]]
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   275
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   276
1261
853abc14c5c6 added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   277
text {* example 2 *}
853abc14c5c6 added IsaMakefile...but so far included only a test for the parser
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
   278
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   279
ML {* val _ = recursive := false  *}
1265
fc8f5897b00a first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents: 1261
diff changeset
   280
nominal_datatype trm' =
961
0f88e04eb486 Variable takes a 'name'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 954
diff changeset
   281
  Var "name"
1265
fc8f5897b00a first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents: 1261
diff changeset
   282
| App "trm'" "trm'"
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   283
| Lam x::"name" t::"trm'"          bind x in t
1265
fc8f5897b00a first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents: 1261
diff changeset
   284
| Let p::"pat'" "trm'" t::"trm'"   bind "f p" in t
fc8f5897b00a first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents: 1261
diff changeset
   285
and pat' =
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
  PN
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
| PS "name"
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   288
| PD "name" "name"
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
binder
1299
cbcd4997dac5 most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents: 1298
diff changeset
   290
  f::"pat' \<Rightarrow> atom set"
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   291
where
978
b44592adf235 Improper interface for datatype and function packages and proper interface lateron.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 973
diff changeset
   292
  "f PN = {}"
1380
dab8d99b37c1 added bn-information, but it is not yet ordered according to the dts
Christian Urban <urbanc@in.tum.de>
parents: 1378
diff changeset
   293
| "f (PD x y) = {atom x, atom y}"
1299
cbcd4997dac5 most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents: 1298
diff changeset
   294
| "f (PS x) = {atom x}"
1380
dab8d99b37c1 added bn-information, but it is not yet ordered according to the dts
Christian Urban <urbanc@in.tum.de>
parents: 1378
diff changeset
   295
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   296
thm trm'_pat'_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   297
thm trm'_pat'_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   298
thm trm'_pat'_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   299
thm trm'_pat'_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   300
thm trm'_pat'_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   301
thm trm'_pat'_distinct
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   302
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   303
lemma supp_fv_trm'_pat':
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   304
  shows "supp t = fv_trm' t" 
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   305
  and "supp bp = fv_pat' bp \<and> {a. infinite {b. \<not>alpha_f ((a \<rightleftharpoons> b) \<bullet> bp) bp}} = fv_f bp"
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   306
apply(induct t and bp rule: trm'_pat'_inducts)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   307
apply(simp_all add: trm'_pat'_fv)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   308
(* VAR case *)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   309
apply(simp only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   310
apply(simp only: trm'_pat'_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   311
apply(simp only: trm'_pat'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   312
apply(simp only: supp_def[symmetric])
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   313
apply(simp only: supp_at_base)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   314
(* APP case *)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   315
apply(simp only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   316
apply(simp only: trm'_pat'_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   317
apply(simp only: trm'_pat'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   318
apply(simp only: de_Morgan_conj)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   319
apply(simp only: Collect_disj_eq)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   320
apply(simp only: infinite_Un)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   321
apply(simp only: Collect_disj_eq)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   322
(* LAM case *)
1498
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   323
apply(rule_tac t="supp (Lam name trm')" and s="supp (Abs {atom name} trm')" in subst)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   324
apply(simp (no_asm) only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   325
apply(simp only: trm'_pat'_perm)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   326
apply(simp only: permute_ABS)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   327
apply(simp only: trm'_pat'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   328
apply(simp only: Abs_eq_iff)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   329
apply(simp only: insert_eqvt atom_eqvt empty_eqvt)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   330
apply(simp only: alpha_gen)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   331
apply(simp only: supp_eqvt[symmetric])
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   332
apply(simp only: eqvts)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   333
apply(simp only: supp_Abs)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   334
(* LET case *)
1498
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   335
apply(rule_tac t="supp (Let pat' trm'1 trm'2)" 
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   336
           and s="supp (Abs (f pat') trm'2) \<union> supp trm'1 \<union> fv_f pat'" in subst)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   337
apply(simp (no_asm) only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   338
apply(simp only: trm'_pat'_perm)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   339
apply(simp only: permute_ABS)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   340
apply(simp only: trm'_pat'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   341
apply(simp only: eqvts)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   342
apply(simp only: Abs_eq_iff)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   343
apply(simp only: ex_simps)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   344
apply(simp only: de_Morgan_conj)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   345
apply(simp only: Collect_disj_eq)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   346
apply(simp only: infinite_Un)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   347
apply(simp only: Collect_disj_eq)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   348
apply(simp only: alpha_gen)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   349
apply(simp only: supp_eqvt[symmetric])
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   350
apply(simp only: eqvts)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   351
apply(blast)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   352
apply(simp add: supp_Abs)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   353
apply(blast)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   354
(* PN case *)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   355
apply(simp only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   356
apply(simp only: trm'_pat'_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   357
apply(simp only: trm'_pat'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   358
apply(simp)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   359
(* PS case *)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   360
apply(simp only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   361
apply(simp only: trm'_pat'_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   362
apply(simp only: trm'_pat'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   363
apply(simp only: supp_def[symmetric])
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   364
apply(simp only: supp_at_base)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   365
apply(simp)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   366
(* PD case *)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   367
apply(simp only: supp_def)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   368
apply(simp only: trm'_pat'_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   369
apply(simp only: trm'_pat'_eq_iff)
1465
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   370
apply(simp only: de_Morgan_conj)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   371
apply(simp only: Collect_disj_eq)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   372
apply(simp only: infinite_Un)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   373
apply(simp only: Collect_disj_eq)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   374
apply(simp only: supp_def[symmetric])
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   375
apply(simp add: supp_at_base)
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   376
done
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   377
4de35639fef0 added another supp-proof for the non-recursive case
Christian Urban <urbanc@in.tum.de>
parents: 1461
diff changeset
   378
thm trm'_pat'_fv[simplified supp_fv_trm'_pat'(1)[symmetric] supp_fv_trm'_pat'(2)[THEN conjunct1, symmetric]]
1367
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   379
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   380
nominal_datatype trm0 =
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   381
  Var0 "name"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   382
| App0 "trm0" "trm0"
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   383
| Lam0 x::"name" t::"trm0"          bind x in t
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   384
| Let0 p::"pat0" "trm0" t::"trm0"   bind "f0 p" in t
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   385
and pat0 =
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   386
  PN0
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   387
| PS0 "name"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   388
| PD0 "pat0" "pat0"
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
binder
1299
cbcd4997dac5 most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents: 1298
diff changeset
   390
  f0::"pat0 \<Rightarrow> atom set"
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   391
where
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   392
  "f0 PN0 = {}"
1299
cbcd4997dac5 most tests work - the ones that do not I commented out
Christian Urban <urbanc@in.tum.de>
parents: 1298
diff changeset
   393
| "f0 (PS0 x) = {atom x}"
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   394
| "f0 (PD0 p1 p2) = (f0 p1) \<union> (f0 p2)"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   395
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   396
thm trm0_pat0_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   397
thm trm0_pat0_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   398
thm trm0_pat0_bn
1340
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   399
thm trm0_pat0_perm
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   400
thm trm0_pat0_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   401
thm trm0_pat0_distinct
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
text {* example type schemes *}
1285
e3ac56d3b7af added example from my phd
Christian Urban <urbanc@in.tum.de>
parents: 1284
diff changeset
   404
1302
d3101a5b9c4d Length fix for nested recursions.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1299
diff changeset
   405
nominal_datatype t =
1416
947e5f772a9c Lifting constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1398
diff changeset
   406
  VarTS "name"
947e5f772a9c Lifting constants.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1398
diff changeset
   407
| FunTS "t" "t"
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   408
and  tyS =
1341
c25f797c7e6e Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1340
diff changeset
   409
  All xs::"name set" ty::"t" bind xs in ty
954
c009d2535896 very rough example file for how nominal2 specification can be parsed
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   410
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   411
thm t_tyS_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   412
thm t_tyS_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   413
thm t_tyS_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   414
thm t_tyS_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   415
thm t_tyS_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   416
thm t_tyS_distinct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   417
1473
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   418
ML {* Sign.of_sort @{theory} (@{typ t}, @{sort fs}) *}
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   419
ML {* Sign.of_sort @{theory} (@{typ tyS}, @{sort fs}) *}
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   420
1478
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   421
lemma supports_subset:
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   422
  fixes S1 S2 :: "atom set"
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   423
  assumes  a: "S1 supports x"
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   424
  and      b: "S1 \<subseteq> S2"
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   425
  shows "S2 supports x"
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   426
  using a b
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   427
  by (auto simp add: supports_def)
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   428
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   429
lemma finite_fv_t_tyS:
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   430
  fixes T::"t"
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   431
  and   S::"tyS"
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   432
  shows "finite (fv_t T)" 
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   433
  and   "finite (fv_tyS S)"
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   434
apply(induct T and S rule: t_tyS_inducts)
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   435
apply(simp_all add: t_tyS_fv)
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   436
done
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   437
1473
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   438
lemma supp_fv_t_tyS:
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   439
  shows "supp T = fv_t T" 
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   440
  and   "supp S = fv_tyS S"
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   441
apply(induct T and S rule: t_tyS_inducts)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   442
apply(simp_all add: t_tyS_fv)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   443
(* VarTS case *)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   444
apply(simp only: supp_def)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   445
apply(simp only: t_tyS_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   446
apply(simp only: t_tyS_eq_iff)
1473
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   447
apply(simp only: supp_def[symmetric])
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   448
apply(simp only: supp_at_base)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   449
(* FunTS case *)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   450
apply(simp only: supp_def)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   451
apply(simp only: t_tyS_perm)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   452
apply(simp only: t_tyS_eq_iff)
1473
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   453
apply(simp only: de_Morgan_conj)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   454
apply(simp only: Collect_disj_eq)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   455
apply(simp only: infinite_Un)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   456
apply(simp only: Collect_disj_eq)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   457
(* All case *)
1498
2ff84b1f551f Rename bound variables + minor cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1496
diff changeset
   458
apply(rule_tac t="supp (All fun t)" and s="supp (Abs (atom ` fun) t)" in subst)
1473
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   459
apply(simp (no_asm) only: supp_def)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   460
apply(simp only: t_tyS_perm)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   461
apply(simp only: permute_ABS)
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   462
apply(simp only: t_tyS_eq_iff)
1473
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   463
apply(simp only: Abs_eq_iff)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   464
apply(simp only: insert_eqvt atom_eqvt empty_eqvt image_eqvt atom_eqvt_raw)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   465
apply(simp only: alpha_gen)
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   466
apply(simp only: supp_eqvt[symmetric])
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   467
apply(simp only: eqvts)
1478
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   468
apply(rule trans)
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   469
apply(rule finite_supp_Abs)
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   470
apply(simp add: finite_fv_t_tyS)
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   471
apply(simp)
1ea4ca823266 added proof of supp/fv for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1473
diff changeset
   472
done
1473
b4216d0e109a added partial proof of supp for type schemes
Christian Urban <urbanc@in.tum.de>
parents: 1472
diff changeset
   473
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   474
(* example 1 from Terms.thy *)
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   475
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   476
nominal_datatype trm1 =
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   477
  Vr1 "name"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   478
| Ap1 "trm1" "trm1"
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   479
| Lm1 x::"name" t::"trm1"       bind x in t
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   480
| Lt1 p::"bp1" "trm1" t::"trm1" bind "bv1 p" in t
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   481
and bp1 =
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   482
  BUnit1
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   483
| BV1 "name"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   484
| BP1 "bp1" "bp1"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   485
binder
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   486
  bv1
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   487
where
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   488
  "bv1 (BUnit1) = {}"
1392
baa67b07f436 parser produces ordered bn-fun information
Christian Urban <urbanc@in.tum.de>
parents: 1380
diff changeset
   489
| "bv1 (BP1 bp1 bp2) = (bv1 bp1) \<union> (bv1 bp2)"
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   490
| "bv1 (BV1 x) = {atom x}"
1392
baa67b07f436 parser produces ordered bn-fun information
Christian Urban <urbanc@in.tum.de>
parents: 1380
diff changeset
   491
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   492
thm trm1_bp1_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   493
thm trm1_bp1_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   494
thm trm1_bp1_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   495
thm trm1_bp1_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   496
thm trm1_bp1_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   497
thm trm1_bp1_distinct
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   498
1367
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   499
text {* example 3 from Terms.thy *}
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   500
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   501
nominal_datatype trm3 =
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   502
  Vr3 "name"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   503
| Ap3 "trm3" "trm3"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   504
| Lm3 x::"name" t::"trm3"        bind x in t
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   505
| Lt3 r::"rassigns3" t::"trm3"   bind "bv3 r" in t
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   506
and rassigns3 =
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   507
  ANil
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   508
| ACons "name" "trm3" "rassigns3"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   509
binder
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   510
  bv3
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   511
where
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   512
  "bv3 ANil = {}"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   513
| "bv3 (ACons x t as) = {atom x} \<union> (bv3 as)"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   514
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   515
thm trm3_rassigns3_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   516
thm trm3_rassigns3_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   517
thm trm3_rassigns3_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   518
thm trm3_rassigns3_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   519
thm trm3_rassigns3_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   520
thm trm3_rassigns3_distinct
1367
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   521
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   522
(* compat should be
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   523
compat (ANil) pi (PNil) \<equiv> TRue
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   524
compat (ACons x t ts) pi (ACons x' t' ts') \<equiv> pi o x = x' \<and> alpha t t' \<and> compat ts pi ts'
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   525
*)
9bbf56cdeb88 added compat definitions to some examples
Christian Urban <urbanc@in.tum.de>
parents: 1365
diff changeset
   526
1251
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   527
(* example 5 from Terms.thy *)
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   528
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   529
nominal_datatype trm5 =
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   530
  Vr5 "name"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   531
| Ap5 "trm5" "trm5"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   532
| Lt5 l::"lts" t::"trm5"  bind "bv5 l" in t
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   533
and lts =
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   534
  Lnil
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   535
| Lcons "name" "trm5" "lts"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   536
binder
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   537
  bv5
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   538
where
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   539
  "bv5 Lnil = {}"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   540
| "bv5 (Lcons n t ltl) = {atom n} \<union> (bv5 ltl)"
11b8798dea5d parsing and definition of raw datatype and bv-function work (not very beautiful)
Christian Urban <urbanc@in.tum.de>
parents: 1232
diff changeset
   541
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   542
thm trm5_lts_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   543
thm trm5_lts_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   544
thm trm5_lts_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   545
thm trm5_lts_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   546
thm trm5_lts_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   547
thm trm5_lts_distinct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   548
1285
e3ac56d3b7af added example from my phd
Christian Urban <urbanc@in.tum.de>
parents: 1284
diff changeset
   549
(* example from my PHD *)
e3ac56d3b7af added example from my phd
Christian Urban <urbanc@in.tum.de>
parents: 1284
diff changeset
   550
e3ac56d3b7af added example from my phd
Christian Urban <urbanc@in.tum.de>
parents: 1284
diff changeset
   551
atom_decl coname
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   552
1341
c25f797c7e6e Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1340
diff changeset
   553
nominal_datatype phd =
1290
a7e7ffb7f362 modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents: 1287
diff changeset
   554
   Ax "name" "coname"
a7e7ffb7f362 modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents: 1287
diff changeset
   555
|  Cut n::"coname" t1::"phd" c::"coname" t2::"phd"              bind n in t1, bind c in t2
a7e7ffb7f362 modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents: 1287
diff changeset
   556
|  AndR c1::"coname" t1::"phd" c2::"coname" t2::"phd" "coname"  bind c1 in t1, bind c2 in t2
a7e7ffb7f362 modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents: 1287
diff changeset
   557
|  AndL1 n::"name" t::"phd" "name"                              bind n in t
a7e7ffb7f362 modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents: 1287
diff changeset
   558
|  AndL2 n::"name" t::"phd" "name"                              bind n in t
a7e7ffb7f362 modified for new binding format - hope it is the intended one
Christian Urban <urbanc@in.tum.de>
parents: 1287
diff changeset
   559
|  ImpL c::"coname" t1::"phd" n::"name" t2::"phd" "name"        bind c in t1, bind n in t2
1319
d793ce9cd06f potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents: 1313
diff changeset
   560
|  ImpR c::"coname" n::"name" t::"phd" "coname"                 bind n in t, bind c in t
d793ce9cd06f potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents: 1313
diff changeset
   561
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   562
thm phd_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   563
thm phd_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   564
thm phd_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   565
thm phd_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   566
thm phd_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   567
thm phd_distinct
1285
e3ac56d3b7af added example from my phd
Christian Urban <urbanc@in.tum.de>
parents: 1284
diff changeset
   568
e3ac56d3b7af added example from my phd
Christian Urban <urbanc@in.tum.de>
parents: 1284
diff changeset
   569
(* example form Leroy 96 about modules; OTT *)
1284
212f3ab40cc2 streamlined parser
Christian Urban <urbanc@in.tum.de>
parents: 1283
diff changeset
   570
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   571
nominal_datatype mexp =
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   572
  Acc "path"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   573
| Stru "body"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   574
| Funct x::"name" "sexp" m::"mexp"    bind x in m
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   575
| FApp "mexp" "path"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   576
| Ascr "mexp" "sexp"
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   577
and body =
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   578
  Empty
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   579
| Seq c::defn d::"body"     bind "cbinders c" in d
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   580
and defn =
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   581
  Type "name" "tyty"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   582
| Dty "name"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   583
| DStru "name" "mexp"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   584
| Val "name" "trmtrm"
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   585
and sexp =
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   586
  Sig sbody
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   587
| SFunc "name" "sexp" "sexp"
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   588
and sbody =
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   589
  SEmpty
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   590
| SSeq C::spec D::sbody    bind "Cbinders C" in D
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   591
and spec =
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   592
  Type1 "name"
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   593
| Type2 "name" "tyty"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   594
| SStru "name" "sexp"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   595
| SVal "name" "tyty"
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   596
and tyty =
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   597
  Tyref1 "name"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   598
| Tyref2 "path" "tyty"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   599
| Fun "tyty" "tyty"
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   600
and path =
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   601
  Sref1 "name"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   602
| Sref2 "path" "name"
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   603
and trmtrm =
1296
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   604
  Tref1 "name"
790940e90db2 some tuning
Christian Urban <urbanc@in.tum.de>
parents: 1295
diff changeset
   605
| Tref2 "path" "name"
1340
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   606
| Lam' v::"name" "tyty" M::"trmtrm"  bind v in M
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   607
| App' "trmtrm" "trmtrm"
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   608
| Let' "body" "trmtrm"
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   609
binder
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   610
    cbinders :: "defn \<Rightarrow> atom set"
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   611
and Cbinders :: "spec \<Rightarrow> atom set"
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   612
where
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   613
  "cbinders (Type t T) = {atom t}"
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   614
| "cbinders (Dty t) = {atom t}"
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   615
| "cbinders (DStru x s) = {atom x}"
1396
08294f4d6c08 Linked parser to fv and alpha.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1392
diff changeset
   616
| "cbinders (Val v M) = {atom v}"
1272
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   617
| "Cbinders (Type1 t) = {atom t}"
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   618
| "Cbinders (Type2 t T) = {atom t}"
6d140b2c751f added ott-example about Leroy96
Christian Urban <urbanc@in.tum.de>
parents: 1265
diff changeset
   619
| "Cbinders (SStru x S) = {atom x}"
1396
08294f4d6c08 Linked parser to fv and alpha.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1392
diff changeset
   620
| "Cbinders (SVal v T) = {atom v}"
1265
fc8f5897b00a first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents: 1261
diff changeset
   621
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   622
thm mexp_body_defn_sexp_sbody_spec_tyty_path_trmtrm_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   623
thm mexp_body_defn_sexp_sbody_spec_tyty_path_trmtrm_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   624
thm mexp_body_defn_sexp_sbody_spec_tyty_path_trmtrm_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   625
thm mexp_body_defn_sexp_sbody_spec_tyty_path_trmtrm_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   626
thm mexp_body_defn_sexp_sbody_spec_tyty_path_trmtrm_induct
1447
378b8c791de8 derive "inducts" from "induct" instead of lifting again is much faster.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1445
diff changeset
   627
thm mexp_body_defn_sexp_sbody_spec_tyty_path_trmtrm_inducts
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   628
thm mexp_body_defn_sexp_sbody_spec_tyty_path_trmtrm_distinct
1392
baa67b07f436 parser produces ordered bn-fun information
Christian Urban <urbanc@in.tum.de>
parents: 1380
diff changeset
   629
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   630
(* example 3 from Peter Sewell's bestiary *)
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   631
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   632
nominal_datatype exp =
1340
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   633
  VarP "name"
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   634
| AppP "exp" "exp"
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   635
| LamP x::"name" e::"exp" bind x in e
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   636
| LetP x::"name" p::"pat3" e1::"exp" e2::"exp" bind x in e2, bind "bp'' p" in e1
1378
5c6c950812b1 All examples should work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1368
diff changeset
   637
and pat3 =
1319
d793ce9cd06f potential problem with the phd-example, where two permutations are generated, but only one is used
Christian Urban <urbanc@in.tum.de>
parents: 1313
diff changeset
   638
  PVar "name"
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   639
| PUnit
1378
5c6c950812b1 All examples should work.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1368
diff changeset
   640
| PPair "pat3" "pat3"
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   641
binder
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   642
  bp'' :: "pat3 \<Rightarrow> atom set"
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   643
where
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   644
  "bp'' (PVar x) = {atom x}"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   645
| "bp'' (PUnit) = {}"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   646
| "bp'' (PPair p1 p2) = bp'' p1 \<union> bp'' p2"
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   647
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   648
thm exp_pat3_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   649
thm exp_pat3_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   650
thm exp_pat3_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   651
thm exp_pat3_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   652
thm exp_pat3_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   653
thm exp_pat3_distinct
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   654
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   655
(* example 6 from Peter Sewell's bestiary *)
1341
c25f797c7e6e Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1340
diff changeset
   656
nominal_datatype exp6 =
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   657
  EVar name
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   658
| EPair exp6 exp6
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   659
| ELetRec x::name p::pat6 e1::exp6 e2::exp6 bind x in e1, bind x in e2, bind "bp6 p" in e1
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   660
and pat6 =
1340
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   661
  PVar' name
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   662
| PUnit'
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   663
| PPair' pat6 pat6
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   664
binder
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   665
  bp6 :: "pat6 \<Rightarrow> atom set"
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   666
where
1340
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   667
  "bp6 (PVar' x) = {atom x}"
f201eb6acafc Lift BV,FV,Permutations and injection :).
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1338
diff changeset
   668
| "bp6 (PUnit') = {}"
1341
c25f797c7e6e Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1340
diff changeset
   669
| "bp6 (PPair' p1 p2) = bp6 p1 \<union> bp6 p2"
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   670
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   671
thm exp6_pat6_fv
1496
fd483d8f486b Prove pseudo-inject (eq-iff) on the exported level and rename appropriately.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1486
diff changeset
   672
thm exp6_pat6_eq_iff
1418
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   673
thm exp6_pat6_bn
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   674
thm exp6_pat6_perm
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   675
thm exp6_pat6_induct
632b08744613 With the 4 cheats, all examples fully lift.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1416
diff changeset
   676
thm exp6_pat6_distinct
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   677
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   678
(* THE REST ARE NOT SUPPOSED TO WORK YET *)
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   679
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   680
(* example 7 from Peter Sewell's bestiary *)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   681
(* dest_Const raised
1341
c25f797c7e6e Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1340
diff changeset
   682
nominal_datatype exp7 =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   683
  EVar' name
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   684
| EUnit'
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   685
| EPair' exp7 exp7
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   686
| ELetRec' l::lrbs e::exp7 bind "b7s l" in e, bind "b7s l" in l
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   687
and lrb =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   688
  Assign' name exp7
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   689
and lrbs =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   690
  Single' lrb
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   691
| More' lrb lrbs
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   692
binder
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   693
  b7 :: "lrb \<Rightarrow> atom set" and
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   694
  b7s :: "lrbs \<Rightarrow> atom set"
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   695
where
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   696
  "b7 (Assign x e) = {atom x}"
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   697
| "b7s (Single a) = b7 a"
1341
c25f797c7e6e Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1340
diff changeset
   698
| "b7s (More a as) = (b7 a) \<union> (b7s as)"
1361
1e811e3424f3 With restricted_nominal=1, exp7 and exp8 work. Not sure about proving bn_rsp there.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1355
diff changeset
   699
thm alpha_exp7_raw_alpha_lrb_raw_alpha_lrbs_raw.intros
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   700
*)
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   701
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   702
(* example 8 from Peter Sewell's bestiary *)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   703
(*
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   704
*** fv_bn: recursive argument, but wrong datatype.
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   705
*** At command "nominal_datatype".
1341
c25f797c7e6e Added lifting of pseudo-injectivity, commented out the code again and enabled the weird examples.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1340
diff changeset
   706
nominal_datatype exp8 =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   707
  EVar' name
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   708
| EUnit'
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   709
| EPair' exp8 exp8
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   710
| ELetRec' l::lrbs8 e::exp8 bind "b_lrbs8 l" in e, bind "b_lrbs8 l" in l
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   711
and fnclause =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   712
  K' x::name p::pat8 e::exp8 bind "b_pat p" in e
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   713
and fnclauses =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   714
  S' fnclause
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   715
| ORs' fnclause fnclauses
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   716
and lrb8 =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   717
  Clause' fnclauses
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   718
and lrbs8 =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   719
  Single' lrb8
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   720
| More' lrb8 lrbs8
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   721
and pat8 =
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   722
  PVar'' name
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   723
| PUnit''
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   724
| PPair'' pat8 pat8
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   725
binder
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   726
  b_lrbs8 :: "lrbs8 \<Rightarrow> atom set" and
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   727
  b_pat :: "pat8 \<Rightarrow> atom set" and
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   728
  b_fnclauses :: "fnclauses \<Rightarrow> atom set" and
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   729
  b_fnclause :: "fnclause \<Rightarrow> atom set" and
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   730
  b_lrb8 :: "lrb8 \<Rightarrow> atom set"
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   731
where
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   732
  "b_lrbs8 (Single' l) = b_lrb8 l"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   733
| "b_lrbs8 (More' l ls) = b_lrb8 l \<union> b_lrbs8 ls"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   734
| "b_pat (PVar'' x) = {atom x}"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   735
| "b_pat (PUnit'') = {}"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   736
| "b_pat (PPair'' p1 p2) = b_pat p1 \<union> b_pat p2"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   737
| "b_fnclauses (S' fc) = (b_fnclause fc)"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   738
| "b_fnclauses (ORs' fc fcs) = (b_fnclause fc) \<union> (b_fnclauses fcs)"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   739
| "b_lrb8 (Clause' fcs) = (b_fnclauses fcs)"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   740
| "b_fnclause (K' x pat exp8) = {atom x}"
1361
1e811e3424f3 With restricted_nominal=1, exp7 and exp8 work. Not sure about proving bn_rsp there.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1355
diff changeset
   741
thm alpha_exp8_raw_alpha_fnclause_raw_alpha_fnclauses_raw_alpha_lrb8_raw_alpha_lrbs8_raw_alpha_pat8_raw.intros
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   742
*)
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   743
(* example 4 from Terms.thy *)
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   744
(* fv_eqvt does not work, we need to repaire defined permute functions
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   745
   defined fv and defined alpha... *)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   746
(* lists-datastructure does not work yet
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   747
nominal_datatype trm4 =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   748
  Vr4 "name"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   749
| Ap4 "trm4" "trm4 list"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   750
| Lm4 x::"name" t::"trm4"  bind x in t
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   751
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   752
thm alpha_trm4_raw_alpha_trm4_raw_list.intros[no_vars]
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   753
thm fv_trm4_raw_fv_trm4_raw_list.simps[no_vars]
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   754
*)
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   755
(* core haskell *)
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   756
atom_decl var
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   757
atom_decl tvar
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   758
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   759
(* there are types, coercion types and regular types *)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   760
(* list-data-structure
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   761
nominal_datatype tkind =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   762
  KStar
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   763
| KFun "tkind" "tkind"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   764
and ckind =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   765
  CKEq "ty" "ty"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   766
and ty =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   767
  TVar "tvar"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   768
| TC "string"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   769
| TApp "ty" "ty"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   770
| TFun "string" "ty list"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   771
| TAll tv::"tvar" "tkind" T::"ty"  bind tv in T
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   772
| TEq "ty" "ty" "ty"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   773
and co =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   774
  CC "string"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   775
| CApp "co" "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   776
| CFun "string" "co list"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   777
| CAll tv::"tvar" "ckind" C::"co"  bind tv in C
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   778
| CEq "co" "co" "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   779
| CSym "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   780
| CCir "co" "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   781
| CLeft "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   782
| CRight "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   783
| CSim "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   784
| CRightc "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   785
| CLeftc "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   786
| CCoe "co" "co"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   787
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   788
abbreviation
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   789
  "atoms A \<equiv> atom ` A"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   790
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   791
nominal_datatype trm =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   792
  Var "var"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   793
| C "string"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   794
| LAM tv::"tvar" "kind" t::"trm"   bind tv in t
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   795
| APP "trm" "ty"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   796
| Lam v::"var" "ty" t::"trm"       bind v in t
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   797
| App "trm" "trm"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   798
| Let x::"var" "ty" "trm" t::"trm" bind x in t
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   799
| Case "trm" "assoc list"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   800
| Cast "trm" "ty"                   --"ty is supposed to be a coercion type only"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   801
and assoc =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   802
  A p::"pat" t::"trm" bind "bv p" in t
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   803
and pat =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   804
  K "string" "(tvar \<times> kind) list" "(var \<times> ty) list"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   805
binder
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   806
 bv :: "pat \<Rightarrow> atom set"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   807
where
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   808
 "bv (K s ts vs) = (atoms (set (map fst ts))) \<union> (atoms (set (map fst vs)))"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   809
*)
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   810
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   811
text {* weirdo example from Peter Sewell's bestiary *}
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   812
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   813
nominal_datatype weird =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   814
  WBind x::"name" y::"name" p1::"weird" p2::"weird" p3::"weird"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   815
    bind x in p1, bind x in p2, bind y in p2, bind y in p3
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   816
| WV "name"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   817
| WP "weird" "weird"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   818
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   819
thm permute_weird_raw.simps[no_vars]
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   820
thm alpha_weird_raw.intros[no_vars]
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   821
thm fv_weird_raw.simps[no_vars]
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   822
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   823
(* example 6 from Terms.thy *)
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   824
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   825
(* BV is not respectful, needs to fail*)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   826
(*
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   827
nominal_datatype trm6 =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   828
  Vr6 "name"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   829
| Lm6 x::"name" t::"trm6"         bind x in t
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   830
| Lt6 left::"trm6" right::"trm6"  bind "bv6 left" in right
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   831
binder
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   832
  bv6
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   833
where
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   834
  "bv6 (Vr6 n) = {}"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   835
| "bv6 (Lm6 n t) = {atom n} \<union> bv6 t"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   836
| "bv6 (Lt6 l r) = bv6 l \<union> bv6 r"
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   837
*)
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   838
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   839
(* example 7 from Terms.thy *)
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   840
(* BV is not respectful, needs to fail*)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   841
(*
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   842
nominal_datatype trm7 =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   843
  Vr7 "name"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   844
| Lm7 l::"name" r::"trm7"   bind l in r
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   845
| Lt7 l::"trm7" r::"trm7"   bind "bv7 l" in r
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   846
binder
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   847
  bv7
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   848
where
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   849
  "bv7 (Vr7 n) = {atom n}"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   850
| "bv7 (Lm7 n t) = bv7 t - {atom n}"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   851
| "bv7 (Lt7 l r) = bv7 l \<union> bv7 r"
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   852
*)
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   853
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   854
(* example 8 from Terms.thy *)
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   855
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   856
(* Binding in a term under a bn, needs to fail *)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   857
(*
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   858
nominal_datatype foo8 =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   859
  Foo0 "name"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   860
| Foo1 b::"bar8" f::"foo8" bind "bv8 b" in f --"check fo error if this is called foo"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   861
and bar8 =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   862
  Bar0 "name"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   863
| Bar1 "name" s::"name" b::"bar8" bind s in b
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   864
binder
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   865
  bv8
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   866
where
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   867
  "bv8 (Bar0 x) = {}"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   868
| "bv8 (Bar1 v x b) = {atom v}"
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   869
*)
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   870
(* example 9 from Terms.thy *)
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   871
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   872
(* BV is not respectful, needs to fail*)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   873
(*
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   874
nominal_datatype lam9 =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   875
  Var9 "name"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   876
| Lam9 n::"name" l::"lam9" bind n in l
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   877
and bla9 =
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   878
  Bla9 f::"lam9" s::"lam9" bind "bv9 f" in s
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   879
binder
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   880
  bv9
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   881
where
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   882
  "bv9 (Var9 x) = {}"
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   883
| "bv9 (Lam9 x b) = {atom x}"
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   884
*)
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   885
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   886
(* Type schemes with separate datatypes *)
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   887
nominal_datatype T =
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   888
  TVar "name"
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   889
| TFun "T" "T"
1398
1f3c01345c9e Reordered examples in Test.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1396
diff changeset
   890
1466
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   891
(* PROBLEM: 
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   892
*** exception Datatype raised 
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   893
*** (line 218 of "/usr/local/src/Isabelle_16-Mar-2010/src/HOL/Tools/Datatype/datatype_aux.ML")
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   894
*** At command "nominal_datatype".
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   895
nominal_datatype TyS =
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   896
  TAll xs::"name list" ty::"T" bind xs in ty
d18defacda25 commented out examples that should not work; but for example type-scheme example should work
Christian Urban <urbanc@in.tum.de>
parents: 1465
diff changeset
   897
*)
1312
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   898
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   899
(* example 9 from Peter Sewell's bestiary *)
b0eae8c93314 added some more examples from Peter Sewell's bestiary
Christian Urban <urbanc@in.tum.de>
parents: 1304
diff changeset
   900
(* run out of steam at the moment *)
1265
fc8f5897b00a first attempt to make sense out of the core-haskell definition
Christian Urban <urbanc@in.tum.de>
parents: 1261
diff changeset
   901
961
0f88e04eb486 Variable takes a 'name'.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 954
diff changeset
   902
end
1223
160343d86a6f "raw"-ified the term-constructors and types given in the specification
Christian Urban <urbanc@in.tum.de>
parents: 1194
diff changeset
   903
160343d86a6f "raw"-ified the term-constructors and types given in the specification
Christian Urban <urbanc@in.tum.de>
parents: 1194
diff changeset
   904
1228
c179ad9d2446 declarartion of the raw datatype already works; raw binding functions throw an exception about mutual recursive types
Christian Urban <urbanc@in.tum.de>
parents: 1223
diff changeset
   905