Nominal/Ex/ExLetRec.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Tue, 18 May 2010 15:58:52 +0200
changeset 2157 a1d27083e688
parent 2120 2786ff1df475
permissions -rw-r--r--
subst experiments
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
2091
1f38489f1cf0 ExLetRec
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2082
diff changeset
    10
ML {* val _ = cheat_equivp := true *}
1f38489f1cf0 ExLetRec
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2082
diff changeset
    11
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
nominal_datatype trm =
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
  Vr "name"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
| Ap "trm" "trm"
2041
3842464ee03b Move 2 more to NewParser
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1773
diff changeset
    15
| 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
    16
| 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
    17
and lts =
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
  Lnil
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
| Lcons "name" "trm" "lts"
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
binder
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
  bn
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
where
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    23
  "bn Lnil = []"
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    24
| "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
    25
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
thm trm_lts.fv
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
thm trm_lts.eq_iff
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
thm trm_lts.bn
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
thm trm_lts.perm
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
thm trm_lts.induct
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
thm trm_lts.distinct
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    32
thm trm_lts.supp
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
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
    34
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2067
diff changeset
    35
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
(* why is this not in HOL simpset? *)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
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
    38
by auto
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
lemma lets_bla:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
  "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
    42
  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
    43
  done
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
lemma lets_ok:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
  "(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
    47
  apply (simp add: trm_lts.eq_iff)
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    48
  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
    49
  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
    50
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
lemma lets_ok3:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
  "x \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
   (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
    55
   (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
    56
  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
    57
  done
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
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
lemma lets_not_ok1:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
  "x \<noteq> y \<Longrightarrow>
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
   (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
    63
   (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
    64
  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
    65
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
lemma lets_nok:
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
  "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
    69
   (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
    70
   (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
    71
  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
    72
  done
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    74
lemma lets_ok4:
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    75
  "(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
    76
   (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
    77
  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
    78
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    79
  apply (simp add: atom_eqvt fresh_star_def)
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1674
diff changeset
    80
  done
1603
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    81
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    82
end
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
2b367c80c0d7 Moved let properties from Term5 to ExLetRec.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    85