# HG changeset patch # User Andreas Lochbihler # Date 1338364493 -7200 # Node ID 72a8506dd59bfcda85b08be427ba0f7f610c69f9 # Parent 6c4b3e78f03e1cc3ac97d161c33e023e388e8da7 eliminated remaining sub- and superscripts in FinFun syntax diff -r 6c4b3e78f03e -r 72a8506dd59b src/HOL/Library/FinFun.thy --- a/src/HOL/Library/FinFun.thy Wed May 30 09:46:58 2012 +0200 +++ b/src/HOL/Library/FinFun.thy Wed May 30 09:54:53 2012 +0200 @@ -1045,8 +1045,8 @@ subsection {* A diagonal operator for FinFuns *} -definition finfun_Diag :: "'a \f 'b \ 'a \f 'c \ 'a \f ('b \ 'c)" ("(1'(_,/ _')\<^sup>f)" [0, 0] 1000) -where [code del]: "finfun_Diag f g = finfun_rec (\b. Pair b \$ g) (\a b c. c(a $:= (b, g $ a))) f" +definition finfun_Diag :: "'a \f 'b \ 'a \f 'c \ 'a \f ('b \ 'c)" ("(1'($_,/ _$'))" [0, 0] 1000) +where [code del]: "($f, g$) = finfun_rec (\b. Pair b \$ g) (\a b c. c(a $:= (b, g $ a))) f" interpretation finfun_Diag_aux: finfun_rec_wf_aux "\b. Pair b \$ g" "\a b c. c(a $:= (b, g $ a))" by(unfold_locales)(simp_all add: expand_finfun_eq fun_eq_iff finfun_upd_apply) @@ -1066,51 +1066,51 @@ by(simp add: finfun_const_def finfun_comp_conv_comp o_def) qed -lemma finfun_Diag_const1: "(K$ b, g)\<^sup>f = Pair b \$ g" +lemma finfun_Diag_const1: "($K$ b, g$) = Pair b \$ g" by(simp add: finfun_Diag_def) text {* - Do not use @{thm finfun_Diag_const1} for the code generator because @{term "Pair b"} is injective, i.e. if @{term g} is free of redundant updates, there is no need to check for redundant updates as is done for @{text "\\<^isub>f"}. + Do not use @{thm finfun_Diag_const1} for the code generator because @{term "Pair b"} is injective, i.e. if @{term g} is free of redundant updates, there is no need to check for redundant updates as is done for @{term "op \$"}. *} lemma finfun_Diag_const_code [code]: - "(K$ b, K$ c)\<^sup>f = (K$ (b, c))" - "(K$ b, finfun_update_code g a c)\<^sup>f = finfun_update_code (K$ b, g)\<^sup>f a (b, c)" + "($K$ b, K$ c$) = (K$ (b, c))" + "($K$ b, finfun_update_code g a c$) = finfun_update_code ($K$ b, g$) a (b, c)" by(simp_all add: finfun_Diag_const1) -lemma finfun_Diag_update1: "(f(a $:= b), g)\<^sup>f = (f, g)\<^sup>f(a $:= (b, g $ a))" - and finfun_Diag_update1_code [code]: "(finfun_update_code f a b, g)\<^sup>f = (f, g)\<^sup>f(a $:= (b, g $ a))" +lemma finfun_Diag_update1: "($f(a $:= b), g$) = ($f, g$)(a $:= (b, g $ a))" + and finfun_Diag_update1_code [code]: "($finfun_update_code f a b, g$) = ($f, g$)(a $:= (b, g $ a))" by(simp_all add: finfun_Diag_def) -lemma finfun_Diag_const2: "(f, K$ c)\<^sup>f = (\b. (b, c)) \$ f" +lemma finfun_Diag_const2: "($f, K$ c$) = (\b. (b, c)) \$ f" by(induct f rule: finfun_weak_induct)(auto intro!: finfun_ext simp add: finfun_upd_apply finfun_Diag_const1 finfun_Diag_update1) -lemma finfun_Diag_update2: "(f, g(a $:= c))\<^sup>f = (f, g)\<^sup>f(a $:= (f $ a, c))" +lemma finfun_Diag_update2: "($f, g(a $:= c)$) = ($f, g$)(a $:= (f $ a, c))" by(induct f rule: finfun_weak_induct)(auto intro!: finfun_ext simp add: finfun_upd_apply finfun_Diag_const1 finfun_Diag_update1) -lemma finfun_Diag_const_const [simp]: "(K$ b, K$ c)\<^sup>f = (K$ (b, c))" +lemma finfun_Diag_const_const [simp]: "($K$ b, K$ c$) = (K$ (b, c))" by(simp add: finfun_Diag_const1) lemma finfun_Diag_const_update: - "(K$ b, g(a $:= c))\<^sup>f = (K$ b, g)\<^sup>f(a $:= (b, c))" + "($K$ b, g(a $:= c)$) = ($K$ b, g$)(a $:= (b, c))" by(simp add: finfun_Diag_const1) lemma finfun_Diag_update_const: - "(f(a $:= b), K$ c)\<^sup>f = (f, K$ c)\<^sup>f(a $:= (b, c))" + "($f(a $:= b), K$ c$) = ($f, K$ c$)(a $:= (b, c))" by(simp add: finfun_Diag_def) lemma finfun_Diag_update_update: - "(f(a $:= b), g(a' $:= c))\<^sup>f = (if a = a' then (f, g)\<^sup>f(a $:= (b, c)) else (f, g)\<^sup>f(a $:= (b, g $ a))(a' $:= (f $ a', c)))" + "($f(a $:= b), g(a' $:= c)$) = (if a = a' then ($f, g$)(a $:= (b, c)) else ($f, g$)(a $:= (b, g $ a))(a' $:= (f $ a', c)))" by(auto simp add: finfun_Diag_update1 finfun_Diag_update2) -lemma finfun_Diag_apply [simp]: "op $ (f, g)\<^sup>f = (\x. (f $ x, g $ x))" +lemma finfun_Diag_apply [simp]: "op $ ($f, g$) = (\x. (f $ x, g $ x))" by(induct f rule: finfun_weak_induct)(auto simp add: finfun_Diag_const1 finfun_Diag_update1 finfun_upd_apply) lemma finfun_Diag_conv_Abs_finfun: - "(f, g)\<^sup>f = Abs_finfun ((\x. (f $ x, g $ x)))" + "($f, g$) = Abs_finfun ((\x. (f $ x, g $ x)))" including finfun proof - - have "(\f :: 'a \f 'b. (f, g)\<^sup>f) = (\f. Abs_finfun ((\x. (f $ x, g $ x))))" + have "(\f :: 'a \f 'b. ($f, g$)) = (\f. Abs_finfun ((\x. (f $ x, g $ x))))" proof(rule finfun_rec_unique) { fix c show "Abs_finfun (\x. ((K$ c) $ x, g $ x)) = Pair c \$ g" by(simp add: finfun_comp_conv_comp o_def finfun_const_def) } @@ -1122,7 +1122,7 @@ thus ?thesis by(auto simp add: fun_eq_iff) qed -lemma finfun_Diag_eq: "(f, g)\<^sup>f = (f', g')\<^sup>f \ f = f' \ g = g'" +lemma finfun_Diag_eq: "($f, g$) = ($f', g'$) \ f = f' \ g = g'" by(auto simp add: expand_finfun_eq fun_eq_iff) definition finfun_fst :: "'a \f ('b \ 'c) \ 'a \f 'b" @@ -1138,7 +1138,7 @@ lemma finfun_fst_comp_conv: "finfun_fst (f \$ g) = (fst \ f) \$ g" by(simp add: finfun_fst_def) -lemma finfun_fst_conv [simp]: "finfun_fst (f, g)\<^sup>f = f" +lemma finfun_fst_conv [simp]: "finfun_fst ($f, g$) = f" by(induct f rule: finfun_weak_induct)(simp_all add: finfun_Diag_const1 finfun_fst_comp_conv o_def finfun_Diag_update1 finfun_fst_update) lemma finfun_fst_conv_Abs_finfun: "finfun_fst = (\f. Abs_finfun (fst \ op $ f))" @@ -1158,7 +1158,7 @@ lemma finfun_snd_comp_conv: "finfun_snd (f \$ g) = (snd \ f) \$ g" by(simp add: finfun_snd_def) -lemma finfun_snd_conv [simp]: "finfun_snd (f, g)\<^sup>f = g" +lemma finfun_snd_conv [simp]: "finfun_snd ($f, g$) = g" apply(induct f rule: finfun_weak_induct) apply(auto simp add: finfun_Diag_const1 finfun_snd_comp_conv o_def finfun_Diag_update1 finfun_snd_update finfun_upd_apply intro: finfun_ext) done @@ -1166,7 +1166,7 @@ lemma finfun_snd_conv_Abs_finfun: "finfun_snd = (\f. Abs_finfun (snd \ op $ f))" by(simp add: finfun_snd_def [abs_def] finfun_comp_conv_comp) -lemma finfun_Diag_collapse [simp]: "(finfun_fst f, finfun_snd f)\<^sup>f = f" +lemma finfun_Diag_collapse [simp]: "($finfun_fst f, finfun_snd f$) = f" by(induct f rule: finfun_weak_induct)(simp_all add: finfun_fst_const finfun_snd_const finfun_fst_update finfun_snd_update finfun_Diag_update_update) subsection {* Currying for FinFuns *} @@ -1244,11 +1244,11 @@ subsection {* Executable equality for FinFuns *} -lemma eq_finfun_All_ext: "(f = g) \ finfun_All ((\(x, y). x = y) \$ (f, g)\<^sup>f)" +lemma eq_finfun_All_ext: "(f = g) \ finfun_All ((\(x, y). x = y) \$ ($f, g$))" by(simp add: expand_finfun_eq fun_eq_iff finfun_All_All o_def) instantiation finfun :: ("{card_UNIV,equal}",equal) equal begin -definition eq_finfun_def [code]: "HOL.equal f g \ finfun_All ((\(x, y). x = y) \$ (f, g)\<^sup>f)" +definition eq_finfun_def [code]: "HOL.equal f g \ finfun_All ((\(x, y). x = y) \$ ($f, g$))" instance by(intro_classes)(simp add: eq_finfun_All_ext eq_finfun_def) end diff -r 6c4b3e78f03e -r 72a8506dd59b src/HOL/ex/FinFunPred.thy --- a/src/HOL/ex/FinFunPred.thy Wed May 30 09:46:58 2012 +0200 +++ b/src/HOL/ex/FinFunPred.thy Wed May 30 09:54:53 2012 +0200 @@ -20,7 +20,7 @@ instance .. lemma le_finfun_code [code]: - "f \ g \ finfun_All ((\(x, y). x \ y) \$ (f, g)\<^sup>f)" + "f \ g \ finfun_All ((\(x, y). x \ y) \$ ($f, g$))" by(simp add: le_finfun_def finfun_All_All o_def) end @@ -48,7 +48,7 @@ by(auto simp add: top_finfun_def) instantiation "finfun" :: (type, inf) inf begin -definition [code]: "inf f g = (\(x, y). inf x y) \$ (f, g)\<^sup>f" +definition [code]: "inf f g = (\(x, y). inf x y) \$ ($f, g$)" instance .. end @@ -56,7 +56,7 @@ by(auto simp add: inf_finfun_def o_def inf_fun_def) instantiation "finfun" :: (type, sup) sup begin -definition [code]: "sup f g = (\(x, y). sup x y) \$ (f, g)\<^sup>f" +definition [code]: "sup f g = (\(x, y). sup x y) \$ ($f, g$)" instance .. end @@ -78,7 +78,7 @@ by(intro_classes)(simp add: sup_finfun_def inf_finfun_def expand_finfun_eq o_def sup_inf_distrib1) instantiation "finfun" :: (type, minus) minus begin -definition "f - g = split (op -) \$ (f, g)\<^sup>f" +definition "f - g = split (op -) \$ ($f, g$)" instance .. end