# HG changeset patch # User wenzelm # Date 1004562337 -3600 # Node ID 1a3a7b3cd9bb28501d62f90c02fd6a2c4143818a # Parent e1d4df962ac973798dbd7074912cf7251fdb184a tuned notation (degree instead of dollar); diff -r e1d4df962ac9 -r 1a3a7b3cd9bb src/HOL/Lambda/Eta.thy --- a/src/HOL/Lambda/Eta.thy Wed Oct 31 22:04:29 2001 +0100 +++ b/src/HOL/Lambda/Eta.thy Wed Oct 31 22:05:37 2001 +0100 @@ -15,7 +15,7 @@ free :: "dB => nat => bool" primrec "free (Var j) i = (j = i)" - "free (s $ t) i = (free s i \ free t i)" + "free (s \ t) i = (free s i \ free t i)" "free (Abs s) i = free s (i + 1)" consts @@ -32,14 +32,14 @@ inductive eta intros - eta [simp, intro]: "\ free s 0 ==> Abs (s $ Var 0) -e> s[dummy/0]" - appL [simp, intro]: "s -e> t ==> s $ u -e> t $ u" - appR [simp, intro]: "s -e> t ==> u $ s -e> u $ t" + eta [simp, intro]: "\ free s 0 ==> Abs (s \ Var 0) -e> s[dummy/0]" + appL [simp, intro]: "s -e> t ==> s \ u -e> t \ u" + appR [simp, intro]: "s -e> t ==> u \ s -e> u \ t" abs [simp, intro]: "s -e> t ==> Abs s -e> Abs t" inductive_cases eta_cases [elim!]: "Abs s -e> z" - "s $ t -e> u" + "s \ t -e> u" "Var i -e> t" @@ -118,18 +118,18 @@ apply (blast intro: rtrancl_refl rtrancl_into_rtrancl)+ done -lemma rtrancl_eta_AppL: "s -e>> s' ==> s $ t -e>> s' $ t" +lemma rtrancl_eta_AppL: "s -e>> s' ==> s \ t -e>> s' \ t" apply (erule rtrancl_induct) apply (blast intro: rtrancl_refl rtrancl_into_rtrancl)+ done -lemma rtrancl_eta_AppR: "t -e>> t' ==> s $ t -e>> s $ t'" +lemma rtrancl_eta_AppR: "t -e>> t' ==> s \ t -e>> s \ t'" apply (erule rtrancl_induct) apply (blast intro: rtrancl_refl rtrancl_into_rtrancl)+ done lemma rtrancl_eta_App: - "[| s -e>> s'; t -e>> t' |] ==> s $ t -e>> s' $ t'" + "[| s -e>> s'; t -e>> t' |] ==> s \ t -e>> s' \ t'" apply (blast intro!: rtrancl_eta_AppL rtrancl_eta_AppR intro: rtrancl_trans) done @@ -189,7 +189,7 @@ subsection "Implicit definition of eta" -text {* @{term "Abs (lift s 0 $ Var 0) -e> s"} *} +text {* @{term "Abs (lift s 0 \ Var 0) -e> s"} *} lemma not_free_iff_lifted [rule_format]: "\i. (\ free s i) = (\t. s = lift t i)" @@ -218,7 +218,7 @@ apply (rule iffI) apply (elim conjE exE) apply (rename_tac u1 u2) - apply (rule_tac x = "u1 $ u2" in exI) + apply (rule_tac x = "u1 \ u2" in exI) apply simp apply (erule exE) apply (erule rev_mp) @@ -244,8 +244,8 @@ done theorem explicit_is_implicit: - "(\s u. (\ free s 0) --> R (Abs (s $ Var 0)) (s[u/0])) = - (\s. R (Abs (lift s 0 $ Var 0)) s)" + "(\s u. (\ free s 0) --> R (Abs (s \ Var 0)) (s[u/0])) = + (\s. R (Abs (lift s 0 \ Var 0)) s)" apply (auto simp add: not_free_iff_lifted) done diff -r e1d4df962ac9 -r 1a3a7b3cd9bb src/HOL/Lambda/InductTermi.thy --- a/src/HOL/Lambda/InductTermi.thy Wed Oct 31 22:04:29 2001 +0100 +++ b/src/HOL/Lambda/InductTermi.thy Wed Oct 31 22:05:37 2001 +0100 @@ -19,16 +19,16 @@ inductive IT intros - Var [intro]: "rs : lists IT ==> Var n $$ rs : IT" + Var [intro]: "rs : lists IT ==> Var n \\ rs : IT" Lambda [intro]: "r : IT ==> Abs r : IT" - Beta [intro]: "(r[s/0]) $$ ss : IT ==> s : IT ==> (Abs r $ s) $$ ss : IT" + Beta [intro]: "(r[s/0]) \\ ss : IT ==> s : IT ==> (Abs r \ s) \\ ss : IT" subsection {* Every term in IT terminates *} lemma double_induction_lemma [rule_format]: "s : termi beta ==> \t. t : termi beta --> - (\r ss. t = r[s/0] $$ ss --> Abs r $ s $$ ss : termi beta)" + (\r ss. t = r[s/0] \\ ss --> Abs r \ s \\ ss : termi beta)" apply (erule acc_induct) apply (erule thin_rl) apply (rule allI) @@ -65,19 +65,19 @@ declare Var_apps_neq_Abs_apps [THEN not_sym, simp] -lemma [simp, THEN not_sym, simp]: "Var n $$ ss \ Abs r $ s $$ ts" +lemma [simp, THEN not_sym, simp]: "Var n \\ ss \ Abs r \ s \\ ts" apply (simp add: foldl_Cons [symmetric] del: foldl_Cons) done lemma [simp]: - "(Abs r $ s $$ ss = Abs r' $ s' $$ ss') = (r = r' \ s = s' \ ss = ss')" + "(Abs r \ s \\ ss = Abs r' \ s' \\ ss') = (r = r' \ s = s' \ ss = ss')" apply (simp add: foldl_Cons [symmetric] del: foldl_Cons) done inductive_cases [elim!]: - "Var n $$ ss : IT" + "Var n \\ ss : IT" "Abs t : IT" - "Abs r $ s $$ ts : IT" + "Abs r \ s \\ ts : IT" theorem termi_implies_IT: "r : termi beta ==> r : IT" apply (erule acc_induct) @@ -96,7 +96,7 @@ apply (drule ex_step1I, assumption) apply clarify apply (rename_tac us) - apply (erule_tac x = "Var n $$ us" in allE) + apply (erule_tac x = "Var n \\ us" in allE) apply force apply (rename_tac u ts) apply (case_tac ts) @@ -110,7 +110,7 @@ apply (erule mp) apply clarify apply (rename_tac t) - apply (erule_tac x = "Abs u $ t $$ ss" in allE) + apply (erule_tac x = "Abs u \ t \\ ss" in allE) apply force done diff -r e1d4df962ac9 -r 1a3a7b3cd9bb src/HOL/Lambda/Lambda.thy --- a/src/HOL/Lambda/Lambda.thy Wed Oct 31 22:04:29 2001 +0100 +++ b/src/HOL/Lambda/Lambda.thy Wed Oct 31 22:05:37 2001 +0100 @@ -13,25 +13,22 @@ datatype dB = Var nat - | App dB dB (infixl "$" 200) + | App dB dB (infixl "\" 200) | Abs dB -syntax (symbols) - App :: "dB => dB => dB" (infixl "\<^sub>\" 200) - consts subst :: "[dB, dB, nat] => dB" ("_[_'/_]" [300, 0, 0] 300) lift :: "[dB, nat] => dB" primrec "lift (Var i) k = (if i < k then Var i else Var (i + 1))" - "lift (s $ t) k = lift s k $ lift t k" + "lift (s \ t) k = lift s k \ lift t k" "lift (Abs s) k = Abs (lift s (k + 1))" primrec (* FIXME base names *) subst_Var: "(Var i)[s/k] = (if k < i then Var (i - 1) else if i = k then s else Var i)" - subst_App: "(t $ u)[s/k] = t[s/k] $ u[s/k]" + subst_App: "(t \ u)[s/k] = t[s/k] \ u[s/k]" subst_Abs: "(Abs t)[s/k] = Abs (t[lift s 0 / k+1])" declare subst_Var [simp del] @@ -44,13 +41,13 @@ primrec "liftn n (Var i) k = (if i < k then Var i else Var (i + n))" - "liftn n (s $ t) k = liftn n s k $ liftn n t k" + "liftn n (s \ t) k = liftn n s k \ liftn n t k" "liftn n (Abs s) k = Abs (liftn n s (k + 1))" primrec "substn (Var i) s k = (if k < i then Var (i - 1) else if i = k then liftn k s 0 else Var i)" - "substn (t $ u) s k = substn t s k $ substn u s k" + "substn (t \ u) s k = substn t s k \ substn u s k" "substn (Abs t) s k = Abs (substn t s (k + 1))" @@ -68,15 +65,15 @@ inductive beta intros - beta [simp, intro!]: "Abs s $ t -> s[t/0]" - appL [simp, intro!]: "s -> t ==> s $ u -> t $ u" - appR [simp, intro!]: "s -> t ==> u $ s -> u $ t" + beta [simp, intro!]: "Abs s \ t -> s[t/0]" + appL [simp, intro!]: "s -> t ==> s \ u -> t \ u" + appR [simp, intro!]: "s -> t ==> u \ s -> u \ t" abs [simp, intro!]: "s -> t ==> Abs s -> Abs t" inductive_cases beta_cases [elim!]: "Var i -> t" "Abs r -> s" - "s $ t -> u" + "s \ t -> u" declare if_not_P [simp] not_less_eq [simp] -- {* don't add @{text "r_into_rtrancl[intro!]"} *} @@ -91,19 +88,19 @@ done lemma rtrancl_beta_AppL: - "s ->> s' ==> s $ t ->> s' $ t" + "s ->> s' ==> s \ t ->> s' \ t" apply (erule rtrancl_induct) apply (blast intro: rtrancl_into_rtrancl)+ done lemma rtrancl_beta_AppR: - "t ->> t' ==> s $ t ->> s $ t'" + "t ->> t' ==> s \ t ->> s \ t'" apply (erule rtrancl_induct) apply (blast intro: rtrancl_into_rtrancl)+ done lemma rtrancl_beta_App [intro]: - "[| s ->> s'; t ->> t' |] ==> s $ t ->> s' $ t'" + "[| s ->> s'; t ->> t' |] ==> s \ t ->> s' \ t'" apply (blast intro!: rtrancl_beta_AppL rtrancl_beta_AppR intro: rtrancl_trans) done diff -r e1d4df962ac9 -r 1a3a7b3cd9bb src/HOL/Lambda/ListApplication.thy --- a/src/HOL/Lambda/ListApplication.thy Wed Oct 31 22:04:29 2001 +0100 +++ b/src/HOL/Lambda/ListApplication.thy Wed Oct 31 22:05:37 2001 +0100 @@ -9,26 +9,23 @@ theory ListApplication = Lambda: syntax - "_list_application" :: "dB => dB list => dB" (infixl "$$" 150) -syntax (symbols) - "_list_application" :: "dB => dB list => dB" (infixl "\<^sub>\\<^sub>\" 150) + "_list_application" :: "dB => dB list => dB" (infixl "\\" 150) +translations + "t \\ ts" == "foldl (op \) t ts" -translations - "t $$ ts" == "foldl (op $) t ts" - -lemma apps_eq_tail_conv [iff]: "(r $$ ts = s $$ ts) = (r = s)" +lemma apps_eq_tail_conv [iff]: "(r \\ ts = s \\ ts) = (r = s)" apply (induct_tac ts rule: rev_induct) apply auto done lemma Var_eq_apps_conv [rule_format, iff]: - "\s. (Var m = s $$ ss) = (Var m = s \ ss = [])" + "\s. (Var m = s \\ ss) = (Var m = s \ ss = [])" apply (induct_tac ss) apply auto done lemma Var_apps_eq_Var_apps_conv [rule_format, iff]: - "\ss. (Var m $$ rs = Var n $$ ss) = (m = n \ rs = ss)" + "\ss. (Var m \\ rs = Var n \\ ss) = (m = n \ rs = ss)" apply (induct_tac rs rule: rev_induct) apply simp apply blast @@ -38,26 +35,26 @@ done lemma App_eq_foldl_conv: - "(r $ s = t $$ ts) = - (if ts = [] then r $ s = t - else (\ss. ts = ss @ [s] \ r = t $$ ss))" + "(r \ s = t \\ ts) = + (if ts = [] then r \ s = t + else (\ss. ts = ss @ [s] \ r = t \\ ss))" apply (rule_tac xs = ts in rev_exhaust) apply auto done lemma Abs_eq_apps_conv [iff]: - "(Abs r = s $$ ss) = (Abs r = s \ ss = [])" + "(Abs r = s \\ ss) = (Abs r = s \ ss = [])" apply (induct_tac ss rule: rev_induct) apply auto done -lemma apps_eq_Abs_conv [iff]: "(s $$ ss = Abs r) = (s = Abs r \ ss = [])" +lemma apps_eq_Abs_conv [iff]: "(s \\ ss = Abs r) = (s = Abs r \ ss = [])" apply (induct_tac ss rule: rev_induct) apply auto done lemma Abs_apps_eq_Abs_apps_conv [iff]: - "\ss. (Abs r $$ rs = Abs s $$ ss) = (r = s \ rs = ss)" + "\ss. (Abs r \\ rs = Abs s \\ ss) = (r = s \ rs = ss)" apply (induct_tac rs rule: rev_induct) apply simp apply blast @@ -67,13 +64,13 @@ done lemma Abs_App_neq_Var_apps [iff]: - "\s t. Abs s $ t ~= Var n $$ ss" + "\s t. Abs s \ t ~= Var n \\ ss" apply (induct_tac ss rule: rev_induct) apply auto done lemma Var_apps_neq_Abs_apps [rule_format, iff]: - "\ts. Var n $$ ts ~= Abs r $$ ss" + "\ts. Var n \\ ts ~= Abs r \\ ss" apply (induct_tac ss rule: rev_induct) apply simp apply (rule allI) @@ -82,19 +79,19 @@ done lemma ex_head_tail: - "\ts h. t = h $$ ts \ ((\n. h = Var n) \ (\u. h = Abs u))" + "\ts h. t = h \\ ts \ ((\n. h = Var n) \ (\u. h = Abs u))" apply (induct_tac t) apply (rule_tac x = "[]" in exI) apply simp apply clarify apply (rename_tac ts1 ts2 h1 h2) - apply (rule_tac x = "ts1 @ [h2 $$ ts2]" in exI) + apply (rule_tac x = "ts1 @ [h2 \\ ts2]" in exI) apply simp apply simp done lemma size_apps [simp]: - "size (r $$ rs) = size r + foldl (op +) 0 (map size rs) + length rs" + "size (r \\ rs) = size r + foldl (op +) 0 (map size rs) + length rs" apply (induct_tac rs rule: rev_induct) apply auto done @@ -104,11 +101,11 @@ done -text {* \medskip A customized induction schema for @{text "$$"}. *} +text {* \medskip A customized induction schema for @{text "\\"}. *} lemma lem [rule_format (no_asm)]: - "[| !!n ts. \t \ set ts. P t ==> P (Var n $$ ts); - !!u ts. [| P u; \t \ set ts. P t |] ==> P (Abs u $$ ts) + "[| !!n ts. \t \ set ts. P t ==> P (Var n \\ ts); + !!u ts. [| P u; \t \ set ts. P t |] ==> P (Abs u \\ ts) |] ==> \t. size t = n --> P t" proof - case rule_context @@ -149,8 +146,8 @@ qed theorem Apps_dB_induct: - "[| !!n ts. \t \ set ts. P t ==> P (Var n $$ ts); - !!u ts. [| P u; \t \ set ts. P t |] ==> P (Abs u $$ ts) + "[| !!n ts. \t \ set ts. P t ==> P (Var n \\ ts); + !!u ts. [| P u; \t \ set ts. P t |] ==> P (Abs u \\ ts) |] ==> P t" proof - case rule_context diff -r e1d4df962ac9 -r 1a3a7b3cd9bb src/HOL/Lambda/ListBeta.thy --- a/src/HOL/Lambda/ListBeta.thy Wed Oct 31 22:04:29 2001 +0100 +++ b/src/HOL/Lambda/ListBeta.thy Wed Oct 31 22:05:37 2001 +0100 @@ -18,7 +18,7 @@ "rs => ss" == "(rs, ss) : step1 beta" lemma head_Var_reduction_aux: - "v -> v' ==> \rs. v = Var n $$ rs --> (\ss. rs => ss \ v' = Var n $$ ss)" + "v -> v' ==> \rs. v = Var n \\ rs --> (\ss. rs => ss \ v' = Var n \\ ss)" apply (erule beta.induct) apply simp apply (rule allI) @@ -32,16 +32,16 @@ done lemma head_Var_reduction: - "Var n $$ rs -> v ==> (\ss. rs => ss \ v = Var n $$ ss)" + "Var n \\ rs -> v ==> (\ss. rs => ss \ v = Var n \\ ss)" apply (drule head_Var_reduction_aux) apply blast done lemma apps_betasE_aux: - "u -> u' ==> \r rs. u = r $$ rs --> - ((\r'. r -> r' \ u' = r' $$ rs) \ - (\rs'. rs => rs' \ u' = r $$ rs') \ - (\s t ts. r = Abs s \ rs = t # ts \ u' = s[t/0] $$ ts))" + "u -> u' ==> \r rs. u = r \\ rs --> + ((\r'. r -> r' \ u' = r' \\ rs) \ + (\rs'. rs => rs' \ u' = r \\ rs') \ + (\s t ts. r = Abs s \ rs = t # ts \ u' = s[t/0] \\ ts))" apply (erule beta.induct) apply (clarify del: disjCI) apply (case_tac r) @@ -70,12 +70,12 @@ done lemma apps_betasE [elim!]: - "[| r $$ rs -> s; !!r'. [| r -> r'; s = r' $$ rs |] ==> R; - !!rs'. [| rs => rs'; s = r $$ rs' |] ==> R; - !!t u us. [| r = Abs t; rs = u # us; s = t[u/0] $$ us |] ==> R |] + "[| r \\ rs -> s; !!r'. [| r -> r'; s = r' \\ rs |] ==> R; + !!rs'. [| rs => rs'; s = r \\ rs' |] ==> R; + !!t u us. [| r = Abs t; rs = u # us; s = t[u/0] \\ us |] ==> R |] ==> R" proof - - assume major: "r $$ rs -> s" + assume major: "r \\ rs -> s" case rule_context show ?thesis apply (cut_tac major [THEN apps_betasE_aux, THEN spec, THEN spec]) @@ -84,20 +84,20 @@ qed lemma apps_preserves_beta [simp]: - "r -> s ==> r $$ ss -> s $$ ss" + "r -> s ==> r \\ ss -> s \\ ss" apply (induct_tac ss rule: rev_induct) apply auto done lemma apps_preserves_beta2 [simp]: - "r ->> s ==> r $$ ss ->> s $$ ss" + "r ->> s ==> r \\ ss ->> s \\ ss" apply (erule rtrancl_induct) apply blast apply (blast intro: apps_preserves_beta rtrancl_into_rtrancl) done lemma apps_preserves_betas [rule_format, simp]: - "\ss. rs => ss --> r $$ rs -> r $$ ss" + "\ss. rs => ss --> r \\ rs -> r \\ ss" apply (induct_tac rs rule: rev_induct) apply simp apply simp diff -r e1d4df962ac9 -r 1a3a7b3cd9bb src/HOL/Lambda/ParRed.thy --- a/src/HOL/Lambda/ParRed.thy Wed Oct 31 22:04:29 2001 +0100 +++ b/src/HOL/Lambda/ParRed.thy Wed Oct 31 22:05:37 2001 +0100 @@ -26,14 +26,14 @@ intros var [simp, intro!]: "Var n => Var n" abs [simp, intro!]: "s => t ==> Abs s => Abs t" - app [simp, intro!]: "[| s => s'; t => t' |] ==> s $ t => s' $ t'" - beta [simp, intro!]: "[| s => s'; t => t' |] ==> (Abs s) $ t => s'[t'/0]" + app [simp, intro!]: "[| s => s'; t => t' |] ==> s \ t => s' \ t'" + beta [simp, intro!]: "[| s => s'; t => t' |] ==> (Abs s) \ t => s'[t'/0]" inductive_cases par_beta_cases [elim!]: "Var n => t" "Abs s => Abs t" - "(Abs s) $ t => u" - "s $ t => u" + "(Abs s) \ t => u" + "s \ t => u" "Abs s => t" @@ -105,9 +105,9 @@ "cd" :: "dB => dB" recdef "cd" "measure size" "cd (Var n) = Var n" - "cd (Var n $ t) = Var n $ cd t" - "cd ((s1 $ s2) $ t) = cd (s1 $ s2) $ cd t" - "cd (Abs u $ t) = (cd u)[cd t/0]" + "cd (Var n \ t) = Var n \ cd t" + "cd ((s1 \ s2) \ t) = cd (s1 \ s2) \ cd t" + "cd (Abs u \ t) = (cd u)[cd t/0]" "cd (Abs s) = Abs (cd s)" lemma par_beta_cd [rule_format]: diff -r e1d4df962ac9 -r 1a3a7b3cd9bb src/HOL/Lambda/Type.thy --- a/src/HOL/Lambda/Type.thy Wed Oct 31 22:04:29 2001 +0100 +++ b/src/HOL/Lambda/Type.thy Wed Oct 31 22:05:37 2001 +0100 @@ -18,8 +18,10 @@ subsection {* Environments *} constdefs + shift :: "(nat \ 'a) \ nat \ 'a \ nat \ 'a" ("_<_:_>" [90, 0, 0] 91) + "e \ \j. if j < i then e j else if j = i then a else e (j - 1)" +syntax (symbols) shift :: "(nat \ 'a) \ nat \ 'a \ nat \ 'a" ("_\_:_\" [90, 0, 0] 91) - "e\i:a\ \ \j. if j < i then e j else if j = i then a else e (j - 1)" lemma shift_eq [simp]: "i = j \ (e\i:T\) j = T" by (simp add: shift_def) @@ -69,11 +71,11 @@ intros Var [intro!]: "env x = T \ env \ Var x : T" Abs [intro!]: "env\0:T\ \ t : U \ env \ Abs t : (T \ U)" - App [intro!]: "env \ s : T \ U \ env \ t : T \ env \ (s \<^sub>\ t) : U" + App [intro!]: "env \ s : T \ U \ env \ t : T \ env \ (s \ t) : U" inductive_cases typing_elims [elim!]: "e \ Var i : T" - "e \ t \<^sub>\ u : T" + "e \ t \ u : T" "e \ Abs t : T" primrec @@ -86,44 +88,44 @@ subsection {* Some examples *} -lemma "e \ Abs (Abs (Abs (Var 1 \<^sub>\ (Var 2 \<^sub>\ Var 1 \<^sub>\ Var 0)))) : ?T" +lemma "e \ Abs (Abs (Abs (Var 1 \ (Var 2 \ Var 1 \ Var 0)))) : ?T" by force -lemma "e \ Abs (Abs (Abs (Var 2 \<^sub>\ Var 0 \<^sub>\ (Var 1 \<^sub>\ Var 0)))) : ?T" +lemma "e \ Abs (Abs (Abs (Var 2 \ Var 0 \ (Var 1 \ Var 0)))) : ?T" by force subsection {* n-ary function types *} lemma list_app_typeD: - "\t T. e \ t \<^sub>\\<^sub>\ ts : T \ \Ts. e \ t : Ts \ T \ e \ ts : Ts" + "\t T. e \ t \\ ts : T \ \Ts. e \ t : Ts \ T \ e \ ts : Ts" apply (induct ts) apply simp apply atomize apply simp - apply (erule_tac x = "t \<^sub>\ a" in allE) + apply (erule_tac x = "t \ a" in allE) apply (erule_tac x = T in allE) apply (erule impE) apply assumption apply (elim exE conjE) - apply (ind_cases "e \ t \<^sub>\ u : T") + apply (ind_cases "e \ t \ u : T") apply (rule_tac x = "Ta # Ts" in exI) apply simp done lemma list_app_typeE: - "e \ t \<^sub>\\<^sub>\ ts : T \ (\Ts. e \ t : Ts \ T \ e \ ts : Ts \ C) \ C" + "e \ t \\ ts : T \ (\Ts. e \ t : Ts \ T \ e \ ts : Ts \ C) \ C" by (insert list_app_typeD) fast lemma list_app_typeI: - "\t T Ts. e \ t : Ts \ T \ e \ ts : Ts \ e \ t \<^sub>\\<^sub>\ ts : T" + "\t T Ts. e \ t : Ts \ T \ e \ ts : Ts \ e \ t \\ ts : T" apply (induct ts) apply simp apply atomize apply (case_tac Ts) apply simp apply simp - apply (erule_tac x = "t \<^sub>\ a" in allE) + apply (erule_tac x = "t \ a" in allE) apply (erule_tac x = T in allE) apply (erule_tac x = lista in allE) apply (erule impE) @@ -152,11 +154,11 @@ subsection {* Lifting preserves termination and well-typedness *} lemma lift_map [simp]: - "\t. lift (t \<^sub>\\<^sub>\ ts) i = lift t i \<^sub>\\<^sub>\ map (\t. lift t i) ts" + "\t. lift (t \\ ts) i = lift t i \\ map (\t. lift t i) ts" by (induct ts) simp_all lemma subst_map [simp]: - "\t. subst (t \<^sub>\\<^sub>\ ts) u i = subst t u i \<^sub>\\<^sub>\ map (\t. subst t u i) ts" + "\t. subst (t \\ ts) u i = subst t u i \\ map (\t. subst t u i) ts" by (induct ts) simp_all lemma lift_IT [intro!]: "t \ IT \ (\i. lift t i \ IT)" @@ -206,39 +208,19 @@ apply blast done -lemma substs_lemma [rule_format]: - "e \ u : T \ \Ts. e\i:T\ \ ts : Ts \ +lemma substs_lemma: + "\Ts. e \ u : T \ e\i:T\ \ ts : Ts \ e \ (map (\t. t[u/i]) ts) : Ts" - apply (induct_tac ts) - apply (intro strip) + apply (induct ts) apply (case_tac Ts) apply simp apply simp - apply (intro strip) + apply atomize apply (case_tac Ts) apply simp apply simp apply (erule conjE) - apply (erule subst_lemma) - apply assumption - apply (rule refl) - done - -lemma substs_lemma [rule_format]: - "e \ u : T \ \Ts. e\i:T\ \ ts : Ts \ - e \ (map (\t. t[u/i]) ts) : Ts" - apply (induct_tac ts) - apply (intro strip) - apply (case_tac Ts) - apply simp - apply simp - apply (intro strip) - apply (case_tac Ts) - apply simp - apply simp - apply (erule conjE) - apply (erule subst_lemma) - apply assumption + apply (erule (1) subst_lemma) apply (rule refl) done @@ -250,7 +232,7 @@ apply blast apply blast apply atomize - apply (ind_cases "s \<^sub>\ t -> t'") + apply (ind_cases "s \ t -> t'") apply hypsubst apply (ind_cases "env \ Abs t : T \ U") apply (rule subst_lemma) @@ -264,13 +246,12 @@ subsection {* Additional lemmas *} -lemma app_last: "(t \<^sub>\\<^sub>\ ts) \<^sub>\ u = t \<^sub>\\<^sub>\ (ts @ [u])" +lemma app_last: "(t \\ ts) \ u = t \\ (ts @ [u])" by simp lemma subst_Var_IT: "r \ IT \ (\i j. r[Var i/j] \ IT)" apply (induct set: IT) txt {* Case @{term Var}: *} - apply atomize apply (simp (no_asm) add: subst_Var) apply ((rule conjI impI)+, @@ -297,13 +278,13 @@ done lemma Var_IT: "Var n \ IT" - apply (subgoal_tac "Var n \<^sub>\\<^sub>\ [] \ IT") + apply (subgoal_tac "Var n \\ [] \ IT") apply simp apply (rule IT.Var) apply (rule lists.Nil) done -lemma app_Var_IT: "t \ IT \ t \<^sub>\ Var i \ IT" +lemma app_Var_IT: "t \ IT \ t \ Var i \ IT" apply (induct set: IT) apply (subst app_last) apply (rule IT.Var) @@ -355,11 +336,11 @@ assume uT: "e \ u : T" { case (Var n rs) - assume nT: "e\i:T\ \ Var n \<^sub>\\<^sub>\ rs : T'" + assume nT: "e\i:T\ \ Var n \\ rs : T'" let ?ty = "{t. \T'. e\i:T\ \ t : T'}" let ?R = "\t. \e T' u i. e\i:T\ \ t : T' \ u \ IT \ e \ u : T \ t[u/i] \ IT" - show "(Var n \<^sub>\\<^sub>\ rs)[u/i] \ IT" + show "(Var n \\ rs)[u/i] \ IT" proof (cases "n = i") case True show ?thesis @@ -368,9 +349,9 @@ with uIT True show ?thesis by simp next case (Cons a as) - with nT have "e\i:T\ \ Var n \<^sub>\ a \<^sub>\\<^sub>\ as : T'" by simp + with nT have "e\i:T\ \ Var n \ a \\ as : T'" by simp then obtain Ts - where headT: "e\i:T\ \ Var n \<^sub>\ a : Ts \ T'" + where headT: "e\i:T\ \ Var n \ a : Ts \ T'" and argsT: "e\i:T\ \ as : Ts" by (rule list_app_typeE) from headT obtain T'' @@ -380,14 +361,14 @@ from varT True have T: "T = T'' \ Ts \ T'" by cases auto with uT have uT': "e \ u : T'' \ Ts \ T'" by simp - from T have "(Var 0 \<^sub>\\<^sub>\ map (\t. lift t 0) - (map (\t. t[u/i]) as))[(u \<^sub>\ a[u/i])/0] \ IT" + from T have "(Var 0 \\ map (\t. lift t 0) + (map (\t. t[u/i]) as))[(u \ a[u/i])/0] \ IT" proof (rule MI2) - from T have "(lift u 0 \<^sub>\ Var 0)[a[u/i]/0] \ IT" + from T have "(lift u 0 \ Var 0)[a[u/i]/0] \ IT" proof (rule MI1) have "lift u 0 \ IT" by (rule lift_IT) - thus "lift u 0 \<^sub>\ Var 0 \ IT" by (rule app_Var_IT) - show "e\0:T''\ \ lift u 0 \<^sub>\ Var 0 : Ts \ T'" + thus "lift u 0 \ Var 0 \ IT" by (rule app_Var_IT) + show "e\0:T''\ \ lift u 0 \ Var 0 : Ts \ T'" proof (rule typing.App) show "e\0:T''\ \ lift u 0 : T'' \ Ts \ T'" by (rule lift_type) (rule uT') @@ -399,7 +380,7 @@ from argT uT show "e \ a[u/i] : T''" by (rule subst_lemma) simp qed - thus "u \<^sub>\ a[u/i] \ IT" by simp + thus "u \ a[u/i] \ IT" by simp from Var have "as \ lists {t. ?R t}" by cases (simp_all add: Cons) moreover from argsT have "as \ lists ?ty" @@ -421,18 +402,18 @@ by (rule lists.Cons) (rule Cons) thus ?case by simp qed - thus "Var 0 \<^sub>\\<^sub>\ ?ls as \ IT" by (rule IT.Var) + thus "Var 0 \\ ?ls as \ IT" by (rule IT.Var) have "e\0:Ts \ T'\ \ Var 0 : Ts \ T'" by (rule typing.Var) simp moreover from uT argsT have "e \ map (\t. t[u/i]) as : Ts" by (rule substs_lemma) hence "e\0:Ts \ T'\ \ ?ls as : Ts" by (rule lift_typings) - ultimately show "e\0:Ts \ T'\ \ Var 0 \<^sub>\\<^sub>\ ?ls as : T'" + ultimately show "e\0:Ts \ T'\ \ Var 0 \\ ?ls as : T'" by (rule list_app_typeI) from argT uT have "e \ a[u/i] : T''" by (rule subst_lemma) (rule refl) - with uT' show "e \ u \<^sub>\ a[u/i] : Ts \ T'" + with uT' show "e \ u \ a[u/i] : Ts \ T'" by (rule typing.App) qed with Cons True show ?thesis @@ -469,25 +450,25 @@ by fastsimp next case (Beta r a as) - assume T: "e\i:T\ \ Abs r \<^sub>\ a \<^sub>\\<^sub>\ as : T'" - assume SI1: "\e T' u i. PROP ?Q (r[a/0] \<^sub>\\<^sub>\ as) e T' u i T" + assume T: "e\i:T\ \ Abs r \ a \\ as : T'" + assume SI1: "\e T' u i. PROP ?Q (r[a/0] \\ as) e T' u i T" assume SI2: "\e T' u i. PROP ?Q a e T' u i T" - have "Abs (r[lift u 0/Suc i]) \<^sub>\ a[u/i] \<^sub>\\<^sub>\ map (\t. t[u/i]) as \ IT" + have "Abs (r[lift u 0/Suc i]) \ a[u/i] \\ map (\t. t[u/i]) as \ IT" proof (rule IT.Beta) - have "Abs r \<^sub>\ a \<^sub>\\<^sub>\ as -> r[a/0] \<^sub>\\<^sub>\ as" + have "Abs r \ a \\ as -> r[a/0] \\ as" by (rule apps_preserves_beta) (rule beta.beta) - with T have "e\i:T\ \ r[a/0] \<^sub>\\<^sub>\ as : T'" + with T have "e\i:T\ \ r[a/0] \\ as : T'" by (rule subject_reduction) - hence "(r[a/0] \<^sub>\\<^sub>\ as)[u/i] \ IT" + hence "(r[a/0] \\ as)[u/i] \ IT" by (rule SI1) - thus "r[lift u 0/Suc i][a[u/i]/0] \<^sub>\\<^sub>\ map (\t. t[u/i]) as \ IT" + thus "r[lift u 0/Suc i][a[u/i]/0] \\ map (\t. t[u/i]) as \ IT" by (simp del: subst_map add: subst_subst subst_map [symmetric]) - from T obtain U where "e\i:T\ \ Abs r \<^sub>\ a : U" + from T obtain U where "e\i:T\ \ Abs r \ a : U" by (rule list_app_typeE) fast then obtain T'' where "e\i:T\ \ a : T''" by cases simp_all thus "a[u/i] \ IT" by (rule SI2) qed - thus "(Abs r \<^sub>\ a \<^sub>\\<^sub>\ as)[u/i] \ IT" by simp + thus "(Abs r \ a \\ as)[u/i] \ IT" by simp } qed qed @@ -506,18 +487,18 @@ show ?case by (rule IT.Lambda) next case (App T U e s t) - have "(Var 0 \<^sub>\ lift t 0)[s/0] \ IT" + have "(Var 0 \ lift t 0)[s/0] \ IT" proof (rule subst_type_IT) have "lift t 0 \ IT" by (rule lift_IT) hence "[lift t 0] \ lists IT" by (rule lists.Cons) (rule lists.Nil) - hence "Var 0 \<^sub>\\<^sub>\ [lift t 0] \ IT" by (rule IT.Var) - also have "Var 0 \<^sub>\\<^sub>\ [lift t 0] = Var 0 \<^sub>\ lift t 0" by simp + hence "Var 0 \\ [lift t 0] \ IT" by (rule IT.Var) + also have "Var 0 \\ [lift t 0] = Var 0 \ lift t 0" by simp finally show "\ \ IT" . have "e\0:T \ U\ \ Var 0 : T \ U" by (rule typing.Var) simp moreover have "e\0:T \ U\ \ lift t 0 : T" by (rule lift_type) - ultimately show "e\0:T \ U\ \ Var 0 \<^sub>\ lift t 0 : U" + ultimately show "e\0:T \ U\ \ Var 0 \ lift t 0 : U" by (rule typing.App) qed thus ?case by simp