Nominal/Ex/LetRec2.thy
author Christian Urban <urbanc@in.tum.de>
Sat, 26 Nov 2011 09:48:14 +0000
changeset 3053 324b148fc6b5
parent 3029 6fd3fc3254ee
child 3065 51ef8a3cb6ef
child 3071 11f6a561eb4b
permissions -rw-r--r--
used simproc-antiquotation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
     1
theory LetRec2
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2438
diff changeset
     2
imports "../Nominal2"
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
atom_decl name
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
nominal_datatype trm =
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
     8
  Var "name"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
     9
| App "trm" "trm"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    10
| Lam x::"name" t::"trm"  binds x in t
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    11
| Let as::"assn" t::"trm"   binds "bn as" in t
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    12
| Let_rec as::"assn" t::"trm"   binds "bn as" in as t
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    13
and assn =
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    14
  ANil
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    15
| ACons "name" "trm" "assn"
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
binder
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
  bn
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
where
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    19
  "bn (ANil) = []"
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    20
| "bn (ACons x t as) = (atom x) # (bn as)"
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    22
thm trm_assn.eq_iff
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    23
thm trm_assn.supp
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    24
3029
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    25
thm trm_assn.fv_defs
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    26
thm trm_assn.eq_iff
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    27
thm trm_assn.bn_defs
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    28
thm trm_assn.perm_simps
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    29
thm trm_assn.induct
6fd3fc3254ee deleted PNil
Christian Urban <urbanc@in.tum.de>
parents: 2950
diff changeset
    30
thm trm_assn.distinct
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2067
diff changeset
    32
2561
7926f1cb45eb respectfulness for permute_bn functions
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    33
7926f1cb45eb respectfulness for permute_bn functions
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    34
section {* Tests *}
7926f1cb45eb respectfulness for permute_bn functions
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    35
7926f1cb45eb respectfulness for permute_bn functions
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    36
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
(* why is this not in HOL simpset? *)
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    38
(*
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
lemma set_sub: "{a, b} - {b} = {a} - {b}"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
by auto
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
lemma lets_bla:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
  "x \<noteq> z \<Longrightarrow> y \<noteq> z \<Longrightarrow> x \<noteq> y \<Longrightarrow>(Lt (Lcons x (Vr y) Lnil) (Vr x)) \<noteq> (Lt (Lcons x (Vr z) Lnil) (Vr x))"
2101
e417be53916e fixed a problem with non-existant alphas2
Christian Urban <urbanc@in.tum.de>
parents: 2094
diff changeset
    44
  apply (auto simp add: trm_lts.eq_iff alphas set_sub supp_at_base)
e417be53916e fixed a problem with non-existant alphas2
Christian Urban <urbanc@in.tum.de>
parents: 2094
diff changeset
    45
  done
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
lemma lets_ok:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
  "(Lt (Lcons x (Vr x) Lnil) (Vr x)) = (Lt (Lcons y (Vr y) Lnil) (Vr y))"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
  apply (simp add: trm_lts.eq_iff)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
2101
e417be53916e fixed a problem with non-existant alphas2
Christian Urban <urbanc@in.tum.de>
parents: 2094
diff changeset
    51
  apply (simp_all add: alphas fresh_star_def eqvts supp_at_base)
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
lemma lets_ok3:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
  "x \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
   (Lt (Lcons x (Ap (Vr y) (Vr x)) (Lcons y (Vr y) Lnil)) (Ap (Vr x) (Vr y))) \<noteq>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
   (Lt (Lcons y (Ap (Vr x) (Vr y)) (Lcons x (Vr x) Lnil)) (Ap (Vr x) (Vr y)))"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
  apply (simp add: alphas trm_lts.eq_iff)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
lemma lets_not_ok1:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
  "x \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
   (Lt (Lcons x (Vr x) (Lcons y (Vr y) Lnil)) (Ap (Vr x) (Vr y))) \<noteq>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
   (Lt (Lcons y (Vr x) (Lcons x (Vr y) Lnil)) (Ap (Vr x) (Vr y)))"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
  apply (simp add: alphas trm_lts.eq_iff)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
lemma lets_nok:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
  "x \<noteq> y \<Longrightarrow> x \<noteq> z \<Longrightarrow> z \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    71
   (Lt (Lcons x (Ap (Vr z) (Vr z)) (Lcons y (Vr z) Lnil)) (Ap (Vr x) (Vr y))) \<noteq>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
   (Lt (Lcons y (Vr z) (Lcons x (Ap (Vr z) (Vr z)) Lnil)) (Ap (Vr x) (Vr y)))"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
  apply (simp add: alphas trm_lts.eq_iff fresh_star_def)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    75
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    76
lemma lets_ok4:
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    77
  "(Lt (Lcons x (Ap (Vr y) (Vr x)) (Lcons y (Vr y) Lnil)) (Ap (Vr x) (Vr y))) =
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    78
   (Lt (Lcons y (Ap (Vr x) (Vr y)) (Lcons x (Vr x) Lnil)) (Ap (Vr y) (Vr x)))"
2041
3842464ee03b Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    79
  apply (simp add: alphas trm_lts.eq_iff supp_at_base)
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    80
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    81
  apply (simp add: atom_eqvt fresh_star_def)
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    82
  done
2438
abafea9b39bb corrected bug with fv-function generation (that was the problem with recursive binders)
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    83
*)
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
end
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    85
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    86
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87