Nominal/Ex/LetRec2.thy
author Christian Urban <urbanc@in.tum.de>
Tue, 03 May 2011 15:39:30 +0100
changeset 2779 3c769bf10e63
parent 2561 7926f1cb45eb
child 2950 0911cb7bf696
permissions -rw-r--r--
added two mutual recursive inductive definitions
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 =
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
  Vr "name"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
| Ap "trm" "trm"
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    10
| Lm x::"name" t::"trm"  bind (set) x in t
2041
3842464ee03b Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    11
| Lt a::"lts" t::"trm"   bind "bn a" in a t
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
and lts =
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
  Lnil
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
| Lcons "name" "trm" "lts"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
binder
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
  bn
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
where
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    18
  "bn Lnil = []"
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    19
| "bn (Lcons x t l) = (atom x) # (bn l)"
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    21
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
    22
thm trm_lts.fv_defs
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    23
thm trm_lts.eq_iff
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
    24
thm trm_lts.bn_defs
abafea9b39bb corrected bug with fv-function generation (that was the problem with recursive binders)
Christian Urban <urbanc@in.tum.de>
parents: 2436
diff changeset
    25
thm trm_lts.perm_simps
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
thm trm_lts.induct
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
thm trm_lts.distinct
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2067
diff changeset
    29
2561
7926f1cb45eb respectfulness for permute_bn functions
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    30
7926f1cb45eb respectfulness for permute_bn functions
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    31
section {* Tests *}
7926f1cb45eb respectfulness for permute_bn functions
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    32
7926f1cb45eb respectfulness for permute_bn functions
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    33
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
(* 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
    35
(*
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
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
    37
by auto
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
lemma lets_bla:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
  "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
    41
  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
    42
  done
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
lemma lets_ok:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
  "(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
    46
  apply (simp add: trm_lts.eq_iff)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
  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
    48
  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
    49
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
lemma lets_ok3:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
  "x \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
   (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
    54
   (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
    55
  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
    56
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
lemma lets_not_ok1:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
  "x \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
   (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
    62
   (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
    63
  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
    64
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
lemma lets_nok:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
  "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
    68
   (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
    69
   (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
    70
  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
    71
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    73
lemma lets_ok4:
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    74
  "(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
    75
   (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
    76
  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
    77
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    78
  apply (simp add: atom_eqvt fresh_star_def)
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    79
  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
    80
*)
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
end
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    83
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84