Nominal/ExLet.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Fri, 26 Mar 2010 17:01:22 +0100
changeset 1658 aacab5f67333
parent 1653 a2142526bb01
child 1685 721d92623c9d
permissions -rw-r--r--
Fixed renamings.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory ExLet
1651
f731e9aff866 Proper bn_rsp, for bn functions calling each other.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1650
diff changeset
     2
imports "Parser" "../Attic/Prove"
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
text {* example 3 or example 5 from Terms.thy *}
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
atom_decl name
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
ML {* val _ = recursive := false  *}
1650
4b949985cf57 Gathering things to prove by induction together; removed cheat_bn_eqvt.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1644
diff changeset
    10
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
nominal_datatype trm =
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
  Vr "name"
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
| Ap "trm" "trm"
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
| Lm x::"name" t::"trm"  bind x in t
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
    15
| Lt a::"lts" t::"trm"   bind "bn a" in t
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
and lts =
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
    17
  Lnil
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
    18
| Lcons "name" "trm" "lts"
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
binder
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
  bn
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
where
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
    22
  "bn Lnil = {}"
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
    23
| "bn (Lcons x t l) = {atom x} \<union> (bn l)"
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
thm trm_lts.fv
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
thm trm_lts.eq_iff
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
thm trm_lts.bn
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
thm trm_lts.perm
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
    29
thm trm_lts.induct[no_vars]
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
    30
thm trm_lts.inducts[no_vars]
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
thm trm_lts.distinct
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
thm trm_lts.fv[simplified trm_lts.supp]
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    34
primrec
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    35
  permute_bn_raw
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    36
where
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    37
  "permute_bn_raw pi (Lnil_raw) = Lnil_raw"
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    38
| "permute_bn_raw pi (Lcons_raw a t l) = Lcons_raw (pi \<bullet> a) t (permute_bn_raw pi l)"
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    39
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    40
quotient_definition
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    41
  "permute_bn :: perm \<Rightarrow> lts \<Rightarrow> lts"
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    42
is
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    43
  "permute_bn_raw"
1639
a98d03fb9d53 added experiemental permute_bn
Christian Urban <urbanc@in.tum.de>
parents: 1638
diff changeset
    44
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    45
lemma [quot_respect]: "((op =) ===> alpha_lts_raw ===> alpha_lts_raw) permute_bn_raw permute_bn_raw"
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    46
  apply simp
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    47
  apply clarify
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    48
  apply (erule alpha_trm_raw_alpha_lts_raw_alpha_bn_raw.inducts)
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    49
  apply simp_all
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    50
  apply (rule alpha_trm_raw_alpha_lts_raw_alpha_bn_raw.intros)
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    51
  apply simp
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    52
  apply (rule alpha_trm_raw_alpha_lts_raw_alpha_bn_raw.intros)
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    53
  apply simp
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    54
  done
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    55
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    56
lemmas permute_bn = permute_bn_raw.simps[quot_lifted]
1639
a98d03fb9d53 added experiemental permute_bn
Christian Urban <urbanc@in.tum.de>
parents: 1638
diff changeset
    57
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    58
lemma permute_bn_zero:
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    59
  "permute_bn 0 a = a"
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    60
  apply(induct a rule: trm_lts.inducts(2))
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    61
  apply(rule TrueI)
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    62
  apply(simp_all add:permute_bn eqvts)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    63
  done
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    64
1640
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
    65
lemma permute_bn_add:
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
    66
  "permute_bn (p + q) a = permute_bn p (permute_bn q a)"
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
    67
  oops
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
    68
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    69
lemma permute_bn_alpha_bn: "alpha_bn lts (permute_bn q lts)"
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    70
  apply(induct lts rule: trm_lts.inducts(2))
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    71
  apply(rule TrueI)
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    72
  apply(simp_all add:permute_bn eqvts trm_lts.eq_iff)
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    73
  done
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
    74
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    75
lemma perm_bn:
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    76
  "p \<bullet> bn l = bn(permute_bn p l)"
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    77
  apply(induct l rule: trm_lts.inducts(2))
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    78
  apply(rule TrueI)
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
    79
  apply(simp_all add:permute_bn eqvts)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    80
  done
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
    81
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    82
lemma Lt_subst:
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    83
  "supp (Abs (bn lts) trm) \<sharp>* q \<Longrightarrow> (Lt lts trm) = Lt (permute_bn q lts) (q \<bullet> trm)"
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    84
  apply (simp only: trm_lts.eq_iff)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    85
  apply (rule_tac x="q" in exI)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    86
  apply (simp add: alphas)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    87
  apply (simp add: permute_bn_alpha_bn)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    88
  apply (simp add: perm_bn[symmetric])
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    89
  apply (simp add: eqvts[symmetric])
1658
aacab5f67333 Fixed renamings.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1653
diff changeset
    90
  apply (simp add: supp_abs)
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    91
  apply (simp add: trm_lts.supp)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    92
  apply (rule supp_perm_eq[symmetric])
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    93
  apply (subst supp_finite_atom_set)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    94
  apply (rule finite_Diff)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    95
  apply (simp add: finite_supp)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    96
  apply (assumption)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    97
  done
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    98
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
    99
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   100
lemma fin_bn:
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   101
  "finite (bn l)"
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   102
  apply(induct l rule: trm_lts.inducts(2))
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   103
  apply(simp_all add:permute_bn eqvts)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   104
  done
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   105
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   106
lemma 
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   107
  fixes t::trm
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   108
  and   l::lts
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   109
  and   c::"'a::fs"
1640
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   110
  assumes a1: "\<And>name c. P1 c (Vr name)"
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   111
  and     a2: "\<And>trm1 trm2 c. \<lbrakk>\<And>d. P1 d trm1; \<And>d. P1 d trm2\<rbrakk> \<Longrightarrow> P1 c (Ap trm1 trm2)"
1640
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   112
  and     a3: "\<And>name trm c. \<lbrakk>atom name \<sharp> c; \<And>d. P1 d trm\<rbrakk> \<Longrightarrow> P1 c (Lm name trm)"
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   113
  and     a4: "\<And>lts trm c. \<lbrakk>bn lts \<sharp>* c; \<And>d. P2 d lts; \<And>d. P1 d trm\<rbrakk> \<Longrightarrow> P1 c (Lt lts trm)"
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   114
  and     a5: "\<And>c. P2 c Lnil"
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   115
  and     a6: "\<And>name trm lts c. \<lbrakk>\<And>d. P1 d trm; \<And>d. P2 d lts\<rbrakk> \<Longrightarrow> P2 c (Lcons name trm lts)"
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   116
  shows "P1 c t" and "P2 c l"
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   117
proof -
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   118
  have "(\<And>(p::perm) (c::'a::fs). P1 c (p \<bullet> t))" and
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   119
       b': "(\<And>(p::perm) (q::perm) (c::'a::fs). P2 c (permute_bn p (q \<bullet> l)))"
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   120
    apply(induct rule: trm_lts.inducts)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   121
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   122
    apply(rule a1)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   123
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   124
    apply(rule a2)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   125
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   126
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   127
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   128
    apply(subgoal_tac "\<exists>q. (q \<bullet> (atom (p \<bullet> name))) \<sharp> c \<and> supp (Lm (p \<bullet> name) (p \<bullet> trm)) \<sharp>* q")
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   129
    apply(erule exE)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   130
    apply(rule_tac t="Lm (p \<bullet> name) (p \<bullet> trm)" 
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   131
               and s="q\<bullet> Lm (p \<bullet> name) (p \<bullet> trm)" in subst)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   132
    apply(rule supp_perm_eq)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   133
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   134
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   135
    apply(rule a3)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   136
    apply(simp add: atom_eqvt)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   137
    apply(subst permute_plus[symmetric])
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   138
    apply(blast)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   139
    apply(rule at_set_avoiding2_atom)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   140
    apply(simp add: finite_supp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   141
    apply(simp add: finite_supp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   142
    apply(simp add: fresh_def)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   143
    apply(simp add: trm_lts.fv[simplified trm_lts.supp])
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   144
    apply(simp)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   145
    apply(subgoal_tac "\<exists>q. (q \<bullet> bn (p \<bullet> lts)) \<sharp>* c \<and> supp (Abs (bn (p \<bullet> lts)) (p \<bullet> trm)) \<sharp>* q")
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   146
    apply(erule exE)
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   147
    apply(erule conjE)
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   148
    apply(subst Lt_subst)
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   149
    apply assumption
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   150
    apply(rule a4)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   151
    apply(simp add:perm_bn)
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   152
    apply assumption
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   153
    apply (simp add: fresh_star_def fresh_def)
1640
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   154
    apply(rotate_tac 1)
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   155
    apply(drule_tac x="q + p" in meta_spec)
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   156
    apply(simp)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   157
    apply(rule at_set_avoiding2)
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   158
    apply(rule fin_bn)
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   159
    apply(simp add: finite_supp)
1658
aacab5f67333 Fixed renamings.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1653
diff changeset
   160
    apply(simp add: supp_abs)
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   161
    apply(rule finite_Diff)
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   162
    apply(simp add: finite_supp)
1658
aacab5f67333 Fixed renamings.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1653
diff changeset
   163
    apply(simp add: fresh_star_def fresh_def supp_abs)
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   164
    apply(simp add: eqvts permute_bn)
1640
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   165
    apply(rule a5)
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   166
    apply(simp add: permute_bn)
1640
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   167
    apply(rule a6)
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   168
    apply simp
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   169
    apply simp
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   170
    done
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   171
  then have a: "P1 c (0 \<bullet> t)" by blast
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   172
  have "P2 c (permute_bn 0 (0 \<bullet> l))" using b' by blast
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   173
  then show "P1 c t" and "P2 c l" using a permute_bn_zero by simp_all
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   174
qed
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   175
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   176
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   177
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   178
lemma lets_bla:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   179
  "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))"
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   180
  by (simp add: trm_lts.eq_iff)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   181
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   182
lemma lets_ok:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   183
  "(Lt (Lcons x (Vr y) Lnil) (Vr x)) = (Lt (Lcons y (Vr y) Lnil) (Vr y))"
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   184
  apply (simp add: trm_lts.eq_iff)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   185
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   186
  apply (simp_all add: alphas)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   187
  apply (simp add: fresh_star_def eqvts)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   188
  done
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   189
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   190
lemma lets_ok3:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   191
  "x \<noteq> y \<Longrightarrow>
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   192
   (Lt (Lcons x (Ap (Vr y) (Vr x)) (Lcons y (Vr y) Lnil)) (Ap (Vr x) (Vr y))) \<noteq>
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   193
   (Lt (Lcons y (Ap (Vr x) (Vr y)) (Lcons x (Vr x) Lnil)) (Ap (Vr x) (Vr y)))"
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   194
  apply (simp add: alphas trm_lts.eq_iff)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   195
  done
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   196
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   197
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   198
lemma lets_not_ok1:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   199
  "(Lt (Lcons x (Vr x) (Lcons y (Vr y) Lnil)) (Ap (Vr x) (Vr y))) =
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   200
   (Lt (Lcons y (Vr x) (Lcons x (Vr y) Lnil)) (Ap (Vr x) (Vr y)))"
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   201
  apply (simp add: alphas trm_lts.eq_iff)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   202
  apply (rule_tac x="0::perm" in exI)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   203
  apply (simp add: fresh_star_def eqvts)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   204
  apply blast
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   205
  done
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   206
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   207
lemma lets_nok:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   208
  "x \<noteq> y \<Longrightarrow> x \<noteq> z \<Longrightarrow> z \<noteq> y \<Longrightarrow>
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   209
   (Lt (Lcons x (Ap (Vr z) (Vr z)) (Lcons y (Vr z) Lnil)) (Ap (Vr x) (Vr y))) \<noteq>
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   210
   (Lt (Lcons y (Vr z) (Lcons x (Ap (Vr z) (Vr z)) Lnil)) (Ap (Vr x) (Vr y)))"
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   211
  apply (simp add: alphas trm_lts.eq_iff fresh_star_def)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   212
  done
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   213
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   214
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   215
end
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   216
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   217
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   218