Nominal/Ex/Let.thy
author Christian Urban <urbanc@in.tum.de>
Mon, 27 Sep 2010 12:19:17 -0400
changeset 2493 2e174807c891
parent 2492 5ac9a74d22fd
child 2494 11133eb76f61
permissions -rw-r--r--
added postprocessed fresh-lemmas for constructors
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 Let
2454
9ffee4eb1ae1 renamed NewParser to Nominal2
Christian Urban <urbanc@in.tum.de>
parents: 2449
diff changeset
     2
imports "../Nominal2" 
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
atom_decl name
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
nominal_datatype trm =
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
     8
  Var "name"
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
     9
| App "trm" "trm"
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
    10
| Lam x::"name" t::"trm"  bind  x in t
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    11
| Let as::"assn" t::"trm"   bind "bn as" in t
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    12
and assn =
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    13
  ANil
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    14
| ACons "name" "trm" "assn"
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
binder
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
  bn
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
where
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    18
  "bn ANil = []"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    19
| "bn (ACons x t as) = (atom x) # (bn as)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    20
2492
5ac9a74d22fd post-processed eq_iff and supp threormes according to the fv-supp equality
Christian Urban <urbanc@in.tum.de>
parents: 2490
diff changeset
    21
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    22
thm trm_assn.fv_defs
2492
5ac9a74d22fd post-processed eq_iff and supp threormes according to the fv-supp equality
Christian Urban <urbanc@in.tum.de>
parents: 2490
diff changeset
    23
thm trm_assn.eq_iff 
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    24
thm trm_assn.bn_defs
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    25
thm trm_assn.perm_simps
2492
5ac9a74d22fd post-processed eq_iff and supp threormes according to the fv-supp equality
Christian Urban <urbanc@in.tum.de>
parents: 2490
diff changeset
    26
thm trm_assn.induct
5ac9a74d22fd post-processed eq_iff and supp threormes according to the fv-supp equality
Christian Urban <urbanc@in.tum.de>
parents: 2490
diff changeset
    27
thm trm_assn.inducts
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    28
thm trm_assn.distinct
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    29
thm trm_assn.supp
2493
2e174807c891 added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents: 2492
diff changeset
    30
thm trm_assn.fresh
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    31
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    32
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    33
lemma fin_bn:
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    34
  shows "finite (set (bn l))"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    35
  apply(induct l rule: trm_assn.inducts(2))
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    36
  apply(simp_all)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    37
  done
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    38
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    39
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    40
inductive
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    41
    test_trm :: "trm \<Rightarrow> bool"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    42
and test_assn :: "assn \<Rightarrow> bool"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    43
where
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    44
  "test_trm (Var x)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    45
| "\<lbrakk>test_trm t1; test_trm t2\<rbrakk> \<Longrightarrow> test_trm (App t1 t2)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    46
| "\<lbrakk>test_trm t; {atom x} \<sharp>* Lam x t\<rbrakk> \<Longrightarrow> test_trm (Lam x t)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    47
| "\<lbrakk>test_assn as; test_trm t; set (bn as) \<sharp>* Let as t\<rbrakk> \<Longrightarrow> test_trm (Let as t)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    48
| "test_assn ANil"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    49
| "\<lbrakk>test_trm t; test_assn as\<rbrakk> \<Longrightarrow> test_assn (ACons x t as)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    50
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    51
declare trm_assn.fv_bn_eqvt[eqvt]
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    52
equivariance test_trm
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    53
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    54
(*
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    55
lemma 
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    56
  fixes p::"perm"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    57
  shows "test_trm (p \<bullet> t)" and "test_assn (p \<bullet> as)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    58
apply(induct t and as arbitrary: p and p rule: trm_assn.inducts)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    59
apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    60
apply(rule test_trm_test_assn.intros)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    61
apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    62
apply(rule test_trm_test_assn.intros)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    63
apply(assumption)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    64
apply(assumption)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    65
apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    66
apply(rule test_trm_test_assn.intros)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    67
apply(assumption)
2493
2e174807c891 added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents: 2492
diff changeset
    68
apply(simp add: trm_assn.fresh fresh_star_def)
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    69
apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    70
defer
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    71
apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    72
apply(rule test_trm_test_assn.intros)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    73
apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    74
apply(rule test_trm_test_assn.intros)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    75
apply(assumption)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    76
apply(assumption)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    77
apply(rule_tac t = "Let (p \<bullet> assn) (p \<bullet> trm)" in subst)
2493
2e174807c891 added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents: 2492
diff changeset
    78
apply(rule trm_assn.eq_iff(4)[THEN iffD2])
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    79
defer
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    80
apply(rule test_trm_test_assn.intros)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    81
prefer 3
2493
2e174807c891 added postprocessed fresh-lemmas for constructors
Christian Urban <urbanc@in.tum.de>
parents: 2492
diff changeset
    82
apply(simp add: fresh_star_def trm_assn.fresh)
2490
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    83
thm freshs
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    84
--"HERE"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    85
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    86
thm supps
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    87
apply(rule test_trm_test_assn.intros)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    88
apply(assumption)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    89
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    90
apply(assumption)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    91
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    92
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    93
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    94
lemma 
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    95
  fixes t::trm
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    96
  and   as::assn
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    97
  and   c::"'a::fs"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    98
  assumes a1: "\<And>x c. P1 c (Var x)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
    99
  and     a2: "\<And>t1 t2 c. \<lbrakk>\<And>d. P1 d t1; \<And>d. P1 d t2\<rbrakk> \<Longrightarrow> P1 c (App t1 t2)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   100
  and     a3: "\<And>x t c. \<lbrakk>{atom x} \<sharp>* c; \<And>d. P1 d t\<rbrakk> \<Longrightarrow> P1 c (Lam x t)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   101
  and     a4: "\<And>as t c. \<lbrakk>set (bn as) \<sharp>* c; \<And>d. P2 d as; \<And>d. P1 d t\<rbrakk> \<Longrightarrow> P1 c (Let as t)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   102
  and     a5: "\<And>c. P2 c ANil"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   103
  and     a6: "\<And>x t as c. \<lbrakk>\<And>d. P1 d t; \<And>d. P2 d as\<rbrakk> \<Longrightarrow> P2 c (ACons x t as)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   104
  shows "P1 c t" and "P2 c as"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   105
proof -
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   106
  have x: "\<And>(p::perm) (c::'a::fs). P1 c (p \<bullet> t)" 
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   107
   and y: "\<And>(p::perm) (c::'a::fs). P2 c (p \<bullet> as)"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   108
    apply(induct rule: trm_assn.inducts)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   109
    apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   110
    apply(rule a1)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   111
    apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   112
    apply(rule a2)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   113
    apply(assumption)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   114
    apply(assumption)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   115
    -- "lam case"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   116
    apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   117
    apply(subgoal_tac "\<exists>q. (q \<bullet> {atom (p \<bullet> name)}) \<sharp>* c \<and> supp (Lam (p \<bullet> name) (p \<bullet> trm)) \<sharp>* q")
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   118
    apply(erule exE)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   119
    apply(erule conjE)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   120
    apply(drule supp_perm_eq[symmetric])
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   121
    apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   122
    apply(thin_tac "?X = ?Y")
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   123
    apply(rule a3)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   124
    apply(simp add: atom_eqvt permute_set_eq)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   125
    apply(simp only: permute_plus[symmetric])
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   126
    apply(rule at_set_avoiding2)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   127
    apply(simp add: finite_supp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   128
    apply(simp add: finite_supp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   129
    apply(simp add: finite_supp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   130
    apply(simp add: freshs fresh_star_def)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   131
    --"let case"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   132
    apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   133
    thm trm_assn.eq_iff
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   134
    thm eq_iffs
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   135
    apply(subgoal_tac "\<exists>q. (q \<bullet> set (bn (p \<bullet> assn))) \<sharp>* c \<and> supp (Abs_lst (bn (p \<bullet> assn)) (p \<bullet> trm)) \<sharp>* q")
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   136
    apply(erule exE)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   137
    apply(erule conjE)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   138
    prefer 2
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   139
    apply(rule at_set_avoiding2)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   140
    apply(rule fin_bn)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   141
    apply(simp add: finite_supp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   142
    apply(simp add: finite_supp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   143
    apply(simp add: abs_fresh)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   144
    apply(rule_tac t = "Let (p \<bullet> assn) (p \<bullet> trm)" in subst)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   145
    prefer 2
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   146
    apply(rule a4)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   147
    prefer 4
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   148
    apply(simp add: eq_iffs)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   149
    apply(rule conjI)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   150
    prefer 2
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   151
    apply(simp add: set_eqvt trm_assn.fv_bn_eqvt)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   152
    apply(subst permute_plus[symmetric])
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   153
    apply(blast)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   154
    prefer 2
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   155
    apply(simp add: eq_iffs)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   156
    thm eq_iffs
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   157
    apply(subst permute_plus[symmetric])
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   158
    apply(blast)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   159
    apply(simp add: supps)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   160
    apply(simp add: fresh_star_def freshs)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   161
    apply(drule supp_perm_eq[symmetric])
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   162
    apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   163
    apply(simp add: eq_iffs)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   164
    apply(simp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   165
    apply(thin_tac "?X = ?Y")
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   166
    apply(rule a4) 
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   167
    apply(simp add: set_eqvt trm_assn.fv_bn_eqvt)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   168
    apply(subst permute_plus[symmetric])
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   169
    apply(blast)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   170
    apply(subst permute_plus[symmetric])
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   171
    apply(blast)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   172
    apply(simp add: supps)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   173
    thm at_set_avoiding2
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   174
    --"HERE"
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   175
    apply(rule at_set_avoiding2)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   176
    apply(rule fin_bn)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   177
    apply(simp add: finite_supp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   178
    apply(simp add: finite_supp)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   179
    apply(simp add: fresh_star_def freshs)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   180
    apply(rule ballI)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   181
    apply(simp add: eqvts permute_bn)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   182
    apply(rule a5)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   183
    apply(simp add: permute_bn)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   184
    apply(rule a6)
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   185
    apply simp
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   186
    apply simp
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   187
    done
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   188
  then have a: "P1 c (0 \<bullet> t)" by blast
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   189
  have "P2 c (permute_bn 0 (0 \<bullet> l))" using b' by blast
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   190
  then show "P1 c t" and "P2 c l" using a permute_bn_zero by simp_all
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   191
qed
320775fa47ca some experiments
Christian Urban <urbanc@in.tum.de>
parents: 2454
diff changeset
   192
*)
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   193
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
   194
text {* *}
1731
3832a31a73b1 a test with let having multiple bodies
Christian Urban <urbanc@in.tum.de>
parents: 1685
diff changeset
   195
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
   196
(*
1731
3832a31a73b1 a test with let having multiple bodies
Christian Urban <urbanc@in.tum.de>
parents: 1685
diff changeset
   197
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   198
primrec
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   199
  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
   200
where
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   201
  "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
   202
| "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
   203
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   204
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
   205
  "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
   206
is
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   207
  "permute_bn_raw"
1639
a98d03fb9d53 added experiemental permute_bn
Christian Urban <urbanc@in.tum.de>
parents: 1638
diff changeset
   208
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   209
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
   210
  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
   211
  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
   212
  apply (erule alpha_trm_raw_alpha_lts_raw_alpha_bn_raw.inducts)
2039
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   213
  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
   214
  apply simp_all
2039
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   215
  apply (rule_tac [!] alpha_trm_raw_alpha_lts_raw_alpha_bn_raw.intros)
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   216
  apply simp_all
1644
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   217
  done
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   218
0e705352bcef Properly defined permute_bn. No more sorry's in Let strong induction.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1643
diff changeset
   219
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
   220
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   221
lemma permute_bn_zero:
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   222
  "permute_bn 0 a = a"
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   223
  apply(induct a rule: trm_lts.inducts(2))
2039
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   224
  apply(rule TrueI)+
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   225
  apply(simp_all add:permute_bn)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   226
  done
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   227
1640
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   228
lemma permute_bn_add:
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   229
  "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
   230
  oops
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   231
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   232
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
   233
  apply(induct lts rule: trm_lts.inducts(2))
2039
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   234
  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
   235
  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
   236
  done
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   237
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   238
lemma perm_bn:
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   239
  "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
   240
  apply(induct l rule: trm_lts.inducts(2))
2039
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   241
  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
   242
  apply(simp_all add:permute_bn eqvts)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   243
  done
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   244
1757
d803c0adfcf8 fv_perm_bn
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1739
diff changeset
   245
lemma fv_perm_bn:
d803c0adfcf8 fv_perm_bn
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1739
diff changeset
   246
  "fv_bn l = fv_bn (permute_bn p l)"
d803c0adfcf8 fv_perm_bn
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1739
diff changeset
   247
  apply(induct l rule: trm_lts.inducts(2))
2039
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   248
  apply(rule TrueI)+
1757
d803c0adfcf8 fv_perm_bn
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1739
diff changeset
   249
  apply(simp_all add:permute_bn eqvts)
d803c0adfcf8 fv_perm_bn
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1739
diff changeset
   250
  done
d803c0adfcf8 fv_perm_bn
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1739
diff changeset
   251
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   252
lemma Lt_subst:
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   253
  "supp (Abs_lst (bn lts) trm) \<sharp>* q \<Longrightarrow> (Lt lts trm) = Lt (permute_bn q lts) (q \<bullet> trm)"
2039
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   254
  apply (simp add: trm_lts.eq_iff permute_bn_alpha_bn)
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   255
  apply (rule_tac x="q" in exI)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   256
  apply (simp add: alphas)
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   257
  apply (simp add: perm_bn[symmetric])
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2039
diff changeset
   258
  apply(rule conjI)
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2039
diff changeset
   259
  apply(drule supp_perm_eq)
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2039
diff changeset
   260
  apply(simp add: abs_eq_iff)
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2039
diff changeset
   261
  apply(simp add: alphas_abs alphas)
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2039
diff changeset
   262
  apply(drule conjunct1)
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   263
  apply (simp add: trm_lts.supp)
2082
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2039
diff changeset
   264
  apply(simp add: supp_abs)
0854af516f14 cleaned up a bit the examples; added equivariance to all examples
Christian Urban <urbanc@in.tum.de>
parents: 2039
diff changeset
   265
  apply (simp add: trm_lts.supp)
1643
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   266
  done
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   267
953403c5faa0 Showed Let substitution.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1642
diff changeset
   268
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   269
lemma fin_bn:
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   270
  "finite (set (bn l))"
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   271
  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
   272
  apply(simp_all add:permute_bn eqvts)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   273
  done
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   274
1765
9a894c42e80e more on the lifting section
Christian Urban <urbanc@in.tum.de>
parents: 1759
diff changeset
   275
thm trm_lts.inducts[no_vars]
9a894c42e80e more on the lifting section
Christian Urban <urbanc@in.tum.de>
parents: 1759
diff changeset
   276
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   277
lemma 
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   278
  fixes t::trm
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   279
  and   l::lts
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   280
  and   c::"'a::fs"
1640
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   281
  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
   282
  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
   283
  and     a3: "\<And>name trm c. \<lbrakk>atom name \<sharp> c; \<And>d. P1 d trm\<rbrakk> \<Longrightarrow> P1 c (Lm name trm)"
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   284
  and     a4: "\<And>lts trm c. \<lbrakk>set (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
   285
  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
   286
  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
   287
  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
   288
proof -
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   289
  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
   290
       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
   291
    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
   292
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   293
    apply(rule a1)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   294
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   295
    apply(rule a2)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   296
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   297
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   298
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   299
    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
   300
    apply(erule exE)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   301
    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
   302
               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
   303
    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
   304
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   305
    apply(simp)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   306
    apply(rule a3)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   307
    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
   308
    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
   309
    apply(blast)
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   310
    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
   311
    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
   312
    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
   313
    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
   314
    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
   315
    apply(simp)
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   316
    apply(subgoal_tac "\<exists>q. (q \<bullet> set (bn (p \<bullet> lts))) \<sharp>* c \<and> supp (Abs_lst (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
   317
    apply(erule exE)
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   318
    apply(erule conjE)
1774
c34347ec7ab3 separated general nominal theory into separate folder
Christian Urban <urbanc@in.tum.de>
parents: 1773
diff changeset
   319
    thm Lt_subst
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   320
    apply(subst Lt_subst)
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   321
    apply assumption
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   322
    apply(rule a4)
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   323
    apply(simp add:perm_bn[symmetric])
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   324
    apply(simp add: eqvts)
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   325
    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
   326
    apply(rotate_tac 1)
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   327
    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
   328
    apply(simp)
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   329
    apply(rule at_set_avoiding2)
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   330
    apply(rule fin_bn)
1641
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   331
    apply(simp add: finite_supp)
0b47b699afe0 further in the proof
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1640
diff changeset
   332
    apply(simp add: finite_supp)
1658
aacab5f67333 Fixed renamings.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1653
diff changeset
   333
    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
   334
    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
   335
    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
   336
    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
   337
    apply(rule a6)
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   338
    apply simp
cd5a6db05540 trying to prove the string induction for let.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1639
diff changeset
   339
    apply simp
1642
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   340
    done
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   341
  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
   342
  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
   343
  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
   344
qed
06f44d498cef Only let substitution is left.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1641
diff changeset
   345
1638
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   346
36798cdbc452 first attempt of strong induction for lets with assignments
Christian Urban <urbanc@in.tum.de>
parents: 1602
diff changeset
   347
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   348
lemma lets_bla:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   349
  "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
   350
  by (simp add: trm_lts.eq_iff)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   351
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   352
lemma lets_ok:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   353
  "(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
   354
  apply (simp add: trm_lts.eq_iff)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   355
  apply (rule_tac x="(x \<leftrightarrow> y)" in exI)
2039
39df91a90f87 Move ExLet to NewParser.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1774
diff changeset
   356
  apply (simp_all add: alphas eqvts supp_at_base fresh_star_def)
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   357
  done
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   358
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   359
lemma lets_ok3:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   360
  "x \<noteq> y \<Longrightarrow>
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   361
   (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
   362
   (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
   363
  apply (simp add: alphas trm_lts.eq_iff)
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   364
  done
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   365
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   366
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   367
lemma lets_not_ok1:
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   368
  "x \<noteq> y \<Longrightarrow>
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   369
   (Lt (Lcons x (Vr x) (Lcons y (Vr y) Lnil)) (Ap (Vr x) (Vr y))) \<noteq>
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   370
   (Lt (Lcons y (Vr x) (Lcons x (Vr y) Lnil)) (Ap (Vr x) (Vr y)))"
1685
721d92623c9d Lets finally abstract lists.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1658
diff changeset
   371
  apply (simp add: alphas trm_lts.eq_iff fresh_star_def eqvts)
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   372
  done
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   373
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   374
lemma lets_nok:
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   375
  "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
   376
   (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
   377
   (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
   378
  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
   379
  done
2436
3885dc2669f9 cleaned up (almost completely) the examples
Christian Urban <urbanc@in.tum.de>
parents: 2120
diff changeset
   380
*)
1602
a7e60da429e2 Move Let properties to ExLet
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1600
diff changeset
   381
1600
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   382
end
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   383
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   384
e33e37fd4c7d More reorganization.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   385