| author | Christian Urban <urbanc@in.tum.de> | 
| Mon, 07 Jun 2010 11:43:01 +0200 | |
| changeset 2311 | 4da5c5c29009 | 
| parent 2173 | 477293d841e8 | 
| child 2424 | 621ebd8b13c4 | 
| permissions | -rw-r--r-- | 
| 1797 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 1 | theory Lambda | 
| 2165 | 2 | imports "../NewParser" Quotient_Option | 
| 1594 | 3 | begin | 
| 4 | ||
| 5 | atom_decl name | |
| 2311 
4da5c5c29009
work on transitivity proof
 Christian Urban <urbanc@in.tum.de> parents: 
2173diff
changeset | 6 | declare [[STEPS = 9]] | 
| 1594 | 7 | |
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 8 | nominal_datatype lam = | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 9 | Var "name" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 10 | | App "lam" "lam" | 
| 2311 
4da5c5c29009
work on transitivity proof
 Christian Urban <urbanc@in.tum.de> parents: 
2173diff
changeset | 11 | | Lam x::"name" l::"lam" bind x in l | 
| 1594 | 12 | |
| 1845 
b7423c6b5564
deleted offending [eqvt]-attribute in Abs; Lambda works again, but there is now a problem in CoreHaskell
 Christian Urban <urbanc@in.tum.de> parents: 
1835diff
changeset | 13 | thm lam.fv | 
| 
b7423c6b5564
deleted offending [eqvt]-attribute in Abs; Lambda works again, but there is now a problem in CoreHaskell
 Christian Urban <urbanc@in.tum.de> parents: 
1835diff
changeset | 14 | thm lam.supp | 
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 15 | lemmas supp_fn' = lam.fv[simplified lam.supp] | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 16 | |
| 1805 | 17 | declare lam.perm[eqvt] | 
| 18 | ||
| 2082 
0854af516f14
cleaned up a bit the examples; added equivariance to all examples
 Christian Urban <urbanc@in.tum.de> parents: 
2041diff
changeset | 19 | |
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 20 | section {* Strong Induction Principles*}
 | 
| 1594 | 21 | |
| 2041 
3842464ee03b
Move 2 more to NewParser
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
1954diff
changeset | 22 | (* | 
| 1797 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 23 | Old way of establishing strong induction | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 24 | principles by chosing a fresh name. | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 25 | *) | 
| 1594 | 26 | lemma | 
| 27 | fixes c::"'a::fs" | |
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 28 | assumes a1: "\<And>name c. P c (Var name)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 29 | and a2: "\<And>lam1 lam2 c. \<lbrakk>\<And>d. P d lam1; \<And>d. P d lam2\<rbrakk> \<Longrightarrow> P c (App lam1 lam2)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 30 | and a3: "\<And>name lam c. \<lbrakk>atom name \<sharp> c; \<And>d. P d lam\<rbrakk> \<Longrightarrow> P c (Lam name lam)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 31 | shows "P c lam" | 
| 1594 | 32 | proof - | 
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 33 | have "\<And>p. P c (p \<bullet> lam)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 34 | apply(induct lam arbitrary: c rule: lam.induct) | 
| 1805 | 35 | apply(perm_simp) | 
| 1594 | 36 | apply(rule a1) | 
| 1805 | 37 | apply(perm_simp) | 
| 1594 | 38 | apply(rule a2) | 
| 1797 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 39 | apply(assumption) | 
| 1594 | 40 | apply(assumption) | 
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 41 | apply(subgoal_tac "\<exists>new::name. (atom new) \<sharp> (c, Lam (p \<bullet> name) (p \<bullet> lam))") | 
| 1594 | 42 | defer | 
| 43 | apply(simp add: fresh_def) | |
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 44 | apply(rule_tac X="supp (c, Lam (p \<bullet> name) (p \<bullet> lam))" in obtain_at_base) | 
| 1594 | 45 | apply(simp add: supp_Pair finite_supp) | 
| 46 | apply(blast) | |
| 47 | apply(erule exE) | |
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 48 | apply(rule_tac t="p \<bullet> Lam name lam" and | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 49 | s="(((p \<bullet> name) \<leftrightarrow> new) + p) \<bullet> Lam name lam" in subst) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 50 | apply(simp del: lam.perm) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 51 | apply(subst lam.perm) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 52 | apply(subst (2) lam.perm) | 
| 1594 | 53 | apply(rule flip_fresh_fresh) | 
| 54 | apply(simp add: fresh_def) | |
| 55 | apply(simp only: supp_fn') | |
| 56 | apply(simp) | |
| 57 | apply(simp add: fresh_Pair) | |
| 58 | apply(simp) | |
| 59 | apply(rule a3) | |
| 60 | apply(simp add: fresh_Pair) | |
| 61 | apply(drule_tac x="((p \<bullet> name) \<leftrightarrow> new) + p" in meta_spec) | |
| 62 | apply(simp) | |
| 63 | done | |
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 64 | then have "P c (0 \<bullet> lam)" by blast | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 65 | then show "P c lam" by simp | 
| 1594 | 66 | qed | 
| 67 | ||
| 1797 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 68 | (* | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 69 | New way of establishing strong induction | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 70 | principles by using a appropriate permutation. | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 71 | *) | 
| 1594 | 72 | lemma | 
| 73 | fixes c::"'a::fs" | |
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 74 | assumes a1: "\<And>name c. P c (Var name)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 75 | and a2: "\<And>lam1 lam2 c. \<lbrakk>\<And>d. P d lam1; \<And>d. P d lam2\<rbrakk> \<Longrightarrow> P c (App lam1 lam2)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 76 | and a3: "\<And>name lam c. \<lbrakk>atom name \<sharp> c; \<And>d. P d lam\<rbrakk> \<Longrightarrow> P c (Lam name lam)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 77 | shows "P c lam" | 
| 1594 | 78 | proof - | 
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 79 | have "\<And>p. P c (p \<bullet> lam)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 80 | apply(induct lam arbitrary: c rule: lam.induct) | 
| 1805 | 81 | apply(perm_simp) | 
| 1594 | 82 | apply(rule a1) | 
| 1805 | 83 | apply(perm_simp) | 
| 1594 | 84 | apply(rule a2) | 
| 85 | apply(assumption) | |
| 1797 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 86 | apply(assumption) | 
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 87 |     apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom name}) \<sharp>* c \<and> supp (p \<bullet> Lam name lam) \<sharp>* q")
 | 
| 1594 | 88 | apply(erule exE) | 
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 89 | apply(rule_tac t="p \<bullet> Lam name lam" and | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 90 | s="q \<bullet> p \<bullet> Lam name lam" in subst) | 
| 1594 | 91 | defer | 
| 1805 | 92 | apply(simp) | 
| 1594 | 93 | apply(rule a3) | 
| 94 | apply(simp add: eqvts fresh_star_def) | |
| 95 | apply(drule_tac x="q + p" in meta_spec) | |
| 96 | apply(simp) | |
| 1797 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 97 | apply(rule at_set_avoiding2) | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 98 | apply(simp add: finite_supp) | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 99 | apply(simp add: finite_supp) | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 100 | apply(simp add: finite_supp) | 
| 1805 | 101 | apply(perm_simp) | 
| 1797 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 102 | apply(simp add: fresh_star_def fresh_def supp_fn') | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 103 | apply(rule supp_perm_eq) | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 104 | apply(simp) | 
| 
fddb470720f1
renamed ExLam to Lambda and completed the proof of the strong ind principle; tuned paper
 Christian Urban <urbanc@in.tum.de> parents: 
1773diff
changeset | 105 | done | 
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 106 | then have "P c (0 \<bullet> lam)" by blast | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 107 | then show "P c lam" by simp | 
| 1594 | 108 | qed | 
| 109 | ||
| 1805 | 110 | section {* Typing *}
 | 
| 111 | ||
| 112 | nominal_datatype ty = | |
| 113 | TVar string | |
| 1810 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 114 | | TFun ty ty | 
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 115 | |
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 116 | notation | 
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 117 |  TFun ("_ \<rightarrow> _") 
 | 
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 118 | |
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 119 | declare ty.perm[eqvt] | 
| 1805 | 120 | |
| 121 | inductive | |
| 122 | valid :: "(name \<times> ty) list \<Rightarrow> bool" | |
| 123 | where | |
| 124 | "valid []" | |
| 125 | | "\<lbrakk>atom x \<sharp> Gamma; valid Gamma\<rbrakk> \<Longrightarrow> valid ((x, T)#Gamma)" | |
| 126 | ||
| 1828 | 127 | inductive | 
| 128 |   typing :: "(name\<times>ty) list \<Rightarrow> lam \<Rightarrow> ty \<Rightarrow> bool" ("_ \<turnstile> _ : _" [60,60,60] 60) 
 | |
| 129 | where | |
| 130 | t_Var[intro]: "\<lbrakk>valid \<Gamma>; (x, T) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Var x : T" | |
| 1947 | 131 | | t_App[intro]: "\<lbrakk>\<Gamma> \<turnstile> t1 : T1 \<rightarrow> T2; \<Gamma> \<turnstile> t2 : T1\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> App t1 t2 : T2" | 
| 1828 | 132 | | t_Lam[intro]: "\<lbrakk>atom x \<sharp> \<Gamma>; (x, T1) # \<Gamma> \<turnstile> t : T2\<rbrakk> \<Longrightarrow> \<Gamma> \<turnstile> Lam x t : T1 \<rightarrow> T2" | 
| 133 | ||
| 1831 
16653e702d89
first working version of the automatic equivariance procedure
 Christian Urban <urbanc@in.tum.de> parents: 
1828diff
changeset | 134 | equivariance valid | 
| 
16653e702d89
first working version of the automatic equivariance procedure
 Christian Urban <urbanc@in.tum.de> parents: 
1828diff
changeset | 135 | equivariance typing | 
| 1816 
56cebe7f8e24
some small tunings (incompleted work in Lambda.thy)
 Christian Urban <urbanc@in.tum.de> parents: 
1814diff
changeset | 136 | |
| 1831 
16653e702d89
first working version of the automatic equivariance procedure
 Christian Urban <urbanc@in.tum.de> parents: 
1828diff
changeset | 137 | thm valid.eqvt | 
| 
16653e702d89
first working version of the automatic equivariance procedure
 Christian Urban <urbanc@in.tum.de> parents: 
1828diff
changeset | 138 | thm typing.eqvt | 
| 1811 
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1810diff
changeset | 139 | thm eqvts | 
| 
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1810diff
changeset | 140 | thm eqvts_raw | 
| 
ae176476b525
implemented in thmdecls the case where eqvt-lemmas are of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1810diff
changeset | 141 | |
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 142 | thm typing.induct[of "\<Gamma>" "t" "T", no_vars] | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 143 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 144 | lemma | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 145 | fixes c::"'a::fs" | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 146 | assumes a: "\<Gamma> \<turnstile> t : T" | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 147 | and a1: "\<And>\<Gamma> x T c. \<lbrakk>valid \<Gamma>; (x, T) \<in> set \<Gamma>\<rbrakk> \<Longrightarrow> P c \<Gamma> (Var x) T" | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 148 | and a2: "\<And>\<Gamma> t1 T1 T2 t2 c. \<lbrakk>\<Gamma> \<turnstile> t1 : T1 \<rightarrow> T2; \<And>d. P d \<Gamma> t1 T1 \<rightarrow> T2; \<Gamma> \<turnstile> t2 : T1; \<And>d. P d \<Gamma> t2 T1\<rbrakk> | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 149 | \<Longrightarrow> P c \<Gamma> (App t1 t2) T2" | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 150 | and a3: "\<And>x \<Gamma> T1 t T2 c. \<lbrakk>atom x \<sharp> c; atom x \<sharp> \<Gamma>; (x, T1) # \<Gamma> \<turnstile> t : T2; \<And>d. P d ((x, T1) # \<Gamma>) t T2\<rbrakk> | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 151 | \<Longrightarrow> P c \<Gamma> (Lam x t) T1 \<rightarrow> T2" | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 152 | shows "P c \<Gamma> t T" | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 153 | proof - | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 154 | from a have "\<And>p c. P c (p \<bullet> \<Gamma>) (p \<bullet> t) (p \<bullet> T)" | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 155 | proof (induct) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 156 | case (t_Var \<Gamma> x T p c) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 157 | then show ?case | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 158 | apply - | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 159 | apply(perm_strict_simp) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 160 | apply(rule a1) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 161 | apply(drule_tac p="p" in permute_boolI) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 162 | apply(perm_strict_simp add: permute_minus_cancel) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 163 | apply(assumption) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 164 | apply(rotate_tac 1) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 165 | apply(drule_tac p="p" in permute_boolI) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 166 | apply(perm_strict_simp add: permute_minus_cancel) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 167 | apply(assumption) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 168 | done | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 169 | next | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 170 | case (t_App \<Gamma> t1 T1 T2 t2 p c) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 171 | then show ?case | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 172 | apply - | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 173 | apply(perm_strict_simp) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 174 | apply(rule a2) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 175 | apply(drule_tac p="p" in permute_boolI) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 176 | apply(perm_strict_simp add: permute_minus_cancel) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 177 | apply(assumption) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 178 | apply(assumption) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 179 | apply(rotate_tac 2) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 180 | apply(drule_tac p="p" in permute_boolI) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 181 | apply(perm_strict_simp add: permute_minus_cancel) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 182 | apply(assumption) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 183 | apply(assumption) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 184 | done | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 185 | next | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 186 | case (t_Lam x \<Gamma> T1 t T2 p c) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 187 | then show ?case | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 188 | apply - | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 189 |       apply(subgoal_tac "\<exists>q. (q \<bullet> {p \<bullet> atom x}) \<sharp>* c \<and> 
 | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 190 | supp (p \<bullet> \<Gamma>, p \<bullet> Lam x t, p \<bullet> (T1 \<rightarrow> T2)) \<sharp>* q") | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 191 | apply(erule exE) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 192 | apply(rule_tac t="p \<bullet> \<Gamma>" and s="(q + p) \<bullet> \<Gamma>" in subst) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 193 | apply(simp only: permute_plus) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 194 | apply(rule supp_perm_eq) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 195 | apply(simp add: supp_Pair fresh_star_union) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 196 | apply(rule_tac t="p \<bullet> Lam x t" and s="(q + p) \<bullet> Lam x t" in subst) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 197 | apply(simp only: permute_plus) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 198 | apply(rule supp_perm_eq) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 199 | apply(simp add: supp_Pair fresh_star_union) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 200 | apply(rule_tac t="p \<bullet> (T1 \<rightarrow> T2)" and s="(q + p) \<bullet> (T1 \<rightarrow> T2)" in subst) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 201 | apply(simp only: permute_plus) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 202 | apply(rule supp_perm_eq) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 203 | apply(simp add: supp_Pair fresh_star_union) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 204 | apply(simp (no_asm) only: eqvts) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 205 | apply(rule a3) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 206 | apply(simp only: eqvts permute_plus) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 207 | apply(simp add: fresh_star_def) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 208 | apply(drule_tac p="q + p" in permute_boolI) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 209 | apply(perm_strict_simp add: permute_minus_cancel) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 210 | apply(assumption) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 211 | apply(rotate_tac 1) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 212 | apply(drule_tac p="q + p" in permute_boolI) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 213 | apply(perm_strict_simp add: permute_minus_cancel) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 214 | apply(assumption) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 215 | apply(drule_tac x="d" in meta_spec) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 216 | apply(drule_tac x="q + p" in meta_spec) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 217 | apply(perm_strict_simp add: permute_minus_cancel) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 218 | apply(assumption) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 219 | apply(rule at_set_avoiding2) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 220 | apply(simp add: finite_supp) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 221 | apply(simp add: finite_supp) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 222 | apply(simp add: finite_supp) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 223 | apply(rule_tac p="-p" in permute_boolE) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 224 | apply(perm_strict_simp add: permute_minus_cancel) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 225 | (* supplied by the user *) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 226 | apply(simp add: fresh_star_prod) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 227 | apply(simp add: fresh_star_def) | 
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 228 | sorry | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 229 | qed | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 230 | then have "P c (0 \<bullet> \<Gamma>) (0 \<bullet> t) (0 \<bullet> T)" . | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 231 | then show "P c \<Gamma> t T" by simp | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 232 | qed | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 233 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 234 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 235 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 236 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 237 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 238 | |
| 1833 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 239 | |
| 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 240 | inductive | 
| 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 241 |   tt :: "('a \<Rightarrow> 'a \<Rightarrow> bool) \<Rightarrow> ('a \<Rightarrow> 'a \<Rightarrow> bool)"  
 | 
| 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 242 |   for r :: "('a \<Rightarrow> 'a \<Rightarrow> bool)"
 | 
| 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 243 | where | 
| 1835 
636de31888a6
tuned and removed dead code
 Christian Urban <urbanc@in.tum.de> parents: 
1833diff
changeset | 244 | aa: "tt r a a" | 
| 
636de31888a6
tuned and removed dead code
 Christian Urban <urbanc@in.tum.de> parents: 
1833diff
changeset | 245 | | bb: "tt r a b ==> tt r a c" | 
| 1833 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 246 | |
| 1835 
636de31888a6
tuned and removed dead code
 Christian Urban <urbanc@in.tum.de> parents: 
1833diff
changeset | 247 | (* PROBLEM: derived eqvt-theorem does not conform with [eqvt] | 
| 1833 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 248 | equivariance tt | 
| 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 249 | *) | 
| 
2050b5723c04
added a library for basic nominal functions; separated nominal_eqvt file
 Christian Urban <urbanc@in.tum.de> parents: 
1831diff
changeset | 250 | |
| 1810 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 251 | |
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 252 | inductive | 
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 253 | alpha_lam_raw' | 
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 254 | where | 
| 1861 
226b797868dc
some tuning of eqvt-infrastructure
 Christian Urban <urbanc@in.tum.de> parents: 
1845diff
changeset | 255 | a1: "name = namea \<Longrightarrow> alpha_lam_raw' (Var_raw name) (Var_raw namea)" | 
| 
226b797868dc
some tuning of eqvt-infrastructure
 Christian Urban <urbanc@in.tum.de> parents: 
1845diff
changeset | 256 | | a2: "\<lbrakk>alpha_lam_raw' lam_raw1 lam_raw1a; alpha_lam_raw' lam_raw2 lam_raw2a\<rbrakk> \<Longrightarrow> | 
| 1810 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 257 | alpha_lam_raw' (App_raw lam_raw1 lam_raw2) (App_raw lam_raw1a lam_raw2a)" | 
| 1865 
b71b838b0a75
Finished proof in Lambda.thy
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
1863diff
changeset | 258 | | a3: "\<exists>pi. ({atom name}, lam_raw) \<approx>gen alpha_lam_raw' fv_lam_raw pi ({atom namea}, lam_rawa) \<Longrightarrow>
 | 
| 1810 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 259 | alpha_lam_raw' (Lam_raw name lam_raw) (Lam_raw namea lam_rawa)" | 
| 
894930834ca8
fixed bug in thmdecls with destructing Trueprop; some initial infrastructure for eqvt-theorems of the form _ ==> _
 Christian Urban <urbanc@in.tum.de> parents: 
1805diff
changeset | 260 | |
| 1866 
6d4e4bf9bce6
automatic proofs for equivariance of alphas
 Christian Urban <urbanc@in.tum.de> parents: 
1865diff
changeset | 261 | equivariance alpha_lam_raw' | 
| 1947 | 262 | |
| 1861 
226b797868dc
some tuning of eqvt-infrastructure
 Christian Urban <urbanc@in.tum.de> parents: 
1845diff
changeset | 263 | thm eqvts_raw | 
| 
226b797868dc
some tuning of eqvt-infrastructure
 Christian Urban <urbanc@in.tum.de> parents: 
1845diff
changeset | 264 | |
| 1800 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 265 | section {* size function *}
 | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 266 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 267 | lemma size_eqvt_raw: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 268 | fixes t::"lam_raw" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 269 | shows "size (pi \<bullet> t) = size t" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 270 | apply (induct rule: lam_raw.inducts) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 271 | apply simp_all | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 272 | done | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 273 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 274 | instantiation lam :: size | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 275 | begin | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 276 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 277 | quotient_definition | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 278 | "size_lam :: lam \<Rightarrow> nat" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 279 | is | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 280 | "size :: lam_raw \<Rightarrow> nat" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 281 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 282 | lemma size_rsp: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 283 | "alpha_lam_raw x y \<Longrightarrow> size x = size y" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 284 | apply (induct rule: alpha_lam_raw.inducts) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 285 | apply (simp_all only: lam_raw.size) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 286 | apply (simp_all only: alphas) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 287 | apply clarify | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 288 | apply (simp_all only: size_eqvt_raw) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 289 | done | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 290 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 291 | lemma [quot_respect]: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 292 | "(alpha_lam_raw ===> op =) size size" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 293 | by (simp_all add: size_rsp) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 294 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 295 | lemma [quot_preserve]: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 296 | "(rep_lam ---> id) size = size" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 297 | by (simp_all add: size_lam_def) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 298 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 299 | instance | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 300 | by default | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 301 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 302 | end | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 303 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 304 | lemmas size_lam[simp] = | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 305 | lam_raw.size(4)[quot_lifted] | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 306 | lam_raw.size(5)[quot_lifted] | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 307 | lam_raw.size(6)[quot_lifted] | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 308 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 309 | (* is this needed? *) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 310 | lemma [measure_function]: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 311 | "is_measure (size::lam\<Rightarrow>nat)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 312 | by (rule is_measure_trivial) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 313 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 314 | section {* Matching *}
 | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 315 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 316 | definition | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 317 |   MATCH :: "('c::pt \<Rightarrow> (bool * 'a::pt * 'b::pt)) \<Rightarrow> 'b \<Rightarrow> 'a \<Rightarrow> 'b"
 | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 318 | where | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 319 | "MATCH M d x \<equiv> if (\<exists>!r. \<exists>q. M q = (True, x, r)) then (THE r. \<exists>q. M q = (True, x, r)) else d" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 320 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 321 | (* | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 322 | lemma MATCH_eqvt: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 323 | shows "p \<bullet> (MATCH M d x) = MATCH (p \<bullet> M) (p \<bullet> d) (p \<bullet> x)" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 324 | unfolding MATCH_def | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 325 | apply(perm_simp the_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 326 | apply (tactic {* Nominal_Permeq.eqvt_tac @{context} 1 *})
 | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 327 | apply(simp) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 328 | thm eqvts_raw | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 329 | apply(subst if_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 330 | apply(subst ex1_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 331 | apply(subst permute_fun_def) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 332 | apply(subst ex_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 333 | apply(subst permute_fun_def) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 334 | apply(subst eq_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 335 | apply(subst permute_fun_app_eq[where f="M"]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 336 | apply(simp only: permute_minus_cancel) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 337 | apply(subst permute_prod.simps) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 338 | apply(subst permute_prod.simps) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 339 | apply(simp only: permute_minus_cancel) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 340 | apply(simp only: permute_bool_def) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 341 | apply(simp) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 342 | apply(subst ex1_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 343 | apply(subst permute_fun_def) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 344 | apply(subst ex_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 345 | apply(subst permute_fun_def) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 346 | apply(subst eq_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 347 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 348 | apply(simp only: eqvts) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 349 | apply(simp) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 350 | apply(subgoal_tac "(p \<bullet> (\<exists>!r. \<exists>q. M q = (True, x, r))) = (\<exists>!r. \<exists>q. (p \<bullet> M) q = (True, p \<bullet> x, r))") | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 351 | apply(drule sym) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 352 | apply(simp) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 353 | apply(rule impI) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 354 | apply(simp add: perm_bool) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 355 | apply(rule trans) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 356 | apply(rule pt_the_eqvt[OF pta at]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 357 | apply(assumption) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 358 | apply(simp add: pt_ex_eqvt[OF pt at]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 359 | apply(simp add: pt_eq_eqvt[OF ptb at]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 360 | apply(rule cheat) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 361 | apply(rule trans) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 362 | apply(rule pt_ex1_eqvt) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 363 | apply(rule pta) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 364 | apply(rule at) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 365 | apply(simp add: pt_ex_eqvt[OF pt at]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 366 | apply(simp add: pt_eq_eqvt[OF ptb at]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 367 | apply(subst pt_pi_rev[OF pta at]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 368 | apply(subst pt_fun_app_eq[OF pt at]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 369 | apply(subst pt_pi_rev[OF pt at]) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 370 | apply(simp) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 371 | done | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 372 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 373 | lemma MATCH_cng: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 374 | assumes a: "M1 = M2" "d1 = d2" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 375 | shows "MATCH M1 d1 x = MATCH M2 d2 x" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 376 | using a by simp | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 377 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 378 | lemma MATCH_eq: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 379 | assumes a: "t = l x" "G x" "\<And>x'. t = l x' \<Longrightarrow> G x' \<Longrightarrow> r x' = r x" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 380 | shows "MATCH (\<lambda>x. (G x, l x, r x)) d t = r x" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 381 | using a | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 382 | unfolding MATCH_def | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 383 | apply(subst if_P) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 384 | apply(rule_tac a="r x" in ex1I) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 385 | apply(rule_tac x="x" in exI) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 386 | apply(blast) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 387 | apply(erule exE) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 388 | apply(drule_tac x="q" in meta_spec) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 389 | apply(auto)[1] | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 390 | apply(rule the_equality) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 391 | apply(blast) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 392 | apply(erule exE) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 393 | apply(drule_tac x="q" in meta_spec) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 394 | apply(auto)[1] | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 395 | done | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 396 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 397 | lemma MATCH_eq2: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 398 | assumes a: "t = l x1 x2" "G x1 x2" "\<And>x1' x2'. t = l x1' x2' \<Longrightarrow> G x1' x2' \<Longrightarrow> r x1' x2' = r x1 x2" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 399 | shows "MATCH (\<lambda>(x1,x2). (G x1 x2, l x1 x2, r x1 x2)) d t = r x1 x2" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 400 | sorry | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 401 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 402 | lemma MATCH_neq: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 403 | assumes a: "\<And>x. t = l x \<Longrightarrow> G x \<Longrightarrow> False" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 404 | shows "MATCH (\<lambda>x. (G x, l x, r x)) d t = d" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 405 | using a | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 406 | unfolding MATCH_def | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 407 | apply(subst if_not_P) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 408 | apply(blast) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 409 | apply(rule refl) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 410 | done | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 411 | |
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 412 | lemma MATCH_neq2: | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 413 | assumes a: "\<And>x1 x2. t = l x1 x2 \<Longrightarrow> G x1 x2 \<Longrightarrow> False" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 414 | shows "MATCH (\<lambda>(x1,x2). (G x1 x2, l x1 x2, r x1 x2)) d t = d" | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 415 | using a | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 416 | unfolding MATCH_def | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 417 | apply(subst if_not_P) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 418 | apply(auto) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 419 | done | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 420 | *) | 
| 
78fdc6b36a1c
changed the eqvt-tac to move only outermost permutations inside; added tracing infrastructure for the eqvt-tac
 Christian Urban <urbanc@in.tum.de> parents: 
1797diff
changeset | 421 | |
| 1954 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 422 | ML {*
 | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 423 | fun mk_avoids ctxt params name set = | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 424 | let | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 425 | val (_, ctxt') = ProofContext.add_fixes | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 426 | (map (fn (s, T) => (Binding.name s, SOME T, NoSyn)) params) ctxt; | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 427 | fun mk s = | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 428 | let | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 429 | val t = Syntax.read_term ctxt' s; | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 430 | val t' = list_abs_free (params, t) |> | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 431 | funpow (length params) (fn Abs (_, _, t) => t) | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 432 | in (t', HOLogic.dest_setT (fastype_of t)) end | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 433 | handle TERM _ => | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 434 |         error ("Expression " ^ quote s ^ " to be avoided in case " ^
 | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 435 | quote name ^ " is not a set type"); | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 436 | fun add_set p [] = [p] | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 437 | | add_set (t, T) ((u, U) :: ps) = | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 438 | if T = U then | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 439 | let val S = HOLogic.mk_setT T | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 440 |             in (Const (@{const_name sup}, S --> S --> S) $ u $ t, T) :: ps
 | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 441 | end | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 442 | else (u, U) :: add_set (t, T) ps | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 443 | in | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 444 | (mk #> add_set) set | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 445 | end; | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 446 | *} | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 447 | |
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 448 | |
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 449 | ML {* 
 | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 450 |   writeln (commas (map (Syntax.string_of_term @{context} o fst) 
 | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 451 |     (mk_avoids @{context} [] "t_Var" "{x}" []))) 
 | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 452 | *} | 
| 
23480003f9c5
some changes to the paper
 Christian Urban <urbanc@in.tum.de> parents: 
1950diff
changeset | 453 | |
| 1947 | 454 | |
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 455 | ML {*
 | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 456 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 457 | fun prove_strong_ind (pred_name, avoids) ctxt = | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 458 | Proof.theorem NONE (K I) [] ctxt | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 459 | |
| 2169 | 460 | local structure P = Parse and K = Keyword in | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 461 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 462 | val _ = | 
| 2169 | 463 | Outer_Syntax.local_theory_to_proof "nominal_inductive" | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 464 | "proves strong induction theorem for inductive predicate involving nominal datatypes" K.thy_goal | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 465 | (P.xname -- (Scan.optional (P.$$$ "avoids" |-- P.enum1 "|" (P.name -- | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 466 | (P.$$$ ":" |-- P.and_list1 P.term))) []) >> prove_strong_ind) | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 467 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 468 | end; | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 469 | |
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 470 | *} | 
| 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 471 | |
| 1950 
7de54c9f81ac
eliminated command so that all compiles
 Christian Urban <urbanc@in.tum.de> parents: 
1949diff
changeset | 472 | (* | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 473 | nominal_inductive typing | 
| 1950 
7de54c9f81ac
eliminated command so that all compiles
 Christian Urban <urbanc@in.tum.de> parents: 
1949diff
changeset | 474 | *) | 
| 1949 
0b692f37a771
changed theorem_i to theorem....requires new Isabelle
 Christian Urban <urbanc@in.tum.de> parents: 
1947diff
changeset | 475 | |
| 2157 | 476 | (* Substitution *) | 
| 2159 
ce00205e07ab
Single variable substitution
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2158diff
changeset | 477 | |
| 2165 | 478 | primrec match_Var_raw where | 
| 479 | "match_Var_raw (Var_raw x) = Some x" | |
| 480 | | "match_Var_raw (App_raw x y) = None" | |
| 481 | | "match_Var_raw (Lam_raw n t) = None" | |
| 482 | ||
| 483 | quotient_definition | |
| 484 | "match_Var :: lam \<Rightarrow> name option" | |
| 485 | is match_Var_raw | |
| 486 | ||
| 487 | lemma [quot_respect]: "(alpha_lam_raw ===> op =) match_Var_raw match_Var_raw" | |
| 488 | apply rule | |
| 489 | apply (induct_tac a b rule: alpha_lam_raw.induct) | |
| 490 | apply simp_all | |
| 491 | done | |
| 492 | ||
| 493 | lemmas match_Var_simps = match_Var_raw.simps[quot_lifted] | |
| 494 | ||
| 495 | primrec match_App_raw where | |
| 496 | "match_App_raw (Var_raw x) = None" | |
| 497 | | "match_App_raw (App_raw x y) = Some (x, y)" | |
| 498 | | "match_App_raw (Lam_raw n t) = None" | |
| 499 | ||
| 500 | quotient_definition | |
| 501 | "match_App :: lam \<Rightarrow> (lam \<times> lam) option" | |
| 502 | is match_App_raw | |
| 503 | ||
| 504 | lemma [quot_respect]: | |
| 505 | "(alpha_lam_raw ===> option_rel (prod_rel alpha_lam_raw alpha_lam_raw)) match_App_raw match_App_raw" | |
| 506 | apply (intro fun_relI) | |
| 507 | apply (induct_tac a b rule: alpha_lam_raw.induct) | |
| 508 | apply simp_all | |
| 509 | done | |
| 510 | ||
| 511 | lemmas match_App_simps = match_App_raw.simps[quot_lifted] | |
| 512 | ||
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 513 | definition new where | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 514 | "new (s :: 'a :: fs) = (THE x. \<forall>a \<in> supp s. atom x \<noteq> a)" | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 515 | |
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 516 | definition | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 517 | "match_Lam (S :: 'a :: fs) t = (if (\<exists>n s. (t = Lam n s)) then | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 518 | (let z = new (S, t) in Some (z, THE s. t = Lam z s)) else None)" | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 519 | |
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 520 | lemma lam_half_inj: "(Lam z s = Lam z sa) = (s = sa)" | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 521 | apply auto | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 522 | apply (simp only: lam.eq_iff alphas) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 523 | apply clarify | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 524 | apply (simp add: eqvts) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 525 | sorry | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 526 | |
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 527 | lemma match_Lam_simps: | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 528 | "match_Lam S (Var n) = None" | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 529 | "match_Lam S (App l r) = None" | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 530 | "z = new (S, (Lam z s)) \<Longrightarrow> match_Lam S (Lam z s) = Some (z, s)" | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 531 | apply (simp_all add: match_Lam_def) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 532 | apply (simp add: lam_half_inj) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 533 | apply auto | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 534 | done | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 535 | |
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 536 | (* | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 537 | lemma match_Lam_simps2: | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 538 | "atom n \<sharp> ((S :: 'a :: fs), Lam n s) \<Longrightarrow> match_Lam S (Lam n s) = Some (n, s)" | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 539 | apply (rule_tac t="Lam n s" | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 540 | and s="Lam (new (S, (Lam n s))) ((n \<leftrightarrow> (new (S, (Lam n s)))) \<bullet> s)" in subst) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 541 | defer | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 542 | apply (subst match_Lam_simps(3)) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 543 | defer | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 544 | apply simp | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 545 | *) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 546 | |
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 547 | (*primrec match_Lam_raw where | 
| 2165 | 548 | "match_Lam_raw (S :: atom set) (Var_raw x) = None" | 
| 549 | | "match_Lam_raw S (App_raw x y) = None" | |
| 550 | | "match_Lam_raw S (Lam_raw n t) = (let z = new (S \<union> (fv_lam_raw t - {atom n})) in Some (z, (n \<leftrightarrow> z) \<bullet> t))"
 | |
| 551 | ||
| 552 | quotient_definition | |
| 553 | "match_Lam :: (atom set) \<Rightarrow> lam \<Rightarrow> (name \<times> lam) option" | |
| 554 | is match_Lam_raw | |
| 555 | ||
| 2172 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 556 | lemma swap_fresh: | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 557 | assumes a: "fv_lam_raw t \<sharp>* p" | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 558 | shows "alpha_lam_raw (p \<bullet> t) t" | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 559 | using a apply (induct t) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 560 | apply (simp add: supp_at_base fresh_star_def) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 561 | apply (rule alpha_lam_raw.intros) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 562 | apply (metis Rep_name_inverse atom_eqvt atom_name_def fresh_perm) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 563 | apply (simp) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 564 | apply (simp only: fresh_star_union) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 565 | apply clarify | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 566 | apply (rule alpha_lam_raw.intros) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 567 | apply simp | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 568 | apply simp | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 569 | apply simp | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 570 | apply (rule alpha_lam_raw.intros) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 571 | sorry | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 572 | |
| 2165 | 573 | lemma [quot_respect]: | 
| 574 | "(op = ===> alpha_lam_raw ===> option_rel (prod_rel op = alpha_lam_raw)) match_Lam_raw match_Lam_raw" | |
| 575 | proof (intro fun_relI, clarify) | |
| 576 | fix S t s | |
| 577 | assume a: "alpha_lam_raw t s" | |
| 578 | show "option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S t) (match_Lam_raw S s)" | |
| 579 | using a proof (induct t s rule: alpha_lam_raw.induct) | |
| 580 | case goal1 show ?case by simp | |
| 581 | next | |
| 582 | case goal2 show ?case by simp | |
| 583 | next | |
| 584 | case (goal3 x t y s) | |
| 585 |       then obtain p where "({atom x}, t) \<approx>gen (\<lambda>x1 x2. alpha_lam_raw x1 x2 \<and>
 | |
| 586 | option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S x1) | |
| 587 |                                (match_Lam_raw S x2)) fv_lam_raw p ({atom y}, s)" ..
 | |
| 588 | then have | |
| 589 |         c: "fv_lam_raw t - {atom x} = fv_lam_raw s - {atom y}" and
 | |
| 590 |         d: "(fv_lam_raw t - {atom x}) \<sharp>* p" and
 | |
| 591 | e: "alpha_lam_raw (p \<bullet> t) s" and | |
| 592 | f: "option_rel (prod_rel op = alpha_lam_raw) (match_Lam_raw S (p \<bullet> t)) (match_Lam_raw S s)" and | |
| 593 |         g: "p \<bullet> {atom x} = {atom y}" unfolding alphas(1) by - (elim conjE, assumption)+
 | |
| 594 |       let ?z = "new (S \<union> (fv_lam_raw t - {atom x}))"
 | |
| 595 |       have h: "?z = new (S \<union> (fv_lam_raw s - {atom y}))" using c by simp
 | |
| 596 | show ?case | |
| 597 | unfolding match_Lam_raw.simps Let_def option_rel.simps prod_rel.simps split_conv | |
| 598 | proof | |
| 599 |         show "?z = new (S \<union> (fv_lam_raw s - {atom y}))" by (fact h)
 | |
| 600 | next | |
| 601 | have "atom y \<sharp> p" sorry | |
| 602 | have "fv_lam_raw t \<sharp>* ((x \<leftrightarrow> y) \<bullet> p)" sorry | |
| 2172 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 603 | then have "alpha_lam_raw (((x \<leftrightarrow> y) \<bullet> p) \<bullet> t) t" using swap_fresh by auto | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 604 | then have "alpha_lam_raw (p \<bullet> t) ((x \<leftrightarrow> y) \<bullet> t)" sorry | 
| 2165 | 605 | have "alpha_lam_raw t ((x \<leftrightarrow> y) \<bullet> s)" sorry | 
| 606 | then have "alpha_lam_raw ((x \<leftrightarrow> ?z) \<bullet> t) ((y \<leftrightarrow> ?z) \<bullet> s)" using eqvts(15) sorry | |
| 607 |         then show "alpha_lam_raw ((x \<leftrightarrow> new (S \<union> (fv_lam_raw t - {atom x}))) \<bullet> t)
 | |
| 608 |                   ((y \<leftrightarrow> new (S \<union> (fv_lam_raw s - {atom y}))) \<bullet> s)" unfolding h .
 | |
| 609 | qed | |
| 610 | qed | |
| 611 | qed | |
| 612 | ||
| 613 | lemmas match_Lam_simps = match_Lam_raw.simps[quot_lifted] | |
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 614 | *) | 
| 2165 | 615 | |
| 616 | lemma app_some: "match_App x = Some (a, b) \<Longrightarrow> x = App a b" | |
| 617 | by (induct x rule: lam.induct) (simp_all add: match_App_simps) | |
| 618 | ||
| 619 | lemma lam_some: "match_Lam S x = Some (z, s) \<Longrightarrow> x = Lam z s \<and> atom z \<sharp> S" | |
| 620 | apply (induct x rule: lam.induct) | |
| 621 | apply (simp_all add: match_Lam_simps) | |
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 622 | apply (thin_tac "match_Lam S lam = Some (z, s) \<Longrightarrow> lam = Lam z s \<and> atom z \<sharp> S") | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 623 | apply (simp add: match_Lam_def) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 624 | apply (subgoal_tac "\<exists>n s. Lam name lam = Lam n s") | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 625 | prefer 2 | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 626 | apply auto[1] | 
| 2165 | 627 | apply (simp add: Let_def) | 
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 628 | apply (thin_tac "\<exists>n s. Lam name lam = Lam n s") | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 629 | apply clarify | 
| 2165 | 630 | apply (rule conjI) | 
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 631 | apply (rule_tac t="THE s. Lam name lam = Lam (new (S, Lam name lam)) s" and | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 632 | s="(name \<leftrightarrow> (new (S, Lam name lam))) \<bullet> lam" in subst) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 633 | defer | 
| 2165 | 634 | apply (simp add: lam.eq_iff) | 
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 635 | apply (rule_tac x="(name \<leftrightarrow> (new (S, Lam name lam)))" in exI) | 
| 2165 | 636 | apply (simp add: alphas) | 
| 637 | apply (simp add: eqvts) | |
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 638 | apply (rule conjI) | 
| 2172 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 639 | sorry | 
| 2165 | 640 | |
| 641 | function subst where | |
| 642 | "subst v s t = ( | |
| 643 | case match_Var t of Some n \<Rightarrow> if n = v then s else Var n | None \<Rightarrow> | |
| 644 | case match_App t of Some (l, r) \<Rightarrow> App (subst v s l) (subst v s r) | None \<Rightarrow> | |
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 645 | case match_Lam (v,s) t of Some (n, t) \<Rightarrow> Lam n (subst v s t) | None \<Rightarrow> undefined)" | 
| 2165 | 646 | by pat_completeness auto | 
| 647 | ||
| 648 | termination apply (relation "measure (\<lambda>(_, _, t). size t)") | |
| 2172 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 649 | apply auto[1] | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 650 | apply (case_tac a) apply simp | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 651 | apply (frule lam_some) apply simp | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 652 | apply (case_tac a) apply simp | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 653 | apply (frule app_some) apply simp | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 654 | apply (case_tac a) apply simp | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 655 | apply (frule app_some) apply simp | 
| 2165 | 656 | done | 
| 657 | ||
| 658 | lemmas lam_exhaust = lam_raw.exhaust[quot_lifted] | |
| 659 | ||
| 660 | lemma subst_eqvt: | |
| 661 | "p \<bullet> (subst v s t) = subst (p \<bullet> v) (p \<bullet> s) (p \<bullet> t)" | |
| 662 | proof (induct v s t rule: subst.induct) | |
| 663 | case (1 v s t) | |
| 664 | show ?case proof (cases t rule: lam_exhaust) | |
| 665 | fix n | |
| 666 | assume "t = Var n" | |
| 667 | then show ?thesis by (simp add: match_Var_simps) | |
| 668 | next | |
| 669 | fix l r | |
| 670 | assume "t = App l r" | |
| 671 | then show ?thesis | |
| 672 | apply (simp only:) | |
| 673 | apply (subst subst.simps) | |
| 674 | apply (subst match_Var_simps) | |
| 675 | apply (simp only: option.cases) | |
| 676 | apply (subst match_App_simps) | |
| 677 | apply (simp only: option.cases) | |
| 678 | apply (simp only: prod.cases) | |
| 679 | apply (simp only: lam.perm) | |
| 680 | apply (subst (3) subst.simps) | |
| 681 | apply (subst match_Var_simps) | |
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 682 | apply (simp only: option.cases) | 
| 2165 | 683 | apply (subst match_App_simps) | 
| 684 | apply (simp only: option.cases) | |
| 685 | apply (simp only: prod.cases) | |
| 686 | apply (subst 1(2)[of "(l, r)" "l" "r"]) | |
| 687 | apply (simp add: match_Var_simps) | |
| 688 | apply (simp add: match_App_simps) | |
| 689 | apply (rule refl) | |
| 690 | apply (subst 1(3)[of "(l, r)" "l" "r"]) | |
| 691 | apply (simp add: match_Var_simps) | |
| 692 | apply (simp add: match_App_simps) | |
| 693 | apply (rule refl) | |
| 694 | apply (rule refl) | |
| 695 | done | |
| 696 | next | |
| 697 | fix n t' | |
| 698 | assume "t = Lam n t'" | |
| 699 | then show ?thesis | |
| 700 | apply (simp only: ) | |
| 701 | apply (simp only: lam.perm) | |
| 702 | apply (subst subst.simps) | |
| 703 | apply (subst match_Var_simps) | |
| 704 | apply (simp only: option.cases) | |
| 705 | apply (subst match_App_simps) | |
| 706 | apply (simp only: option.cases) | |
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 707 | apply (rule_tac t="Lam n t'" and s="Lam (new ((v, s), Lam n t')) ((n \<leftrightarrow> new ((v, s), Lam n t')) \<bullet> t')" in subst) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 708 | defer | 
| 2165 | 709 | apply (subst match_Lam_simps) | 
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 710 | defer | 
| 2165 | 711 | apply (simp only: option.cases) | 
| 712 | apply (simp only: prod.cases) | |
| 713 | apply (subst (2) subst.simps) | |
| 714 | apply (subst match_Var_simps) | |
| 715 | apply (simp only: option.cases) | |
| 716 | apply (subst match_App_simps) | |
| 717 | apply (simp only: option.cases) | |
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 718 | apply (rule_tac t="Lam (p \<bullet> n) (p \<bullet> t')" and s="Lam (new ((p \<bullet> v, p \<bullet> s), Lam (p \<bullet> n) (p \<bullet> t'))) (((p \<bullet> n) \<leftrightarrow> new ((p \<bullet> v, p \<bullet> s), Lam (p \<bullet> n) (p \<bullet> t'))) \<bullet> t')" in subst) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 719 | defer | 
| 2165 | 720 | apply (subst match_Lam_simps) | 
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 721 | defer | 
| 2165 | 722 | apply (simp only: option.cases) | 
| 723 | apply (simp only: prod.cases) | |
| 724 | apply (simp only: lam.perm) | |
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 725 | thm 1(1) | 
| 2165 | 726 | sorry | 
| 727 | qed | |
| 728 | qed | |
| 729 | ||
| 2172 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 730 | lemma subst_proper_eqs: | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 731 | "subst y s (Var x) = (if x = y then s else (Var x))" | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 732 | "subst y s (App l r) = App (subst y s l) (subst y s r)" | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 733 | "atom x \<sharp> (t, s) \<Longrightarrow> subst y s (Lam x t) = Lam x (subst y s t)" | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 734 | apply (subst subst.simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 735 | apply (simp only: match_Var_simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 736 | apply (simp only: option.simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 737 | apply (subst subst.simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 738 | apply (simp only: match_App_simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 739 | apply (simp only: option.simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 740 | apply (simp only: prod.simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 741 | apply (simp only: match_Var_simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 742 | apply (simp only: option.simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 743 | apply (subst subst.simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 744 | apply (simp only: match_Var_simps) | 
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 745 | apply (simp only: option.simps) | 
| 2172 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 746 | apply (simp only: match_App_simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 747 | apply (simp only: option.simps) | 
| 2173 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 748 | apply (rule_tac t="Lam x t" and s="Lam (new ((y, s), Lam x t)) ((x \<leftrightarrow> new ((y, s), Lam x t)) \<bullet> t)" in subst) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 749 | defer | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 750 | apply (subst match_Lam_simps) | 
| 
477293d841e8
Match_Lam defined on Quotient Level.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2172diff
changeset | 751 | defer | 
| 2172 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 752 | apply (simp only: option.simps) | 
| 
fd5eec72c3f5
More on Function-defined subst.
 Cezary Kaliszyk <kaliszyk@in.tum.de> parents: 
2170diff
changeset | 753 | apply (simp only: prod.simps) | 
| 2157 | 754 | sorry | 
| 755 | ||
| 1594 | 756 | end | 
| 757 | ||
| 758 | ||
| 759 |