Nominal/Ex/ExLetRec.thy
author Christian Urban <urbanc@in.tum.de>
Tue, 04 May 2010 14:38:07 +0100
changeset 2048 20be95dce643
parent 2041 3842464ee03b
child 2067 ace7775cbd04
permissions -rw-r--r--
increased step counter so that all steps go through
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1604
5ab97f43ec24 More modification needed for compilation
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1603
diff changeset
     1
theory ExLetRec
2041
3842464ee03b Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
     2
imports "../NewParser"
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
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
     5
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
text {* example 3 or example 5 from Terms.thy *}
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
atom_decl name
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
nominal_datatype trm =
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
  Vr "name"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
| Ap "trm" "trm"
2041
3842464ee03b Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    13
| Lm x::"name" t::"trm"  bind_set x in t
3842464ee03b Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    14
| 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
    15
and lts =
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
  Lnil
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
| Lcons "name" "trm" "lts"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
binder
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
  bn
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
where
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    21
  "bn Lnil = []"
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    22
| "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
    23
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
thm trm_lts.fv
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
thm trm_lts.eq_iff
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
thm trm_lts.bn
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
thm trm_lts.perm
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
thm trm_lts.induct
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
thm trm_lts.distinct
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    30
thm trm_lts.supp
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
thm trm_lts.fv[simplified trm_lts.supp]
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
(* why is this not in HOL simpset? *)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
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
    35
by auto
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
lemma lets_bla:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
  "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))"
2041
3842464ee03b Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    39
  by (simp add: trm_lts.eq_iff alphas2 set_sub supp_at_base)
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
lemma lets_ok:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
  "(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
    43
  apply (simp add: trm_lts.eq_iff)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
2041
3842464ee03b Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    45
  apply (simp_all add: alphas2 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
    46
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
lemma lets_ok3:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
  "x \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
   (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
    51
   (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
    52
  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
    53
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    55
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
lemma lets_not_ok1:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
  "x \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
   (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
    59
   (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
    60
  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
    61
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
lemma lets_nok:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
  "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
    65
   (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
    66
   (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
    67
  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
    68
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    70
lemma lets_ok4:
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    71
  "(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
    72
   (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
    73
  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
    74
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    75
  apply (simp add: atom_eqvt fresh_star_def)
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    76
  done
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78
end
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    80
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81