diff --git a/thys/Bicategory/Bicategory.thy b/thys/Bicategory/Bicategory.thy --- a/thys/Bicategory/Bicategory.thy +++ b/thys/Bicategory/Bicategory.thy @@ -1,2434 +1,2336 @@ (* Title: Bicategory Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) theory Bicategory imports Prebicategory Category3.Subcategory Category3.DiscreteCategory MonoidalCategory.MonoidalCategory begin section "Bicategories" text \ A \emph{bicategory} is a (vertical) category that has been equipped with a horizontal composition, an associativity natural isomorphism, and for each object a ``unit isomorphism'', such that horizontal composition on the left by target and on the right by source are fully faithful endofunctors of the vertical category, and such that the usual pentagon coherence condition holds for the associativity. \ locale bicategory = horizontal_composition V H src trg + \: natural_isomorphism VVV.comp V HoHV HoVH \\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))\ + L: fully_faithful_functor V V L + R: fully_faithful_functor V V R for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" + assumes unit_in_vhom: "obj a \ \\[a] : a \ a \ a\" and iso_unit: "obj a \ iso \[a]" and pentagon: "\ ide f; ide g; ide h; ide k; src f = trg g; src g = trg h; src h = trg k \ \ (f \ \[g, h, k]) \ \[f, g \ h, k] \ (\[f, g, h] \ k) = \[f, g, h \ k] \ \[f \ g, h, k]" begin (* * TODO: the mapping \ is not currently assumed to be extensional. * It might be best in the long run if it were. *) definition \ where "\ \\\ \ \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))" lemma assoc_in_hom': assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "in_hhom \[\, \, \] (src \) (trg \)" and "\\[\, \, \] : (dom \ \ dom \) \ dom \ \ cod \ \ cod \ \ cod \\" proof - show "\\[\, \, \] : (dom \ \ dom \) \ dom \ \ cod \ \ cod \ \ cod \\" proof - have 1: "VVV.in_hom (\, \, \) (dom \, dom \, dom \) (cod \, cod \, cod \)" using assms VVV.in_hom_char VVV.arr_char VV.arr_char by auto have "\\[\, \, \] : HoHV (dom \, dom \, dom \) \ HoVH (cod \, cod \, cod \)\" using 1 \.preserves_hom by auto moreover have "HoHV (dom \, dom \, dom \) = (dom \ \ dom \) \ dom \" using 1 HoHV_def by (simp add: VVV.in_hom_char) moreover have "HoVH (cod \, cod \, cod \) = cod \ \ cod \ \ cod \" using 1 HoVH_def by (simp add: VVV.in_hom_char) ultimately show ?thesis by simp qed thus "in_hhom \[\, \, \] (src \) (trg \)" using assms src_cod trg_cod vconn_implies_hpar(1) vconn_implies_hpar(2) by auto qed lemma assoc_is_natural_1: assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "\[\, \, \] = (\ \ \ \ \) \ \[dom \, dom \, dom \]" using assms \.is_natural_1 [of "(\, \, \)"] VVV.arr_char VV.arr_char VVV.dom_char HoVH_def src_dom trg_dom by simp lemma assoc_is_natural_2: assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "\[\, \, \] = \[cod \, cod \, cod \] \ ((\ \ \) \ \)" using assms \.is_natural_2 [of "(\, \, \)"] VVV.arr_char VV.arr_char VVV.cod_char HoHV_def src_dom trg_dom by simp lemma assoc_naturality: assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "\[cod \, cod \, cod \] \ ((\ \ \) \ \) = (\ \ \ \ \) \ \[dom \, dom \, dom \]" using assms \.naturality VVV.arr_char VV.arr_char HoVH_def HoHV_def VVV.dom_char VVV.cod_char by auto lemma assoc_in_hom [intro]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "in_hhom \[f, g, h] (src h) (trg f)" and "\\[f, g, h] : (dom f \ dom g) \ dom h \ cod f \ cod g \ cod h\" using assms assoc_in_hom' apply auto[1] using assms assoc_in_hom' ideD(1) by metis lemma assoc_simps [simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "arr \[f, g, h]" and "src \[f, g, h] = src h" and "trg \[f, g, h] = trg f" and "dom \[f, g, h] = (dom f \ dom g) \ dom h" and "cod \[f, g, h] = cod f \ cod g \ cod h" using assms assoc_in_hom apply auto using assoc_in_hom(1) by auto lemma iso_assoc [intro, simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "iso \[f, g, h]" using assms \.components_are_iso [of "(f, g, h)"] VVV.ide_char VVV.arr_char VV.arr_char by simp end subsection "Categories Induce Bicategories" text \ In this section we show that a category becomes a bicategory if we take the vertical composition to be discrete, we take the composition of the category as the horizontal composition, and we take the vertical domain and codomain as \src\ and \trg\. \ (* * It is helpful to make a few local definitions here, but I don't want them to * clutter the category locale. Using a context and private definitions does not * work as expected. So we have to define a new locale just for the present purpose. *) locale category_as_bicategory = category begin interpretation V: discrete_category \Collect arr\ null using not_arr_null by (unfold_locales, blast) abbreviation V where "V \ V.comp" interpretation src: "functor" V V dom using V.null_char by (unfold_locales, simp add: has_domain_iff_arr dom_def, auto) interpretation trg: "functor" V V cod using V.null_char by (unfold_locales, simp add: has_codomain_iff_arr cod_def, auto) interpretation H: horizontal_homs V dom cod by (unfold_locales, auto) interpretation H: "functor" H.VV.comp V \\\\. fst \\ \ snd \\\ apply (unfold_locales) using H.VV.arr_char V.null_char ext apply force using H.VV.arr_char V.null_char H.VV.dom_char H.VV.cod_char apply auto[3] proof - show "\g f. H.VV.seq g f \ fst (H.VV.comp g f) \ snd (H.VV.comp g f) = V (fst g \ snd g) (fst f \ snd f)" proof - have 0: "\f. H.VV.arr f \ V.arr (fst f \ snd f)" using H.VV.arr_char by auto have 1: "\f g. V.seq g f \ V.ide f \ g = f" using V.arr_char V.dom_char V.cod_char V.not_arr_null by force have 2: "\f g. H.VxV.seq g f \ H.VxV.ide f \ g = f" using 1 H.VxV.seq_char by (metis H.VxV.dom_eqI H.VxV.ide_Ide) fix f g assume fg: "H.VV.seq g f" have 3: "H.VV.ide f \ f = g" using fg 2 H.VV.seq_char H.VV.ide_char by blast show "fst (H.VV.comp g f) \ snd (H.VV.comp g f) = V (fst g \ snd g) (fst f \ snd f)" using fg 0 1 3 H.VV.comp_char H.VV.arr_char H.VV.ide_char V.arr_char V.comp_char H.VV.comp_arr_ide by (metis (no_types, lifting)) qed qed interpretation H: horizontal_composition V C dom cod by (unfold_locales, auto) abbreviation \ where "\ f g h \ f \ g \ h" interpretation \: natural_isomorphism H.VVV.comp V H.HoHV H.HoVH \\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))\ apply unfold_locales using V.null_char ext apply fastforce using H.HoHV_def H.HoVH_def H.VVV.arr_char H.VV.arr_char H.VVV.dom_char H.VV.dom_char H.VVV.cod_char H.VV.cod_char H.VVV.ide_char comp_assoc by auto interpretation fully_faithful_functor V V H.R using comp_arr_dom by (unfold_locales, auto) interpretation fully_faithful_functor V V H.L using comp_cod_arr by (unfold_locales, auto) abbreviation \ where "\ \ \x. x" proposition induces_bicategory: shows "bicategory V C \ \ dom cod" apply (unfold_locales, auto simp add: comp_assoc) using comp_arr_dom by fastforce end subsection "Monoidal Categories induce Bicategories" text \ In this section we show that our definition of bicategory directly generalizes our definition of monoidal category: a monoidal category becomes a bicategory when equipped with the constant-\\\ functors as src and trg and \\\ as the unit isomorphism from \\ \ \\ to \\\. There is a slight mismatch because the bicategory locale assumes that the associator is given in curried form, whereas for monoidal categories it is given in tupled form. Ultimately, the monoidal category locale should be revised to also use curried form, which ends up being more convenient in most situations. \ context monoidal_category begin interpretation I: constant_functor C C \ using \_in_hom by unfold_locales auto interpretation horizontal_homs C I.map I.map by unfold_locales auto lemma CC_eq_VV: shows "CC.comp = VV.comp" proof - have "\g f. CC.comp g f = VV.comp g f" proof - fix f g show "CC.comp g f = VV.comp g f" proof - have "CC.seq g f \ CC.comp g f = VV.comp g f" using VV.comp_char VV.arr_char CC.seq_char by (elim CC.seqE seqE, simp) moreover have "\ CC.seq g f \ CC.comp g f = VV.comp g f" using VV.seq_char VV.ext VV.null_char CC.ext by (metis (no_types, lifting)) ultimately show ?thesis by blast qed qed thus ?thesis by blast qed lemma CCC_eq_VVV: shows "CCC.comp = VVV.comp" proof - have "\g f. CCC.comp g f = VVV.comp g f" proof - fix f g show "CCC.comp g f = VVV.comp g f" proof - have "CCC.seq g f \ CCC.comp g f = VVV.comp g f" by (metis (no_types, lifting) CC.arrE CCC.seqE CC_eq_VV I.map_simp I.preserves_reflects_arr VV.seq_char VVV.arrI VVV.comp_simp VVV.seq_char trg_vcomp vseq_implies_hpar(1)) moreover have "\ CCC.seq g f \ CCC.comp g f = VVV.comp g f" using VVV.seq_char VVV.ext VVV.null_char CCC.ext by (metis (no_types, lifting)) ultimately show ?thesis by blast qed qed thus ?thesis by blast qed interpretation H: "functor" VV.comp C \\\\. fst \\ \ snd \\\ using CC_eq_VV T.functor_axioms by simp interpretation H: horizontal_composition C tensor I.map I.map by (unfold_locales, simp_all) lemma HoHV_eq_ToTC: shows "H.HoHV = T.ToTC" using H.HoHV_def T.ToTC_def CCC_eq_VVV by presburger lemma HoVH_eq_ToCT: shows "H.HoVH = T.ToCT" using H.HoVH_def T.ToCT_def CCC_eq_VVV by presburger interpretation \: natural_isomorphism VVV.comp C H.HoHV H.HoVH \ using \.natural_isomorphism_axioms CCC_eq_VVV HoHV_eq_ToTC HoVH_eq_ToCT by simp lemma R'_eq_R: shows "H.R = R" using H.is_extensional CC_eq_VV CC.arr_char by force lemma L'_eq_L: shows "H.L = L" using H.is_extensional CC_eq_VV CC.arr_char by force interpretation R': fully_faithful_functor C C H.R using R'_eq_R R.fully_faithful_functor_axioms unity_def by auto interpretation L': fully_faithful_functor C C H.L using L'_eq_L L.fully_faithful_functor_axioms unity_def by auto lemma obj_char: shows "obj a \ a = \" using obj_def [of a] \_in_hom by fastforce proposition induces_bicategory: shows "bicategory C tensor (\\ \ \. \ (\, \, \)) (\_. \) I.map I.map" using obj_char \_in_hom \_is_iso pentagon \.is_extensional \.is_natural_1 \.is_natural_2 by unfold_locales simp_all end subsection "Prebicategories Extend to Bicategories" text \ In this section, we show that a prebicategory with homs and units extends to a bicategory. The main work is to show that the endofunctors \L\ and \R\ are fully faithful. We take the left and right unitor isomorphisms, which were obtained via local constructions in the left and right hom-subcategories defined by a specified weak unit, and show that in the presence of the chosen sources and targets they are the components of a global natural isomorphisms \\\ and \\\ from the endofunctors \L\ and \R\ to the identity functor. A consequence is that functors \L\ and \R\ are endo-equivalences, hence fully faithful. \ context prebicategory_with_homs begin text \ Once it is equipped with a particular choice of source and target for each arrow, a prebicategory determines a horizontal composition. \ lemma induces_horizontal_composition: shows "horizontal_composition V H src trg" proof - interpret H: "functor" VV.comp V \\\\. fst \\ \ snd \\\ proof - have "VV.comp = VoV.comp" using composable_char\<^sub>P\<^sub>B\<^sub>H by meson thus "functor VV.comp V (\\\. fst \\ \ snd \\)" using functor_axioms by argo qed show "horizontal_composition V H src trg" using src_hcomp' trg_hcomp' composable_char\<^sub>P\<^sub>B\<^sub>H not_arr_null by (unfold_locales; metis) qed end sublocale prebicategory_with_homs \ horizontal_composition V H src trg using induces_horizontal_composition by auto locale prebicategory_with_homs_and_units = prebicategory_with_units + prebicategory_with_homs begin no_notation in_hom ("\_ : _ \ _\") text \ The next definitions extend the left and right unitors that were defined locally with respect to a particular weak unit, to globally defined versions using the chosen source and target for each arrow. \ definition lunit ("\[_]") where "lunit f \ left_hom_with_unit.lunit V H \ \[trg f] (trg f) f" definition runit ("\[_]") where "runit f \ right_hom_with_unit.runit V H \ \[src f] (src f) f" lemma lunit_in_hom: assumes "ide f" shows "\\[f] : src f \\<^sub>W\<^sub>C trg f\" and "\\[f] : trg f \ f \ f\" proof - interpret Left: subcategory V \left (trg f)\ using assms left_hom_is_subcategory by simp interpret Left: left_hom_with_unit V H \ \\[trg f]\ \trg f\ using assms obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by (unfold_locales, auto) have 0: "Left.ide f" using assms Left.ide_char Left.arr_char left_def composable_char\<^sub>P\<^sub>B\<^sub>H by auto show 1: "\\[f] : trg f \ f \ f\" unfolding lunit_def using assms 0 Left.lunit_char(1) Left.hom_char H\<^sub>L_def by auto show "\\[f] : src f \\<^sub>W\<^sub>C trg f\" using 1 src_cod trg_cod src_in_sources trg_in_targets by (metis arrI vconn_implies_hpar) qed lemma runit_in_hom: assumes "ide f" shows "\\[f] : src f \\<^sub>W\<^sub>C trg f\" and "\\[f] : f \ src f \ f\" proof - interpret Right: subcategory V \right (src f)\ using assms right_hom_is_subcategory weak_unit_self_composable by force interpret Right: right_hom_with_unit V H \ \\[src f]\ \src f\ using assms obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by (unfold_locales, auto) have 0: "Right.ide f" using assms Right.ide_char Right.arr_char right_def composable_char\<^sub>P\<^sub>B\<^sub>H by auto show 1: "\\[f] : f \ src f \ f\" unfolding runit_def using assms 0 Right.runit_char(1) Right.hom_char H\<^sub>R_def by auto show "\\[f] : src f \\<^sub>W\<^sub>C trg f\" using 1 src_cod trg_cod src_in_sources trg_in_targets by (metis arrI vconn_implies_hpar) qed text \ The characterization of the locally defined unitors yields a corresponding characterization of the globally defined versions, by plugging in the chosen source or target for each arrow for the unspecified weak unit in the the local versions. \ lemma lunit_char: assumes "ide f" shows "\\[f] : src f \\<^sub>W\<^sub>C trg f\" and "\\[f] : trg f \ f \ f\" and "trg f \ \[f] = (\[trg f] \ f) \ inv \[trg f, trg f, f]" and "\!\. \\ : trg f \ f \ f\ \ trg f \ \ = (\[trg f] \ f) \ inv \[trg f, trg f, f]" proof - let ?a = "src f" and ?b = "trg f" interpret Left: subcategory V \left ?b\ using assms left_hom_is_subcategory weak_unit_self_composable by force interpret Left: left_hom_with_unit V H \ \\[?b]\ ?b using assms obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by (unfold_locales, auto) have 0: "Left.ide f" using assms Left.ide_char Left.arr_char left_def composable_char\<^sub>P\<^sub>B\<^sub>H by auto show "\\[f] : src f \\<^sub>W\<^sub>C trg f\" using assms lunit_in_hom by simp show A: "\\[f] : trg f \ f \ f\" using assms lunit_in_hom by simp show B: "?b \ \[f] = (\[?b] \ f) \ inv \[?b, ?b, f]" unfolding lunit_def using 0 Left.lunit_char(2) H\<^sub>L_def by (metis Left.comp_simp Left.characteristic_iso(1-2) Left.seqI') show "\!\. \\ : trg f \ f \ f\ \ trg f \ \ = (\[?b] \ f) \ inv \[?b, ?b, f]" proof - have 1: "hom (trg f \ f) f = Left.hom (Left.L f) f" proof have 1: "Left.L f = ?b \ f" using 0 H\<^sub>L_def by simp show "Left.hom (Left.L f) f \ hom (?b \ f) f" using assms Left.hom_char [of "?b \ f" f] H\<^sub>L_def by simp show "hom (?b \ f) f \ Left.hom (Left.L f) f" using assms 1 ide_in_hom composable_char\<^sub>P\<^sub>B\<^sub>H hom_connected left_def Left.hom_char by auto qed let ?P = "\\. Left.in_hom \ (Left.L f) f" let ?P' = "\\. \\ : ?b \ f \ f\" let ?Q = "\\. Left.L \ = (\[?b] \ f) \ (inv \[?b, ?b, f])" let ?R = "\\. ?b \ \ = (\[?b] \ f) \ (inv \[?b, ?b, f])" have 2: "?P = ?P'" using 0 1 H\<^sub>L_def Left.hom_char by blast moreover have "\\. ?P \ \ (?Q \ \ ?R \)" using 2 Left.lunit_eqI H\<^sub>L_def by presburger moreover have "(\!\. ?P \ \ ?Q \)" using 0 2 A B Left.lunit_char(3) Left.ide_char Left.arr_char by (metis (no_types, lifting) Left.lunit_char(2) calculation(2) lunit_def) ultimately show ?thesis by metis qed qed lemma runit_char: assumes "ide f" shows "\\[f] : src f \\<^sub>W\<^sub>C trg f\" and "\\[f] : f \ src f \ f\" and "\[f] \ src f = (f \ \[src f]) \ \[f, src f, src f]" and "\!\. \\ : f \ src f \ f\ \ \ \ src f = (f \ \[src f]) \ \[f, src f, src f]" proof - let ?a = "src f" and ?b = "trg f" interpret Right: subcategory V \right ?a\ using assms right_hom_is_subcategory weak_unit_self_composable by force interpret Right: right_hom_with_unit V H \ \\[?a]\ ?a using assms obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by (unfold_locales, auto) have 0: "Right.ide f" using assms Right.ide_char Right.arr_char right_def composable_char\<^sub>P\<^sub>B\<^sub>H by auto show "\\[f] : src f \\<^sub>W\<^sub>C trg f\" using assms runit_in_hom by simp show A: "\\[f] : f \ src f \ f\" using assms runit_in_hom by simp show B: "\[f] \ ?a = (f \ \[?a]) \ \[f, ?a, ?a]" unfolding runit_def using 0 Right.runit_char(2) H\<^sub>R_def using Right.comp_simp Right.characteristic_iso(4) Right.iso_is_arr by auto show "\!\. \\ : f \ src f \ f\ \ \ \ ?a = (f \ \[?a]) \ \[f, ?a, ?a]" proof - have 1: "hom (f \ ?a) f = Right.hom (Right.R f) f" proof have 1: "Right.R f = f \ ?a" using 0 H\<^sub>R_def by simp show "Right.hom (Right.R f) f \ hom (f \ ?a) f" using assms Right.hom_char [of "f \ ?a" f] H\<^sub>R_def by simp show "hom (f \ ?a) f \ Right.hom (Right.R f) f" using assms 1 ide_in_hom composable_char\<^sub>P\<^sub>B\<^sub>H hom_connected right_def Right.hom_char by auto qed let ?P = "\\. Right.in_hom \ (Right.R f) f" let ?P' = "\\. \\ : f \ ?a \ f\" let ?Q = "\\. Right.R \ = (f \ \[?a]) \ \[f, ?a, ?a]" let ?R = "\\. \ \ ?a = (f \ \[?a]) \ \[f, ?a, ?a]" have 2: "?P = ?P'" using 0 1 H\<^sub>R_def Right.hom_char by blast moreover have "\\. ?P \ \ (?Q \ \ ?R \)" using 2 Right.runit_eqI H\<^sub>R_def by presburger moreover have "(\!\. ?P \ \ ?Q \)" using 0 2 A B Right.runit_char(3) Right.ide_char Right.arr_char by (metis (no_types, lifting) Right.runit_char(2) calculation(2) runit_def) ultimately show ?thesis by metis qed qed lemma lunit_eqI: assumes "ide f" and "\\ : trg f \ f \ f\" and "trg f \ \ = (\[trg f] \ f) \ (inv \[trg f, trg f, f])" shows "\ = \[f]" using assms lunit_char(2-4) by blast lemma runit_eqI: assumes "ide f" and "\\ : f \ src f \ f\" and "\ \ src f = (f \ \[src f]) \ \[f, src f, src f]" shows "\ = \[f]" using assms runit_char(2-4) by blast lemma iso_lunit: assumes "ide f" shows "iso \[f]" proof - let ?b = "trg f" interpret Left: subcategory V \left ?b\ using assms left_hom_is_subcategory weak_unit_self_composable by force interpret Left: left_hom_with_unit V H \ \\[?b]\ ?b using assms obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by (unfold_locales, auto) show ?thesis proof - have 0: "Left.ide f" using assms Left.ide_char Left.arr_char left_def composable_char\<^sub>P\<^sub>B\<^sub>H by auto thus ?thesis unfolding lunit_def using Left.iso_lunit Left.iso_char by blast qed qed lemma iso_runit: assumes "ide f" shows "iso \[f]" proof - let ?a = "src f" interpret Right: subcategory V \right ?a\ using assms right_hom_is_subcategory weak_unit_self_composable by force interpret Right: right_hom_with_unit V H \ \\[?a]\ ?a using assms obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by (unfold_locales, auto) show ?thesis proof - have 0: "Right.ide f" using assms Right.ide_char Right.arr_char right_def composable_char\<^sub>P\<^sub>B\<^sub>H by auto thus ?thesis unfolding runit_def using Right.iso_runit Right.iso_char by blast qed qed lemma lunit_naturality: assumes "arr \" shows "\ \ \[dom \] = \[cod \] \ (trg \ \ \)" proof - let ?a = "src \" and ?b = "trg \" interpret Left: subcategory V \left ?b\ using assms obj_trg left_hom_is_subcategory weak_unit_self_composable by force interpret Left: left_hom_with_unit V H \ \\[?b]\ ?b using assms obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by (unfold_locales, auto) interpret Left.L: endofunctor \Left ?b\ Left.L using assms endofunctor_H\<^sub>L [of ?b] weak_unit_self_composable obj_trg obj_is_weak_unit by blast have 1: "Left.in_hom \ (dom \) (cod \)" using assms Left.hom_char Left.arr_char left_def composable_char\<^sub>P\<^sub>B\<^sub>H obj_trg by auto have 2: "Left.in_hom \[Left.dom \] (?b \ dom \) (dom \)" unfolding lunit_def using assms 1 Left.in_hom_char trg_dom Left.lunit_char(1) H\<^sub>L_def Left.arr_char Left.dom_char Left.ide_dom by force have 3: "Left.in_hom \[Left.cod \] (?b \ cod \) (cod \)" unfolding lunit_def using assms 1 Left.in_hom_char trg_cod Left.lunit_char(1) H\<^sub>L_def Left.cod_char Left.ide_cod by force have 4: "Left.in_hom (Left.L \) (?b \ dom \) (?b \ cod \)" using 1 Left.L.preserves_hom [of \ "dom \" "cod \"] H\<^sub>L_def by auto show ?thesis - proof - - have "\ \ \[dom \] = Left.comp \ \[Left.dom \]" - using 1 2 Left.comp_simp by fastforce - also have "... = Left.comp \ (Left.lunit (Left.dom \))" - using assms 1 lunit_def by auto - also have "... = Left.comp (Left.lunit (Left.cod \)) (Left.L \)" - using 1 Left.lunit_naturality Left.cod_simp by auto - also have "... = Left.comp (lunit (Left.cod \)) (Left.L \)" - using assms 1 lunit_def by auto - also have "... = \[cod \] \ Left.L \" - using 1 3 4 Left.comp_char Left.cod_char Left.in_hom_char by auto - also have "... = \[cod \] \ (trg \ \ \)" - using 1 by (simp add: H\<^sub>L_def) - finally show ?thesis by simp - qed + by (metis "1" "2" H\<^sub>L_def Left.comp_simp Left.in_homE Left.lunit_naturality + Left.seqI' lunit_def trg_cod trg_dom) qed lemma runit_naturality: assumes "arr \" shows "\ \ \[dom \] = \[cod \] \ (\ \ src \)" proof - let ?a = "src \" and ?b = "trg \" interpret Right: subcategory V \right ?a\ using assms right_hom_is_subcategory weak_unit_self_composable by force interpret Right: right_hom_with_unit V H \ \\[?a]\ ?a using assms obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by (unfold_locales, auto) interpret Right.R: endofunctor \Right ?a\ Right.R using assms endofunctor_H\<^sub>R [of ?a] weak_unit_self_composable obj_src obj_is_weak_unit by blast have 1: "Right.in_hom \ (dom \) (cod \)" using assms Right.hom_char Right.arr_char right_def composable_char\<^sub>P\<^sub>B\<^sub>H by auto have 2: "Right.in_hom \[Right.dom \] (dom \ \ ?a) (dom \)" unfolding runit_def using 1 Right.in_hom_char trg_dom Right.runit_char(1) [of "Right.dom \"] H\<^sub>R_def Right.arr_char Right.dom_char Right.ide_dom assms by force have 3: "\[Right.cod \] \ Right.hom (cod \ \ ?a) (cod \)" unfolding runit_def using 1 Right.in_hom_char trg_cod Right.runit_char(1) [of "Right.cod \"] H\<^sub>R_def Right.cod_char Right.ide_cod assms by force have 4: "Right.R \ \ Right.hom (dom \ \ ?a) (cod \ \ ?a)" using 1 Right.R.preserves_hom [of \ "dom \" "cod \"] H\<^sub>R_def by auto show ?thesis - proof - - have "\ \ \[dom \] = Right.comp \ \[Right.dom \]" - by (metis 1 2 Right.comp_char Right.in_homE Right.seqI' Right.seq_char) - also have "... = Right.comp \ (Right.runit (Right.dom \))" - using assms 1 src_dom trg_dom Right.hom_char runit_def by auto - also have "... = Right.comp (Right.runit (Right.cod \)) (Right.R \)" - using 1 Right.runit_naturality Right.cod_simp by auto - also have "... = Right.comp (runit (Right.cod \)) (Right.R \)" - using assms 1 runit_def by auto - also have "... = \[cod \] \ Right.R \" - using 1 3 4 Right.comp_char Right.cod_char Right.in_hom_char by auto - also have "... = \[cod \] \ (\ \ ?a)" - using 1 by (simp add: H\<^sub>R_def) - finally show ?thesis by simp - qed + by (metis "1" "2" H\<^sub>R_def Right.comp_simp Right.in_homE Right.runit_naturality + Right.seqI' runit_def src_cod src_dom) qed interpretation L: endofunctor V L using endofunctor_L by auto interpretation \: transformation_by_components V V L map lunit using lunit_in_hom lunit_naturality by unfold_locales auto interpretation \: natural_isomorphism V V L map \.map using iso_lunit by unfold_locales auto lemma natural_isomorphism_\: shows "natural_isomorphism V V L map \.map" .. interpretation L: equivalence_functor V V L using L.isomorphic_to_identity_is_equivalence \.natural_isomorphism_axioms by simp lemma equivalence_functor_L: shows "equivalence_functor V V L" .. lemma lunit_commutes_with_L: assumes "ide f" shows "\[L f] = L \[f]" proof - have "seq \[f] (L \[f])" using assms lunit_char(2) L.preserves_hom by fastforce moreover have "seq \[f] \[L f]" using assms lunit_char(2) lunit_char(2) [of "L f"] L.preserves_ide by auto ultimately show ?thesis using assms lunit_char(2) [of f] lunit_naturality [of "\[f]"] iso_lunit iso_is_section section_is_mono monoE [of "\[f]" "L \[f]" "\[L f]"] by auto qed interpretation R: endofunctor V R using endofunctor_R by auto interpretation \: transformation_by_components V V R map runit using runit_in_hom runit_naturality by unfold_locales auto interpretation \: natural_isomorphism V V R map \.map using iso_runit by unfold_locales auto lemma natural_isomorphism_\: shows "natural_isomorphism V V R map \.map" .. interpretation R: equivalence_functor V V R using R.isomorphic_to_identity_is_equivalence \.natural_isomorphism_axioms by simp lemma equivalence_functor_R: shows "equivalence_functor V V R" .. lemma runit_commutes_with_R: assumes "ide f" shows "\[R f] = R \[f]" proof - have "seq \[f] (R \[f])" using assms runit_char(2) R.preserves_hom by fastforce moreover have "seq \[f] \[R f]" using assms runit_char(2) runit_char(2) [of "R f"] R.preserves_ide by auto ultimately show ?thesis using assms runit_char(2) [of f] runit_naturality [of "\[f]"] iso_runit iso_is_section section_is_mono monoE [of "\[f]" "R \[f]" "\[R f]"] by auto qed definition \ where "\ \ \ \ \ if VVV.arr (\, \, \) then (\ \ \ \ \) \ \[dom \, dom \, dom \] else null" lemma \_ide_simp [simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\ f g h = \[f, g, h]" proof - have "\ f g h = (f \ g \ h) \ \[dom f, dom g, dom h]" using assms \_def VVV.arr_char [of "(f, g, h)"] by auto also have "... = (f \ g \ h) \ \[f, g, h]" using assms by simp also have "... = \[f, g, h]" using assms \_def assoc_in_hom\<^sub>A\<^sub>W\<^sub>C hcomp_in_hom\<^sub>P\<^sub>B\<^sub>H VVV.arr_char VoV.arr_char comp_cod_arr composable_char\<^sub>P\<^sub>B\<^sub>H by auto finally show ?thesis by simp qed (* TODO: Figure out how this got reinstated. *) no_notation in_hom ("\_ : _ \ _\") lemma natural_isomorphism_\: shows "natural_isomorphism VVV.comp V HoHV HoVH (\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\)))" proof - interpret \: transformation_by_components VVV.comp V HoHV HoVH \\f. \[fst f, fst (snd f), snd (snd f)]\ proof show 1: "\x. VVV.ide x \ \\[fst x, fst (snd x), snd (snd x)] : HoHV x \ HoVH x\" proof - fix x assume x: "VVV.ide x" show "\\[fst x, fst (snd x), snd (snd x)] : HoHV x \ HoVH x\" proof - have "ide (fst x) \ ide (fst (snd x)) \ ide (snd (snd x)) \ fst x \ fst (snd x) \ null \ fst (snd x) \ snd (snd x) \ null" using x VVV.ide_char VVV.arr_char VV.arr_char composable_char\<^sub>P\<^sub>B\<^sub>H by simp hence "\[fst x, fst (snd x), snd (snd x)] \ hom ((fst x \ fst (snd x)) \ snd (snd x)) (fst x \ fst (snd x) \ snd (snd x))" using x assoc_in_hom\<^sub>A\<^sub>W\<^sub>C by simp thus ?thesis unfolding HoHV_def HoVH_def using x VVV.ideD(1) by simp qed qed show "\f. VVV.arr f \ \[fst (VVV.cod f), fst (snd (VVV.cod f)), snd (snd (VVV.cod f))] \ HoHV f = HoVH f \ \[fst (VVV.dom f), fst (snd (VVV.dom f)), snd (snd (VVV.dom f))]" unfolding HoHV_def HoVH_def using assoc_naturality\<^sub>A\<^sub>W\<^sub>C VVV.arr_char VV.arr_char VVV.dom_char VVV.cod_char composable_char\<^sub>P\<^sub>B\<^sub>H by simp qed interpret \: natural_isomorphism VVV.comp V HoHV HoVH \.map proof fix f assume f: "VVV.ide f" show "iso (\.map f)" proof - have "fst f \ fst (snd f) \ null \ fst (snd f) \ snd (snd f) \ null" using f VVV.ideD(1) VVV.arr_char [of f] VV.arr_char composable_char\<^sub>P\<^sub>B\<^sub>H by auto thus ?thesis using f \.map_simp_ide iso_assoc\<^sub>A\<^sub>W\<^sub>C VVV.ide_char VVV.arr_char by simp qed qed have "(\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))) = \.map" proof fix \\\ have "\ VVV.arr \\\ \ \ (fst \\\) (fst (snd \\\)) (snd (snd \\\)) = \.map \\\" using \_def \.map_def by simp moreover have "VVV.arr \\\ \ \ (fst \\\) (fst (snd \\\)) (snd (snd \\\)) = \.map \\\" proof - assume \\\: "VVV.arr \\\" have "\ (fst \\\) (fst (snd \\\)) (snd (snd \\\)) = (fst \\\ \ fst (snd \\\) \ snd (snd \\\)) \ \[dom (fst \\\), dom (fst (snd \\\)), dom (snd (snd \\\))]" using \\\ \_def by simp also have "... = \[cod (fst \\\), cod (fst (snd \\\)), cod (snd (snd \\\))] \ ((fst \\\ \ fst (snd \\\)) \ snd (snd \\\))" using \\\ HoHV_def HoVH_def VVV.arr_char VV.arr_char assoc_naturality\<^sub>A\<^sub>W\<^sub>C composable_char\<^sub>P\<^sub>B\<^sub>H by simp also have "... = \[fst (VVV.cod \\\), fst (snd (VVV.cod \\\)), snd (snd (VVV.cod \\\))] \ ((fst \\\ \ fst (snd \\\)) \ snd (snd \\\))" using \\\ VVV.arr_char VVV.cod_char VV.arr_char by simp also have "... = \.map \\\" using \\\ \.map_def HoHV_def composable_char\<^sub>P\<^sub>B\<^sub>H by auto finally show ?thesis by blast qed ultimately show "\ (fst \\\) (fst (snd \\\)) (snd (snd \\\)) = \.map \\\" by blast qed thus ?thesis using \.natural_isomorphism_axioms by simp qed proposition induces_bicategory: shows "bicategory V H \ \ src trg" proof - interpret VxVxV: product_category V VxV.comp .. interpret VoVoV: subcategory VxVxV.comp \\\\\. arr (fst \\\) \ VV.arr (snd \\\) \ src (fst \\\) = trg (fst (snd \\\))\ using subcategory_VVV by blast interpret HoHV: "functor" VVV.comp V HoHV using functor_HoHV by blast interpret HoVH: "functor" VVV.comp V HoVH using functor_HoVH by blast interpret \: natural_isomorphism VVV.comp V HoHV HoVH \\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))\ using natural_isomorphism_\ by blast interpret L: equivalence_functor V V L using equivalence_functor_L by blast interpret R: equivalence_functor V V R using equivalence_functor_R by blast show "bicategory V H \ \ src trg" proof show "\a. obj a \ \\[a] : a \ a \ a\" using obj_is_weak_unit unit_in_vhom\<^sub>P\<^sub>B\<^sub>U by blast show "\a. obj a \ iso \[a]" using obj_is_weak_unit iso_unit\<^sub>P\<^sub>B\<^sub>U by blast show "\f g h k. \ ide f; ide g; ide h; ide k; src f = trg g; src g = trg h; src h = trg k \ \ (f \ \ g h k) \ \ f (g \ h) k \ (\ f g h \ k) = \ f g (h \ k) \ \ (f \ g) h k" proof - fix f g h k assume f: "ide f" and g: "ide g" and h: "ide h" and k: "ide k" and fg: "src f = trg g" and gh: "src g = trg h" and hk: "src h = trg k" have "sources f \ targets g \ {}" using f g fg src_in_sources [of f] trg_in_targets ideD(1) by auto moreover have "sources g \ targets h \ {}" using g h gh src_in_sources [of g] trg_in_targets ideD(1) by auto moreover have "sources h \ targets k \ {}" using h k hk src_in_sources [of h] trg_in_targets ideD(1) by auto moreover have "\ f g h = \[f, g, h] \ \ g h k = \[g, h, k]" using f g h k fg gh hk \_ide_simp by simp moreover have "\ f (g \ h) k = \[f, g \ h, k] \ \ f g (h \ k) = \[f, g, h \ k] \ \ (f \ g) h k = \[f \ g, h, k]" using f g h k fg gh hk \_ide_simp preserves_ide hcomp_in_hom\<^sub>P\<^sub>B\<^sub>H(1) by simp ultimately show "(f \ \ g h k) \ \ f (g \ h) k \ (\ f g h \ k) = \ f g (h \ k) \ \ (f \ g) h k" using f g h k fg gh hk pentagon\<^sub>A\<^sub>W\<^sub>C [of f g h k] \_ide_simp by presburger qed qed qed end text \ The following is the main result of this development: Every prebicategory extends to a bicategory, by making an arbitrary choice of representatives of each isomorphism class of weak units and using that to define the source and target mappings, and then choosing an arbitrary isomorphism in \hom (a \ a) a\ for each weak unit \a\. \ context prebicategory begin interpretation prebicategory_with_homs V H \ some_src some_trg using extends_to_prebicategory_with_homs by auto interpretation prebicategory_with_units V H \ some_unit using extends_to_prebicategory_with_units by auto interpretation prebicategory_with_homs_and_units V H \ some_unit some_src some_trg .. theorem extends_to_bicategory: shows "bicategory V H \ some_unit some_src some_trg" using induces_bicategory by simp end section "Bicategories as Prebicategories" subsection "Bicategories are Prebicategories" text \ In this section we show that a bicategory determines a prebicategory with homs, whose weak units are exactly those arrows that are isomorphic to their chosen source, or equivalently, to their chosen target. Moreover, the notion of horizontal composability, which in a bicategory is determined by the coincidence of chosen sources and targets, agrees with the version defined for the induced weak composition in terms of nonempty intersections of source and target sets, which is not dependent on any arbitrary choices. \ context bicategory begin (* TODO: Why does this get re-introduced? *) no_notation in_hom ("\_ : _ \ _\") interpretation \': inverse_transformation VVV.comp V HoHV HoVH \\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))\ .. abbreviation \' where "\' \ \'.map" definition \' ("\\<^sup>-\<^sup>1[_, _, _]") where "\\<^sup>-\<^sup>1[\, \, \] \ \'.map (\, \, \)" lemma assoc'_in_hom': assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "in_hhom \\<^sup>-\<^sup>1[\, \, \] (src \) (trg \)" and "\\\<^sup>-\<^sup>1[\, \, \] : dom \ \ dom \ \ dom \ \ (cod \ \ cod \) \ cod \\" proof - show "\\\<^sup>-\<^sup>1[\, \, \] : dom \ \ dom \ \ dom \ \ (cod \ \ cod \) \ cod \\" proof - have 1: "VVV.in_hom (\, \, \) (dom \, dom \, dom \) (cod \, cod \, cod \)" using assms VVV.in_hom_char VVV.arr_char VV.arr_char by auto have "\\\<^sup>-\<^sup>1[\, \, \] : HoVH (dom \, dom \, dom \) \ HoHV (cod \, cod \, cod \)\" using 1 \'_def \'.preserves_hom by auto moreover have "HoVH (dom \, dom \, dom \) = dom \ \ dom \ \ dom \" using 1 HoVH_def by (simp add: VVV.in_hom_char) moreover have "HoHV (cod \, cod \, cod \) = (cod \ \ cod \) \ cod \" using 1 HoHV_def by (simp add: VVV.in_hom_char) ultimately show ?thesis by simp qed thus "in_hhom \\<^sup>-\<^sup>1[\, \, \] (src \) (trg \)" using assms vconn_implies_hpar(1) vconn_implies_hpar(2) by auto qed lemma assoc'_is_natural_1: assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "\\<^sup>-\<^sup>1[\, \, \] = ((\ \ \) \ \) \ \\<^sup>-\<^sup>1[dom \, dom \, dom \]" using assms \'.is_natural_1 [of "(\, \, \)"] VVV.arr_char VV.arr_char VVV.dom_char HoHV_def src_dom trg_dom \'_def by simp lemma assoc'_is_natural_2: assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "\\<^sup>-\<^sup>1[\, \, \] = \\<^sup>-\<^sup>1[cod \, cod \, cod \] \ (\ \ \ \ \)" using assms \'.is_natural_2 [of "(\, \, \)"] VVV.arr_char VV.arr_char VVV.cod_char HoVH_def src_dom trg_dom \'_def by simp lemma assoc'_naturality: assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "\\<^sup>-\<^sup>1[cod \, cod \, cod \] \ (\ \ \ \ \) = ((\ \ \) \ \) \ \\<^sup>-\<^sup>1[dom \, dom \, dom \]" using assms assoc'_is_natural_1 assoc'_is_natural_2 by metis lemma assoc'_in_hom [intro]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "in_hhom \\<^sup>-\<^sup>1[f, g, h] (src h) (trg f)" and "\\\<^sup>-\<^sup>1[f, g, h] : dom f \ dom g \ dom h \ (cod f \ cod g) \ cod h\" using assms assoc'_in_hom'(1-2) ideD(1) by meson+ lemma assoc'_simps [simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "arr \\<^sup>-\<^sup>1[f, g, h]" and "src \\<^sup>-\<^sup>1[f, g, h] = src h" and "trg \\<^sup>-\<^sup>1[f, g, h] = trg f" and "dom \\<^sup>-\<^sup>1[f, g, h] = dom f \ dom g \ dom h" and "cod \\<^sup>-\<^sup>1[f, g, h] = (cod f \ cod g) \ cod h" using assms assoc'_in_hom by blast+ lemma assoc'_eq_inv_assoc [simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\\<^sup>-\<^sup>1[f, g, h] = inv \[f, g, h]" using assms VVV.ide_char VVV.arr_char VV.ide_char VV.arr_char \'.map_ide_simp \'_def by auto lemma inverse_assoc_assoc' [intro]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "inverse_arrows \[f, g, h] \\<^sup>-\<^sup>1[f, g, h]" using assms VVV.ide_char VVV.arr_char VV.ide_char VV.arr_char \'.map_ide_simp \'.inverts_components \'_def by auto lemma iso_assoc' [intro, simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "iso \\<^sup>-\<^sup>1[f, g, h]" using assms by simp lemma comp_assoc_assoc' [simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\[f, g, h] \ \\<^sup>-\<^sup>1[f, g, h] = f \ g \ h" and "\\<^sup>-\<^sup>1[f, g, h] \ \[f, g, h] = (f \ g) \ h" using assms comp_arr_inv' comp_inv_arr' by auto lemma unit_in_hom [intro, simp]: assumes "obj a" shows "\\[a] : a \ a\" and "\\[a] : a \ a \ a\" proof - show "\\[a] : a \ a \ a\" using assms unit_in_vhom by simp thus "\\[a] : a \ a\" using assms by (metis arrI in_hhom_def obj_simps(2-3) vconn_implies_hpar(1-4)) qed interpretation weak_composition V H using is_weak_composition by auto lemma seq_if_composable: assumes "\ \ \ \ null" shows "src \ = trg \" using assms H.is_extensional [of "(\, \)"] VV.arr_char by auto lemma obj_self_composable: assumes "obj a" shows "a \ a \ null" and "isomorphic (a \ a) a" - proof - - show 1: "isomorphic (a \ a) a" - using assms unit_in_hom iso_unit isomorphic_def by blast - obtain \ where \: "iso \ \ \\ : a \ a \ a\" - using 1 isomorphic_def by blast - have "ide (a \ a)" using 1 \ ide_dom [of \] by fastforce - thus "a \ a \ null" using ideD(1) not_arr_null by metis - qed + apply (metis arr_dom_iff_arr assms in_homE not_arr_null unit_in_vhom) + by (meson assms iso_unit isomorphic_def unit_in_vhom) lemma obj_is_weak_unit: assumes "obj a" shows "weak_unit a" proof - interpret Left_a: subcategory V \left a\ using assms left_hom_is_subcategory by force interpret Right_a: subcategory V \right a\ using assms right_hom_is_subcategory by force text \ We know that \H\<^sub>L a\ is fully faithful as a global endofunctor, but the definition of weak unit involves its restriction to a subcategory. So we have to verify that the restriction is also a fully faithful functor. \ interpret La: endofunctor \Left a\ \H\<^sub>L a\ using assms obj_self_composable endofunctor_H\<^sub>L [of a] by force interpret La: fully_faithful_functor \Left a\ \Left a\ \H\<^sub>L a\ proof show "\f f'. Left_a.par f f' \ H\<^sub>L a f = H\<^sub>L a f' \ f = f'" proof - fix \ \' assume par: "Left_a.par \ \'" assume eq: "H\<^sub>L a \ = H\<^sub>L a \'" have 1: "par \ \'" using par Left_a.arr_char Left_a.dom_char Left_a.cod_char left_def composable_implies_arr null_agreement by metis moreover have "L \ = L \'" using par eq H\<^sub>L_def Left_a.arr_char left_def preserves_arr assms 1 seq_if_composable [of a \] not_arr_null seq_if_composable [of a \'] by auto ultimately show "\ = \'" using L.is_faithful by blast qed show "\f g \. \ Left_a.ide f; Left_a.ide g; Left_a.in_hom \ (H\<^sub>L a f) (H\<^sub>L a g) \ \ \\. Left_a.in_hom \ f g \ H\<^sub>L a \ = \" proof - fix f g \ assume f: "Left_a.ide f" and g: "Left_a.ide g" and \: "Left_a.in_hom \ (H\<^sub>L a f) (H\<^sub>L a g)" have 1: "a = trg f \ a = trg g" using assms f g Left_a.ide_char Left_a.arr_char left_def seq_if_composable [of a f] seq_if_composable [of a g] by auto show "\\. Left_a.in_hom \ f g \ H\<^sub>L a \ = \" proof - have 2: "\\. \\ : f \ g\ \ L \ = \" using f g \ 1 Left_a.ide_char H\<^sub>L_def L.preserves_reflects_arr Left_a.arr_char Left_a.in_hom_char L.is_full by force obtain \ where \: "\\ : f \ g\ \ L \ = \" using 2 by blast have "Left_a.arr \" using \ 1 trg_dom Left_a.arr_char left_def hseq_char' by fastforce moreover have "H\<^sub>L a \ = \" using \ 1 trg_dom H\<^sub>L_def by auto ultimately show ?thesis using \ Left_a.dom_simp Left_a.cod_simp by blast qed qed qed interpret Ra: endofunctor \Right a\ \H\<^sub>R a\ using assms obj_self_composable endofunctor_H\<^sub>R [of a] by force interpret Ra: fully_faithful_functor \Right a\ \Right a\ \H\<^sub>R a\ proof show "\f f'. Right_a.par f f' \ H\<^sub>R a f = H\<^sub>R a f' \ f = f'" proof - fix \ \' assume par: "Right_a.par \ \'" assume eq: "H\<^sub>R a \ = H\<^sub>R a \'" have 1: "par \ \'" using par Right_a.arr_char Right_a.dom_char Right_a.cod_char right_def composable_implies_arr null_agreement by metis moreover have "R \ = R \'" using par eq H\<^sub>R_def Right_a.arr_char right_def preserves_arr assms 1 seq_if_composable [of \ a] not_arr_null seq_if_composable [of \' a] by auto ultimately show "\ = \'" using R.is_faithful by blast qed show "\f g \. \ Right_a.ide f; Right_a.ide g; Right_a.in_hom \ (H\<^sub>R a f) (H\<^sub>R a g) \ \ \\. Right_a.in_hom \ f g \ H\<^sub>R a \ = \" proof - fix f g \ assume f: "Right_a.ide f" and g: "Right_a.ide g" and \: "Right_a.in_hom \ (H\<^sub>R a f) (H\<^sub>R a g)" have 1: "a = src f \ a = src g" using assms f g Right_a.ide_char Right_a.arr_char right_def seq_if_composable by auto show "\\. Right_a.in_hom \ f g \ H\<^sub>R a \ = \" proof - have 2: "\\. \\ : f \ g\ \ R \ = \" using f g \ 1 Right_a.ide_char H\<^sub>R_def R.preserves_reflects_arr Right_a.arr_char Right_a.in_hom_char R.is_full by force obtain \ where \: "\\ : f \ g\ \ R \ = \" using 2 by blast have "Right_a.arr \" using \ 1 src_dom Right_a.arr_char right_def hseq_char' by fastforce moreover have "H\<^sub>R a \ = \" using \ 1 src_dom H\<^sub>R_def by auto ultimately show ?thesis using \ Right_a.dom_simp Right_a.cod_simp by blast qed qed qed have "isomorphic (a \ a) a \ a \ a \ null" using assms obj_self_composable unit_in_hom iso_unit isomorphic_def by blast thus ?thesis using La.fully_faithful_functor_axioms Ra.fully_faithful_functor_axioms weak_unit_def by blast qed lemma src_in_sources: assumes "arr \" shows "src \ \ sources \" using assms obj_is_weak_unit R.preserves_arr hseq_char' by auto lemma trg_in_targets: assumes "arr \" shows "trg \ \ targets \" using assms obj_is_weak_unit L.preserves_arr hseq_char' by auto lemma weak_unit_cancel_left: assumes "weak_unit a" and "ide f" and "ide g" and "a \ f \ a \ g" shows "f \ g" proof - have 0: "ide a" using assms weak_unit_def by force interpret Left_a: subcategory V \left a\ using 0 left_hom_is_subcategory by simp interpret Left_a: left_hom V H a using assms weak_unit_self_composable by unfold_locales auto interpret La: fully_faithful_functor \Left a\ \Left a\ \H\<^sub>L a\ using assms weak_unit_def by fast obtain \ where \: "iso \ \ \\ : a \ f \ a \ g\" using assms by blast have 1: "Left_a.iso \ \ Left_a.in_hom \ (a \ f) (a \ g)" - proof - have "a \ \ \ null" - proof - - have "a \ dom \ \ null" - using assms \ weak_unit_self_composable - by (metis arr_dom_iff_arr hseq_char' in_homE match_4) - thus ?thesis - using hom_connected by simp - qed - thus "Left_a.in_hom \ (a \ f) (a \ g)" - using \ Left_a.hom_char left_def by auto - thus "Left_a.iso \" - using \ Left_a.iso_char by auto - qed + by (metis H\<^sub>L_def La.is_extensional La.preserves_arr Left_a.arrI Left_a.dom_closed + Left_a.in_hom_char Left_a.iso_char Left_a.not_arr_null Left_a.null_char \ assms(4) + hom_connected(4) hseq_char' ide_char' in_homE isomorphic_implies_ide(2) left_def) hence 2: "Left_a.ide (a \ f) \ Left_a.ide (a \ g)" using Left_a.ide_dom [of \] Left_a.ide_cod [of \] Left_a.dom_simp Left_a.cod_simp by auto hence 3: "Left_a.ide f \ Left_a.ide g" by (metis Left_a.ideI Left_a.ide_def Left_a.null_char assms(2) assms(3) left_def) obtain \ where \: "\ \ Left_a.hom f g \ a \ \ = \" using assms 1 2 3 La.is_full [of g f \] H\<^sub>L_def by auto have "Left_a.iso \" using \ 1 H\<^sub>L_def La.reflects_iso by auto hence "iso \ \ \\ : f \ g\" using \ Left_a.iso_char Left_a.in_hom_char by auto thus ?thesis by auto qed lemma weak_unit_cancel_right: assumes "weak_unit a" and "ide f" and "ide g" and "f \ a \ g \ a" shows "f \ g" proof - have 0: "ide a" using assms weak_unit_def by force interpret Right_a: subcategory V \right a\ using 0 right_hom_is_subcategory by simp interpret Right_a: right_hom V H a using assms weak_unit_self_composable by unfold_locales auto interpret R: fully_faithful_functor \Right a\ \Right a\ \H\<^sub>R a\ using assms weak_unit_def by fast obtain \ where \: "iso \ \ in_hom \ (f \ a) (g \ a)" using assms by blast have 1: "Right_a.iso \ \ \ \ Right_a.hom (f \ a) (g \ a)" proof have "\ \ a \ null" - proof - - have "dom \ \ a \ null" - using assms \ weak_unit_self_composable - by (metis arr_dom_iff_arr hseq_char' in_homE match_3) - thus ?thesis - using hom_connected by simp - qed + by (metis \ assms(1,4) hom_connected(3) ideD(1) in_homE isomorphic_implies_ide(2) + match_3 not_arr_null weak_unit_self_composable(3)) thus "\ \ Right_a.hom (f \ a) (g \ a)" using \ Right_a.hom_char right_def by simp thus "Right_a.iso \" using \ Right_a.iso_char by auto qed hence 2: "Right_a.ide (f \ a) \ Right_a.ide (g \ a)" using Right_a.ide_dom [of \] Right_a.ide_cod [of \] Right_a.dom_simp Right_a.cod_simp by auto hence 3: "Right_a.ide f \ Right_a.ide g" using assms Right_a.ide_char Right_a.arr_char right_def Right_a.ide_def Right_a.null_char by metis obtain \ where \: "\ \ Right_a.hom f g \ \ \ a = \" using assms 1 2 3 R.is_full [of g f \] H\<^sub>R_def by auto have "Right_a.iso \" using \ 1 H\<^sub>R_def R.reflects_iso by auto hence "iso \ \ \\ : f \ g\" using \ Right_a.iso_char Right_a.in_hom_char by auto thus ?thesis by auto qed text \ All sources of an arrow ({\em i.e.}~weak units composable on the right with that arrow) are isomorphic to the chosen source, and similarly for targets. That these statements hold was somewhat surprising to me. \ lemma source_iso_src: assumes "arr \" and "a \ sources \" shows "a \ src \" proof - have 0: "ide a" using assms weak_unit_def by force have 1: "src a = trg a" using assms ide_dom sources_def weak_unit_iff_self_target seq_if_composable weak_unit_self_composable by simp obtain \ where \: "iso \ \ \\ : a \ a \ a\" using assms weak_unit_def by blast have "a \ src a \ src a \ src a" proof - have "src a \ src a \ src a" using 0 obj_is_weak_unit weak_unit_def isomorphic_symmetric by auto moreover have "a \ src a \ src a" proof - have "a \ a \ src a \ a \ src a" proof - have "iso (\ \ src a) \ \\ \ src a : (a \ a) \ src a \ a \ src a\" using 0 1 \ ide_in_hom(2) by auto moreover have "iso \\<^sup>-\<^sup>1[a, a, src a] \ \\\<^sup>-\<^sup>1[a, a, src a] : a \ a \ src a \ (a \ a) \ src a\" using 0 1 iso_assoc' by force ultimately show ?thesis using isos_compose isomorphic_def by auto qed thus ?thesis using assms 0 weak_unit_cancel_left by auto qed ultimately show ?thesis using isomorphic_transitive by meson qed hence "a \ src a" using 0 weak_unit_cancel_right [of "src a" a "src a"] obj_is_weak_unit by auto thus ?thesis using assms seq_if_composable 1 by auto qed lemma target_iso_trg: assumes "arr \" and "b \ targets \" shows "b \ trg \" proof - have 0: "ide b" using assms weak_unit_def by force have 1: "trg \ = src b" using assms seq_if_composable by auto obtain \ where \: "iso \ \ \\ : b \ b \ b\" using assms weak_unit_def by blast have "trg b \ b \ trg b \ trg b" proof - have "trg b \ trg b \ trg b" using 0 obj_is_weak_unit weak_unit_def isomorphic_symmetric by auto moreover have "trg b \ b \ trg b" proof - have "(trg b \ b) \ b \ trg b \ b" proof - have "iso (trg b \ \) \ \trg b \ \ : trg b \ b \ b \ trg b \ b\" using assms 0 1 \ ide_in_hom(2) targetsD(1) weak_unit_self_composable apply (intro conjI hcomp_in_vhom) by auto moreover have "iso \[trg b, b, b] \ \\[trg b, b, b] : (trg b \ b) \ b \ trg b \ b \ b\" using assms(2) 0 1 seq_if_composable targetsD(1-2) weak_unit_self_composable by auto ultimately show ?thesis using isos_compose isomorphic_def by auto qed thus ?thesis using assms 0 weak_unit_cancel_right by auto qed ultimately show ?thesis using isomorphic_transitive by meson qed hence "b \ trg b" using 0 weak_unit_cancel_left [of "trg b" b "trg b"] obj_is_weak_unit by simp thus ?thesis using assms 0 1 seq_if_composable weak_unit_iff_self_source targetsD(1-2) source_iso_src by simp qed lemma is_weak_composition_with_homs: shows "weak_composition_with_homs V H src trg" using src_in_sources trg_in_targets seq_if_composable composable_implies_arr by (unfold_locales, simp_all) interpretation weak_composition_with_homs V H src trg using is_weak_composition_with_homs by auto text \ In a bicategory, the notion of composability defined in terms of the chosen sources and targets coincides with the version defined for a weak composition, which does not involve particular choices. \ lemma connected_iff_seq: assumes "arr \" and "arr \" shows "sources \ \ targets \ \ {} \ src \ = trg \" proof show "src \ = trg \ \ sources \ \ targets \ \ {}" using assms src_in_sources [of \] trg_in_targets [of \] by auto show "sources \ \ targets \ \ {} \ src \ = trg \" proof - assume 1: "sources \ \ targets \ \ {}" obtain a where a: "a \ sources \ \ targets \" using assms 1 by blast have \: "arr \" using a composable_implies_arr by auto have \: "arr \" using a composable_implies_arr by auto - have 1: "\a'. a' \ sources \ \ src a' = src a \ trg a' = trg a" - proof - fix a' - assume a': "a' \ sources \" - have 1: "a' \ a" - using a a' \ src_dom sources_dom source_iso_src isomorphic_transitive - isomorphic_symmetric - by (meson IntD1) - obtain \ where \: "iso \ \ \ \ hom a' a" - using 1 by auto - show "src a' = src a" - using \ src_dom src_cod by auto - show "trg a' = trg a" - using \ trg_dom trg_cod by auto - qed - have 2: "\a'. a' \ targets \ \ src a' = src a \ trg a' = trg a" - proof - fix a' - assume a': "a' \ targets \" - have 1: "a' \ a" - using a a' \ trg_dom targets_dom target_iso_trg isomorphic_transitive - isomorphic_symmetric - by (meson IntD2) - obtain \ where \: "iso \ \ \ \ hom a' a" - using 1 by auto - show "src a' = src a" - using \ src_dom src_cod by auto - show "trg a' = trg a" - using \ trg_dom trg_cod by auto - qed + have 2: "\a'. a' \ sources \ \ src a' = src a \ trg a' = trg a" + by (metis IntE a seq_if_composable sourcesD(2-3) weak_unit_self_composable(3)) have "src \ = src (src \)" using \ by simp also have "... = src (trg \)" - using \ 1 [of "src \"] src_in_sources a weak_unit_self_composable seq_if_composable + using \ 2 [of "src \"] src_in_sources a weak_unit_self_composable seq_if_composable by auto also have "... = trg (trg \)" using \ by simp also have "... = trg \" using \ by simp finally show "src \ = trg \" by blast qed qed lemma is_associative_weak_composition: shows "associative_weak_composition V H \" proof - have 1: "\\ \. \ \ \ \ null \ src \ = trg \" using H.is_extensional VV.arr_char by force show "associative_weak_composition V H \" proof show "\f g h. ide f \ ide g \ ide h \ f \ g \ null \ g \ h \ null \ \\[f, g, h] : (f \ g) \ h \ f \ g \ h\" using 1 by auto show "\f g h. ide f \ ide g \ ide h \ f \ g \ null \ g \ h \ null \ iso \[f, g, h]" using 1 iso_assoc by presburger show "\\ \ \. \ \ \ \ null \ \ \ \ \ null \ \[cod \, cod \, cod \] \ ((\ \ \) \ \) = (\ \ \ \ \) \ \[dom \, dom \, dom \]" using 1 assoc_naturality hseq_char hseq_char' by metis show "\f g h k. ide f \ ide g \ ide h \ ide k \ sources f \ targets g \ {} \ sources g \ targets h \ {} \ sources h \ targets k \ {} \ (f \ \[g, h, k]) \ \[f, g \ h, k] \ (\[f, g, h] \ k) = \[f, g, h \ k] \ \[f \ g, h, k]" using 1 connected_iff_seq pentagon ideD(1) by auto qed qed interpretation associative_weak_composition V H \ using is_associative_weak_composition by auto theorem is_prebicategory: shows "prebicategory V H \" using src_in_sources trg_in_targets by (unfold_locales, auto) interpretation prebicategory V H \ using is_prebicategory by auto corollary is_prebicategory_with_homs: shows "prebicategory_with_homs V H \ src trg" .. interpretation prebicategory_with_homs V H \ src trg using is_prebicategory_with_homs by auto text \ In a bicategory, an arrow is a weak unit if and only if it is isomorphic to its chosen source (or to its chosen target). \ lemma weak_unit_char: shows "weak_unit a \ a \ src a" and "weak_unit a \ a \ trg a" proof - show "weak_unit a \ a \ src a" using isomorphism_respects_weak_units isomorphic_symmetric by (meson ideD(1) isomorphic_implies_ide(2) obj_is_weak_unit obj_src source_iso_src weak_unit_iff_self_source weak_unit_self_composable(1)) show "weak_unit a \ a \ trg a" using isomorphism_respects_weak_units isomorphic_symmetric by (metis \weak_unit a = isomorphic a (src a)\ ideD(1) isomorphic_implies_hpar(3) isomorphic_implies_ide(1) src_trg target_iso_trg weak_unit_iff_self_target) qed interpretation H: partial_magma H using is_partial_magma by auto text \ Every arrow with respect to horizontal composition is also an arrow with respect to vertical composition. The converse is not necessarily true. \ lemma harr_is_varr: assumes "H.arr \" shows "arr \" - proof - - have "H.domains \ \ {} \ arr \" - proof - - assume 1: "H.domains \ \ {}" - obtain a where a: "H.ide a \ \ \ a \ null" - using 1 H.domains_def by auto - show "arr \" - using a hseq_char' H.ide_def by blast - qed - moreover have "H.codomains \ \ {} \ arr \" - proof - - assume 1: "H.codomains \ \ {}" - obtain a where a: "H.ide a \ a \ \ \ null" - using 1 H.codomains_def by auto - show "arr \" - using a hseq_char' ide_def by blast - qed - ultimately show ?thesis using assms H.arr_def by auto - qed + using H.arr_def H.codomains_def H.domains_def assms composable_implies_arr(1) + composable_implies_arr(2) + by auto text \ An identity for horizontal composition is also an identity for vertical composition. \ lemma horizontal_identity_is_ide: assumes "H.ide \" shows "ide \" proof - have \: "arr \" using assms H.ide_def composable_implies_arr(2) by auto hence 1: "\ \ dom \ \ null" using assms hom_connected H.ide_def by auto have "\ \ dom \ = dom \" using assms 1 H.ide_def by simp moreover have "\ \ dom \ = \" using assms 1 H.ide_def [of \] null_agreement by (metis \ cod_cod cod_dom hcomp_simps\<^sub>W\<^sub>C(3) ideD(2) ide_char' paste_1) ultimately have "dom \ = \" by simp thus ?thesis using \ by (metis ide_dom) qed text \ Every identity for horizontal composition is a weak unit. \ lemma horizontal_identity_is_weak_unit: assumes "H.ide \" shows "weak_unit \" using assms weak_unit_char by (metis H.ide_def comp_target_ide horizontal_identity_is_ide ideD(1) isomorphism_respects_weak_units null_agreement targetsD(2-3) trg_in_targets) end subsection "Vertically Discrete Bicategories are Categories" text \ In this section we show that if a bicategory is discrete with respect to vertical composition, then it is a category with respect to horizontal composition. To obtain this result, we need to establish that the set of arrows for the horizontal composition coincides with the set of arrows for the vertical composition. This is not true for a general bicategory, and even with the assumption that the vertical category is discrete it is not immediately obvious from the definitions. The issue is that the notion ``arrow'' for the horizontal composition is defined in terms of the existence of ``domains'' and ``codomains'' with respect to that composition, whereas the axioms for a bicategory only relate the notion ``arrow'' for the vertical category to the existence of sources and targets with respect to the horizontal composition. So we have to establish that, under the assumption of vertical discreteness, sources coincide with domains and targets coincide with codomains. We also need the fact that horizontal identities are weak units, which previously required some effort to show. \ locale vertically_discrete_bicategory = bicategory + assumes vertically_discrete: "ide = arr" begin interpretation prebicategory_with_homs V H \ src trg using is_prebicategory_with_homs by auto interpretation H: partial_magma H using is_partial_magma(1) by auto lemma weak_unit_is_horizontal_identity: assumes "weak_unit a" shows "H.ide a" proof - have "a \ a \ H.null" using assms weak_unit_self_composable by simp moreover have "\f. f \ a \ H.null \ f \ a = f" proof - fix f assume "f \ a \ H.null" hence "f \ a \ f" using assms comp_ide_source composable_implies_arr(2) sourcesI vertically_discrete by auto thus "f \ a = f" using vertically_discrete isomorphic_def by auto qed moreover have "\f. a \ f \ H.null \ a \ f = f" proof - fix f assume "a \ f \ H.null" hence "a \ f \ f" using assms comp_target_ide composable_implies_arr(1) targetsI vertically_discrete by auto thus "a \ f = f" using vertically_discrete isomorphic_def by auto qed ultimately show "H.ide a" using H.ide_def by simp qed lemma sources_eq_domains: shows "sources \ = H.domains \" using weak_unit_is_horizontal_identity H.domains_def sources_def horizontal_identity_is_weak_unit by auto lemma targets_eq_codomains: shows "targets \ = H.codomains \" using weak_unit_is_horizontal_identity H.codomains_def targets_def horizontal_identity_is_weak_unit by auto lemma arr_agreement: shows "arr = H.arr" using arr_def H.arr_def arr_iff_has_src arr_iff_has_trg sources_eq_domains targets_eq_codomains by auto interpretation H: category H proof show "\g f. g \ f \ H.null \ H.seq g f" using arr_agreement hcomp_simps\<^sub>W\<^sub>C(1) by auto show "\f. (H.domains f \ {}) = (H.codomains f \ {})" using sources_eq_domains targets_eq_codomains arr_iff_has_src arr_iff_has_trg by simp fix f g h show "H.seq h g \ H.seq (h \ g) f \ H.seq g f" using null_agreement arr_agreement H.not_arr_null preserves_arr VoV.arr_char by (metis hseq_char' match_1) show "H.seq h (g \ f) \ H.seq g f \ H.seq h g" using null_agreement arr_agreement H.not_arr_null preserves_arr VoV.arr_char by (metis hseq_char' match_2) show "H.seq g f \ H.seq h g \ H.seq (h \ g) f" using arr_agreement match_3 hseq_char(1) by auto show "H.seq g f \ H.seq h g \ (h \ g) \ f = h \ g \ f" proof - assume hg: "H.seq h g" assume gf: "H.seq g f" have "iso \[h, g, f] \ \\[h, g, f] : (h \ g) \ f \ h \ g \ f\" using hg gf vertically_discrete arr_agreement hseq_char assoc_in_hom iso_assoc by auto thus ?thesis using arr_agreement vertically_discrete by auto qed qed proposition is_category: shows "category H" .. end subsection "Obtaining the Unitors" text \ We now want to exploit the construction of unitors in a prebicategory with units, to obtain left and right unitors in a bicategory. However, a bicategory is not \emph{a priori} a prebicategory with units, because a bicategory only assigns unit isomorphisms to each \emph{object}, not to each weak unit. In order to apply the results about prebicategories with units to a bicategory, we first need to extend the bicategory to a prebicategory with units, by extending the mapping \\\, which provides a unit isomorphism for each object, to a mapping that assigns a unit isomorphism to all weak units. This extension can be made in an arbitrary way, as the values chosen for non-objects ultimately do not affect the components of the unitors at objects. \ context bicategory begin interpretation prebicategory V H \ using is_prebicategory by auto definition \' where "\' a \ SOME \. iso \ \ \ \ hom (a \ a) a \ (obj a \ \ = \[a])" lemma \'_extends_\: assumes "weak_unit a" shows "iso (\' a)" and "\\' a : a \ a \ a\" and "obj a \ \' a = \[a]" proof - let ?P = "\a \. iso \ \ \\ : a \ a \ a\ \ (obj a \ \ = \[a])" have "\\. ?P a \" by (metis assms iso_some_unit(1) iso_some_unit(2) iso_unit unit_in_vhom) hence 1: "?P a (\' a)" using \'_def someI_ex [of "?P a"] by simp show "iso (\' a)" using 1 by simp show "\\' a : a \ a \ a\" using 1 by simp show "obj a \ \' a = \[a]" using 1 by simp qed proposition extends_to_prebicategory_with_units: shows "prebicategory_with_units V H \ \'" using \'_extends_\ by unfold_locales auto interpretation PB: prebicategory_with_units V H \ \' using extends_to_prebicategory_with_units by auto interpretation PB: prebicategory_with_homs V H \ src trg using is_prebicategory_with_homs by auto interpretation PB: prebicategory_with_homs_and_units V H \ \' src trg .. proposition extends_to_prebicategory_with_homs_and_units: shows "prebicategory_with_homs_and_units V H \ \' src trg" .. definition lunit ("\[_]") where "\[a] \ PB.lunit a" definition runit ("\[_]") where "\[a] \ PB.runit a" abbreviation lunit' ("\\<^sup>-\<^sup>1[_]") where "\\<^sup>-\<^sup>1[a] \ inv \[a]" abbreviation runit' ("\\<^sup>-\<^sup>1[_]") where "\\<^sup>-\<^sup>1[a] \ inv \[a]" text \ \sloppypar The characterizations of the left and right unitors that we obtain from locale @{locale prebicategory_with_homs_and_units} mention the arbitarily chosen extension \\'\, rather than the given \\\. We want ``native versions'' for the present context. \ lemma lunit_char: assumes "ide f" shows "\\[f] : L f \ f\" and "L \[f] = (\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]" and "\!\. \\ : L f \ f\ \ L \ = (\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]" proof - have 1: "trg (PB.lunit f) = trg f" using assms PB.lunit_char [of f] vconn_implies_hpar(2) vconn_implies_hpar(4) by metis show "\\[f] : L f \ f\" unfolding lunit_def using assms PB.lunit_char by simp show "L \[f] = (\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]" unfolding lunit_def using assms 1 PB.lunit_char obj_is_weak_unit \'_extends_\ by simp let ?P = "\\. \\ : L f \ f\ \ L \ = (\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]" have "?P = (\\. \\ : trg f \ f \ f\ \ trg f \ \ = (\' (trg f) \ f) \ inv \[trg f, trg f, f])" proof - have "\\. \\ : L f \ f\ \ \\ : trg f \ f \ f\" using assms by simp moreover have "\\. \\ : L f \ f\ \ L \ = (\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f] \ trg f \ \ = (\' (trg f) \ f) \ inv \[trg f, trg f, f]" using calculation obj_is_weak_unit \'_extends_\ by auto ultimately show ?thesis by blast qed thus "\!\. \\ : L f \ f\ \ L \ = (\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]" using assms PB.lunit_char by simp qed lemma lunit_in_hom [intro]: assumes "ide f" shows "\\[f] : src f \ trg f\" and "\\[f] : trg f \ f \ f\" proof - show "\\[f] : trg f \ f \ f\" using assms lunit_char by auto thus "\\[f] : src f \ trg f\" by (metis arrI in_hhomI vconn_implies_hpar(1-4)) qed lemma lunit_in_vhom [simp]: assumes "ide f" and "trg f = b" shows "\\[f] : b \ f \ f\" using assms by auto lemma lunit_simps [simp]: assumes "ide f" shows "arr \[f]" and "src \[f] = src f" and "trg \[f] = trg f" and "dom \[f] = trg f \ f" and "cod \[f] = f" using assms lunit_in_hom apply auto using assms lunit_in_hom apply blast using assms lunit_in_hom by blast lemma runit_char: assumes "ide f" shows "\\[f] : R f \ f\" and "R \[f] = (f \ \[src f]) \ \[f, src f, src f]" and "\!\. \\ : R f \ f\ \ R \ = (f \ \[src f]) \ \[f, src f, src f]" proof - have 1: "src (PB.runit f) = src f" using assms PB.runit_char [of f] vconn_implies_hpar(1) vconn_implies_hpar(3) by metis show "\\[f] : R f \ f\" unfolding runit_def using assms PB.runit_char by simp show "R \[f] = (f \ \[src f]) \ \[f, src f, src f]" unfolding runit_def using assms 1 PB.runit_char obj_is_weak_unit \'_extends_\ by simp let ?P = "\\. \\ : R f \ f\ \ R \ = (f \ \[src f]) \ \[f, src f, src f]" have "?P = (\\. \\ : f \ src f \ f\ \ \ \ src f = (f \ \' (src f)) \ \[f, src f, src f])" proof - have "\\. \\ : R f \ f\ \ \\ : f \ src f \ f\" using assms by simp moreover have "\\. \\ : R f \ f\ \ R \ = (f \ \[src f]) \ \[f, src f, src f] \ \ \ src f = (f \ \' (src f)) \ \[f, src f, src f]" using calculation obj_is_weak_unit \'_extends_\ by auto ultimately show ?thesis by blast qed thus "\!\. \\ : R f \ f\ \ R \ = (f \ \[src f]) \ \[f, src f, src f]" using assms PB.runit_char by simp qed lemma runit_in_hom [intro]: assumes "ide f" shows "\\[f] : src f \ trg f\" and "\\[f] : f \ src f \ f\" proof - show "\\[f] : f \ src f \ f\" using assms runit_char by auto thus "\\[f] : src f \ trg f\" by (metis arrI in_hhom_def vconn_implies_hpar(1-4)) qed lemma runit_in_vhom [simp]: assumes "ide f" and "src f = a" shows "\\[f] : f \ a \ f\" using assms by auto lemma runit_simps [simp]: assumes "ide f" shows "arr \[f]" and "src \[f] = src f" and "trg \[f] = trg f" and "dom \[f] = f \ src f" and "cod \[f] = f" using assms runit_in_hom apply auto using assms runit_in_hom apply blast using assms runit_in_hom by blast lemma lunit_eqI: assumes "ide f" and "\\ : trg f \ f \ f\" and "trg f \ \ = (\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]" shows "\ = \[f]" unfolding lunit_def using assms PB.lunit_eqI \'_extends_\ trg.preserves_ide obj_is_weak_unit by simp lemma runit_eqI: assumes "ide f" and "\\ : f \ src f \ f\" and "\ \ src f = (f \ \[src f]) \ \[f, src f, src f]" shows "\ = \[f]" unfolding runit_def using assms PB.runit_eqI \'_extends_\ src.preserves_ide obj_is_weak_unit by simp lemma lunit_naturality: assumes "arr \" shows "\ \ \[dom \] = \[cod \] \ (trg \ \ \)" unfolding lunit_def using assms PB.lunit_naturality by auto lemma runit_naturality: assumes "arr \" shows "\ \ \[dom \] = \[cod \] \ (\ \ src \)" unfolding runit_def using assms PB.runit_naturality by auto lemma iso_lunit [simp]: assumes "ide f" shows "iso \[f]" unfolding lunit_def using assms PB.iso_lunit by blast lemma iso_runit [simp]: assumes "ide f" shows "iso \[f]" unfolding runit_def using assms PB.iso_runit by blast lemma iso_lunit' [simp]: assumes "ide f" shows "iso \\<^sup>-\<^sup>1[f]" using assms iso_lunit by blast lemma iso_runit' [simp]: assumes "ide f" shows "iso \\<^sup>-\<^sup>1[f]" using assms iso_runit by blast lemma lunit'_in_hom [intro]: assumes "ide f" shows "\\\<^sup>-\<^sup>1[f] : src f \ trg f\" and "\\\<^sup>-\<^sup>1[f] : f \ trg f \ f\" proof - show "\\\<^sup>-\<^sup>1[f] : f \ trg f \ f\" using assms lunit_char iso_lunit by simp thus "\\\<^sup>-\<^sup>1[f] : src f \ trg f\" using assms src_dom trg_dom by simp qed lemma lunit'_in_vhom [simp]: assumes "ide f" and "trg f = b" shows "\\\<^sup>-\<^sup>1[f] : f \ b \ f\" using assms by auto lemma lunit'_simps [simp]: assumes "ide f" shows "arr \\<^sup>-\<^sup>1[f]" and "src \\<^sup>-\<^sup>1[f] = src f" and "trg \\<^sup>-\<^sup>1[f] = trg f" and "dom \\<^sup>-\<^sup>1[f] = f" and "cod \\<^sup>-\<^sup>1[f] = trg f \ f" using assms lunit'_in_hom by auto lemma runit'_in_hom [intro]: assumes "ide f" shows "\\\<^sup>-\<^sup>1[f] : src f \ trg f\" and "\\\<^sup>-\<^sup>1[f] : f \ f \ src f\" proof - show "\\\<^sup>-\<^sup>1[f] : f \ f \ src f\" using assms runit_char iso_runit by simp thus "\\\<^sup>-\<^sup>1[f] : src f \ trg f\" using src_dom trg_dom by (simp add: assms) qed lemma runit'_in_vhom [simp]: assumes "ide f" and "src f = a" shows "\\\<^sup>-\<^sup>1[f] : f \ f \ a\" using assms by auto lemma runit'_simps [simp]: assumes "ide f" shows "arr \\<^sup>-\<^sup>1[f]" and "src \\<^sup>-\<^sup>1[f] = src f" and "trg \\<^sup>-\<^sup>1[f] = trg f" and "dom \\<^sup>-\<^sup>1[f] = f" and "cod \\<^sup>-\<^sup>1[f] = f \ src f" using assms runit'_in_hom by auto interpretation L: endofunctor V L .. interpretation \: transformation_by_components V V L map lunit using lunit_in_hom lunit_naturality by unfold_locales auto interpretation \: natural_isomorphism V V L map \.map using iso_lunit by (unfold_locales, auto) lemma natural_isomorphism_\: shows "natural_isomorphism V V L map \.map" .. abbreviation \ where "\ \ \.map" lemma \_ide_simp: assumes "ide f" shows "\ f = \[f]" using assms by simp interpretation L: equivalence_functor V V L using L.isomorphic_to_identity_is_equivalence \.natural_isomorphism_axioms by simp lemma equivalence_functor_L: shows "equivalence_functor V V L" .. lemma lunit_commutes_with_L: assumes "ide f" shows "\[L f] = L \[f]" unfolding lunit_def using assms PB.lunit_commutes_with_L by blast interpretation R: endofunctor V R .. interpretation \: transformation_by_components V V R map runit using runit_in_hom runit_naturality by unfold_locales auto interpretation \: natural_isomorphism V V R map \.map using iso_runit by (unfold_locales, auto) lemma natural_isomorphism_\: shows "natural_isomorphism V V R map \.map" .. abbreviation \ where "\ \ \.map" lemma \_ide_simp: assumes "ide f" shows "\ f = \[f]" using assms by simp interpretation R: equivalence_functor V V R using R.isomorphic_to_identity_is_equivalence \.natural_isomorphism_axioms by simp lemma equivalence_functor_R: shows "equivalence_functor V V R" .. lemma runit_commutes_with_R: assumes "ide f" shows "\[R f] = R \[f]" unfolding runit_def using assms PB.runit_commutes_with_R by blast lemma lunit'_naturality: assumes "arr \" shows "(trg \ \ \) \ \\<^sup>-\<^sup>1[dom \] = \\<^sup>-\<^sup>1[cod \] \ \" using assms iso_lunit lunit_naturality invert_opposite_sides_of_square L.preserves_arr L.preserves_cod arr_cod ide_cod ide_dom lunit_simps(1) lunit_simps(4) seqI by presburger lemma runit'_naturality: assumes "arr \" shows "(\ \ src \) \ \\<^sup>-\<^sup>1[dom \] = \\<^sup>-\<^sup>1[cod \] \ \" using assms iso_runit runit_naturality invert_opposite_sides_of_square R.preserves_arr R.preserves_cod arr_cod ide_cod ide_dom runit_simps(1) runit_simps(4) seqI by presburger lemma isomorphic_unit_right: assumes "ide f" shows "f \ src f \ f" using assms runit'_in_hom iso_runit' isomorphic_def isomorphic_symmetric by blast lemma isomorphic_unit_left: assumes "ide f" shows "trg f \ f \ f" using assms lunit'_in_hom iso_lunit' isomorphic_def isomorphic_symmetric by blast end subsection "Further Properties of Bicategories" text \ Here we derive further properties of bicategories, now that we have the unitors at our disposal. This section generalizes the corresponding development in theory @{theory MonoidalCategory.MonoidalCategory}, which has some diagrams to illustrate the longer calculations. The present section also includes some additional facts that are now nontrivial due to the partiality of horizontal composition. \ context bicategory begin lemma unit_simps [simp]: assumes "obj a" shows "arr \[a]" and "src \[a] = a" and "trg \[a] = a" and "dom \[a] = a \ a" and "cod \[a] = a" using assms unit_in_hom by blast+ lemma triangle: assumes "ide f" and "ide g" and "src g = trg f" shows "(g \ \[f]) \ \[g, src g, f] = \[g] \ f" proof - let ?b = "src g" have *: "(g \ \[?b \ f]) \ \[g, ?b, ?b \ f] = \[g] \ ?b \ f" proof - have 1: "((g \ \[?b \ f]) \ \[g, ?b, ?b \ f]) \ \[g \ ?b, ?b, f] = (\[g] \ ?b \ f) \ \[g \ ?b, ?b, f]" proof - have "((g \ \[?b \ f]) \ \[g, ?b, ?b \ f]) \ \[g \ ?b, ?b, f] = (g \ \[?b \ f]) \ \[g, ?b, ?b \ f] \ \[g \ ?b, ?b, f]" using HoVH_def HoHV_def comp_assoc by auto also have "... = (g \ \[?b \ f]) \ (g \ \[?b, ?b, f]) \ \[g, ?b \ ?b, f] \ (\[g, ?b, ?b] \ f)" using assms pentagon by force also have "... = ((g \ \[?b \ f]) \ (g \ \[?b, ?b, f])) \ \[g, ?b \ ?b, f] \ (\[g, ?b, ?b] \ f)" using assms assoc_in_hom HoVH_def HoHV_def comp_assoc by auto also have "... = ((g \ ?b \ \[f]) \ (g \ \[?b, ?b, f])) \ \[g, ?b \ ?b, f] \ (\[g, ?b, ?b] \ f)" using assms lunit_commutes_with_L lunit_in_hom by force also have "... = ((g \ (\[?b] \ f) \ \\<^sup>-\<^sup>1[?b, ?b, f]) \ (g \ \[?b, ?b, f])) \ \[g, ?b \ ?b, f] \ (\[g, ?b, ?b] \ f)" using assms lunit_char(2) by force also have "... = (g \ ((\[?b] \ f) \ \\<^sup>-\<^sup>1[?b, ?b, f]) \ \[?b, ?b, f]) \ \[g, ?b \ ?b, f] \ (\[g, ?b, ?b] \ f)" using assms interchange [of g g "(\[?b] \ f) \ \\<^sup>-\<^sup>1[?b, ?b, f]" "\[?b, ?b, f]"] by auto also have "... = ((g \ \[?b] \ f) \ \[g, ?b \ ?b, f]) \ (\[g, ?b, ?b] \ f)" using assms comp_arr_dom comp_assoc_assoc' comp_assoc by auto also have "... = (\[g, ?b, f] \ ((g \ \[?b]) \ f)) \ (\[g, ?b, ?b] \ f)" using assms assoc_naturality [of g "\[?b]" f] by simp also have "... = \[g, ?b, f] \ ((g \ \[?b]) \ \[g, ?b, ?b] \ f)" using assms interchange [of "g \ \[?b]" "\[g, ?b, ?b]" f f] comp_assoc by simp also have "... = \[g, ?b, f] \ ((\[g] \ ?b) \ f)" using assms runit_char(2) by force also have "... = (\[g] \ ?b \ f) \ \[g \ ?b, ?b, f]" using assms assoc_naturality [of "\[g]" ?b f] by auto finally show ?thesis by blast qed show "(g \ \[?b \ f]) \ \[g, ?b, ?b \ f] = \[g] \ ?b \ f" proof - have "epi \[g \ ?b, ?b, f]" using assms preserves_ide iso_assoc iso_is_retraction retraction_is_epi by force thus ?thesis using assms 1 by auto qed qed have "(g \ \[f]) \ \[g, ?b, f] = ((g \ \[f]) \ (g \ \[?b \ f]) \ (g \ ?b \ \\<^sup>-\<^sup>1[f])) \ (g \ ?b \ \[f]) \ \[g, ?b, ?b \ f] \ ((g \ ?b) \ \\<^sup>-\<^sup>1[f])" proof - have "\[g, ?b, f] = (g \ ?b \ \[f]) \ \[g, ?b, ?b \ f] \ ((g \ ?b) \ \\<^sup>-\<^sup>1[f])" proof - have "\[g, ?b, f] = (g \ ?b \ f) \ \[g, ?b, f]" using assms comp_cod_arr by simp have "\[g, ?b, f] = ((g \ ?b \ \[f]) \ (g \ ?b \ \\<^sup>-\<^sup>1[f])) \ \[g, ?b, f]" using assms comp_cod_arr comp_arr_inv' whisker_left [of g] whisker_left [of ?b "\[f]" "\\<^sup>-\<^sup>1[f]"] by simp also have "... = (g \ ?b \ \[f]) \ \[g, ?b, ?b \ f] \ ((g \ ?b) \ \\<^sup>-\<^sup>1[f])" using assms iso_lunit assoc_naturality [of g ?b "\\<^sup>-\<^sup>1[f]"] comp_assoc by force finally show ?thesis by blast qed moreover have "g \ \[f] = (g \ \[f]) \ (g \ \[?b \ f]) \ (g \ ?b \ \\<^sup>-\<^sup>1[f])" proof - have "(g \ \[?b \ f]) \ (g \ ?b \ \\<^sup>-\<^sup>1[f]) = g \ ?b \ f" proof - have "(g \ \[?b \ f]) \ (g \ ?b \ \\<^sup>-\<^sup>1[f]) = (g \ ?b \ \[f]) \ (g \ ?b \ \\<^sup>-\<^sup>1[f])" using assms lunit_in_hom lunit_commutes_with_L by simp also have "... = g \ ?b \ f" using assms comp_arr_inv' whisker_left [of g] whisker_left [of ?b "\[f]" "\\<^sup>-\<^sup>1[f]"] by simp finally show ?thesis by blast qed thus ?thesis using assms comp_arr_dom by auto qed ultimately show ?thesis by simp qed also have "... = (g \ \[f]) \ (g \ \[?b \ f]) \ ((g \ ?b \ \\<^sup>-\<^sup>1[f]) \ (g \ ?b \ \[f])) \ \[g, ?b, ?b \ f] \ ((g \ ?b) \ \\<^sup>-\<^sup>1[f])" using comp_assoc by simp also have "... = (g \ \[f]) \ (g \ \[?b \ f]) \ ((g \ ?b \ (?b \ f)) \ \[g, ?b, ?b \ f]) \ ((g \ ?b) \ \\<^sup>-\<^sup>1[f])" using assms iso_lunit comp_inv_arr' interchange [of g g "?b \ \\<^sup>-\<^sup>1[f]" "?b \ \[f]"] interchange [of ?b ?b "\\<^sup>-\<^sup>1[f]" "\[f]"] comp_assoc by auto also have "... = (g \ \[f]) \ ((g \ \[?b \ f]) \ \[g, ?b, ?b \ f]) \ ((g \ ?b) \ \\<^sup>-\<^sup>1[f])" using assms comp_cod_arr comp_assoc by auto also have "... = \[g] \ f" proof - have "\[g] \ f = (g \ \[f]) \ (\[g] \ ?b \ f) \ ((g \ ?b) \ \\<^sup>-\<^sup>1[f])" proof - have "(g \ \[f]) \ (\[g] \ ?b \ f) \ ((g \ ?b) \ \\<^sup>-\<^sup>1[f]) = (g \ \[f]) \ (\[g] \ (g \ ?b) \ (?b \ f) \ \\<^sup>-\<^sup>1[f])" using assms iso_lunit interchange [of "\[g]" "g \ ?b" "?b \ f" "\\<^sup>-\<^sup>1[f]"] by force also have "... = (g \ \[f]) \ (\[g] \ \\<^sup>-\<^sup>1[f])" using assms comp_arr_dom comp_cod_arr by simp also have "... = \[g] \ \[f] \ \\<^sup>-\<^sup>1[f]" using assms interchange [of g "\[g]" "\[f]" "\\<^sup>-\<^sup>1[f]"] comp_cod_arr by simp also have "... = \[g] \ f" using assms iso_lunit comp_arr_inv' by simp finally show ?thesis by argo qed thus ?thesis using assms * by argo qed finally show ?thesis by blast qed lemma lunit_hcomp_gen: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "(f \ \[g \ h]) \ (f \ \[trg g, g, h]) = f \ \[g] \ h" proof - have "((f \ \[g \ h]) \ (f \ \[trg g, g, h])) \ \[f, trg g \ g, h] \ (\[f, trg g, g] \ h) = (f \ (\[g] \ h)) \ \[f, trg g \ g, h] \ (\[f, trg g, g] \ h)" proof - have "((f \ \[g \ h]) \ (f \ \[trg g, g, h])) \ (\[f, trg g \ g, h] \ (\[f, trg g, g] \ h)) = ((f \ \[g \ h]) \ \[f, trg g, g \ h]) \ \[f \ trg g, g, h]" using assms pentagon comp_assoc by simp also have "... = (\[f] \ (g \ h)) \ \[f \ trg g, g, h]" using assms triangle [of "g \ h" f] by auto also have "... = \[f, g, h] \ ((\[f] \ g) \ h)" using assms assoc_naturality [of "\[f]" g h] by simp also have "... = (\[f, g, h] \ ((f \ \[g]) \ h)) \ (\[f, trg g, g] \ h)" using assms triangle interchange [of "f \ \[g]" "\[f, trg g, g]" h h] comp_assoc by auto also have "... = (f \ (\[g] \ h)) \ (\[f, trg g \ g, h] \ (\[f, trg g, g] \ h))" using assms assoc_naturality [of f "\[g]" h] comp_assoc by simp finally show ?thesis by blast qed moreover have "iso (\[f, trg g \ g, h] \ (\[f, trg g, g] \ h))" using assms iso_assoc isos_compose by simp ultimately show ?thesis using assms iso_is_retraction retraction_is_epi epiE [of "\[f, trg g \ g, h] \ (\[f, trg g, g] \ h)" "(f \ \[g \ h]) \ (f \ \[trg g, g, h])" "f \ \[g] \ h"] by auto qed lemma lunit_hcomp: assumes "ide f" and "ide g" and "src f = trg g" shows "\[f \ g] \ \[trg f, f, g] = \[f] \ g" and "\\<^sup>-\<^sup>1[trg f, f, g] \ \\<^sup>-\<^sup>1[f \ g] = \\<^sup>-\<^sup>1[f] \ g" and "\[f \ g] = (\[f] \ g) \ \\<^sup>-\<^sup>1[trg f, f, g]" and "\\<^sup>-\<^sup>1[f \ g] = \[trg f, f, g] \ (\\<^sup>-\<^sup>1[f] \ g)" proof - show 1: "\[f \ g] \ \[trg f, f, g] = \[f] \ g" proof - have "L (\[f \ g] \ \[trg f, f, g]) = L (\[f] \ g)" using assms interchange [of "trg f" "trg f" "\[f \ g]" "\[trg f, f, g]"] lunit_hcomp_gen by fastforce thus ?thesis using assms L.is_faithful [of "\[f \ g] \ \[trg f, f, g]" "\[f] \ g"] by force qed show "\\<^sup>-\<^sup>1[trg f, f, g] \ \\<^sup>-\<^sup>1[f \ g] = \\<^sup>-\<^sup>1[f] \ g" proof - have "\\<^sup>-\<^sup>1[trg f, f, g] \ \\<^sup>-\<^sup>1[f \ g] = inv (\[f \ g] \ \[trg f, f, g])" using assms by (simp add: inv_comp) also have "... = inv (\[f] \ g)" using 1 by simp also have "... = \\<^sup>-\<^sup>1[f] \ g" using assms by simp finally show ?thesis by simp qed show 2: "\[f \ g] = (\[f] \ g) \ \\<^sup>-\<^sup>1[trg f, f, g]" using assms 1 invert_side_of_triangle(2) by auto show "\\<^sup>-\<^sup>1[f \ g] = \[trg f, f, g] \ (\\<^sup>-\<^sup>1[f] \ g)" proof - have "\\<^sup>-\<^sup>1[f \ g] = inv ((\[f] \ g) \ \\<^sup>-\<^sup>1[trg f, f, g])" using 2 by simp also have "... = \[trg f, f, g] \ inv (\[f] \ g)" using assms inv_comp by simp also have "... = \[trg f, f, g] \ (\\<^sup>-\<^sup>1[f] \ g)" using assms by simp finally show ?thesis by simp qed qed lemma runit_hcomp_gen: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\[f \ g] \ h = ((f \ \[g]) \ h) \ (\[f, g, src g] \ h)" proof - have "\[f \ g] \ h = ((f \ g) \ \[h]) \ \[f \ g, src g, h]" using assms triangle by simp also have "... = (\\<^sup>-\<^sup>1[f, g, h] \ (f \ g \ \[h]) \ \[f, g, src g \ h]) \ \[f \ g, src g, h]" using assms assoc_naturality [of f g "\[h]"] invert_side_of_triangle(1) by simp also have "... = \\<^sup>-\<^sup>1[f, g, h] \ (f \ g \ \[h]) \ \[f, g, src g \ h] \ \[f \ g, src g, h]" using comp_assoc by simp also have "... = (\\<^sup>-\<^sup>1[f, g, h] \ (f \ (\[g] \ h))) \ (f \ \\<^sup>-\<^sup>1[g, src g, h]) \ \[f, g, src g \ h] \ \[f \ g, src g, h]" using assms interchange [of f f] triangle comp_assoc invert_side_of_triangle(2) [of "\[g] \ h" "g \ \[h]" "\[g, src g, h]"] by simp also have "... = ((f \ \[g]) \ h) \ \\<^sup>-\<^sup>1[f, g \ src g, h] \ (f \ \\<^sup>-\<^sup>1[g, src g, h]) \ \[f, g, src g \ h] \ \[f \ g, src g, h]" using assms assoc'_naturality [of f "\[g]" h] comp_assoc by simp also have "... = ((f \ \[g]) \ h) \ (\[f, g, src g] \ h)" using assms pentagon [of f g "src g" h] iso_assoc inv_hcomp invert_side_of_triangle(1) [of "\[f, g, src g \ h] \ \[f \ g, src g, h]" "f \ \[g, src g, h]" "\[f, g \ src g, h] \ (\[f, g, src g] \ h)"] invert_side_of_triangle(1) [of "(f \ \\<^sup>-\<^sup>1[g, src g, h]) \ \[f, g, src g \ h] \ \[f \ g, src g, h]" "\[f, g \ src g, h]" "\[f, g, src g] \ h"] by auto finally show ?thesis by blast qed lemma runit_hcomp: assumes "ide f" and "ide g" and "src f = trg g" shows "\[f \ g] = (f \ \[g]) \ \[f, g, src g]" and "\\<^sup>-\<^sup>1[f \ g] = \\<^sup>-\<^sup>1[f, g, src g] \ (f \ \\<^sup>-\<^sup>1[g])" and "\[f \ g] \ \\<^sup>-\<^sup>1[f, g, src g] = f \ \[g]" and "\[f, g, src g] \ \\<^sup>-\<^sup>1[f \ g] = f \ \\<^sup>-\<^sup>1[g]" proof - show 1: "\[f \ g] = (f \ \[g]) \ \[f, g, src g]" using assms interchange [of "f \ \[g]" "\[f, g, src g]" "src g" "src g"] runit_hcomp_gen [of f g "src g"] R.is_faithful [of "(f \ \[g]) \ (\[f, g, src g])" "\[f \ g]"] by simp show "\\<^sup>-\<^sup>1[f \ g] = \\<^sup>-\<^sup>1[f, g, src g] \ (f \ \\<^sup>-\<^sup>1[g])" using assms 1 inv_comp inv_hcomp by auto show 2: "\[f \ g] \ \\<^sup>-\<^sup>1[f, g, src g] = f \ \[g]" using assms 1 comp_arr_dom comp_cod_arr comp_assoc hseqI' comp_assoc_assoc' by auto show "\[f, g, src g] \ \\<^sup>-\<^sup>1[f \ g] = f \ \\<^sup>-\<^sup>1[g]" proof - have "\[f, g, src g] \ \\<^sup>-\<^sup>1[f \ g] = inv (\[f \ g] \ \\<^sup>-\<^sup>1[f, g, src g])" using assms inv_comp by simp also have "... = inv (f \ \[g])" using 2 by simp also have "... = f \ \\<^sup>-\<^sup>1[g]" using assms inv_hcomp [of f "\[g]"] by simp finally show ?thesis by simp qed qed lemma unitor_coincidence: assumes "obj a" shows "\[a] = \[a]" and "\[a] = \[a]" proof - have "R \[a] = R \[a] \ R \[a] = R \[a]" proof - have "R \[a] = (a \ \[a]) \ \[a, a, a]" using assms lunit_hcomp [of a a] lunit_commutes_with_L [of a] by auto moreover have "(a \ \[a]) \ \[a, a, a] = R \[a]" using assms triangle [of a a] by auto moreover have "(a \ \[a]) \ \[a, a, a] = R \[a]" proof - have "(a \ \[a]) \ \[a, a, a] = ((\[a] \ a) \ \\<^sup>-\<^sup>1[a, a, a]) \ \[a, a, a]" using assms lunit_char(2) by force also have "... = R \[a]" using assms comp_arr_dom comp_assoc comp_assoc_assoc' apply (elim objE) by (simp add: assms) finally show ?thesis by blast qed ultimately show ?thesis by argo qed moreover have "par \[a] \[a] \ par \[a] \[a]" using assms by auto ultimately have 1: "\[a] = \[a] \ \[a] = \[a]" using R.is_faithful by blast show "\[a] = \[a]" using 1 by auto show "\[a] = \[a]" using 1 by auto qed lemma unit_triangle: assumes "obj a" shows "\[a] \ a = (a \ \[a]) \ \[a, a, a]" and "(\[a] \ a) \ \\<^sup>-\<^sup>1[a, a, a] = a \ \[a]" proof - show 1: "\[a] \ a = (a \ \[a]) \ \[a, a, a]" using assms triangle [of a a] unitor_coincidence by auto show "(\[a] \ a) \ \\<^sup>-\<^sup>1[a, a, a] = a \ \[a]" using assms 1 invert_side_of_triangle(2) [of "\[a] \ a" "a \ \[a]" "\[a, a, a]"] assoc'_eq_inv_assoc by (metis hseqI' iso_assoc objE obj_def' unit_simps(1) unit_simps(2)) qed lemma hcomp_assoc_isomorphic: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "(f \ g) \ h \ f \ g \ h" using assms assoc_in_hom [of f g h] iso_assoc isomorphic_def by auto lemma hcomp_arr_obj: assumes "arr \" and "obj a" and "src \ = a" shows "\ \ a = \\<^sup>-\<^sup>1[cod \] \ \ \ \[dom \]" and "\[cod \] \ (\ \ a) \ \\<^sup>-\<^sup>1[dom \] = \" proof - show "\ \ a = \\<^sup>-\<^sup>1[cod \] \ \ \ \[dom \]" using assms iso_runit runit_naturality comp_cod_arr by (metis ide_cod ide_dom invert_side_of_triangle(1) runit_simps(1) runit_simps(5) seqI) show "\[cod \] \ (\ \ a) \ \\<^sup>-\<^sup>1[dom \] = \" using assms iso_runit runit_naturality [of \] comp_cod_arr by (metis ide_dom invert_side_of_triangle(2) comp_assoc runit_simps(1) runit_simps(5) seqI) qed lemma hcomp_obj_arr: assumes "arr \" and "obj b" and "b = trg \" shows "b \ \ = \\<^sup>-\<^sup>1[cod \] \ \ \ \[dom \]" and "\[cod \] \ (b \ \) \ \\<^sup>-\<^sup>1[dom \] = \" proof - show "b \ \ = \\<^sup>-\<^sup>1[cod \] \ \ \ \[dom \]" using assms iso_lunit lunit_naturality comp_cod_arr by (metis ide_cod ide_dom invert_side_of_triangle(1) lunit_simps(1) lunit_simps(5) seqI) show "\[cod \] \ (b \ \) \ \\<^sup>-\<^sup>1[dom \] = \" using assms iso_lunit lunit_naturality [of \] comp_cod_arr by (metis ide_dom invert_side_of_triangle(2) comp_assoc lunit_simps(1) lunit_simps(5) seqI) qed lemma hcomp_reassoc: assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "(\ \ \) \ \ = \\<^sup>-\<^sup>1[cod \, cod \, cod \] \ (\ \ \ \ \) \ \[dom \, dom \, dom \]" and "\ \ \ \ \ = \[cod \, cod \, cod \] \ ((\ \ \) \ \) \ \\<^sup>-\<^sup>1[dom \, dom \, dom \]" proof - show "(\ \ \) \ \ = \\<^sup>-\<^sup>1[cod \, cod \, cod \] \ (\ \ \ \ \) \ \[dom \, dom \, dom \]" proof - have "(\ \ \) \ \ = (\\<^sup>-\<^sup>1[cod \, cod \, cod \] \ \[cod \, cod \, cod \]) \ ((\ \ \) \ \)" using assms comp_assoc_assoc'(2) comp_cod_arr by simp also have "... = \\<^sup>-\<^sup>1[cod \, cod \, cod \] \ \[cod \, cod \, cod \] \ ((\ \ \) \ \)" using comp_assoc by simp also have "... = \\<^sup>-\<^sup>1[cod \, cod \, cod \] \ (\ \ \ \ \) \ \[dom \, dom \, dom \]" using assms assoc_naturality by simp finally show ?thesis by simp qed show "\ \ \ \ \ = \[cod \, cod \, cod \] \ ((\ \ \) \ \) \ \\<^sup>-\<^sup>1[dom \, dom \, dom \]" proof - have "\ \ \ \ \ = (\ \ \ \ \) \ \[dom \, dom \, dom \] \ \\<^sup>-\<^sup>1[dom \, dom \, dom \]" using assms comp_assoc_assoc'(1) comp_arr_dom by simp also have "... = ((\ \ \ \ \) \ \[dom \, dom \, dom \]) \ \\<^sup>-\<^sup>1[dom \, dom \, dom \]" using comp_assoc by simp also have "... = (\[cod \, cod \, cod \] \ ((\ \ \) \ \)) \ \\<^sup>-\<^sup>1[dom \, dom \, dom \]" using assms assoc_naturality by simp also have "... = \[cod \, cod \, cod \] \ ((\ \ \) \ \) \ \\<^sup>-\<^sup>1[dom \, dom \, dom \]" using comp_assoc by simp finally show ?thesis by simp qed qed lemma triangle': assumes "ide f" and "ide g" and "src f = trg g" shows "(f \ \[g]) = (\[f] \ g) \ \\<^sup>-\<^sup>1[f, src f, g]" - proof - - have "(\[f] \ g) \ \\<^sup>-\<^sup>1[f, src f, g] = ((f \ \[g]) \ \[f, src f, g]) \ \\<^sup>-\<^sup>1[f, src f, g]" - using assms triangle by auto - also have "... = (f \ \[g])" - using assms comp_arr_dom comp_assoc comp_assoc_assoc' by auto - finally show ?thesis by auto - qed + using assms(1-3) invert_side_of_triangle(2) triangle by force lemma pentagon': assumes "ide f" and "ide g" and "ide h" and "ide k" and "src f = trg g" and "src g = trg h" and "src h = trg k" shows "((\\<^sup>-\<^sup>1[f, g, h] \ k) \ \\<^sup>-\<^sup>1[f, g \ h, k]) \ (f \ \\<^sup>-\<^sup>1[g, h, k]) = \\<^sup>-\<^sup>1[f \ g, h, k] \ \\<^sup>-\<^sup>1[f, g, h \ k]" proof - have "((\\<^sup>-\<^sup>1[f, g, h] \ k) \ \\<^sup>-\<^sup>1[f, g \ h, k]) \ (f \ \\<^sup>-\<^sup>1[g, h, k]) = inv ((f \ \[g, h, k]) \ (\[f, g \ h, k] \ (\[f, g, h] \ k)))" proof - have "inv ((f \ \[g, h, k]) \ (\[f, g \ h, k] \ (\[f, g, h] \ k))) = inv (\[f, g \ h, k] \ (\[f, g, h] \ k)) \ inv (f \ \[g, h, k])" using assms inv_comp [of "\[f, g \ h, k] \ (\[f, g, h] \ k)" "f \ \[g, h, k]"] by force also have "... = (inv (\[f, g, h] \ k) \ inv \[f, g \ h, k]) \ inv (f \ \[g, h, k])" using assms iso_assoc inv_comp by simp also have "... = ((\\<^sup>-\<^sup>1[f, g, h] \ k) \ \\<^sup>-\<^sup>1[f, g \ h, k]) \ (f \ \\<^sup>-\<^sup>1[g, h, k])" using assms inv_hcomp by simp finally show ?thesis by simp qed also have "... = inv (\[f, g, h \ k] \ \[f \ g, h, k])" using assms pentagon by simp also have "... = \\<^sup>-\<^sup>1[f \ g, h, k] \ \\<^sup>-\<^sup>1[f, g, h \ k]" using assms inv_comp by simp finally show ?thesis by auto qed end text \ The following convenience locale extends @{locale bicategory} by pre-interpreting the various functors and natural transformations. \ locale extended_bicategory = bicategory + L: equivalence_functor V V L + R: equivalence_functor V V R + \: natural_isomorphism VVV.comp V HoHV HoVH \\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))\ + \': inverse_transformation VVV.comp V HoHV HoVH \\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))\ + \: natural_isomorphism V V L map \ + \': inverse_transformation V V L map \ + \: natural_isomorphism V V R map \ + \': inverse_transformation V V R map \ sublocale bicategory \ extended_bicategory V H \ \ src trg proof - interpret L: equivalence_functor V V L using equivalence_functor_L by auto interpret R: equivalence_functor V V R using equivalence_functor_R by auto interpret \': inverse_transformation VVV.comp V HoHV HoVH \\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))\ .. interpret \: natural_isomorphism V V L map \ using natural_isomorphism_\ by auto interpret \': inverse_transformation V V L map \ .. interpret \: natural_isomorphism V V R map \ using natural_isomorphism_\ by auto interpret \': inverse_transformation V V R map \ .. interpret extended_bicategory V H \ \ src trg .. show "extended_bicategory V H \ \ src trg" .. qed end diff --git a/thys/Bicategory/BicategoryOfSpans.thy b/thys/Bicategory/BicategoryOfSpans.thy --- a/thys/Bicategory/BicategoryOfSpans.thy +++ b/thys/Bicategory/BicategoryOfSpans.thy @@ -1,14697 +1,14655 @@ (* Title: BicategoryOfSpans Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) section "Bicategories of Spans" theory BicategoryOfSpans imports Category3.ConcreteCategory IsomorphismClass CanonicalIsos EquivalenceOfBicategories SpanBicategory Tabulation begin text \ In this section, we prove CKS Theorem 4, which characterizes up to equivalence the bicategories of spans in a category with pullbacks. The characterization consists of three conditions: BS1: ``Every 1-cell is isomorphic to a composition \g \ f\<^sup>*\, where f and g are maps''; BS2: ``For every span of maps \(f, g)\ there is a 2-cell \\\ such that \(f, \, g)\ is a tabulation''; and BS3: ``Any two 2-cells between the same pair of maps are equal and invertible.'' One direction of the proof, which is the easier direction once it is established that BS1 and BS3 are respected by equivalence of bicategories, shows that if a bicategory \B\ is biequivalent to the bicategory of spans in some category \C\ with pullbacks, then it satisfies BS1 -- BS3. The other direction, which is harder, shows that a bicategory \B\ satisfying BS1 -- BS3 is biequivalent to the bicategory of spans in a certain category with pullbacks that is constructed from the sub-bicategory of maps of \B\. \ subsection "Definition" text \ We define a \emph{bicategory of spans} to be a bicategory that satisfies the conditions \BS1\ -- \BS3\ stated informally above. \ locale bicategory_of_spans = bicategory + chosen_right_adjoints + assumes BS1: "ide r \ \f g. is_left_adjoint f \ is_left_adjoint g \ isomorphic r (g \ f\<^sup>*)" and BS2: "\ is_left_adjoint f; is_left_adjoint g; src f = src g \ \ \r \. tabulation V H \ \ src trg r \ f g" and BS3: "\ is_left_adjoint f; is_left_adjoint f'; \\ : f \ f'\; \\' : f \ f'\ \ \ iso \ \ iso \' \ \ = \'" text \ Using the already-established fact \equivalence_pseudofunctor.reflects_tabulation\ that tabulations are reflected by equivalence pseudofunctors, it is not difficult to prove that the notion `bicategory of spans' respects equivalence of bicategories. \ lemma bicategory_of_spans_respects_equivalence: assumes "equivalent_bicategories V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D" and "bicategory_of_spans V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C" shows "bicategory_of_spans V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D" proof - interpret C: bicategory_of_spans V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C using assms by simp interpret C: chosen_right_adjoints V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C .. interpret D: bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D using assms equivalent_bicategories_def equivalence_pseudofunctor.axioms(1) pseudofunctor.axioms(2) by fast interpret D: chosen_right_adjoints V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D .. obtain F \ where F: "equivalence_pseudofunctor V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D F \" using assms equivalent_bicategories_def by blast interpret F: equivalence_pseudofunctor V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D F \ using F by simp interpret E: equivalence_of_bicategories V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C (* 17 sec *) F \ F.right_map F.right_cmp F.unit\<^sub>0 F.unit\<^sub>1 F.counit\<^sub>0 F.counit\<^sub>1 using F.extends_to_equivalence_of_bicategories by simp interpret E': converse_equivalence_of_bicategories V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C F \ F.right_map F.right_cmp F.unit\<^sub>0 F.unit\<^sub>1 F.counit\<^sub>0 F.counit\<^sub>1 .. interpret G: equivalence_pseudofunctor V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C F.right_map F.right_cmp using E'.equivalence_pseudofunctor_left by simp write V\<^sub>C (infixr "\\<^sub>C" 55) write V\<^sub>D (infixr "\\<^sub>D" 55) write H\<^sub>C (infixr "\\<^sub>C" 53) write H\<^sub>D (infixr "\\<^sub>D" 53) write \\<^sub>C ("\\<^sub>C[_, _, _]") write \\<^sub>D ("\\<^sub>D[_, _, _]") write C.in_hhom ("\_ : _ \\<^sub>C _\") write C.in_hom ("\_ : _ \\<^sub>C _\") write D.in_hhom ("\_ : _ \\<^sub>D _\") write D.in_hom ("\_ : _ \\<^sub>D _\") write C.isomorphic (infix "\\<^sub>C" 50) write D.isomorphic (infix "\\<^sub>D" 50) write C.some_right_adjoint ("_\<^sup>*\<^sup>C" [1000] 1000) write D.some_right_adjoint ("_\<^sup>*\<^sup>D" [1000] 1000) show "bicategory_of_spans V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D" proof show "\r'. D.ide r' \ \f' g'. D.is_left_adjoint f' \ D.is_left_adjoint g' \ r' \\<^sub>D g' \\<^sub>D (f')\<^sup>*\<^sup>D" proof - fix r' assume r': "D.ide r'" obtain f g where fg: "C.is_left_adjoint f \ C.is_left_adjoint g \ F.right_map r' \\<^sub>C g \\<^sub>C f\<^sup>*\<^sup>C" using r' C.BS1 [of "F.right_map r'"] by auto have trg_g: "trg\<^sub>C g = E.G.map\<^sub>0 (trg\<^sub>D r')" using fg r' C.isomorphic_implies_ide C.isomorphic_implies_hpar by (metis C.ideD(1) C.trg_hcomp D.ideD(1) E.G.preserves_trg) have trg_f: "trg\<^sub>C f = E.G.map\<^sub>0 (src\<^sub>D r')" using fg r' C.isomorphic_implies_ide C.isomorphic_implies_hpar by (metis C.ideD(1) C.right_adjoint_simps(2) C.src_hcomp D.ideD(1) E.G.preserves_src) define d_src where "d_src \ F.counit\<^sub>0 (src\<^sub>D r')" define e_src where "e_src \ (F.counit\<^sub>0 (src\<^sub>D r'))\<^sup>~\<^sup>D" have d_src: "\d_src : F.map\<^sub>0 (E.G.map\<^sub>0 (src\<^sub>D r')) \\<^sub>D src\<^sub>D r'\ \ D.equivalence_map d_src" using d_src_def r' E.\.map\<^sub>0_in_hhom E.\.components_are_equivalences by simp have e_src: "\e_src : src\<^sub>D r' \\<^sub>D F.map\<^sub>0 (E.G.map\<^sub>0 (src\<^sub>D r'))\ \ D.equivalence_map e_src" using e_src_def r' E.\.map\<^sub>0_in_hhom E.\.components_are_equivalences by simp obtain \_src \_src where eq_src: "equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D d_src e_src \_src \_src" using d_src_def e_src_def d_src e_src D.quasi_inverses_some_quasi_inverse D.quasi_inverses_def by blast interpret eq_src: equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D d_src e_src \_src \_src using eq_src by simp define d_trg where "d_trg \ F.counit\<^sub>0 (trg\<^sub>D r')" define e_trg where "e_trg \ (F.counit\<^sub>0 (trg\<^sub>D r'))\<^sup>~\<^sup>D" have d_trg: "\d_trg : F.map\<^sub>0 (E.G.map\<^sub>0 (trg\<^sub>D r')) \\<^sub>D trg\<^sub>D r'\ \ D.equivalence_map d_trg" using d_trg_def r' E.\.map\<^sub>0_in_hhom E.\.components_are_equivalences by simp have e_trg: "\e_trg : trg\<^sub>D r' \\<^sub>D F.map\<^sub>0 (E.G.map\<^sub>0 (trg\<^sub>D r'))\ \ D.equivalence_map e_trg" using e_trg_def r' E.\.map\<^sub>0_in_hhom E.\.components_are_equivalences by simp obtain \_trg \_trg where eq_trg: "equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D d_trg e_trg \_trg \_trg" using d_trg_def e_trg_def d_trg e_trg D.quasi_inverses_some_quasi_inverse D.quasi_inverses_def by blast interpret eq_trg: equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D d_trg e_trg \_trg \_trg using eq_trg by simp interpret eqs: two_equivalences_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D d_src e_src \_src \_src d_trg e_trg \_trg \_trg .. interpret hom: subcategory V\<^sub>D \\\. \\ : trg\<^sub>D d_src \\<^sub>D trg\<^sub>D d_trg\\ using D.hhom_is_subcategory by simp interpret hom': subcategory V\<^sub>D \\\. \\ : src\<^sub>D d_src \\<^sub>D src\<^sub>D d_trg\\ using D.hhom_is_subcategory by simp interpret e: equivalence_of_categories hom.comp hom'.comp eqs.F eqs.G eqs.\ eqs.\ using eqs.induces_equivalence_of_hom_categories by simp have r'_in_hhom: "D.in_hhom r' (src\<^sub>D e_src) (src\<^sub>D e_trg)" using r' e_src e_trg by (simp add: D.in_hhom_def) define g' where "g' = d_trg \\<^sub>D F g" have g': "D.is_left_adjoint g'" unfolding g'_def using fg r' d_trg trg_g C.left_adjoint_is_ide D.equivalence_is_adjoint D.left_adjoints_compose F.preserves_left_adjoint C.ideD(1) D.in_hhom_def F.preserves_trg by metis have 1: "D.is_right_adjoint (F f\<^sup>*\<^sup>C \\<^sub>D e_src)" proof - have "D.is_right_adjoint e_src" using r' e_src D.equivalence_is_adjoint by simp moreover have "D.is_right_adjoint (F f\<^sup>*\<^sup>C)" using fg C.left_adjoint_extends_to_adjoint_pair F.preserves_adjoint_pair by blast moreover have "src\<^sub>D (F f\<^sup>*\<^sup>C) = trg\<^sub>D e_src" using fg r' trg_f C.right_adjoint_is_ide e_src by auto ultimately show ?thesis using fg r' D.right_adjoints_compose F.preserves_right_adjoint by blast qed obtain f' where f': "D.adjoint_pair f' (F f\<^sup>*\<^sup>C \\<^sub>D e_src)" using 1 by auto have f': "D.is_left_adjoint f' \ F f\<^sup>*\<^sup>C \\<^sub>D e_src \\<^sub>D (f')\<^sup>*\<^sup>D" using f' D.left_adjoint_determines_right_up_to_iso D.left_adjoint_extends_to_adjoint_pair by blast have "r' \\<^sub>D d_trg \\<^sub>D (e_trg \\<^sub>D r' \\<^sub>D d_src) \\<^sub>D e_src" using r' r'_in_hhom D.isomorphic_def eqs.\_in_hom eqs.\_components_are_iso D.isomorphic_symmetric D.ide_char eq_src.antipar(2) eq_trg.antipar(2) by metis also have 1: "... \\<^sub>D d_trg \\<^sub>D F (F.right_map r') \\<^sub>D e_src" proof - have "e_trg \\<^sub>D r' \\<^sub>D d_src \\<^sub>D F (F.right_map r')" proof - have "D.in_hom (F.counit\<^sub>1 r') (r' \\<^sub>D d_src) (F.counit\<^sub>0 (trg\<^sub>D r') \\<^sub>D F (F.right_map r'))" unfolding d_src_def using r' E.\.map\<^sub>1_in_hom(2) [of r'] by simp hence "r' \\<^sub>D d_src \\<^sub>D F.counit\<^sub>0 (trg\<^sub>D r') \\<^sub>D F (F.right_map r')" using r' D.isomorphic_def E.\.iso_map\<^sub>1_ide by auto thus ?thesis using r' e_trg_def E.\.components_are_equivalences D.isomorphic_symmetric D.quasi_inverse_transpose(2) by (metis D.isomorphic_implies_hpar(1) F.preserves_isomorphic d_trg d_trg_def eq_trg.ide_left fg) qed thus ?thesis using D.hcomp_ide_isomorphic D.hcomp_isomorphic_ide D.in_hhom_def D.isomorphic_implies_hpar(4) d_trg e_src eq_src.antipar(1-2) eq_trg.antipar(2) r' by force qed also have 2: "... \\<^sub>D d_trg \\<^sub>D (F g \\<^sub>D F f\<^sup>*\<^sup>C) \\<^sub>D e_src" proof - have "F (F.right_map r') \\<^sub>D F g \\<^sub>D F f\<^sup>*\<^sup>C" by (meson C.hseq_char C.ideD(1) C.isomorphic_implies_ide(2) C.left_adjoint_is_ide C.right_adjoint_simps(1) D.isomorphic_symmetric D.isomorphic_transitive F.preserves_isomorphic F.weakly_preserves_hcomp fg) thus ?thesis using D.hcomp_ide_isomorphic D.hcomp_isomorphic_ide by (metis 1 D.hseqE D.ideD(1) D.isomorphic_implies_hpar(2) eq_src.ide_right eq_trg.ide_left) qed also have 3: "... \\<^sub>D (d_trg \\<^sub>D F g) \\<^sub>D F f\<^sup>*\<^sup>C \\<^sub>D e_src" proof - have "... \\<^sub>D d_trg \\<^sub>D F g \\<^sub>D F f\<^sup>*\<^sup>C \\<^sub>D e_src" by (metis C.left_adjoint_is_ide C.right_adjoint_simps(1) D.hcomp_assoc_isomorphic D.hcomp_ide_isomorphic D.hcomp_simps(1) D.hseq_char D.ideD(1) D.isomorphic_implies_hpar(2) F.preserves_ide calculation eq_src.ide_right eq_trg.ide_left fg) also have "... \\<^sub>D (d_trg \\<^sub>D F g) \\<^sub>D F f\<^sup>*\<^sup>C \\<^sub>D e_src" by (metis C.left_adjoint_is_ide D.hcomp_assoc_isomorphic D.hcomp_simps(2) D.hseq_char D.ideD(1) D.isomorphic_implies_ide(1) D.isomorphic_symmetric F.preserves_ide calculation eq_trg.ide_left f' fg) finally show ?thesis by blast qed also have "... \\<^sub>D g' \\<^sub>D f'\<^sup>*\<^sup>D" using g'_def f' by (metis 3 D.adjoint_pair_antipar(1) D.hcomp_ide_isomorphic D.hseq_char D.ideD(1) D.isomorphic_implies_ide(2) g') finally have "D.isomorphic r' (g' \\<^sub>D f'\<^sup>*\<^sup>D)" by simp thus "\f' g'. D.is_left_adjoint f' \ D.is_left_adjoint g' \ r' \\<^sub>D g' \\<^sub>D f'\<^sup>*\<^sup>D" using f' g' by auto qed show "\f f' \ \'. \ D.is_left_adjoint f; D.is_left_adjoint f'; \\ : f \\<^sub>D f'\; \\' : f \\<^sub>D f'\ \ \ D.iso \ \ D.iso \' \ \ = \'" proof - fix f f' \ \' assume f: "D.is_left_adjoint f" and f': "D.is_left_adjoint f'" and \: "\\ : f \\<^sub>D f'\" and \': "\\' : f \\<^sub>D f'\" have "C.is_left_adjoint (F.right_map f) \ C.is_left_adjoint (F.right_map f')" using f f' E.G.preserves_left_adjoint by blast moreover have "\F.right_map \ : F.right_map f \\<^sub>C F.right_map f'\ \ \F.right_map \' : F.right_map f \\<^sub>C F.right_map f'\" using \ \' E.G.preserves_hom by simp ultimately have "C.iso (F.right_map \) \ C.iso (F.right_map \') \ F.right_map \ = F.right_map \'" using C.BS3 by blast thus "D.iso \ \ D.iso \' \ \ = \'" using \ \' G.reflects_iso G.is_faithful by blast qed show "\f g. \ D.is_left_adjoint f; D.is_left_adjoint g; src\<^sub>D f = src\<^sub>D g \ \ \r \. tabulation V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D r \ f g" proof - fix f g assume f: "D.is_left_adjoint f" assume g: "D.is_left_adjoint g" assume fg: "src\<^sub>D f = src\<^sub>D g" have "C.is_left_adjoint (F.right_map f)" using f E.G.preserves_left_adjoint by blast moreover have "C.is_left_adjoint (F.right_map g)" using g E.G.preserves_left_adjoint by blast moreover have "src\<^sub>C (F.right_map f) = src\<^sub>C (F.right_map g)" using f g D.left_adjoint_is_ide fg by simp ultimately have 1: "\r \. tabulation V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C r \ (F.right_map f) (F.right_map g)" using C.BS2 by simp obtain r \ where \: "tabulation V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C r \ (F.right_map f) (F.right_map g)" using 1 by auto interpret \: tabulation V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C r \ \F.right_map f\ \F.right_map g\ using \ by simp obtain r' where r': "D.ide r' \ D.in_hhom r' (trg\<^sub>D f) (trg\<^sub>D g) \ C.isomorphic (F.right_map r') r" using f g \.ide_base \.tab_in_hom G.locally_essentially_surjective by (metis D.obj_trg E.G.preserves_reflects_arr E.G.preserves_trg \.leg0_simps(2-3) \.leg1_simps(2,4) \.base_in_hom(1)) obtain \ where \: "\\ : r \\<^sub>C F.right_map r'\ \ C.iso \" using r' C.isomorphic_symmetric by blast have \: "tabulation V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C (F.right_map r') ((\ \\<^sub>C F.right_map f) \\<^sub>C \) (F.right_map f) (F.right_map g)" using \ \.is_preserved_by_base_iso by simp have 1: "\\'. \\' : g \\<^sub>D H\<^sub>D r' f\ \ F.right_map \' = F.right_cmp (r', f) \\<^sub>C (\ \\<^sub>C F.right_map f) \\<^sub>C \" proof - have "D.ide g" by (simp add: D.left_adjoint_is_ide g) moreover have "D.ide (H\<^sub>D r' f)" using f r' D.left_adjoint_is_ide by auto moreover have "src\<^sub>D g = src\<^sub>D (H\<^sub>D r' f)" using fg by (simp add: calculation(2)) moreover have "trg\<^sub>D g = trg\<^sub>D (H\<^sub>D r' f)" using calculation(2) r' by auto moreover have "\F.right_cmp (r', f) \\<^sub>C (\ \\<^sub>C F.right_map f) \\<^sub>C \ : F.right_map g \\<^sub>C F.right_map (r' \\<^sub>D f)\" using f g r' \ D.left_adjoint_is_ide \.ide_base by (intro C.comp_in_homI, auto) ultimately show ?thesis using G.locally_full by simp qed obtain \' where \': "\\' : g \\<^sub>D H\<^sub>D r' f\ \ F.right_map \' = F.right_cmp (r', f) \\<^sub>C (\ \\<^sub>C F.right_map f) \\<^sub>C \" using 1 by auto have "tabulation V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D r' \' f g" proof - have "C.inv (F.right_cmp (r', f)) \\<^sub>C F.right_map \' = (\ \\<^sub>C F.right_map f) \\<^sub>C \" using r' f \' C.comp_assoc C.comp_cod_arr C.invert_side_of_triangle(1) by (metis D.adjoint_pair_antipar(1) D.arrI D.in_hhomE E.G.cmp_components_are_iso E.G.preserves_arr) thus ?thesis using \ \' G.reflects_tabulation by (simp add: D.left_adjoint_is_ide f r') qed thus "\r' \'. tabulation V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D r' \' f g" by auto qed qed qed subsection "Span(C) is a Bicategory of Spans" text \ We first consider an arbitrary 1-cell \r\ in \Span(C)\, and show that it has a tabulation as a span of maps. This is CKS Proposition 3 (stated more strongly to assert that the ``output leg'' can also be taken to be a map, which the proof shows already). \ locale identity_arrow_in_span_bicategory = (* 20 sec *) span_bicategory C prj0 prj1 + r: identity_arrow_of_spans C r for C :: "'a comp" (infixr "\" 55) and prj0 :: "'a \ 'a \ 'a" ("\

\<^sub>0[_, _]") and prj1 :: "'a \ 'a \ 'a" ("\

\<^sub>1[_, _]") and r :: "'a arrow_of_spans_data" begin text \ CKS say: ``Suppose \r = (r\<^sub>0, R, r\<^sub>1): A \ B\ and put \f = (1, R, r\<^sub>0)\, \g = (1, R, r\<^sub>1)\. Let \k\<^sub>0, k\<^sub>1\ form a kernel pair for \r\<^sub>0\ and define \\\ by \k\<^sub>0\ = k\<^sub>1\ = 1\<^sub>R\.'' \ abbreviation ra where "ra \ r.dom.apex" abbreviation r0 where "r0 \ r.dom.leg0" abbreviation r1 where "r1 \ r.dom.leg1" abbreviation f where "f \ mkIde ra r0" abbreviation g where "g \ mkIde ra r1" abbreviation k0 where "k0 \ \

\<^sub>0[r0, r0]" abbreviation k1 where "k1 \ \

\<^sub>1[r0, r0]" text \ Here \ra\ is the apex \R\ of the span \(r\<^sub>0, R, r\<^sub>1)\, and the spans \f\ and \g\ also have that same 0-cell as their apex. The tabulation 2-cell \\\ has to be an arrow of spans from \g = (1, R, r\<^sub>1)\ to \r \ f\, which is the span \(k\<^sub>0, r\<^sub>1 \ k\<^sub>1)\. \ abbreviation \ where "\ \ \Chn = \ra \r0, r0\ ra\, Dom = \Leg0 = ra, Leg1 = r1\, Cod = \Leg0 = k0, Leg1 = r1 \ k1\\" lemma has_tabulation: shows "tabulation vcomp hcomp assoc unit src trg r \ f g" and "is_left_adjoint f" and "is_left_adjoint g" proof - have ide_f: "ide f" using ide_mkIde r.dom.leg_in_hom(1) C.arr_dom C.dom_dom r.dom.apex_def r.dom.leg_simps(1) by presburger interpret f: identity_arrow_of_spans C f using ide_f ide_char' by auto have ide_g: "ide g" using ide_mkIde r.dom.leg_in_hom by (metis C.arr_dom C.dom_dom r.dom.leg_simps(3) r.dom.leg_simps(4)) interpret g: identity_arrow_of_spans C g using ide_g ide_char' by auto show "is_left_adjoint f" using is_left_adjoint_char [of f] ide_f by simp show "is_left_adjoint g" using is_left_adjoint_char [of g] ide_g by simp have ide_r: "ide r" using ide_char' r.identity_arrow_of_spans_axioms by auto have src_r: "src r = mkObj (C.cod r0)" by (simp add: ide_r src_def) have trg_r: "trg r = mkObj (C.cod r1)" by (simp add: ide_r trg_def) have src_f: "src f = mkObj ra" using ide_f src_def by auto have trg_f: "trg f = mkObj (C.cod r0)" using ide_f trg_def by auto have src_g: "src g = mkObj ra" using ide_g src_def by auto have trg_g: "trg g = mkObj (C.cod r1)" using ide_g trg_def by auto have hseq_rf: "hseq r f" using ide_r ide_f src_r trg_f by simp interpret rf: two_composable_arrows_of_spans C prj0 prj1 r f using hseq_rf hseq_char by unfold_locales auto interpret rf: two_composable_identity_arrows_of_spans C prj0 prj1 r f .. interpret rf: identity_arrow_of_spans C \r \ f\ using rf.ide_composite ide_char' by auto let ?rf = "r \ f" (* TODO: Put this expansion into two_composable_identity_arrows_of_spans. *) have rf: "?rf = \Chn = r0 \\ r0, Dom = \Leg0 = k0, Leg1 = r1 \ k1\, Cod = \Leg0 = k0, Leg1 = r1 \ k1\\" unfolding hcomp_def chine_hcomp_def using hseq_rf C.comp_cod_arr by auto interpret Cod_rf: span_in_category C \\Leg0 = k0, Leg1 = r1 \ k1\\ using ide_r ide_f rf C.comp_cod_arr by unfold_locales auto have Dom_g: "Dom g = \Leg0 = ra, Leg1 = r1\" by simp interpret Dom_g: span_in_category C \\Leg0 = ra, Leg1 = r1\\ using Dom_g g.dom.span_in_category_axioms by simp interpret Dom_\: span_in_category C \Dom \\ using Dom_g g.dom.span_in_category_axioms by simp interpret Cod_\: span_in_category C \Cod \\ using rf Cod_rf.span_in_category_axioms by simp interpret \: arrow_of_spans C \ using Dom_\.apex_def Cod_\.apex_def C.comp_assoc C.comp_arr_dom by unfold_locales auto have \: "\\ : g \ r \ f\" using rf ide_g arr_char dom_char cod_char \.arrow_of_spans_axioms ideD(2) Cod_rf.apex_def g.dom.leg_simps(4) by auto show "tabulation vcomp hcomp assoc unit src trg r \ f g" proof - interpret T: tabulation_data vcomp hcomp assoc unit src trg r \ f g using ide_f \ by unfold_locales auto show ?thesis proof show T1: "\u \. \ ide u; \\ : dom \ \ r \ u\ \ \ \w \ \. ide w \ \\ : f \ w \ u\ \ \\ : dom \ \ g \ w\ \ iso \ \ T.composite_cell w \ \ \ = \" proof - fix u \ assume u: "ide u" assume \: "\\ : dom \ \ r \ u\" show "\w \ \. ide w \ \\ : f \ w \ u\ \ \\ : dom \ \ g \ w\ \ iso \ \ T.composite_cell w \ \ \ = \" proof - interpret u: identity_arrow_of_spans C u using u ide_char' by auto have v: "ide (dom \)" using \ by auto interpret v: identity_arrow_of_spans C \dom \\ using v ide_char' by auto interpret \: arrow_of_spans C \ using \ arr_char by auto have hseq_ru: "hseq r u" using u \ ide_cod by fastforce interpret ru: two_composable_arrows_of_spans C prj0 prj1 r u using hseq_ru hseq_char by unfold_locales auto interpret ru: two_composable_identity_arrows_of_spans C prj0 prj1 r u .. text \ CKS say: ``We must show that \(f, \, g)\ is a wide tabulation of \r\. Take \u = (u\<^sub>0, U, u\<^sub>1): X \ A\, \v = (v\<^sub>0, V, v\<^sub>1): X \ B\, \\: v \ ru\ as in \T1\. Let \P\ be the pullback of \u\<^sub>1, r\<^sub>0\. Let \w = (v\<^sub>0, V, p\<^sub>1\): X \ R\, \\ = p\<^sub>0\: fw \ u\, \\ = 1: v \ gw\; so \\ = (r\)(\w)\\ as required.'' \ let ?R = "r.apex" let ?A = "C.cod r0" let ?B = "C.cod r1" let ?U = "u.apex" let ?u0 = "u.leg0" let ?u1 = "u.leg1" let ?X = "C.cod ?u0" let ?V = "v.apex" let ?v0 = "v.leg0" let ?v1 = "v.leg1" let ?\ = "\.chine" let ?P = "r0 \\ ?u1" let ?p0 = "\

\<^sub>0[r0, ?u1]" let ?p1 = "\

\<^sub>1[r0, ?u1]" let ?w1 = "?p1 \ ?\" define w where "w = mkIde ?v0 ?w1" let ?Q = "?R \\ ?w1" let ?q1 = "\

\<^sub>0[?R, ?w1]\. What CKS say is only correct if the projection \\

\<^sub>0[?R, ?w1]\ is an identity, which can't be guaranteed for an arbitrary choice of pullbacks. \ define \ where "\ = \Chn = ?p0 \ ?\ \ \

\<^sub>0[?R, ?w1], Dom = Dom (f \ w), Cod = Cod u\" interpret Dom_\: span_in_category C \Dom \\ using \_def fw.dom.span_in_category_axioms by simp interpret Cod_\: span_in_category C \Cod \\ using \_def u.cod.span_in_category_axioms by simp have Dom_\_leg0_eq: "Dom_\.leg0 = ?v0 \ \

\<^sub>0[?R, ?w1]" using w_def \_def hcomp_def hseq_fw hseq_char by simp have Dom_\_leg1_eq: "Dom_\.leg1 = r0 \ ?q1" using w_def \_def hcomp_def hseq_fw hseq_char by simp have Cod_\_leg0_eq: "Cod_\.leg0 = ?u0" using w_def \_def hcomp_def hseq_fw hseq_char by simp have Cod_\_leg1_eq: "Cod_\.leg1 = ?u1" using w_def \_def hcomp_def hseq_fw hseq_char by simp have Chn_\_eq: "Chn \ = ?p0 \ ?\ \ \

\<^sub>0[?R, ?w1]" using \_def by simp interpret \: arrow_of_spans C \ proof show 1: "\Chn \ : Dom_\.apex \\<^sub>C Cod_\.apex\" using \_def Chn_\ ru.legs_form_cospan fw_apex_eq by (intro C.in_homI, auto) show "Cod_\.leg0 \ Chn \ = Dom_\.leg0" proof - have "Cod_\.leg0 \ Chn \ = ?u0 \ ?p0 \ ?\ \ \

\<^sub>0[?R, ?w1]" using Cod_\_leg0_eq Chn_\_eq by simp also have "... = ?v0 \ \

\<^sub>0[?R, ?w1]" proof - have "?u0 \ ?p0 \ ?\ \ \

\<^sub>0[?R, ?w1] = (?u0 \ ?p0 \ ?\) \ \

\<^sub>0[?R, ?w1]" using C.comp_assoc by simp also have "... = ?v0 \ \

\<^sub>0[?R, ?w1]" proof - have "?u0 \ ?p0 \ ?\ = (?u0 \ ?p0) \ ?\" using C.comp_assoc by simp also have "... = \.cod.leg0 \ ?\" by (metis \ arrow_of_spans_data.select_convs(2) cod_char in_homE ru.leg0_composite) also have "... = \.dom.leg0" using \.leg0_commutes by simp also have "... = ?v0" using \ dom_char by auto finally show ?thesis by simp qed finally show ?thesis by simp qed also have "... = Dom_\.leg0" using Dom_\_leg0_eq by simp finally show ?thesis by blast qed show "Cod_\.leg1 \ Chn \ = Dom_\.leg1" proof - have "Cod_\.leg1 \ Chn \ = ?u1 \ ?p0 \ ?\ \ \

\<^sub>0[?R, ?w1]" using Cod_\_leg1_eq Chn_\_eq by simp also have "... = r0 \ ?q1" proof - have "?u1 \ ?p0 \ ?\ \ \

\<^sub>0[?R, ?w1] = ((?u1 \ ?p0) \ ?\) \ \

\<^sub>0[?R, ?w1]" using C.comp_assoc by fastforce also have "... = ((r0 \ ?p1) \ ?\) \ \

\<^sub>0[?R, ?w1]" using C.pullback_commutes' ru.legs_form_cospan by simp also have "... = r0 \ ?w1 \ \

\<^sub>0[?R, ?w1]" using C.comp_assoc by fastforce also have "... = r0 \ ?R \ ?q1" using \ C.in_homE C.pullback_commutes' w1 by auto also have "... = r0 \ ?q1" using \ w1 C.comp_cod_arr by auto finally show ?thesis by simp qed also have "... = Dom_\.leg1" using Dom_\_leg1_eq by simp finally show ?thesis by blast qed qed text \ Similarly, CKS say to take \\ = 1: v \ gw\, but obviously this can't be interpreted literally, either, because \v.apex\ and \gw.apex\ are not equal. Instead, we have to define \\\ so that \Chn \ = C.inv \

\<^sub>0[?R, ?w1]\, noting that \\

\<^sub>0[?R, ?w1]\ is the pullback of an identity, hence is an isomorphism. Then \?v0 \ \

\<^sub>0[?R, ?w1] \ Chn \ = ?v0\ and \?v1 \ \

\<^sub>1[?R, ?w1] \ Chn \ = ?v1 \ ?w1\, showing that \\\ is an arrow of spans. \ let ?\' = "\

\<^sub>0[?R, ?w1]" define \ where "\ = \Chn = C.inv ?\', Dom = Dom (dom \), Cod = Cod (g \ w)\" have iso_\: "C.inverse_arrows ?\' (Chn \)" using \_def \ w1 C.iso_pullback_ide by (metis C.inv_is_inverse C.seqE arrow_of_spans_data.select_convs(1) r.chine_eq_apex r.chine_simps(1) r.chine_simps(3) r.cod_simps(1) r.dom.apex_def r.dom.ide_apex r.dom.is_span r1w1 v.dom.leg_simps(3)) text \ $$ \xymatrix{ && X \\ && V \ar[u]_{v_0} \ar[d]_{\omega} \ar@/ul50pt/[ddddll]_{v_1} \ar@/l30pt/[dd]_<>(0.7){w_1}\\ & R\downarrow\downarrow w_1 \ar[ur]^{\nu'} \ar[dd]_{q_1} & r_0\downarrow\downarrow u_1 \ar[d]_{p_1} \ar@/dl10pt/[drr]_<>(0.4){p_0} & R\downarrow\downarrow w_1 \ar[ul]_{\nu'} \ar[dd]^<>(0.7){q_1} \ar@ {.>}[dr]_{\theta}\\ && R && U \ar@/ur20pt/[uuull]_{u_0} \ar[dd]^{u_1} \\ & R \ar[dl]_{r_1} \ar@ {<->}[ur]_{R} \ar@ {.>}[dr]^{\rho} \ar@/dl5pt/[ddr]_<>(0.4){R} && R \ar@ {<->}[ul]^{R} \ar[dr]^{r_0} \ar[ur]_{r_1}\\ B && r_0\downarrow\downarrow r_0 \ar[uu]_{k_0} \ar[d]^{k_1} \ar[uu] \ar[ur]_{k_0} && A \\ & & R \ar[ull]^{r_1} \ar[urr]_{r_0} \\ } $$ \ have w1_eq: "?w1 = ?q1 \ C.inv ?\'" proof - have "?R \ ?q1 = ?w1 \ ?\'" using iso_\ \ w1 C.pullback_commutes [of ?R ?w1] by blast hence "?q1 = ?w1 \ ?\'" using \ w1 C.comp_cod_arr by auto thus ?thesis using iso_\ C.invert_side_of_triangle(2) by (metis C.isoI C.prj1_simps(1) arrow_of_spans_data.select_convs(3) fw.legs_form_cospan(2) span_data.simps(1-2) w_def) qed interpret Dom_\: span_in_category C \Dom \\ using \_def v.dom.span_in_category_axioms by simp interpret Cod_\: span_in_category C \Cod \\ using \_def gw.cod.span_in_category_axioms by simp interpret \: arrow_of_spans C \ proof show 1: "\Chn \ : Dom_\.apex \\<^sub>C Cod_\.apex\" proof show "C.arr (Chn \)" using iso_\ by auto show "C.dom (Chn \) = Dom_\.apex" using \_def iso_\ w1 gw_apex_eq by fastforce show "C.cod (Chn \) = Cod_\.apex" using \_def iso_\ gw_apex_eq C.comp_inv_arr C.pbdom_def by (metis C.cod_comp arrow_of_spans_data.select_convs(3) gw.apex_composite gw.chine_composite gw.chine_simps(1,3)) qed show "Cod_\.leg0 \ Chn \ = Dom_\.leg0" using w_def \_def 1 iso_\ hcomp_def hseq_gw C.comp_arr_inv C.comp_assoc v.leg0_commutes by auto show "Cod_\.leg1 \ Chn \ = Dom_\.leg1" using w_def \_def hcomp_def hseq_gw C.comp_assoc w1_eq r1w1 by auto qed text \ Now we can proceed to establishing the conclusions of \T1\. \ have "ide w \ \\ : f \ w \ u\ \ \\ : dom \ \ dom \ \ w\ \ iso \ \ T.composite_cell w \ \ \ = \" proof (intro conjI) show ide_w: "ide w" using w by blast show \: "\\ : f \ w \ u\" using \_def \.arrow_of_spans_axioms arr_char dom_char cod_char hseq_fw hseq_char hcomp_def fw.chine_eq_apex by auto show \: "\\ : dom \ \ dom \ \ w\" proof - have "\\ : dom \ \ g \ w\" using \_def \ \.arrow_of_spans_axioms arr_char dom_char cod_char hseq_gw hseq_char hcomp_def gw.chine_eq_apex by auto thus ?thesis using T.tab_in_hom by simp qed show "iso \" using iso_\ iso_char arr_char \.arrow_of_spans_axioms by auto show "T.composite_cell w \ \ \ = \" proof (intro arr_eqI) have \w: "\\ \ w : g \ w \ (r \ f) \ w\" using w_def \ ide_w hseq_rf hseq_fw hseq_gw by auto have r\: "\r \ \ : r \ f \ w \ r \ u\" using arfw ide_r \ fw.composite_simps(2) rf.composable by auto have 1: "\T.composite_cell w \ \ \ : dom \ \ r \ u\" using \ \w arfw r\ by auto show 3: "par (T.composite_cell w \ \ \) \" using 1 \ by (elim in_homE, auto) show "Chn (T.composite_cell w \ \ \) = ?\" proof - have 2: "Chn (T.composite_cell w \ \ \) = Chn (r \ \) \ Chn \[r, f, w] \ Chn (\ \ w) \ Chn \" using 1 3 Chn_vcomp C.comp_assoc by (metis (full_types) seqE) also have "... = ?\" proof - let ?LHS = "Chn (r \ \) \ Chn \[r, f, w] \ Chn (\ \ w) \ Chn \" have Chn_r\: "Chn (r \ \) = \r.chine \ \

\<^sub>1[r0, r0 \ ?q1] \r0, ?u1\ \.chine \ \

\<^sub>0[r0, r0 \ ?q1]\" using r\ hcomp_def \_def chine_hcomp_def Dom_\_leg1_eq by (metis arrI arrow_of_spans_data.select_convs(1,3) hseq_char r.cod_simps(2) u.cod_simps(3)) have Chn_arfw: "Chn \[r, f, w] = rfw.chine_assoc" using \_ide ide_f rf.composable fw.composable w by auto have Chn_\w: "Chn (\ \ w) = \?\ \ ?q1 \k0, ?w1\ ?\'\" proof - have "Chn (\ \ w) = chine_hcomp \Chn = ?\, Dom = \Leg0 = ?R, Leg1 = r1\, Cod = \Leg0 = k0, Leg1 = r1 \ k1\\ \Chn = v.apex, Dom = \Leg0 = ?v0, Leg1 = ?w1\, Cod = \Leg0 = ?v0, Leg1 = ?w1\\" using \ ide_w hseq_rf hseq_char hcomp_def src_def trg_def by (metis (no_types, lifting) \w arrI arrow_of_spans_data.select_convs(1) v.dom.apex_def w_def) also have "... = \?\ \ ?q1 \k0, ?w1\ ?V \ ?\'\" unfolding chine_hcomp_def by simp also have "... = \?\ \ ?q1 \k0, ?w1\ ?\'\" proof - have "?V \ ?\' = ?\'" using C.comp_ide_arr v.dom.ide_apex \ w1 by auto thus ?thesis by simp qed finally show ?thesis by blast qed have 3: "C.seq ?p1 ?\" using w1 by blast moreover have 4: "C.seq ?p1 ?LHS" proof show "\?LHS : v.apex \\<^sub>C ru.apex\" by (metis (no_types, lifting) 1 2 Chn_in_hom ru.chine_eq_apex v.chine_eq_apex) show "\?p1 : ru.apex \\<^sub>C ?R\" using P C.prj1_in_hom ru.legs_form_cospan by fastforce qed moreover have "?p0 \ ?LHS = ?p0 \ ?\" proof - have "?p0 \ ?LHS = (?p0 \ Chn (r \ \)) \ Chn \[r, f, w] \ Chn (\ \ w) \ Chn \" using C.comp_assoc by simp also have "... = (\.chine \ \

\<^sub>0[r0, r0 \ ?q1]) \ Chn \[r, f, w] \ Chn (\ \ w) \ Chn \" proof - have "?p0 \ Chn (r \ \) = \.chine \ \

\<^sub>0[r0, r0 \ ?q1]" by (metis C.prj_tuple(1) Chn_r\ \_def arrI Dom_\_leg1_eq arrow_of_spans_data.select_convs(3) chine_hcomp_props(2) hseq_char r.cod_simps(2) r\ u.cod_simps(3)) thus ?thesis by argo qed also have "... = ?p0 \ ?\ \ (rfw.Prj\<^sub>0\<^sub>0 \ Chn \[r, f, w]) \ Chn (\ \ w) \ Chn \" using w_def \_def C.comp_assoc by simp also have "... = ?p0 \ ?\ \ (rfw.Prj\<^sub>0 \ Chn (\ \ w)) \ Chn \" using Chn_arfw rfw.prj_chine_assoc C.comp_assoc by simp also have "... = ?p0 \ ?\ \ ?\' \ Chn \" proof - have "rfw.Prj\<^sub>0 \ Chn (\ \ w) = \

\<^sub>0[k0, ?w1] \ \?\ \ ?q1 \k0, ?w1\ ?\'\" using w_def Chn_\w C.comp_cod_arr by simp also have "... = ?\'" by (metis (no_types, lifting) C.not_arr_null C.prj_tuple(1) C.seqE C.tuple_is_extensional Chn_\w 4) finally have "rfw.Prj\<^sub>0 \ Chn (\ \ w) = ?\'" by blast thus ?thesis by simp qed also have "... = ?p0 \ ?\" using iso_\ C.comp_arr_dom by (metis (no_types, lifting) C.comp_arr_inv C.dom_comp \_def \.chine_simps(1) 3 arrow_of_spans_data.simps(1) w1_eq) finally show ?thesis by blast qed moreover have "?p1 \ ?LHS = ?w1" proof - have "?p1 \ ?LHS = (?p1 \ Chn (r \ \)) \ Chn \[r, f, w] \ Chn (\ \ w) \ Chn \" using C.comp_assoc by simp also have "... = (r.chine \ \

\<^sub>1[r0, r0 \ ?q1]) \ Chn \[r, f, w] \ Chn (\ \ w) \ Chn \" by (metis (no_types, lifting) C.not_arr_null C.prj_tuple(2) C.seqE C.tuple_is_extensional Chn_r\ 4) also have "... = r.chine \ (rfw.Prj\<^sub>1 \ Chn \[r, f, w]) \ Chn (\ \ w) \ Chn \" using w_def Dom_\_leg1_eq C.comp_assoc by simp also have "... = r.chine \ (rfw.Prj\<^sub>1\<^sub>1 \ Chn (\ \ w)) \ Chn \" using Chn_arfw rfw.prj_chine_assoc(1) C.comp_assoc by simp also have "... = r.chine \ ?q1 \ Chn \" proof - have "rfw.Prj\<^sub>1\<^sub>1 \ Chn (\ \ w) = (k1 \ \

\<^sub>1[k0, ?w1]) \ \?\ \ ?q1 \k0, ?w1\ ?\'\" using w_def Chn_\w C.comp_cod_arr by simp also have "... = k1 \ \

\<^sub>1[k0, ?w1] \ \?\ \ ?q1 \k0, ?w1\ ?\'\" using C.comp_assoc by simp also have "... = k1 \ ?\ \ ?q1" by (metis (no_types, lifting) C.not_arr_null C.prj_tuple(2) C.seqE C.tuple_is_extensional Chn_\w 4) also have "... = (k1 \ ?\) \ ?q1" using C.comp_assoc by presburger also have "... = ?R \ ?q1" by simp also have "... = ?q1" by (metis Dom_\_leg1_eq C.comp_ide_arr C.prj1_simps(3) C.prj1_simps_arr C.seqE C.seqI Dom_\.leg_simps(3) r.dom.ide_apex) finally have "rfw.Prj\<^sub>1\<^sub>1 \ Chn (\ \ w) = ?q1" by blast thus ?thesis by simp qed also have "... = (r.chine \ ?p1) \ ?\" using \_def w1_eq C.comp_assoc by simp also have "... = ?w1" using C.comp_cod_arr r.chine_eq_apex ru.prj_simps(1) by auto finally show ?thesis by blast qed ultimately show ?thesis using ru.legs_form_cospan C.prj_joint_monic by blast qed finally show ?thesis by argo qed qed qed thus ?thesis using w_def by auto qed qed show T2: "\u w w' \ \' \. \ ide w; ide w'; \\ : f \ w \ u\; \\' : f \ w' \ u\; \\ : g \ w \ g \ w'\; T.composite_cell w \ = T.composite_cell w' \' \ \ \ \ \!\. \\ : w \ w'\ \ \ = g \ \ \ \ = \' \ (f \ \)" proof - fix u w w' \ \' \ assume ide_w: "ide w" assume ide_w': "ide w'" assume \: "\\ : f \ w \ u\" assume \': "\\' : f \ w' \ u\" assume \: "\\ : g \ w \ g \ w'\" assume E: "T.composite_cell w \ = T.composite_cell w' \' \ \" interpret T: uw\w'\'\ vcomp hcomp assoc unit src trg r \ f g u w \ w' \' \ using ide_w ide_w' \ \' \ E comp_assoc by unfold_locales auto show "\!\. \\ : w \ w'\ \ \ = g \ \ \ \ = \' \ (f \ \)" proof interpret u: identity_arrow_of_spans C u using T.uw\.u_simps(1) ide_char' by auto interpret w: identity_arrow_of_spans C w using ide_w ide_char' by auto interpret w': identity_arrow_of_spans C w' using ide_w' ide_char' by auto let ?u0 = u.leg0 let ?u1 = u.leg1 let ?w0 = w.leg0 let ?w1 = w.leg1 let ?wa = "w.apex" let ?w0' = w'.leg0 let ?w1' = w'.leg1 let ?wa' = "w'.apex" let ?R = ra let ?p0 = "\

\<^sub>0[?R, ?w1]" let ?p0' = "\

\<^sub>0[?R, ?w1']" let ?p1 = "\

\<^sub>1[?R, ?w1]" let ?p1' = "\

\<^sub>1[?R, ?w1']" interpret fw: two_composable_identity_arrows_of_spans C prj0 prj1 f w using hseq_char by unfold_locales auto interpret fw': two_composable_identity_arrows_of_spans C prj0 prj1 f w' using hseq_char by unfold_locales auto have hseq_gw: "hseq g w" using T.leg1_in_hom by auto interpret gw: two_composable_identity_arrows_of_spans C prj0 prj1 g w using hseq_gw hseq_char by unfold_locales auto have hseq_gw': "hseq g w'" using T.leg1_in_hom by auto interpret gw': two_composable_identity_arrows_of_spans C prj0 prj1 g w' using hseq_gw' hseq_char by unfold_locales auto interpret rfw: three_composable_identity_arrows_of_spans C prj0 prj1 r f w .. interpret rfw: identity_arrow_of_spans C \r \ f \ w\ using rfw.composites_are_identities ide_char' by auto interpret rfw': three_composable_arrows_of_spans C prj0 prj1 r f w' .. interpret rfw': three_composable_identity_arrows_of_spans C prj0 prj1 r f w' .. interpret rfw': identity_arrow_of_spans C \r \ f \ w'\ using rfw'.composites_are_identities ide_char' by auto have \w: "\\ \ w : g \ w \ (r \ f) \ w\" using \ hseq_gw by blast interpret \w: two_composable_arrows_of_spans C prj0 prj1 \ w using \w by unfold_locales auto have \w': "\\ \ w' : g \ w' \ (r \ f) \ w'\" using \ hseq_gw' by blast interpret \w': two_composable_arrows_of_spans C prj0 prj1 \ w' using \w' by unfold_locales auto have arfw: "\\[r, f, w] : (r \ f) \ w \ r \ f \ w\" using fw.composable ide_f ide_r ide_w rf.composable by auto have arfw': "\\[r, f, w'] : (r \ f) \ w' \ r \ f \ w'\" using fw'.composable ide_f ide_r ide_w' rf.composable by auto have r\: "\r \ \ : r \ f \ w \ r \ u\" by fastforce interpret Dom_\: span_in_category C \Dom \\ using fw.dom.span_in_category_axioms by (metis \ arrow_of_spans_data.select_convs(2) in_homE dom_char) interpret Cod_\: span_in_category C \Cod \\ using \ u.cod.span_in_category_axioms cod_char by auto interpret \: arrow_of_spans C \ using arr_char T.uw\.\_simps(1) by auto interpret r\: two_composable_arrows_of_spans C prj0 prj1 r \ using r\ by unfold_locales auto have r\': "\r \ \' : r \ f \ w' \ r \ u\" by fastforce interpret Dom_\': span_in_category C \Dom \'\ using fw'.dom.span_in_category_axioms by (metis \' arrow_of_spans_data.select_convs(2) in_homE dom_char) interpret Cod_\': span_in_category C \Cod \'\ using \' u.cod.span_in_category_axioms cod_char by auto interpret \': arrow_of_spans C \' using arr_char T.uw'\'.\_simps(1) by auto interpret r\': two_composable_arrows_of_spans C prj0 prj1 r \' using r\' by unfold_locales auto have 7: "\T.composite_cell w' \' \ \ : g \ w \ r \ u\" using \ \w' arfw' r\' by auto have 8: "\T.composite_cell w \ : g \ w \ r \ u\" using \w arfw r\ by auto interpret ru: two_composable_identity_arrows_of_spans C prj0 prj1 r u using hseq_char by unfold_locales auto interpret Dom_\: span_in_category C \Dom \\ using \ fw.dom.span_in_category_axioms arr_char by (metis comp_arr_dom in_homE gw.cod.span_in_category_axioms seq_char) interpret Cod_\: span_in_category C \Cod \\ using \ fw.cod.span_in_category_axioms arr_char by (metis (no_types, lifting) comp_arr_dom ideD(2) in_homI gw'.cod.span_in_category_axioms gw'.chine_is_identity hseq_gw' seqI' seq_char ide_char) interpret \: arrow_of_spans C \ using \ arr_char by auto text \ CKS say: ``Take \u\, \w\, \w'\, \\\, \\'\ as in \T2\ and note that \fw = (w\<^sub>0, W, r\<^sub>0 w\<^sub>1)\, \gw = (w\<^sub>0, W, r\<^sub>1 w\<^sub>1)\, \emph{etc}. So \\: W \ W'\ satisfies \w\<^sub>0 = w\<^sub>0' \\, \r\<^sub>1 w\<^sub>1 = r\<^sub>1 w\<^sub>1' \\. But the equation \(r\)(\w) = (r\')(\w')\\ gives \w\<^sub>1 = w\<^sub>1'\. So \\ = \ : w \ w'\ is unique with \\ = g \, \ = \' (f \).\'' Once again, there is substantial punning in the proof sketch given by CKS. We can express \fw\ and \gw\ almost in the form they indicate, but projections are required. \ have cospan: "C.cospan ?R ?w1" using hseq_char [of \ w] src_def trg_def by auto have cospan': "C.cospan ?R ?w1'" using hseq_char [of \ w'] src_def trg_def by auto have fw: "f \ w = \Chn = ?R \\ ?w1, Dom = \Leg0 = ?w0 \ ?p0, Leg1 = r0 \ ?p1\, Cod = \Leg0 = ?w0 \ ?p0, Leg1 = r0 \ ?p1\\" using ide_f hseq_char hcomp_def chine_hcomp_def fw.dom.apex_def cospan fw.chine_eq_apex by auto have gw: "g \ w = \Chn = ?R \\ ?w1, Dom = \Leg0 = ?w0 \ ?p0, Leg1 = r1 \ ?p1\, Cod = \Leg0 = ?w0 \ ?p0, Leg1 = r1 \ ?p1\\" using hseq_gw hseq_char hcomp_def chine_hcomp_def gw.dom.apex_def cospan gw.chine_eq_apex by auto have fw': "f \ w' = \Chn = ?R \\ ?w1', Dom = \Leg0 = ?w0' \ ?p0', Leg1 = r0 \ ?p1'\, Cod = \Leg0 = ?w0' \ ?p0', Leg1 = r0 \ ?p1'\\" using ide_f hseq_char hcomp_def chine_hcomp_def fw'.dom.apex_def cospan' fw'.chine_eq_apex by auto have gw': "g \ w' = \Chn = ?R \\ ?w1', Dom = \Leg0 = ?w0' \ ?p0', Leg1 = r1 \ ?p1'\, Cod = \Leg0 = ?w0' \ ?p0', Leg1 = r1 \ ?p1'\\" using hseq_gw' hseq_char hcomp_def chine_hcomp_def gw'.dom.apex_def cospan' gw'.chine_eq_apex by auto text \ Note that \?p0\ and \?p0'\ are only isomorphisms, not identities, and we have \?p1\ (which equals \?w1 \ ?p0\) and \?p1'\ (which equals \?w1' \ ?p0'\) in place of \?w1\ and \?w1'\. \ text \ The following diagram summarizes the various given and defined arrows involved in the proof. We have deviated slightly here from the nomenclature used in in CKS. We prefer to use \W\ and \W'\ to denote the apexes of \w\ and \w'\, respectively. We already have the expressions \?R \\ ?w1\ and \?R \\ ?w1'\ for the apexes of \fw\ and \fw'\ (which are the same as the apexes of \gw\ and \gw'\, respectively) and we will not use any abbreviation for them. \ text \ $$ \xymatrix{ &&& X \\ && W \ar[ur]^{w_0} \ar[dr]_{w_1} \ar@ {.>}[rr]^{\gamma} && W' \ar[ul]_{w_0'} \ar[dl]^{w_1'} && U \ar@/r10pt/[dddl]^{u_1} \ar@/u7pt/[ulll]_{u_0}\\ & R\downarrow\downarrow w_1 \ar[ur]_{p_0} \ar[dr]^{p_1} \ar@/d15pt/[rrrr]_{\beta} \ar@/u100pt/[urrrrr]^{\theta} && R && R \downarrow\downarrow w_1' \ar[ul]^{p_0'} \ar[dl]^{p_1'} \ar[ur]_{\theta'} \\ && R \ar@ {.>}[dr]_{\rho} \ar@/dl7pt/[ddr]_{R} \ar[ur]_{R} \ar[dl]_{r_1} \ar@ {<->}[rr]_{R} && R \ar[ul]^{R} \ar[dr]_{r_0} \\ & B && r_0 \downarrow\downarrow r_0 \ar[d]^{k_1} \ar[ur]_{k_0} && A \\ &&& R \ar@/dr10pt/[urr]_{r_0} \ar@/dl5pt/[ull]^{r_1} } $$ \ have Chn_\: "\\.chine: ?R \\ ?w1 \\<^sub>C ?R \\ ?w1'\" using gw gw' Chn_in_hom \ gw'.chine_eq_apex gw.chine_eq_apex by force have \_eq: "\ = \Chn = \.chine, Dom = \Leg0 = ?w0 \ ?p0, Leg1 = r1 \ ?p1\, Cod = \Leg0 = ?w0' \ ?p0', Leg1 = r1 \ ?p1'\\" using \ gw gw' dom_char cod_char by auto have Dom_\_eq: "Dom \ = \Leg0 = ?w0 \ ?p0, Leg1 = r1 \ ?p1\" using \ gw gw' dom_char cod_char by auto have Cod_\_eq: "Cod \ = \Leg0 = ?w0' \ ?p0', Leg1 = r1 \ ?p1'\" using \ gw gw' dom_char cod_char by auto have \0: "?w0 \ ?p0 = ?w0' \ ?p0' \ \.chine" using Dom_\_eq Cod_\_eq \.leg0_commutes C.comp_assoc by simp have \1: "r1 \ ?p1 = r1 \ ?p1' \ \.chine" using Dom_\_eq Cod_\_eq \.leg1_commutes C.comp_assoc by simp have Dom_\_0: "Dom_\.leg0 = ?w0 \ ?p0" using arrI dom_char fw T.uw\.\_simps(4) by auto have Cod_\_0: "Cod_\.leg0 = ?u0" using \ cod_char by auto have Dom_\_1: "Dom_\.leg1 = r0 \ ?p1" using arrI dom_char fw T.uw\.\_simps(4) by auto have Cod_\_1: "Cod_\.leg1 = ?u1" using T.uw\.\_simps(5) cod_char by auto have Dom_\'_0: "Dom_\'.leg0 = ?w0' \ ?p0'" using dom_char fw' T.uw'\'.\_simps(4) by auto have Cod_\'_0: "Cod_\'.leg0 = ?u0" using T.uw'\'.\_simps(5) cod_char by auto have Dom_\'_1: "Dom_\'.leg1 = r0 \ ?p1'" using dom_char fw' T.uw'\'.\_simps(4) by auto have Cod_\'_1: "Cod_\'.leg1 = ?u1" using T.uw'\'.\_simps(5) cod_char by auto have Dom_\_0: "Dom_\.leg0 = ?R" by simp have Dom_\_1: "Dom_\.leg1 = r1" by simp have Cod_\_0: "Cod_\.leg0 = k0" by simp have Cod_\_1: "Cod_\.leg1 = r1 \ k1" by simp have Chn_r\: "\r\.chine : rfw.chine \\<^sub>C ru.chine\" using r\.chine_composite_in_hom ru.chine_composite rfw.chine_composite Cod_\_1 Dom_\_1 fw.leg1_composite by auto have Chn_r\_eq: "r\.chine = \\

\<^sub>1[r0, r0 \ ?p1] \r0, ?u1\ \.chine \ \

\<^sub>0[r0, r0 \ ?p1]\" using r\.chine_composite Cod_\_1 Dom_\_1 fw.leg1_composite C.comp_cod_arr by (metis arrow_of_spans_data.simps(2) fw r.chine_eq_apex r.cod_simps(2) rfw.prj_simps(10) rfw.prj_simps(16) span_data.simps(2)) have r\_cod_apex_eq: "r\.cod.apex = r0 \\ ?u1" using Cod_\_1 r\.chine_composite_in_hom by auto hence r\'_cod_apex_eq: "r\'.cod.apex = r0 \\ ?u1" using Cod_\'_1 r\'.chine_composite_in_hom by auto have Chn_r\': "\r\'.chine : rfw'.chine \\<^sub>C ru.chine\" using r\'.chine_composite_in_hom ru.chine_composite rfw'.chine_composite Cod_\'_1 Dom_\'_1 fw'.leg1_composite by auto have Chn_r\'_eq: "r\'.chine = \\

\<^sub>1[r0, r0 \ ?p1'] \r0, ?u1\ \'.chine \ \

\<^sub>0[r0, r0 \ ?p1']\" using r\'.chine_composite Cod_\'_1 Dom_\'_1 fw'.leg1_composite C.comp_cod_arr by (metis arrow_of_spans_data.simps(2) fw' r.chine_eq_apex r.cod_simps(2) rfw'.prj_simps(10) rfw'.prj_simps(16) span_data.simps(2)) have Chn_\w: "\\w.chine : ?R \\ ?w1 \\<^sub>C k0 \\ ?w1\" using \w.chine_composite_in_hom by simp have Chn_\w_eq: "\w.chine = \\.chine \ ?p1 \k0, ?w1\ ?p0\" using \w.chine_composite C.comp_cod_arr ide_w by (simp add: chine_hcomp_arr_ide hcomp_def) have Chn_\w': "\\w'.chine : ?R \\ ?w1' \\<^sub>C k0 \\ ?w1'\" using \w'.chine_composite_in_hom by simp have Chn_\w'_eq: "\w'.chine = \\.chine \ ?p1' \k0, ?w1'\ ?p0'\" using \w'.chine_composite C.comp_cod_arr ide_w' Dom_\_0 Cod_\_0 by (metis \w'.composite_is_arrow chine_hcomp_arr_ide chine_hcomp_def hseq_char w'.cod_simps(3)) text \ The following are some collected commutativity properties that are used subsequently. \ have "C.commutative_square r0 ?u1 ?p1 \.chine" using ru.legs_form_cospan(1) Dom_\.is_span Dom_\_1 Cod_\_1 \.leg1_commutes - apply (intro C.commutative_squareI) by auto + by (intro C.commutative_squareI) auto have "C.commutative_square r0 ?u1 (?p1' \ \.chine) (\'.chine \ \.chine)" - proof - have 1: "r0 \ ?p1' = ?u1 \ \'.chine" - using \'.leg1_commutes Cod_\'_1 Dom_\'_1 fw'.leg1_composite by simp - show "C.cospan r0 ?u1" - using ru.legs_form_cospan(1) by blast - show "C.span (?p1' \ \.chine) (\'.chine \ \.chine)" - using \.chine_in_hom \'.chine_in_hom - by (metis "1" C.dom_comp C.in_homE C.prj1_simps(1) C.prj1_simps(2) - C.seqI Cod_\'_1 Dom_\'.leg_simps(3) Chn_\ \'.leg1_commutes cospan') - show "C.dom r0 = C.cod (?p1' \ \.chine)" - using \.chine_in_hom - by (metis C.cod_comp C.prj1_simps(3) - \C.span (?p1' \ \.chine) (\'.chine \ \.chine)\ - cospan' r.dom.apex_def r.chine_eq_apex r.chine_simps(2)) - show "r0 \ ?p1' \ \.chine = ?u1 \ \'.chine \ \.chine" - using 1 \.chine_in_hom C.comp_assoc by metis - qed + by (metis (mono_tags, lifting) C.commutative_square_comp_arr C.dom_comp + C.seqE Cod_\'_1 Dom_\.leg_simps(3) Dom_\_eq Dom_\'.leg_simps(3) + Dom_\'_1 \1 \'.leg1_commutes C.commutative_squareI + ru.legs_form_cospan(1) span_data.simps(2)) have "C.commutative_square r0 ?u1 \

\<^sub>1[r0, r0 \ ?p1] (\.chine \ \

\<^sub>0[r0, r0 \ ?p1])" using ru.legs_form_cospan(1) Dom_\.is_span Dom_\_1 C.comp_assoc C.pullback_commutes' r\.legs_form_cospan(1) apply (intro C.commutative_squareI) apply auto by (metis C.comp_assoc Cod_\_1 \.leg1_commutes) hence "C.commutative_square r0 ?u1 \

\<^sub>1[r0, r0 \ ?p1] (\.chine \ \

\<^sub>0[r0, r0 \ ?p1])" using fw.leg1_composite by auto have "C.commutative_square r0 ?u1 \

\<^sub>1[r0, r0 \ ?p1'] (\'.chine \ \

\<^sub>0[r0, r0 \ ?p1'])" using C.tuple_is_extensional Chn_r\'_eq r\'.chine_simps(1) fw' by force have "C.commutative_square ra ?w1 rfw.Prj\<^sub>0\<^sub>1 rfw.Prj\<^sub>0" using C.pullback_commutes' gw.legs_form_cospan(1) rfw.prj_simps(2) C.comp_assoc C.comp_cod_arr - apply (intro C.commutative_squareI) by auto + by (intro C.commutative_squareI) auto have "C.commutative_square ?R ?w1' rfw'.Prj\<^sub>0\<^sub>1 rfw'.Prj\<^sub>0" - using cospan' - apply (intro C.commutative_squareI) - apply simp_all - by (metis C.comp_assoc C.prj0_simps_arr C.pullback_commutes' - arrow_of_spans_data.select_convs(2) rfw'.prj_simps(3) - span_data.select_convs(1-2)) + by (metis (no_types, lifting) C.commutative_square_comp_arr C.comp_assoc + C.pullback_commutes select_convs(2) rfw'.cospan_\\ + rfw'.prj_chine_assoc(2) rfw'.prj_chine_assoc(3) rfw'.prj_simps(2) + span_data.select_convs(1)) have "C.commutative_square r0 (r0 \ ?p1) rfw.Prj\<^sub>1\<^sub>1 \rfw.Prj\<^sub>0\<^sub>1 \ra, ?w1\ rfw.Prj\<^sub>0\" proof - have "C.arr rfw.chine_assoc" by (metis C.seqE rfw.prj_chine_assoc(1) rfw.prj_simps(1)) thus ?thesis using C.tuple_is_extensional rfw.chine_assoc_def by fastforce qed have "C.commutative_square r0 (r0 \ ?p1') rfw'.Prj\<^sub>1\<^sub>1 \rfw'.Prj\<^sub>0\<^sub>1 \ra, ?w1'\ rfw'.Prj\<^sub>0\" by (metis (no_types, lifting) C.not_arr_null C.seqE C.tuple_is_extensional arrow_of_spans_data.select_convs(2) rfw'.chine_assoc_def rfw'.prj_chine_assoc(1) rfw'.prj_simps(1) span_data.select_convs(1-2)) have "C.commutative_square k0 ?w1 (\.chine \ ?p1) ?p0" using C.tuple_is_extensional Chn_\w_eq \w.chine_simps(1) by fastforce have "C.commutative_square k0 ?w1' (\.chine \ ?p1') (w'.chine \ ?p0')" using C.tuple_is_extensional \w'.chine_composite \w'.chine_simps(1) by force have "C.commutative_square k0 ?w1' (\.chine \ ?p1') ?p0'" using C.tuple_is_extensional Chn_\w'_eq \w'.chine_simps(1) by force text \ Now, derive the consequences of the equation: \[ \(r \ \) \ \[r, ?f, w] \ (?\ \ w) = (r \ \') \ \[r, ?f, w'] \ (?\ \ w') \ \\ \] The strategy is to expand and simplify the left and right hand side to tuple form, then compose with projections and equate corresponding components. We first work on the right-hand side. \ have R: "Chn (T.composite_cell w' \' \ \) = \?p1' \ \.chine \r0, ?u1\ \'.chine \ \.chine\" proof - have "Chn (T.composite_cell w' \' \ \) = r\'.chine \ Chn \[r, f, w'] \ \w'.chine \ \.chine" proof - have 1: "\T.composite_cell w' \' \ \ : g \ w \ r \ u\" using \ \w' arfw' r\' by auto have "Chn (T.composite_cell w' \' \ \) = Chn (T.composite_cell w' \') \ \.chine" using 1 Chn_vcomp by blast also have "... = (r\'.chine \ Chn (\[r, f, w'] \ (\ \ w'))) \ \.chine" proof - have "seq (r \ \') (\[r, f, w'] \ (\ \ w'))" using 1 by blast thus ?thesis using 1 Chn_vcomp by presburger qed also have "... = (r\'.chine \ Chn \[r, f, w'] \ \w'.chine) \ \.chine" proof - have "seq \[r, f, w'] (\ \ w')" using 1 by blast thus ?thesis using 1 Chn_vcomp by presburger qed finally show ?thesis using C.comp_assoc by auto qed also have "... = \?p1' \ \.chine \r0, ?u1\ \'.chine \ \.chine\" proof - let ?LHS = "r\'.chine \ Chn \[r, f, w'] \ \w'.chine \ \.chine" let ?RHS = "\?p1' \ \.chine \r0, ?u1\ \'.chine \ \.chine\" have LHS: "\?LHS : ?R \\ ?w1 \\<^sub>C r\'.cod.apex\" proof (intro C.comp_in_homI) show "\\.chine : ?R \\ ?w1 \\<^sub>C ?R \\ ?w1'\" using Chn_\ by simp show "\\w'.chine : ?R \\ ?w1' \\<^sub>C Cod_\.leg0 \\ w'.cod.leg1\" using Chn_\w' by simp show "\Chn \[r, f, w'] : Cod_\.leg0 \\ w'.cod.leg1 \\<^sub>C rfw'.chine\" using arfw' by (metis (no_types, lifting) Chn_in_hom Cod_\_0 arrow_of_spans_data.simps(2) rf rf.leg0_composite rfw'.chine_composite(1) span_data.select_convs(1) w'.cod_simps(3)) show "\r\'.chine : rfw'.chine \\<^sub>C r\'.cod.apex\" using Chn_r\' by auto qed have 2: "C.commutative_square r0 ?u1 (?p1' \ \.chine) (\'.chine \ \.chine)" by fact have RHS: "\?RHS : ?R \\ ?w1 \\<^sub>C r\'.cod.apex\" using 2 Chn_\ r\'_cod_apex_eq C.tuple_in_hom [of r0 ?u1 "?p1' \ \.chine" "\'.chine \ \.chine"] by fastforce show ?thesis proof (intro C.prj_joint_monic [of r0 ?u1 ?LHS ?RHS]) show "C.cospan r0 ?u1" using ru.legs_form_cospan(1) by blast show "C.seq ru.prj\<^sub>1 ?LHS" using LHS r\'_cod_apex_eq by auto show "C.seq ru.prj\<^sub>1 ?RHS" using RHS r\'_cod_apex_eq by auto show "ru.prj\<^sub>0 \ ?LHS = ru.prj\<^sub>0 \ ?RHS" proof - have "ru.prj\<^sub>0 \ ?LHS = (ru.prj\<^sub>0 \ r\'.chine) \ Chn \[r, f, w'] \ \w'.chine \ \.chine" using C.comp_assoc by simp also have "... = ((\'.chine \ \

\<^sub>0[r0, r0 \ ?p1']) \ Chn \[r, f, w']) \ \w'.chine \ \.chine" using Chn_r\'_eq C.comp_assoc fw' \C.commutative_square r0 ?u1 \

\<^sub>1[r0, r0 \ ?p1'] (\'.chine \ \

\<^sub>0[r0, r0 \ ?p1'])\ by simp also have "... = \'.chine \ (\

\<^sub>0[r0, r0 \ ?p1'] \ Chn \[r, f, w']) \ \w'.chine \ \.chine" using C.comp_assoc by simp also have "... = \'.chine \ (\rfw'.Prj\<^sub>0\<^sub>1 \?R, ?w1'\ rfw'.Prj\<^sub>0\ \ \w'.chine) \ \.chine" using ide_f hseq_rf hseq_char \_ide C.comp_assoc rfw'.chine_assoc_def fw'.leg1_composite C.prj_tuple(1) \C.commutative_square r0 (r0 \ ?p1') rfw'.Prj\<^sub>1\<^sub>1 \rfw'.Prj\<^sub>0\<^sub>1 \?R, ?w1'\ rfw'.Prj\<^sub>0\\ by simp also have "... = \'.chine \ \.chine" proof - have "\rfw'.Prj\<^sub>0\<^sub>1 \?R, ?w1'\ rfw'.Prj\<^sub>0\ \ \w'.chine = gw'.apex" proof (intro C.prj_joint_monic [of ?R ?w1' "\rfw'.Prj\<^sub>0\<^sub>1 \?R, ?w1'\ rfw'.Prj\<^sub>0\ \ \w'.chine" gw'.apex]) show "C.cospan ?R ?w1'" using fw'.legs_form_cospan(1) by simp show "C.seq ?p1' (\rfw'.Prj\<^sub>0\<^sub>1 \?R, ?w1'\ rfw'.Prj\<^sub>0\ \ \w'.chine)" proof (intro C.seqI' C.comp_in_homI) show "\\w'.chine : Dom_\.leg0 \\ w'.leg1 \\<^sub>C Cod_\.leg0 \\ w'.cod.leg1\" using \w'.chine_composite_in_hom by simp show "\\rfw'.Prj\<^sub>0\<^sub>1 \?R, w'.leg1\ rfw'.Prj\<^sub>0\ : Cod_\.leg0 \\ w'.cod.leg1 \\<^sub>C ?R \\ w'.leg1\" using \C.commutative_square ?R ?w1' rfw'.Prj\<^sub>0\<^sub>1 rfw'.Prj\<^sub>0\ C.tuple_in_hom [of ?R ?w1' rfw'.Prj\<^sub>0\<^sub>1 rfw'.Prj\<^sub>0] rf rf.leg0_composite by auto show "\?p1' : ?R \\ w'.leg1 \\<^sub>C f.apex\" using fw'.prj_in_hom(1) by auto qed show "C.seq ?p1' gw'.apex" using gw'.dom.apex_def gw'.leg0_composite fw'.prj_in_hom by auto show "?p0' \ \rfw'.Prj\<^sub>0\<^sub>1 \?R, ?w1'\ rfw'.Prj\<^sub>0\ \ \w'.chine = ?p0' \ gw'.apex" proof - have "?p0' \ \rfw'.Prj\<^sub>0\<^sub>1 \?R, ?w1'\ rfw'.Prj\<^sub>0\ \ \w'.chine = (?p0' \ \rfw'.Prj\<^sub>0\<^sub>1 \?R, ?w1'\ rfw'.Prj\<^sub>0\) \ \w'.chine" using C.comp_assoc by simp also have "... = rfw'.Prj\<^sub>0 \ \w'.chine" using \C.commutative_square ?R ?w1' rfw'.Prj\<^sub>0\<^sub>1 rfw'.Prj\<^sub>0\ by auto also have "... = \

\<^sub>0[k0, ?w1'] \ \\.chine \ ?p1' \k0, ?w1'\ w'.chine \ ?p0'\" using \w'.chine_composite Dom_\_0 Cod_\_0 C.comp_cod_arr by simp also have "... = w'.chine \ ?p0'" using \C.commutative_square k0 ?w1' (\.chine \ ?p1') (w'.chine \ ?p0')\ by simp also have "... = ?p0' \ gw'.apex" using cospan C.comp_cod_arr C.comp_arr_dom gw'.chine_is_identity gw'.chine_eq_apex gw'.chine_composite fw'.prj_in_hom by auto finally show ?thesis by simp qed show "?p1' \ \rfw'.Prj\<^sub>0\<^sub>1 \ra, ?w1'\ rfw'.Prj\<^sub>0\ \ \w'.chine = ?p1' \ gw'.apex" proof - have "?p1' \ \rfw'.Prj\<^sub>0\<^sub>1 \ra, ?w1'\ rfw'.Prj\<^sub>0\ \ \w'.chine = (?p1' \ \rfw'.Prj\<^sub>0\<^sub>1 \ra, ?w1'\ rfw'.Prj\<^sub>0\) \ \w'.chine" using C.comp_assoc by simp also have "... = rfw'.Prj\<^sub>0\<^sub>1 \ \w'.chine" using \C.commutative_square ?R ?w1' rfw'.Prj\<^sub>0\<^sub>1 rfw'.Prj\<^sub>0\ by simp also have "... = k0 \ \

\<^sub>1[k0, ?w1'] \ \\.chine \ ?p1' \k0, ?w1'\ w'.chine \ ?p0'\" using \w'.chine_composite Cod_\_0 C.comp_assoc C.comp_cod_arr by simp also have "... = k0 \ \.chine \ ?p1'" using \C.commutative_square k0 ?w1' (\.chine \ ?p1') (w'.chine \ ?p0')\ by simp also have "... = (k0 \ \.chine) \ ?p1'" using C.comp_assoc by metis also have "... = ?p1'" using \.leg0_commutes C.comp_cod_arr cospan' by simp also have "... = ?p1' \ gw'.apex" using C.comp_arr_dom cospan' gw'.chine_eq_apex gw'.chine_composite by simp finally show ?thesis by simp qed qed thus ?thesis using Chn_\ C.comp_cod_arr gw'.apex_composite by auto qed also have "... = \

\<^sub>0[r0, ?u1] \ ?RHS" using RHS 2 C.prj_tuple [of r0 ?u1] by simp finally show ?thesis by simp qed show "ru.prj\<^sub>1 \ ?LHS = ru.prj\<^sub>1 \ ?RHS" proof - have "ru.prj\<^sub>1 \ ?LHS = (ru.prj\<^sub>1 \ r\'.chine) \ Chn \[r, f, w'] \ \w'.chine \ \.chine" using C.comp_assoc by simp also have "... = \

\<^sub>1[r0, fw'.leg1] \ Chn \[r, f, w'] \ \w'.chine \ \.chine" using Chn_r\' Chn_r\'_eq fw' \C.commutative_square r0 ?u1 \

\<^sub>1[r0, r0 \ ?p1'] (\'.chine \ \

\<^sub>0[r0, r0 \ ?p1'])\ by simp also have "... = (rfw'.Prj\<^sub>1 \ rfw'.chine_assoc) \ \w'.chine \ \.chine" using ide_f ide_w' hseq_rf hseq_char \_ide fw'.leg1_composite C.comp_assoc by auto also have "... = (rfw'.Prj\<^sub>1\<^sub>1 \ \w'.chine) \ \.chine" using rfw'.prj_chine_assoc C.comp_assoc by simp also have "... = ((k1 \ \

\<^sub>1[k0, ?w1']) \ \w'.chine) \ \.chine" using C.comp_cod_arr by simp also have "... = (k1 \ \

\<^sub>1[k0, ?w1'] \ \w'.chine) \ \.chine" using C.comp_assoc by simp also have "... = (k1 \ \.chine \ ?p1') \ \.chine" using Chn_\w'_eq Dom_\_0 Cod_\_0 \C.commutative_square k0 ?w1' (\.chine \ ?p1') ?p0'\ by simp also have "... = (k1 \ \.chine) \ ?p1' \ \.chine" using C.comp_assoc by metis also have "... = (?R \ ?p1') \ \.chine" using C.comp_assoc by simp also have "... = ?p1' \ \.chine" using C.comp_cod_arr C.prj1_in_hom [of ?R ?w1'] cospan' by simp also have "... = ru.prj\<^sub>1 \ ?RHS" using RHS 2 by simp finally show ?thesis by simp qed qed qed finally show ?thesis by simp qed text \ Now we work on the left-hand side. \ have L: "Chn (T.composite_cell w \) = \?p1 \r0, ?u1\ \.chine\" proof - have "Chn (T.composite_cell w \) = r\.chine \ Chn \[r, f, w] \ \w.chine" using Chn_vcomp arfw C.comp_assoc by auto moreover have "... = \?p1 \r0, ?u1\ \.chine\" proof - let ?LHS = "r\.chine \ Chn \[r, f, w] \ \w.chine" let ?RHS = "\?p1 \r0, ?u1\ \.chine\" have 2: "C.commutative_square r0 ?u1 ?p1 \.chine" by fact have LHS: "\?LHS : ?R \\ ?w1 \\<^sub>C r0 \\ ?u1\" using Chn_r\ Chn_\w rfw.chine_assoc_in_hom by (metis (no_types, lifting) "8" Chn_in_hom Dom_\_0 arrow_of_spans_data.simps(2) calculation gw.chine_composite r\_cod_apex_eq ru.chine_composite) have RHS: "\?RHS : ?R \\ ?w1 \\<^sub>C r0 \\ ?u1\" using 2 C.tuple_in_hom [of r0 ?u1 "?p1" \.chine] cospan r\_cod_apex_eq by simp show ?thesis proof (intro C.prj_joint_monic [of r0 ?u1 ?LHS ?RHS]) show "C.cospan r0 ?u1" using ru.legs_form_cospan(1) by blast show "C.seq ru.prj\<^sub>1 ?LHS" using LHS r\_cod_apex_eq by auto show "C.seq ru.prj\<^sub>1 ?RHS" using RHS r\_cod_apex_eq by auto show "ru.prj\<^sub>0 \ ?LHS = ru.prj\<^sub>0 \ ?RHS" proof - have "ru.prj\<^sub>0 \ ?LHS = (ru.prj\<^sub>0 \ r\.chine) \ Chn \[r, f, w] \ \w.chine" using C.comp_assoc by simp also have "... = (\.chine \ \

\<^sub>0[r0, f.leg1 \ fw.prj\<^sub>1]) \ Chn \[r, f, w] \ \w.chine" using Chn_r\_eq Dom_\_1 Cod_\_1 fw.leg1_composite \C.commutative_square r0 ?u1 \

\<^sub>1[r0, r0 \ ?p1] (\.chine \ \

\<^sub>0[r0, r0 \ ?p1])\ by simp also have "... = \.chine \ (\

\<^sub>0[r0, r0 \ ?p1] \ Chn \[r, f, w]) \ \w.chine" using C.comp_assoc by simp also have "... = \.chine \ \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\ \ \w.chine" proof - have "Chn \[r, f, w] = rfw.chine_assoc" using ide_f ide_w hseq_rf hseq_char \_ide by auto moreover have "\

\<^sub>0[r0, r0 \ ?p1] \ rfw.chine_assoc = \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\" using rfw.chine_assoc_def \C.commutative_square r0 (r0 \ ?p1) rfw.Prj\<^sub>1\<^sub>1 \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\\ by simp ultimately show ?thesis by simp qed also have "... = \.chine \ (?R \\ ?w1)" proof - have "\rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\ \ \w.chine = ?R \\ ?w1" proof (intro C.prj_joint_monic [of ?R ?w1 "\rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\ \ \w.chine" "?R \\ ?w1"]) show "C.cospan ?R ?w1" by fact show "C.seq ?p1 (\rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\ \ \w.chine)" proof - have "C.seq rfw.Prj\<^sub>0\<^sub>1 \w.chine" by (meson C.seqI' Chn_in_hom \w rfw.prj_in_hom(2) \C.commutative_square ?R ?w1 rfw.Prj\<^sub>0\<^sub>1 rfw.Prj\<^sub>0\) thus ?thesis using \C.commutative_square ?R ?w1 rfw.Prj\<^sub>0\<^sub>1 rfw.Prj\<^sub>0\ by (metis (no_types) C.comp_assoc C.prj_tuple(2)) qed show "C.seq ?p1 (?R \\ ?w1)" using gw.dom.apex_def gw.leg0_composite gw.prj_in_hom by auto show "?p0 \ \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\ \ \w.chine = ?p0 \ (?R \\ ?w1)" proof - have "?p0 \ \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\ \ \w.chine = (?p0 \ \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\) \ \w.chine" using C.comp_assoc by simp also have "... = rfw.Prj\<^sub>0 \ \w.chine" using \C.commutative_square ?R ?w1 rfw.Prj\<^sub>0\<^sub>1 rfw.Prj\<^sub>0\ by simp also have "... = \

\<^sub>0[k0, ?w1] \ \\.chine \ ?p1 \k0, ?w1\ ?p0\" using Chn_\w_eq C.comp_cod_arr by simp also have "... = ?p0" using \C.commutative_square k0 ?w1 (\.chine \ ?p1) ?p0\ C.prj_tuple(1) by blast also have "... = ?p0 \ (?R \\ ?w1)" using C.comp_arr_dom gw.chine_eq_apex gw.chine_is_identity by (metis C.arr_dom_iff_arr C.pbdom_def Dom_g gw.chine_composite gw.chine_simps(1) span_data.select_convs(1)) finally show ?thesis by simp qed show "?p1 \ \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\ \ \w.chine = ?p1 \ (?R \\ ?w1)" proof - have "?p1 \ \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\ \ \w.chine = (?p1 \ \rfw.Prj\<^sub>0\<^sub>1 \?R, ?w1\ rfw.Prj\<^sub>0\) \ \w.chine" using C.comp_assoc by simp also have "... = rfw.Prj\<^sub>0\<^sub>1 \ \w.chine" using \C.commutative_square ?R ?w1 rfw.Prj\<^sub>0\<^sub>1 rfw.Prj\<^sub>0\ by simp also have "... = (k0 \ \

\<^sub>1[k0, ?w1]) \ \\.chine \ ?p1 \k0, ?w1\ ?p0\" using Chn_\w_eq C.comp_cod_arr by simp also have "... = k0 \ \

\<^sub>1[k0, ?w1] \ \\.chine \ ?p1 \k0, ?w1\ ?p0\" using C.comp_assoc by simp also have "... = k0 \ \.chine \ ?p1" using \C.commutative_square k0 ?w1 (\.chine \ ?p1) ?p0\ by simp also have "... = (k0 \ \.chine) \ ?p1" using C.comp_assoc by metis also have "... = ?p1 \ (?R \\ ?w1)" using C.comp_arr_dom C.comp_cod_arr cospan by simp finally show ?thesis by blast qed qed thus ?thesis by simp qed also have "... = \.chine" using C.comp_arr_dom \.chine_in_hom gw.chine_eq_apex gw.chine_is_identity Dom_\_0 Cod_\_0 Dom_\.apex_def Cod_\.apex_def by (metis Dom_g \.chine_simps(1) \.chine_simps(2) gw.chine_composite gw.dom.apex_def gw.leg0_composite span_data.select_convs(1)) also have "... = ru.prj\<^sub>0 \ ?RHS" using 2 by simp finally show ?thesis by blast qed show "ru.prj\<^sub>1 \ ?LHS = ru.prj\<^sub>1 \ ?RHS" proof - have "ru.prj\<^sub>1 \ ?LHS = (ru.prj\<^sub>1 \ r\.chine) \ Chn \[r, f, w] \ \w.chine" using C.comp_assoc by simp also have "... = (r.chine \ \

\<^sub>1[r0, r0 \ ?p1]) \ Chn \[r, f, w] \ \w.chine" proof - have "r\.chine \ C.null \ \

\<^sub>1[r.cod.leg0, Cod_\.leg1] \ r\.chine = r.chine \ \

\<^sub>1[r0, Dom_\.leg1]" by (metis (lifting) C.prj_tuple(2) C.tuple_is_extensional r.cod_simps(2) r\.chine_composite) thus ?thesis using Cod_\_1 Dom_\_1 r\.chine_simps(1) fw by fastforce qed also have "... = r.chine \ (rfw.Prj\<^sub>1 \ Chn \[r, f, w]) \ \w.chine" using C.comp_assoc fw.leg1_composite by simp also have "... = r.chine \ rfw.Prj\<^sub>1\<^sub>1 \ \w.chine" using ide_f ide_w hseq_rf hseq_char \_ide rfw.prj_chine_assoc(1) by auto also have "... = r.chine \ k1 \ \

\<^sub>1[k0, ?w1] \ \w.chine" using C.comp_cod_arr C.comp_assoc by simp also have "... = r.chine \ k1 \ \.chine \ \

\<^sub>1[Dom_\.leg0, ?w1]" using Chn_\w_eq \C.commutative_square k0 ?w1 (\.chine \ \

\<^sub>1[ra, w.leg1]) \

\<^sub>0[ra, w.leg1]\ by auto also have "... = r.chine \ (k1 \ \.chine) \ ?p1" using C.comp_assoc Dom_\_0 by metis also have "... = r.chine \ ra \ ?p1" by simp also have "... = r.chine \ ?p1" using C.comp_cod_arr by (metis C.comp_assoc r.cod_simps(1) r.chine_eq_apex r.chine_simps(1) r.chine_simps(3)) also have "... = ?p1" using C.comp_cod_arr r.chine_eq_apex r.chine_is_identity by (metis 2 C.commutative_squareE r.dom.apex_def) also have "... = ru.prj\<^sub>1 \ ?RHS" using 2 by simp finally show ?thesis by simp qed qed qed ultimately show ?thesis by simp qed text \ This is the main point: the equation E boils down to the following: \[ \?p1' \ \.chine = ?p1 \ \'.chine \ \.chine = \.chine\ \] The first equation gets us close to what we need, but we still need \?p1 \ C.inv ?p0 = ?w1\, which follows from the fact that ?p0 is the pullback of ?R. \ have *: "\?p1' \ \.chine \r0, ?u1\ \'.chine \ \.chine\ = \?p1 \r0, ?u1\ \.chine\" using L R E by simp have **: "?p1' \ \.chine = ?p1" by (metis "*" C.in_homE C.not_arr_null C.prj_tuple(2) C.tuple_in_hom C.tuple_is_extensional \C.commutative_square r0 u.leg1 (\

\<^sub>1[ra, w'.leg1] \ \.chine) (\'.chine \ \.chine)\) have ***: "\'.chine \ \.chine = \.chine" by (metis "*" C.prj_tuple(1) \C.commutative_square r0 ?u1 (?p1' \ \.chine) (\'.chine \ \.chine)\ \C.commutative_square r0 ?u1 ?p1 \.chine\) text \ CKS say to take \\ = \\, but obviously this cannot work as literally described, because \\\ : g \ w \ g \ w'\\, whereas we must have \\\ : w \ w'\\. Instead, we have to define \\\ by transporting \\\ along the projections from \?R \\ ?w1\ to \?W\ and \?R \\ ?w1'\ to \?W'\. These are isomorphisms by virtue of their being pullbacks of identities, but they are not themselves necessarily identities. Specifically, we take \Chn \ = ?p0' \ Chn \ \ C.inv ?p0\. \ let ?\ = "\Chn = ?p0' \ \.chine \ C.inv ?p0, Dom = Dom w, Cod = Cod w'\" interpret Dom_\: span_in_category C \Dom ?\\ using w.dom.span_in_category_axioms by simp interpret Cod_\: span_in_category C \Cod ?\\ using w'.cod.span_in_category_axioms by simp text \ It has to be shown that \\\ is an arrow of spans. \ interpret \: arrow_of_spans C ?\ proof show "\Chn ?\ : Dom_\.apex \\<^sub>C Cod_\.apex\" proof - have "\Chn \: gw.apex \\<^sub>C gw'.apex\" using Chn_in_hom \ gw'.chine_eq_apex gw.chine_eq_apex by force moreover have "\?p0' : gw'.apex \\<^sub>C w'.apex\" using cospan' hseq_gw' hseq_char hcomp_def gw'.dom.apex_def w'.dom.apex_def by auto moreover have "\C.inv ?p0 : w.apex \\<^sub>C gw.apex\" using cospan hseq_gw hseq_char hcomp_def gw.dom.apex_def w.dom.apex_def C.iso_pullback_ide by auto ultimately show ?thesis using Dom_\.apex_def Cod_\.apex_def by auto qed text \ The commutativity property for the ``input leg'' follows directly from that for \\\. \ show "Cod_\.leg0 \ Chn ?\ = Dom_\.leg0" using C.comp_assoc C.comp_arr_dom cospan C.iso_pullback_ide C.comp_arr_inv' by (metis C.invert_side_of_triangle(2) Dom_\.leg_simps(1) Dom_\_eq \0 arrow_of_spans_data.select_convs(1,3) arrow_of_spans_data.simps(2) r.dom.ide_apex span_data.select_convs(1) w'.cod_simps(2)) text \ The commutativity property for the ``output leg'' is a bit more subtle. \ show "Cod_\.leg1 \ Chn ?\ = Dom_\.leg1" proof - have "Cod_\.leg1 \ Chn ?\ = ((?w1' \ ?p0') \ \.chine) \ C.inv ?p0" using C.comp_assoc by simp also have "... = ((?R \ ?p1') \ Chn \) \ C.inv ?p0" using cospan' C.pullback_commutes [of ?R ?w1'] by auto also have "... = (?p1' \ \.chine) \ C.inv ?p0" using cospan' C.comp_cod_arr by simp also have "... = ?p1 \ C.inv ?p0" using ** by simp also have "... = ?w1" text \ Sledgehammer found this at a time when I was still struggling to understand what was going on. \ by (metis C.comp_cod_arr C.invert_side_of_triangle(2) C.iso_pullback_ide C.prj1_simps(1,3) C.pullback_commutes' cospan r.dom.ide_apex r.chine_eq_apex r.chine_simps(2)) also have "... = Dom_\.leg1" by auto finally show ?thesis by simp qed qed text \ What remains to be shown is that \\\ is unique with the properties asserted by \T2\; \emph{i.e.} \\\ : w \ w'\ \ \ = g \ \ \ \ = \' \ (f \ \)\. CKS' assertion that the equation \(r\)(\w) = (r\')(\w')\\ gives \w\<^sub>1 = w\<^sub>1'\ does not really seem to be true. The reason \\\ is unique is because it is obtained by transporting \\\ along isomorphisms. \ have \: "\?\ : w \ w'\" using \.arrow_of_spans_axioms arr_char dom_char cod_char by auto have hseq_f\: "hseq f ?\" using \ src_def trg_def arrI fw.composable rf.are_arrows(2) by auto have hseq_g\: "hseq g ?\" using \ src_def trg_def fw.composable gw.are_arrows(1) src_f by auto interpret f\: two_composable_arrows_of_spans C prj0 prj1 f ?\ using hseq_f\ hseq_char by (unfold_locales, simp) interpret f\: arrow_of_spans C \f \ ?\\ using f\.composite_is_arrow arr_char by simp interpret g\: two_composable_arrows_of_spans C prj0 prj1 g ?\ using hseq_g\ hseq_char by (unfold_locales, simp) interpret g\: arrow_of_spans C \g \ ?\\ using g\.composite_is_arrow arr_char by simp have Chn_g\: "Chn (g \ ?\) = \?p1 \?R, ?w1'\ ?p0' \ \.chine\" proof - have "Chn (g \ ?\) = \?R \ ?p1 \?R, ?w1'\ (?p0' \ \.chine \ C.inv ?p0) \ ?p0\" using g\.chine_composite by simp also have "... = \?p1 \?R, ?w1'\ (?p0' \ \.chine \ C.inv ?p0) \ ?p0\" using C.comp_cod_arr cospan by simp also have "... = \?p1 \?R, ?w1'\ ?p0' \ \.chine\" proof - have "(?p0' \ \.chine \ C.inv ?p0) \ ?p0 = ?p0' \ \.chine" using C.comp_assoc C.iso_pullback_ide [of ?R ?w1] C.comp_inv_arr C.comp_arr_dom Chn_\ by (metis C.comp_inv_arr' C.in_homE C.pbdom_def cospan r.dom.ide_apex) thus ?thesis by simp qed ultimately show ?thesis by simp qed have Chn_\_eq: "\.chine = Chn (g \ ?\)" - proof - - have "Chn (g \ ?\) = \?p1 \?R, ?w1'\ ?p0' \ Chn \\" - using Chn_g\ by simp - also have "... = \.chine" - text \Here was another score by sledgehammer while I was still trying - to understand it.\ - using ** C.prj_joint_monic - by (metis C.prj1_simps(1) C.tuple_prj cospan cospan') - finally show ?thesis by simp - qed + by (metis "**" C.span_prj C.tuple_prj Chn_g\ cospan cospan') have \_eq_g\: "\ = g \ ?\" proof (intro arr_eqI) show "par \ (g \ ?\)" proof - have "\g \ ?\ : g \ w \ g \ w'\" using ide_g \ T.leg1_simps(3) by (intro hcomp_in_vhom, auto) thus ?thesis using \ by (elim in_homE, auto) qed show "\.chine = Chn (g \ ?\)" using Chn_\_eq by simp qed moreover have "\ = \' \ (f \ ?\)" proof (intro arr_eqI) have f\: "\f \ ?\ : f \ w \ f \ w'\" using \ ide_f by auto show par: "par \ (\' \ (f \ ?\))" using \ \' f\ by (elim in_homE, auto) show "\.chine = Chn (\' \ (f \ ?\))" using par "***" Chn_vcomp calculation f\.chine_composite g\.chine_composite by auto qed ultimately show 2: "\?\ : w \ w'\ \ \ = g \ ?\ \ \ = \' \ (f \ ?\)" using \ by simp show "\\'. \\' : w \ w'\ \ \ = g \ \' \ \ = \' \ (f \ \') \ \' = ?\" proof - fix \' assume 1: "\\' : w \ w'\ \ \ = g \ \' \ \ = \' \ (f \ \')" interpret \': arrow_of_spans C \' using 1 arr_char by auto have hseq_g\': \hseq g \'\ using 1 \ by auto interpret g\': two_composable_arrows_of_spans C prj0 prj1 g \' using hseq_g\' hseq_char by unfold_locales auto interpret g\': arrow_of_spans C \g \ \'\ using g\'.composite_is_arrow arr_char by simp show "\' = ?\" proof (intro arr_eqI) show par: "par \' ?\" using 1 \ by fastforce show "\'.chine = \.chine" proof - have "C.commutative_square ?R ?w1' (g.chine \ ?p1) (\'.chine \ ?p0)" proof show "C.cospan ?R ?w1'" by fact show 3: "C.span (g.chine \ ?p1) (\'.chine \ ?p0)" proof (intro conjI) show "C.seq g.chine ?p1" using cospan by auto show "C.seq \'.chine ?p0" using cospan 2 par arrow_of_spans_data.simps(1) dom_char in_homE w.chine_eq_apex by auto thus "C.dom (g.chine \ ?p1) = C.dom (\'.chine \ ?p0)" using g.chine_eq_apex cospan by simp qed show "C.dom ra = C.cod (g.chine \ ?p1)" using cospan by auto show "?R \ g.chine \ ?p1 = ?w1' \ \'.chine \ ?p0" proof - have "?w1' \ \'.chine \ ?p0 = (?w1' \ \'.chine) \ ?p0" using C.comp_assoc by simp moreover have "... = ?w1 \ ?p0" using 1 \'.leg1_commutes dom_char cod_char by auto also have "... = ?R \ ?p1" using cospan C.pullback_commutes [of ra ?w1] by auto also have "... = ?R \ g.chine \ ?p1" using 3 C.comp_cod_arr g.chine_is_identity g.chine_eq_apex g.dom.apex_def by auto finally show ?thesis by auto qed qed have "C.commutative_square ?R ?w1' (g.chine \ ?p1) (\.chine \ ?p0)" proof show "C.cospan ?R ?w1'" by fact show 3: "C.span (g.chine \ ?p1) (\.chine \ ?p0)" using cospan \.chine_in_hom by auto show "C.dom ?R = C.cod (g.chine \ ?p1)" using cospan by auto show "?R \ g.chine \ ?p1 = ?w1' \ \.chine \ ?p0" proof - have "?w1' \ \.chine \ ?p0 = (?w1' \ \.chine) \ ?p0" using C.comp_assoc by simp moreover have "... = ?w1 \ ?p0" using 1 \.leg1_commutes dom_char cod_char by auto also have "... = ?R \ ?p1" using cospan C.pullback_commutes [of ra ?w1] by auto also have "... = ?R \ g.chine \ ?p1" using 3 C.comp_cod_arr g.chine_is_identity g.chine_eq_apex g.dom.apex_def by auto finally show ?thesis by auto qed qed have "\'.chine \ ?p0 = \.chine \ ?p0" proof - have "\'.chine \ ?p0 = ?p0' \ g\'.chine" using 1 dom_char cod_char g\'.chine_composite \C.commutative_square ?R ?w1' (g.chine \ ?p1) (\'.chine \ ?p0)\ by auto also have "... = ?p0' \ \.chine" using 1 by simp also have "... = ?p0' \ g\.chine" using Chn_\_eq by simp also have "... = \.chine \ ?p0" using g\.chine_composite \C.commutative_square ?R ?w1' (g.chine \ ?p1) (\.chine \ ?p0)\ by simp finally show ?thesis by simp qed thus ?thesis using C.iso_pullback_ide C.iso_is_retraction C.retraction_is_epi C.epiE [of "?p0" \'.chine \.chine] cospan \.chine_in_hom \'.chine_in_hom by auto qed qed qed qed qed qed qed qed end context span_bicategory begin interpretation chosen_right_adjoints vcomp hcomp assoc unit src trg .. notation some_right_adjoint ("_\<^sup>*" [1000] 1000) (* TODO: Why is this needed? *) notation isomorphic (infix "\" 50) text \ \Span(C)\ is a bicategory of spans. \ lemma is_bicategory_of_spans: shows "bicategory_of_spans vcomp hcomp assoc unit src trg" proof text \ Every 1-cell \r\ is isomorphic to the composition of a map and the right adjoint of a map. The proof is to obtain a tabulation of \r\ as a span of maps \(f, g)\ and then observe that \r\ is isomorphic to \g \ f\<^sup>*\. \ show "\r. ide r \ \f g. is_left_adjoint f \ is_left_adjoint g \ r \ g \ f\<^sup>*" proof - fix r assume r: "ide r" interpret r: identity_arrow_of_spans C r using r ide_char' by auto interpret r: identity_arrow_in_span_bicategory C prj0 prj1 r .. have \: "tabulation (\) (\) assoc unit src trg r r.\ r.f r.g \ is_left_adjoint r.f \ is_left_adjoint r.g" using r r.has_tabulation by blast interpret \: tabulation vcomp hcomp assoc unit src trg r r.\ r.f r.g using \ by fast have 1: "r \ r.g \ r.f\<^sup>*" using \ \.yields_isomorphic_representation' \.T0.is_map left_adjoint_extends_to_adjoint_pair isomorphic_def [of "r.g \ r.f\<^sup>*" r] isomorphic_symmetric by auto thus "\f g. is_left_adjoint f \ is_left_adjoint g \ r \ g \ f\<^sup>*" using \ by blast qed text \ Every span of maps extends to a tabulation. \ show "\f g. \ is_left_adjoint f; is_left_adjoint g; src f = src g \ \ \r \. tabulation (\) (\) assoc unit src trg r \ f g" proof - text \ The proof idea is as follows: Let maps \f = (f\<^sub>1, f\<^sub>0)\ and \g = (g\<^sub>1, g\<^sub>0)\ be given. Let \f' = (f\<^sub>1 \ C.inv f\<^sub>0, C.cod f\<^sub>0)\ and \g' = (g\<^sub>1 \ C.inv g\<^sub>0, C.cod g\<^sub>0)\; then \f'\ and \g'\ are maps isomorphic to \f\ and \g\, respectively. By a previous result, \f'\ and \g'\ extend to a tabulation \(f', \, g')\ of \r = (f\<^sub>1 \ C.inv f\<^sub>0, g\<^sub>1 \ C.inv g\<^sub>0)\. Compose with isomorphisms \\\ : f' \ f\\ and \\\ : g \ g'\\ to obtain \(f, (r \ \) \ \ \ \, g)\ and show it must also be a tabulation. \ fix f g assume f: "is_left_adjoint f" assume g: "is_left_adjoint g" assume fg: "src f = src g" show "\r \. tabulation (\) (\) assoc unit src trg r \ f g" proof - text \We have to unpack the hypotheses to get information about f and g.\ obtain f\<^sub>a \\<^sub>f \\<^sub>f where ff\<^sub>a: "adjunction_in_bicategory vcomp hcomp assoc unit src trg f f\<^sub>a \\<^sub>f \\<^sub>f" using f adjoint_pair_def by auto interpret ff\<^sub>a: adjunction_in_bicategory vcomp hcomp assoc unit src trg f f\<^sub>a \\<^sub>f \\<^sub>f using ff\<^sub>a by simp interpret f: arrow_of_spans C f using ide_char [of f] by simp interpret f: identity_arrow_of_spans C f using ide_char [of f] by unfold_locales auto obtain g\<^sub>a \\<^sub>g \\<^sub>g where G: "adjunction_in_bicategory vcomp hcomp assoc unit src trg g g\<^sub>a \\<^sub>g \\<^sub>g" using g adjoint_pair_def by auto interpret gg\<^sub>a: adjunction_in_bicategory vcomp hcomp assoc unit src trg g g\<^sub>a \\<^sub>g \\<^sub>g using G by simp interpret g: arrow_of_spans C g using ide_char [of g] by simp interpret g: identity_arrow_of_spans C g using ide_char [of g] by unfold_locales auto let ?f' = "mkIde (C.cod f.leg0) (f.dom.leg1 \ C.inv f.leg0)" have f': "ide ?f'" proof - have "C.span (C.cod f.leg0) (f.leg1 \ C.inv f.leg0)" using f is_left_adjoint_char by auto thus ?thesis using ide_mkIde by blast qed interpret f': arrow_of_spans C ?f' using f' ide_char by blast interpret f': identity_arrow_of_spans C ?f' using f' ide_char by unfold_locales auto let ?g' = "mkIde (C.cod g.leg0) (g.dom.leg1 \ C.inv g.leg0)" have g': "ide ?g'" proof - have "C.span (C.cod g.leg0) (g.leg1 \ C.inv g.leg0)" using g is_left_adjoint_char by auto thus ?thesis using ide_mkIde by blast qed interpret g': arrow_of_spans C ?g' using g' ide_char by blast interpret g': identity_arrow_of_spans C ?g' using g' ide_char by unfold_locales auto let ?r = "mkIde (f'.leg1) (g'.leg1)" have r: "ide ?r" proof - have "C.span (f'.leg1) (g'.leg1)" using f g fg src_def is_left_adjoint_char by simp thus ?thesis using ide_mkIde by blast qed interpret r: arrow_of_spans C ?r using r ide_char by blast interpret r: identity_arrow_of_spans C ?r using r ide_char by unfold_locales auto interpret r: identity_arrow_in_span_bicategory C prj0 prj1 ?r .. have "r.f = ?f'" using f r.chine_eq_apex is_left_adjoint_char by auto have "r.g = ?g'" using f r.chine_eq_apex fg src_def is_left_adjoint_char by simp interpret \: tabulation \(\)\ \(\)\ assoc unit src trg ?r r.\ r.f r.g using r.has_tabulation by simp have \_eq: "r.\ = \Chn = \C.cod f.leg0 \f'.leg1, f'.leg1\ C.cod f.leg0\, Dom = \Leg0 = C.cod f.leg0, Leg1 = g'.leg1\, Cod = \Leg0 = \

\<^sub>0[f'.leg1, f'.leg1], Leg1 = g'.leg1 \ \

\<^sub>1[f'.leg1, f'.leg1]\\" using \r.f = ?f'\ by auto text \Obtain the isomorphism from \f'\ to \f\.\ let ?\ = "\Chn = C.inv f.leg0, Dom = Dom ?f', Cod = Dom f\" interpret Dom_\: span_in_category C \Dom \Chn = C.inv f.leg0, Dom = Dom (mkIde f.dsrc (f.leg1 \ C.inv f.leg0)), Cod = Dom f\\ using f'.dom.span_in_category_axioms by simp interpret Cod_\: span_in_category C \Cod \Chn = C.inv f.leg0, Dom = Dom (mkIde f.dsrc (f.leg1 \ C.inv f.leg0)), Cod = Dom f\\ using f.dom.span_in_category_axioms by simp interpret \: arrow_of_spans C ?\ proof show "\Chn \Chn = C.inv f.leg0, Dom = Dom (mkIde f.dsrc (f.leg1 \ C.inv f.leg0)), Cod = Dom f\ : Dom_\.apex \\<^sub>C Cod_\.apex\" using f f.dom.apex_def f'.dom.apex_def is_left_adjoint_char by auto show "Cod_\.leg0 \ Chn \Chn = C.inv f.leg0, Dom = Dom (mkIde f.dsrc (f.leg1 \ C.inv f.leg0)), Cod = Dom f\ = Dom_\.leg0" using f f.dom.apex_def is_left_adjoint_char C.comp_arr_inv C.inv_is_inverse by simp show "Cod_\.leg1 \ Chn \Chn = C.inv f.leg0, Dom = Dom (mkIde f.dsrc (f.leg1 \ C.inv f.leg0)), Cod = Dom f\ = Dom_\.leg1" by simp qed have \: "\?\ : ?f' \ f\ \ iso ?\" using f is_left_adjoint_char iso_char arr_char dom_char cod_char \.arrow_of_spans_axioms f'.dom.apex_def f.dom.apex_def by auto text \ Obtain the isomorphism from \g\ to \g'\. Recall: \g' = mkIde (C.cod g.leg0) (g.dom.leg1 \ C.inv g.leg0)\. The isomorphism is given by \g.leg0\. \ let ?\ = "\Chn = g.leg0, Dom = Dom g, Cod = Dom ?g'\" interpret Dom_\: span_in_category C \Dom \Chn = g.leg0, Dom = Dom g, Cod = Dom (mkIde g.dsrc (g.leg1 \ C.inv g.leg0))\\ using g.dom.span_in_category_axioms by simp interpret Cod_\: span_in_category C \Cod \Chn = g.leg0, Dom = Dom g, Cod = Dom (mkIde g.dsrc (g.leg1 \ C.inv g.leg0))\\ using g'.dom.span_in_category_axioms by simp interpret \: arrow_of_spans C ?\ proof show "\Chn \Chn = g.leg0, Dom = Dom g, Cod = Dom (mkIde g.dsrc (g.leg1 \ C.inv g.leg0))\ : Dom_\.apex \\<^sub>C Cod_\.apex\" using g g.dom.apex_def g'.dom.apex_def is_left_adjoint_char by auto show "Cod_\.leg0 \ Chn \Chn = g.leg0, Dom = Dom g, Cod = Dom (mkIde g.dsrc (g.leg1 \ C.inv g.leg0))\ = Dom_\.leg0" using C.comp_cod_arr by simp show "Cod_\.leg1 \ Chn \Chn = g.leg0, Dom = Dom g, Cod = Dom (mkIde g.dsrc (g.leg1 \ C.inv g.leg0))\ = Dom_\.leg1" using g g.dom.apex_def is_left_adjoint_char C.comp_inv_arr C.inv_is_inverse C.comp_assoc C.comp_arr_dom by simp qed have \: "\?\ : g \ ?g'\ \ iso ?\" using g is_left_adjoint_char iso_char arr_char dom_char cod_char \.arrow_of_spans_axioms g.dom.apex_def g'.dom.apex_def by auto have \\: "tabulation (\) (\) assoc unit src trg ?r (r.\ \ ?\) r.f g" using \ \r.g = ?g'\ r.has_tabulation \.preserved_by_output_iso by simp interpret \\: tabulation vcomp hcomp assoc unit src trg ?r \r.\ \ ?\\ r.f g using \\ by auto have "tabulation (\) (\) assoc unit src trg ?r ((?r \ ?\) \ r.\ \ ?\) f g" using \ \r.f = ?f'\ \\.preserved_by_input_iso [of ?\ f] by argo thus ?thesis by auto qed qed text \The sub-bicategory of maps is locally essentially discrete.\ show "\f f' \ \'. \ is_left_adjoint f; is_left_adjoint f'; \\ : f \ f'\; \\' : f \ f'\ \ \ iso \ \ iso \' \ \ = \'" proof - fix f f' \ \' assume f: "is_left_adjoint f" and f': "is_left_adjoint f'" assume \: "\\ : f \ f'\" and \': "\\' : f \ f'\" obtain f\<^sub>a \ \ where f\<^sub>a: "adjunction_in_bicategory vcomp hcomp assoc unit src trg f f\<^sub>a \ \" using f adjoint_pair_def by auto obtain f'\<^sub>a \' \' where f'\<^sub>a: "adjunction_in_bicategory vcomp hcomp assoc unit src trg f' f'\<^sub>a \' \'" using f' adjoint_pair_def adjunction_def by auto interpret f\<^sub>a: adjunction_in_bicategory vcomp hcomp assoc unit src trg f f\<^sub>a \ \ using f\<^sub>a by simp interpret f'\<^sub>a: adjunction_in_bicategory vcomp hcomp assoc unit src trg f' f'\<^sub>a \' \' using f'\<^sub>a by simp interpret f: identity_arrow_of_spans C f using ide_char' [of f] by simp interpret f': identity_arrow_of_spans C f' using ide_char' [of f'] by simp interpret \: arrow_of_spans C \ using \ arr_char by auto interpret \': arrow_of_spans C \' using \' arr_char by auto have 1: "C.iso f.leg0 \ C.iso f'.leg0" using f f' is_left_adjoint_char by simp have 2: "\.chine = C.inv f'.leg0 \ f.leg0" using \ 1 dom_char cod_char \.leg0_commutes C.invert_side_of_triangle by auto moreover have "\'.chine = C.inv f'.leg0 \ f.leg0" using \' 1 dom_char cod_char \'.leg0_commutes C.invert_side_of_triangle by auto ultimately have 3: "\.chine = \'.chine" by simp have "iso \" using 1 2 \ C.isos_compose dom_char cod_char iso_char arr_char by auto hence "iso \'" using 3 iso_char arr_char \'.arrow_of_spans_axioms by simp moreover have "\ = \'" using 3 \ \' dom_char cod_char by fastforce ultimately show "iso \ \ iso \' \ \ = \'" by simp qed qed text \ We can now prove the easier half of the main result (CKS Theorem 4): If \B\ is biequivalent to \Span(C)\, where \C\ is a category with pullbacks, then \B\ is a bicategory of spans. (Well, it is easier given that we have already done the work to show that the notion ``bicategory of spans'' is respected by equivalence of bicategories.) \ theorem equivalent_implies_bicategory_of_spans: assumes "equivalent_bicategories vcomp hcomp assoc unit src trg V\<^sub>1 H\<^sub>1 \\<^sub>1 \\<^sub>1 src\<^sub>1 trg\<^sub>1" shows "bicategory_of_spans V\<^sub>1 H\<^sub>1 \\<^sub>1 \\<^sub>1 src\<^sub>1 trg\<^sub>1" using assms is_bicategory_of_spans bicategory_of_spans_respects_equivalence by blast end subsection "Properties of Bicategories of Spans" text \ We now develop consequences of the axioms for a bicategory of spans, in preparation for proving the other half of the main result. \ context bicategory_of_spans begin notation isomorphic (infix "\" 50) text \ The following is a convenience version of \BS2\ that gives us what we generally want: given specified \f, g\ obtain \\\ that makes \(f, \, g)\ a tabulation of \g \ f\<^sup>*\, not a tabulation of some \r\ isomorphic to \g \ f\<^sup>*\. \ lemma BS2': assumes "is_left_adjoint f" and "is_left_adjoint g" and "src f = src g" and "isomorphic (g \ f\<^sup>*) r" shows "\\. tabulation V H \ \ src trg r \ f g" proof - have 1: "is_left_adjoint f \ is_left_adjoint g \ g \ f\<^sup>* \ r" using assms BS1 by simp obtain \ where \: "\\ : g \ f\<^sup>* \ r\ \ iso \" using 1 isomorphic_def by blast obtain r' \' where \': "tabulation V H \ \ src trg r' \' f g" using assms 1 BS2 by blast interpret \': tabulation V H \ \ src trg r' \' f g using \' by simp let ?\ = "\'.T0.trnr\<^sub>\ r' \'" have \: "\?\ : g \ f\<^sup>* \ r'\ \ iso ?\" using \'.yields_isomorphic_representation by blast have "\\ \ inv ?\ : r' \ r\ \ iso (\ \ inv ?\)" using \ \ isos_compose by blast hence 3: "tabulation V H \ \ src trg r ((\ \ inv ?\ \ f) \ \') f g" using \'.is_preserved_by_base_iso by blast hence "\\. tabulation V H \ \ src trg r \ f g" by blast thus ?thesis using someI_ex [of "\\. tabulation V H \ \ src trg r \ f g"] by simp qed text \ The following observation is made by CKS near the beginning of the proof of Theorem 4: If \w\ is an arbitrary 1-cell, and \g\ and \g \ w\ are maps, then \w\ is in fact a map. It is applied frequently. \ lemma BS4: assumes "is_left_adjoint g" and "ide w" and "is_left_adjoint (g \ w)" shows "is_left_adjoint w" proof - text \ CKS say: ``by (i) there are maps \m, n\ with \w \ nm\<^sup>*\, so, by (ii), we have two tabulations \(1, \, gw)\, \(m, \, gn)\ of \gw\; since tabulations are unique up to equivalence, \m\ is invertible and \w \ nm\<^sup>*\ is a map.'' \ have ex_\: "\\. tabulation V H \ \ src trg (g \ w) \ (src w) (g \ w)" proof - have "(g \ w) \ src w \ g \ w" by (metis assms(3) iso_runit ideD(1) isomorphic_def left_adjoint_is_ide runit_in_hom(2) src_hcomp) - moreover have "isomorphic ((g \ w) \ (src w)\<^sup>*) (g \ w)" + moreover have "(g \ w) \ (src w)\<^sup>* \ g \ w" proof - have "(g \ w) \ src (g \ w) \ g \ w" using calculation isomorphic_implies_ide(2) by auto - moreover have "isomorphic (src (g \ w)) (src w)\<^sup>*" + moreover have "src (g \ w) \ (src w)\<^sup>*" proof - interpret src_w: map_in_bicategory V H \ \ src trg \src w\ using assms obj_is_self_adjoint by unfold_locales auto interpret src_w: adjunction_in_bicategory V H \ \ src trg \src w\ \(src w)\<^sup>*\ src_w.\ src_w.\ using src_w.is_map left_adjoint_extends_to_adjunction by simp have "adjoint_pair (src w) (src w)" using assms obj_is_self_adjoint by simp moreover have "adjoint_pair (src w) (src w)\<^sup>*" using adjoint_pair_def src_w.adjunction_in_bicategory_axioms by auto ultimately have "src w \ (src w)\<^sup>*" using left_adjoint_determines_right_up_to_iso by simp moreover have "src w = src (g \ w)" using assms isomorphic_def hcomp_simps(1) left_adjoint_is_ide by simp ultimately show ?thesis by simp qed moreover have "src (g \ w) = trg (src (g \ w))" using assms left_adjoint_is_ide by simp ultimately show ?thesis using assms left_adjoint_is_ide isomorphic_transitive isomorphic_symmetric hcomp_ide_isomorphic by blast qed ultimately show ?thesis using assms obj_is_self_adjoint left_adjoint_is_ide BS2' [of "src w" "g \ w" "g \ w"] by auto qed obtain \ where \: "tabulation V H \ \ src trg (g \ w) \ (src w) (g \ w)" using ex_\ by auto obtain m n where mn: "is_left_adjoint m \ is_left_adjoint n \ isomorphic w (n \ m\<^sup>*)" using assms BS1 [of w] by auto have m\<^sub>a: "adjoint_pair m m\<^sup>* \ isomorphic w (n \ m\<^sup>*)" using mn adjoint_pair_def left_adjoint_extends_to_adjoint_pair by blast have ex_\: "\\. tabulation V H \ \ src trg (g \ w) \ m (g \ n)" proof - have "hseq n m\<^sup>*" using mn isomorphic_implies_ide by auto have "trg (n \ m\<^sup>*) = trg w" using mn m\<^sub>a isomorphic_def by (metis (no_types, lifting) dom_inv in_homE trg_dom trg_inv) hence "trg n = trg w" using mn by (metis assms(2) ideD(1) trg.preserves_reflects_arr trg_hcomp) hence "hseq g n" using assms mn left_adjoint_is_ide ideD(1) by (metis hseq_char) have "hseq g w" using assms left_adjoint_is_ide by simp have "src m = src n" using mn m\<^sub>a \hseq n m\<^sup>*\ adjoint_pair_antipar [of m "m\<^sup>*"] by fastforce have "is_left_adjoint (g \ n)" using assms mn left_adjoints_compose \hseq g n\ by blast moreover have "src m = src (g \ n)" using assms mn \hseq g n\ \src m = src n\ by simp moreover have "(g \ n) \ m\<^sup>* \ g \ w" proof - have 1: "src g = trg (n \ m\<^sup>*)" using assms \trg (n \ m\<^sup>*) = trg w\ \hseq g w\ by fastforce hence "(g \ n) \ m\<^sup>* \ g \ n \ m\<^sup>*" using assms mn m\<^sub>a assoc_in_hom iso_assoc \hseq g n\ \hseq n m\<^sup>*\ isomorphic_def left_adjoint_is_ide right_adjoint_is_ide by (metis hseqE ideD(2) ideD(3)) also have "... \ g \ w" using assms 1 mn m\<^sub>a isomorphic_symmetric hcomp_ide_isomorphic left_adjoint_is_ide by simp finally show ?thesis using isomorphic_transitive by blast qed ultimately show ?thesis using assms mn m\<^sub>a BS2' by blast qed obtain \ where \: "tabulation V H \ \ src trg (g \ w) \ m (g \ n)" using ex_\ by auto interpret \: tabulation V H \ \ src trg \g \ w\ \ \src w\ \g \ w\ using \ by auto interpret \: tabulation V H \ \ src trg \g \ w\ \ m \g \ n\ using \ by auto text \ As usual, the sketch given by CKS seems more suggestive than it is a precise recipe. We can obtain an equivalence map \\e : src w \ src m\\ and \\\ such that \\\ : m \ e \ src w\\. We can also obtain an equivalence map \\e' : src m \ src w\\ and \\'\ such that \\\' : src w \ e' \ m\\. If \\'\ can be taken to be an isomorphism; then we have \e' \ src w \ e' \ m\. Since \e'\ is an equivalence, this shows \m\ is an equivalence, hence its right adjoint \m\<^sup>*\ is also an equivalence and therefore a map. But \w = n \ m\<^sub>a\, so this shows that \w\ is a map. Now, we may assume without loss of generality that \e\ and \e'\ are part of an adjoint equivalence. We have \\\ : m \ e \ src w\\ and \\\' : src w \ e' \ m\\. We may take the transpose of \\\ to obtain \\\ : m \ src w \ e'\\; then \\\' \ \ : m \ m\\ and \\\ \ \' : src w \ e' \ src w \ e'\\. Since \m\ and \src w \ e'\ are maps, by \BS3\ it must be that \\\ and \\'\ are inverses. \ text \ {\bf Note:} CKS don't cite \BS3\ here. I am not sure whether this result can be proved without \BS3\. For example, I am interested in knowing whether it can still be proved under the the assumption that 2-cells between maps are unique, but not necessarily invertible, or maybe even in a more general situation. It looks like the invertibility part of \BS3\ is not used in the proof below. \ have 2: "\e e' \ \ \ \ \' \'. equivalence_in_bicategory (\) (\) \ \ src trg e e' \ \ \ \\' : src w \ e' \ m\ \ \\ : g \ n \ (g \ w) \ e'\ \ iso \ \ \ = \.composite_cell e' \' \ \ \ \\ : m \ e \ src w\ \ \\' : g \ w \ (g \ n) \ e\ \ iso \' \ \ = ((g \ w) \ \) \ \[g \ w, m, e] \ (\ \ e) \ \'" using \ \.apex_unique_up_to_equivalence [of \ "src w" "g \ w"] comp_assoc by metis obtain e e' \ \ \ \ \' \' where *: "equivalence_in_bicategory (\) (\) \ \ src trg e e' \ \ \ \\' : src w \ e' \ m\ \ \\ : g \ n \ (g \ w) \ e'\ \ iso \ \ \ = \.composite_cell e' \' \ \ \ \\ : m \ e \ src w\ \ \\' : g \ w \ (g \ n) \ e\ \ iso \' \ \ = \.composite_cell e \ \ \'" using 2 comp_assoc by auto interpret ee': equivalence_in_bicategory \(\)\ \(\)\ \ \ src trg e e' \ \ using * by simp have equiv_e: "equivalence_map e" using ee'.equivalence_in_bicategory_axioms equivalence_map_def by auto obtain \' where \': "adjoint_equivalence_in_bicategory (\) (\) \ \ src trg e e' \ \'" using equivalence_refines_to_adjoint_equivalence [of e e' \] ee'.unit_in_hom(2) ee'.unit_is_iso ee'.antipar equiv_e by auto interpret ee': adjoint_equivalence_in_bicategory \(\)\ \(\)\ \ \ src trg e e' \ \' using \' by simp interpret e'e: adjoint_equivalence_in_bicategory \(\)\ \(\)\ \ \ src trg e' e \inv \'\ \inv \\ using * ee'.dual_adjoint_equivalence by simp have equiv_e': "equivalence_map e'" using e'e.equivalence_in_bicategory_axioms equivalence_map_def by auto have "hseq m e" using * ide_dom [of \] - apply (elim conjE in_homE) by simp + by (elim conjE in_homE) simp have "hseq (src w) e'" using * ide_dom [of \'] - apply (elim conjE in_homE) by simp + by (elim conjE in_homE) simp have "e'e.trnr\<^sub>\ m \ \ hom m (src w \ e')" proof - have "src m = trg e" using \hseq m e\ by auto moreover have "src (src w) = trg e'" using \hseq (src w) e'\ by auto moreover have "ide m" using mn left_adjoint_is_ide by simp moreover have "ide (src w)" using assms by simp ultimately show ?thesis using * e'e.adjoint_transpose_right(1) by blast qed hence 3: "\e'e.trnr\<^sub>\ m \ : m \ src w \ e'\" by simp hence "\\' \ e'e.trnr\<^sub>\ m \ : m \ m\ \ \e'e.trnr\<^sub>\ m \ \ \' : src w \ e' \ src w \ e'\" using * by auto moreover have "\m : m \ m\ \ \src w \ e' : src w \ e' \ src w \ e'\" using mn 3 ide_cod [of "e'e.trnr\<^sub>\ m \"] left_adjoint_is_ide by fastforce moreover have 4: "is_left_adjoint (src w \ e')" proof - have "is_left_adjoint (src w)" using assms obj_is_self_adjoint by simp moreover have "is_left_adjoint e'" using e'e.adjunction_in_bicategory_axioms adjoint_pair_def by auto ultimately show ?thesis using left_adjoints_compose \hseq (src w) e'\ by auto qed ultimately have "\' \ e'e.trnr\<^sub>\ m \ = m \ e'e.trnr\<^sub>\ m \ \ \' = src w \ e'" using mn BS3 [of m m "\' \ e'e.trnr\<^sub>\ m \" m] BS3 [of "src w \ e'" "src w \ e'" "e'e.trnr\<^sub>\ m \ \ \'" "src w \ e'"] by auto hence "inverse_arrows \' (e'e.trnr\<^sub>\ m \)" using mn 4 left_adjoint_is_ide inverse_arrows_def by simp hence 5: "iso \'" by auto have "equivalence_map (src w \ e')" using assms obj_is_equivalence_map equiv_e' \hseq (src w) e'\ equivalence_maps_compose by auto hence "equivalence_map m" using * 5 equivalence_map_preserved_by_iso isomorphic_def by auto hence "equivalence_map m\<^sup>*" using mn m\<^sub>a right_adjoint_to_equivalence_is_equivalence by simp hence "is_left_adjoint m\<^sup>*" using equivalence_is_left_adjoint by simp moreover have "hseq n m\<^sup>*" using mn isomorphic_implies_ide by auto ultimately have "is_left_adjoint (n \ m\<^sup>*)" using mn left_adjoints_compose by blast thus ?thesis using mn left_adjoint_preserved_by_iso isomorphic_def isomorphic_symmetric by metis qed end subsection "Choosing Tabulations" context bicategory_of_spans begin notation isomorphic (infix "\" 50) notation iso_class ("\_\") text \ We will ultimately need to have chosen a specific tabulation for each 1-cell. This has to be done carefully, to avoid unnecessary choices. We start out by using \BS1\ to choose a specific factorization of the form \r \ tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*\ for each 1-cell \r\. This has to be done in such a way that all elements of an isomorphism class are assigned the same factorization. \ abbreviation isomorphic_rep where "isomorphic_rep r f g \ is_left_adjoint f \ is_left_adjoint g \ g \ f\<^sup>* \ r" definition tab\<^sub>0 where "tab\<^sub>0 r \ SOME f. \g. isomorphic_rep (iso_class_rep \r\) f g" definition tab\<^sub>1 where "tab\<^sub>1 r \ SOME g. isomorphic_rep (iso_class_rep \r\) (tab\<^sub>0 r) g" definition rep where "rep r \ SOME \. \\ : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\ \ iso \" lemma rep_props: assumes "ide r" shows "\rep r : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\" and "iso (rep r)" and "r \ iso_class_rep \r\" and "isomorphic_rep r (tab\<^sub>0 r) (tab\<^sub>1 r)" and "tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r" proof - have 1: "isomorphic_rep r (tab\<^sub>0 r) (tab\<^sub>1 r)" proof - have "\f g. isomorphic_rep (iso_class_rep \r\) f g" using assms BS1 isomorphic_symmetric rep_iso_class isomorphic_transitive by blast hence "isomorphic_rep (iso_class_rep \r\) (tab\<^sub>0 r) (tab\<^sub>1 r)" using assms tab\<^sub>0_def tab\<^sub>1_def someI_ex [of "\f. \g. isomorphic_rep (iso_class_rep \r\) f g"] someI_ex [of "\g. isomorphic_rep (iso_class_rep \r\) (tab\<^sub>0 r) g"] by simp thus ?thesis using assms isomorphic_symmetric isomorphic_transitive rep_iso_class by blast qed hence "\\. \\ : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\ \ iso \" using isomorphic_def by blast hence 2: "\rep r : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\ \ iso (rep r)" using someI_ex [of "\\. \\ : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\ \ iso \"] rep_def by auto show "\rep r : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\" using 2 by simp show "iso (rep r)" using 2 by simp show "r \ iso_class_rep \r\" using assms rep_iso_class isomorphic_symmetric by simp thus "isomorphic_rep r (tab\<^sub>0 r) (tab\<^sub>1 r)" using 1 isomorphic_transitive by blast thus "tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r" by simp qed lemma tab\<^sub>0_in_hom [intro]: assumes "ide r" shows "\tab\<^sub>0 r : src (tab\<^sub>0 r) \ src r\" and "\tab\<^sub>0 r : tab\<^sub>0 r \ tab\<^sub>0 r\" proof - show "\tab\<^sub>0 r : tab\<^sub>0 r \ tab\<^sub>0 r\" using assms rep_props left_adjoint_is_ide by auto have "trg (tab\<^sub>0 r) = src r" using assms rep_props by (metis ideD(1) isomorphic_implies_hpar(1) isomorphic_implies_hpar(3) right_adjoint_simps(2) src_hcomp) thus "\tab\<^sub>0 r : src (tab\<^sub>0 r) \ src r\" using assms rep_props left_adjoint_is_ide by (intro in_hhomI, auto) qed lemma tab\<^sub>0_simps [simp]: assumes "ide r" shows "ide (tab\<^sub>0 r)" and "is_left_adjoint (tab\<^sub>0 r)" and "trg (tab\<^sub>0 r) = src r" and "dom (tab\<^sub>0 r) = tab\<^sub>0 r" and "cod (tab\<^sub>0 r) = tab\<^sub>0 r" using assms tab\<^sub>0_in_hom rep_props ide_dom left_adjoint_is_ide by auto lemma tab\<^sub>1_in_hom [intro]: assumes "ide r" shows "\tab\<^sub>1 r : src (tab\<^sub>0 r) \ trg r\" and "\tab\<^sub>1 r : tab\<^sub>1 r \ tab\<^sub>1 r\" proof - show "\tab\<^sub>1 r : tab\<^sub>1 r \ tab\<^sub>1 r\" using assms rep_props left_adjoint_is_ide by auto have "trg (tab\<^sub>1 r) = trg r" using assms rep_props by (metis ideD(1) isomorphic_implies_hpar(1) isomorphic_implies_hpar(4) trg_hcomp) moreover have "src (tab\<^sub>0 r) = src (tab\<^sub>1 r)" using assms rep_props by fastforce ultimately show "\tab\<^sub>1 r : src (tab\<^sub>0 r) \ trg r\" using assms rep_props left_adjoint_is_ide by (intro in_hhomI, auto) qed lemma tab\<^sub>1_simps [simp]: assumes "ide r" shows "ide (tab\<^sub>1 r)" and "is_left_adjoint (tab\<^sub>1 r)" and "src (tab\<^sub>1 r) = src (tab\<^sub>0 r)" and "trg (tab\<^sub>1 r) = trg r" and "dom (tab\<^sub>1 r) = tab\<^sub>1 r" and "cod (tab\<^sub>1 r) = tab\<^sub>1 r" using assms tab\<^sub>1_in_hom rep_props ide_dom left_adjoint_is_ide by auto lemma rep_in_hom [intro]: assumes "ide r" shows "\rep r : src r \ trg r\" and "\rep r : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\" proof - show "\rep r : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\" using assms rep_props by auto thus "\rep r : src r \ trg r\" using arrI vconn_implies_hpar(1-4) by force qed lemma rep_simps [simp]: assumes "ide r" shows "arr (rep r)" and "src (rep r) = src r" and "trg (rep r) = trg r" and "dom (rep r) = tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*" and "cod (rep r) = r" using assms rep_in_hom by auto lemma iso_rep: assumes "ide r" shows "iso (rep r)" using assms rep_props by simp end text \ Next, we assign a specific tabulation to each 1-cell r. We can't just do this any old way if we ultimately expect to obtain a mapping that is functorial with respect to vertical composition. What we have to do is to assign the representative \tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*\ its canonical tabulation, obtained as the adjoint transpose of the identity, and then translate this to a tabulation of \r\ via the chosen isomorphism \\rep r : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ r\\. \ locale identity_in_bicategory_of_spans = bicategory_of_spans + fixes r :: 'a assumes is_ide: "ide r" begin interpretation tab\<^sub>0: map_in_bicategory V H \ \ src trg \tab\<^sub>0 r\ using is_ide rep_props by unfold_locales auto interpretation tab\<^sub>1: map_in_bicategory V H \ \ src trg \tab\<^sub>1 r\ using is_ide rep_props by unfold_locales auto text \ A tabulation \(tab\<^sub>0 r, tab, tab\<^sub>1 r)\ of \r\ can be obtained as the adjoint transpose of the isomorphism \\rep r : (tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>* \ r\\. It is essential to define it this way if we expect the mapping from 2-cells of the underlying bicategory to arrows of spans to preserve vertical composition. \ definition tab where "tab \ tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) (rep r)" text \ In view of \BS2'\, the 1-cell \(tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*\ has the canonical tabulation obtained via adjoint transpose of an identity. In fact, this tabulation generates the chosen tabulation of \r\ in the same isomorphism class by translation along the isomorphism \\rep r : (tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>* \ r\\. This fact is used to show that the mapping from 2-cells to arrows of spans preserves identities. \ lemma canonical_tabulation: shows "tabulation V H \ \ src trg ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*) (tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)) (tab\<^sub>0 r) (tab\<^sub>1 r)" proof - have "\\. tabulation V H \ \ src trg ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*) \ (tab\<^sub>0 r) (tab\<^sub>1 r)" by (simp add: bicategory_of_spans.BS2' bicategory_of_spans_axioms is_ide isomorphic_reflexive) thus ?thesis using is_ide tab\<^sub>0.canonical_tabulation by simp qed lemma tab_def_alt: shows "tab = (rep r \ tab\<^sub>0 r) \ tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)" and "(inv (rep r) \ tab\<^sub>0 r) \ tab = tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)" proof - have "tab = tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) (rep r \ ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*))" using tab_def is_ide rep_in_hom [of r] comp_arr_dom by auto also have "... = (rep r \ tab\<^sub>0 r) \ tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)" using is_ide tab\<^sub>0.trnr\<^sub>\_comp by auto finally show 1: "tab = (rep r \ tab\<^sub>0 r) \ tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)" by simp have "(inv (rep r) \ tab\<^sub>0 r) \ tab = ((inv (rep r) \ tab\<^sub>0 r) \ (rep r \ tab\<^sub>0 r)) \ tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)" unfolding 1 using comp_assoc by presburger also have "... = tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)" proof - have 1: "(inv (rep r) \ tab\<^sub>0 r) \ (rep r \ tab\<^sub>0 r) = ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*) \ tab\<^sub>0 r" using whisker_right [of "tab\<^sub>0 r" "inv (rep r)" "rep r"] iso_rep rep_in_hom inv_is_inverse comp_inv_arr by (simp add: comp_inv_arr' is_ide) show ?thesis proof - have "\tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*) : tab\<^sub>1 r \ (tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*) \ tab\<^sub>0 r\" by (meson canonical_tabulation tabulation_data.tab_in_hom(2) tabulation_def) hence "((tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*) \ tab\<^sub>0 r) \ tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*) = tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)" using 1 comp_cod_arr by blast thus ?thesis using 1 by simp qed qed finally show "(inv (rep r) \ tab\<^sub>0 r) \ tab = tab\<^sub>0.trnr\<^sub>\ (tab\<^sub>1 r) ((tab\<^sub>1 r) \ (tab\<^sub>0 r)\<^sup>*)" by blast qed lemma tab_is_tabulation: shows "tabulation V H \ \ src trg r tab (tab\<^sub>0 r) (tab\<^sub>1 r)" by (metis bicategory_of_spans.iso_rep bicategory_of_spans.rep_in_hom(2) bicategory_of_spans_axioms is_ide canonical_tabulation tab_def_alt(1) tabulation.is_preserved_by_base_iso) (* * TODO: If I pull the interpretation "tab" out of the following, Isabelle warns that * the lemma is a redundant introduction rule and is being "ignored" for that purpose. * However, the redundancy is only in the present context: if the enclosing locale is * interpreted elsewhere, then the rule is not redundant. In order to make sure that * the rule is not "ignored", I have put the interpretation "tab" into the proof to * avoid the warning. *) lemma tab_in_hom [intro]: shows "\tab : src (tab\<^sub>0 r) \ trg r\" and "\tab : tab\<^sub>1 r \ r \ tab\<^sub>0 r\" proof - interpret tab: tabulation V H \ \ src trg r tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ using tab_is_tabulation by simp show "\tab : src (tab\<^sub>0 r) \ trg r\" using tab.tab_in_hom by auto show "\tab : tab\<^sub>1 r \ r \ tab\<^sub>0 r\" using tab.tab_in_hom by auto qed lemma tab_simps [simp]: shows "arr tab" and "src tab = src (tab\<^sub>0 r)" and "trg tab = trg r" and "dom tab = tab\<^sub>1 r" and "cod tab = r \ tab\<^sub>0 r" using tab_in_hom by auto end text \ The following makes the chosen tabulation conveniently available whenever we are considering a particular 1-cell. \ sublocale identity_in_bicategory_of_spans \ tabulation V H \ \ src trg r tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ using is_ide tab_is_tabulation by simp context identity_in_bicategory_of_spans begin interpretation tab\<^sub>0: map_in_bicategory V H \ \ src trg \tab\<^sub>0 r\ using is_ide rep_props by unfold_locales auto interpretation tab\<^sub>1: map_in_bicategory V H \ \ src trg \tab\<^sub>1 r\ using is_ide rep_props by unfold_locales auto text \ The fact that adjoint transpose is a bijection allows us to invert the definition of \tab\ in terms of \rep\ to express rep in terms of tab. \ lemma rep_in_terms_of_tab: shows "rep r = T0.trnr\<^sub>\ r tab" using is_ide T0.adjoint_transpose_right(3) [of r "tab\<^sub>1 r" "rep r"] tab_def by fastforce lemma isomorphic_implies_same_tab: assumes "isomorphic r r'" shows "tab\<^sub>0 r = tab\<^sub>0 r'" and "tab\<^sub>1 r = tab\<^sub>1 r'" using assms tab\<^sub>0_def tab\<^sub>1_def iso_class_eqI by auto text \ ``Every 1-cell has a tabulation as a span of maps.'' Has a nice simple ring to it, but maybe not so useful for us, since we generally really need to know that the tabulation has a specific form. \ lemma has_tabulation: shows "\\ f g. is_left_adjoint f \ is_left_adjoint g \ tabulation V H \ \ src trg r \ f g" using is_ide tab_is_tabulation rep_props by blast end subsection "Tabulations in a Bicategory of Spans" context bicategory_of_spans begin abbreviation tab_of_ide where "tab_of_ide r \ identity_in_bicategory_of_spans.tab V H \ \ src trg r" abbreviation prj\<^sub>0 where "prj\<^sub>0 h k \ tab\<^sub>0 (k\<^sup>* \ h)" abbreviation prj\<^sub>1 where "prj\<^sub>1 h k \ tab\<^sub>1 (k\<^sup>* \ h)" lemma prj_in_hom [intro]: assumes "ide h" and "is_left_adjoint k" and "trg h = trg k" shows "\prj\<^sub>0 h k : src (prj\<^sub>0 h k) \ src h\" and "\prj\<^sub>1 h k : src (prj\<^sub>0 h k) \ src k\" and "\prj\<^sub>0 h k : prj\<^sub>0 h k \ prj\<^sub>0 h k\" and "\prj\<^sub>1 h k : prj\<^sub>1 h k \ prj\<^sub>1 h k\" by (intro in_hhomI, auto simp add: assms(1-3)) lemma prj_simps [simp]: assumes "ide h" and "is_left_adjoint k" and "trg h = trg k" shows "trg (prj\<^sub>0 h k) = src h" and "src (prj\<^sub>1 h k) = src (prj\<^sub>0 h k)" and "trg (prj\<^sub>1 h k) = src k" and "dom (prj\<^sub>0 h k) = prj\<^sub>0 h k" and "cod (prj\<^sub>0 h k) = prj\<^sub>0 h k" and "dom (prj\<^sub>1 h k) = prj\<^sub>1 h k" and "cod (prj\<^sub>1 h k) = prj\<^sub>1 h k" and "is_left_adjoint (prj\<^sub>0 h k)" and "is_left_adjoint (prj\<^sub>1 h k)" using assms prj_in_hom by auto end text \ Many of the commutativity conditions that we would otherwise have to worry about when working with tabulations in a bicategory of spans reduce to trivialities. The following locales try to exploit this to make our life more manageable. \ locale span_of_maps = bicategory_of_spans + fixes leg\<^sub>0 :: 'a and leg\<^sub>1 :: 'a assumes leg0_is_map: "is_left_adjoint leg\<^sub>0" and leg1_is_map : "is_left_adjoint leg\<^sub>1" text \ The purpose of the somewhat strange-looking assumptions in this locale is to cater to the form of data that we obtain from \T1\. Under the assumption that we are in a bicategory of spans and that the legs of \r\ and \s\ are maps, the hypothesized 2-cells will be uniquely determined isomorphisms, and an arrow of spans \w\ from \r\ to \s\ will be a map. We want to prove this once and for all under the weakest assumptions we can manage. \ locale arrow_of_spans_of_maps = bicategory_of_spans V H \ \ src trg + r: span_of_maps V H \ \ src trg r\<^sub>0 r\<^sub>1 + s: span_of_maps V H \ \ src trg s\<^sub>0 s\<^sub>1 for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and r\<^sub>0 :: 'a and r\<^sub>1 :: 'a and s\<^sub>0 :: 'a and s\<^sub>1 :: 'a and w :: 'a + assumes is_ide: "ide w" and leg0_lax: "\\. \\ : s\<^sub>0 \ w \ r\<^sub>0\" and leg1_iso: "\\. \\ : r\<^sub>1 \ s\<^sub>1 \ w\ \ iso \" begin notation isomorphic (infix "\" 50) lemma composite_leg1_is_map: shows "is_left_adjoint (s\<^sub>1 \ w)" using r.leg1_is_map leg1_iso left_adjoint_preserved_by_iso' isomorphic_def isomorphic_symmetric by auto lemma is_map: shows "is_left_adjoint w" using is_ide composite_leg1_is_map s.leg1_is_map BS4 [of s\<^sub>1 w] by auto lemma hseq_leg\<^sub>0: shows "hseq s\<^sub>0 w" by (metis ideD(1) ide_dom in_homE leg0_lax) lemma composite_with_leg0_is_map: shows "is_left_adjoint (s\<^sub>0 \ w)" using left_adjoints_compose is_map s.leg0_is_map hseq_leg\<^sub>0 by blast lemma leg0_uniquely_isomorphic: shows "s\<^sub>0 \ w \ r\<^sub>0" and "\!\. \\ : s\<^sub>0 \ w \ r\<^sub>0\" proof - show 1: "s\<^sub>0 \ w \ r\<^sub>0" using leg0_lax composite_with_leg0_is_map r.leg0_is_map BS3 [of "s\<^sub>0 \ w" r\<^sub>0] isomorphic_def by auto have "\\. \\ : s\<^sub>0 \ w \ r\<^sub>0\ \ iso \" using 1 isomorphic_def by simp moreover have "\\ \'. \\ : s\<^sub>0 \ w \ r\<^sub>0\ \ \\' : s\<^sub>0 \ w \ r\<^sub>0\ \ \ = \'" using BS3 r.leg0_is_map composite_with_leg0_is_map by blast ultimately show "\!\. \\ : s\<^sub>0 \ w \ r\<^sub>0\" by blast qed lemma leg1_uniquely_isomorphic: shows "r\<^sub>1 \ s\<^sub>1 \ w" and "\!\. \\ : r\<^sub>1 \ s\<^sub>1 \ w\" proof - show 1: "r\<^sub>1 \ s\<^sub>1 \ w" using leg1_iso isomorphic_def by auto have "\\. \\ : r\<^sub>1 \ s\<^sub>1 \ w\ \ iso \" using leg1_iso isomorphic_def isomorphic_symmetric by simp moreover have "\\ \'. \\ : r\<^sub>1 \ s\<^sub>1 \ w\ \ \\' : r\<^sub>1 \ s\<^sub>1 \ w\ \ \ = \'" using BS3 r.leg1_is_map composite_leg1_is_map by blast ultimately show "\!\. \\ : r\<^sub>1 \ s\<^sub>1 \ w\" by blast qed definition the_\ where "the_\ \ THE \. \\ : s\<^sub>0 \ w \ r\<^sub>0\" definition the_\ where "the_\ \ THE \. \\ : r\<^sub>1 \ s\<^sub>1 \ w\" lemma the_\_props: shows "\the_\ : s\<^sub>0 \ w \ r\<^sub>0\" and "iso the_\" proof - show "\the_\ : s\<^sub>0 \ w \ r\<^sub>0\" unfolding the_\_def using the1I2 [of "\\. \\ : s\<^sub>0 \ w \ r\<^sub>0\" "\\. \\ : s\<^sub>0 \ w \ r\<^sub>0\"] leg0_uniquely_isomorphic by simp thus "iso the_\" using BS3 r.leg0_is_map composite_with_leg0_is_map by simp qed lemma the_\_in_hom [intro]: shows "\the_\ : src r\<^sub>0 \ trg r\<^sub>0\" and "\the_\ : s\<^sub>0 \ w \ r\<^sub>0\" using the_\_props apply auto by (metis cod_trg in_hhom_def in_homE isomorphic_implies_hpar(3) leg0_uniquely_isomorphic(1) src_dom trg.preserves_cod) lemma the_\_simps [simp]: shows "arr the_\" and "src the_\ = src r\<^sub>0" and "trg the_\ = trg r\<^sub>0" and "dom the_\ = s\<^sub>0 \ w" and "cod the_\ = r\<^sub>0" using the_\_in_hom by auto lemma the_\_props: shows "\the_\ : r\<^sub>1 \ s\<^sub>1 \ w\" and "iso the_\" proof - show "\the_\ : r\<^sub>1 \ s\<^sub>1 \ w\" unfolding the_\_def using the1I2 [of "\\. \\ : r\<^sub>1 \ s\<^sub>1 \ w\" "\\. \\ : r\<^sub>1 \ s\<^sub>1 \ w\"] leg1_uniquely_isomorphic by simp thus "iso the_\" using BS3 r.leg1_is_map composite_leg1_is_map by simp qed lemma the_\_in_hom [intro]: shows "\the_\ : src r\<^sub>1 \ trg r\<^sub>1\" and "\the_\ : r\<^sub>1 \ s\<^sub>1 \ w\" using the_\_props apply auto by (metis in_hhom_def in_homE isomorphic_implies_hpar(3) leg1_uniquely_isomorphic(1) src_cod trg_dom) lemma the_\_simps [simp]: shows "arr the_\" and "src the_\ = src r\<^sub>1" and "trg the_\ = trg r\<^sub>1" and "dom the_\ = r\<^sub>1" and "cod the_\ = s\<^sub>1 \ w" using the_\_in_hom by auto end (* * TODO: I could probably avoid repeating the declarations of the locale parameters * if I was willing to accept them being given in their order of appearance. *) locale arrow_of_spans_of_maps_to_tabulation_data = bicategory_of_spans V H \ \ src trg + arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 r\<^sub>1 s\<^sub>0 s\<^sub>1 w + \: tabulation_data V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and r\<^sub>0 :: 'a and r\<^sub>1 :: 'a and s :: 'a and \ :: 'a and s\<^sub>0 :: 'a and s\<^sub>1 :: 'a and w :: 'a text \ The following declaration allows us to inherit the rules and other facts defined in locale @{locale uw\}. It is tedious to prove very much without these in place. \ sublocale arrow_of_spans_of_maps_to_tabulation_data \ uw\ V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 r\<^sub>0 w the_\ using \.tab_in_hom is_ide the_\_props by unfold_locales auto locale arrow_of_spans_of_maps_to_tabulation = arrow_of_spans_of_maps_to_tabulation_data + tabulation V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 locale tabulation_in_maps = span_of_maps V H \ \ src trg s\<^sub>0 s\<^sub>1 + tabulation V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and s :: 'a and \ :: 'a and s\<^sub>0 :: 'a and s\<^sub>1 :: 'a sublocale tabulation_in_maps \ tabulation V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 .. sublocale identity_in_bicategory_of_spans \ tabulation_in_maps V H \ \ src trg r tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ using is_ide rep_props by unfold_locales auto locale cospan_of_maps_in_bicategory_of_spans = bicategory_of_spans + fixes h :: 'a and k :: 'a assumes h_is_map: "is_left_adjoint h" and k_is_map: "is_left_adjoint k" and cospan: "trg h = trg k" begin text \ The following sublocale declaration is perhaps pushing the limits of sensibility, but the purpose is, given a cospan of maps \(h, k)\, to obtain ready access to the composite \k\<^sup>* \ h\ and its chosen tabulation. \ sublocale identity_in_bicategory_of_spans V H \ \ src trg \k\<^sup>* \ h\ using h_is_map k_is_map cospan left_adjoint_is_ide by unfold_locales auto notation isomorphic (infix "\" 50) interpretation E: self_evaluation_map V H \ \ src trg .. notation E.eval ("\_\") interpretation h: map_in_bicategory V H \ \ src trg h using h_is_map by unfold_locales auto interpretation k: map_in_bicategory V H \ \ src trg k using k_is_map by unfold_locales auto text \ Our goal here is to reformulate the biuniversal properties of the chosen tabulation of \k\<^sup>* \ h\ in terms of its transpose, which yields a 2-cell from \k \ tab\<^sub>1 (k\<^sup>* \ h)\ to \h \ tab\<^sub>0 (k\<^sup>* \ h)\. These results do not depend on \BS3\. \ abbreviation p\<^sub>0 where "p\<^sub>0 \ prj\<^sub>0 h k" abbreviation p\<^sub>1 where "p\<^sub>1 \ prj\<^sub>1 h k" lemma p\<^sub>0_in_hom [intro]: shows "\p\<^sub>0 : src p\<^sub>0 \ src h\" by auto lemma p\<^sub>1_in_hom [intro]: shows "\p\<^sub>1 : src p\<^sub>0 \ src k\" using prj_in_hom cospan h.ide_left k_is_map by blast lemma p\<^sub>0_simps [simp]: shows "trg p\<^sub>0 = src h" by simp lemma p\<^sub>1_simps [simp]: shows "trg p\<^sub>1 = src k" using k.antipar(1) by auto definition \ where "\ \ k.trnl\<^sub>\ (h \ p\<^sub>0) (\[k\<^sup>*, h, p\<^sub>0] \ tab)" lemma \_in_hom [intro]: shows "\\ : src p\<^sub>0 \ trg h\" and "\\ : k \ p\<^sub>1 \ h \ p\<^sub>0\" proof - show 1: "\\ : k \ p\<^sub>1 \ h \ p\<^sub>0\" unfolding \_def using k.antipar cospan k.adjoint_transpose_left(2) [of "h \ p\<^sub>0" "p\<^sub>1"] by fastforce show "\\ : src p\<^sub>0 \ trg h\" using 1 k.antipar arrI cospan vconn_implies_hpar(1-2) by force qed lemma \_simps [simp]: shows "arr \" and "src \ = src p\<^sub>0" and "trg \ = trg h" and "dom \ = k \ p\<^sub>1" and "cod \ = h \ p\<^sub>0" using \_in_hom by auto lemma transpose_\: shows "tab = \\<^sup>-\<^sup>1[k\<^sup>*, h, p\<^sub>0] \ k.trnl\<^sub>\ p\<^sub>1 \" proof - have "\\<^sup>-\<^sup>1[k\<^sup>*, h, p\<^sub>0] \ k.trnl\<^sub>\ p\<^sub>1 \ = \\<^sup>-\<^sup>1[k\<^sup>*, h, p\<^sub>0] \ \[k\<^sup>*, h, p\<^sub>0] \ tab" unfolding \_def using k.antipar cospan k.adjoint_transpose_left(4) [of "h \ p\<^sub>0" "p\<^sub>1" "\[k\<^sup>*, h, p\<^sub>0] \ tab"] by fastforce also have "... = (\\<^sup>-\<^sup>1[k\<^sup>*, h, p\<^sub>0] \ \[k\<^sup>*, h, p\<^sub>0]) \ tab" using comp_assoc by presburger also have "... = tab" using k.antipar cospan comp_cod_arr comp_assoc_assoc' by simp finally show ?thesis by simp qed lemma transpose_triangle: assumes "ide w" and "\\ : p\<^sub>0 \ w \ u\" and "\\ : v \ p\<^sub>1 \ w\" shows "k.trnl\<^sub>\ (h \ u) (\[k\<^sup>*, h, u] \ ((k\<^sup>* \ h) \ \) \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w) \ \) = (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] \ (k \ \)" proof - have u: "ide u" using assms(2) by auto have v: "ide v" using assms(3) by auto have 0: "src p\<^sub>0 = trg w" by (metis assms(2) hseqE ideD(1) src.preserves_reflects_arr u vconn_implies_hpar(3)) have 1: "src h = trg u" using assms(1-2) 0 trg_dom trg_cod vconn_implies_hpar(4) by auto have 2: "src k = trg v" using assms(1,3) 0 trg_dom trg_cod hseqI' by (metis ideD(1) leg1_simps(2) leg1_simps(3) p\<^sub>1_simps trg_hcomp vconn_implies_hpar(4)) have 3: "src u = src v \ src u = src w" using assms 0 k.antipar src_dom src_cod hseqI' by (metis ideD(1) leg0_simps(2) leg1_simps(2) leg1_simps(3) src_hcomp vconn_implies_hpar(3)) have 4: "src h = trg \" using assms 1 k.antipar by auto define \ where "\ = \[k\<^sup>*, h, p\<^sub>0 \ w] \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w)" have \: "\\ : p\<^sub>1 \ w \ k\<^sup>* \ h \ p\<^sub>0 \ w\" unfolding \_def using assms 0 k.antipar cospan by (intro comp_in_homI, auto) have "k.trnl\<^sub>\ (h \ u) (\[k\<^sup>*, h, u] \ ((k\<^sup>* \ h) \ \) \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w) \ \) = k.trnl\<^sub>\ (h \ u) ((k\<^sup>* \ h \ \) \ \ \ \)" unfolding \_def using assms 1 k.antipar cospan assoc_naturality [of "k\<^sup>*" h \] comp_assoc by (metis "4" h.ide_left ide_char in_homE k.ide_right) also have "... = k.trnl\<^sub>\ (h \ u) (k\<^sup>* \ h \ \) \ (k \ \ \ \)" proof - have "ide (h \ u)" using "1" u assms h.ide_left by blast moreover have "seq (k\<^sup>* \ h \ \) (\ \ \)" using assms 1 k.antipar cospan \ seqI' apply (intro seqI) apply auto apply blast proof - have "dom (k\<^sup>* \ h \ \) = k\<^sup>* \ h \ p\<^sub>0 \ w" using assms by (metis "4" cospan hcomp_simps(2-3) h.ide_left hseqI' ide_char in_homE k.antipar(2) k.ide_right) also have "... = cod \" using \ by auto finally show "dom (k\<^sup>* \ h \ \) = cod \" by simp qed moreover have "src k = trg (k\<^sup>* \ h \ \)" using assms k.antipar cospan calculation(2) by auto ultimately show ?thesis using k.trnl\<^sub>\_comp by simp qed also have "... = k.trnl\<^sub>\ (h \ u) (k\<^sup>* \ h \ \) \ (k \ \) \ (k \ \)" using assms u \ whisker_left by (metis k.ide_left seqI') also have "... = (\[h \ u] \ (k.\ \ h \ u) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ u] \ (k \ k\<^sup>* \ h \ \)) \ (k \ \) \ (k \ \)" unfolding k.trnl\<^sub>\_def by simp also have "... = (h \ \) \ (\[h \ p\<^sub>0 \ w] \ (k.\ \ h \ p\<^sub>0 \ w) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \)) \ (k \ \)" proof - have "\[h \ u] \ (k.\ \ h \ u) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ u] \ (k \ k\<^sup>* \ h \ \) = \[h \ u] \ (k.\ \ h \ u) \ ((k \ k\<^sup>*) \ h \ \) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w]" using assms 4 k.antipar cospan assoc'_naturality [of k "k\<^sup>*" "h \ \"] by fastforce also have "... = \[h \ u] \ ((k.\ \ h \ u) \ ((k \ k\<^sup>*) \ h \ \)) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w]" using comp_assoc by presburger also have "... = (\[h \ u] \ (trg k \ h \ \)) \ (k.\ \ h \ p\<^sub>0 \ w) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w]" proof - have "(k.\ \ h \ u) \ ((k \ k\<^sup>*) \ h \ \) = k.\ \ (k \ k\<^sup>*) \ (h \ u) \ (h \ \)" using assms 1 k.antipar cospan interchange comp_arr_dom comp_cod_arr by fastforce also have "... = k.\ \ h \ \" using assms k.antipar cospan comp_arr_dom comp_cod_arr k.counit_in_hom whisker_left by (metis h.ide_left in_homE) also have "... = (trg k \ h \ \) \ (k.\ \ h \ p\<^sub>0 \ w)" using assms 4 k.antipar cospan whisker_left comp_arr_dom comp_cod_arr interchange [of "trg k" k.\ "h \ \" "h \ p\<^sub>0 \ w"] by auto finally have "(k.\ \ h \ u) \ ((k \ k\<^sup>*) \ h \ \) = (trg k \ h \ \) \ (k.\ \ h \ p\<^sub>0 \ w)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (h \ \) \ \[h \ p\<^sub>0 \ w] \ (k.\ \ h \ p\<^sub>0 \ w) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w]" proof - have "\[h \ u] \ (trg k \ h \ \) = (h \ \) \ \[h \ p\<^sub>0 \ w]" using assms 1 4 k.antipar cospan lunit_naturality [of "h \ \"] by (metis hcomp_simps(3-4) h.ide_left hseqI' ide_char in_homE trg_hcomp) thus ?thesis using comp_assoc by presburger qed finally have "\[h \ u] \ (k.\ \ h \ u) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ u] \ (k \ k\<^sup>* \ h \ \) = (h \ \) \ \[h \ p\<^sub>0 \ w] \ (k.\ \ h \ p\<^sub>0 \ w) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w]" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] \ (k \ \)" proof - have "\[h \ p\<^sub>0 \ w] \ (k.\ \ h \ p\<^sub>0 \ w) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w] \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w)) = \[h, p\<^sub>0, w] \ \[(h \ p\<^sub>0) \ w] \ (trg h \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ (k.\ \ h \ p\<^sub>0 \ w) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w] \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w))" proof - have "\[h \ p\<^sub>0 \ w] = \[h, p\<^sub>0, w] \ \[(h \ p\<^sub>0) \ w] \ (trg h \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w])" proof - have "\[h, p\<^sub>0, w] \ \[(h \ p\<^sub>0) \ w] \ (trg h \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) = \[h, p\<^sub>0, w] \ \ ((h \ p\<^sub>0) \ w) \ (trg h \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w])" using assms 0 k.antipar cospan comp_cod_arr \_ide_simp by simp also have "... = \[h, p\<^sub>0, w] \ \ (\\<^sup>-\<^sup>1[h, p\<^sub>0, w])" using assms 0 k.antipar cospan \.is_natural_2 [of "\\<^sup>-\<^sup>1[h, p\<^sub>0, w]"] by simp also have "... = \[h, p\<^sub>0, w] \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w] \ \ (h \ p\<^sub>0 \ w)" using assms 0 k.antipar cospan \.is_natural_1 [of "\\<^sup>-\<^sup>1[h, p\<^sub>0, w]"] comp_assoc by simp also have "... = (\[h, p\<^sub>0, w] \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ \ (h \ p\<^sub>0 \ w)" using comp_assoc by presburger also have "... = \ (h \ p\<^sub>0 \ w)" using assms 0 k.antipar cospan comp_cod_arr comp_assoc_assoc' by simp also have "... = \[h \ p\<^sub>0 \ w]" using assms 0 k.antipar cospan \_ide_simp by simp finally show ?thesis by simp qed thus ?thesis using comp_assoc by presburger qed also have "... = \[h, p\<^sub>0, w] \ (\[h \ p\<^sub>0] \ w) \ \\<^sup>-\<^sup>1[trg h, h \ p\<^sub>0, w] \ ((trg h \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ (k.\ \ h \ p\<^sub>0 \ w)) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w] \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w))" using assms 0 k.antipar cospan lunit_hcomp comp_assoc by simp also have "... = \[h, p\<^sub>0, w] \ (\[h \ p\<^sub>0] \ w) \ (\\<^sup>-\<^sup>1[trg h, h \ p\<^sub>0, w] \ (k.\ \ (h \ p\<^sub>0) \ w)) \ ((k \ k\<^sup>*) \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w] \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w))" proof - have "(trg h \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ (k.\ \ h \ p\<^sub>0 \ w) = (k.\ \ (h \ p\<^sub>0) \ w) \ ((k \ k\<^sup>*) \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w])" using assms 0 k.antipar cospan comp_arr_dom comp_cod_arr interchange [of "trg h" k.\ "\\<^sup>-\<^sup>1[h, p\<^sub>0, w]" "h \ p\<^sub>0 \ w"] interchange [of k.\ "k \ k\<^sup>*" "(h \ p\<^sub>0) \ w" "\\<^sup>-\<^sup>1[h, p\<^sub>0, w]"] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \[h, p\<^sub>0, w] \ (\[h \ p\<^sub>0] \ w) \ ((k.\ \ (h \ p\<^sub>0)) \ w) \ \\<^sup>-\<^sup>1[k \ k\<^sup>*, h \ p\<^sub>0, w] \ ((k \ k\<^sup>*) \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w] \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w))" using assms 0 k.antipar cospan assoc'_naturality [of k.\ "h \ p\<^sub>0" w] comp_assoc by simp also have "... = \[h, p\<^sub>0, w] \ (\[h \ p\<^sub>0] \ w) \ ((k.\ \ (h \ p\<^sub>0)) \ w) \ \\<^sup>-\<^sup>1[k \ k\<^sup>*, h \ p\<^sub>0, w] \ ((k \ k\<^sup>*) \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w]) \ (k \ \[k\<^sup>* \ h, p\<^sub>0, w]) \ (k \ tab \ w)" proof - have "k \ \[k\<^sup>*, h, p\<^sub>0 \ w] \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w) = (k \ \[k\<^sup>*, h, p\<^sub>0 \ w]) \ (k \ \[k\<^sup>* \ h, p\<^sub>0, w]) \ (k \ tab \ w)" proof - have "seq \[k\<^sup>*, h, p\<^sub>0 \ w] (\[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w))" using \_def assms 0 k.antipar cospan \ by blast thus ?thesis using assms 0 k.antipar cospan whisker_left by auto qed thus ?thesis using comp_assoc by presburger qed also have "... = \[h, p\<^sub>0, w] \ (\[h \ p\<^sub>0] \ w) \ ((k.\ \ (h \ p\<^sub>0)) \ w) \ (\\<^sup>-\<^sup>1[k \ k\<^sup>*, h \ p\<^sub>0, w] \ ((k \ k\<^sup>*) \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w]) \ (k \ \[k\<^sup>* \ h, p\<^sub>0, w]) \ \[k, (k\<^sup>* \ h) \ p\<^sub>0, w]) \ ((k \ tab) \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" proof - have "k \ tab \ w = \[k, (k\<^sup>* \ h) \ p\<^sub>0, w] \ \\<^sup>-\<^sup>1[k, (k\<^sup>* \ h) \ p\<^sub>0, w] \ (k \ tab \ w)" proof - have "\[k, (k\<^sup>* \ h) \ p\<^sub>0, w] \ \\<^sup>-\<^sup>1[k, (k\<^sup>* \ h) \ p\<^sub>0, w] \ (k \ tab \ w) = (\[k, (k\<^sup>* \ h) \ p\<^sub>0, w] \ \\<^sup>-\<^sup>1[k, (k\<^sup>* \ h) \ p\<^sub>0, w]) \ (k \ tab \ w)" using comp_assoc by presburger also have "... = (k \ ((k\<^sup>* \ h) \ p\<^sub>0) \ w) \ (k \ tab \ w)" using assms k.antipar 0 comp_assoc_assoc' by simp also have "... = k \ tab \ w" using assms k.antipar 0 comp_cod_arr by simp finally show ?thesis by simp qed also have "... = \[k, (k\<^sup>* \ h) \ p\<^sub>0, w] \ ((k \ tab) \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" using assms 0 k.antipar cospan assoc'_naturality [of k tab w] by simp finally have "k \ tab \ w = \[k, (k\<^sup>* \ h) \ p\<^sub>0, w] \ ((k \ tab) \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" by simp thus ?thesis using comp_assoc by presburger qed also have "... = \[h, p\<^sub>0, w] \ (\[h \ p\<^sub>0] \ w) \ ((k.\ \ h \ p\<^sub>0) \ w) \ (\\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0] \ (k \ \[k\<^sup>*, h, p\<^sub>0]) \ w) \ ((k \ tab) \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" proof - have "\\<^sup>-\<^sup>1[k \ k\<^sup>*, h \ p\<^sub>0, w] \ ((k \ k\<^sup>*) \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w]) \ (k \ \[k\<^sup>* \ h, p\<^sub>0, w]) \ \[k, (k\<^sup>* \ h) \ p\<^sub>0, w] = \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0] \ (k \ \[k\<^sup>*, h, p\<^sub>0]) \ w" proof - have "\\<^sup>-\<^sup>1[k \ k\<^sup>*, h \ p\<^sub>0, w] \ ((k \ k\<^sup>*) \ \\<^sup>-\<^sup>1[h, p\<^sub>0, w]) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w]) \ (k \ \[k\<^sup>* \ h, p\<^sub>0, w]) \ \[k, (k\<^sup>* \ h) \ p\<^sub>0, w] = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\k\<^bold>\ \<^bold>\ \<^bold>\k\<^sup>*\<^bold>\, \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>] \<^bold>\ ((\<^bold>\k\<^bold>\ \<^bold>\ \<^bold>\k\<^sup>*\<^bold>\) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\h\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\k\<^bold>\, \<^bold>\k\<^sup>*\<^bold>\, \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\k\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\k\<^sup>*\<^bold>\, \<^bold>\h\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\\<^bold>]) \<^bold>\ (\<^bold>\k\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\k\<^sup>*\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\k\<^bold>\, (\<^bold>\k\<^sup>*\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]\" using assms 0 k.antipar cospan \_def \'_def by simp also have "... = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\k\<^bold>\, \<^bold>\k\<^sup>*\<^bold>\, \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\k\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\k\<^sup>*\<^bold>\, \<^bold>\h\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\w\<^bold>\\" using assms 0 k.antipar cospan by (intro E.eval_eqI, simp_all) also have "... = \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0] \ (k \ \[k\<^sup>*, h, p\<^sub>0]) \ w" using assms 0 k.antipar cospan \_def \'_def by simp finally show ?thesis by simp qed thus ?thesis using comp_assoc by presburger qed also have "... = \[h, p\<^sub>0, w] \ (\[h \ p\<^sub>0] \ (k.\ \ h \ p\<^sub>0) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0] \ (k \ \[k\<^sup>*, h, p\<^sub>0]) \ (k \ tab) \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" using assms 0 k.antipar cospan comp_assoc whisker_right by auto also have "... = \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" unfolding \_def k.trnl\<^sub>\_def using assms 0 k.antipar cospan comp_assoc whisker_left by simp finally have "\[h \ p\<^sub>0 \ w] \ (k.\ \ h \ p\<^sub>0 \ w) \ \\<^sup>-\<^sup>1[k, k\<^sup>*, h \ p\<^sub>0 \ w] \ (k \ \[k\<^sup>*, h, p\<^sub>0 \ w] \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w)) = \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" by blast thus ?thesis using \_def comp_assoc by simp qed finally show ?thesis by simp qed text \ \BS3\ implies that \\\ is the unique 2-cell from \k \ p\<^sub>1\ to \h \ p\<^sub>0\ and is an isomorphism. \ lemma \_uniqueness: shows "\\. \\ : k \ p\<^sub>1 \ h \ p\<^sub>0\ \ \ = \" and "iso \" proof - have 2: "is_left_adjoint (k \ p\<^sub>1)" using k.antipar cospan left_adjoints_compose by (simp add: k_is_map) have 3: "is_left_adjoint (h \ p\<^sub>0)" using k.antipar cospan left_adjoints_compose by (simp add: h_is_map) show "\\. \\ : k \ p\<^sub>1 \ h \ p\<^sub>0\ \ \ = \" using \_in_hom 2 3 BS3 by simp show "iso \" using \_in_hom 2 3 BS3 by simp qed text \ As a consequence, the chosen tabulation of \k\<^sup>* \ h\ is the unique 2-cell from \p\<^sub>1\ to \(k\<^sup>* \ h) \ p\<^sub>0\, and therefore if we are given any such 2-cell we may conclude it yields a tabulation of \k\<^sup>* \ h\. \ lemma tab_uniqueness: assumes "\\ : p\<^sub>1 \ (k\<^sup>* \ h) \ p\<^sub>0\" shows "\ = tab" proof - have "\k.trnl\<^sub>\ (h \ p\<^sub>0) (\[k\<^sup>*, h, p\<^sub>0] \ \) : k \ p\<^sub>1 \ h \ p\<^sub>0\" using assms k.antipar cospan k.adjoint_transpose_left(2) [of "h \ p\<^sub>0" "p\<^sub>1"] assoc_in_hom by force hence "tab = \\<^sup>-\<^sup>1[k\<^sup>*, h, p\<^sub>0] \ k.trnl\<^sub>\ p\<^sub>1 (k.trnl\<^sub>\ (h \ p\<^sub>0) (\[k\<^sup>*, h, p\<^sub>0] \ \))" using transpose_\ \_uniqueness(1) by auto also have "... = \\<^sup>-\<^sup>1[k\<^sup>*, h, p\<^sub>0] \ \[k\<^sup>*, h, p\<^sub>0] \ \" using assms k.antipar cospan k.adjoint_transpose_left(4) assoc_in_hom by auto also have "... = (\\<^sup>-\<^sup>1[k\<^sup>*, h, p\<^sub>0] \ \[k\<^sup>*, h, p\<^sub>0]) \ \" using comp_assoc by presburger also have "... = \" using assms k.antipar cospan comp_cod_arr comp_assoc_assoc' by auto finally show ?thesis by simp qed text \ The following lemma reformulates the biuniversal property of the canonical tabulation of \k\<^sup>* \ h\ as a biuniversal property of \\\, regarded as a square that commutes up to isomorphism. \ lemma \_biuniversal_prop: assumes "ide u" and "ide v" shows "\\. \\ : k \ v \ h \ u\ \ \w \ \. ide w \ \\ : p\<^sub>0 \ w \ u\ \ \\ : v \ p\<^sub>1 \ w\ \ iso \ \ (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] \ (k \ \) = \" and "\w w' \ \' \. \ ide w; ide w'; \\ : p\<^sub>0 \ w \ u\; \\' : p\<^sub>0 \ w' \ u\; \\ : p\<^sub>1 \ w \ p\<^sub>1 \ w'\; (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] = (h \ \') \ \[h, p\<^sub>0, w'] \ (\ \ w') \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w'] \ (k \ \) \ \ \!\. \\ : w \ w'\ \ \ = \' \ (p\<^sub>0 \ \) \ p\<^sub>1 \ \ = \" proof - fix \ assume \: "\\ : k \ v \ h \ u\" have 1: "src h = trg u" using assms \ ide_cod by (metis ide_def in_homE seq_if_composable) have 2: "src k = trg v" using assms \ ide_dom by (metis ideD(1) in_homE not_arr_null seq_if_composable) let ?\ = "\\<^sup>-\<^sup>1[k\<^sup>*, h, u] \ k.trnl\<^sub>\ v \" have \: "\?\ : v \ (k\<^sup>* \ h) \ u\" using assms \ 1 2 k.antipar cospan k.adjoint_transpose_left(1) [of "h \ u" v] assoc_in_hom by auto obtain w \ \ where w\\: "ide w \ \\ : p\<^sub>0 \ w \ u\ \ \\ : v \ p\<^sub>1 \ w\ \ iso \ \ ((k\<^sup>* \ h) \ \) \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w) \ \ = ?\" using assms \ T1 [of u ?\] comp_assoc by (metis in_homE) have 0: "src p\<^sub>0 = trg w" using w\\ ide_dom by (metis hseqE ideD(1) in_homE) have "\ = k.trnl\<^sub>\ (h \ u) (\[k\<^sup>*, h, u] \ ((k\<^sup>* \ h) \ \) \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w) \ \)" proof - have "\ = k.trnl\<^sub>\ (h \ u) (\[k\<^sup>*, h, u] \ ?\)" proof - have "k.trnl\<^sub>\ (h \ u) (\[k\<^sup>*, h, u] \ ?\) = k.trnl\<^sub>\ (h \ u) ((\[k\<^sup>*, h, u] \ \\<^sup>-\<^sup>1[k\<^sup>*, h, u]) \ k.trnl\<^sub>\ v \)" using comp_assoc by presburger also have "... = k.trnl\<^sub>\ (h \ u) (k.trnl\<^sub>\ v \)" proof - have "(\[k\<^sup>*, h, u] \ \\<^sup>-\<^sup>1[k\<^sup>*, h, u]) \ k.trnl\<^sub>\ v \ = (k\<^sup>* \ h \ u) \ k.trnl\<^sub>\ v \" using comp_assoc_assoc' by (simp add: "1" assms(1) cospan k.antipar(2)) also have "... = k.trnl\<^sub>\ v \" using "1" \ assms(1) comp_ide_arr cospan k.antipar(2) by fastforce finally show ?thesis by simp qed also have "... = \" using assms \ k.antipar cospan 1 2 k.adjoint_transpose_left(3) by simp finally show ?thesis by simp qed thus ?thesis using w\\ by simp qed also have "... = (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] \ (k \ \)" using assms k.antipar cospan w\\ transpose_triangle [of w \ u \] by auto finally have "(h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] \ (k \ \) = \" by simp thus "\w \ \. ide w \ \\ : p\<^sub>0 \ w \ u\ \ \\ : v \ p\<^sub>1 \ w\ \ iso \ \ (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] \ (k \ \) = \" using w\\ by blast next fix w w' \ \' \ assume w: "ide w" assume w': "ide w'" assume \: "\\ : p\<^sub>0 \ w \ u\" assume \': "\\' : p\<^sub>0 \ w' \ u\" assume \: "\\ : p\<^sub>1 \ w \ p\<^sub>1 \ w'\" assume eq: "(h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] = (h \ \') \ \[h, p\<^sub>0, w'] \ (\ \ w') \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w'] \ (k \ \)" have 0: "src p\<^sub>0 = trg w" using \ ide_dom by (metis ideD(1) in_homE not_arr_null seq_if_composable) interpret uw\w'\': uw\w'\' V H \ \ src trg \k\<^sup>* \ h\ tab \p\<^sub>0\ \p\<^sub>1\ u w \ w' \' using w \ w' \' apply (unfold_locales) by auto show "\!\. \\ : w \ w'\ \ \ = \' \ (p\<^sub>0 \ \) \ p\<^sub>1 \ \ = \" proof - let ?LHS = "\[k\<^sup>*, h, u] \ ((k\<^sup>* \ h) \ \) \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w)" let ?RHS = "\[k\<^sup>*, h, u] \ ((k\<^sup>* \ h) \ \') \ \[k\<^sup>* \ h, p\<^sub>0, w'] \ (tab \ w') \ \" have eq': "?LHS = ?RHS" proof - have "k.trnl\<^sub>\ (h \ u) ?LHS = k.trnl\<^sub>\ (h \ u) (\[k\<^sup>*, h, u] \ ((k\<^sup>* \ h) \ \) \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w) \ (p\<^sub>1 \ w))" using assms 0 w \ \ k.antipar cospan comp_arr_dom by (metis tab_simps(1) tab_simps(4) whisker_right) also have "... = (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] \ (k \ p\<^sub>1 \ w)" using assms w \ \ transpose_triangle by (metis arr_dom ide_hcomp ide_in_hom(2) in_homE ide_leg1 not_arr_null seq_if_composable) also have "... = (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" using assms 0 w k.antipar cospan comp_arr_dom by simp also have "... = (h \ \') \ \[h, p\<^sub>0, w'] \ (\ \ w') \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w'] \ (k \ \)" using eq by blast also have "... = k.trnl\<^sub>\ (h \ u) ?RHS" using assms w' \' \ transpose_triangle by simp finally have 4: "k.trnl\<^sub>\ (h \ u) ?LHS = k.trnl\<^sub>\ (h \ u) ?RHS" by simp have "src k = trg (p\<^sub>1 \ w)" using assms 0 w k.antipar cospan by simp moreover have "src k\<^sup>* = trg (h \ u)" using assms 0 w k.antipar cospan by simp moreover have "ide (h \ u)" using assms 0 w k.antipar cospan by simp moreover have "ide (p\<^sub>1 \ w)" using assms 0 w k.antipar cospan by simp ultimately have "inj_on (k.trnl\<^sub>\ (h \ u)) (hom (p\<^sub>1 \ w) (k\<^sup>* \ h \ u))" using assms 0 w w' k.antipar cospan k.adjoint_transpose_left(6) bij_betw_imp_inj_on by blast moreover have "?LHS \ hom (p\<^sub>1 \ w) (k\<^sup>* \ h \ u)" proof - have "\\[k\<^sup>*, h, u] \ ((k\<^sup>* \ h) \ \) \ \[k\<^sup>* \ h, p\<^sub>0, w] \ (tab \ w) : p\<^sub>1 \ w \ k\<^sup>* \ h \ u\" using k.antipar cospan apply (intro comp_in_homI) by auto thus ?thesis by simp qed moreover have "?RHS \ hom (p\<^sub>1 \ w) (k\<^sup>* \ h \ u)" proof - have "\\[k\<^sup>*, h, u] \ ((k\<^sup>* \ h) \ \') \ \[k\<^sup>* \ h, p\<^sub>0, w'] \ (tab \ w') \ \ : p\<^sub>1 \ w \ k\<^sup>* \ h \ u\" using \ k.antipar cospan apply (intro comp_in_homI) by auto thus ?thesis by blast qed ultimately show "?LHS = ?RHS" using assms 4 k.antipar cospan bij_betw_imp_inj_on inj_on_def [of "k.trnl\<^sub>\ (h \ u)" "hom (p\<^sub>1 \ w) (k\<^sup>* \ h \ u)"] by simp qed moreover have "seq \[k\<^sup>*, h, u] (composite_cell w \)" using assms k.antipar cospan tab_in_hom by fastforce moreover have "seq \[k\<^sup>*, h, u] (composite_cell w' \' \ \)" using assms \ k.antipar cospan tab_in_hom by fastforce ultimately have "composite_cell w \ = composite_cell w' \' \ \" using assms 0 w w' \ k.antipar cospan iso_assoc iso_is_section section_is_mono monoE [of "\[k\<^sup>*, h, u]" "composite_cell w \" "composite_cell w' \' \ \"] comp_assoc by simp thus ?thesis using w w' \ \' \ eq' T2 [of w w' \ u \' \] by metis qed qed text \ Using the uniqueness properties established for \\\, we obtain yet another reformulation of the biuniversal property associated with the chosen tabulation of \k\<^sup>* \ h\, this time as a kind of pseudo-pullback. We will use this to show that the category of isomorphism classes of maps has pullbacks. \ lemma has_pseudo_pullback: assumes "is_left_adjoint u" and "is_left_adjoint v" and "isomorphic (k \ v) (h \ u)" shows "\w. is_left_adjoint w \ isomorphic (p\<^sub>0 \ w) u \ isomorphic v (p\<^sub>1 \ w)" and "\w w'. \ is_left_adjoint w; is_left_adjoint w'; p\<^sub>0 \ w \ u; v \ p\<^sub>1 \ w; p\<^sub>0 \ w' \ u; v \ p\<^sub>1 \ w' \ \ w \ w'" proof - interpret u: map_in_bicategory V H \ \ src trg u using assms(1) by unfold_locales auto interpret v: map_in_bicategory V H \ \ src trg v using assms(2) by unfold_locales auto obtain \ where \: "\\ : k \ v \ h \ u\ \ iso \" using assms(3) by auto obtain w \ \ where w\\: "ide w \ \\ : p\<^sub>0 \ w \ u\ \ \\ : v \ p\<^sub>1 \ w\ \ iso \ \ (h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] \ (k \ \) = \" using assms \ \_biuniversal_prop(1) [of u v \] by auto have "is_left_adjoint w \ isomorphic (p\<^sub>0 \ w) u \ isomorphic v (p\<^sub>1 \ w)" proof (intro conjI) show 1: "is_left_adjoint w" using assms(2) w\\ left_adjoint_preserved_by_iso' isomorphic_def BS4 leg1_is_map by blast show "v \ p\<^sub>1 \ w" using w\\ isomorphic_def by blast show "p\<^sub>0 \ w \ u" proof - have "src p\<^sub>0 = trg w" using w\\ ide_dom by (metis ideD(1) in_homE not_arr_null seq_if_composable) hence "is_left_adjoint (p\<^sub>0 \ w)" using 1 left_adjoints_compose by simp thus ?thesis using assms w\\ 1 BS3 isomorphic_def by metis qed qed thus "\w. is_left_adjoint w \ p\<^sub>0 \ w \ u \ v \ p\<^sub>1 \ w" by blast show "\w w'. \ is_left_adjoint w; is_left_adjoint w'; p\<^sub>0 \ w \ u; v \ p\<^sub>1 \ w; p\<^sub>0 \ w' \ u; v \ p\<^sub>1 \ w' \ \ w \ w'" proof - fix w w' assume w: "is_left_adjoint w" and w': "is_left_adjoint w'" assume 1: "p\<^sub>0 \ w \ u" assume 2: "v \ p\<^sub>1 \ w" assume 3: "p\<^sub>0 \ w' \ u" assume 4: "v \ p\<^sub>1 \ w'" obtain \ where \: "\\ : p\<^sub>0 \ w \ u\" using 1 by auto obtain \' where \': "\\' : p\<^sub>0 \ w' \ u\" using 3 by auto obtain \ where \: "\\: v \ p\<^sub>1 \ w\ \ iso \" using 2 by blast obtain \' where \': "\\': v \ p\<^sub>1 \ w'\ \ iso \'" using 4 by blast let ?\ = "\' \ inv \" have \: "\?\ : p\<^sub>1 \ w \ p\<^sub>1 \ w'\" using \ \' by (elim conjE in_homE, auto) interpret uw\: uw\ V H \ \ src trg \k\<^sup>* \ h\ tab \p\<^sub>0\ \p\<^sub>1\ u w \ using w \ left_adjoint_is_ide by unfold_locales auto interpret uw'\': uw\ V H \ \ src trg \k\<^sup>* \ h\ tab \p\<^sub>0\ \p\<^sub>1\ u w' \' using w' \' left_adjoint_is_ide by unfold_locales auto interpret uw\w'\': uw\w'\' V H \ \ src trg \k\<^sup>* \ h\ tab \p\<^sub>0\ \p\<^sub>1\ u w \ w' \' using w w' \ \' left_adjoint_is_ide by unfold_locales have "(h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w] = (h \ \') \ \[h, p\<^sub>0, w'] \ (\ \ w') \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w'] \ (k \ ?\)" proof - let ?LHS = "(h \ \) \ \[h, p\<^sub>0, w] \ (\ \ w) \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w]" let ?RHS = "(h \ \') \ \[h, p\<^sub>0, w'] \ (\ \ w') \ \\<^sup>-\<^sup>1[k, p\<^sub>1, w'] \ (k \ ?\)" have "\?LHS : k \ p\<^sub>1 \ w \ h \ u\" using w k.antipar by fastforce moreover have "\?RHS : k \ p\<^sub>1 \ w \ h \ u\" using w k.antipar \ by fastforce moreover have "is_left_adjoint (k \ p\<^sub>1 \ w)" using w k.is_map left_adjoints_compose by simp moreover have "is_left_adjoint (h \ u)" using assms h.is_map left_adjoints_compose by auto ultimately show "?LHS = ?RHS" using BS3 by blast qed hence "\!\. \\ : w \ w'\ \ \ = \' \ (p\<^sub>0 \ \) \ p\<^sub>1 \ \ = ?\" using assms left_adjoint_is_ide w w' \ \' \ \' \ \_biuniversal_prop(2) [of u v w w' \ \' ?\] by presburger thus "w \ w'" using w w' BS3 isomorphic_def by metis qed qed end subsubsection "Tabulations in Maps" text \ Here we focus our attention on the properties of tabulations in a bicategory of spans, in the special case in which both legs are maps. \ context tabulation_in_maps begin text \ The following are the conditions under which \w\ is a 1-cell induced via \T1\ by a 2-cell \\\ : dom \ \ s \ r\<^sub>0\\: \w\ is an arrow of spans and \\\ is obtained by composing the tabulation \\\ with \w\ and the isomorphisms that witness \w\ being an arrow of spans. \ abbreviation is_induced_by_cell where "is_induced_by_cell w r\<^sub>0 \ \ arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 (dom \) s\<^sub>0 s\<^sub>1 w \ composite_cell w (arrow_of_spans_of_maps.the_\ V H r\<^sub>0 s\<^sub>0 w) \ (arrow_of_spans_of_maps.the_\ V H (dom \) s\<^sub>1 w) = \" lemma induced_map_unique: assumes "is_induced_by_cell w r\<^sub>0 \" and "is_induced_by_cell w' r\<^sub>0 \" shows "isomorphic w w'" proof - interpret w: arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 \dom \\ s\<^sub>0 s\<^sub>1 w using assms(1) by auto interpret w: arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 \dom \\ s \ s\<^sub>0 s\<^sub>1 w .. interpret w': arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 \dom \\ s\<^sub>0 s\<^sub>1 w' using assms(2) by auto interpret w': arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 \dom \\ s \ s\<^sub>0 s\<^sub>1 w' .. let ?\ = "w'.the_\ \ inv w.the_\" have \: "\?\ : s\<^sub>1 \ w \ s\<^sub>1 \ w'\" using w.the_\_props w'.the_\_props arr_iff_in_hom by auto have 1: "composite_cell w w.the_\ = composite_cell w' w'.the_\ \ (w'.the_\ \ inv w.the_\)" proof - have "composite_cell w' w'.the_\ \ (w'.the_\ \ inv w.the_\) = ((composite_cell w' w'.the_\) \ w'.the_\) \ inv w.the_\" using comp_assoc by presburger also have "... = \ \ inv w.the_\" using assms(2) comp_assoc by simp also have "... = (composite_cell w w.the_\ \ w.the_\) \ inv w.the_\" using assms(1) comp_assoc by simp also have "... = composite_cell w w.the_\ \ w.the_\ \ inv w.the_\" using comp_assoc by presburger also have "... = composite_cell w w.the_\" proof - have "w.the_\ \ inv w.the_\ = s\<^sub>1 \ w" using w.the_\_props comp_arr_inv inv_is_inverse by auto thus ?thesis using composite_cell_in_hom w.ide_w w.the_\_props comp_arr_dom by (metis composite_cell_in_hom in_homE w.w_in_hom(1)) qed finally show ?thesis by auto qed have "\\. \\ : w \ w'\" using 1 \ w.is_ide w'.is_ide w.the_\_props w'.the_\_props T2 [of w w' w.the_\ r\<^sub>0 w'.the_\ ?\] by blast thus ?thesis using BS3 w.is_map w'.is_map by blast qed text \ The object src \s\<^sub>0\ forming the apex of the tabulation satisfies the conditions for being a map induced via \T1\ by the 2-cell \\\ itself. This is ultimately required for the map from 2-cells to arrows of spans to be functorial with respect to vertical composition. \ lemma apex_is_induced_by_cell: shows "is_induced_by_cell (src s\<^sub>0) s\<^sub>0 \" proof - have 1: "arrow_of_spans_of_maps V H \ \ src trg s\<^sub>0 s\<^sub>1 s\<^sub>0 s\<^sub>1 (src s\<^sub>0)" using iso_runit [of s\<^sub>0] iso_runit [of s\<^sub>1] tab_in_hom apply unfold_locales apply simp using ide_leg0 isomorphic_def apply blast using ide_leg1 isomorphic_def leg1_simps(3) runit'_in_vhom [of s\<^sub>1 "src s\<^sub>0"] iso_runit' by blast interpret w: arrow_of_spans_of_maps V H \ \ src trg s\<^sub>0 \dom \\ s\<^sub>0 s\<^sub>1 \src s\<^sub>0\ using 1 tab_in_hom by simp interpret w: arrow_of_spans_of_maps_to_tabulation V H \ \ src trg s\<^sub>0 \dom \\ s \ s\<^sub>0 s\<^sub>1 \src s\<^sub>0\ .. show "is_induced_by_cell (src s\<^sub>0) s\<^sub>0 \" proof (intro conjI) show "arrow_of_spans_of_maps V H \ \ src trg s\<^sub>0 (dom \) s\<^sub>0 s\<^sub>1 (src s\<^sub>0)" using w.arrow_of_spans_of_maps_axioms by simp show "composite_cell (src s\<^sub>0) w.the_\ \ w.the_\ = \" proof - have \: "w.the_\ = \[s\<^sub>0]" using iso_runit [of s\<^sub>0] w.leg0_uniquely_isomorphic w.the_\_props the1_equality [of "\\. \\ : s\<^sub>0 \ src s\<^sub>0 \ s\<^sub>0\ \ iso \"] by auto have \: "w.the_\ = \\<^sup>-\<^sup>1[s\<^sub>1]" using iso_runit' w.leg1_uniquely_isomorphic w.the_\_props leg1_simps(3) the1_equality [of "\\. \\ : s\<^sub>1 \ s\<^sub>1 \ src s\<^sub>0\ \ iso \"] tab_in_vhom' by auto have "composite_cell (src s\<^sub>0) \[s\<^sub>0] \ \\<^sup>-\<^sup>1[s\<^sub>1] = \" proof - have "composite_cell (src s\<^sub>0) \[s\<^sub>0] \ \\<^sup>-\<^sup>1[s\<^sub>1] = ((s \ \[s\<^sub>0]) \ \[s, s\<^sub>0, src s\<^sub>0]) \ (\ \ src s\<^sub>0) \ \\<^sup>-\<^sup>1[s\<^sub>1]" using comp_assoc by presburger also have "... = (\[s \ s\<^sub>0] \ (\ \ src s\<^sub>0)) \ \\<^sup>-\<^sup>1[s\<^sub>1]" using runit_hcomp comp_assoc by simp also have "... = \ \ \[s\<^sub>1] \ \\<^sup>-\<^sup>1[s\<^sub>1]" using runit_naturality tab_in_hom by (metis tab_simps(1) tab_simps(2) tab_simps(4) tab_simps(5) comp_assoc) also have "... = \" using iso_runit tab_in_hom comp_arr_dom comp_arr_inv inv_is_inverse by simp finally show ?thesis by simp qed thus ?thesis using \ \ comp_assoc by simp qed qed qed end subsubsection "Composing Tabulations" text \ Given tabulations \(r\<^sub>0, \, r\<^sub>1)\ of \r\ and \(s\<^sub>0, \, s\<^sub>1)\ of \s\ in a bicategory of spans, where \(r\<^sub>0, r\<^sub>1)\ and \(s\<^sub>0, s\<^sub>1)\ are spans of maps and 1-cells \r\ and \s\ are composable, we can construct a 2-cell that yields a tabulation of \r \ s\. The proof uses the fact that the 2-cell \\\ associated with the cospan \(r\<^sub>0, s\<^sub>1)\ is an isomorphism, which we have proved above (\cospan_of_maps_in_bicategory_of_spans.\_uniqueness\) using \BS3\. However, this is the only use of \BS3\ in the proof, and it seems plausible that it would be possible to establish that \\\ is an isomorphism in more general situations in which the subbicategory of maps is not locally essentially discrete. Alternatively, more general situations could be treated by adding the assertion that \\\ is an isomorphism as part of a weakening of \BS3\. \ locale composite_tabulation_in_maps = bicategory_of_spans V H \ \ src trg + \: tabulation_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 + \: tabulation_in_maps V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and r :: 'a and \ :: 'a and r\<^sub>0 :: 'a and r\<^sub>1 :: 'a and s :: 'a and \ :: 'a and s\<^sub>0 :: 'a and s\<^sub>1 :: 'a + assumes composable: "src r = trg s" begin text \ Interpret \(r\<^sub>0, s\<^sub>1)\ as a @{locale cospan_of_maps_in_bicategory_of_spans}, to obtain the isomorphism \\\ in the central diamond, along with the assertion that it is unique. \ interpretation r\<^sub>0s\<^sub>1: cospan_of_maps_in_bicategory_of_spans V H \ \ src trg s\<^sub>1 r\<^sub>0 using \.leg0_is_map \.leg1_is_map composable by unfold_locales auto text \ We need access to simps, etc. in the preceding interpretation, yet trying to declare it as a sublocale introduces too many conflicts at the moment. As it confusing elsewhere to figure out exactly how, in other contexts, to express the particular interpretation that is needed, to make things easier we include the following lemma. Then we can just recall the lemma to find out how to express the interpretation required in a given context. \ lemma r\<^sub>0s\<^sub>1_is_cospan: shows "cospan_of_maps_in_bicategory_of_spans V H \ \ src trg s\<^sub>1 r\<^sub>0" .. text \ The following define the projections associated with the natural tabulation of \r\<^sub>0\<^sup>* \ s\<^sub>1\. \ abbreviation p\<^sub>0 where "p\<^sub>0 \ r\<^sub>0s\<^sub>1.p\<^sub>0" abbreviation p\<^sub>1 where "p\<^sub>1 \ r\<^sub>0s\<^sub>1.p\<^sub>1" text \ $$ \xymatrix{ && {\rm src}~\phi \ar[dl]_{p_1} \ar[dr]^{p_0} \ddtwocell\omit{^\phi} \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^\sigma}\\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } $$ \ text \ Next, we define the 2-cell that is the composite of the tabulation \\\, the tabulation \\\, and the central diamond that commutes up to unique isomorphism \\\. \ definition tab where "tab \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ (r \ \ \ p\<^sub>0) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, p\<^sub>1] \ (\ \ p\<^sub>1)" lemma tab_in_hom [intro]: shows "\tab : r\<^sub>1 \ p\<^sub>1 \ (r \ s) \ s\<^sub>0 \ p\<^sub>0\" using \.T0.antipar(1) r\<^sub>0s\<^sub>1.\_in_hom composable \.leg0_in_hom(1) \.leg1_in_hom(1) composable tab_def by auto interpretation tabulation_data V H \ \ src trg \r \ s\ tab \s\<^sub>0 \ p\<^sub>0\ \r\<^sub>1 \ p\<^sub>1\ using composable tab_in_hom by unfold_locales auto text \ In the subsequent proof we will use coherence to shortcut a few of the calculations. \ interpretation E: self_evaluation_map V H \ \ src trg .. notation E.eval ("\_\") text \ The following is applied twice in the proof of property \T2\ for the composite tabulation. It's too long to repeat. \ lemma technical: assumes "ide w" and "\\ : (s\<^sub>0 \ p\<^sub>0) \ w \ u\" and "w\<^sub>r = p\<^sub>1 \ w" and "\\<^sub>r = (s \ \) \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" shows "\.composite_cell w\<^sub>r \\<^sub>r = \[r, s, u] \ composite_cell w \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" text \ $$ \xymatrix{ && X \ar[d]^{w} \ar@/ur20pt/[dddrr]^{u} \xtwocell[ddr]{}\omit{^{\theta}} \\ && {\rm src}~\phi \ar[dl]_{p_1} \ar[dr]^{p_0} \ddtwocell\omit{^\phi} \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^\sigma}\\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } $$ \ proof - interpret uw\: uw\ V H \ \ src trg \r \ s\ tab \s\<^sub>0 \ p\<^sub>0\ \r\<^sub>1 \ p\<^sub>1\ u w \ using assms(1-2) composable by unfold_locales auto show ?thesis proof - have "\[r, s, u] \ composite_cell w \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] = (\[r, s, u] \ ((r \ s) \ \)) \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (tab \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using comp_assoc by presburger also have "... = (r \ s \ \) \ \[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (tab \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using assoc_naturality [of r s \] composable comp_assoc by simp also have "... = (r \ s \ \) \ \[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ ((\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0])) \ (r \ \ \ p\<^sub>0) \ \.composite_cell p\<^sub>1 r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" unfolding tab_def using comp_assoc by presburger also have "... = (r \ s \ \) \ ((\[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ w))) \ ((r \ \ \ p\<^sub>0) \ \.composite_cell p\<^sub>1 r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using composable \.T0.antipar(1) comp_assoc whisker_right by auto also have "... = (r \ s \ \) \ ((\[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ w))) \ ((r \ \ \ p\<^sub>0) \ w) \ ((r \ r\<^sub>0s\<^sub>1.\) \ w) \ (\[r, r\<^sub>0, p\<^sub>1] \ w) \ ((\ \ p\<^sub>1) \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using composable \.T0.antipar(1) whisker_right tab_def tab_in_hom(2) composable comp_assoc by force also have "... = (r \ s \ \) \ ((\[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ w))) \ ((r \ \ \ p\<^sub>0) \ w) \ ((r \ r\<^sub>0s\<^sub>1.\) \ w) \ ((\[r, r\<^sub>0, p\<^sub>1] \ w) \ \\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w]) \ (\ \ p\<^sub>1 \ w)" using assoc'_naturality [of \ p\<^sub>1 w] \.T0.antipar(1) r\<^sub>0s\<^sub>1.base_simps(2) comp_assoc by auto also have "... = (r \ s \ \) \ ((\[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ w))) \ ((r \ \ \ p\<^sub>0) \ w) \ (((r \ r\<^sub>0s\<^sub>1.\) \ w) \ \\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w]) \ \.composite_cell (p\<^sub>1 \ w) \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" proof - have "(\[r, r\<^sub>0, p\<^sub>1] \ w) \ \\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w] = \\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w] \ (r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w]" proof - have "(\\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1] \ w) \ \\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w] \ (r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) = \\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w] \ \\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1 \ w]" using pentagon' \.T0.antipar(1) comp_assoc by simp moreover have 1: "seq (\\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1] \ w)(\\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w] \ (r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]))" using \.T0.antipar(1) by (intro seqI hseqI, auto) ultimately have "\\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w] = ((\\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1] \ w) \ \\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w] \ (r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w])) \ \[r, r\<^sub>0, p\<^sub>1 \ w]" using \.T0.antipar(1) iso_assoc invert_side_of_triangle(2) [of "(\\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1] \ w) \ \\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w] \ (r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w])" "\\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w]" "\\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1 \ w]"] by fastforce hence "\\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w] = (\\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1] \ w) \ \\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w] \ (r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w]" using comp_assoc by presburger moreover have "seq (inv (\\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1] \ w)) \\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w]" using \.T0.antipar(1) 1 by fastforce ultimately show ?thesis using \.T0.antipar(1) iso_assoc invert_side_of_triangle(1) [of "\\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w]" "\\<^sup>-\<^sup>1[r, r\<^sub>0, p\<^sub>1] \ w" "\\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w] \ (r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w]"] by fastforce qed thus ?thesis using comp_assoc by presburger qed also have "... = (r \ s \ \) \ ((\[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ w))) \ (((r \ \ \ p\<^sub>0) \ w) \ \\<^sup>-\<^sup>1[r, s\<^sub>1 \ p\<^sub>0, w]) \ (r \ r\<^sub>0s\<^sub>1.\ \ w) \ \.composite_cell (p\<^sub>1 \ w) \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" proof - have "((r \ r\<^sub>0s\<^sub>1.\) \ w) \ \\<^sup>-\<^sup>1[r, r\<^sub>0 \ p\<^sub>1, w] = \\<^sup>-\<^sup>1[r, s\<^sub>1 \ p\<^sub>0, w] \ (r \ r\<^sub>0s\<^sub>1.\ \ w)" using assoc'_naturality [of r r\<^sub>0s\<^sub>1.\ w] r\<^sub>0s\<^sub>1.cospan by auto thus ?thesis using comp_assoc by presburger qed also have "... = (r \ s \ \) \ (\[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ w) \ \\<^sup>-\<^sup>1[r, (s \ s\<^sub>0) \ p\<^sub>0, w]) \ (r \ (\ \ p\<^sub>0) \ w) \ (r \ r\<^sub>0s\<^sub>1.\ \ w) \ \.composite_cell (p\<^sub>1 \ w) \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" proof - have "((r \ \ \ p\<^sub>0) \ w) \ \\<^sup>-\<^sup>1[r, s\<^sub>1 \ p\<^sub>0, w] = \\<^sup>-\<^sup>1[r, (s \ s\<^sub>0) \ p\<^sub>0, w] \ (r \ (\ \ p\<^sub>0) \ w)" using assoc'_naturality [of r "\ \ p\<^sub>0" w] by (simp add: composable) thus ?thesis using comp_assoc by presburger qed also have "... = (r \ s \ \) \ (r \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ ((r \ (\ \ p\<^sub>0) \ w) \ (r \ r\<^sub>0s\<^sub>1.\ \ w) \ (r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w])) \ \[r, r\<^sub>0, p\<^sub>1 \ w] \ (\ \ p\<^sub>1 \ w)" proof - have "\[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ w) \ \\<^sup>-\<^sup>1[r, (s \ s\<^sub>0) \ p\<^sub>0, w] = r \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ \[s \ s\<^sub>0, p\<^sub>0, w]" proof - have "\[r, s, (s\<^sub>0 \ p\<^sub>0) \ w] \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0] \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ w) \ \\<^sup>-\<^sup>1[r, (s \ s\<^sub>0) \ p\<^sub>0, w] = \\<^bold>\\<^bold>[\<^bold>\r\<^bold>\, \<^bold>\s\<^bold>\, (\<^bold>\s\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\w\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^bold>[\<^bold>\r\<^bold>\ \<^bold>\ \<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\r\<^bold>\, \<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\r\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\w\<^bold>\) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\r\<^bold>\, (\<^bold>\s\<^bold>\ \<^bold>\ \<^bold>\s\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]\" using \_def \'_def composable by simp also have "... = \\<^bold>\r\<^bold>\ \<^bold>\ (\<^bold>\s\<^bold>\ \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\s\<^sub>0\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^bold>[\<^bold>\s\<^bold>\ \<^bold>\ \<^bold>\s\<^sub>0\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]\" using composable by (intro E.eval_eqI, simp_all) also have "... = r \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ \[s \ s\<^sub>0, p\<^sub>0, w]" using \_def \'_def composable by simp finally show ?thesis by simp qed thus ?thesis using comp_assoc by presburger qed also have "... = (r \ s \ \) \ (r \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ \.composite_cell (p\<^sub>1 \ w) (((\ \ p\<^sub>0) \ w) \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w])" using assms(3) arrI \.T0.antipar(1) whisker_left by auto also have "... = (r \ (s \ \) \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\[s \ s\<^sub>0, p\<^sub>0, w] \ ((\ \ p\<^sub>0) \ w)) \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w] \ (\ \ p\<^sub>1 \ w)" using \.T0.antipar(1) comp_assoc whisker_left by auto also have "... = (r \ (s \ \) \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w] \ (\ \ p\<^sub>1 \ w)" using assoc_naturality [of \ p\<^sub>0 w] comp_assoc by simp finally show ?thesis using assms(3-4) by simp qed qed lemma composite_is_tabulation: shows "tabulation V H \ \ src trg (r \ s) tab (s\<^sub>0 \ p\<^sub>0) (r\<^sub>1 \ p\<^sub>1)" proof show "\u \. \ ide u; \\ : dom \ \ (r \ s) \ u\ \ \ \w \ \. ide w \ \\ : (s\<^sub>0 \ p\<^sub>0) \ w \ u\ \ \\ : dom \ \ (r\<^sub>1 \ p\<^sub>1) \ w\ \ iso \ \ composite_cell w \ \ \ = \" proof - fix u \ assume u: "ide u" assume \: "\\ : dom \ \ (r \ s) \ u\" let ?v = "dom \" have 1: "\\[r, s, u] \ \ : ?v \ r \ s \ u\" proof - (* * TODO: I think this highlights the current issue with assoc_in_hom: * it can't be applied automatically here because there isn't any way to * obtain the equations src r = trg s and src s = trg u from assumption \. * Maybe this can be improved with a little bit of thought, but not while * a lot of other stuff is being changed, too. *) have "src r = trg s \ src s = trg u" by (metis \ arr_cod hseq_char in_homE hcomp_simps(1)) thus ?thesis using u \ by fastforce qed obtain w\<^sub>r \\<^sub>r \\<^sub>r where w\<^sub>r\\<^sub>r\\<^sub>r: "ide w\<^sub>r \ \\\<^sub>r : r\<^sub>0 \ w\<^sub>r \ s \ u\ \ \\\<^sub>r : ?v \ r\<^sub>1 \ w\<^sub>r\ \ iso \\<^sub>r \ \.composite_cell w\<^sub>r \\<^sub>r \ \\<^sub>r = \[r, s, u] \ \" using u \ \.T1 [of "s \ u" "\[r, s, u] \ \"] by (metis 1 \.ide_base \.ide_base arr_cod composable ide_hcomp in_homE match_1 not_arr_null seq_if_composable) text \ $$ \xymatrix{ && X \ar@ {.>}[ddl]^{w_r} \ar@/ul20pt/[dddll]_{v} \xtwocell[dddll]{}\omit{^{<1.5>\nu_r}} \ar@/ur20pt/[dddrr]^{u} \xtwocell[dddr]{}\omit{^{\theta_r}} \\ && \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && \\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } $$ \ text \We need some simps, etc., otherwise the subsequent diagram chase is very painful.\ have w\<^sub>r: "ide w\<^sub>r" using w\<^sub>r\\<^sub>r\\<^sub>r by simp have [simp]: "src w\<^sub>r = src u" using w\<^sub>r\\<^sub>r\\<^sub>r \ 1 comp_arr_dom in_homE seqE hcomp_simps(1) vseq_implies_hpar(1) by (metis src_hcomp) have [simp]: "trg w\<^sub>r = src \" using w\<^sub>r\\<^sub>r\\<^sub>r by (metis 1 arrI not_arr_null seqE seq_if_composable) have \\<^sub>r_in_hom [intro]: "\\\<^sub>r : r\<^sub>0 \ w\<^sub>r \ s \ u\" using w\<^sub>r\\<^sub>r\\<^sub>r by simp have \\<^sub>r_in_hhom [intro]: "\\\<^sub>r : src u \ trg s\" using \\<^sub>r_in_hom src_cod [of \\<^sub>r] trg_cod [of \\<^sub>r] by (metis \src w\<^sub>r = src u\ \.leg1_simps(4) arr_dom in_hhomI in_homE r\<^sub>0s\<^sub>1.cospan src_hcomp trg_hcomp vconn_implies_hpar(1) vconn_implies_hpar(2)) have [simp]: "src \\<^sub>r = src u" using \\<^sub>r_in_hhom by auto have [simp]: "trg \\<^sub>r = trg s" using \\<^sub>r_in_hhom by auto have [simp]: "dom \\<^sub>r = r\<^sub>0 \ w\<^sub>r" using \\<^sub>r_in_hom by blast have [simp]: "cod \\<^sub>r = s \ u" using \\<^sub>r_in_hom by blast have \\<^sub>r_in_hom [intro]: "\\\<^sub>r : ?v \ r\<^sub>1 \ w\<^sub>r\" using w\<^sub>r\\<^sub>r\\<^sub>r by simp have \\<^sub>r_in_hhom [intro]: "\\\<^sub>r : src u \ trg r\" using \\<^sub>r_in_hom src_dom [of \\<^sub>r] trg_dom [of \\<^sub>r] by (metis \src w\<^sub>r = src u\ \.leg1_simps(4) arr_cod in_hhomI in_homE src_hcomp trg_hcomp vconn_implies_hpar(3) vconn_implies_hpar(4)) have [simp]: "src \\<^sub>r = src u" using \\<^sub>r_in_hhom by auto have [simp]: "trg \\<^sub>r = trg r" using \\<^sub>r_in_hhom by auto have [simp]: "dom \\<^sub>r = ?v" using \\<^sub>r_in_hom by auto have [simp]: "cod \\<^sub>r = r\<^sub>1 \ w\<^sub>r" using \\<^sub>r_in_hom by auto have iso_\\<^sub>r: "iso \\<^sub>r" using w\<^sub>r\\<^sub>r\\<^sub>r by simp obtain w\<^sub>s \\<^sub>s \\<^sub>s where w\<^sub>s\\<^sub>s\\<^sub>s: "ide w\<^sub>s \ \\\<^sub>s : s\<^sub>0 \ w\<^sub>s \ u\ \ \\\<^sub>s : r\<^sub>0 \ w\<^sub>r \ s\<^sub>1 \ w\<^sub>s\ \ iso \\<^sub>s \ \.composite_cell w\<^sub>s \\<^sub>s \ \\<^sub>s = \\<^sub>r" using u w\<^sub>r\\<^sub>r\\<^sub>r \.T1 [of u \\<^sub>r] by auto text \ $$ \xymatrix{ && X \ar[ddl]^{w_r} \ar@/ul20pt/[dddll]_{v} \xtwocell[dddll]{}\omit{^{<1.5>\nu_r}} \ar@/ur20pt/[dddrr]^{u} \ar@ {.>}[ddr]_{w_s} \xtwocell[dddrr]{}\omit{^{<-1.5>\theta_s}} \xtwocell[ddd]{}\omit{^{<1>\nu_s}} \\ && \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^\sigma}\\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } $$ \ have w\<^sub>s: "ide w\<^sub>s" using w\<^sub>s\\<^sub>s\\<^sub>s by simp have [simp]: "src w\<^sub>s = src u" using w\<^sub>s\\<^sub>s\\<^sub>s src_cod by (metis \.leg0_simps(2) \.tab_simps(2) \\<^sub>r_in_hom arrI hseqI' ideD(1) seqE seq_if_composable src_hcomp vconn_implies_hpar(3)) have [simp]: "trg w\<^sub>s = src \" using w\<^sub>s\\<^sub>s\\<^sub>s by (metis \.tab_simps(2) arr_dom in_homE not_arr_null seq_if_composable) have \\<^sub>s_in_hom [intro]: "\\\<^sub>s : s\<^sub>0 \ w\<^sub>s \ u\" using w\<^sub>s\\<^sub>s\\<^sub>s by simp have \\<^sub>s_in_hhom [intro]: "\\\<^sub>s : src u \ src s\" using \\<^sub>s_in_hom src_cod trg_cod by (metis \\<^sub>r_in_hom arrI hseqE in_hhom_def seqE vconn_implies_hpar(1) vconn_implies_hpar(3) w\<^sub>s\\<^sub>s\\<^sub>s) have [simp]: "src \\<^sub>s = src u" using \\<^sub>s_in_hhom by auto have [simp]: "trg \\<^sub>s = src s" using \\<^sub>s_in_hhom by auto have [simp]: "dom \\<^sub>s = s\<^sub>0 \ w\<^sub>s" using \\<^sub>s_in_hom by blast have [simp]: "cod \\<^sub>s = u" using \\<^sub>s_in_hom by blast have \\<^sub>s_in_hom [intro]: "\\\<^sub>s : r\<^sub>0 \ w\<^sub>r \ s\<^sub>1 \ w\<^sub>s\" using w\<^sub>s\\<^sub>s\\<^sub>s by simp have \\<^sub>s_in_hhom [intro]: "\\\<^sub>s : src u \ trg s\" using \\<^sub>s_in_hom src_dom trg_cod by (metis \src \\<^sub>r = src u\ \trg \\<^sub>r = trg s\ \\<^sub>r_in_hom in_hhomI in_homE src_dom trg_dom) have [simp]: "src \\<^sub>s = src u" using \\<^sub>s_in_hhom by auto have [simp]: "trg \\<^sub>s = trg s" using \\<^sub>s_in_hhom by auto have [simp]: "dom \\<^sub>s = r\<^sub>0 \ w\<^sub>r" using \\<^sub>s_in_hom by auto have [simp]: "cod \\<^sub>s = s\<^sub>1 \ w\<^sub>s" using \\<^sub>s_in_hom by auto have iso_\\<^sub>s: "iso \\<^sub>s" using w\<^sub>s\\<^sub>s\\<^sub>s by simp obtain w \\<^sub>t \\<^sub>t where w\\<^sub>t\\<^sub>t: "ide w \ \\\<^sub>t : p\<^sub>0 \ w \ w\<^sub>s\ \ \\\<^sub>t : w\<^sub>r \ p\<^sub>1 \ w\ \ iso \\<^sub>t \ (s\<^sub>1 \ \\<^sub>t) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t) = \\<^sub>s" using w\<^sub>r\\<^sub>r\\<^sub>r w\<^sub>s\\<^sub>s\\<^sub>s iso_\\<^sub>s r\<^sub>0s\<^sub>1.\_biuniversal_prop(1) [of w\<^sub>s w\<^sub>r \\<^sub>s] by blast text \ $$ \xymatrix{ && X \ar[ddl]_{w_r} \ar@/ul20pt/[dddll]_{v} \xtwocell[dddll]{}\omit{^{<1.5>\nu_r}} \ar@/ur20pt/[dddrr]^{u} \ar[ddr]^{w_s} \xtwocell[dddrr]{}\omit{^{<-1.5>\theta_s}} \ar@ {.>}[d]^{w} \xtwocell[ddl]{}\omit{^<-2>{\nu_t}} \xtwocell[ddr]{}\omit{^<2>{\theta_t}} \\ && {\rm src}~\phi \ar[dl]_{p_1} \ar[dr]^{p_0} \ddtwocell\omit{^\phi} \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^\sigma}\\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } $$ \ text \{\bf Note:} \w\ is not necessarily a map.\ have w: "ide w" using w\\<^sub>t\\<^sub>t by simp have [simp]: "src w = src u" using w\\<^sub>t\\<^sub>t src_cod by (metis \\<^sub>s_in_hom \src \\<^sub>s = src u\ arrI seqE src_hcomp src_vcomp vseq_implies_hpar(1)) have [simp]: "trg w = src p\<^sub>0" using w\\<^sub>t\\<^sub>t by (metis \\<^sub>s_in_hom arrI not_arr_null r\<^sub>0s\<^sub>1.\_simps(2) seqE seq_if_composable) have \\<^sub>t_in_hom [intro]: "\\\<^sub>t : p\<^sub>0 \ w \ w\<^sub>s\" using w\\<^sub>t\\<^sub>t by simp have \\<^sub>t_in_hhom [intro]: "\\\<^sub>t : src u \ src \\" using \\<^sub>t_in_hom src_cod trg_cod \src w\<^sub>s = src u\ \trg w\<^sub>s = src \\ by fastforce have [simp]: "src \\<^sub>t = src u" using \\<^sub>t_in_hhom by auto have [simp]: "trg \\<^sub>t = src \" using \\<^sub>t_in_hhom by auto have [simp]: "dom \\<^sub>t = p\<^sub>0 \ w" using \\<^sub>t_in_hom by blast have (* [simp]: *) "cod \\<^sub>t = w\<^sub>s" using \\<^sub>t_in_hom by blast have \\<^sub>t_in_hom [intro]: "\\\<^sub>t : w\<^sub>r \ p\<^sub>1 \ w\" using w\\<^sub>t\\<^sub>t by simp have \\<^sub>t_in_hhom [intro]: "\\\<^sub>t : src u \ src \\" using \\<^sub>t_in_hom src_dom trg_dom \src w\<^sub>r = src u\ \trg w\<^sub>r = src \\ by fastforce have [simp]: "src \\<^sub>t = src u" using \\<^sub>t_in_hhom by auto have [simp]: "trg \\<^sub>t = src \" using \\<^sub>t_in_hhom by auto have (* [simp]: *) "dom \\<^sub>t = w\<^sub>r" using \\<^sub>t_in_hom by auto have [simp]: "cod \\<^sub>t = p\<^sub>1 \ w" using \\<^sub>t_in_hom by auto have iso_\\<^sub>t: "iso \\<^sub>t" using w\\<^sub>t\\<^sub>t by simp define \ where "\ = \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t) \ \[s\<^sub>0, p\<^sub>0, w]" have \: "\\ : (s\<^sub>0 \ p\<^sub>0) \ w \ u\" proof (unfold \_def, intro comp_in_homI) show "\\[s\<^sub>0, p\<^sub>0, w] : (s\<^sub>0 \ p\<^sub>0) \ w \ s\<^sub>0 \ p\<^sub>0 \ w\" using w\\<^sub>t\\<^sub>t by auto show "\s\<^sub>0 \ \\<^sub>t : s\<^sub>0 \ p\<^sub>0 \ w \ s\<^sub>0 \ w\<^sub>s\" using w\\<^sub>t\\<^sub>t by auto show "\\\<^sub>s : s\<^sub>0 \ w\<^sub>s \ u\" using w\<^sub>s\\<^sub>s\\<^sub>s by simp qed define \ where "\ = \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" have \: "\\ : ?v \ (r\<^sub>1 \ p\<^sub>1) \ w\" proof (unfold \_def, intro comp_in_homI) show "\\\<^sub>r : ?v \ r\<^sub>1 \ w\<^sub>r\" using w\<^sub>r\\<^sub>r\\<^sub>r by blast show "\r\<^sub>1 \ \\<^sub>t : r\<^sub>1 \ w\<^sub>r \ r\<^sub>1 \ p\<^sub>1 \ w\" using w\\<^sub>t\\<^sub>t by (intro hcomp_in_vhom, auto) show "\\\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] : r\<^sub>1 \ p\<^sub>1 \ w \ (r\<^sub>1 \ p\<^sub>1) \ w\" using w\\<^sub>t\\<^sub>t assoc_in_hom by (simp add: \.T0.antipar(1)) qed have iso_\: "iso \" using \ w\\<^sub>t\\<^sub>t w\<^sub>r\\<^sub>r\\<^sub>r \.T0.antipar(1) by (unfold \_def, intro isos_compose) auto have *: "arr ((s \ \\<^sub>s) \ \[s, s\<^sub>0, w\<^sub>s] \ (\ \ w\<^sub>s) \ (s\<^sub>1 \ \\<^sub>t) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t))" using w\<^sub>s\\<^sub>s\\<^sub>s w\\<^sub>t\\<^sub>t \\<^sub>r_in_hom comp_assoc by auto have "((r \ s) \ \) \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (tab \ w) \ \ = \" proof - have "seq (r \ \\<^sub>r) (\[r, r\<^sub>0, w\<^sub>r] \ (\ \ w\<^sub>r) \ \\<^sub>r)" using w\<^sub>r\\<^sub>r\\<^sub>r \.base_simps(2) composable by fastforce hence "\ = \\<^sup>-\<^sup>1[r, s, u] \ \.composite_cell w\<^sub>r \\<^sub>r \ \\<^sub>r" using w\<^sub>r\\<^sub>r\\<^sub>r invert_side_of_triangle(1) iso_assoc by (metis 1 \.ide_base \.ide_base arrI assoc'_eq_inv_assoc composable hseq_char' seqE seq_if_composable u vconn_implies_hpar(2) vconn_implies_hpar(4) w\<^sub>s\\<^sub>s\\<^sub>s) also have "... = \\<^sup>-\<^sup>1[r, s, u] \ \.composite_cell w\<^sub>r (\.composite_cell w\<^sub>s \\<^sub>s \ \\<^sub>s) \ \\<^sub>r" using w\<^sub>s\\<^sub>s\\<^sub>s by simp also have "... = \\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ \[s, s\<^sub>0, w\<^sub>s] \ (\ \ w\<^sub>s) \ (s\<^sub>1 \ \\<^sub>t) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t)) \ \[r, r\<^sub>0, w\<^sub>r] \ (\ \ w\<^sub>r) \ \\<^sub>r" using w\\<^sub>t\\<^sub>t comp_assoc by simp text \Rearrange to create \\\ and \\\, leaving \tab\ in the middle.\ also have "... = \\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ \[s, s\<^sub>0, w\<^sub>s] \ ((\ \ w\<^sub>s) \ (s\<^sub>1 \ \\<^sub>t)) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t)) \ \[r, r\<^sub>0, w\<^sub>r] \ (\ \ w\<^sub>r) \ \\<^sub>r" using comp_assoc by presburger also have "... = \\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ (\[s, s\<^sub>0, w\<^sub>s] \ ((s \ s\<^sub>0) \ \\<^sub>t)) \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t)) \ \[r, r\<^sub>0, w\<^sub>r] \ (\ \ w\<^sub>r) \ \\<^sub>r" proof - have "(\ \ w\<^sub>s) \ (s\<^sub>1 \ \\<^sub>t) = \ \ \\<^sub>t" using comp_arr_dom comp_cod_arr interchange by (metis \cod \\<^sub>t = w\<^sub>s\ \.tab_simps(1) \.tab_simps(4) arrI w\\<^sub>t\\<^sub>t) also have "... = ((s \ s\<^sub>0) \ \\<^sub>t) \ (\ \ p\<^sub>0 \ w)" using comp_arr_dom comp_cod_arr interchange w\<^sub>s\\<^sub>s\\<^sub>s w\\<^sub>t\\<^sub>t \.tab_in_hom by (metis \dom \\<^sub>t = p\<^sub>0 \ w\ \.tab_simps(5) arrI) finally have "(\ \ w\<^sub>s) \ (s\<^sub>1 \ \\<^sub>t) = ((s \ s\<^sub>0) \ \\<^sub>t) \ (\ \ p\<^sub>0 \ w)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t)) \ \[r, r\<^sub>0, w\<^sub>r] \ (\ \ w\<^sub>r) \ \\<^sub>r" using assoc_naturality [of s s\<^sub>0 \\<^sub>t] w\\<^sub>t\\<^sub>t comp_assoc \cod \\<^sub>t = w\<^sub>s\ arrI by force also have "... = \\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t)) \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t)) \ \[r, r\<^sub>0, w\<^sub>r] \ (\ \ w\<^sub>r) \ \\<^sub>r" proof - have "r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t) = (r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t)) \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t))" proof - have "seq ((s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t)) (\[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t))" proof - have "seq (s \ \\<^sub>s) ((s \ s\<^sub>0 \ \\<^sub>t) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t))" using \\\[r, s, u] \ \ : dom \ \ r \ s \ u\\ calculation by blast thus ?thesis using comp_assoc by presburger qed thus ?thesis using whisker_left [of r "(s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t)" "\[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ (r\<^sub>0 \ \\<^sub>t)"] w\<^sub>s\\<^sub>s\\<^sub>s w\\<^sub>t\\<^sub>t comp_assoc by simp qed thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t)) \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ ((r \ r\<^sub>0 \ \\<^sub>t) \ \[r, r\<^sub>0, w\<^sub>r]) \ (\ \ w\<^sub>r) \ \\<^sub>r" proof - have "seq (\[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) (r\<^sub>0 \ \\<^sub>t)" using 1 r\<^sub>0s\<^sub>1.p\<^sub>1_simps w\\<^sub>t\\<^sub>t apply (intro seqI' comp_in_homI) by auto hence "r \ (\[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ (r\<^sub>0 \ \\<^sub>t) = (r \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ (r \ r\<^sub>0 \ \\<^sub>t)" using whisker_left by simp thus ?thesis using comp_assoc by simp qed also have "... = \\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t)) \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w] \ (((r \ r\<^sub>0) \ \\<^sub>t) \ (\ \ w\<^sub>r)) \ \\<^sub>r" proof - have "(r \ r\<^sub>0 \ \\<^sub>t) \ \[r, r\<^sub>0, w\<^sub>r] = \[r, r\<^sub>0, p\<^sub>1 \ w] \ ((r \ r\<^sub>0) \ \\<^sub>t)" using assoc_naturality [of r r\<^sub>0 \\<^sub>t] \\<^sub>t_in_hom by auto thus ?thesis using comp_assoc by presburger qed also have "... = (\\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t))) \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w] \ (\ \ p\<^sub>1 \ w) \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" proof - have "((r \ r\<^sub>0) \ \\<^sub>t) \ (\ \ w\<^sub>r) = \ \ \\<^sub>t" using comp_arr_dom comp_cod_arr interchange by (metis \dom \\<^sub>t = w\<^sub>r\ \.tab_simps(1) \.tab_simps(5) arrI w\\<^sub>t\\<^sub>t) also have "... = (\ \ p\<^sub>1 \ w) \ (r\<^sub>1 \ \\<^sub>t)" using comp_arr_dom comp_cod_arr interchange by (metis \cod \\<^sub>t = p\<^sub>1 \ w\ \trg \\<^sub>t = src \\ \.T0.antipar(1) \.tab_simps(1) \.tab_simps(2) \.tab_simps(4) r\<^sub>0s\<^sub>1.base_simps(2) trg.preserves_reflects_arr trg_hcomp) finally have "((r \ r\<^sub>0) \ \\<^sub>t) \ (\ \ w\<^sub>r) = (\ \ p\<^sub>1 \ w) \ (r\<^sub>1 \ \\<^sub>t)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ ((\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w]) \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w] \ (\ \ p\<^sub>1 \ w) \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" proof - have "\\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t)) = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w]" proof - have "seq (s \ \\<^sub>s) (s \ s\<^sub>0 \ \\<^sub>t)" using \\<^sub>s_in_hom \\<^sub>s_in_hhom \\<^sub>t_in_hom \\<^sub>t_in_hhom 1 calculation by blast moreover have "src r = trg (s \ \\<^sub>s)" using composable hseqI by force ultimately have "\\<^sup>-\<^sup>1[r, s, u] \ (r \ (s \ \\<^sub>s) \ (s \ s\<^sub>0 \ \\<^sub>t)) = (\\<^sup>-\<^sup>1[r, s, u] \ (r \ s \ \\<^sub>s)) \ (r \ s \ s\<^sub>0 \ \\<^sub>t)" using whisker_left comp_assoc by simp also have "... = ((r \ s) \ \\<^sub>s) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ w\<^sub>s] \ (r \ s \ s\<^sub>0 \ \\<^sub>t)" using assoc_naturality comp_assoc by (metis \cod \\<^sub>s = u\ \dom \\<^sub>s = s\<^sub>0 \ w\<^sub>s\ \trg \\<^sub>s = src s\ \.base_simps(2-4) \.base_simps(2-4) arrI assoc'_naturality composable w\<^sub>s\\<^sub>s\\<^sub>s) also have "... = (((r \ s) \ \\<^sub>s) \ ((r \ s) \ s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w]" proof - have "\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ w\<^sub>s] \ (r \ s \ s\<^sub>0 \ \\<^sub>t) = ((r \ s) \ s\<^sub>0 \ \\<^sub>t) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w]" using arrI hseq_char assoc'_naturality [of r s "s\<^sub>0 \ \\<^sub>t"] \cod \\<^sub>t = w\<^sub>s\ composable by auto thus ?thesis using comp_assoc by auto qed also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w]" using \_def \ whisker_left by (metis (full_types) arrI cod_comp ide_base seqE seqI) finally show ?thesis by simp qed thus ?thesis using comp_assoc by presburger qed also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ ((r \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ \[s \ s\<^sub>0, p\<^sub>0, w] \ ((\ \ p\<^sub>0) \ w) \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w])) \ \[r, r\<^sub>0, p\<^sub>1 \ w] \ (\ \ p\<^sub>1 \ w) \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" proof - have "(\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] = \[s \ s\<^sub>0, p\<^sub>0, w] \ ((\ \ p\<^sub>0) \ w)" using assoc_naturality [of \ p\<^sub>0 w] by (simp add: w\\<^sub>t\\<^sub>t) thus ?thesis using comp_assoc by presburger qed also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (r \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ (r \ (\ \ p\<^sub>0) \ w) \ (r \ r\<^sub>0s\<^sub>1.\ \ w) \ ((r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w]) \ (\ \ p\<^sub>1 \ w) \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" using r\<^sub>0s\<^sub>1.p\<^sub>1_simps w\\<^sub>t\\<^sub>t whisker_left comp_assoc by force also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (r \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ (r \ (\ \ p\<^sub>0) \ w) \ (r \ r\<^sub>0s\<^sub>1.\ \ w) \ (\[r, r\<^sub>0 \ p\<^sub>1, w] \ (\[r, r\<^sub>0, p\<^sub>1] \ w) \ (\\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w]) \ (\ \ p\<^sub>1 \ w)) \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" proof - have "(r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w] = \[r, r\<^sub>0 \ p\<^sub>1, w] \ (\[r, r\<^sub>0, p\<^sub>1] \ w) \ \\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w]" proof - have 1: "(r \ \[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0 \ p\<^sub>1, w] \ (\[r, r\<^sub>0, p\<^sub>1] \ w) = \[r, r\<^sub>0, p\<^sub>1 \ w] \ \[r \ r\<^sub>0, p\<^sub>1, w]" using pentagon by (simp add: \.T0.antipar(1) w) moreover have 2: "seq \[r, r\<^sub>0, p\<^sub>1 \ w] \[r \ r\<^sub>0, p\<^sub>1, w]" using \.T0.antipar(1) w by simp moreover have "inv (r \ \[r\<^sub>0, p\<^sub>1, w]) = r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using \.T0.antipar(1) w by simp ultimately have "\[r, r\<^sub>0 \ p\<^sub>1, w] \ (\[r, r\<^sub>0, p\<^sub>1] \ w) = ((r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w]) \ \[r \ r\<^sub>0, p\<^sub>1, w]" using \.T0.antipar(1) w comp_assoc invert_side_of_triangle(1) [of "\[r, r\<^sub>0, p\<^sub>1 \ w] \ \[r \ r\<^sub>0, p\<^sub>1, w]" "r \ \[r\<^sub>0, p\<^sub>1, w]" "\[r, r\<^sub>0 \ p\<^sub>1, w] \ (\[r, r\<^sub>0, p\<^sub>1] \ w)"] by simp hence "(r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w] = (\[r, r\<^sub>0 \ p\<^sub>1, w] \ (\[r, r\<^sub>0, p\<^sub>1] \ w)) \ \\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w]" using \.T0.antipar(1) w invert_side_of_triangle(2) [of "\[r, r\<^sub>0 \ p\<^sub>1, w] \ (\[r, r\<^sub>0, p\<^sub>1] \ w)" "(r \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]) \ \[r, r\<^sub>0, p\<^sub>1 \ w]" "\[r \ r\<^sub>0, p\<^sub>1, w]"] using \trg w = src p\<^sub>0\ by simp thus ?thesis using comp_assoc by presburger qed thus ?thesis using comp_assoc by presburger qed also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (r \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ (r \ (\ \ p\<^sub>0) \ w) \ ((r \ r\<^sub>0s\<^sub>1.\ \ w) \ \[r, r\<^sub>0 \ p\<^sub>1, w]) \ (\[r, r\<^sub>0, p\<^sub>1] \ w) \ ((\ \ p\<^sub>1) \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" proof - have "\\<^sup>-\<^sup>1[r \ r\<^sub>0, p\<^sub>1, w] \ (\ \ p\<^sub>1 \ w) = ((\ \ p\<^sub>1) \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using assoc'_naturality [of \ p\<^sub>1 w] by (simp add: \.T0.antipar(1) w\\<^sub>t\\<^sub>t) thus ?thesis using comp_assoc by presburger qed also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (r \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ ((r \ (\ \ p\<^sub>0) \ w) \ \[r, s\<^sub>1 \ p\<^sub>0, w]) \ ((r \ r\<^sub>0s\<^sub>1.\) \ w) \ (\[r, r\<^sub>0, p\<^sub>1] \ w) \ ((\ \ p\<^sub>1) \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" proof - have "(r \ r\<^sub>0s\<^sub>1.\ \ w) \ \[r, r\<^sub>0 \ p\<^sub>1, w] = \[r, s\<^sub>1 \ p\<^sub>0, w] \ ((r \ r\<^sub>0s\<^sub>1.\) \ w)" using assoc_naturality [of r r\<^sub>0s\<^sub>1.\ w] r\<^sub>0s\<^sub>1.cospan w\\<^sub>t\\<^sub>t by auto thus ?thesis using comp_assoc by presburger qed also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (r \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ \[r, (s \ s\<^sub>0) \ p\<^sub>0, w] \ (((r \ \ \ p\<^sub>0) \ w) \ ((r \ r\<^sub>0s\<^sub>1.\) \ w) \ (\[r, r\<^sub>0, p\<^sub>1] \ w) \ ((\ \ p\<^sub>1) \ w)) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" proof - have "(r \ (\ \ p\<^sub>0) \ w) \ \[r, s\<^sub>1 \ p\<^sub>0, w] = \[r, (s \ s\<^sub>0) \ p\<^sub>0, w] \ ((r \ \ \ p\<^sub>0) \ w)" proof - have "arr w \ dom w = w \ cod w = w" using ide_char w by blast then show ?thesis using assoc_naturality [of r "\ \ p\<^sub>0" w] composable by auto qed thus ?thesis using comp_assoc by presburger qed also have "... = ((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (r \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ \[r, (s \ s\<^sub>0) \ p\<^sub>0, w] \ ((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ w) \ (\[r, s, s\<^sub>0 \ p\<^sub>0] \ w)) \ (tab \ w) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] \ (r\<^sub>1 \ \\<^sub>t) \ \\<^sub>r" proof - have "((r \ \ \ p\<^sub>0) \ w) \ ((r \ r\<^sub>0s\<^sub>1.\) \ w) \ (\[r, r\<^sub>0, p\<^sub>1] \ w) \ ((\ \ p\<^sub>1) \ w) = (r \ \ \ p\<^sub>0) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, p\<^sub>1] \ (\ \ p\<^sub>1) \ w" using w \.T0.antipar(1) composable whisker_right by auto also have "... = (((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ (\[r, s, s\<^sub>0 \ p\<^sub>0] \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0]) \ (r \ \[s, s\<^sub>0, p\<^sub>0])) \ (r \ \ \ p\<^sub>0)) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, p\<^sub>1] \ (\ \ p\<^sub>1) \ w" proof - have "((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ (\[r, s, s\<^sub>0 \ p\<^sub>0] \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0]) \ (r \ \[s, s\<^sub>0, p\<^sub>0])) \ (r \ \ \ p\<^sub>0) = r \ \ \ p\<^sub>0" proof - have "((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ (\[r, s, s\<^sub>0 \ p\<^sub>0] \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0]) \ (r \ \[s, s\<^sub>0, p\<^sub>0])) \ (r \ \ \ p\<^sub>0) = ((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ ((r \ s \ s\<^sub>0 \ p\<^sub>0) \ (r \ \[s, s\<^sub>0, p\<^sub>0]))) \ (r \ \ \ p\<^sub>0)" using comp_assoc_assoc' by (simp add: composable) also have "... = ((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ (r \ \[s, s\<^sub>0, p\<^sub>0])) \ (r \ \ \ p\<^sub>0)" using comp_cod_arr by (simp add: composable) also have "... = ((r \ (s \ s\<^sub>0) \ p\<^sub>0)) \ (r \ \ \ p\<^sub>0)" using whisker_left comp_assoc_assoc' assoc_in_hom hseqI' by (metis \.ide_base \.base_simps(2) \.ide_base \.ide_leg0 \.leg0_simps(2-3) \.leg1_simps(3) r\<^sub>0s\<^sub>1.ide_leg0 r\<^sub>0s\<^sub>1.leg0_simps(2) r\<^sub>0s\<^sub>1.p\<^sub>0_simps hcomp_simps(1)) also have "... = r \ \ \ p\<^sub>0" using comp_cod_arr by (simp add: composable) finally show ?thesis by blast qed thus ?thesis by simp qed also have "... = (r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ \[r, s, s\<^sub>0 \ p\<^sub>0] \ (\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0]) \ (r \ \[s, s\<^sub>0, p\<^sub>0]) \ (r \ \ \ p\<^sub>0) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, p\<^sub>1] \ (\ \ p\<^sub>1) \ w" using comp_assoc by presburger also have "... = (r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ \[r, s, s\<^sub>0 \ p\<^sub>0] \ tab \ w" using tab_def by simp also have "... = ((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ w) \ (\[r, s, s\<^sub>0 \ p\<^sub>0] \ w) \ (tab \ w)" using w \.T0.antipar(1) composable comp_assoc whisker_right by auto finally have "((r \ \ \ p\<^sub>0) \ w) \ ((r \ r\<^sub>0s\<^sub>1.\) \ w) \ (\[r, r\<^sub>0, p\<^sub>1] \ w) \ ((\ \ p\<^sub>1) \ w) = ((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ w) \ (\[r, s, s\<^sub>0 \ p\<^sub>0] \ w) \ (tab \ w)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ ((r \ s) \ \[s\<^sub>0, p\<^sub>0, w])) \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (tab \ w) \ \" proof - have "\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (r \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ \[r, (s \ s\<^sub>0) \ p\<^sub>0, w] \ ((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ w) \ (\[r, s, s\<^sub>0 \ p\<^sub>0] \ w) = ((r \ s) \ \[s\<^sub>0, p\<^sub>0, w]) \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w]" proof - have "\\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ p\<^sub>0 \ w] \ (r \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (r \ \[s \ s\<^sub>0, p\<^sub>0, w]) \ \[r, (s \ s\<^sub>0) \ p\<^sub>0, w] \ ((r \ \\<^sup>-\<^sup>1[s, s\<^sub>0, p\<^sub>0]) \ w) \ (\[r, s, s\<^sub>0 \ p\<^sub>0] \ w) = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\r\<^bold>\, \<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\r\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\\<^bold>]) \<^bold>\ (\<^bold>\r\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\s\<^bold>\ \<^bold>\ \<^bold>\s\<^sub>0\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\r\<^bold>\, (\<^bold>\s\<^bold>\ \<^bold>\ \<^bold>\s\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>] \<^bold>\ ((\<^bold>\r\<^bold>\ \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\w\<^bold>\) \<^bold>\ (\<^bold>\\<^bold>[\<^bold>\r\<^bold>\, \<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\w\<^bold>\)\" using w comp_assoc \'_def \_def composable by simp also have "... = \((\<^bold>\r\<^bold>\ \<^bold>\ \<^bold>\s\<^bold>\) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\s\<^sub>0\<^bold>\, \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\r\<^bold>\ \<^bold>\ \<^bold>\s\<^bold>\, \<^bold>\s\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\p\<^sub>0\<^bold>\, \<^bold>\w\<^bold>\\<^bold>]\" using w composable apply (intro E.eval_eqI) by simp_all also have "... = ((r \ s) \ \[s\<^sub>0, p\<^sub>0, w]) \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w]" using w comp_assoc \'_def \_def composable by simp finally show ?thesis by simp qed thus ?thesis using \_def comp_assoc by simp qed also have "... = ((r \ s) \ \) \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (tab \ w) \ \" proof - have "((r \ s) \ \\<^sub>s \ (s\<^sub>0 \ \\<^sub>t)) \ ((r \ s) \ \[s\<^sub>0, p\<^sub>0, w]) = (r \ s) \ \" using \_def w whisker_left composable by (metis \ arrI ide_base comp_assoc) thus ?thesis using comp_assoc by presburger qed finally show "((r \ s) \ \) \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w] \ (tab \ w) \ \ = \" by simp qed thus "\w \ \. ide w \ \\ : (s\<^sub>0 \ p\<^sub>0) \ w \ u\ \ \\ : dom \ \ (r\<^sub>1 \ p\<^sub>1) \ w\ \ iso \ \ composite_cell w \ \ \ = \" using w\\<^sub>t\\<^sub>t \ \ iso_\ comp_assoc by metis qed show "\u w w' \ \' \. \ ide w; ide w'; \\ : (s\<^sub>0 \ p\<^sub>0) \ w \ u\; \\' : (s\<^sub>0 \ p\<^sub>0) \ w' \ u\; \\ : (r\<^sub>1 \ p\<^sub>1) \ w \ (r\<^sub>1 \ p\<^sub>1) \ w'\; composite_cell w \ = composite_cell w' \' \ \ \ \ \!\. \\ : w \ w'\ \ \ = (r\<^sub>1 \ p\<^sub>1) \ \ \ \ = \' \ ((s\<^sub>0 \ p\<^sub>0) \ \)" proof - fix u w w' \ \' \ assume w: "ide w" assume w': "ide w'" assume \: "\\ : (s\<^sub>0 \ p\<^sub>0) \ w \ u\" assume \': "\\' : (s\<^sub>0 \ p\<^sub>0) \ w' \ u\" assume \: "\\ : (r\<^sub>1 \ p\<^sub>1) \ w \ (r\<^sub>1 \ p\<^sub>1) \ w'\" assume eq: "composite_cell w \ = composite_cell w' \' \ \" interpret uw\w'\'\: uw\w'\'\ V H \ \ src trg \r \ s\ tab \s\<^sub>0 \ p\<^sub>0\ \r\<^sub>1 \ p\<^sub>1\ u w \ w' \' \ using w w' \ \' \ eq composable tab_in_hom comp_assoc by unfold_locales auto text \ $$ \begin{array}{ll} \xymatrix{ && X \ar[d]_{w'} \xtwocell[ddl]{}\omit{^{\beta}} \ar@/ul20pt/[dddll]_<>(0.25){w}|<>(0.33)@ {>}_<>(0.5){p_1}|<>(0.67)@ {>}_<>(0.75){r_1} \ar@/ur20pt/[dddrr]^{u} \xtwocell[ddr]{}\omit{^{\theta'}}\\ && {\rm src}~\phi \ar[dl]^{p_1} \ar[dr]_{p_0} \ddtwocell\omit{^\phi} \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^\sigma}\\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } \\ \hspace{5cm} = \qquad \xy/50pt/ \xymatrix{ && X \ar[d]_{w} \ar@/ur20pt/[dddrr]^{u} \xtwocell[ddr]{}\omit{^{\theta}}\\ && {\rm src}~\phi \ar[dl]^{p_1} \ar[dr]_{p_0} \ddtwocell\omit{^\phi} \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^\sigma}\\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } \endxy \end{array} $$ \ text \ First apply property \\.T2\ using \\\\<^sub>r : r\<^sub>1 \ p\<^sub>1 \ w \ r\<^sub>1 \ p\<^sub>1 \ w'\\ (obtained by composing \\\ with associativities) and ``everything to the right'' as \\\<^sub>r\ and \\\<^sub>r'\. This yields \\\\<^sub>r : p\<^sub>1 \ w \ p\<^sub>1 \ w'\\. Next, apply property \\.T2\ to obtain \\\\<^sub>s : p\<^sub>0 \ w \ p\<^sub>0 \ w'\\. For this use \\\\<^sub>s : s\<^sub>0 \ p\<^sub>0 \ w \ u\\ and \\\\<^sub>s' : s\<^sub>0 \ p\<^sub>0 \ w'\\ obtained by composing \\\ and \\'\ with associativities. We also need \\\\<^sub>s : s\<^sub>1 \ p\<^sub>0 \ w \ s\<^sub>1 \ p\<^sub>0 \ w'\\. To get this, transport \r\<^sub>0 \ \\<^sub>r\ across \\\; we need \\\ to be an isomorphism in order to do this. Finally, apply the biuniversal property of \\\ to get \\\ : w \ w'\\ and verify the required equation. \ let ?w\<^sub>r = "p\<^sub>1 \ w" have w\<^sub>r: "ide ?w\<^sub>r" by simp let ?w\<^sub>r' = "p\<^sub>1 \ w'" have w\<^sub>r': "ide ?w\<^sub>r'" by simp define \\<^sub>r where "\\<^sub>r = (s \ \) \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" have \\<^sub>r: "\\\<^sub>r : r\<^sub>0 \ ?w\<^sub>r \ s \ u\" unfolding \\<^sub>r_def using \.T0.antipar(1) by fastforce define \\<^sub>r' where "\\<^sub>r' = (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \[s, s\<^sub>0, p\<^sub>0 \ w'] \ (\ \ p\<^sub>0 \ w') \ \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w']" have \\<^sub>r': "\\\<^sub>r' : r\<^sub>0 \ ?w\<^sub>r' \ s \ u\" unfolding \\<^sub>r'_def using \.T0.antipar(1) by fastforce define \\<^sub>r where "\\<^sub>r = \[r\<^sub>1, p\<^sub>1, w'] \ \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" have \\<^sub>r: "\\\<^sub>r : r\<^sub>1 \ ?w\<^sub>r \ r\<^sub>1 \ ?w\<^sub>r'\" unfolding \\<^sub>r_def using \.T0.antipar(1) by force have eq\<^sub>r: "\.composite_cell ?w\<^sub>r \\<^sub>r = \.composite_cell ?w\<^sub>r' \\<^sub>r' \ \\<^sub>r" text \ $$ \begin{array}{ll} \xymatrix{ && X \ar[ddl]^{w_r'} \xtwocell[dddll]{}\omit{^<2>{\beta_r}} \ar@/ul20pt/[dddll]_<>(0.33){w_r}|<>(0.67)@ {>}_<>(0.75){r_1} \ar@/ur20pt/[dddrr]^{u} \xtwocell[dddr]{}\omit{^{\theta_r'}}\\ && \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && \\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } \\ \hspace{5cm} =\qquad \xy/50pt/ \xymatrix{ && X \ar[ddl]^{w_r} \ar@/ur20pt/[dddrr]^{u} \xtwocell[dddr]{}\omit{^{\theta_r}}\\ && \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \dtwocell\omit{^\rho} && \\ {\rm trg}~r && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} && {\rm src}~s \ar[ll]^{s} } \endxy \end{array} $$ \ proof - have "\.composite_cell ?w\<^sub>r \\<^sub>r = \[r, s, u] \ composite_cell w \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using \\<^sub>r_def technical uw\w'\'\.uw\.uw\ by blast also have "... = \[r, s, u] \ (((r \ s) \ \') \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w'] \ (tab \ w') \ \) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using eq comp_assoc by simp also have "... = (r \ \\<^sub>r') \ \[r, r\<^sub>0, ?w\<^sub>r'] \ (\ \ ?w\<^sub>r') \ \\<^sub>r" proof - have "\[r, s, u] \ (composite_cell w' \' \ \) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] = \[r, s, u] \ composite_cell w' \' \ \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using comp_assoc by presburger also have "... = (r \ (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \[s, s\<^sub>0, p\<^sub>0 \ w'] \ (\ \ p\<^sub>0 \ w') \ \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w']) \ \[r, r\<^sub>0, p\<^sub>1 \ w'] \ (\ \ p\<^sub>1 \ w') \ \[r\<^sub>1, p\<^sub>1, w'] \ \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" proof - have "\[r, s, u] \ composite_cell w' \' \ \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] = \[r, s, u] \ composite_cell w' \' \ ((\\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ \[r\<^sub>1, p\<^sub>1, w']) \ \) \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" proof - have "(\\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ \[r\<^sub>1, p\<^sub>1, w']) \ \ = \" using comp_cod_arr \.T0.antipar(1) \ comp_assoc_assoc' by simp thus ?thesis by argo qed also have "... = (\[r, s, u] \ ((r \ s) \ \') \ \[r \ s, s\<^sub>0 \ p\<^sub>0, w'] \ (tab \ w') \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w']) \ \[r\<^sub>1, p\<^sub>1, w'] \ \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using comp_assoc by presburger also have "... = ((r \ (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \[s, s\<^sub>0, p\<^sub>0 \ w'] \ (\ \ p\<^sub>0 \ w') \ \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w']) \ \[r, r\<^sub>0, p\<^sub>1 \ w'] \ (\ \ p\<^sub>1 \ w')) \ \[r\<^sub>1, p\<^sub>1, w'] \ \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using \\<^sub>r'_def technical [of w' \' u ?w\<^sub>r' \\<^sub>r'] comp_assoc by fastforce finally show ?thesis using comp_assoc by simp qed finally show ?thesis using \\<^sub>r'_def \\<^sub>r_def comp_assoc by auto qed finally show ?thesis using comp_assoc by presburger qed have 1: "\!\. \\ : ?w\<^sub>r \ ?w\<^sub>r'\ \ \\<^sub>r = \\<^sub>r' \ (r\<^sub>0 \ \) \ \\<^sub>r = r\<^sub>1 \ \" using eq\<^sub>r \.T2 [of ?w\<^sub>r ?w\<^sub>r' \\<^sub>r "s \ u" \\<^sub>r' \\<^sub>r] w\<^sub>r w\<^sub>r' \\<^sub>r \\<^sub>r' \\<^sub>r by blast obtain \\<^sub>r where \\<^sub>r: "\\\<^sub>r : ?w\<^sub>r \ ?w\<^sub>r'\ \ \\<^sub>r = \\<^sub>r' \ (r\<^sub>0 \ \\<^sub>r) \ \\<^sub>r = r\<^sub>1 \ \\<^sub>r" using 1 by blast let ?w\<^sub>s = "p\<^sub>0 \ w" have w\<^sub>s: "ide ?w\<^sub>s" by simp let ?w\<^sub>s' = "p\<^sub>0 \ w'" have w\<^sub>s': "ide ?w\<^sub>s'" by simp define \\<^sub>s where "\\<^sub>s = \ \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]" have \\<^sub>s: "\\\<^sub>s : s\<^sub>0 \ p\<^sub>0 \ w \ u\" using \\<^sub>s_def by auto define \\<^sub>s' where "\\<^sub>s' = \' \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']" have \\<^sub>s': "\\\<^sub>s' : s\<^sub>0 \ p\<^sub>0 \ w' \ u\" using \\<^sub>s'_def by auto define \\<^sub>s where "\\<^sub>s = \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ \\<^sub>r) \ \[r\<^sub>0, p\<^sub>1, w] \ (inv r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" have \\<^sub>s: "\\\<^sub>s : s\<^sub>1 \ ?w\<^sub>s \ s\<^sub>1 \ ?w\<^sub>s'\" unfolding \\<^sub>s_def using \\<^sub>r r\<^sub>0s\<^sub>1.\_in_hom(2) r\<^sub>0s\<^sub>1.\_uniqueness(2) \.T0.antipar(1) apply (intro comp_in_homI) apply auto by auto have eq\<^sub>s: "\.composite_cell (p\<^sub>0 \ w) (\ \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) = \.composite_cell (p\<^sub>0 \ w') (\' \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \\<^sub>s" text \ $$ \begin{array}{ll} \xy/67pt/ \xymatrix{ && X \ar[d]^{w'} \ar@/l10pt/[dl]_{w} \ddltwocell\omit{^{\gamma_r}} \ar@/ur20pt/[dddrr]^{u} \xtwocell[ddr]{}\omit{^{\theta_s'}}\\ & {\rm src}~\phi \ar[dr]_{p_1} \ar[d]_{p_0} & {\rm src}~\phi \ar[d]^{p_1} \ar[dr]_{p_0} \ddrtwocell\omit{^\phi} \xtwocell[ddl]{}\omit{^\;\;\;\;\phi^{-1}} \\ & {\rm src}~\sigma \ar[dr]_{s_1} & {\rm src}~\rho \ar[d]^{r_0} & {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^\sigma}\\ && {\rm src}~r = {\rm trg}~s && {\rm src}~s \ar[ll]^{s} } \endxy \\ \hspace{5cm}= \xy/50pt/ \xymatrix{ & X \ar@/dl15pt/[ddr]_<>(0.5){w_s} \ar@/ur20pt/[dddrr]^{u} \xtwocell[ddr]{}\omit{^{\theta_s}}\\ & \\ && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^\sigma}\\ & {\rm src}~r = {\rm trg}~s && {\rm src}~s \ar[ll]^{s} } \endxy \end{array} $$ \ proof - have "\.composite_cell (p\<^sub>0 \ w') (\' \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \\<^sub>s = (\\<^sub>r' \ (r\<^sub>0 \ \\<^sub>r)) \ \[r\<^sub>0, p\<^sub>1, w] \ (inv r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" using \\<^sub>s_def \\<^sub>r'_def whisker_left comp_assoc by simp also have "... = \\<^sub>r \ \[r\<^sub>0, p\<^sub>1, w] \ (inv r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" using \\<^sub>r by simp also have "... = ((s \ \) \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w])) \ \[s, s\<^sub>0, ?w\<^sub>s] \ (\ \ ?w\<^sub>s) \ \[s\<^sub>1, p\<^sub>0, w] \ ((r\<^sub>0s\<^sub>1.\ \ w) \ (\\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ \[r\<^sub>0, p\<^sub>1, w]) \ (inv r\<^sub>0s\<^sub>1.\ \ w)) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" using \\<^sub>r_def comp_assoc by simp also have "... = (s \ \) \ \.composite_cell (p\<^sub>0 \ w) \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]" proof - have "(\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ ((r\<^sub>0s\<^sub>1.\ \ w) \ (\\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ \[r\<^sub>0, p\<^sub>1, w]) \ (inv r\<^sub>0s\<^sub>1.\ \ w)) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w] = \ \ p\<^sub>0 \ w" proof - have "\\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ \[r\<^sub>0, p\<^sub>1, w] = cod (inv r\<^sub>0s\<^sub>1.\ \ w)" using r\<^sub>0s\<^sub>1.\_uniqueness(2) \.T0.antipar(1) comp_assoc_assoc' by simp text \Here the fact that \\\ is a retraction is used.\ moreover have "(r\<^sub>0s\<^sub>1.\ \ w) \ (inv r\<^sub>0s\<^sub>1.\ \ w) = cod \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" using r\<^sub>0s\<^sub>1.\_uniqueness(2) comp_arr_inv' whisker_right [of w r\<^sub>0s\<^sub>1.\ "inv r\<^sub>0s\<^sub>1.\"] by simp moreover have "\[s\<^sub>1, p\<^sub>0, w] \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w] = dom (\ \ p\<^sub>0 \ w)" using r\<^sub>0s\<^sub>1.base_simps(2) hseq_char comp_assoc_assoc' by auto moreover have "hseq (inv r\<^sub>0s\<^sub>1.\) w" using r\<^sub>0s\<^sub>1.\_uniqueness(2) by (intro hseqI, auto) moreover have "hseq \ (p\<^sub>0 \ w)" by (intro hseqI, auto) ultimately show ?thesis using comp_arr_dom comp_cod_arr by simp qed thus ?thesis using comp_assoc by simp qed also have "... = \.composite_cell (p\<^sub>0 \ w) (\ \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w])" using \\<^sub>s_def whisker_left by (metis \.ide_base \\<^sub>s arrI comp_assoc) finally show ?thesis by simp qed hence 2: "\!\. \\ : ?w\<^sub>s \ ?w\<^sub>s'\ \ \\<^sub>s = \\<^sub>s' \ (s\<^sub>0 \ \) \ \\<^sub>s = s\<^sub>1 \ \" using \.T2 [of ?w\<^sub>s ?w\<^sub>s' \\<^sub>s u \\<^sub>s' \\<^sub>s] w\<^sub>s w\<^sub>s' \\<^sub>s \\<^sub>s' \\<^sub>s by (metis \\<^sub>s'_def \\<^sub>s_def) obtain \\<^sub>s where \\<^sub>s: "\\\<^sub>s : ?w\<^sub>s \ ?w\<^sub>s'\ \ \\<^sub>s = \\<^sub>s' \ (s\<^sub>0 \ \\<^sub>s) \ \\<^sub>s = s\<^sub>1 \ \\<^sub>s" using 2 by blast have eq\<^sub>t: "(s\<^sub>1 \ \\<^sub>s) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] = (s\<^sub>1 \ ?w\<^sub>s') \ \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ \\<^sub>r)" text \ $$ \xy/78pt/ \xymatrix{ & X \ar[d]^{w'} \ar@/ul15pt/[ddl]_{w_r} \xtwocell[ddl]{}\omit{^{\gamma_r}} \\ & {\rm src}~\phi \ar[dl]_{p_1} \ar[dr]^{p_0} \ddtwocell\omit{^\phi} \\ {\rm src}~\rho \ar[dr]^{r_0} && {\rm src}~\sigma \ar[dl]_{s_1} \\ & {\rm src}~r = {\rm trg}~s & } \endxy \qquad = \qquad \xy/78pt/ \xymatrix{ & X \ar[d]^{w} \ar@/ur15pt/[ddr]^{w_s'} \xtwocell[ddr]{}\omit{^{\gamma_s}} \\ & {\rm src}~\phi \ar[dl]_{p_1} \ar[dr]^{p_0} \ddtwocell\omit{^\phi} \\ {\rm src}~\rho \ar[dr]^{r_0} && {\rm src}~\sigma \ar[dl]_{s_1} \\ & {\rm src}~r = {\rm trg}~s & } \endxy $$ \ proof - have "(s\<^sub>1 \ ?w\<^sub>s') \ \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ \\<^sub>r) = \\<^sub>s \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" proof - have "\\<^sub>s \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] = (\[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w']) \ (r\<^sub>0 \ \\<^sub>r) \ \[r\<^sub>0, p\<^sub>1, w] \ ((inv r\<^sub>0s\<^sub>1.\ \ w) \ (\\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w] \ \[s\<^sub>1, p\<^sub>0, w]) \ (r\<^sub>0s\<^sub>1.\ \ w)) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using \\<^sub>s_def comp_assoc by metis also have "... = (\[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w']) \ (r\<^sub>0 \ \\<^sub>r)" proof - have "(r\<^sub>0 \ \\<^sub>r) \ \[r\<^sub>0, p\<^sub>1, w] \ ((inv r\<^sub>0s\<^sub>1.\ \ w) \ (\\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w] \ \[s\<^sub>1, p\<^sub>0, w]) \ (r\<^sub>0s\<^sub>1.\ \ w)) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] = r\<^sub>0 \ \\<^sub>r" proof - have "(r\<^sub>0 \ \\<^sub>r) \ \[r\<^sub>0, p\<^sub>1, w] \ ((inv r\<^sub>0s\<^sub>1.\ \ w) \ (\\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w] \ \[s\<^sub>1, p\<^sub>0, w]) \ (r\<^sub>0s\<^sub>1.\ \ w)) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] = (r\<^sub>0 \ \\<^sub>r) \ \[r\<^sub>0, p\<^sub>1, w] \ ((inv r\<^sub>0s\<^sub>1.\ \ w) \ (r\<^sub>0s\<^sub>1.\ \ w)) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using r\<^sub>0s\<^sub>1.\_uniqueness(2) comp_assoc_assoc' comp_cod_arr by simp (* Used here that \ is a section. *) also have "... = (r\<^sub>0 \ \\<^sub>r) \ \[r\<^sub>0, p\<^sub>1, w] \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using r\<^sub>0s\<^sub>1.\_uniqueness(2) comp_inv_arr' \.T0.antipar(1) whisker_right [of w "inv r\<^sub>0s\<^sub>1.\" r\<^sub>0s\<^sub>1.\] comp_cod_arr by simp also have "... = r\<^sub>0 \ \\<^sub>r" proof - have "hseq r\<^sub>0 \\<^sub>r" using \\<^sub>s \\<^sub>s_def by blast thus ?thesis using comp_assoc_assoc' comp_arr_dom by (metis (no_types) \\<^sub>r \.ide_leg0 comp_assoc_assoc'(1) hcomp_simps(3) hseq_char ide_char in_homE r\<^sub>0s\<^sub>1.ide_leg1 r\<^sub>0s\<^sub>1.p\<^sub>1_simps w w\<^sub>r) qed finally show ?thesis by blast qed thus ?thesis by simp qed also have "... = \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ \\<^sub>r)" using comp_assoc by presburger also have "... = (s\<^sub>1 \ ?w\<^sub>s') \ \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ \\<^sub>r)" proof - have "(s\<^sub>1 \ ?w\<^sub>s') \ \[s\<^sub>1, p\<^sub>0, w'] = \[s\<^sub>1, p\<^sub>0, w']" using comp_cod_arr by simp thus ?thesis using comp_assoc by metis qed finally show ?thesis by simp qed also have "... = (s\<^sub>1 \ \\<^sub>s) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using \\<^sub>s by simp finally show ?thesis by simp qed have 3: "\!\. \\ : w \ w'\ \ \\<^sub>s = (p\<^sub>0 \ w') \ (p\<^sub>0 \ \) \ p\<^sub>1 \ \ = \\<^sub>r" using w w' w\<^sub>s' w\<^sub>r \\<^sub>r \\<^sub>s eq\<^sub>t r\<^sub>0s\<^sub>1.\_biuniversal_prop(2) [of ?w\<^sub>s' ?w\<^sub>r w w' \\<^sub>s "p\<^sub>0 \ w'" \\<^sub>r] by blast obtain \ where \: "\\ : w \ w'\ \ \\<^sub>s = (p\<^sub>0 \ w') \ (p\<^sub>0 \ \) \ p\<^sub>1 \ \ = \\<^sub>r" using 3 by blast show "\!\. \\ : w \ w'\ \ \ = (r\<^sub>1 \ p\<^sub>1) \ \ \ \ = \' \ ((s\<^sub>0 \ p\<^sub>0) \ \)" proof - have "\\. \\ : w \ w'\ \ \ = (r\<^sub>1 \ p\<^sub>1) \ \ \ \ = \' \ ((s\<^sub>0 \ p\<^sub>0) \ \)" proof - have "\ = \' \ ((s\<^sub>0 \ p\<^sub>0) \ \)" proof - have "\' \ ((s\<^sub>0 \ p\<^sub>0) \ \) = (\\<^sub>s' \ \[s\<^sub>0, p\<^sub>0, w']) \ ((s\<^sub>0 \ p\<^sub>0) \ \)" using \\<^sub>s'_def comp_arr_dom comp_assoc comp_assoc_assoc'(2) by auto also have "... = (\\<^sub>s' \ (s\<^sub>0 \ p\<^sub>0 \ \)) \ \[s\<^sub>0, p\<^sub>0, w]" using assoc_naturality [of s\<^sub>0 p\<^sub>0 \] comp_assoc by (metis \ \\<^sub>r \.leg0_simps(4-5) r\<^sub>0s\<^sub>1.leg0_simps(4-5) r\<^sub>0s\<^sub>1.leg1_simps(3) hseqE in_homE leg0_simps(2)) also have "... = \\<^sub>s \ \[s\<^sub>0, p\<^sub>0, w]" by (metis \ \\<^sub>s arrI comp_ide_arr w\<^sub>s') also have "... = \" using \\<^sub>s_def comp_assoc comp_arr_dom comp_assoc_assoc' by simp finally show ?thesis by simp qed moreover have "\ = (r\<^sub>1 \ p\<^sub>1) \ \" proof - have "\ = \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ \\<^sub>r \ \[r\<^sub>1, p\<^sub>1, w]" proof - have "\\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ \\<^sub>r \ \[r\<^sub>1, p\<^sub>1, w] = (\\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ \[r\<^sub>1, p\<^sub>1, w']) \ \ \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w] \ \[r\<^sub>1, p\<^sub>1, w]" using \\<^sub>r_def comp_assoc by simp also have "... = \" using comp_arr_dom comp_cod_arr by (metis \.ide_leg1 r\<^sub>0s\<^sub>1.ide_leg1 comp_assoc_assoc'(2) hseqE ideD(1) uw\w'\'\.\_simps(1) uw\w'\'\.\_simps(4-5) leg1_simps(2) w w' w\<^sub>r w\<^sub>r') finally show ?thesis by simp qed also have "... = \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ (r\<^sub>1 \ \\<^sub>r) \ \[r\<^sub>1, p\<^sub>1, w]" using \\<^sub>r by simp also have "... = \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ \[r\<^sub>1, p\<^sub>1, w'] \ ((r\<^sub>1 \ p\<^sub>1) \ \)" using assoc_naturality [of r\<^sub>1 p\<^sub>1 \] by (metis \ \\<^sub>r \.ide_leg1 r\<^sub>0s\<^sub>1.leg1_simps(5-6) hseqE ide_char in_homE leg1_simps(2)) also have "... = (\\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ \[r\<^sub>1, p\<^sub>1, w']) \ ((r\<^sub>1 \ p\<^sub>1) \ \)" using comp_assoc by presburger also have "... = (r\<^sub>1 \ p\<^sub>1) \ \" using comp_cod_arr by (metis \.ide_leg1 r\<^sub>0s\<^sub>1.ide_leg1 calculation comp_assoc_assoc'(2) comp_ide_arr hseqE ideD(1) ide_cod local.uw\w'\'\.\_simps(1) local.uw\w'\'\.\_simps(5) w' w\<^sub>r') finally show ?thesis by simp qed ultimately show "\\. \\ : w \ w'\ \ \ = (r\<^sub>1 \ p\<^sub>1) \ \ \ \ = \' \ ((s\<^sub>0 \ p\<^sub>0) \ \)" using \ by blast qed moreover have "\\'. \\' : w \ w'\ \ \ = (r\<^sub>1 \ p\<^sub>1) \ \' \ \ = \' \ ((s\<^sub>0 \ p\<^sub>0) \ \') \ \' = \" proof - fix \' assume \': "\\' : w \ w'\ \ \ = (r\<^sub>1 \ p\<^sub>1) \ \' \ \ = \' \ ((s\<^sub>0 \ p\<^sub>0) \ \')" show "\' = \" proof - let ?P\<^sub>r = "\\. \\ : ?w\<^sub>r \ ?w\<^sub>r'\ \ \\<^sub>r = \\<^sub>r' \ (r\<^sub>0 \ \) \ \\<^sub>r = r\<^sub>1 \ \" let ?P\<^sub>s = "\\. \\ : ?w\<^sub>s \ ?w\<^sub>s'\ \ \\<^sub>s = \\<^sub>s' \ (s\<^sub>0 \ \) \ \\<^sub>s = s\<^sub>1 \ \" let ?\\<^sub>r' = "p\<^sub>1 \ \'" let ?\\<^sub>s' = "p\<^sub>0 \ \'" let ?P\<^sub>t = "\\. \\ : w \ w'\ \ \\<^sub>s = (p\<^sub>0 \ w') \ (p\<^sub>0 \ \) \ p\<^sub>1 \ \ = \\<^sub>r" have "hseq p\<^sub>0 \'" proof (intro hseqI) show "\\' : src \ \ src p\<^sub>0\" using \' by (metis hseqE hseqI' in_hhom_def uw\w'\'\.\_simps(1) src_hcomp src_vcomp leg0_simps(2) leg1_simps(3) uw\w'\'\.uw\.\_simps(1) vseq_implies_hpar(1)) show "\p\<^sub>0 : src p\<^sub>0 \ src s\<^sub>0\" by simp qed hence "hseq p\<^sub>1 \'" using hseq_char by simp have "\?\\<^sub>r' : ?w\<^sub>r \ ?w\<^sub>r'\" using \' by auto moreover have "\\<^sub>r = \\<^sub>r' \ (r\<^sub>0 \ ?\\<^sub>r')" proof - text \ Note that @{term \\<^sub>r} is the composite of ``everything to the right'' of @{term "\ \ ?w\<^sub>r"}, and similarly for @{term \\<^sub>r'}. We can factor @{term \\<^sub>r} as @{term "(s \ \) \ X w"}, where @{term "X w"} is a composite of @{term \} and @{term \}. We can similarly factor @{term \\<^sub>r'} as @{term "(s \ \') \ X w'"}. Then @{term "\\<^sub>r' \ (r\<^sub>0 \ ?\\<^sub>r') = (s \ \') \ X w' \ (r\<^sub>0 \ ?\\<^sub>r')"}, which equals @{term "(s \ \') \ (s \ (s\<^sub>0 \ p\<^sub>0) \ ?\\<^sub>r') \ X w = \\<^sub>r"}. \ let ?X = "\w. (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" have "\\<^sub>r' \ (r\<^sub>0 \ ?\\<^sub>r') = (s \ \') \ ?X w' \ (r\<^sub>0 \ ?\\<^sub>r')" using \\<^sub>r'_def comp_assoc by simp also have "... = (s \ \') \ (s \ (s\<^sub>0 \ p\<^sub>0) \ \') \ ?X w" proof - have "(s \ \') \ ((s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \[s, s\<^sub>0, p\<^sub>0 \ w'] \ (\ \ p\<^sub>0 \ w') \ \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w']) \ (r\<^sub>0 \ p\<^sub>1 \ \') = (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \[s, s\<^sub>0, p\<^sub>0 \ w'] \ (\ \ p\<^sub>0 \ w') \ \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ p\<^sub>1 \ \')" using comp_assoc by presburger also have "... = (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \[s, s\<^sub>0, p\<^sub>0 \ w'] \ (\ \ p\<^sub>0 \ w') \ \[s\<^sub>1, p\<^sub>0, w'] \ ((r\<^sub>0s\<^sub>1.\ \ w') \ ((r\<^sub>0 \ p\<^sub>1) \ \')) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using assoc'_naturality [of r\<^sub>0 p\<^sub>1 \'] comp_assoc by (metis \' \\p\<^sub>1 \ \' : p\<^sub>1 \ w \ p\<^sub>1 \ w'\\ \.T0.antipar(1) \.leg0_in_hom(2) r\<^sub>0s\<^sub>1.leg1_simps(4-6) r\<^sub>0s\<^sub>1.base_simps(2) hcomp_in_vhomE in_homE trg_hcomp) also have "... = (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \[s, s\<^sub>0, p\<^sub>0 \ w'] \ (\ \ p\<^sub>0 \ w') \ (\[s\<^sub>1, p\<^sub>0, w'] \ ((s\<^sub>1 \ p\<^sub>0) \ \')) \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" proof - have "(r\<^sub>0s\<^sub>1.\ \ w') \ ((r\<^sub>0 \ p\<^sub>1) \ \') = r\<^sub>0s\<^sub>1.\ \ \'" using \' interchange [of r\<^sub>0s\<^sub>1.\ "r\<^sub>0 \ p\<^sub>1" w' \'] comp_arr_dom comp_cod_arr by auto also have "... = ((s\<^sub>1 \ p\<^sub>0) \ \') \ (r\<^sub>0s\<^sub>1.\ \ w)" using \' interchange \hseq p\<^sub>0 \'\ comp_arr_dom comp_cod_arr by (metis comp_arr_ide r\<^sub>0s\<^sub>1.\_simps(1,5) seqI' uw\w'\'\.uw\.w_in_hom(2) w) finally have "(r\<^sub>0s\<^sub>1.\ \ w') \ ((r\<^sub>0 \ p\<^sub>1) \ \') = ((s\<^sub>1 \ p\<^sub>0) \ \') \ (r\<^sub>0s\<^sub>1.\ \ w)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ \[s, s\<^sub>0, p\<^sub>0 \ w'] \ ((\ \ p\<^sub>0 \ w') \ (s\<^sub>1 \ p\<^sub>0 \ \')) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using \' assoc_naturality [of s\<^sub>1 p\<^sub>0 \'] comp_assoc by (metis \.leg1_simps(2) \.leg1_simps(3,5-6) r\<^sub>0s\<^sub>1.leg0_simps(4-5) hcomp_in_vhomE hseqE in_homE uw\w'\'\.\_simps(1) leg0_in_hom(2) leg1_simps(3)) also have "... = (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ (\[s, s\<^sub>0, p\<^sub>0 \ w'] \ ((s \ s\<^sub>0) \ p\<^sub>0 \ \')) \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" proof - have "(\ \ p\<^sub>0 \ w') \ (s\<^sub>1 \ p\<^sub>0 \ \') = \ \ p\<^sub>0 \ \'" using \' interchange [of \ s\<^sub>1 "p\<^sub>0 \ w'" "p\<^sub>0 \ \'"] whisker_left \hseq p\<^sub>0 \'\comp_arr_dom comp_cod_arr by (metis \.tab_simps(1) \.tab_simps(4) hcomp_simps(4) in_homE r\<^sub>0s\<^sub>1.leg0_simps(5)) also have "... = ((s \ s\<^sub>0) \ p\<^sub>0 \ \') \ (\ \ p\<^sub>0 \ w)" using \' interchange [of "s \ s\<^sub>0" \ "p\<^sub>0 \ \'" "p\<^sub>0 \ w"] whisker_left comp_arr_dom comp_cod_arr \hseq p\<^sub>0 \'\ by (metis \.tab_simps(1) \.tab_simps(5) hcomp_simps(3) in_homE r\<^sub>0s\<^sub>1.leg0_simps(4)) finally have "(\ \ p\<^sub>0 \ w') \ (s\<^sub>1 \ p\<^sub>0 \ \') = ((s \ s\<^sub>0) \ p\<^sub>0 \ \') \ (\ \ p\<^sub>0 \ w)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (s \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ ((s \ s\<^sub>0 \ p\<^sub>0 \ \') \ \[s, s\<^sub>0, p\<^sub>0 \ w]) \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using \' assoc_naturality [of s s\<^sub>0 "p\<^sub>0 \ \'"] \hseq p\<^sub>0 \'\ by force also have "... = (s \ \') \ ((s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ (s \ s\<^sub>0 \ p\<^sub>0 \ \')) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using comp_assoc by presburger also have "... = (s \ \') \ ((s \ (s\<^sub>0 \ p\<^sub>0) \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w])) \ \[s, s\<^sub>0, p\<^sub>0 \ w] \ (\ \ p\<^sub>0 \ w) \ \[s\<^sub>1, p\<^sub>0, w] \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" proof - have "(s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ (s \ s\<^sub>0 \ p\<^sub>0 \ \') = (s \ (s\<^sub>0 \ p\<^sub>0) \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w])" proof - have "(s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w']) \ (s \ s\<^sub>0 \ p\<^sub>0 \ \') = s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w'] \ (s\<^sub>0 \ p\<^sub>0 \ \')" proof - have "seq \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w'] (s\<^sub>0 \ p\<^sub>0 \ \')" proof (* It seems to be too time-consuming for auto to solve these. *) show "\s\<^sub>0 \ p\<^sub>0 \ \' : s\<^sub>0 \ p\<^sub>0 \ w \ s\<^sub>0 \ p\<^sub>0 \ w'\" using \' by (intro hcomp_in_vhom, auto) show "\\\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w'] : s\<^sub>0 \ p\<^sub>0 \ w' \ (s\<^sub>0 \ p\<^sub>0) \ w'\" by auto qed thus ?thesis using w w' \' whisker_left by simp qed also have "... = s \ ((s\<^sub>0 \ p\<^sub>0) \ \') \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]" using \' \hseq p\<^sub>0 \'\ assoc'_naturality [of s\<^sub>0 p\<^sub>0 \'] by fastforce also have "... = (s \ (s\<^sub>0 \ p\<^sub>0) \ \') \ (s \ \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w])" proof - have "seq ((s\<^sub>0 \ p\<^sub>0) \ \') \\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w]" proof (* Same here. *) show "\\\<^sup>-\<^sup>1[s\<^sub>0, p\<^sub>0, w] : s\<^sub>0 \ p\<^sub>0 \ w \ (s\<^sub>0 \ p\<^sub>0) \ w\" by auto show "\(s\<^sub>0 \ p\<^sub>0) \ \' : (s\<^sub>0 \ p\<^sub>0) \ w \ (s\<^sub>0 \ p\<^sub>0) \ w'\" using \' by (intro hcomp_in_vhom, auto) qed thus ?thesis using w w' \' whisker_left by simp qed finally show ?thesis by blast qed thus ?thesis by simp qed also have "... = (s \ \') \ (s \ (s\<^sub>0 \ p\<^sub>0) \ \') \ ?X w" using comp_assoc by presburger finally show ?thesis by simp qed also have "... = \\<^sub>r" using \\<^sub>r_def \' uw\w'\'\.uw\.\_simps(1) whisker_left \.ide_base comp_assoc by simp finally show ?thesis by simp qed moreover have "\\<^sub>r = r\<^sub>1 \ ?\\<^sub>r'" proof - have "\\<^sub>r = \[r\<^sub>1, p\<^sub>1, w'] \ ((r\<^sub>1 \ p\<^sub>1) \ \') \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w]" using \\<^sub>r_def \' by simp also have "... = \[r\<^sub>1, p\<^sub>1, w'] \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w'] \ (r\<^sub>1 \ p\<^sub>1 \ \')" using \' assoc'_naturality by (metis \.leg1_simps(5-6) r\<^sub>0s\<^sub>1.leg1_simps(5-6) hcomp_in_vhomE hseqE in_homE uw\w'\'\.\_simps(1) leg1_in_hom(2)) also have "... = (\[r\<^sub>1, p\<^sub>1, w'] \ \\<^sup>-\<^sup>1[r\<^sub>1, p\<^sub>1, w']) \ (r\<^sub>1 \ p\<^sub>1 \ \')" using comp_assoc by presburger also have "... = r\<^sub>1 \ p\<^sub>1 \ \'" using comp_cod_arr by (metis (no_types, lifting) \\<^sub>r \.ide_leg1 r\<^sub>0s\<^sub>1.ide_leg1 arrI calculation comp_assoc_assoc'(1) comp_ide_arr ide_hcomp hseq_char' ideD(1) seq_if_composable hcomp_simps(2) leg1_simps(2) w' w\<^sub>r') finally show ?thesis by simp qed ultimately have P\<^sub>r': "?P\<^sub>r ?\\<^sub>r'" by simp have eq\<^sub>r: "\\<^sub>r = ?\\<^sub>r'" using 1 \\<^sub>r P\<^sub>r' by blast have "\?\\<^sub>s' : ?w\<^sub>s \ ?w\<^sub>s'\" using \' by auto moreover have "\\<^sub>s = \\<^sub>s' \ (s\<^sub>0 \ ?\\<^sub>s')" using \' \hseq p\<^sub>0 \'\ \.leg0_simps(2,4-5) \.leg1_simps(3) \\<^sub>s'_def \\<^sub>s_def assoc'_naturality hseqE in_homE comp_assoc r\<^sub>0s\<^sub>1.leg0_simps(4-5) r\<^sub>0s\<^sub>1.p\<^sub>0_simps by metis moreover have "\\<^sub>s = s\<^sub>1 \ ?\\<^sub>s'" proof - have "\[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ \\<^sub>r) \ \[r\<^sub>0, p\<^sub>1, w] \ (inv r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w] = \[s\<^sub>1, p\<^sub>0, w'] \ (r\<^sub>0s\<^sub>1.\ \ w') \ (\\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ p\<^sub>1 \ \')) \ \[r\<^sub>0, p\<^sub>1, w] \ (inv r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" using eq\<^sub>r comp_assoc by simp also have "... = \[s\<^sub>1, p\<^sub>0, w'] \ ((r\<^sub>0s\<^sub>1.\ \ w') \ ((r\<^sub>0 \ p\<^sub>1) \ \')) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ \[r\<^sub>0, p\<^sub>1, w] \ (inv r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" proof - have "\\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w'] \ (r\<^sub>0 \ p\<^sub>1 \ \') = ((r\<^sub>0 \ p\<^sub>1) \ \') \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w]" using \' assoc'_naturality \hseq p\<^sub>1 \'\ by (metis \.leg0_simps(2,4-5) \.leg1_simps(3) r\<^sub>0s\<^sub>1.leg1_simps(5-6) hseqE in_homE leg1_simps(2)) thus ?thesis using comp_assoc by presburger qed also have "... = (\[s\<^sub>1, p\<^sub>0, w'] \ ((s\<^sub>1 \ p\<^sub>0) \ \')) \ (r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ \[r\<^sub>0, p\<^sub>1, w] \ (inv r\<^sub>0s\<^sub>1.\ \ w) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" proof - have "(r\<^sub>0s\<^sub>1.\ \ w') \ ((r\<^sub>0 \ p\<^sub>1) \ \') = r\<^sub>0s\<^sub>1.\ \ \'" using \' interchange [of r\<^sub>0s\<^sub>1.\ "r\<^sub>0 \ p\<^sub>1" w' \'] comp_arr_dom comp_cod_arr by auto also have "... = ((s\<^sub>1 \ p\<^sub>0) \ \') \ (r\<^sub>0s\<^sub>1.\ \ w)" using \' interchange \hseq p\<^sub>0 \'\ comp_arr_dom comp_cod_arr by (metis in_homE r\<^sub>0s\<^sub>1.\_simps(1,5)) finally have "(r\<^sub>0s\<^sub>1.\ \ w') \ ((r\<^sub>0 \ p\<^sub>1) \ \') = ((s\<^sub>1 \ p\<^sub>0) \ \') \ (r\<^sub>0s\<^sub>1.\ \ w)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (s\<^sub>1 \ ?\\<^sub>s') \ \[s\<^sub>1, p\<^sub>0, w] \ ((r\<^sub>0s\<^sub>1.\ \ w) \ (\\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ \[r\<^sub>0, p\<^sub>1, w]) \ (inv r\<^sub>0s\<^sub>1.\ \ w)) \ \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" proof - have "\[s\<^sub>1, p\<^sub>0, w'] \ ((s\<^sub>1 \ p\<^sub>0) \ \') = (s\<^sub>1 \ ?\\<^sub>s') \ \[s\<^sub>1, p\<^sub>0, w]" using \' assoc_naturality [of s\<^sub>1 p\<^sub>0 \'] \hseq p\<^sub>0 \'\ by auto thus ?thesis using comp_assoc by presburger qed also have "... = s\<^sub>1 \ ?\\<^sub>s'" proof - have "\\<^sup>-\<^sup>1[r\<^sub>0, p\<^sub>1, w] \ \[r\<^sub>0, p\<^sub>1, w] = cod (inv r\<^sub>0s\<^sub>1.\ \ w)" using r\<^sub>0s\<^sub>1.\_uniqueness(2) \.T0.antipar(1) comp_assoc_assoc' by simp text \Here the fact that \\\ is a retraction is used.\ moreover have "(r\<^sub>0s\<^sub>1.\ \ w) \ (inv r\<^sub>0s\<^sub>1.\ \ w) = cod \\<^sup>-\<^sup>1[s\<^sub>1, p\<^sub>0, w]" using r\<^sub>0s\<^sub>1.\_uniqueness(2) comp_arr_inv' whisker_right [of w r\<^sub>0s\<^sub>1.\ "inv r\<^sub>0s\<^sub>1.\"] by simp moreover have "cod (inv r\<^sub>0s\<^sub>1.\ \ w) \ (inv r\<^sub>0s\<^sub>1.\ \ w) = inv r\<^sub>0s\<^sub>1.\ \ w" using \\<^sub>s_def \\<^sub>s by (meson arrI comp_cod_arr seqE) ultimately show ?thesis using \' \hseq p\<^sub>0 \'\ comp_arr_dom comp_cod_arr comp_assoc_assoc' whisker_left [of s\<^sub>1 "p\<^sub>0 \ \'" "p\<^sub>0 \ w"] whisker_left [of p\<^sub>0] by (metis \.ide_leg1 assoc'_simps(1) hseqE ideD(1) in_homE r\<^sub>0s\<^sub>1.ide_leg0 r\<^sub>0s\<^sub>1.p\<^sub>0_simps w w\<^sub>s) qed finally show ?thesis using \\<^sub>s_def by simp qed ultimately have P\<^sub>s': "?P\<^sub>s ?\\<^sub>s'" by simp have eq\<^sub>s: "\\<^sub>s = ?\\<^sub>s'" using 2 \\<^sub>s P\<^sub>s' by blast have "?P\<^sub>t \'" using \' comp_cod_arr \\p\<^sub>0 \ \' : p\<^sub>0 \ w \ p\<^sub>0 \ w'\\ eq\<^sub>r eq\<^sub>s by auto thus "\' = \" using 3 \ by blast qed qed ultimately show ?thesis by blast qed qed qed end sublocale composite_tabulation_in_maps \ tabulation V H \ \ src trg \r \ s\ tab \s\<^sub>0 \ p\<^sub>0\ \r\<^sub>1 \ p\<^sub>1\ using composite_is_tabulation by simp sublocale composite_tabulation_in_maps \ tabulation_in_maps V H \ \ src trg \r \ s\ tab \s\<^sub>0 \ p\<^sub>0\ \r\<^sub>1 \ p\<^sub>1\ using T0.is_map \.leg1_is_map \.T0.antipar(2) composable \.leg1_is_map \.T0.antipar apply unfold_locales apply simp apply (intro left_adjoints_compose) by auto subsection "The Classifying Category of Maps" text \ \sloppypar We intend to show that if \B\ is a bicategory of spans, then \B\ is biequivalent to \Span(Maps(B))\, for a specific category \Maps(B)\ derived from \B\. The category \Maps(B)\ is constructed in this section as the ``classifying category'' of maps of \B\, which has the same objects as \B\ and which has as 1-cells the isomorphism classes of maps of \B\. We show that, if \B\ is a bicategory of spans, then \Maps(B)\ has pullbacks. \ locale maps_category = B: bicategory_of_spans begin no_notation B.in_hhom ("\_ : _ \ _\") no_notation B.in_hom ("\_ : _ \\<^sub>B _\") notation B.in_hhom ("\_ : _ \\<^sub>B _\") notation B.in_hom ("\_ : _ \\<^sub>B _\") notation B.isomorphic (infix "\\<^sub>B" 50) notation B.iso_class ("\_\\<^sub>B") text \ I attempted to modularize the construction here, by refactoring ``classifying category'' out as a separate locale, but it ended up causing extra work because to apply it we first need to obtain the full sub-bicategory of 2-cells between maps, then construct its classifying category, and then we have to re-prove everything about it, to get rid of any mention of the sub-bicategory construction. So the construction is being done here as a ``one-off'' special case construction, with the necessary properties proved just once. \ text \ The ``hom-categories'' of \Maps(C)\ have as arrows the isomorphism classes of maps of \B\. \ abbreviation Hom where "Hom a b \ {F. \f. \f : a \\<^sub>B b\ \ B.is_left_adjoint f \ F = \f\\<^sub>B}" lemma in_HomD: assumes "F \ Hom a b" shows "F \ {}" and "B.is_iso_class F" and "f \ F \ B.ide f" and "f \ F \ \f : a \\<^sub>B b\" and "f \ F \ B.is_left_adjoint f" and "f \ F \ F = \f\\<^sub>B" proof - show "F \ {}" using assms B.ide_in_iso_class B.left_adjoint_is_ide B.iso_class_is_nonempty by auto show 1: "B.is_iso_class F" using assms B.is_iso_classI B.left_adjoint_is_ide by fastforce show "f \ F \ B.ide f" using assms 1 B.iso_class_memb_is_ide by blast obtain f' where f': "\f' : a \\<^sub>B b\ \ B.is_left_adjoint f' \ F = \f'\\<^sub>B" using assms by auto show "f \ F \ \f : a \\<^sub>B b\" using assms f' B.iso_class_def B.isomorphic_implies_hpar by auto show "f \ F \ B.is_left_adjoint f" using assms f' B.iso_class_def B.left_adjoint_preserved_by_iso [of f'] by auto show "f \ F \ F = \f\\<^sub>B" by (metis B.adjoint_pair_antipar(1) f' B.ide_in_iso_class B.is_iso_classI B.iso_class_elems_isomorphic B.iso_class_eqI) qed definition Comp where "Comp G F \ {h. B.is_iso_class F \ B.is_iso_class G \ (\f g. f \ F \ g \ G \ g \ f \\<^sub>B h)}" lemma in_CompI [intro]: assumes "B.is_iso_class F" and "B.is_iso_class G" and "f \ F" and "g \ G" and "g \ f \\<^sub>B h" shows "h \ Comp G F" unfolding Comp_def using assms by auto lemma in_CompE [elim]: assumes "h \ Comp G F" and "\f g. \ B.is_iso_class F; B.is_iso_class G; f \ F; g \ G; g \ f \\<^sub>B h \ \ T" shows T using assms Comp_def by auto lemma is_iso_class_Comp: assumes "Comp G F \ {}" shows "B.is_iso_class (Comp G F)" proof - obtain h where h: "h \ Comp G F" using assms by auto have ide_h: "B.ide h" using h Comp_def B.isomorphic_implies_hpar(2) by auto obtain f g where fg: "B.is_iso_class F \ B.is_iso_class G \ f \ F \ g \ G \ g \ f \\<^sub>B h" using h Comp_def by auto have "Comp G F = \g \ f\\<^sub>B \ B.ide (g \ f)" proof (intro conjI) show "B.ide (g \ f)" using fg B.iso_class_memb_is_ide B.isomorphic_implies_ide(1) by auto show "Comp G F = \g \ f\\<^sub>B" proof show "\g \ f\\<^sub>B \ Comp G F" unfolding Comp_def B.iso_class_def using fg by auto show "Comp G F \ \g \ f\\<^sub>B" proof fix h' assume h': "h' \ Comp G F" obtain f' g' where f'g': "f' \ F \ g' \ G \ g' \ f' \\<^sub>B h'" using h' Comp_def by auto have 1: "f' \\<^sub>B f \ g' \\<^sub>B g" using f'g' fg B.iso_class_elems_isomorphic by auto moreover have "B.ide f \ B.ide f' \ B.ide g \ B.ide g'" using 1 B.isomorphic_implies_hpar by auto ultimately have "g' \ f' \\<^sub>B g \ f" using f'g' fg B.hcomp_isomorphic_ide B.hcomp_ide_isomorphic B.isomorphic_transitive B.isomorphic_implies_hpar by (meson B.hseqE B.ideD(1)) hence "h' \\<^sub>B g \ f" using f'g' B.isomorphic_symmetric B.isomorphic_transitive by blast thus "h' \ B.iso_class (g \ f)" using B.iso_class_def B.isomorphic_symmetric by simp qed qed qed thus ?thesis using assms B.is_iso_class_def B.ide_in_iso_class by auto qed lemma Comp_is_extensional: assumes "Comp G F \ {}" shows "B.is_iso_class F" and "B.is_iso_class G" and "F \ {}" and "G \ {}" using assms Comp_def by auto lemma Comp_eqI [intro]: assumes "h \ Comp G F" and "h' \ Comp G' F'" and "h \\<^sub>B h'" shows "Comp G F = Comp G' F'" proof - obtain f g where fg: "f \ F \ g \ G \ g \ f \\<^sub>B h" using assms comp_def by auto obtain f' g' where f'g': "f' \ F' \ g' \ G' \ g' \ f' \\<^sub>B h'" using assms by auto have "h \ Comp G F \ Comp G' F'" by (meson IntI assms in_CompE in_CompI B.isomorphic_symmetric B.isomorphic_transitive) hence "Comp G F \ Comp G' F' \ {}" by auto thus ?thesis using assms is_iso_class_Comp by (metis empty_iff B.iso_class_eq) qed lemma Comp_eq_iso_class_memb: assumes "h \ Comp G F" shows "Comp G F = \h\\<^sub>B" proof show "Comp G F \ \h\\<^sub>B" proof fix h' assume h': "h' \ Comp G F" obtain f g where fg: "f \ F \ g \ G \ g \ f \\<^sub>B h" using assms by auto obtain f' g' where f'g': "f' \ F \ g' \ G \ g' \ f' \\<^sub>B h'" using h' by auto have "f \\<^sub>B f' \ g \\<^sub>B g'" using assms fg f'g' in_HomD(6) B.iso_class_elems_isomorphic by auto moreover have "B.ide f \ B.ide f' \ B.ide g \ B.ide g'" using assms fg f'g' in_HomD [of F] in_HomD [of G] by (meson calculation B.isomorphic_implies_ide(1) B.isomorphic_implies_ide(2)) moreover have "src g = trg f \ src g = trg f' \ src g' = trg f \ src g' = trg f'" using fg f'g' by (metis B.seq_if_composable calculation(1) B.ideD(1) B.isomorphic_implies_hpar(1) B.isomorphic_implies_hpar(3) B.not_arr_null) ultimately have "g \ f \\<^sub>B g' \ f'" using fg f'g' B.hcomp_ide_isomorphic B.hcomp_isomorphic_ide B.isomorphic_transitive by metis thus "h' \ \h\\<^sub>B" using fg f'g' B.isomorphic_symmetric B.isomorphic_transitive B.iso_class_def [of h] by blast qed show "\h\\<^sub>B \ Comp G F" proof (unfold B.iso_class_def Comp_def) obtain f g where 1: "f \ F \ g \ G \ g \ f \\<^sub>B h" using assms in_HomD Comp_def by (meson in_CompE) show "{h'. B.isomorphic h h'} \ {h. B.is_iso_class F \ B.is_iso_class G \ (\f g. f \ F \ g \ G \ g \ f \\<^sub>B h)}" using assms 1 B.isomorphic_transitive by blast qed qed interpretation concrete_category \Collect B.obj\ Hom B.iso_class \\_ _ _. Comp\ proof show "\a. a \ Collect B.obj \ \a\\<^sub>B \ Hom a a" by (metis (mono_tags, lifting) B.ide_in_hom(1) mem_Collect_eq B.objE B.obj_is_self_adjoint(1)) show "\a b c F G. \ a \ Collect B.obj; b \ Collect B.obj; c \ Collect B.obj; F \ Hom a b; G \ Hom b c \ \ Comp G F \ Hom a c" proof - fix a b c F G assume a: "a \ Collect B.obj" and b: "b \ Collect B.obj" and c: "c \ Collect B.obj" and F: "F \ Hom a b" and G: "G \ Hom b c" obtain f where f: "\f : a \\<^sub>B b\ \ B.is_left_adjoint f \ F = \f\\<^sub>B" using F by blast obtain g where g: "\g : b \\<^sub>B c\ \ B.is_left_adjoint g \ G = \g\\<^sub>B" using G by blast have "{h. B.is_iso_class F \ B.is_iso_class G \ (\f g. f \ F \ \f : a \\<^sub>B b\ \ g \ G \ \g : b \\<^sub>B c\ \ g \ f \\<^sub>B h)} = \g \ f\\<^sub>B" proof show "{h. B.is_iso_class F \ B.is_iso_class G \ (\f g. f \ F \ \f : a \\<^sub>B b\ \ g \ G \ \g : b \\<^sub>B c\ \ g \ f \\<^sub>B h)} \ \g \ f\\<^sub>B" proof fix h assume "h \ {h. B.is_iso_class F \ B.is_iso_class G \ (\f g. f \ F \ \f : a \\<^sub>B b\ \ g \ G \ \g : b \\<^sub>B c\ \ g \ f \\<^sub>B h)}" hence h: "B.is_iso_class F \ B.is_iso_class G \ (\f g. f \ F \ \f : a \\<^sub>B b\ \ g \ G \ \g : b \\<^sub>B c\ \ g \ f \\<^sub>B h)" by simp show "h \ \g \ f\\<^sub>B" proof - obtain f' g' where f'g': "g' \ G \ f' \ F \ g' \ f' \\<^sub>B h" using h by auto obtain \ where \: "\\ : f \\<^sub>B f'\ \ B.iso \" using f f'g' F B.iso_class_def by auto obtain \ where \: "\\ : g \\<^sub>B g'\ \ B.iso \" using g f'g' G B.iso_class_def by auto have 1: "\\ \ \ : g \ f \\<^sub>B g' \ f'\" using f g \ \ by auto moreover have "B.iso (\ \ \)" using f g \ \ 1 B.iso_hcomp by auto ultimately show ?thesis using f'g' B.iso_class_def B.isomorphic_def by auto qed qed show "\g \ f\\<^sub>B \ {h. B.is_iso_class F \ B.is_iso_class G \ (\f g. f \ F \ \f : a \\<^sub>B b\ \ g \ G \ \g : b \\<^sub>B c\ \ g \ f \\<^sub>B h)}" using f g B.iso_class_def B.isomorphic_reflexive B.left_adjoint_is_ide B.is_iso_classI by blast qed hence 1: "\gf. gf \ B.iso_class (g \ f) \ B.is_iso_class F \ B.is_iso_class G \ (\f g. f \ F \ \f : a \\<^sub>B b\ \ g \ G \ \g : b \\<^sub>B c\ \ g \ f \\<^sub>B gf)" by blast show "Comp G F \ Hom a c" proof - have gf: "B.is_left_adjoint (g \ f)" by (meson f g B.hseqE B.hseqI B.left_adjoints_compose) obtain gf' where gf': "B.adjoint_pair (g \ f) gf'" using gf by blast hence "\g \ f\\<^sub>B = Comp G F" using 1 Comp_eq_iso_class_memb B.ide_in_iso_class B.left_adjoint_is_ide by blast thus ?thesis using f g gf' by blast qed qed show "\a b F. \ a \ Collect B.obj; F \ Hom a b \ \ Comp F \a\\<^sub>B = F" proof - fix a b F assume a: "a \ Collect B.obj" assume F: "F \ Hom a b" obtain f where f: "\f : a \\<^sub>B b\ \ B.is_left_adjoint f \ F = \f\\<^sub>B" using F by auto have *: "\f'. f' \ F \ \f' : a \\<^sub>B b\ \ B.ide f' \ f \\<^sub>B f'" using f B.iso_class_def by force show "Comp F \a\\<^sub>B = F" proof show "Comp F \a\\<^sub>B \ F" proof fix h assume "h \ Comp F \a\\<^sub>B" hence h: "\f' a'. f' \ F \ a' \ \a\\<^sub>B \ f' \ a' \\<^sub>B h" unfolding Comp_def by auto obtain f' a' where f'a': "f' \ F \ a' \ \a\\<^sub>B \ f' \ a' \\<^sub>B h" using h by auto have "B.isomorphic f h" proof - have "B.isomorphic f (f \ a)" using f B.iso_runit' [of f] B.isomorphic_def B.left_adjoint_is_ide by blast also have "f \ a \\<^sub>B f' \ a" using f f'a' B.iso_class_def B.hcomp_isomorphic_ide apply (elim conjE B.in_hhomE) by auto also have "f' \ a \\<^sub>B f' \ a'" using f'a' * [of f'] B.iso_class_def B.hcomp_ide_isomorphic by auto also have "f' \ a' \\<^sub>B h" using f'a' by simp finally show ?thesis by blast qed thus "h \ F" using f B.iso_class_def by simp qed show "F \ Comp F \a\\<^sub>B" proof fix h assume h: "h \ F" have "f \ F" using f B.iso_class_def B.right_adjoint_determines_left_up_to_iso by auto moreover have "a \ B.iso_class a" using a B.iso_class_def B.isomorphic_reflexive by auto moreover have "f \ a \\<^sub>B h" proof - have "f \ a \\<^sub>B f" using f B.iso_runit [of f] B.isomorphic_def B.left_adjoint_is_ide by blast also have "f \\<^sub>B h" using h * by simp finally show ?thesis by blast qed ultimately show "h \ Comp F \a\\<^sub>B" unfolding Comp_def using a f F B.is_iso_classI B.left_adjoint_is_ide by auto qed qed qed show "\a b F. \ b \ Collect B.obj; F \ Hom a b \ \ Comp \b\\<^sub>B F = F" proof - fix a b F assume b: "b \ Collect B.obj" assume F: "F \ Hom a b" obtain f where f: "\f : a \\<^sub>B b\ \ B.is_left_adjoint f \ F = \f\\<^sub>B" using F by auto have *: "\f'. f' \ F \ \f' : a \\<^sub>B b\ \ B.ide f' \ f \\<^sub>B f'" using f B.iso_class_def by force show "Comp \b\\<^sub>B F = F" proof show "Comp \b\\<^sub>B F \ F" proof fix h assume "h \ Comp \b\\<^sub>B F" hence h: "\b' f'. b' \ \b\\<^sub>B \ f' \ F \ b' \ f' \\<^sub>B h" unfolding Comp_def by auto obtain b' f' where b'f': "b' \ \b\\<^sub>B \ f' \ F \ b' \ f' \\<^sub>B h" using h by auto have "f \\<^sub>B h" proof - have "f \\<^sub>B b \ f" using f B.iso_lunit' [of f] B.isomorphic_def B.left_adjoint_is_ide by blast also have "... \\<^sub>B b \ f'" using f b'f' B.iso_class_def B.hcomp_ide_isomorphic by (elim conjE B.in_hhomE, auto) also have "... \\<^sub>B b' \ f'" using b'f' * [of f'] B.iso_class_def B.hcomp_isomorphic_ide by auto also have "... \\<^sub>B h" using b'f' by simp finally show ?thesis by blast qed thus "h \ F" using f B.iso_class_def by simp qed show "F \ Comp \b\\<^sub>B F" proof fix h assume h: "h \ F" have "f \ F" using f B.iso_class_def B.right_adjoint_determines_left_up_to_iso by auto moreover have "b \ B.iso_class b" using b B.iso_class_def B.isomorphic_reflexive by auto moreover have "b \ f \\<^sub>B h" proof - have "b \ f \\<^sub>B f" using f B.iso_lunit [of f] B.isomorphic_def B.left_adjoint_is_ide by blast also have "f \\<^sub>B h" using h * by simp finally show ?thesis by blast qed ultimately show "h \ Comp \b\\<^sub>B F" unfolding Comp_def using b f F B.is_iso_classI B.left_adjoint_is_ide by auto qed qed qed show "\a b c d F G H. \ a \ Collect B.obj; b \ Collect B.obj; c \ Collect B.obj; d \ Collect B.obj; F \ Hom a b; G \ Hom b c; H \ Hom c d \ \ Comp H (Comp G F) = Comp (Comp H G) F" proof - fix a b c d F G H assume F: "F \ Hom a b" and G: "G \ Hom b c" and H: "H \ Hom c d" show "Comp H (Comp G F) = Comp (Comp H G) F" proof show "Comp H (Comp G F) \ Comp (Comp H G) F" proof fix x assume x: "x \ Comp H (Comp G F)" obtain f g h gf where 1: "B.is_iso_class F \ B.is_iso_class G \ B.is_iso_class H \ h \ H \ g \ G \ f \ F \ gf \ Comp G F \ g \ f \\<^sub>B gf \ h \ gf \\<^sub>B x" using x unfolding Comp_def by blast have hgf: "B.ide f \ B.ide g \ B.ide h" using 1 F G H B.isomorphic_implies_hpar in_HomD B.left_adjoint_is_ide by (metis (mono_tags, lifting)) have "h \ g \ f \\<^sub>B x" - proof - - have "h \ g \ f \\<^sub>B h \ gf" - using 1 hgf B.hcomp_ide_isomorphic - by (metis (full_types) B.isomorphic_implies_hpar(1) B.isomorphic_reflexive - B.isomorphic_symmetric B.seq_if_composable) - also have "h \ gf \\<^sub>B x" - using 1 by simp - finally show ?thesis by blast - qed + by (metis "1" B.hcomp_ide_isomorphic B.hseqE B.ide_char' + B.isomorphic_implies_hpar(4) B.isomorphic_implies_ide(1) + B.isomorphic_transitive hgf) moreover have "(h \ g) \ f \\<^sub>B h \ g \ f" using 1 hgf B.iso_assoc B.assoc_in_hom B.isomorphic_def by (metis B.hseq_char B.ideD(1-3) B.isomorphic_implies_hpar(1) B.trg_hcomp calculation) moreover have hg: "\h \ g : b \\<^sub>B d\" using G H 1 in_HomD(4) by blast moreover have "h \ g \ Comp H G" unfolding Comp_def using 1 hgf F G H in_HomD [of F a b] in_HomD [of G b c] in_HomD [of H c d] B.isomorphic_reflexive B.hcomp_ide_isomorphic B.hseqI' by (metis (no_types, lifting) B.hseqE B.hseqI mem_Collect_eq) ultimately show "x \ Comp (Comp H G) F" - using 1 F G H hgf B.is_iso_class_def is_iso_class_Comp [of H G] - B.isomorphic_reflexive [of "h \ g"] - apply (intro in_CompI) - apply auto[7] - apply blast - apply simp - by (meson B.isomorphic_symmetric B.isomorphic_transitive) + by (metis "1" B.isomorphic_transitive emptyE in_CompI is_iso_class_Comp) qed show "Comp (Comp H G) F \ Comp H (Comp G F)" proof fix x assume x: "x \ Comp (Comp H G) F" obtain f g h hg where 1: "B.is_iso_class F \ B.is_iso_class G \ B.is_iso_class H \ h \ H \ g \ G \ f \ F \ hg \ Comp H G \ h \ g \\<^sub>B hg \ hg \ f \\<^sub>B x" using x unfolding Comp_def by blast have hgf: "B.ide f \ B.ide g \ B.ide h \ src h = trg g \ src g = trg f" using 1 F G H in_HomD B.left_adjoint_is_ide by (metis (no_types, lifting) B.hseq_char' B.ideD(1) B.ide_dom B.in_homE B.isomorphic_def B.isomorphic_symmetric B.seqI' B.seq_if_composable B.src_dom B.src_hcomp B.vseq_implies_hpar(1)) have 2: "(h \ g) \ f \\<^sub>B x" - proof - - have "(h \ g) \ f \\<^sub>B hg \ f" - using 1 F G H hgf - by (simp add: B.hcomp_isomorphic_ide) - also have "hg \ f \\<^sub>B x" - using 1 by simp - finally show ?thesis by blast - qed + by (meson "1" B.hcomp_isomorphic_ide B.hseqE B.ideD(1) B.isomorphic_implies_ide(1) + B.isomorphic_symmetric B.isomorphic_transitive hgf) moreover have "(h \ g) \ f \\<^sub>B h \ g \ f" using hgf B.iso_assoc B.assoc_in_hom B.isomorphic_def by auto moreover have "g \ f \ Comp G F" using 1 F G hgf B.isomorphic_reflexive by blast ultimately show "x \ Comp H (Comp G F)" using 1 hgf is_iso_class_Comp [of G F] B.isomorphic_reflexive [of "g \ f"] apply (intro in_CompI) apply auto[6] apply simp apply auto[1] by (meson B.isomorphic_symmetric B.isomorphic_transitive) qed qed qed qed lemma is_concrete_category: shows "concrete_category (Collect B.obj) Hom B.iso_class (\_ _ _. Comp)" .. sublocale concrete_category \Collect B.obj\ Hom B.iso_class \\_ _ _. Comp\ using is_concrete_category by simp abbreviation comp (infixr "\" 55) where "comp \ COMP" notation in_hom ("\_ : _ \ _\") no_notation B.in_hom ("\_ : _ \\<^sub>B _\") lemma Map_memb_in_hhom: assumes "\F : A \ B\" and "f \ Map F" shows "\f : Dom A \\<^sub>B Dom B\" proof - have "\f : Dom F \\<^sub>B Cod F\" using assms arr_char [of F] in_HomD [of "Map F" "Dom F" "Cod F"] by blast moreover have "Dom F = Dom A" using assms by auto moreover have "Cod F = Dom B" using assms by auto ultimately show ?thesis by simp qed lemma MkArr_in_hom': assumes "B.is_left_adjoint f" and "\f : a \\<^sub>B b\" shows "\MkArr a b \f\\<^sub>B : MkIde a \ MkIde b\" using assms MkArr_in_hom by blast text \ The isomorphisms in \Maps(B)\ are the isomorphism classes of equivalence maps in \B\. \ lemma iso_char: shows "iso F \ arr F \ (\f. f \ Map F \ B.equivalence_map f)" proof assume F: "iso F" have "\f. f \ Map F \ B.equivalence_map f" proof - fix f assume f: "f \ Map F" obtain G where G: "inverse_arrows F G" using F by auto obtain g where g: "g \ Map G" using G arr_char [of G] in_HomD(1) by blast have f: "f \ Map F \ \f : Dom F \\<^sub>B Cod F\ \ B.ide f \ B.is_left_adjoint f" by (metis (mono_tags, lifting) F iso_is_arr is_concrete_category concrete_category.arr_char f in_HomD(2,4-5) B.iso_class_memb_is_ide) have g: "g \ Map G \ \g : Cod F \\<^sub>B Dom F\ \ B.ide g \ B.is_left_adjoint g" by (metis (no_types, lifting) F G Cod_cod Cod_dom arr_inv cod_inv dom_inv inverse_unique iso_is_arr is_concrete_category concrete_category.Map_in_Hom g in_HomD(2,4-5) B.iso_class_memb_is_ide) have "src (g \ f) \\<^sub>B g \ f" proof - have "g \ f \ Map (G \ F)" proof - have 1: "f \ Map F \ g \ Map G \ g \ f \\<^sub>B g \ f" using F G f g B.isomorphic_reflexive by force have 2: "Dom G = Cod F \ Cod G = Dom F" using F G arr_char by (metis (no_types, lifting) Cod.simps(1) Cod_dom arr_inv cod_char comp_inv_arr dom_inv inverse_unique iso_is_arr is_concrete_category concrete_category.Cod_comp) have "g \ f \ Comp (Map G) (Map F)" using 1 F iso_is_arr Map_in_Hom [of F] in_HomD(2) apply (intro in_CompI, auto) proof - show "B.is_iso_class (Map G)" using G iso_is_arr Map_in_Hom [of G] in_HomD(2) [of "Map G"] by blast qed thus ?thesis using F G f g comp_char [of G F] by auto qed moreover have "Dom F \ Map (G \ F)" by (metis (no_types, lifting) F G Map_dom comp_inv_arr iso_is_arr g B.ide_in_iso_class B.in_hhomE B.objE) moreover have "Map (G \ F) = \Dom F\\<^sub>B" by (simp add: F G comp_inv_arr iso_is_arr) moreover have "Dom F = src (g \ f)" using f g by fastforce ultimately show ?thesis using f g B.iso_class_elems_isomorphic B.is_iso_classI by (metis B.hseqI B.ide_src) qed moreover have "f \ g \\<^sub>B trg f" proof - have "f \ g \ Map (F \ G)" proof - have 1: "f \ Map F \ g \ Map G \ f \ g \\<^sub>B f \ g" using F G f g B.isomorphic_reflexive by force have 2: "Dom G = Cod F \ Cod G = Dom F" using F G arr_char by (metis (no_types, lifting) Cod.simps(1) Cod_dom arr_inv cod_char comp_inv_arr dom_inv inverse_unique iso_is_arr is_concrete_category concrete_category.Cod_comp) hence "f \ g \ Comp (Map F) (Map G)" using 1 F iso_is_arr Map_in_Hom [of F] in_HomD(2) apply (intro in_CompI, auto) proof - show "B.is_iso_class (Map G)" using G iso_is_arr Map_in_Hom [of G] in_HomD(2) [of "Map G"] by blast qed thus ?thesis using F G f g comp_char [of F G] by auto qed moreover have "Cod F \ Map (F \ G)" by (metis (no_types, lifting) F G Map_cod comp_arr_inv dom_inv inverse_unique iso_is_arr g B.ide_in_iso_class B.in_hhomE B.src.preserves_ide) moreover have "Map (F \ G) = \Cod F\\<^sub>B" by (metis (no_types, lifting) F G Map_cod comp_arr_inv dom_inv inverse_unique iso_is_arr) moreover have "Cod F = trg (f \ g)" using f g by fastforce ultimately show ?thesis using B.iso_class_elems_isomorphic by (metis f g B.is_iso_classI B.in_hhomE B.src.preserves_ide) qed ultimately show "B.equivalence_map f" using f g B.equivalence_mapI B.quasi_inversesI [of f g] by fastforce qed thus "arr F \ (\f. f \ Map F \ B.equivalence_map f)" using F by blast next assume F: "arr F \ (\f. f \ Map F \ B.equivalence_map f)" show "iso F" proof - obtain f where f: "f \ Map F" using F arr_char in_HomD(1) by blast have f_in_hhom: "\f : Dom F \\<^sub>B Cod F\" using f F arr_char in_HomD(4) [of "Map F" "Dom F" "Cod F" f] by simp have "Map F = B.iso_class f" using f F arr_char in_HomD(6) [of "Map F" "Dom F" "Cod F" f] by simp obtain g \ \' where \': "equivalence_in_bicategory V H \ \ src trg f g \ \'" using f F B.equivalence_map_def by auto interpret \': equivalence_in_bicategory V H \ \ src trg f g \ \' using \' by auto obtain \ where \: "adjoint_equivalence_in_bicategory V H \ \ src trg f g \ \" using f F \'.ide_right \'.antipar \'.unit_in_hom \'.unit_is_iso B.equivalence_map_def B.equivalence_refines_to_adjoint_equivalence [of f g \] by auto interpret \: adjoint_equivalence_in_bicategory V H \ \ src trg f g \ \ using \ by simp have g_in_hhom: "\g : Cod F \\<^sub>B Dom F\" using \.ide_right \.antipar f_in_hhom by auto have fg: "B.quasi_inverses f g" using B.quasi_inverses_def \.equivalence_in_bicategory_axioms by auto have g: "\g : Cod F \\<^sub>B Dom F\ \ B.is_left_adjoint g \ \g\\<^sub>B = \g\\<^sub>B" using \'.dual_equivalence B.equivalence_is_left_adjoint B.equivalence_map_def g_in_hhom by blast have F_as_MkArr: "F = MkArr (Dom F) (Cod F) \f\\<^sub>B" using F MkArr_Map \Map F = B.iso_class f\ by fastforce have F_in_hom: "in_hom F (MkIde (Dom F)) (MkIde (Cod F))" using F arr_char dom_char cod_char by (intro in_homI, auto) let ?G = "MkArr (Cod F) (Dom F) \g\\<^sub>B" have "arr ?G" using MkArr_in_hom' g by blast hence G_in_hom: "\?G : MkIde (Cod F) \ MkIde (Dom F)\" using arr_char MkArr_in_hom by simp have "inverse_arrows F ?G" proof show "ide (?G \ F)" proof - have "?G \ F = dom F" proof (intro arr_eqI) show 1: "seq ?G F" using F_in_hom G_in_hom by blast show "arr (dom F)" using F_in_hom ide_dom by fastforce show "Dom (?G \ F) = Dom (dom F)" using F_in_hom G_in_hom 1 comp_char by auto show "Cod (?G \ F) = Cod (dom F)" using F_in_hom G_in_hom 1 comp_char by auto show "Map (?G \ F) = Map (dom F)" proof - have "Map (?G \ F) = Comp \g\\<^sub>B \f\\<^sub>B" using 1 comp_char [of ?G F] \Map F = B.iso_class f\ by simp also have "... = \g \ f\\<^sub>B" proof - have "g \ f \ Comp \g\\<^sub>B \f\\<^sub>B" by (metis \.ide_left \.ide_right \.unit_in_vhom \.unit_simps(3) B.arrI B.ide_cod B.ide_in_iso_class in_CompI B.is_iso_classI B.isomorphic_reflexive) thus ?thesis using Comp_eq_iso_class_memb F_in_hom G_in_hom arr_char arr_char \Map F = B.iso_class f\ by auto qed also have "... = \src f\\<^sub>B" using \.unit_in_hom \.unit_is_iso B.isomorphic_def B.iso_class_def B.isomorphic_symmetric by (intro B.iso_class_eqI, blast) also have "... = \Dom F\\<^sub>B" using \.ide_left f_in_hhom B.ide_in_iso_class B.in_hhomE B.src.preserves_ide B.isomorphic_reflexive by (intro B.iso_class_eqI, fastforce) also have "... = Map (dom F)" using F_in_hom dom_char by auto finally show ?thesis by blast qed qed thus ?thesis using F by simp qed show "ide (F \ ?G)" proof - have "F \ ?G = cod F" proof (intro arr_eqI) show 1: "seq F ?G" using F_in_hom G_in_hom by blast show "arr (cod F)" using F_in_hom ide_cod by fastforce show "Dom (F \ ?G) = Dom (cod F)" using F_in_hom G_in_hom 1 comp_char by auto show "Cod (F \ ?G) = Cod (cod F)" using F_in_hom G_in_hom 1 comp_char by auto show "Map (F \ ?G) = Map (cod F)" proof - have "Map (F \ ?G) = Comp \f\\<^sub>B \g\\<^sub>B" using 1 comp_char [of F ?G] \Map F = \f\\<^sub>B\ by simp also have "... = \f \ g\\<^sub>B" proof - have "f \ g \ Comp \f\\<^sub>B \g\\<^sub>B" by (metis \.antipar(1) \.ide_left \.ide_right B.ide_hcomp B.ide_in_iso_class in_CompI B.is_iso_classI B.isomorphic_reflexive) thus ?thesis using Comp_eq_iso_class_memb F_in_hom G_in_hom arr_char arr_char \Map F = \f\\<^sub>B\ by auto qed also have "... = \trg f\\<^sub>B" proof - have "trg f \ \f \ g\\<^sub>B" using \.counit_in_hom \.counit_is_iso B.isomorphic_def B.iso_class_def B.isomorphic_symmetric by blast thus ?thesis using B.iso_class_eqI by (metis \.antipar(1) \.ide_left \.ide_right B.ide_hcomp B.ide_in_iso_class B.is_iso_classI B.iso_class_elems_isomorphic) qed also have "... = \Cod F\\<^sub>B" using f_in_hhom by auto also have "... = Map (cod F)" using F_in_hom dom_char by auto finally show ?thesis by blast qed qed thus ?thesis using F by simp qed qed thus ?thesis by auto qed qed lemma iso_char': shows "iso F \ arr F \ (\f. f \ Map F \ B.equivalence_map f)" proof - have "arr F \ (\f. f \ Map F \ B.equivalence_map f) \ (\f. f \ Map F \ B.equivalence_map f)" proof assume F: "arr F" show "(\f. f \ Map F \ B.equivalence_map f) \ (\f. f \ Map F \ B.equivalence_map f)" using F arr_char in_HomD(1) by blast show "(\f. f \ Map F \ B.equivalence_map f) \ (\f. f \ Map F \ B.equivalence_map f)" by (metis (no_types, lifting) F is_concrete_category concrete_category.arr_char B.equivalence_map_preserved_by_iso in_HomD(2) B.iso_class_elems_isomorphic) qed thus ?thesis using iso_char by blast qed text \ The following mapping takes a map in \B\ to the corresponding arrow of \Maps(B)\. \ abbreviation CLS ("\\_\\") where "\\f\\ \ MkArr (src f) (trg f) \f\\<^sub>B" lemma ide_CLS_obj: assumes "B.obj a" shows "ide \\a\\" by (simp add: assms B.obj_simps) lemma CLS_in_hom: assumes "B.is_left_adjoint f" shows "\\\f\\ : \\src f\\ \ \\trg f\\\" using assms B.left_adjoint_is_ide MkArr_in_hom MkArr_in_hom' by simp lemma CLS_eqI: assumes "B.ide f" shows "\\f\\ = \\g\\ \ f \\<^sub>B g" by (metis arr.inject assms B.ide_in_iso_class B.iso_class_def B.iso_class_eqI B.isomorphic_implies_hpar(3) B.isomorphic_implies_hpar(4) B.isomorphic_symmetric mem_Collect_eq) lemma CLS_hcomp: assumes "B.ide f" and "B.ide g" and "src f = trg g" shows "\\f \ g\\ = MkArr (src g) (trg f) (Comp \f\\<^sub>B \g\\<^sub>B)" proof - have "\\f \ g\\ = MkArr (src g) (trg f) \f \ g\\<^sub>B" using assms B.left_adjoint_is_ide by simp moreover have "\f \ g\\<^sub>B = Comp \f\\<^sub>B \g\\<^sub>B" proof show "\f \ g\\<^sub>B \ Comp \f\\<^sub>B \g\\<^sub>B" by (metis assms(1-2) B.ide_in_iso_class in_CompI B.is_iso_classI B.iso_class_def mem_Collect_eq subsetI) show "Comp \f\\<^sub>B \g\\<^sub>B \ \f \ g\\<^sub>B" by (metis Comp_eq_iso_class_memb \\f \ g\\<^sub>B \ Comp \f\\<^sub>B \g\\<^sub>B\ assms(1-3) B.ide_hcomp B.ide_in_iso_class subset_iff) qed ultimately show ?thesis by simp qed lemma comp_CLS: assumes "B.is_left_adjoint f" and "B.is_left_adjoint g" and "f \ g \\<^sub>B h" shows "\\f\\ \ \\g\\ = \\h\\" proof - have hseq_fg: "B.hseq f g" using assms B.isomorphic_implies_hpar(1) by simp have "seq \\f\\ \\g\\" using assms hseq_fg CLS_in_hom [of f] CLS_in_hom [of g] apply (elim B.hseqE) by auto hence "\\f\\ \ \\g\\ = MkArr (src g) (trg f) (Comp \f\\<^sub>B \g\\<^sub>B)" using comp_char [of "CLS f" "CLS g"] by simp also have "... = \\f \ g\\" using assms hseq_fg CLS_hcomp apply (elim B.hseqE) using B.adjoint_pair_antipar(1) by auto also have "... = \\h\\" using assms B.isomorphic_symmetric by (simp add: assms(3) B.iso_class_eqI B.isomorphic_implies_hpar(3) B.isomorphic_implies_hpar(4)) finally show ?thesis by simp qed text \ The following mapping that takes an arrow of \Maps(B)\ and chooses some representative map in \B\. \ definition REP where "REP F \ if arr F then SOME f. f \ Map F else B.null" lemma REP_in_Map: assumes "arr A" shows "REP A \ Map A" proof - have "Map A \ {}" using assms arr_char in_HomD(1) by blast thus ?thesis using assms REP_def someI_ex [of "\f. f \ Map A"] by auto qed lemma REP_in_hhom [intro]: assumes "in_hom F A B" shows "\REP F : src (REP A) \\<^sub>B src (REP B)\" and "B.is_left_adjoint (REP F)" proof - have "Map F \ {}" using assms in_hom_char arr_char null_char in_HomD(1) [of "Map F" "Dom F" "Cod F"] by blast hence 1: "REP F \ Map F" using assms REP_def someI_ex [of "\f. f \ Map F"] by auto hence 2: "B.arr (REP F)" using assms 1 in_hom_char [of F A B] B.iso_class_def Map_memb_in_hhom B.in_hhom_def by blast hence "\REP F : Dom A \\<^sub>B Dom B\" using assms 1 in_hom_char [of F A B] Map_memb_in_hhom by auto thus "\REP F : src (REP A) \\<^sub>B src (REP B)\" using assms by (metis (no_types, lifting) Map_memb_in_hhom ideD(1) in_homI in_hom_char REP_in_Map B.in_hhom_def) have "REP F \ \REP F\\<^sub>B" using assms 1 2 arr_char [of F] in_HomD(6) B.ide_in_iso_class B.iso_class_memb_is_ide in_hom_char by blast thus "B.is_left_adjoint (REP F)" using assms 1 2 arr_char in_HomD(5) [of "Map F" "Dom F" "Cod F" "REP F"] by auto qed lemma ide_REP: assumes "arr A" shows "B.ide (REP A)" using assms REP_in_hhom(2) B.adjoint_pair_antipar(1) by blast lemma REP_simps [simp]: assumes "arr A" shows "B.ide (REP A)" and "src (REP A) = Dom A" and "trg (REP A) = Cod A" and "B.dom (REP A) = REP A" and "B.cod (REP A) = REP A" proof - show "B.ide (REP A)" using assms ide_REP by blast show "src (REP A) = Dom A" using assms REP_in_hhom by (metis (no_types, lifting) Map_memb_in_hhom Dom_dom in_homI REP_in_Map B.in_hhom_def) show "trg (REP A) = Cod A" using assms REP_in_hhom by (metis (no_types, lifting) Map_memb_in_hhom Dom_cod in_homI REP_in_Map B.in_hhom_def) show "B.dom (REP A) = REP A" using assms in_homI REP_in_hhom(2) B.adjoint_pair_antipar(1) B.ideD(2) by blast show "B.cod (REP A) = REP A" using assms in_homI REP_in_hhom(2) B.adjoint_pair_antipar(1) B.ideD(3) by blast qed lemma isomorphic_REP_src: assumes "ide A" shows "REP A \\<^sub>B src (REP A)" using assms by (metis (no_types, lifting) ideD(1) ide_char REP_in_Map ide_REP REP_simps(2) B.is_iso_classI B.ide_in_iso_class B.iso_class_elems_isomorphic B.src.preserves_ide) lemma isomorphic_REP_trg: assumes "ide A" shows "REP A \\<^sub>B trg (REP A)" using assms ide_char isomorphic_REP_src by auto lemma CLS_REP: assumes "arr F" shows "\\REP F\\ = F" by (metis (mono_tags, lifting) MkArr_Map is_concrete_category REP_in_Map REP_simps(2) REP_simps(3) assms concrete_category.Map_in_Hom in_HomD(6)) lemma REP_CLS: assumes "B.is_left_adjoint f" shows "REP \\f\\ \\<^sub>B f" by (metis (mono_tags, lifting) CLS_in_hom Map.simps(1) in_homE REP_in_Map assms B.iso_class_def B.isomorphic_symmetric mem_Collect_eq) lemma isomorphic_hcomp_REP: assumes "seq F G" shows "REP F \ REP G \\<^sub>B REP (F \ G)" proof - have 1: "Dom F = Cod G" using assms seq_char by simp have 2: "Map F = B.iso_class (REP F)" using assms seq_char arr_char REP_in_Map in_HomD(6) by meson have 3: "Map G = B.iso_class (REP G)" using assms seq_char arr_char REP_in_Map in_HomD(6) [of "Map G" "Dom G" "Cod G" "REP G"] by auto have "Map (F \ G) = Comp \REP F\\<^sub>B \REP G\\<^sub>B" using assms seq_char null_char by (metis (no_types, lifting) CLS_REP Map.simps(1) Map_comp) have "Comp \REP F\\<^sub>B \REP G\\<^sub>B = \REP F \ REP G\\<^sub>B" proof - have "REP F \ REP G \ Comp \REP F\\<^sub>B \REP G\\<^sub>B" proof - have "REP F \ Map F \ REP G \ Map G" using assms seq_char REP_in_Map by auto moreover have "REP F \ REP G \\<^sub>B REP F \ REP G" using assms seq_char 2 B.isomorphic_reflexive by auto ultimately show ?thesis using assms 1 2 3 B.iso_class_def B.is_iso_class_def by (intro in_CompI, auto) qed moreover have "\REP F\\<^sub>B \ Hom (Cod G) (Cod F)" using assms 1 2 arr_char [of F] by auto moreover have "\REP G\\<^sub>B \ Hom (Dom G) (Cod G)" using assms 1 3 arr_char [of G] by auto ultimately show ?thesis using Comp_eq_iso_class_memb assms arr_char arr_char REP_in_Map by (simp add: Comp_def) qed moreover have "REP (F \ G) \ Comp \REP F\\<^sub>B \REP G\\<^sub>B" proof - have "Map (F \ G) = Comp (Map F) (Map G)" using assms 1 comp_char [of F G] by simp thus ?thesis using assms 1 2 3 REP_in_Map [of "F \ G"] by simp qed ultimately show ?thesis using B.iso_class_def by simp qed text \ We now show that \Maps(B)\ has pullbacks. For this we need to exhibit functions \PRJ\<^sub>0\ and \PRJ\<^sub>1\ that produce the legs of the pullback of a cospan \(H, K)\ and verify that they have the required universal property. These are obtained by choosing representatives \h\ and \k\ of \H\ and \K\, respectively, and then taking \PRJ\<^sub>0 = CLS (tab\<^sub>0 (k\<^sup>* \ h))\ and \PRJ\<^sub>1 = CLS (tab\<^sub>1 (k\<^sup>* \ h))\. That these constitute a pullback in \Maps(B)\ follows from the fact that \tab\<^sub>0 (k\<^sup>* \ h)\ and \tab\<^sub>1 (k\<^sup>* \ h)\ form a pseudo-pullback of \(h, k)\ in the underlying bicategory. For our purposes here, it is not sufficient simply to show that \Maps(B)\ has pullbacks and then to treat it as an abstract ``category with pullbacks'' where the pullbacks are chosen arbitrarily. Instead, we have to retain the connection between a pullback in Maps and the tabulation of \k\<^sup>* \ h\ that is ultimately used to obtain it. If we don't do this, then it becomes problematic to define the compositor of a pseudofunctor from the underlying bicategory \B\ to \Span(Maps(B))\, because the components will go from the apex of a composite span (obtained by pullback) to the apex of a tabulation (chosen arbitrarily using \BS2\) and these need not be in agreement with each other. \ definition PRJ\<^sub>0 where "PRJ\<^sub>0 \ \K H. if cospan K H then \\B.tab\<^sub>0 ((REP K)\<^sup>* \ (REP H))\\ else null" definition PRJ\<^sub>1 where "PRJ\<^sub>1 \ \K H. if cospan K H then \\B.tab\<^sub>1 ((REP K)\<^sup>* \ (REP H))\\ else null" interpretation elementary_category_with_pullbacks comp PRJ\<^sub>0 PRJ\<^sub>1 proof show "\H K. \ cospan K H \ PRJ\<^sub>0 K H = null" unfolding PRJ\<^sub>0_def by auto show "\H K. \ cospan K H \ PRJ\<^sub>1 K H = null" unfolding PRJ\<^sub>1_def by auto show "\H K. cospan K H \ commutative_square K H (PRJ\<^sub>1 K H) (PRJ\<^sub>0 K H)" proof - fix H K assume HK: "cospan K H" define h where "h = REP H" define k where "k = REP K" have h: "h \ Map H" using h_def HK REP_in_Map by blast have k: "k \ Map K" using k_def HK REP_in_Map by blast have 1: "B.is_left_adjoint h \ B.is_left_adjoint k \ B.ide h \ B.ide k \ trg h = trg k" using h k h_def k_def HK arr_char cod_char B.in_hhom_def B.left_adjoint_is_ide in_HomD(5) [of "Map H" "Dom H" "Cod H" h] in_HomD(5) [of "Map K" "Dom K" "Cod K" k] apply auto by (metis (no_types, lifting) HK Dom_cod) interpret h: map_in_bicategory \(\)\ \(\)\ \ \ src trg h using 1 by unfold_locales auto interpret k: map_in_bicategory \(\)\ \(\)\ \ \ src trg k using 1 by unfold_locales auto interpret hk: cospan_of_maps_in_bicategory_of_spans \(\)\ \(\)\ \ \ src trg h k using 1 by unfold_locales auto let ?f = "B.tab\<^sub>0 (k\<^sup>* \ h)" let ?g = "B.tab\<^sub>1 (k\<^sup>* \ h)" have span: "span \\?f\\ \\?g\\" using dom_char CLS_in_hom [of ?f] CLS_in_hom [of ?g] by auto have seq: "seq H \\?f\\" using HK seq_char hk.leg0_is_map CLS_in_hom h_def hk.p\<^sub>0_simps hk.satisfies_T0 by fastforce have seq': "seq K \\?g\\" using HK k arr_char dom_char cod_char in_HomD(5) hk.leg1_is_map CLS_in_hom by (metis (no_types, lifting) Cod.simps(1) seq_char REP_simps(2) hk.p\<^sub>1_simps k_def span) show "commutative_square K H (PRJ\<^sub>1 K H) (PRJ\<^sub>0 K H)" proof show "cospan K H" using HK by simp show "dom K = cod (PRJ\<^sub>1 K H)" using seq' PRJ\<^sub>1_def HK h_def k_def by auto show "span (PRJ\<^sub>1 K H) (PRJ\<^sub>0 K H)" unfolding PRJ\<^sub>0_def PRJ\<^sub>1_def using HK span h_def k_def by simp show "K \ PRJ\<^sub>1 K H = H \ PRJ\<^sub>0 K H" proof - have iso: "h \ ?f \\<^sub>B k \ ?g" using hk.\_uniqueness B.isomorphic_symmetric B.isomorphic_def by blast have *: "Comp (Map H) \?f\\<^sub>B = Comp (Map K) \?g\\<^sub>B" proof (intro Comp_eqI) show "h \ ?f \ Comp (Map H) \B.tab\<^sub>0 (k\<^sup>* \ h)\\<^sub>B" proof (unfold Comp_def) have "B.is_iso_class \?f\\<^sub>B" by (simp add: B.is_iso_classI) moreover have "B.is_iso_class (Map H)" using CLS_REP HK Map.simps(1) B.is_iso_classI h.ide_left h_def by (metis (no_types, lifting)) moreover have "?f \ \B.tab\<^sub>0 (k\<^sup>* \ h)\\<^sub>B" by (simp add: B.ide_in_iso_class(1)) moreover have "\?f : src (B.tab\<^sub>0 (k\<^sup>* \ h)) \\<^sub>B Dom H\" using seq seq_char by simp moreover have "h \ Map H" by fact moreover have "\h : Dom H \\<^sub>B Cod H\" by (simp add: HK h_def) moreover have "h \ ?f \\<^sub>B h \ ?f" using B.isomorphic_reflexive by auto ultimately show "h \ B.tab\<^sub>0 (k\<^sup>* \ h) \ {h'. B.is_iso_class \B.tab\<^sub>0 (k\<^sup>* \ h)\\<^sub>B \ B.is_iso_class (Map H) \ (\f g. f \ \B.tab\<^sub>0 (k\<^sup>* \ h)\\<^sub>B \ g \ Map H \ g \ f \\<^sub>B h')}" by auto qed show "k \ ?g \ Comp (Map K) \B.tab\<^sub>1 (k\<^sup>* \ h)\\<^sub>B" proof (unfold Comp_def) have "B.is_iso_class \?g\\<^sub>B" by (simp add: B.is_iso_classI) moreover have "B.is_iso_class (Map K)" by (metis (no_types, lifting) CLS_REP HK Map.simps(1) B.is_iso_classI k.ide_left k_def) moreover have "?g \ \B.tab\<^sub>1 (k\<^sup>* \ h)\\<^sub>B" by (simp add: B.ide_in_iso_class(1)) moreover have "\?g : src (B.tab\<^sub>1 (k\<^sup>* \ h)) \\<^sub>B Dom K\" using seq seq_char B.in_hhom_def seq' by auto moreover have "k \ Map K" by fact moreover have "\k : Dom K \\<^sub>B Cod K\" by (simp add: HK k_def) moreover have "k \ ?g \\<^sub>B k \ ?g" using B.isomorphic_reflexive iso B.isomorphic_implies_hpar(2) by auto ultimately show "k \ B.tab\<^sub>1 (k\<^sup>* \ h) \ {h'. B.is_iso_class \B.tab\<^sub>1 (k\<^sup>* \ h)\\<^sub>B \ B.is_iso_class (Map K) \ (\f g. f \ \B.tab\<^sub>1 (k\<^sup>* \ h)\\<^sub>B \ g \ Map K \ g \ f \\<^sub>B h')}" by auto qed show "h \ ?f \\<^sub>B k \ ?g" using iso by simp qed have "K \ PRJ\<^sub>1 K H = K \ \\?g\\" unfolding PRJ\<^sub>1_def using HK h_def k_def by simp also have "... = MkArr (src ?g) (Cod K) (Comp (Map K) \?g\\<^sub>B)" using seq' comp_char [of K "\\?g\\"] by simp also have "... = MkArr (src ?f) (Cod H) (Comp (Map H) \?f\\<^sub>B)" using * HK cod_char by auto also have "... = comp H \\?f\\" using seq comp_char [of H "\\?f\\"] by simp also have "... = comp H (PRJ\<^sub>0 K H)" unfolding PRJ\<^sub>0_def using HK h_def k_def by simp finally show ?thesis by simp qed qed qed show "\H K U V. commutative_square K H V U \ \!E. comp (PRJ\<^sub>1 K H) E = V \ comp (PRJ\<^sub>0 K H) E = U" proof - fix H K U V assume cs: "commutative_square K H V U" have HK: "cospan K H" using cs by auto (* TODO: Is there any way to avoid this repetition? *) define h where "h = REP H" define k where "k = REP K" have h: "h \ Map H" using h_def HK REP_in_Map by blast have k: "k \ Map K" using k_def HK REP_in_Map by blast have 1: "B.is_left_adjoint h \ B.is_left_adjoint k \ B.ide h \ B.ide k \ trg h = trg k" using h k h_def k_def HK arr_char cod_char B.in_hhom_def B.left_adjoint_is_ide in_HomD(5) [of "Map H" "Dom H" "Cod H" h] in_HomD(5) [of "Map K" "Dom K" "Cod K" k] apply auto by (metis (no_types, lifting) HK Dom_cod) interpret h: map_in_bicategory \(\)\ \(\)\ \ \ src trg h using 1 by unfold_locales auto interpret k: map_in_bicategory \(\)\ \(\)\ \ \ src trg k using 1 by unfold_locales auto interpret hk: cospan_of_maps_in_bicategory_of_spans \(\)\ \(\)\ \ \ src trg h k using 1 by unfold_locales auto let ?f = "B.tab\<^sub>0 (k\<^sup>* \ h)" let ?g = "B.tab\<^sub>1 (k\<^sup>* \ h)" have seq_HU: "seq H U" using cs by auto have seq_KV: "seq K V" using cs by auto let ?u = "REP U" let ?v = "REP V" have u: "B.ide ?u" using ide_REP seq_HU by auto have v: "B.ide ?v" using ide_REP seq_KV by auto have u_is_map: "B.is_left_adjoint ?u" using u seq_HU REP_in_Map arr_char [of U] in_HomD(5) [of "Map U" "Dom U" "Cod U" ?u] by auto have v_is_map: "B.is_left_adjoint ?v" using v seq_KV REP_in_Map arr_char [of V] in_HomD(5) [of "Map V" "Dom V" "Cod V" ?v] by auto have *: "h \ ?u \\<^sub>B k \ ?v" proof - have "h \ ?u \\<^sub>B REP (H \ U)" proof - have "h \ ?u \\<^sub>B REP H \ ?u" proof - have "h \\<^sub>B REP H" using h h_def HK arr_char REP_in_Map B.iso_class_elems_isomorphic in_HomD(5) [of "Map H" "Dom H" "Cod H" h] B.isomorphic_reflexive by auto thus ?thesis using h_def seq_HU B.isomorphic_implies_hpar(1) B.isomorphic_reflexive by (simp add: seq_char) qed also have "... \\<^sub>B REP (H \ U)" using seq_HU isomorphic_hcomp_REP isomorphic_def by blast finally show ?thesis by blast qed also have "... \\<^sub>B REP (K \ V)" using seq_HU cs B.isomorphic_reflexive by auto also have "... \\<^sub>B (k \ ?v)" proof - have "... \\<^sub>B REP K \ ?v" using seq_KV isomorphic_hcomp_REP B.isomorphic_def B.isomorphic_symmetric by blast also have "... \\<^sub>B k \ ?v" proof - have "k \\<^sub>B REP K" using k k_def HK arr_char REP_in_Map B.iso_class_elems_isomorphic in_HomD(5) [of "Map K" "Dom K" "Cod K" k] B.isomorphic_reflexive by auto thus ?thesis using k_def seq_KV B.isomorphic_implies_hpar(1) B.isomorphic_reflexive by (simp add: seq_char) qed finally show ?thesis by blast qed finally show ?thesis by blast qed have hseq_hu: "src h = trg ?u" using * B.isomorphic_implies_hpar by (meson B.hseqE B.ideD(1)) have hseq_kv: "src k = trg ?v" using * B.isomorphic_implies_hpar by (meson B.hseqE B.ideD(1)) obtain w where w: "B.is_left_adjoint w \ ?f \ w \\<^sub>B ?u \ ?v \\<^sub>B (?g \ w)" using * u_is_map v_is_map hk.has_pseudo_pullback [of ?u ?v] B.isomorphic_symmetric by blast have w_in_hom: "\w : src ?u \\<^sub>B src ?f\ \ B.ide w" using w B.left_adjoint_is_ide B.src_cod B.trg_cod B.isomorphic_def by (metis B.hseqE B.ideD(1) B.in_hhom_def B.isomorphic_implies_hpar(3) B.isomorphic_implies_ide(1) B.src_hcomp) let ?W = "CLS w" have W: "\?W : dom U \ dom \\?f\\\" proof show "arr ?W" using w CLS_in_hom by blast thus "dom ?W = dom U" using w_in_hom dom_char REP_in_hhom(1) CLS_in_hom by (metis (no_types, lifting) Dom.simps(1) commutative_squareE dom_char REP_simps(2) cs B.in_hhomE) show "cod ?W = dom \\?f\\" proof - have "src ?f = trg w" by (metis (lifting) B.in_hhomE w_in_hom) thus ?thesis using CLS_in_hom [of ?f] CLS_in_hom [of w] hk.satisfies_T0 w by fastforce qed qed show "\!E. PRJ\<^sub>1 K H \ E = V \ PRJ\<^sub>0 K H \ E = U" proof - have "PRJ\<^sub>1 K H \ ?W = V \ PRJ\<^sub>0 K H \ ?W = U" proof - have "\\?f\\ \ ?W = U" using w w_in_hom u CLS_in_hom comp_CLS B.isomorphic_symmetric CLS_REP hk.leg0_is_map by (metis (mono_tags, lifting) commutative_square_def cs) moreover have "\\?g\\ \ ?W = V" using w w_in_hom v CLS_in_hom comp_CLS B.isomorphic_symmetric CLS_REP hk.leg1_is_map by (metis (mono_tags, lifting) commutative_square_def cs) ultimately show ?thesis using HK h_def k_def PRJ\<^sub>0_def PRJ\<^sub>1_def by auto qed moreover have "\W'. PRJ\<^sub>1 K H \ W' = V \ PRJ\<^sub>0 K H \ W' = U \ W' = ?W" proof - fix W' assume "PRJ\<^sub>1 K H \ W' = V \ PRJ\<^sub>0 K H \ W' = U" hence W': "\W' : dom U \ dom \\?f\\\ \ \\?f\\ \ W' = U \ \\?g\\ \ W' = V" using PRJ\<^sub>0_def PRJ\<^sub>1_def HK h_def k_def apply simp using cs arr_iff_in_hom by blast let ?w' = "REP W'" have w': "B.ide ?w'" using W' ide_REP by auto have fw'_iso_u: "?f \ ?w' \\<^sub>B ?u" proof - have "?f \ ?w' \\<^sub>B REP \\?f\\ \ ?w'" by (metis (no_types, lifting) Cod.simps(1) in_hom_char REP_CLS REP_simps(3) W W' B.hcomp_isomorphic_ide hk.satisfies_T0 B.in_hhomE B.isomorphic_symmetric w' w_in_hom) also have "REP \\?f\\ \ ?w' \\<^sub>B ?u" using W' isomorphic_hcomp_REP cs by blast finally show ?thesis by blast qed have gw'_iso_v: "?g \ ?w' \\<^sub>B ?v" proof - have "?g \ ?w' \\<^sub>B REP \\?g\\ \ ?w'" proof - have "?g \\<^sub>B REP \\?g\\" using REP_CLS B.isomorphic_symmetric hk.leg1_is_map by blast moreover have "B.ide (REP W')" using W' by auto moreover have "src ?f = trg ?w'" using w_in_hom W W' in_hom_char arr_char B.in_hhom_def by (meson fw'_iso_u B.hseqE B.ideD(1) B.isomorphic_implies_ide(1)) ultimately show ?thesis using B.hcomp_isomorphic_ide by simp qed also have "... \\<^sub>B ?v" using W' isomorphic_hcomp_REP cs by blast finally show ?thesis by blast qed show "W' = ?W" proof - have "W' = \\?w'\\" using w' W' CLS_REP by auto also have "... = ?W" proof - have "?w' \\<^sub>B w" using * w W' hk.has_pseudo_pullback(2) u_is_map v_is_map B.isomorphic_symmetric fw'_iso_u gw'_iso_v by blast thus ?thesis using CLS_eqI B.iso_class_eqI w' by blast qed finally show ?thesis by blast qed qed ultimately show ?thesis by auto qed qed qed lemma is_elementary_category_with_pullbacks: shows "elementary_category_with_pullbacks comp PRJ\<^sub>0 PRJ\<^sub>1" .. lemma is_category_with_pullbacks: shows "category_with_pullbacks comp" .. sublocale elementary_category_with_pullbacks comp PRJ\<^sub>0 PRJ\<^sub>1 using is_elementary_category_with_pullbacks by simp end text \ Here we relate the projections of the chosen pullbacks in \Maps(B)\ to the projections associated with the chosen tabulations in \B\. \ context composite_tabulation_in_maps begin interpretation Maps: maps_category V H \ \ src trg .. interpretation r\<^sub>0s\<^sub>1: cospan_of_maps_in_bicategory_of_spans V H \ \ src trg s\<^sub>1 r\<^sub>0 using \.leg0_is_map \.leg1_is_map composable by unfold_locales auto lemma prj_char: shows "Maps.PRJ\<^sub>0 \\r\<^sub>0\\ \\s\<^sub>1\\ = \\prj\<^sub>0 s\<^sub>1 r\<^sub>0\\" and "Maps.PRJ\<^sub>1 \\r\<^sub>0\\ \\s\<^sub>1\\ = \\prj\<^sub>1 s\<^sub>1 r\<^sub>0\\" proof - have "Maps.arr (Maps.MkArr (src s\<^sub>0) (trg s) \s\<^sub>1\)" using \.leg1_in_hom Maps.CLS_in_hom \.leg1_is_map Maps.arr_char by auto moreover have "Maps.arr (Maps.MkArr (src r\<^sub>0) (trg s) \r\<^sub>0\)" using Maps.CLS_in_hom composable r\<^sub>0s\<^sub>1.k_is_map by fastforce moreover have "Maps.cod (Maps.MkArr (src r\<^sub>0) (trg s) \r\<^sub>0\) = Maps.cod (Maps.MkArr (src s\<^sub>0) (trg s) \s\<^sub>1\)" unfolding Maps.arr_char using \.leg1_in_hom \.leg0_in_hom by (simp add: Maps.cod_char calculation(1) calculation(2)) ultimately have "Maps.PRJ\<^sub>0 \\r\<^sub>0\\ \\s\<^sub>1\\ = \\tab\<^sub>0 ((Maps.REP (Maps.MkArr (src r\<^sub>0) (trg s) \r\<^sub>0\))\<^sup>* \ Maps.REP (Maps.MkArr (src s\<^sub>0) (trg s) \s\<^sub>1\))\\ \ Maps.PRJ\<^sub>1 (Maps.CLS r\<^sub>0) (Maps.CLS s\<^sub>1) = \\tab\<^sub>1 ((Maps.REP (Maps.MkArr (src r\<^sub>0) (trg s) \r\<^sub>0\))\<^sup>* \ Maps.REP (Maps.MkArr (src s\<^sub>0) (trg s) \s\<^sub>1\))\\" unfolding Maps.PRJ\<^sub>0_def Maps.PRJ\<^sub>1_def using Maps.CLS_in_hom \.leg1_is_map \.leg0_is_map composable by simp moreover have "r\<^sub>0\<^sup>* \ s\<^sub>1 \ (Maps.REP (Maps.MkArr (src r\<^sub>0) (trg s) \r\<^sub>0\))\<^sup>* \ Maps.REP (Maps.MkArr (src s\<^sub>0) (trg s) \s\<^sub>1\)" proof - have "r\<^sub>0 \ Maps.REP (Maps.MkArr (src r\<^sub>0) (trg s) \r\<^sub>0\)" using Maps.REP_CLS composable isomorphic_symmetric r\<^sub>0s\<^sub>1.k_is_map by fastforce hence 3: "isomorphic r\<^sub>0\<^sup>* (Maps.REP (Maps.MkArr (src r\<^sub>0) (trg s) \r\<^sub>0\))\<^sup>*" using \.leg0_is_map by (simp add: isomorphic_to_left_adjoint_implies_isomorphic_right_adjoint) moreover have 4: "s\<^sub>1 \ Maps.REP (Maps.MkArr (src s\<^sub>0) (trg s) \s\<^sub>1\)" using Maps.REP_CLS isomorphic_symmetric r\<^sub>0s\<^sub>1.h_is_map by fastforce ultimately show ?thesis proof - have 1: "src r\<^sub>0\<^sup>* = trg s\<^sub>1" using \.T0.antipar(2) r\<^sub>0s\<^sub>1.cospan by argo have 2: "ide s\<^sub>1" by simp have "src (Maps.REP (Maps.MkArr (src r\<^sub>0) (trg s) \r\<^sub>0\))\<^sup>* = trg s\<^sub>1" by (metis 3 \.T0.antipar(2) isomorphic_implies_hpar(3) r\<^sub>0s\<^sub>1.cospan) thus ?thesis using 1 2 by (meson 3 4 hcomp_ide_isomorphic hcomp_isomorphic_ide isomorphic_implies_ide(2) isomorphic_transitive) qed qed ultimately have 1: "Maps.PRJ\<^sub>0 \\r\<^sub>0\\ \\s\<^sub>1\\ = \\prj\<^sub>0 s\<^sub>1 r\<^sub>0\\ \ Maps.PRJ\<^sub>1 \\r\<^sub>0\\ \\s\<^sub>1\\ = \\prj\<^sub>1 s\<^sub>1 r\<^sub>0\\" using r\<^sub>0s\<^sub>1.isomorphic_implies_same_tab by simp show "Maps.PRJ\<^sub>0 \\r\<^sub>0\\ \\s\<^sub>1\\ = \\prj\<^sub>0 s\<^sub>1 r\<^sub>0\\" using 1 by simp show "Maps.PRJ\<^sub>1 \\r\<^sub>0\\ \\s\<^sub>1\\ = \\prj\<^sub>1 s\<^sub>1 r\<^sub>0\\" using 1 by simp qed end context identity_in_bicategory_of_spans begin interpretation Maps: maps_category V H \ \ src trg .. interpretation Span: span_bicategory Maps.comp Maps.PRJ\<^sub>0 Maps.PRJ\<^sub>1 .. notation isomorphic (infix "\" 50) text \ A 1-cell \r\ in a bicategory of spans is a map if and only if the ``input leg'' \tab\<^sub>0 r\ of the chosen tabulation of \r\ is an equivalence map. Since a tabulation of \r\ is unique up to equivalence, and equivalence maps compose, the result actually holds if ``chosen tabulation'' is replaced by ``any tabulation''. \ lemma is_map_iff_tab\<^sub>0_is_equivalence: shows "is_left_adjoint r \ equivalence_map (tab\<^sub>0 r)" proof assume 1: "equivalence_map (tab\<^sub>0 r)" have 2: "quasi_inverses (tab\<^sub>0 r) (tab\<^sub>0 r)\<^sup>*" proof - obtain g' \' \' where \'\': "equivalence_in_bicategory V H \ \ src trg (tab\<^sub>0 r) g' \' \'" using 1 equivalence_map_def by auto have "adjoint_pair (tab\<^sub>0 r) g'" using \'\' quasi_inverses_def quasi_inverses_are_adjoint_pair by blast moreover have "adjoint_pair (tab\<^sub>0 r) (tab\<^sub>0 r)\<^sup>*" using T0.adjunction_in_bicategory_axioms adjoint_pair_def by auto ultimately have "g' \ (tab\<^sub>0 r)\<^sup>*" using left_adjoint_determines_right_up_to_iso by simp thus ?thesis using \'\' quasi_inverses_def quasi_inverses_isomorphic_right by blast qed obtain \' \' where \'\': "equivalence_in_bicategory V H \ \ src trg (tab\<^sub>0 r) (tab\<^sub>0 r)\<^sup>* \' \'" using 2 quasi_inverses_def by auto interpret \'\': equivalence_in_bicategory V H \ \ src trg \tab\<^sub>0 r\ \(tab\<^sub>0 r)\<^sup>*\ \' \' using \'\' by auto have "is_left_adjoint (tab\<^sub>0 r)\<^sup>*" using 2 quasi_inverses_are_adjoint_pair quasi_inverses_symmetric by blast hence "is_left_adjoint (tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*)" using left_adjoints_compose by simp thus "is_left_adjoint r" using yields_isomorphic_representation isomorphic_def left_adjoint_preserved_by_iso' by meson next assume 1: "is_left_adjoint r" have 2: "is_left_adjoint (tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*)" using 1 yields_isomorphic_representation left_adjoint_preserved_by_iso' isomorphic_symmetric isomorphic_def by meson hence "is_left_adjoint (tab\<^sub>0 r)\<^sup>*" using is_ide BS4 [of "tab\<^sub>1 r" "(tab\<^sub>0 r)\<^sup>*"] by auto hence "is_left_adjoint ((tab\<^sub>0 r)\<^sup>* \ tab\<^sub>0 r) \ is_left_adjoint (tab\<^sub>0 r \ (tab\<^sub>0 r)\<^sup>*)" using left_adjoints_compose T0.antipar by simp hence 3: "iso \ \ iso \" using BS3 [of "src (tab\<^sub>0 r)" "(tab\<^sub>0 r)\<^sup>* \ tab\<^sub>0 r" \ \] BS3 [of "tab\<^sub>0 r \ (tab\<^sub>0 r)\<^sup>*" "trg (tab\<^sub>0 r)" \ \] T0.unit_in_hom T0.counit_in_hom obj_is_self_adjoint by auto hence "equivalence_in_bicategory V H \ \ src trg (tab\<^sub>0 r) (tab\<^sub>0 r)\<^sup>* \ \" apply unfold_locales by auto thus "equivalence_map (tab\<^sub>0 r)" using equivalence_map_def by blast qed text \ The chosen tabulation (and indeed, any other tabulation, which is equivalent) of an object is symmetric in the sense that its two legs are isomorphic. \ lemma obj_has_symmetric_tab: assumes "obj r" shows "tab\<^sub>0 r \ tab\<^sub>1 r" proof - have "tab\<^sub>0 r \ r \ tab\<^sub>0 r" proof - have "trg (tab\<^sub>0 r) = r" using assms by auto moreover have "\\\<^sup>-\<^sup>1[tab\<^sub>0 r] : tab\<^sub>0 r \ trg (tab\<^sub>0 r) \ tab\<^sub>0 r\ \ iso \\<^sup>-\<^sup>1[tab\<^sub>0 r]" using assms by simp ultimately show ?thesis unfolding isomorphic_def by metis qed also have "... \ tab\<^sub>1 r" proof - have "\tab : tab\<^sub>1 r \ r \ tab\<^sub>0 r\" using tab_in_hom by simp moreover have "is_left_adjoint (r \ tab\<^sub>0 r)" using assms left_adjoints_compose obj_is_self_adjoint by simp ultimately show ?thesis using BS3 [of "tab\<^sub>1 r" "r \ tab\<^sub>0 r" tab tab] isomorphic_symmetric isomorphic_def by auto qed finally show ?thesis by simp qed text \ The chosen tabulation of \r\ determines a span in \Maps(B)\. \ lemma determines_span: assumes "ide r" shows "span_in_category Maps.comp \Leg0 = \\tab\<^sub>0 r\\, Leg1 = \\tab\<^sub>1 r\\\" using assms Maps.CLS_in_hom [of "tab\<^sub>0 r"] Maps.CLS_in_hom [of "tab\<^sub>1 r"] tab\<^sub>0_in_hom tab\<^sub>1_in_hom apply unfold_locales by fastforce end subsection "Arrows of Tabulations in Maps" text \ Here we consider the situation of two tabulations: a tabulation \\\ of \r\ and a tabulation \\\ of \s\, both ``legs'' of each tabulation being maps, together with an arbitrary 2-cell \\\ : r \ s\\. The 2-cell \\\ at the base composes with the tabulation \\\ to yield a 2-cell \\ = (\ \ r\<^sub>0) \ \\ ``over'' s. By property \T1\ of tabulation \\\, this induces a map from the apex of \\\ to the apex of \\\, which together with the other data forms a triangular prism whose sides commute up to (unique) isomorphism. \ text \ $$ \xymatrix{ && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \dtwocell\omit{^<-1>\sigma} & \\ &{\rm trg}~s && {\rm src}~s \ar[ll]^{s} \\ & \rrtwocell\omit{^\mu} &&\\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \ar@ {.>}[uuur]^<>(0.3){{\rm chine}} \dtwocell\omit{^\rho}& \\ {\rm trg}~r \ar@ {=}[uuur] && {\rm src}~r \ar[ll]^{r} \ar@ {=}[uuur] } $$ \ locale arrow_of_tabulations_in_maps = bicategory_of_spans V H \ \ src trg + \: tabulation_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 + \: tabulation_in_maps V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and r :: 'a and \ :: 'a and r\<^sub>0 :: 'a and r\<^sub>1 :: 'a and s :: 'a and \ :: 'a and s\<^sub>0 :: 'a and s\<^sub>1 :: 'a and \ :: 'a + assumes in_hom: "\\ : r \ s\" begin abbreviation (input) \ where "\ \ (\ \ r\<^sub>0) \ \" lemma \_in_hom [intro]: shows "\\ : src \ \ trg \\" and "\\ : r\<^sub>1 \ s \ r\<^sub>0\" proof - show "\\ : r\<^sub>1 \ s \ r\<^sub>0\" using in_hom \.leg0_in_hom(2) \.tab_in_vhom' by auto thus "\\ : src \ \ trg \\" by (metis \.tab_simps(3) \.base_in_hom(2) \.tab_simps(3) \.base_in_hom(2) arrI in_hom seqI' vcomp_in_hhom vseq_implies_hpar(1-2)) qed lemma \_simps [simp]: shows "arr \" and "src \ = src \" and "trg \ = trg \" and "dom \ = r\<^sub>1" and "cod \ = s \ r\<^sub>0" using \_in_hom by auto abbreviation is_induced_map where "is_induced_map w \ \.is_induced_by_cell w r\<^sub>0 \" text \ The following is an equivalent restatement, in elementary terms, of the conditions for being an induced map. \ abbreviation (input) is_induced_map' where "is_induced_map' w \ ide w \ (\\ \. \\ : s\<^sub>0 \ w \ r\<^sub>0\ \ \\ : r\<^sub>1 \ s\<^sub>1 \ w\ \ iso \ \ \ = (s \ \) \ \[s, s\<^sub>0, w] \ (\ \ w) \ \)" lemma is_induced_map_iff: shows "is_induced_map w \ is_induced_map' w" proof assume w: "is_induced_map' w" show "is_induced_map w" proof have 1: "dom \ = r\<^sub>1" by auto interpret w: arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 \dom \\ s \ s\<^sub>0 s\<^sub>1 w proof - have "arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 r\<^sub>1 s \ s\<^sub>0 s\<^sub>1 w" using w apply unfold_locales by auto thus "arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 (dom \) s \ s\<^sub>0 s\<^sub>1 w" using 1 by simp qed show "arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 (dom \) s\<^sub>0 s\<^sub>1 w" using w.arrow_of_spans_of_maps_axioms by auto show "\.composite_cell w w.the_\ \ w.the_\ = \" proof - obtain \ \ where \\: "\\ : s\<^sub>0 \ w \ r\<^sub>0\ \ \\ : r\<^sub>1 \ s\<^sub>1 \ w\ \ iso \ \ \ = (s \ \) \ \[s, s\<^sub>0, w] \ (\ \ w) \ \" using w w.the_\_props(1) by auto have "(s \ \) \ \[s, s\<^sub>0, w] \ (\ \ w) \ \ = \" using \\ by argo moreover have "\ = w.the_\ \ \ = w.the_\" using \\ 1 w.the_\_props(1) w.leg0_uniquely_isomorphic w.leg1_uniquely_isomorphic by auto ultimately show ?thesis using comp_assoc by simp qed qed next assume w: "is_induced_map w" show "is_induced_map' w" proof - interpret w: arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 r\<^sub>1 s\<^sub>0 s\<^sub>1 w using w in_hom by auto interpret w: arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 r\<^sub>1 s \ s\<^sub>0 s\<^sub>1 w .. have "dom \ = r\<^sub>1" by auto thus ?thesis using w comp_assoc w.the_\_props(1) w.the_\_props(2) w.uw\ by metis qed qed lemma exists_induced_map: shows "\w. is_induced_map w" proof - obtain w \ \ where w\\: "ide w \ \\ : s\<^sub>0 \ w \ r\<^sub>0\ \ \\ : r\<^sub>1 \ s\<^sub>1 \ w\ \ iso \ \ \ = (s \ \) \ \[s, s\<^sub>0, w] \ (\ \ w) \ \" using \_in_hom \.ide_leg0 \.T1 comp_assoc by (metis in_homE) thus ?thesis using is_induced_map_iff by blast qed lemma induced_map_unique: assumes "is_induced_map w" and "is_induced_map w'" shows "w \ w'" using assms \.induced_map_unique by blast definition chine where "chine \ SOME w. is_induced_map w" lemma chine_is_induced_map: shows "is_induced_map chine" unfolding chine_def using exists_induced_map someI_ex [of is_induced_map] by simp lemma chine_in_hom [intro]: shows "\chine : src r\<^sub>0 \ src s\<^sub>0\" and "\chine: chine \ chine\" proof - show "\chine : src r\<^sub>0 \ src s\<^sub>0\" using chine_is_induced_map by (metis \_simps(1) \_simps(4) \.leg1_simps(3) \.ide_base \.ide_leg0 \.leg0_simps(3) \.tab_simps(2) arrow_of_spans_of_maps.is_ide arrow_of_spans_of_maps.the_\_simps(2) assoc_simps(2) hseqE in_hhom_def seqE src_vcomp vseq_implies_hpar(1)) show "\chine: chine \ chine\" using chine_is_induced_map by (meson arrow_of_spans_of_maps.is_ide ide_in_hom(2)) qed lemma chine_simps [simp]: shows "arr chine" and "ide chine" and "src chine = src r\<^sub>0" and "trg chine = src s\<^sub>0" and "dom chine = chine" and "cod chine = chine" using chine_in_hom apply auto by (meson arrow_of_spans_of_maps.is_ide chine_is_induced_map) end sublocale arrow_of_tabulations_in_maps \ arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 r\<^sub>1 s\<^sub>0 s\<^sub>1 chine using chine_is_induced_map is_induced_map_iff by unfold_locales auto sublocale arrow_of_tabulations_in_maps \ arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 r\<^sub>1 s \ s\<^sub>0 s\<^sub>1 chine .. context arrow_of_tabulations_in_maps begin text \ The two factorizations of the composite 2-cell \\\ amount to a naturality condition. \ lemma \_naturality: shows "(\ \ r\<^sub>0) \ \ = (s \ the_\) \ \[s, s\<^sub>0, chine] \ (\ \ chine) \ the_\" using chine_is_induced_map is_induced_map_iff by (metis leg0_uniquely_isomorphic(2) leg1_uniquely_isomorphic(2) the_\_props(1) uw\) lemma induced_map_preserved_by_iso: assumes "is_induced_map w" and "isomorphic w w'" shows "is_induced_map w'" proof - interpret w: arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 r\<^sub>1 s\<^sub>0 s\<^sub>1 w using assms in_hom by auto interpret w: arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 r\<^sub>1 s \ s\<^sub>0 s\<^sub>1 w .. obtain \ where \: "\\ : w \ w'\ \ iso \" using assms(2) isomorphic_def by auto show ?thesis proof interpret w': arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 \dom \\ s\<^sub>0 s\<^sub>1 w' proof show "is_left_adjoint r\<^sub>0" by (simp add: \.satisfies_T0) show "is_left_adjoint (dom \)" by (simp add: \.leg1_is_map) show "ide w'" using assms by force show "\\. \\ : s\<^sub>0 \ w' \ r\<^sub>0\" using \ w.the_\_props \.leg0_in_hom(2) assms(2) comp_in_homI hcomp_in_vhom inv_in_hom isomorphic_implies_hpar(4) w.the_\_simps(4) w.w_simps(4) by metis have "\(s\<^sub>1 \ \) \ w.the_\ : r\<^sub>1 \ s\<^sub>1 \ w'\ \ iso ((s\<^sub>1 \ \) \ w.the_\)" proof (intro conjI) show "\(s\<^sub>1 \ \) \ w.the_\ : r\<^sub>1 \ s\<^sub>1 \ w'\" using \ w.the_\_props by (intro comp_in_homI, auto) thus "iso ((s\<^sub>1 \ \) \ w.the_\)" using \ w.the_\_props by (meson \.ide_leg1 arrI iso_hcomp hseqE ide_is_iso isos_compose seqE) qed hence "\\. \\ : r\<^sub>1 \ s\<^sub>1 \ w'\ \ iso \" by auto thus "\\. \\ : dom \ \ s\<^sub>1 \ w'\ \ iso \" by auto qed interpret w': arrow_of_spans_of_maps_to_tabulation V H \ \ src trg r\<^sub>0 \dom \\ s \ s\<^sub>0 s\<^sub>1 w' .. show "arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 (dom \) s\<^sub>0 s\<^sub>1 w'" using w'.arrow_of_spans_of_maps_axioms by auto show "\.composite_cell w' w'.the_\ \ w'.the_\ = \" proof - have 1: "w'.the_\ = w.the_\ \ (s\<^sub>0 \ inv \)" proof - have "\w.the_\ \ (s\<^sub>0 \ inv \) : s\<^sub>0 \ w' \ r\<^sub>0\" using w.the_\_props \ by (intro comp_in_homI, auto) moreover have "\w'.the_\ : s\<^sub>0 \ w' \ r\<^sub>0\" using w'.the_\_props by simp ultimately show ?thesis using w'.leg0_uniquely_isomorphic(2) by blast qed moreover have "w'.the_\ = (s\<^sub>1 \ \) \ w.the_\" proof - have "\(s\<^sub>1 \ \) \ w.the_\ : dom \ \ s\<^sub>1 \ w'\" using w.the_\_props \ by (intro comp_in_homI, auto) moreover have "iso ((s\<^sub>1 \ \) \ w.the_\)" using w.the_\_props \ iso_hcomp by (meson \.ide_leg1 arrI calculation hseqE ide_is_iso isos_compose seqE) ultimately show ?thesis using w'.the_\_props w'.leg1_uniquely_isomorphic(2) by blast qed ultimately have "\.composite_cell w' w'.the_\ \ w'.the_\ = \.composite_cell w' (w.the_\ \ (s\<^sub>0 \ inv \)) \ (s\<^sub>1 \ \) \ w.the_\" by simp also have "... = (s \ w.the_\ \ (s\<^sub>0 \ inv \)) \ \[s, s\<^sub>0, w'] \ (\ \ w') \ (s\<^sub>1 \ \) \ w.the_\" using comp_assoc by presburger also have "... = (s \ w.the_\) \ ((s \ s\<^sub>0 \ inv \) \ \[s, s\<^sub>0, w'] \ (\ \ w') \ (s\<^sub>1 \ \)) \ w.the_\" using 1 comp_assoc w'.the_\_simps(1) whisker_left by auto also have "... = (s \ w.the_\) \ (\[s, s\<^sub>0, w] \ (\ \ w)) \ w.the_\" proof - have "(s \ s\<^sub>0 \ inv \) \ \[s, s\<^sub>0, w'] \ (\ \ w') \ (s\<^sub>1 \ \) = \[s, s\<^sub>0, w] \ (\ \ w)" proof - have "(s \ s\<^sub>0 \ inv \) \ \[s, s\<^sub>0, w'] \ (\ \ w') \ (s\<^sub>1 \ \) = \[s, s\<^sub>0, w] \ ((s \ s\<^sub>0) \ inv \) \ (\ \ w') \ (s\<^sub>1 \ \)" proof - have "(s \ s\<^sub>0 \ inv \) \ \[s, s\<^sub>0, w'] = \[s, s\<^sub>0, w] \ ((s \ s\<^sub>0) \ inv \)" using assms \ assoc_naturality [of s s\<^sub>0 "inv \"] w.w_simps(4) by (metis \.leg0_simps(2-5) \.base_simps(2-4) arr_inv cod_inv dom_inv in_homE trg_cod) thus ?thesis using comp_assoc by metis qed also have "... = \[s, s\<^sub>0, w] \ (\ \ w) \ (s\<^sub>1 \ inv \) \ (s\<^sub>1 \ \)" proof - have "((s \ s\<^sub>0) \ inv \) \ (\ \ w') = (\ \ w) \ (s\<^sub>1 \ inv \)" using \ comp_arr_dom comp_cod_arr in_hhom_def interchange [of "s \ s\<^sub>0" \ "inv \" w'] interchange [of \ s\<^sub>1 w "inv \"] by auto thus ?thesis using comp_assoc by metis qed also have "... = \[s, s\<^sub>0, w] \ (\ \ w)" proof - have "(\ \ w) \ (s\<^sub>1 \ inv \) \ (s\<^sub>1 \ \) = \ \ w" proof - have "(\ \ w) \ (s\<^sub>1 \ inv \) \ (s\<^sub>1 \ \) = (\ \ w) \ (s\<^sub>1 \ inv \ \ \)" using \ whisker_left in_hhom_def by auto also have "... = (\ \ w) \ (s\<^sub>1 \ w)" using \ comp_inv_arr' by auto also have "... = \ \ w" using whisker_right [of w \ s\<^sub>1] comp_arr_dom in_hhom_def by auto finally show ?thesis by blast qed thus ?thesis by simp qed finally show ?thesis by simp qed thus ?thesis by simp qed also have "... = \" using assms(1) comp_assoc w.is_ide w.the_\_props(1) w.the_\_props(1) by simp finally show ?thesis using comp_assoc by auto qed qed qed end text \ In the special case that \\\ is an identity 2-cell, the induced map from the apex of \\\ to the apex of \\\ is an equivalence map. \ locale identity_arrow_of_tabulations_in_maps = arrow_of_tabulations_in_maps + assumes is_ide: "ide \" begin lemma r_eq_s: shows "r = s" using is_ide by (metis ide_char in_hom in_homE) lemma \_eq_\: shows "\ = \" by (meson \_simps(1) comp_ide_arr ide_hcomp hseq_char' ide_u is_ide seqE seq_if_composable) lemma chine_is_equivalence: shows "equivalence_map chine" proof - obtain w w' \ \ \ \ \' \' where e: "equivalence_in_bicategory (\) (\) \ \ src trg w' w \ \ \ \w : src s\<^sub>0 \ src r\<^sub>0\ \ \w' : src r\<^sub>0 \ src s\<^sub>0\ \ \\ : r\<^sub>0 \ w \ s\<^sub>0\ \ \\ : s\<^sub>1 \ r\<^sub>1 \ w\ \ iso \ \ \ = (s \ \) \ \[s, r\<^sub>0, w] \ (\ \ w) \ \ \ \\' : s\<^sub>0 \ w' \ r\<^sub>0\ \ \\' : r\<^sub>1 \ s\<^sub>1 \ w'\ \ iso \' \ \ = (s \ \') \ \[s, s\<^sub>0, w'] \ (\ \ w') \ \'" using r_eq_s \.apex_unique_up_to_equivalence [of \ r\<^sub>0 r\<^sub>1] \.tabulation_axioms by blast have w': "equivalence_map w'" using e equivalence_map_def by auto hence "is_induced_map w'" using e r_eq_s \_eq_\ is_induced_map_iff comp_assoc equivalence_map_is_ide by metis hence "isomorphic chine w'" using induced_map_unique chine_is_induced_map by simp thus ?thesis using w' equivalence_map_preserved_by_iso isomorphic_symmetric by blast qed end text \ The following gives an interpretation of @{locale arrow_of_tabulations_in_maps} in the special case that the tabulations are those that we have chosen for the domain and codomain of the underlying 2-cell \\\ : r \ s\\. In this case, we can recover \\\ from \\\ via adjoint transpose. \ locale arrow_in_bicategory_of_spans = bicategory_of_spans V H \ \ src trg + r: identity_in_bicategory_of_spans V H \ \ src trg r + s: identity_in_bicategory_of_spans V H \ \ src trg s for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and r :: 'a and s :: 'a and \ :: 'a + assumes in_hom: "\\ : r \ s\" begin abbreviation (input) r\<^sub>0 where "r\<^sub>0 \ tab\<^sub>0 r" abbreviation (input) r\<^sub>1 where "r\<^sub>1 \ tab\<^sub>1 r" abbreviation (input) s\<^sub>0 where "s\<^sub>0 \ tab\<^sub>0 s" abbreviation (input) s\<^sub>1 where "s\<^sub>1 \ tab\<^sub>1 s" lemma is_arrow_of_tabulations_in_maps: shows "arrow_of_tabulations_in_maps V H \ \ src trg r r.tab r\<^sub>0 r\<^sub>1 s s.tab s\<^sub>0 s\<^sub>1 \" using in_hom by unfold_locales auto end sublocale identity_in_bicategory_of_spans \ arrow_in_bicategory_of_spans V H \ \ src trg r r r apply unfold_locales using is_ide by auto context arrow_in_bicategory_of_spans begin interpretation arrow_of_tabulations_in_maps V H \ \ src trg r r.tab r\<^sub>0 r\<^sub>1 s s.tab s\<^sub>0 s\<^sub>1 \ using is_arrow_of_tabulations_in_maps by simp interpretation r: arrow_of_tabulations_in_maps V H \ \ src trg r r.tab r\<^sub>0 r\<^sub>1 r r.tab r\<^sub>0 r\<^sub>1 r using r.is_arrow_of_tabulations_in_maps by simp lemma \_in_terms_of_\: shows "\ = r.T0.trnr\<^sub>\ (cod \) \ \ inv (r.T0.trnr\<^sub>\ r r.tab)" proof - have \: "arr \" using in_hom by auto have "\ \ r.T0.trnr\<^sub>\ r r.tab = r.T0.trnr\<^sub>\ s \" proof - have "\ \ r.T0.trnr\<^sub>\ r r.tab = (\ \ \[r]) \ (r \ r.\) \ \[r, tab\<^sub>0 r, (tab\<^sub>0 r)\<^sup>*] \ (r.tab \ (tab\<^sub>0 r)\<^sup>*)" unfolding r.T0.trnr\<^sub>\_def using comp_assoc by presburger also have "... = \[s] \ ((\ \ src \) \ (r \ r.\)) \ \[r, tab\<^sub>0 r, (tab\<^sub>0 r)\<^sup>*] \ (r.tab \ (tab\<^sub>0 r)\<^sup>*)" using \ runit_naturality comp_assoc by (metis in_hom in_homE) also have "... = \[s] \ (s \ r.\) \ ((\ \ tab\<^sub>0 r \ (tab\<^sub>0 r)\<^sup>*) \ \[r, tab\<^sub>0 r, (tab\<^sub>0 r)\<^sup>*]) \ (r.tab \ (tab\<^sub>0 r)\<^sup>*)" proof - have "(\ \ src \) \ (r \ r.\) = \ \ r.\" using \ interchange comp_arr_dom comp_cod_arr by (metis in_hom in_homE r.T0.counit_simps(1) r.T0.counit_simps(3) r.u_simps(3) src_dom) also have "... = (s \ r.\) \ (\ \ tab\<^sub>0 r \ (tab\<^sub>0 r)\<^sup>*)" using in_hom interchange [of s \ r.\ "tab\<^sub>0 r \ (tab\<^sub>0 r)\<^sup>*"] comp_arr_dom comp_cod_arr r.T0.counit_simps(1) r.T0.counit_simps(2) by auto finally have "(\ \ src \) \ (r \ r.\) = (s \ r.\) \ (\ \ tab\<^sub>0 r \ (tab\<^sub>0 r)\<^sup>*)" by blast thus ?thesis using comp_assoc by presburger qed also have "... = \[s] \ (s \ r.\) \ \[s, tab\<^sub>0 r, (tab\<^sub>0 r)\<^sup>*] \ ((\ \ tab\<^sub>0 r) \ (tab\<^sub>0 r)\<^sup>*) \ (r.tab \ (tab\<^sub>0 r)\<^sup>*)" proof - have "(\ \ tab\<^sub>0 r \ (tab\<^sub>0 r)\<^sup>*) \ \[r, tab\<^sub>0 r, (tab\<^sub>0 r)\<^sup>*] = \[s, tab\<^sub>0 r, (tab\<^sub>0 r)\<^sup>*] \ ((\ \ tab\<^sub>0 r) \ (tab\<^sub>0 r)\<^sup>*)" using \ assoc_naturality [of \ "tab\<^sub>0 r" "(tab\<^sub>0 r)\<^sup>*"] by (metis ide_char in_hom in_homE r.T0.antipar(1) r.T0.ide_right r.u_simps(3) src_dom u_simps(2) u_simps(4-5)) thus ?thesis using comp_assoc by presburger qed also have "... = \[s] \ (s \ r.\) \ \[s, tab\<^sub>0 r, (tab\<^sub>0 r)\<^sup>*] \ ((\ \ tab\<^sub>0 r) \ r.tab \ (tab\<^sub>0 r)\<^sup>*)" using \ whisker_right \_simps(1) by auto also have "... = r.T0.trnr\<^sub>\ s \" unfolding r.T0.trnr\<^sub>\_def by simp finally show ?thesis by blast qed thus ?thesis using \ r.yields_isomorphic_representation invert_side_of_triangle(2) by (metis in_hom in_homE seqI') qed end subsubsection "Vertical Composite" locale vertical_composite_of_arrows_of_tabulations_in_maps = bicategory_of_spans V H \ \ src trg + \: tabulation_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 + \: tabulation_in_maps V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 + \: tabulation_in_maps V H \ \ src trg t \ t\<^sub>0 t\<^sub>1 + \: arrow_of_tabulations_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 s \ s\<^sub>0 s\<^sub>1 \ + \: arrow_of_tabulations_in_maps V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 t \ t\<^sub>0 t\<^sub>1 \ for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and r :: 'a and \ :: 'a and r\<^sub>0 :: 'a and r\<^sub>1 :: 'a and s :: 'a and \ :: 'a and s\<^sub>0 :: 'a and s\<^sub>1 :: 'a and t :: 'a and \ :: 'a and t\<^sub>0 :: 'a and t\<^sub>1 :: 'a and \ :: 'a and \ :: 'a begin text \ $$ \xymatrix{ &&& {\rm src}~\tau \ar[dl]_{t_1} \ar[dr]^{t_0} \dtwocell\omit{^<-1>\tau} & \\ &&{\rm trg}~t && {\rm src}~t \ar[ll]^{s} \\ && \rrtwocell\omit{^\pi} && \\ && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \ar[uuur]^<>(0.3){\pi.{\rm chine}} \dtwocell\omit{^<-1>\sigma} & \\ &{\rm trg}~s \ar@ {=}[uuur] && {\rm src}~s \ar[ll]^{s} \ar@ {=}[uuur] \\ & \rrtwocell\omit{^\mu} &&\\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \ar[uuur]^<>(0.3){\mu.{\rm chine}} \dtwocell\omit{^\rho} & \\ {\rm trg}~r \ar@ {=}[uuur] && {\rm src}~r \ar[ll]^{r} \ar@ {=}[uuur] } $$ \ notation isomorphic (infix "\" 50) interpretation arrow_of_tabulations_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 t \ t\<^sub>0 t\<^sub>1 \\ \ \\ using \.in_hom \.in_hom by (unfold_locales, blast) lemma is_arrow_of_tabulations_in_maps: shows "arrow_of_tabulations_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 t \ t\<^sub>0 t\<^sub>1 (\ \ \)" .. lemma chine_char: shows "chine \ \.chine \ \.chine" proof - have "is_induced_map (\.chine \ \.chine)" proof - let ?f = "\.chine" have f: "\?f : src \ \ src \\ \ is_left_adjoint ?f \ ide ?f \ \.is_induced_map ?f" using \.chine_is_induced_map \.is_map by auto let ?g = "\.chine" have g: "\?g : src \ \ src \\ \ is_left_adjoint ?g \ ide ?g \ \.is_induced_map ?g" using \.chine_is_induced_map \.is_map by auto let ?\ = "\.the_\ \ (\.the_\ \ ?f) \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f]" let ?\ = "\[t\<^sub>1, ?g, ?f] \ (\.the_\ \ ?f) \ \.the_\" have \: "\?\ : t\<^sub>0 \ ?g \ ?f \ r\<^sub>0\" using f g \.the_\_props \.the_\_props by (intro comp_in_homI hcomp_in_vhom, auto+) have \: "\?\ : r\<^sub>1 \ t\<^sub>1 \ ?g \ ?f\" using f g \.the_\_props \.the_\_props by (intro comp_in_homI hcomp_in_vhom, auto) interpret gf: arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 r\<^sub>1 t\<^sub>0 t\<^sub>1 \?g \ ?f\ proof show "ide (?g \ ?f)" by simp show "\\. \\ : t\<^sub>0 \ ?g \ ?f \ r\<^sub>0\" using \ by blast show "\\. \\ : r\<^sub>1 \ t\<^sub>1 \ ?g \ ?f\ \ iso \" using \ \.the_\_props \.the_\_props \.the_\_props \.the_\_props isos_compose [of "\.the_\" "\.the_\"] \.is_ide \ \ide (\.chine \ \.chine)\ \.uw\ \.w_simps(4) \.ide_leg1 \.leg1_simps(3) arrI hseq_char ideD(1) ide_is_iso iso_assoc iso_hcomp isos_compose seqE by metis qed show ?thesis proof (intro conjI) have \_eq: "?\ = gf.the_\" using \ gf.the_\_props gf.leg0_uniquely_isomorphic by auto have \_eq: "?\ = gf.the_\" using \ gf.the_\_props gf.leg1_uniquely_isomorphic by auto have A: "src ?g = trg ?f" using f g by fastforce show "arrow_of_spans_of_maps V H \ \ src trg r\<^sub>0 (dom \) t\<^sub>0 t\<^sub>1 (?g \ ?f)" using gf.arrow_of_spans_of_maps_axioms by simp have "((t \ gf.the_\) \ \[t, t\<^sub>0, ?g \ ?f] \ (\ \ ?g \ ?f)) \ gf.the_\ = \" proof - have "\ = (\ \ r\<^sub>0) \ (\ \ r\<^sub>0) \ \" using whisker_right comp_assoc by (metis \_simps(1) hseqE ide_u seqE) also have "... = ((\ \ r\<^sub>0) \ (s \ \.the_\)) \ \[s, s\<^sub>0, ?f] \ (\ \ ?f) \ \.the_\" using \.\_naturality comp_assoc by simp also have "... = (t \ \.the_\) \ ((\ \ s\<^sub>0 \ ?f) \ \[s, s\<^sub>0, ?f]) \ (\ \ ?f) \ \.the_\" proof - have "(\ \ r\<^sub>0) \ (s \ \.the_\) = \ \ \.the_\" using f comp_arr_dom comp_cod_arr \.the_\_props \.in_hom interchange [of \ s r\<^sub>0 \.the_\] by (metis in_homE) also have "... = (t \ \.the_\) \ (\ \ s\<^sub>0 \ ?f)" using f comp_arr_dom comp_cod_arr \.the_\_props \.in_hom interchange [of t \ \.the_\ "s\<^sub>0 \ ?f"] by (metis in_homE) finally have "(\ \ r\<^sub>0) \ (s \ \.the_\) = (t \ \.the_\) \ (\ \ s\<^sub>0 \ ?f)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (t \ \.the_\) \ \[t, s\<^sub>0, ?f] \ (((\ \ s\<^sub>0) \ ?f) \ (\ \ ?f)) \ \.the_\" proof - have "(\ \ s\<^sub>0 \ ?f) \ \[s, s\<^sub>0, ?f] = \[t, s\<^sub>0, ?f] \ ((\ \ s\<^sub>0) \ ?f)" using f assoc_naturality [of \ s\<^sub>0 ?f] \.in_hom by auto thus ?thesis using comp_assoc by presburger qed also have "... = (t \ \.the_\) \ \[t, s\<^sub>0, ?f] \ (\.\ \ ?f) \ \.the_\" using whisker_right comp_assoc by simp also have "... = (t \ \.the_\) \ \[t, s\<^sub>0, ?f] \ ((t \ \.the_\) \ \[t, t\<^sub>0, ?g] \ (\ \ ?g) \ \.the_\ \ ?f) \ \.the_\" using \.\_naturality by simp also have "... = (t \ \.the_\) \ \[t, s\<^sub>0, ?f] \ (((t \ \.the_\) \ ?f) \ (\[t, t\<^sub>0, ?g] \ ?f) \ ((\ \ ?g) \ ?f) \ (\.the_\ \ ?f)) \ \.the_\" using f g \.the_\_props \.the_\_props whisker_right by (metis \.\_simps(1) \.\_naturality seqE) also have "... = (t \ \.the_\) \ (\[t, s\<^sub>0, ?f] \ ((t \ \.the_\) \ ?f)) \ (\[t, t\<^sub>0, ?g] \ ?f) \ ((\ \ ?g) \ ?f) \ (\.the_\ \ ?f) \ \.the_\" using comp_assoc by presburger also have "... = (t \ \.the_\) \ (t \ \.the_\ \ ?f) \ (\[t, t\<^sub>0 \ ?g, ?f] \ (\[t, t\<^sub>0, ?g] \ ?f)) \ ((\ \ ?g) \ ?f) \ (\.the_\ \ ?f) \ \.the_\" using f \.the_\_props assoc_naturality [of t "\.the_\" ?f] \.\_simps(3) comp_assoc by auto also have "... = (t \ \.the_\) \ (t \ \.the_\ \ ?f) \ (t \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f]) \ \[t, t\<^sub>0, ?g \ ?f] \ (\[t \ t\<^sub>0, ?g, ?f] \ ((\ \ ?g) \ ?f)) \ (\.the_\ \ ?f) \ \.the_\" proof - have "seq \[t, t\<^sub>0, ?g \ ?f] \[t \ t\<^sub>0, ?g, ?f]" using f g by fastforce moreover have "inv (t \ \[t\<^sub>0, ?g, ?f]) = t \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f]" using f g by simp moreover have "iso (t \ \[t\<^sub>0, ?g, ?f])" using f g by simp have "\[t, t\<^sub>0 \ ?g, ?f] \ (\[t, t\<^sub>0, ?g] \ ?f) = (t \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f]) \ \[t, t\<^sub>0, ?g \ ?f] \ \[t \ t\<^sub>0, ?g, ?f]" proof - have "seq \[t, t\<^sub>0, ?g \ ?f] \[t \ t\<^sub>0, ?g, ?f]" using f g by fastforce moreover have "inv (t \ \[t\<^sub>0, ?g, ?f]) = t \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f]" using f g by simp moreover have "iso (t \ \[t\<^sub>0, ?g, ?f])" using f g by simp ultimately show ?thesis using A f g pentagon invert_side_of_triangle(1) by (metis \.w_simps(4) \.ide_base \.ide_leg0 \.leg0_simps(3)) qed thus ?thesis using comp_assoc by presburger qed also have "... = ((t \ \.the_\) \ (t \ \.the_\ \ ?f)) \ (t \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f]) \ \[t, t\<^sub>0, ?g \ ?f] \ (\ \ ?g \ ?f) \ \[t\<^sub>1, ?g, ?f] \ (\.the_\ \ ?f) \ \.the_\" using f g assoc_naturality [of \ ?g ?f] comp_assoc by simp also have "... = (t \ \.the_\ \ (\.the_\ \ ?f) \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f]) \ \[t, t\<^sub>0, ?g \ ?f] \ (\ \ ?g \ ?f) \ \[t\<^sub>1, ?g, ?f] \ (\.the_\ \ ?f) \ \.the_\" proof - have 1: "seq \.the_\ ((\.the_\ \ ?f) \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f])" using \_eq by auto hence "t \ (\.the_\ \ ?f) \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f] = (t \ \.the_\ \ ?f) \ (t \ \\<^sup>-\<^sup>1[t\<^sub>0, ?g, ?f])" using whisker_left \.ide_base by blast thus ?thesis using 1 whisker_left \.ide_base comp_assoc by presburger qed also have "... = ((t \ gf.the_\) \ \[t, t\<^sub>0, ?g \ ?f] \ (\ \ ?g \ ?f)) \ gf.the_\" using \_eq \_eq by (simp add: comp_assoc) finally show ?thesis using comp_assoc by presburger qed thus "((t \ gf.the_\) \ \[t, t\<^sub>0, ?g \ ?f] \ (\ \ ?g \ ?f)) \ arrow_of_spans_of_maps.the_\ (\) (\) (dom ((\ \ \ \ r\<^sub>0) \ \)) t\<^sub>1 (?g \ ?f) = \" by simp qed qed thus ?thesis using chine_is_induced_map induced_map_unique by simp qed end sublocale vertical_composite_of_arrows_of_tabulations_in_maps \ arrow_of_tabulations_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 t \ t\<^sub>0 t\<^sub>1 "\ \ \" using is_arrow_of_tabulations_in_maps by simp subsubsection "Horizontal Composite" locale horizontal_composite_of_arrows_of_tabulations_in_maps = bicategory_of_spans V H \ \ src trg + \: tabulation_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 + \: tabulation_in_maps V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 + \: tabulation_in_maps V H \ \ src trg t \ t\<^sub>0 t\<^sub>1 + \: tabulation_in_maps V H \ \ src trg u \ u\<^sub>0 u\<^sub>1 + \\: composite_tabulation_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 s \ s\<^sub>0 s\<^sub>1 + \\: composite_tabulation_in_maps V H \ \ src trg t \ t\<^sub>0 t\<^sub>1 u \ u\<^sub>0 u\<^sub>1 + \: arrow_of_tabulations_in_maps V H \ \ src trg r \ r\<^sub>0 r\<^sub>1 t \ t\<^sub>0 t\<^sub>1 \ + \: arrow_of_tabulations_in_maps V H \ \ src trg s \ s\<^sub>0 s\<^sub>1 u \ u\<^sub>0 u\<^sub>1 \ for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and r :: 'a and \ :: 'a and r\<^sub>0 :: 'a and r\<^sub>1 :: 'a and s :: 'a and \ :: 'a and s\<^sub>0 :: 'a and s\<^sub>1 :: 'a and t :: 'a and \ :: 'a and t\<^sub>0 :: 'a and t\<^sub>1 :: 'a and u :: 'a and \ :: 'a and u\<^sub>0 :: 'a and u\<^sub>1 :: 'a and \ :: 'a and \ :: 'a begin text \ $$ \xymatrix{ &&& {\rm src}~t_0u_1.\phi \ar[dl]_{\tau\mu.p_1} \ar[dr]^{\tau\mu.p_0} \ddtwocell\omit{^{t_0u_1.\phi}} \\ && {\rm src}~\tau \ar[dl]_{t_1} \ar[dr]^<>(0.4){t_0} \dtwocell\omit{^<-1>\tau} && {\rm src}~\mu \ar[dl]_{u_1} \ar[dr]^{u_0} \dtwocell\omit{^<-1>\mu} & \\ & {\rm trg}~t && {\rm src}~t = {\rm trg}~u \ar[ll]^{t} && {\rm src}~u \ar[ll]^{u} \\ & \xtwocell[r]{}\omit{^\omega} & {\rm src}~r_0s_1.\phi \ar[uuur]_<>(0.2){{\rm chine}} \ar[dl]^{\rho\sigma.p_1} \ar[dr]_{\rho\sigma.p_0\hspace{20pt}} \ddtwocell\omit{^{r_0s_1.\phi}} & \rrtwocell\omit{^\chi} && \\ & {\rm src}~\rho \ar[dl]_{r_1} \ar[dr]^{r_0} \ar[uuur]^<>(0.4){\omega.{\rm chine}} \dtwocell\omit{^\rho} && {\rm src}~\sigma \ar[dl]_{s_1} \ar[dr]^{s_0} \ar[uuur]^<>(0.4){\chi.{\rm chine}} \dtwocell\omit{^<-1>\sigma} & \\ {\rm trg}~r \ar@ {=}[uuur] && {\rm src}~r = {\rm trg}~s \ar[ll]^{r} \ar@ {=}[uuur] && {\rm src}~s \ar[ll]^{s} \ar@ {=}[uuur] \\ } $$ \ notation isomorphic (infix "\" 50) interpretation arrow_of_tabulations_in_maps V H \ \ src trg \r \ s\ \\.tab \s\<^sub>0 \ \\.p\<^sub>0\ \r\<^sub>1 \ \\.p\<^sub>1\ \t \ u\ \\.tab \u\<^sub>0 \ \\.p\<^sub>0\ \t\<^sub>1 \ \\.p\<^sub>1\ \\ \ \\ using \\.composable \.in_hom \.in_hom by unfold_locales auto lemma is_arrow_of_tabulations_in_maps: shows "arrow_of_tabulations_in_maps V H \ \ src trg (r \ s) \\.tab (s\<^sub>0 \ \\.p\<^sub>0) (r\<^sub>1 \ \\.p\<^sub>1) (t \ u) \\.tab (u\<^sub>0 \ \\.p\<^sub>0) (t\<^sub>1 \ \\.p\<^sub>1) (\ \ \)" .. sublocale arrow_of_tabulations_in_maps V H \ \ src trg \r \ s\ \\.tab \s\<^sub>0 \ \\.p\<^sub>0\ \r\<^sub>1 \ \\.p\<^sub>1\ \t \ u\ \\.tab \u\<^sub>0 \ \\.p\<^sub>0\ \t\<^sub>1 \ \\.p\<^sub>1\ \\ \ \\ using is_arrow_of_tabulations_in_maps by simp interpretation Maps: maps_category V H \ \ src trg .. notation Maps.comp (infixr "\" 55) interpretation r\<^sub>0s\<^sub>1: cospan_of_maps_in_bicategory_of_spans \(\)\ \(\)\ \ \ src trg s\<^sub>1 r\<^sub>0 using \.leg0_is_map \.leg1_is_map \\.composable apply unfold_locales by auto interpretation r\<^sub>0s\<^sub>1: arrow_of_tabulations_in_maps \(\)\ \(\)\ \ \ src trg \r\<^sub>0\<^sup>* \ s\<^sub>1\ r\<^sub>0s\<^sub>1.tab r\<^sub>0s\<^sub>1.p\<^sub>0 r\<^sub>0s\<^sub>1.p\<^sub>1 \r\<^sub>0\<^sup>* \ s\<^sub>1\ r\<^sub>0s\<^sub>1.tab r\<^sub>0s\<^sub>1.p\<^sub>0 r\<^sub>0s\<^sub>1.p\<^sub>1 \r\<^sub>0\<^sup>* \ s\<^sub>1\ using r\<^sub>0s\<^sub>1.is_arrow_of_tabulations_in_maps by simp interpretation t\<^sub>0u\<^sub>1: cospan_of_maps_in_bicategory_of_spans \(\)\ \(\)\ \ \ src trg u\<^sub>1 t\<^sub>0 using \.leg0_is_map \.leg1_is_map \\.composable apply unfold_locales by auto interpretation t\<^sub>0u\<^sub>1: arrow_of_tabulations_in_maps \(\)\ \(\)\ \ \ src trg \t\<^sub>0\<^sup>* \ u\<^sub>1\ t\<^sub>0u\<^sub>1.tab t\<^sub>0u\<^sub>1.p\<^sub>0 t\<^sub>0u\<^sub>1.p\<^sub>1 \t\<^sub>0\<^sup>* \ u\<^sub>1\ t\<^sub>0u\<^sub>1.tab t\<^sub>0u\<^sub>1.p\<^sub>0 t\<^sub>0u\<^sub>1.p\<^sub>1 \t\<^sub>0\<^sup>* \ u\<^sub>1\ using t\<^sub>0u\<^sub>1.is_arrow_of_tabulations_in_maps by simp interpretation E: self_evaluation_map V H \ \ src trg .. notation E.eval ("\_\") no_notation in_hom ("\_ : _ \ _\") text \ The following lemma states that the rectangular faces of the ``top prism'' commute up to isomorphism. This was not already proved in @{locale composite_tabulation_in_maps}, because there we did not consider any composite structure of the ``source'' 2-cell. There are common elements, though to the proof that the composite of tabulations is a tabulation and the present lemma. The proof idea is to use property \T2\ of the ``base'' tabulations to establish the existence of the desired isomorphisms. The proofs have to be carried out in sequence, starting from the ``output'' side, because the arrow \\\ required in the hypotheses of \T2\ depends, for the ``input'' tabulation, on the isomorphism constructed for the ``output'' tabulation. \ lemma prj_chine: shows "\\.p\<^sub>0 \ chine \ \.chine \ \\.p\<^sub>0" and "\\.p\<^sub>1 \ chine \ \.chine \ \\.p\<^sub>1" proof - have 1: "arrow_of_spans_of_maps V H \ \ src trg (s\<^sub>0 \ \\.p\<^sub>0) (r\<^sub>1 \ \\.p\<^sub>1) (u\<^sub>0 \ \\.p\<^sub>0) (t\<^sub>1 \ \\.p\<^sub>1) chine \ (((t \ u) \ the_\) \ \[t \ u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\\.tab \ chine)) \ the_\ = ((\ \ \) \ s\<^sub>0 \ \\.p\<^sub>0) \ \\.tab" using chine_is_induced_map by simp let ?u\<^sub>\ = "u \ s\<^sub>0 \ \\.p\<^sub>0" let ?w\<^sub>\ = "\.chine \ \\.p\<^sub>1" let ?w\<^sub>\' = "\\.p\<^sub>1 \ chine" have u\<^sub>\: "ide ?u\<^sub>\" using \.u_simps(3) by auto have w\<^sub>\: "ide ?w\<^sub>\ \ is_left_adjoint ?w\<^sub>\" by (simp add: \.is_map \.T0.antipar(1) left_adjoints_compose) have w\<^sub>\': "ide ?w\<^sub>\' \ is_left_adjoint ?w\<^sub>\'" by (simp add: is_map left_adjoints_compose) let ?\\<^sub>\ = "\[u, s\<^sub>0, \\.p\<^sub>0] \ ((\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1]" let ?\\<^sub>\' = "(u \ the_\) \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ (t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]" let ?\\<^sub>\ = "\[t\<^sub>1, \\.p\<^sub>1, chine] \ the_\ \ (inv \.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>1, \.chine, \\.p\<^sub>1]" have \\<^sub>\: "\?\\<^sub>\ : t\<^sub>0 \ ?w\<^sub>\ \ ?u\<^sub>\\" using \.T0.antipar(1) \.the_\_in_hom \.u_simps(3) by (intro comp_in_homI, auto) have \\<^sub>\': "\?\\<^sub>\' : t\<^sub>0 \ ?w\<^sub>\' \ ?u\<^sub>\\" proof (intro comp_in_homI) show "\\\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine] : t\<^sub>0 \ \\.p\<^sub>1 \ chine \ (t\<^sub>0 \ \\.p\<^sub>1) \ chine\" using t\<^sub>0u\<^sub>1.p\<^sub>1_simps assoc'_in_hom by simp show "\t\<^sub>0u\<^sub>1.\ \ chine : (t\<^sub>0 \ \\.p\<^sub>1) \ chine \ (u\<^sub>1 \ \\.p\<^sub>0) \ chine\" using \.T0.antipar(1) by (intro hcomp_in_vhom, auto) show "\(\ \ \\.p\<^sub>0) \ chine : (u\<^sub>1 \ \\.p\<^sub>0) \ chine \ ((u \ u\<^sub>0) \ \\.p\<^sub>0) \ chine\" by (intro hcomp_in_vhom, auto) show "\\[u, u\<^sub>0, \\.p\<^sub>0] \ chine : ((u \ u\<^sub>0) \ \\.p\<^sub>0) \ chine \ (u \ u\<^sub>0 \ \\.p\<^sub>0) \ chine\" using assoc_in_hom by auto show "\\[u, u\<^sub>0 \ \\.p\<^sub>0, chine] : (u \ u\<^sub>0 \ \\.p\<^sub>0) \ chine \ u \ (u\<^sub>0 \ \\.p\<^sub>0) \ chine\" by auto show "\u \ the_\ : u \ (u\<^sub>0 \ \\.p\<^sub>0) \ chine \ ?u\<^sub>\\" by (intro hcomp_in_vhom, auto) qed have \\<^sub>\: "\?\\<^sub>\ : t\<^sub>1 \ ?w\<^sub>\ \ t\<^sub>1 \ ?w\<^sub>\'\" proof (intro comp_in_homI) show "\\\<^sup>-\<^sup>1[t\<^sub>1, \.chine, \\.p\<^sub>1] : t\<^sub>1 \ ?w\<^sub>\ \ (t\<^sub>1 \ \.chine) \ \\.p\<^sub>1\" using \.T0.antipar(1) by auto show "\inv \.the_\ \ \\.p\<^sub>1 : (t\<^sub>1 \ \.chine) \ \\.p\<^sub>1 \ r\<^sub>1 \ \\.p\<^sub>1\" using \.the_\_props \.T0.antipar(1) by (intro hcomp_in_vhom, auto) show "\the_\ : r\<^sub>1 \ \\.p\<^sub>1 \ (t\<^sub>1 \ \\.p\<^sub>1) \ chine\" using the_\_in_hom(2) by simp show "\\[t\<^sub>1, \\.p\<^sub>1, chine] : (t\<^sub>1 \ \\.p\<^sub>1) \ chine \ t\<^sub>1 \ ?w\<^sub>\'\" using t\<^sub>0u\<^sub>1.p\<^sub>1_simps assoc_in_hom by simp qed define LHS where "LHS = (t \ ?\\<^sub>\) \ \[t, t\<^sub>0, ?w\<^sub>\] \ (\ \ ?w\<^sub>\)" have LHS: "\LHS : t\<^sub>1 \ ?w\<^sub>\ \ t \ ?u\<^sub>\\" proof (unfold LHS_def, intro comp_in_homI) show "\\ \ ?w\<^sub>\ : t\<^sub>1 \ \.chine \ \\.p\<^sub>1 \ (t \ t\<^sub>0) \ ?w\<^sub>\\" using \.T0.antipar(1) by (intro hcomp_in_vhom, auto) show "\\[t, t\<^sub>0, ?w\<^sub>\] : (t \ t\<^sub>0) \ ?w\<^sub>\ \ t \ t\<^sub>0 \ ?w\<^sub>\\" using \.T0.antipar(1) by auto show "\t \ ?\\<^sub>\ : t \ t\<^sub>0 \ ?w\<^sub>\ \ t \ ?u\<^sub>\\" proof - have "src t = trg (t\<^sub>0 \ \.chine \ r\<^sub>0s\<^sub>1.p\<^sub>1)" by (metis \.u_simps(3) \.ide_base \.ide_leg0 \.leg1_simps(3) \\.composable \\<^sub>\ arrI assoc_simps(3) r\<^sub>0s\<^sub>1.ide_u r\<^sub>0s\<^sub>1.p\<^sub>0_simps trg_vcomp vconn_implies_hpar(2)) thus ?thesis using \\<^sub>\ by blast qed qed define RHS where "RHS = ((t \ ?\\<^sub>\') \ \[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\')) \ ?\\<^sub>\" have RHS: "\RHS : t\<^sub>1 \ ?w\<^sub>\ \ t \ ?u\<^sub>\\" unfolding RHS_def proof show "\?\\<^sub>\ : t\<^sub>1 \ ?w\<^sub>\ \ t\<^sub>1 \ ?w\<^sub>\'\" using \\<^sub>\ by simp show "\(t \ ?\\<^sub>\') \ \[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\') : t\<^sub>1 \ ?w\<^sub>\' \ t \ ?u\<^sub>\\" proof show "\\[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\') : t\<^sub>1 \ ?w\<^sub>\' \ t \ t\<^sub>0 \ ?w\<^sub>\'\" using \.T0.antipar(1) by fastforce show "\t \ ?\\<^sub>\' : t \ t\<^sub>0 \ ?w\<^sub>\' \ t \ ?u\<^sub>\\" using w\<^sub>\' \\<^sub>\' \.leg0_simps(2) \.leg0_simps(3) hseqI' ideD(1) t\<^sub>0u\<^sub>1.p\<^sub>1_simps trg_hcomp \.base_in_hom(2) hcomp_in_vhom by presburger qed qed have eq: "LHS = RHS" proof - have "\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ LHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] \ (\.the_\ \ \\.p\<^sub>1) = \" proof - text \ Here we use \\.\_naturality\ to replace @{term \.chine} in favor of @{term \}. We have to bring @{term \.the_\}, @{term \}, and @{term \.the_\} together, with @{term \\.p\<^sub>1} on the right. \ have "\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ LHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] \ (\.the_\ \ \\.p\<^sub>1) = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \[u, s\<^sub>0, \\.p\<^sub>0] \ ((\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1]) \ \[t, t\<^sub>0, \.chine \ \\.p\<^sub>1] \ (\ \ \.chine \ \\.p\<^sub>1) \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] \ (\.the_\ \ \\.p\<^sub>1)" unfolding LHS_def using comp_assoc by presburger also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \[u, s\<^sub>0, \\.p\<^sub>0]) \ (t \ (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ (t \ \.the_\ \ \\.p\<^sub>1) \ (t \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1]) \ \[t, t\<^sub>0, \.chine \ \\.p\<^sub>1] \ ((\ \ \.chine \ \\.p\<^sub>1) \ \[t\<^sub>1, \.chine, \\.p\<^sub>1]) \ (\.the_\ \ \\.p\<^sub>1)" proof - have "t \ \[u, s\<^sub>0, \\.p\<^sub>0] \ ((\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] = (t \ \[u, s\<^sub>0, \\.p\<^sub>0]) \ (t \ (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ (t \ \.the_\ \ \\.p\<^sub>1) \ (t \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1])" using whisker_left \.ide_base \\<^sub>\ arrI seqE by (metis (full_types)) thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \[u, s\<^sub>0, \\.p\<^sub>0]) \ (t \ (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ (t \ \.the_\ \ \\.p\<^sub>1) \ ((t \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1]) \ \[t, t\<^sub>0, \.chine \ \\.p\<^sub>1] \ \[t \ t\<^sub>0, \.chine, \\.p\<^sub>1]) \ ((\ \ \.chine) \ \\.p\<^sub>1) \ (\.the_\ \ \\.p\<^sub>1)" proof - have "(\ \ \.chine \ \\.p\<^sub>1) \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] = \[t \ t\<^sub>0, \.chine, \\.p\<^sub>1] \ ((\ \ \.chine) \ \\.p\<^sub>1)" using assoc_naturality by (metis \.w_simps(2-6) \.leg1_simps(3) \\.leg1_simps(2) \.tab_simps(1) \.tab_simps(2,4-5) hseqE r\<^sub>0s\<^sub>1.leg1_simps(5) r\<^sub>0s\<^sub>1.leg1_simps(6)) thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \[u, s\<^sub>0, \\.p\<^sub>0]) \ (t \ (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ ((t \ \.the_\ \ \\.p\<^sub>1) \ \[t, t\<^sub>0 \ \.chine, \\.p\<^sub>1]) \ (\[t, t\<^sub>0, \.chine] \ \\.p\<^sub>1) \ ((\ \ \.chine) \ \\.p\<^sub>1) \ (\.the_\ \ \\.p\<^sub>1)" proof - have "(t \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1]) \ \[t, t\<^sub>0, \.chine \ \\.p\<^sub>1] \ \[t \ t\<^sub>0, \.chine, \\.p\<^sub>1] = \[t, t\<^sub>0 \ \.chine, \\.p\<^sub>1] \ (\[t, t\<^sub>0, \.chine] \ \\.p\<^sub>1)" proof - have "seq \[t, t\<^sub>0, \.chine \ \\.p\<^sub>1] \[t \ t\<^sub>0, \.chine, \\.p\<^sub>1]" by (simp add: \.T0.antipar(1)) moreover have "inv (t \ \[t\<^sub>0, \.chine, \\.p\<^sub>1]) = t \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1]" using \.T0.antipar(1) by simp ultimately show ?thesis using pentagon \.T0.antipar(1) iso_hcomp invert_side_of_triangle(1) [of "\[t, t\<^sub>0, \.chine \ \\.p\<^sub>1] \ \[t \ t\<^sub>0, \.chine, \\.p\<^sub>1]" "t \ \[t\<^sub>0, \.chine, \\.p\<^sub>1]" "\[t, t\<^sub>0 \ \.chine, \\.p\<^sub>1] \ (\[t, t\<^sub>0, \.chine] \ \\.p\<^sub>1)"] by simp qed thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \[u, s\<^sub>0, \\.p\<^sub>0]) \ (t \ (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ \[t, r\<^sub>0, \\.p\<^sub>1] \ (((t \ \.the_\) \ \\.p\<^sub>1) \ (\[t, t\<^sub>0, \.chine] \ \\.p\<^sub>1) \ ((\ \ \.chine) \ \\.p\<^sub>1)) \ (\.the_\ \ \\.p\<^sub>1)" proof - have "(t \ \.the_\ \ \\.p\<^sub>1) \ \[t, t\<^sub>0 \ \.chine, \\.p\<^sub>1] = \[t, r\<^sub>0, \\.p\<^sub>1] \ ((t \ \.the_\) \ \\.p\<^sub>1)" using assoc_naturality [of t \.the_\ \\.p\<^sub>1] \.\_simps(3) \\.leg1_simps(2) hseq_char by auto thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \[u, s\<^sub>0, \\.p\<^sub>0]) \ (t \ (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ \[t, r\<^sub>0, \\.p\<^sub>1] \ ((\ \ r\<^sub>0) \ \ \ \\.p\<^sub>1)" using whisker_right \.T0.antipar(1) \.\_simps(1) \.\_naturality comp_assoc by fastforce also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ ((t \ \[u, s\<^sub>0, \\.p\<^sub>0]) \ (t \ (\ \ s\<^sub>0) \ \\.p\<^sub>0)) \ (t \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ \[t, r\<^sub>0, \\.p\<^sub>1] \ ((\ \ r\<^sub>0) \ \ \ \\.p\<^sub>1)" proof - have "t \ (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0 = (t \ (\ \ s\<^sub>0) \ \\.p\<^sub>0) \ (t \ \ \ \\.p\<^sub>0)" using whisker_left whisker_right \.T0.antipar(1) by (metis (full_types) \.\_simps(1) \.ide_base \\<^sub>\ arrI r\<^sub>0s\<^sub>1.ide_u seqE) thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \ \ s\<^sub>0 \ \\.p\<^sub>0) \ (t \ \[s, s\<^sub>0, \\.p\<^sub>0]) \ (t \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ \[t, r\<^sub>0, \\.p\<^sub>1] \ ((\ \ r\<^sub>0) \ \ \ \\.p\<^sub>1)" proof - have "(t \ \[u, s\<^sub>0, \\.p\<^sub>0]) \ (t \ (\ \ s\<^sub>0) \ \\.p\<^sub>0) = t \ \[u, s\<^sub>0, \\.p\<^sub>0] \ ((\ \ s\<^sub>0) \ \\.p\<^sub>0)" using \.in_hom whisker_left by auto also have "... = t \ (\ \ s\<^sub>0 \ \\.p\<^sub>0) \ \[s, s\<^sub>0, \\.p\<^sub>0]" using assoc_naturality [of \ s\<^sub>0 \\.p\<^sub>0] \.in_hom by auto also have "... = (t \ \ \ s\<^sub>0 \ \\.p\<^sub>0) \ (t \ \[s, s\<^sub>0, \\.p\<^sub>0])" proof - have "seq (\ \ s\<^sub>0 \ \\.p\<^sub>0) \[s, s\<^sub>0, \\.p\<^sub>0]" using \.in_hom apply (intro seqI hseqI) apply auto proof - show "\\ : src u \ trg \\" by (metis \.\_simps(1) \.u_simps(3) hseqE in_hhom_def seqE) show "dom (\ \ s\<^sub>0 \ \\.p\<^sub>0) = s \ s\<^sub>0 \ \\.p\<^sub>0" by (metis \_simps(1) \.in_hom hcomp_simps(1,3) hseq_char in_homE seqE u_simps(4)) qed thus ?thesis using whisker_left by simp qed finally show ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \ \ s\<^sub>0 \ \\.p\<^sub>0) \ (t \ \[s, s\<^sub>0, \\.p\<^sub>0]) \ (t \ \ \ \\.p\<^sub>0) \ (t \ r\<^sub>0s\<^sub>1.\) \ (\[t, r\<^sub>0, \\.p\<^sub>1] \ ((\ \ r\<^sub>0) \ \\.p\<^sub>1)) \ (\ \ \\.p\<^sub>1)" using whisker_right comp_assoc by simp also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ \ \ s\<^sub>0 \ \\.p\<^sub>0) \ (t \ \[s, s\<^sub>0, \\.p\<^sub>0]) \ (t \ \ \ \\.p\<^sub>0) \ ((t \ r\<^sub>0s\<^sub>1.\) \ (\ \ r\<^sub>0 \ \\.p\<^sub>1)) \ \[r, r\<^sub>0, \\.p\<^sub>1] \ (\ \ \\.p\<^sub>1)" using assoc_naturality [of \ r\<^sub>0 \\.p\<^sub>1] \.in_hom \.T0.antipar(1) comp_assoc by fastforce also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ ((t \ \ \ s\<^sub>0 \ \\.p\<^sub>0) \ (t \ \[s, s\<^sub>0, \\.p\<^sub>0]) \ (t \ \ \ \\.p\<^sub>0)) \ (\ \ s\<^sub>1 \ \\.p\<^sub>0) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, \\.p\<^sub>1] \ (\ \ \\.p\<^sub>1)" proof - have "(t \ r\<^sub>0s\<^sub>1.\) \ (\ \ r\<^sub>0 \ \\.p\<^sub>1) = \ \ r\<^sub>0s\<^sub>1.\" using comp_cod_arr comp_arr_dom \.in_hom interchange comp_ide_arr by (metis \.base_in_hom(2) \.ide_base r\<^sub>0s\<^sub>1.\_simps(1) r\<^sub>0s\<^sub>1.\_simps(4) seqI') also have "... = (\ \ s\<^sub>1 \ \\.p\<^sub>0) \ (r \ r\<^sub>0s\<^sub>1.\)" using r\<^sub>0s\<^sub>1.\_in_hom comp_cod_arr comp_arr_dom \.in_hom interchange by (metis in_homE) finally have "(t \ r\<^sub>0s\<^sub>1.\) \ (\ \ r\<^sub>0 \ \\.p\<^sub>1) = (\ \ s\<^sub>1 \ \\.p\<^sub>0) \ (r \ r\<^sub>0s\<^sub>1.\)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ ((t \ (\ \ s\<^sub>0 \ \\.p\<^sub>0) \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0)) \ (\ \ s\<^sub>1 \ \\.p\<^sub>0)) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, \\.p\<^sub>1] \ (\ \ \\.p\<^sub>1)" using whisker_left \.T0.antipar(1) \\.composable \.in_hom comp_assoc by auto also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (\ \ (\ \ s\<^sub>0 \ \\.p\<^sub>0) \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0)) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, \\.p\<^sub>1] \ (\ \ \\.p\<^sub>1)" proof - have "(t \ (\ \ s\<^sub>0 \ \\.p\<^sub>0) \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0)) \ (\ \ s\<^sub>1 \ \\.p\<^sub>0) = \ \ (\ \ s\<^sub>0 \ \\.p\<^sub>0) \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0)" proof - have "\(\ \ s\<^sub>0 \ \\.p\<^sub>0) \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0) : s\<^sub>1 \ \\.p\<^sub>0 \ u \ s\<^sub>0 \ \\.p\<^sub>0\" using \.in_hom \.in_hom by force thus ?thesis by (metis (no_types) \.in_hom comp_arr_dom comp_cod_arr in_homE interchange) qed thus ?thesis using comp_assoc by presburger qed also have "... = (\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (\ \ \ \ s\<^sub>0 \ \\.p\<^sub>0)) \ (r \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0)) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, \\.p\<^sub>1] \ (\ \ \\.p\<^sub>1)" proof - have "\ \ (\ \ s\<^sub>0 \ \\.p\<^sub>0) \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0) = (\ \ \ \ s\<^sub>0 \ \\.p\<^sub>0) \ (r \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0))" proof - have "seq (\ \ s\<^sub>0 \ \\.p\<^sub>0) (\[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0))" using \.in_hom by force thus ?thesis using comp_arr_dom comp_cod_arr \.in_hom \.in_hom interchange by (metis in_homE) qed thus ?thesis using comp_assoc by presburger qed also have "... = ((\ \ \) \ s\<^sub>0 \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ \\.p\<^sub>0] \ (r \ \[s, s\<^sub>0, \\.p\<^sub>0] \ (\ \ \\.p\<^sub>0)) \ (r \ r\<^sub>0s\<^sub>1.\) \ \[r, r\<^sub>0, \\.p\<^sub>1] \ (\ \ \\.p\<^sub>1)" proof - have "\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (\ \ \ \ s\<^sub>0 \ \\.p\<^sub>0) = ((\ \ \) \ s\<^sub>0 \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[r, s, s\<^sub>0 \ \\.p\<^sub>0]" using assoc_naturality \.in_hom \.in_hom by (metis \\.leg0_simps(3) assoc'_naturality hcomp_in_vhomE in_hom in_homE u_simps(2) u_simps(4) u_simps(5)) thus ?thesis using comp_assoc by presburger qed also have "... = \" using whisker_left \\.tab_def comp_assoc by simp finally show ?thesis by auto qed also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ RHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] \ (\.the_\ \ \\.p\<^sub>1)" proof - text \Now cancel @{term \.the_\} and its inverse.\ have "\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ RHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] \ (\.the_\ \ \\.p\<^sub>1) = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ (u \ the_\) \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ (t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t, t\<^sub>0, \\.p\<^sub>1 \ chine] \ (\ \ \\.p\<^sub>1 \ chine) \ \[t\<^sub>1, \\.p\<^sub>1, chine] \ the_\ \ (inv \.the_\ \ \\.p\<^sub>1) \ ((\\<^sup>-\<^sup>1[t\<^sub>1, \.chine, \\.p\<^sub>1]) \ \[t\<^sub>1, \.chine, \\.p\<^sub>1]) \ (\.the_\ \ \\.p\<^sub>1)" unfolding RHS_def using comp_assoc by presburger also have "... = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ (u \ the_\) \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ (t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t, t\<^sub>0, \\.p\<^sub>1 \ chine] \ (\ \ \\.p\<^sub>1 \ chine) \ \[t\<^sub>1, \\.p\<^sub>1, chine] \ the_\" proof - have "the_\ \ (inv \.the_\ \ \\.p\<^sub>1) \ ((\\<^sup>-\<^sup>1[t\<^sub>1, \.chine, \\.p\<^sub>1]) \ \[t\<^sub>1, \.chine, \\.p\<^sub>1]) \ (\.the_\ \ \\.p\<^sub>1) = the_\ \ (inv \.the_\ \ \\.p\<^sub>1) \ ((t\<^sub>1 \ \.chine) \ \\.p\<^sub>1) \ (\.the_\ \ \\.p\<^sub>1)" using comp_inv_arr \.T0.antipar(1) comp_assoc_assoc' by simp also have "... = the_\ \ (inv \.the_\ \ \\.p\<^sub>1) \ (\.the_\ \ \\.p\<^sub>1)" using comp_cod_arr \.T0.antipar(1) by simp also have "... = the_\ \ (r\<^sub>1 \ \\.p\<^sub>1)" using whisker_right [of \\.p\<^sub>1] r\<^sub>0s\<^sub>1.ide_leg1 \.the_\_props(2) \.the_\_simps(4) \.leg1_simps(2) comp_inv_arr' by metis also have "... = the_\" using comp_arr_dom by simp finally show ?thesis using comp_assoc by simp qed text \ Now reassociate to move @{term the_\} to the left and get other terms composed with @{term chine}, where they can be reduced to @{term \\.tab}. \ also have "... = (\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ (t \ u \ the_\)) \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ (t \ (\ \ \\.p\<^sub>0) \ chine) \ (t \ t\<^sub>0u\<^sub>1.\ \ chine) \ (t \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t, t\<^sub>0, \\.p\<^sub>1 \ chine] \ (\ \ \\.p\<^sub>1 \ chine) \ \[t\<^sub>1, \\.p\<^sub>1, chine] \ the_\" proof - have "arr ((u \ the_\) \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ (t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine])" using \\<^sub>\' by blast moreover have "arr (\[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ (t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine])" using calculation by blast moreover have "arr ((\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ (t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine])" using calculation by blast moreover have "arr (((\ \ \\.p\<^sub>0) \ chine) \ (t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine])" using calculation by blast moreover have "arr ((t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine])" using calculation by blast ultimately have "t \ (u \ the_\) \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ (t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine] = (t \ u \ the_\) \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ (t \ (\ \ \\.p\<^sub>0) \ chine) \ (t \ t\<^sub>0u\<^sub>1.\ \ chine) \ (t \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine])" using whisker_left \.T0.antipar(1) \.ide_base by presburger thus ?thesis using comp_assoc by presburger qed also have "... = ((t \ u) \ the_\) \ \\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ (t \ (\ \ \\.p\<^sub>0) \ chine) \ (t \ t\<^sub>0u\<^sub>1.\ \ chine) \ (t \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t, t\<^sub>0, \\.p\<^sub>1 \ chine] \ ((\ \ \\.p\<^sub>1 \ chine) \ \[t\<^sub>1, \\.p\<^sub>1, chine]) \ the_\" using assoc'_naturality [of t u the_\] \\.composable \_simps(3) comp_assoc by auto also have "... = ((t \ u) \ the_\) \ \\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ (t \ (\ \ \\.p\<^sub>0) \ chine) \ (t \ t\<^sub>0u\<^sub>1.\ \ chine) \ ((t \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t, t\<^sub>0, \\.p\<^sub>1 \ chine] \ \[t \ t\<^sub>0, \\.p\<^sub>1, chine]) \ ((\ \ \\.p\<^sub>1) \ chine) \ the_\" proof - have "(\ \ \\.p\<^sub>1 \ chine) \ \[t\<^sub>1, \\.p\<^sub>1, chine] = \[t \ t\<^sub>0, \\.p\<^sub>1, chine] \ ((\ \ \\.p\<^sub>1) \ chine)" using assoc_naturality by (metis \.leg1_simps(3) \.tab_simps(1,2,4) \.tab_simps(5) \\.leg0_simps(2) \\.leg1_simps(2) hseqE src_hcomp t\<^sub>0u\<^sub>1.leg1_simps(3,5-6) w_simps(2) w_simps(4-6)) thus ?thesis using comp_assoc by presburger qed also have "... = ((t \ u) \ the_\) \ \\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ (t \ (\ \ \\.p\<^sub>0) \ chine) \ ((t \ t\<^sub>0u\<^sub>1.\ \ chine) \ \[t, t\<^sub>0 \ \\.p\<^sub>1, chine]) \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine) \ ((\ \ \\.p\<^sub>1) \ chine) \ the_\" proof - have "(t \ \\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t, t\<^sub>0, \\.p\<^sub>1 \ chine] \ \[t \ t\<^sub>0, \\.p\<^sub>1, chine] = \[t, t\<^sub>0 \ \\.p\<^sub>1, chine] \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine)" using pentagon t\<^sub>0u\<^sub>1.p\<^sub>1_simps uw\ \.T0.antipar(1) iso_hcomp comp_assoc_assoc' invert_side_of_triangle(1) [of "\[t, t\<^sub>0, \\.p\<^sub>1 \ chine] \ \[t \ t\<^sub>0, \\.p\<^sub>1, chine]" "t \ \[t\<^sub>0, \\.p\<^sub>1, chine]" "\[t, t\<^sub>0 \ \\.p\<^sub>1, chine] \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine)"] by auto thus ?thesis using comp_assoc by presburger qed also have "... = ((t \ u) \ the_\) \ \\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((t \ (\ \ \\.p\<^sub>0) \ chine) \ \[t, u\<^sub>1 \ \\.p\<^sub>0, chine]) \ ((t \ t\<^sub>0u\<^sub>1.\) \ chine) \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine) \ ((\ \ \\.p\<^sub>1) \ chine) \ the_\" proof - have "(t \ t\<^sub>0u\<^sub>1.\ \ chine) \ \[t, t\<^sub>0 \ \\.p\<^sub>1, chine] = \[t, u\<^sub>1 \ \\.p\<^sub>0, chine] \ ((t \ t\<^sub>0u\<^sub>1.\) \ chine)" using assoc_naturality [of t t\<^sub>0u\<^sub>1.\ chine] t\<^sub>0u\<^sub>1.cospan by auto thus ?thesis using comp_assoc by presburger qed also have "... = ((t \ u) \ the_\) \ \\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ \[t, (u \ u\<^sub>0) \ \\.p\<^sub>0, chine] \ ((t \ \ \ \\.p\<^sub>0) \ chine) \ ((t \ t\<^sub>0u\<^sub>1.\) \ chine) \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine) \ ((\ \ \\.p\<^sub>1) \ chine) \ the_\" proof - have "(t \ (\ \ \\.p\<^sub>0) \ chine) \ \[t, u\<^sub>1 \ \\.p\<^sub>0, chine] = \[t, (u \ u\<^sub>0) \ \\.p\<^sub>0, chine] \ ((t \ (\ \ \\.p\<^sub>0)) \ chine)" using assoc_naturality [of t "\ \ \\.p\<^sub>0" chine] by (simp add: \\.composable) thus ?thesis using comp_assoc by presburger qed also have "... = ((t \ u) \ the_\) \ \\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ \[t, (u \ u\<^sub>0) \ \\.p\<^sub>0, chine] \ ((t \ \\<^sup>-\<^sup>1[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ ((t \ \[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ ((t \ \ \ \\.p\<^sub>0) \ chine) \ ((t \ t\<^sub>0u\<^sub>1.\) \ chine) \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine) \ ((\ \ \\.p\<^sub>1) \ chine) \ the_\" proof - have "(((t \ \\<^sup>-\<^sup>1[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ ((t \ \[u, u\<^sub>0, \\.p\<^sub>0]) \ chine)) \ ((t \ \ \ \\.p\<^sub>0) \ chine) = ((t \ ((u \ u\<^sub>0) \ \\.p\<^sub>0)) \ chine) \ ((t \ \ \ \\.p\<^sub>0) \ chine)" using whisker_right whisker_left [of t "\\<^sup>-\<^sup>1[u, u\<^sub>0, \\.p\<^sub>0]" "\[u, u\<^sub>0, \\.p\<^sub>0]"] \\.composable comp_assoc_assoc' by simp also have "... = (t \ \ \ \\.p\<^sub>0) \ chine" using comp_cod_arr \\.composable by simp finally have "(((t \ \\<^sup>-\<^sup>1[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ ((t \ \[u, u\<^sub>0, \\.p\<^sub>0]) \ chine)) \ ((t \ \ \ \\.p\<^sub>0) \ chine) = (t \ \ \ \\.p\<^sub>0) \ chine" by simp thus ?thesis using comp_assoc by metis qed also have "... = ((t \ u) \ the_\) \ \\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ \[t, (u \ u\<^sub>0) \ \\.p\<^sub>0, chine] \ ((t \ \\<^sup>-\<^sup>1[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ (((\[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine) \ (\\<^sup>-\<^sup>1[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine)) \ ((t \ \[u, u\<^sub>0, \\.p\<^sub>0]) \ chine)) \ ((t \ \ \ \\.p\<^sub>0) \ chine) \ ((t \ t\<^sub>0u\<^sub>1.\) \ chine) \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine) \ ((\ \ \\.p\<^sub>1) \ chine) \ the_\" proof - have "((\[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine) \ (\\<^sup>-\<^sup>1[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine)) \ ((t \ \[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) = ((t \ \[u, u\<^sub>0, \\.p\<^sub>0]) \ chine)" using comp_inv_arr' comp_cod_arr \\.composable comp_assoc_assoc' whisker_right [of chine "\[t, u, u\<^sub>0 \ \\.p\<^sub>0]" "\\<^sup>-\<^sup>1[t, u, u\<^sub>0 \ \\.p\<^sub>0]"] by simp thus ?thesis using comp_assoc by simp qed also have "... = ((t \ u) \ the_\) \ \\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ \[t, (u \ u\<^sub>0) \ \\.p\<^sub>0, chine] \ ((t \ \\<^sup>-\<^sup>1[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ (\[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine) \ ((\\<^sup>-\<^sup>1[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine) \ ((t \ \[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ ((t \ \ \ \\.p\<^sub>0) \ chine) \ ((t \ t\<^sub>0u\<^sub>1.\) \ chine) \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine) \ ((\ \ \\.p\<^sub>1) \ chine)) \ the_\" using comp_assoc by presburger also have "... = ((t \ u) \ the_\) \ (\\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ \[t, (u \ u\<^sub>0) \ \\.p\<^sub>0, chine] \ ((t \ \\<^sup>-\<^sup>1[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ (\[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine)) \ (\\.tab \ chine) \ the_\" proof - have "(\\<^sup>-\<^sup>1[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine) \ ((t \ \[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ ((t \ \ \ \\.p\<^sub>0) \ chine) \ ((t \ t\<^sub>0u\<^sub>1.\) \ chine) \ (\[t, t\<^sub>0, \\.p\<^sub>1] \ chine) \ ((\ \ \\.p\<^sub>1) \ chine) = \\.tab \ chine" using uw\ whisker_right [of chine] by (metis \\.tab_def \\.tab_in_vhom' arrI seqE) thus ?thesis using comp_assoc by presburger qed also have "... = ((t \ u) \ the_\) \ \[t \ u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\\.tab \ chine) \ the_\" proof - have "\\<^sup>-\<^sup>1[t, u, (u\<^sub>0 \ \\.p\<^sub>0) \ chine] \ (t \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine]) \ (t \ \[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ \[t, (u \ u\<^sub>0) \ \\.p\<^sub>0, chine] \ ((t \ \\<^sup>-\<^sup>1[u, u\<^sub>0, \\.p\<^sub>0]) \ chine) \ (\[t, u, u\<^sub>0 \ \\.p\<^sub>0] \ chine) = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\t\<^bold>\, \<^bold>\u\<^bold>\, (\<^bold>\u\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\\\.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\chine\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\u\<^bold>\, \<^bold>\u\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\\\.p\<^sub>0\<^bold>\, \<^bold>\chine\<^bold>\\<^bold>]) \<^bold>\ (\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\u\<^bold>\, \<^bold>\u\<^sub>0\<^bold>\, \<^bold>\\\.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\chine\<^bold>\) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\t\<^bold>\, (\<^bold>\u\<^bold>\ \<^bold>\ \<^bold>\u\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\\\.p\<^sub>0\<^bold>\, \<^bold>\chine\<^bold>\\<^bold>] \<^bold>\ ((\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\u\<^bold>\, \<^bold>\u\<^sub>0\<^bold>\, \<^bold>\\\.p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\chine\<^bold>\) \<^bold>\ (\<^bold>\\<^bold>[\<^bold>\t\<^bold>\, \<^bold>\u\<^bold>\, \<^bold>\u\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\\\.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\chine\<^bold>\)\" using \'_def \_def \\.composable by simp also have "... = \\<^bold>\\<^bold>[\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\u\<^bold>\, \<^bold>\u\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\\\.p\<^sub>0\<^bold>\, \<^bold>\chine\<^bold>\\<^bold>]\" using \\.composable apply (intro E.eval_eqI) by simp_all also have "... = \[t \ u, u\<^sub>0 \ \\.p\<^sub>0, chine]" using \'_def \_def \\.composable by simp finally show ?thesis by simp qed also have "... = \" using \_naturality by simp finally show ?thesis by simp qed finally have "\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ LHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] \ (\.the_\ \ \\.p\<^sub>1) = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0] \ RHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] \ (\.the_\ \ \\.p\<^sub>1)" by blast (* * TODO: This is common enough that there should be "cancel_iso_left" and * "cancel_iso_right" rules for doing it. *) hence "(LHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1]) \ (\.the_\ \ \\.p\<^sub>1) = (RHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1]) \ (\.the_\ \ \\.p\<^sub>1)" using u\<^sub>\ r\<^sub>0s\<^sub>1.ide_u LHS RHS iso_is_section [of "\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ \\.p\<^sub>0]"] section_is_mono monoE \\.composable comp_assoc by (metis (no_types, lifting) \_simps(1) \.ide_base \\\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ r\<^sub>0s\<^sub>1.p\<^sub>0] \ LHS \ \[t\<^sub>1, \.chine, r\<^sub>0s\<^sub>1.p\<^sub>1] \ (\.the_\ \ r\<^sub>0s\<^sub>1.p\<^sub>1) = ((\ \ \) \ s\<^sub>0 \ r\<^sub>0s\<^sub>1.p\<^sub>0) \ \\.tab\ \.ide_base hseq_char ideD(1) ide_u iso_assoc') hence 1: "LHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1] = RHS \ \[t\<^sub>1, \.chine, \\.p\<^sub>1]" using epiE LHS RHS iso_is_retraction retraction_is_epi \\.composable \.the_\_props iso_hcomp by (metis \_simps(1) \.the_\_simps(2) \((\ \ \) \ s\<^sub>0 \ r\<^sub>0s\<^sub>1.p\<^sub>0) \ \\.tab = \\<^sup>-\<^sup>1[t, u, s\<^sub>0 \ r\<^sub>0s\<^sub>1.p\<^sub>0] \ RHS \ \[t\<^sub>1, \.chine, r\<^sub>0s\<^sub>1.p\<^sub>1] \ (\.the_\ \ r\<^sub>0s\<^sub>1.p\<^sub>1)\ \.leg1_simps(3) ide_is_iso local.comp_assoc r\<^sub>0s\<^sub>1.ide_leg1 r\<^sub>0s\<^sub>1.p\<^sub>1_simps seqE) show "LHS = RHS" proof - have "epi \[t\<^sub>1, \.chine, \\.p\<^sub>1]" using iso_is_retraction retraction_is_epi \.T0.antipar(1) by simp moreover have "seq LHS \[t\<^sub>1, \.chine, \\.p\<^sub>1]" using LHS \.T0.antipar(1) by auto moreover have "seq RHS \[t\<^sub>1, \.chine, \\.p\<^sub>1]" using RHS \.T0.antipar(1) by auto ultimately show ?thesis using epiE 1 by blast qed qed have 1: "\!\. \\ : ?w\<^sub>\ \ ?w\<^sub>\'\ \ ?\\<^sub>\ = t\<^sub>1 \ \ \ ?\\<^sub>\ = ?\\<^sub>\' \ (t\<^sub>0 \ \)" using LHS_def RHS_def u\<^sub>\ w\<^sub>\ w\<^sub>\' \\<^sub>\ \\<^sub>\ \\<^sub>\' eq \.T2 [of ?w\<^sub>\ ?w\<^sub>\' ?\\<^sub>\ ?u\<^sub>\ ?\\<^sub>\' ?\\<^sub>\] by fastforce obtain \\<^sub>\ where \\<^sub>\: "\\\<^sub>\ : ?w\<^sub>\ \ ?w\<^sub>\'\ \ ?\\<^sub>\ = t\<^sub>1 \ \\<^sub>\ \ ?\\<^sub>\ = ?\\<^sub>\' \ (t\<^sub>0 \ \\<^sub>\)" using 1 by auto text \ At this point we could show that @{term \\<^sub>\} is invertible using \BS3\, but we want to avoid using \BS3\ if possible and we also want to establish a characterization of @{term "inv \\<^sub>\"}. So we show the invertibility of @{term \\<^sub>\} directly, using a few more applications of \T2\. \ have iso_\\<^sub>\: "iso ?\\<^sub>\" using uw\ \\<^sub>\ the_\_props \.the_\_props hseqI' iso_assoc' \.hseq_leg\<^sub>0 apply (intro isos_compose) apply (metis \.is_ide \\.leg1_simps(2) \.ide_leg1 \.leg1_simps(2) \.leg1_simps(3) hseqE r\<^sub>0s\<^sub>1.ide_leg1 hcomp_simps(1) vconn_implies_hpar(3)) apply (metis \\.leg1_simps(2) hseqE ide_is_iso r\<^sub>0s\<^sub>1.ide_leg1 src_inv iso_inv_iso iso_hcomp vconn_implies_hpar(1)) apply blast apply blast apply blast apply (metis \.ide_leg1 \.leg1_simps(3) hseqE ide_char iso_assoc t\<^sub>0u\<^sub>1.ide_leg1 t\<^sub>0u\<^sub>1.p\<^sub>1_simps w\<^sub>\') by blast hence eq': "((t \ ?\\<^sub>\') \ \[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\')) = ((t \ ?\\<^sub>\) \ \[t, t\<^sub>0, ?w\<^sub>\] \ (\ \ ?w\<^sub>\)) \ inv ?\\<^sub>\" proof - have "seq ((t \ ?\\<^sub>\') \ \[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\')) ?\\<^sub>\" using LHS RHS_def eq by blast hence "(t \ ?\\<^sub>\') \ \[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\') = (((t \ ?\\<^sub>\') \ \[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\')) \ ?\\<^sub>\) \ inv ?\\<^sub>\" by (meson invert_side_of_triangle(2) iso_\\<^sub>\) thus ?thesis using LHS_def RHS_def eq by argo qed have 2: "\!\. \\ : ?w\<^sub>\' \ ?w\<^sub>\\ \ inv ?\\<^sub>\ = t\<^sub>1 \ \ \ ?\\<^sub>\' = ?\\<^sub>\ \ (t\<^sub>0 \ \)" using u\<^sub>\ w\<^sub>\ w\<^sub>\' \\<^sub>\ \\<^sub>\ \\<^sub>\' eq' \.T2 [of ?w\<^sub>\' ?w\<^sub>\ ?\\<^sub>\'?u\<^sub>\ ?\\<^sub>\ "inv ?\\<^sub>\"] iso_\\<^sub>\ comp_assoc by blast obtain \\<^sub>\' where \\<^sub>\': "\\\<^sub>\' : ?w\<^sub>\' \ ?w\<^sub>\\ \ inv ?\\<^sub>\ = t\<^sub>1 \ \\<^sub>\' \ ?\\<^sub>\' = ?\\<^sub>\ \ (t\<^sub>0 \ \\<^sub>\')" using 2 by auto have "inverse_arrows \\<^sub>\ \\<^sub>\'" proof have "\\\<^sub>\' \ \\<^sub>\ : ?w\<^sub>\ \ ?w\<^sub>\\" using \\<^sub>\ \\<^sub>\' by auto moreover have "t\<^sub>1 \ \\<^sub>\' \ \\<^sub>\ = t\<^sub>1 \ ?w\<^sub>\" using \\<^sub>\ \\<^sub>\' whisker_left \\<^sub>\ iso_\\<^sub>\ comp_inv_arr' by (metis (no_types, lifting) \.ide_leg1 calculation in_homE) moreover have "?\\<^sub>\ = ?\\<^sub>\ \ (t\<^sub>0 \ \\<^sub>\' \ \\<^sub>\)" proof - have "?\\<^sub>\ = ?\\<^sub>\' \ (t\<^sub>0 \ \\<^sub>\)" using \\<^sub>\ by simp also have "... = ?\\<^sub>\ \ (t\<^sub>0 \ \\<^sub>\') \ (t\<^sub>0 \ \\<^sub>\)" using \\<^sub>\' comp_assoc by simp also have "... = ?\\<^sub>\ \ (t\<^sub>0 \ \\<^sub>\' \ \\<^sub>\)" using \\<^sub>\ \\<^sub>\' whisker_left by (metis (full_types) \.ide_leg0 seqI') finally show ?thesis by simp qed moreover have "\\. \\ : ?w\<^sub>\ \ ?w\<^sub>\\ \ t\<^sub>1 \ \ = t\<^sub>1 \ ?w\<^sub>\ \ ?\\<^sub>\ = ?\\<^sub>\ \ (t\<^sub>0 \ \) \ \ = ?w\<^sub>\" proof - have "\!\. \\ : ?w\<^sub>\ \ ?w\<^sub>\\ \ t\<^sub>1 \ ?w\<^sub>\ = t\<^sub>1 \ \ \ ?\\<^sub>\ = ?\\<^sub>\ \ (t\<^sub>0 \ \)" proof - have "(t \ ?\\<^sub>\) \ \[t, t\<^sub>0, ?w\<^sub>\] \ (\ \ ?w\<^sub>\) = ((t \ ?\\<^sub>\) \ \[t, t\<^sub>0, ?w\<^sub>\] \ (\ \ ?w\<^sub>\)) \ (t\<^sub>1 \ ?w\<^sub>\)" by (metis LHS LHS_def comp_arr_dom in_homE) thus ?thesis using w\<^sub>\ \\<^sub>\ \.w_simps(4) \.leg1_in_hom(2) \.leg1_simps(3) hcomp_in_vhom ideD(1) trg_hcomp ide_in_hom(2) \.T2 by presburger qed thus "\\. \\ : ?w\<^sub>\ \ ?w\<^sub>\\ \ t\<^sub>1 \ \ = t\<^sub>1 \ ?w\<^sub>\ \ ?\\<^sub>\ = ?\\<^sub>\ \ (t\<^sub>0 \ \) \ \ = ?w\<^sub>\" by (metis \\<^sub>\ comp_arr_dom ide_in_hom(2) in_homE w\<^sub>\) qed ultimately have "\\<^sub>\' \ \\<^sub>\ = ?w\<^sub>\" by simp thus "ide (\\<^sub>\' \ \\<^sub>\)" using w\<^sub>\ by simp have "\\\<^sub>\ \ \\<^sub>\' : ?w\<^sub>\' \ ?w\<^sub>\'\" using \\<^sub>\ \\<^sub>\' by auto moreover have "t\<^sub>1 \ \\<^sub>\ \ \\<^sub>\' = t\<^sub>1 \ ?w\<^sub>\'" by (metis \\<^sub>\ \\<^sub>\ \\<^sub>\' \.ide_leg1 calculation comp_arr_inv' in_homE iso_\\<^sub>\ whisker_left) moreover have "?\\<^sub>\' = ?\\<^sub>\' \ (t\<^sub>0 \ \\<^sub>\ \ \\<^sub>\')" proof - have "?\\<^sub>\' = ?\\<^sub>\ \ (t\<^sub>0 \ \\<^sub>\')" using \\<^sub>\' by simp also have "... = ?\\<^sub>\' \ (t\<^sub>0 \ \\<^sub>\) \ (t\<^sub>0 \ \\<^sub>\')" using \\<^sub>\ comp_assoc by simp also have "... = ?\\<^sub>\' \ (t\<^sub>0 \ \\<^sub>\ \ \\<^sub>\')" using \\<^sub>\ \\<^sub>\' whisker_left \.ide_leg0 by fastforce finally show ?thesis by simp qed moreover have "\\. \\ : ?w\<^sub>\' \ ?w\<^sub>\'\ \ t\<^sub>1 \ \ = t\<^sub>1 \ ?w\<^sub>\' \ ?\\<^sub>\' = ?\\<^sub>\' \ (t\<^sub>0 \ \) \ \ = ?w\<^sub>\'" proof - have "\!\. \\ : ?w\<^sub>\' \ ?w\<^sub>\'\ \ t\<^sub>1 \ ?w\<^sub>\' = t\<^sub>1 \ \ \ ?\\<^sub>\' = ?\\<^sub>\' \ (t\<^sub>0 \ \)" proof - have "(t \ ?\\<^sub>\') \ \[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\') = ((t \ ?\\<^sub>\') \ \[t, t\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\')) \ (t\<^sub>1 \ ?w\<^sub>\')" proof - have 1: "t\<^sub>1 \ \\<^sub>\ \ \\<^sub>\' = (t\<^sub>1 \ \\<^sub>\) \ (t\<^sub>1 \ \\<^sub>\')" by (meson \\<^sub>\ \\<^sub>\' \.ide_leg1 seqI' whisker_left) have "((LHS \ inv ?\\<^sub>\) \ (t\<^sub>1 \ \\<^sub>\)) \ (t\<^sub>1 \ \\<^sub>\') = LHS \ inv ?\\<^sub>\" using LHS_def RHS_def \\<^sub>\ \\<^sub>\' eq eq' by argo thus ?thesis unfolding LHS_def using 1 by (simp add: calculation(2) eq' comp_assoc) qed thus ?thesis using w\<^sub>\' \\<^sub>\' \.w_simps(4) \.leg1_in_hom(2) \.leg1_simps(3) hcomp_in_vhom ideD(1) trg_hcomp ide_in_hom(2) \.T2 \.T0.antipar(1) t\<^sub>0u\<^sub>1.base_simps(2) t\<^sub>0u\<^sub>1.leg1_simps(4) by presburger qed thus "\\. \\ : ?w\<^sub>\' \ ?w\<^sub>\'\ \ t\<^sub>1 \ \ = t\<^sub>1 \ ?w\<^sub>\' \ ?\\<^sub>\' = ?\\<^sub>\' \ (t\<^sub>0 \ \) \ \ = ?w\<^sub>\'" by (metis \\<^sub>\' comp_arr_dom ide_in_hom(2) in_homE w\<^sub>\') qed ultimately have "\\<^sub>\ \ \\<^sub>\' = ?w\<^sub>\'" by simp thus "ide (\\<^sub>\ \ \\<^sub>\')" using w\<^sub>\' by simp qed thus "\\.p\<^sub>1 \ chine \ \.chine \ \\.p\<^sub>1" using w\<^sub>\ w\<^sub>\' \\<^sub>\ isomorphic_symmetric isomorphic_def by blast have iso_\\<^sub>\: "iso \\<^sub>\" using \inverse_arrows \\<^sub>\ \\<^sub>\'\ by auto have \\<^sub>\'_eq: "\\<^sub>\' = inv \\<^sub>\" using \inverse_arrows \\<^sub>\ \\<^sub>\'\ inverse_unique by blast let ?w\<^sub>\ = "\\.p\<^sub>0 \ chine" let ?w\<^sub>\' = "\.chine \ \\.p\<^sub>0" let ?u\<^sub>\ = "s\<^sub>0 \ \\.p\<^sub>0" let ?\\<^sub>\ = "the_\ \ \\<^sup>-\<^sup>1[u\<^sub>0, \\.p\<^sub>0, chine]" let ?\\<^sub>\' = "(\.the_\ \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[u\<^sub>0, \.chine, \\.p\<^sub>0]" let ?\\<^sub>\ = "\[u\<^sub>1, \.chine, \\.p\<^sub>0] \ (\.the_\ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" have w\<^sub>\: "ide ?w\<^sub>\ \ is_left_adjoint ?w\<^sub>\" using is_map left_adjoints_compose by simp have w\<^sub>\': "ide ?w\<^sub>\' \ is_left_adjoint ?w\<^sub>\'" using \.is_map left_adjoints_compose by (simp add: is_map left_adjoints_compose) have 1: "\!\. \\ : ?w\<^sub>\ \ ?w\<^sub>\'\ \ ?\\<^sub>\ = u\<^sub>1 \ \ \ ?\\<^sub>\ = ?\\<^sub>\' \ (u\<^sub>0 \ \)" proof - have \\<^sub>\: "\?\\<^sub>\ : u\<^sub>0 \ ?w\<^sub>\ \ ?u\<^sub>\\" by auto have \\<^sub>\': "\?\\<^sub>\' : u\<^sub>0 \ ?w\<^sub>\' \ ?u\<^sub>\\" by fastforce have \\<^sub>\: "\?\\<^sub>\ : u\<^sub>1 \ ?w\<^sub>\ \ u\<^sub>1 \ ?w\<^sub>\'\" proof (intro comp_in_homI) show "\\\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine] : u\<^sub>1 \ \\.p\<^sub>0 \ chine \ (u\<^sub>1 \ \\.p\<^sub>0) \ chine\" by auto show "\inv t\<^sub>0u\<^sub>1.\ \ chine : (u\<^sub>1 \ \\.p\<^sub>0) \ chine \ (t\<^sub>0 \ \\.p\<^sub>1) \ chine\" using t\<^sub>0u\<^sub>1.\_uniqueness(2) hcomp_in_vhom by (simp add: t\<^sub>0u\<^sub>1.\_in_hom(2) w_in_hom(2)) show "\\[t\<^sub>0, \\.p\<^sub>1, chine] : (t\<^sub>0 \ \\.p\<^sub>1) \ chine \ t\<^sub>0 \ \\.p\<^sub>1 \ chine\" using \.T0.antipar(1) by auto show "\t\<^sub>0 \ inv \\<^sub>\ : t\<^sub>0 \ \\.p\<^sub>1 \ chine \ t\<^sub>0 \ \.chine \ \\.p\<^sub>1\" using \\<^sub>\ iso_\\<^sub>\ using \.T0.antipar(1) by auto show "\\\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] : t\<^sub>0 \ \.chine \ \\.p\<^sub>1 \ (t\<^sub>0 \ \.chine) \ \\.p\<^sub>1\" using \.T0.antipar(1) by auto show "\\.the_\ \ \\.p\<^sub>1 : (t\<^sub>0 \ \.chine) \ \\.p\<^sub>1 \ r\<^sub>0 \ \\.p\<^sub>1\" using \.T0.antipar(1) by auto show "\r\<^sub>0s\<^sub>1.\ : r\<^sub>0 \ \\.p\<^sub>1 \ s\<^sub>1 \ \\.p\<^sub>0\" by auto show "\\.the_\ \ \\.p\<^sub>0 : s\<^sub>1 \ \\.p\<^sub>0 \ (u\<^sub>1 \ \.chine) \ \\.p\<^sub>0\" by auto show "\\[u\<^sub>1, \.chine, \\.p\<^sub>0] : (u\<^sub>1 \ \.chine) \ \\.p\<^sub>0 \ u\<^sub>1 \ \.chine \ \\.p\<^sub>0\" by auto qed text \ The proof of the equation below needs to make use of the equation \\\<^sub>\' = \\<^sub>\ \ (t\<^sub>0 \ \\<^sub>\')\ from the previous section. So the overall strategy is to work toward an expression of the form \\\<^sub>\ \ (t\<^sub>0 \ \\<^sub>\')\ and perform the replacement to eliminate \\\<^sub>\'\. \ have eq\<^sub>\: "(u \ ?\\<^sub>\) \ \[u, u\<^sub>0, ?w\<^sub>\] \ (\ \ ?w\<^sub>\) = ((u \ ?\\<^sub>\') \ \[u, u\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\')) \ ?\\<^sub>\" proof - let ?LHS = "(u \ ?\\<^sub>\) \ \[u, u\<^sub>0, ?w\<^sub>\] \ (\ \ ?w\<^sub>\)" let ?RHS = "((u \ ?\\<^sub>\') \ \[u, u\<^sub>0, ?w\<^sub>\'] \ (\ \ ?w\<^sub>\')) \ ?\\<^sub>\" have "?RHS = (u \ (\.the_\ \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[u\<^sub>0, \.chine, \\.p\<^sub>0]) \ \[u, u\<^sub>0, \.chine \ \\.p\<^sub>0] \ (\ \ \.chine \ \\.p\<^sub>0) \ \[u\<^sub>1, \.chine, \\.p\<^sub>0] \ (\.the_\ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using comp_assoc by presburger also have "... = (u \ \.the_\ \ \\.p\<^sub>0) \ ((u \ \\<^sup>-\<^sup>1[u\<^sub>0, \.chine, \\.p\<^sub>0]) \ \[u, u\<^sub>0, \.chine \ \\.p\<^sub>0]) \ (\ \ \.chine \ \\.p\<^sub>0) \ \[u\<^sub>1, \.chine, \\.p\<^sub>0] \ (\.the_\ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" proof - have "u \ (\.the_\ \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[u\<^sub>0, \.chine, \\.p\<^sub>0] = (u \ \.the_\ \ \\.p\<^sub>0) \ (u \ \\<^sup>-\<^sup>1[u\<^sub>0, \.chine, \\.p\<^sub>0])" using whisker_left \.ide_base \\<^sub>\' by blast thus ?thesis using comp_assoc by presburger qed also have "... = ((u \ \.the_\ \ \\.p\<^sub>0) \ \[u, u\<^sub>0 \ \.chine, \\.p\<^sub>0]) \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[u \ u\<^sub>0, \.chine, \\.p\<^sub>0] \ (\ \ \.chine \ \\.p\<^sub>0) \ \[u\<^sub>1, \.chine, \\.p\<^sub>0] \ (\.the_\ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" proof - have "seq (u \ \[u\<^sub>0, \.chine, \\.p\<^sub>0]) (\[u, u\<^sub>0 \ \.chine, \\.p\<^sub>0] \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0))" by auto moreover have "src u = trg \[u\<^sub>0, \.chine, \\.p\<^sub>0]" by simp moreover have "inv (u \ \[u\<^sub>0, \.chine, \\.p\<^sub>0]) = u \ \\<^sup>-\<^sup>1[u\<^sub>0, \.chine, \\.p\<^sub>0]" by simp moreover have "iso (u \ \[u\<^sub>0, \.chine, \\.p\<^sub>0])" by simp moreover have "iso \[u \ u\<^sub>0, \.chine, \\.p\<^sub>0]" by simp ultimately have "(u \ \\<^sup>-\<^sup>1[u\<^sub>0, \.chine, \\.p\<^sub>0]) \ \[u, u\<^sub>0, \.chine \ \\.p\<^sub>0] = \[u, u\<^sub>0 \ \.chine, \\.p\<^sub>0] \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[u \ u\<^sub>0, \.chine, \\.p\<^sub>0]" using pentagon hseqI' comp_assoc invert_opposite_sides_of_square [of "u \ \[u\<^sub>0, \.chine, \\.p\<^sub>0]" "\[u, u\<^sub>0 \ \.chine, \\.p\<^sub>0] \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0)" "\[u, u\<^sub>0, \.chine \ \\.p\<^sub>0]" "\[u \ u\<^sub>0, \.chine, \\.p\<^sub>0]"] inv_hcomp \.is_ide \.w_simps(3) \.w_simps(4) \.base_simps(2) \.ide_base \.ide_leg0 \.leg0_simps(2) \.leg0_simps(3) \.leg1_simps(3) assoc'_eq_inv_assoc ide_hcomp r\<^sub>0s\<^sub>1.ide_u r\<^sub>0s\<^sub>1.p\<^sub>0_simps hcomp_simps(1) by presburger thus ?thesis using comp_assoc by presburger qed also have "... = \[u, s\<^sub>0, \\.p\<^sub>0] \ ((u \ \.the_\) \ \\.p\<^sub>0) \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0) \ (\\<^sup>-\<^sup>1[u \ u\<^sub>0, \.chine, \\.p\<^sub>0] \ (\ \ \.chine \ \\.p\<^sub>0)) \ \[u\<^sub>1, \.chine, \\.p\<^sub>0] \ (\.the_\ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" proof - have "(u \ \.the_\ \ \\.p\<^sub>0) \ \[u, u\<^sub>0 \ \.chine, \\.p\<^sub>0] = \[u, s\<^sub>0, \\.p\<^sub>0] \ ((u \ \.the_\) \ \\.p\<^sub>0)" using assoc_naturality [of u \.the_\ \\.p\<^sub>0] \.\_simps(3) by auto thus ?thesis using comp_assoc by presburger qed also have "... = \[u, s\<^sub>0, \\.p\<^sub>0] \ ((u \ \.the_\) \ \\.p\<^sub>0) \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0) \ ((\ \ \.chine) \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[u\<^sub>1, \.chine, \\.p\<^sub>0] \ \[u\<^sub>1, \.chine, \\.p\<^sub>0] \ (\.the_\ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" proof - have "\\<^sup>-\<^sup>1[u \ u\<^sub>0, \.chine, \\.p\<^sub>0] \ (\ \ \.chine \ \\.p\<^sub>0) = ((\ \ \.chine) \ \\.p\<^sub>0) \ \\<^sup>-\<^sup>1[u\<^sub>1, \.chine, \\.p\<^sub>0]" using assoc'_naturality [of \ \.chine \\.p\<^sub>0] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \[u, s\<^sub>0, \\.p\<^sub>0] \ ((u \ \.the_\) \ \\.p\<^sub>0) \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0) \ ((\ \ \.chine) \ \\.p\<^sub>0) \ ((\\<^sup>-\<^sup>1[u\<^sub>1, \.chine, \\.p\<^sub>0] \ \[u\<^sub>1, \.chine, \\.p\<^sub>0]) \ (\.the_\ \ \\.p\<^sub>0)) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using comp_assoc by metis also have "... = \[u, s\<^sub>0, \\.p\<^sub>0] \ (((u \ \.the_\) \ \\.p\<^sub>0) \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0) \ ((\ \ \.chine) \ \\.p\<^sub>0) \ (\.the_\ \ \\.p\<^sub>0)) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1] \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" proof - have "(\\<^sup>-\<^sup>1[u\<^sub>1, \.chine, \\.p\<^sub>0] \ \[u\<^sub>1, \.chine, \\.p\<^sub>0]) \ (\.the_\ \ \\.p\<^sub>0) = \.the_\ \ \\.p\<^sub>0" using comp_inv_arr' comp_cod_arr by auto thus ?thesis using comp_assoc by simp qed also have "... = (\[u, s\<^sub>0, \\.p\<^sub>0] \ ((\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0) \ r\<^sub>0s\<^sub>1.\ \ (\.the_\ \ \\.p\<^sub>1) \ \\<^sup>-\<^sup>1[t\<^sub>0, \.chine, \\.p\<^sub>1]) \ (t\<^sub>0 \ inv \\<^sub>\) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" proof - have "arr ((u \ \.the_\) \ \[u, u\<^sub>0, \.chine] \ (\ \ \.chine) \ \.the_\)" using \.\_simps(3) by simp hence "((u \ \.the_\) \ \\.p\<^sub>0) \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0) \ ((\ \ \.chine) \ \\.p\<^sub>0) \ (\.the_\ \ \\.p\<^sub>0) = (u \ \.the_\) \ \[u, u\<^sub>0, \.chine] \ (\ \ \.chine) \ \.the_\ \ \\.p\<^sub>0" using whisker_right by simp also have "... = (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0" using \.\_naturality by simp finally have "((u \ \.the_\) \ \\.p\<^sub>0) \ (\[u, u\<^sub>0, \.chine] \ \\.p\<^sub>0) \ ((\ \ \.chine) \ \\.p\<^sub>0) \ (\.the_\ \ \\.p\<^sub>0) = (\ \ s\<^sub>0) \ \ \ \\.p\<^sub>0" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (?\\<^sub>\ \ (t\<^sub>0 \ inv \\<^sub>\)) \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using comp_assoc by presburger also have "... = ?\\<^sub>\' \ \[t\<^sub>0, \\.p\<^sub>1, chine] \ (inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using \\<^sub>\' \\<^sub>\'_eq by simp also have "... = (u \ the_\) \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ ((t\<^sub>0u\<^sub>1.\ \ chine) \ ((\\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t\<^sub>0, \\.p\<^sub>1, chine]) \ (inv t\<^sub>0u\<^sub>1.\ \ chine)) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using comp_assoc by presburger also have "... = (u \ the_\) \ \[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ ((\ \ \\.p\<^sub>0) \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" proof - have "((t\<^sub>0u\<^sub>1.\ \ chine) \ ((\\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t\<^sub>0, \\.p\<^sub>1, chine]) \ (inv t\<^sub>0u\<^sub>1.\ \ chine)) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine] = \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" proof - have "((t\<^sub>0u\<^sub>1.\ \ chine) \ ((\\<^sup>-\<^sup>1[t\<^sub>0, \\.p\<^sub>1, chine]) \ \[t\<^sub>0, \\.p\<^sub>1, chine]) \ (inv t\<^sub>0u\<^sub>1.\ \ chine)) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine] = ((t\<^sub>0u\<^sub>1.\ \ chine) \ ((t\<^sub>0 \ \\.p\<^sub>1) \ chine) \ (inv t\<^sub>0u\<^sub>1.\ \ chine)) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using comp_inv_arr' \.T0.antipar(1) by auto also have "... = ((t\<^sub>0u\<^sub>1.\ \ chine) \ (inv t\<^sub>0u\<^sub>1.\ \ chine)) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using comp_cod_arr t\<^sub>0u\<^sub>1.\_uniqueness by simp also have "... = (t\<^sub>0u\<^sub>1.\ \ inv t\<^sub>0u\<^sub>1.\ \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using whisker_right t\<^sub>0u\<^sub>1.\_uniqueness by simp also have "... = ((u\<^sub>1 \ \\.p\<^sub>0) \ chine) \ \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using comp_arr_inv' \.T0.antipar(1) t\<^sub>0u\<^sub>1.\_uniqueness by simp also have "... = \\<^sup>-\<^sup>1[u\<^sub>1, \\.p\<^sub>0, chine]" using comp_cod_arr \.T0.antipar(1) by simp finally show ?thesis by simp qed thus ?thesis using comp_assoc by simp qed also have "... = (u \ the_\) \ (\[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine) \ \\<^sup>-\<^sup>1[u \ u\<^sub>0, \\.p\<^sub>0, chine]) \ (\ \ ?w\<^sub>\)" using assoc'_naturality [of \ \\.p\<^sub>0 chine] comp_assoc by auto also have "... = ((u \ the_\) \ (u \ \\<^sup>-\<^sup>1[u\<^sub>0, \\.p\<^sub>0, chine])) \ \[u, u\<^sub>0, ?w\<^sub>\] \ (\ \ ?w\<^sub>\)" using uw\ pentagon comp_assoc invert_opposite_sides_of_square [of "u \ \[u\<^sub>0, \\.p\<^sub>0, chine]" "\[u, u\<^sub>0 \ \\.p\<^sub>0, chine] \ (\[u, u\<^sub>0, \\.p\<^sub>0] \ chine)" "\[u, u\<^sub>0, ?w\<^sub>\]" "\[u \ u\<^sub>0, \\.p\<^sub>0, chine]"] \.base_simps(2) \.ide_base \.ide_leg0 \.leg0_simps(2) assoc'_eq_inv_assoc ide_hcomp hcomp_simps(1) t\<^sub>0u\<^sub>1.ide_u by force also have "... = (u \ the_\ \ \\<^sup>-\<^sup>1[u\<^sub>0, \\.p\<^sub>0, chine]) \ \[u, u\<^sub>0, ?w\<^sub>\] \ (\ \ ?w\<^sub>\)" using whisker_left comp_assoc by simp finally show ?thesis by simp qed show "\!\. \\ : ?w\<^sub>\ \ ?w\<^sub>\'\ \ ?\\<^sub>\ = u\<^sub>1 \ \ \ ?\\<^sub>\ = ?\\<^sub>\' \ (u\<^sub>0 \ \)" using w\<^sub>\ w\<^sub>\' \\<^sub>\ \\<^sub>\' \\<^sub>\ eq\<^sub>\ \.T2 [of ?w\<^sub>\ ?w\<^sub>\' ?\\<^sub>\ ?u\<^sub>\ ?\\<^sub>\' ?\\<^sub>\] by fast qed obtain \\<^sub>\ where \\<^sub>\: "\\\<^sub>\ : ?w\<^sub>\ \ ?w\<^sub>\'\ \ ?\\<^sub>\ = u\<^sub>1 \ \\<^sub>\ \ ?\\<^sub>\ = ?\\<^sub>\' \ (u\<^sub>0 \ \\<^sub>\)" using 1 by auto show "?w\<^sub>\ \ ?w\<^sub>\'" using w\<^sub>\ w\<^sub>\' \\<^sub>\ BS3 [of ?w\<^sub>\ ?w\<^sub>\' \\<^sub>\ \\<^sub>\] isomorphic_def by auto qed lemma comp_L: shows "Maps.seq \\t\<^sub>0\\ \\\.chine \ \\.p\<^sub>1\\" and "\\t\<^sub>0\\ \ \\\.chine \ \\.p\<^sub>1\\ = Maps.MkArr (src (\.chine \ \\.p\<^sub>1)) (src t) (Maps.Comp \t\<^sub>0\ \\.chine \ \\.p\<^sub>1\)" proof - show "Maps.seq \\t\<^sub>0\\ \\\.chine \ \\.p\<^sub>1\\" proof - have "is_left_adjoint (\.chine \ \\.p\<^sub>1)" using \.is_map r\<^sub>0s\<^sub>1.leg1_is_map left_adjoints_compose r\<^sub>0s\<^sub>1.p\<^sub>1_simps by auto thus ?thesis using Maps.CLS_in_hom r\<^sub>0s\<^sub>1.leg1_is_map apply (intro Maps.seqI') apply blast using Maps.CLS_in_hom [of t\<^sub>0] \.leg0_is_map \\.leg1_in_hom by auto qed thus "\\t\<^sub>0\\ \ \\\.chine \ \\.p\<^sub>1\\ = Maps.MkArr (src (\.chine \ \\.p\<^sub>1)) (src t) (Maps.Comp \t\<^sub>0\ \\.chine \ \\.p\<^sub>1\)" using Maps.comp_char by auto qed lemma comp_R: shows "Maps.seq \\u\<^sub>1\\ \\\.chine \ \\.p\<^sub>0\\" and "\\u\<^sub>1\\ \ \\\.chine \ \\.p\<^sub>0\\ = Maps.MkArr (src r\<^sub>0s\<^sub>1.p\<^sub>0) (trg u) (Maps.Comp \u\<^sub>1\ \\.chine \ r\<^sub>0s\<^sub>1.p\<^sub>0\)" proof - show "Maps.seq \\u\<^sub>1\\ \\\.chine \ \\.p\<^sub>0\\" proof - have "is_left_adjoint (\.chine \ \\.p\<^sub>0)" using \.is_map r\<^sub>0s\<^sub>1.leg0_is_map left_adjoints_compose [of \.chine \\.p\<^sub>0] by simp thus ?thesis using Maps.CLS_in_hom \.leg1_is_map apply (intro Maps.seqI') apply blast using Maps.CLS_in_hom [of u\<^sub>1] \.leg1_is_map by simp qed thus "\\u\<^sub>1\\ \ \\\.chine \ \\.p\<^sub>0\\ = Maps.MkArr (src r\<^sub>0s\<^sub>1.p\<^sub>0) (trg u) (Maps.Comp \u\<^sub>1\ \\.chine \ r\<^sub>0s\<^sub>1.p\<^sub>0\)" using Maps.comp_char by auto qed lemma comp_L_eq_comp_R: shows "\\t\<^sub>0\\ \ \\\.chine \ \\.p\<^sub>1\\ = \\u\<^sub>1\\ \ \\\.chine \ \\.p\<^sub>0\\" proof (intro Maps.arr_eqI) show "Maps.seq \\t\<^sub>0\\ \\\.chine \ \\.p\<^sub>1\\" using comp_L(1) by simp show "Maps.seq \\u\<^sub>1\\ \\\.chine \ \\.p\<^sub>0\\" using comp_R(1) by simp show "Maps.Dom (\\t\<^sub>0\\ \ \\\.chine \ \\.p\<^sub>1\\) = Maps.Dom (\\u\<^sub>1\\ \ \\\.chine \ \\.p\<^sub>0\\)" by (metis (no_types, lifting) Maps.Dom.simps(1) \.w_simps(2) \.w_simps(3) \.leg1_simps(3) \\.leg1_in_hom(2) comp_L(2) comp_R(2) hcomp_in_vhomE hseqI' r\<^sub>0s\<^sub>1.leg1_simps(3) hcomp_simps(1)) show "Maps.Cod (\\t\<^sub>0\\ \ \\\.chine \ \\.p\<^sub>1\\) = Maps.Cod (\\u\<^sub>1\\ \ \\\.chine \ \\.p\<^sub>0\\)" by (metis Maps.Cod.simps(1) \\.composable comp_L(2) comp_R(2)) have A: "Maps.Map (\\t\<^sub>0\\ \ \\\.chine \ \\.p\<^sub>1\\) = Maps.Comp \t\<^sub>0\ \\.chine \ \\.p\<^sub>1\" using comp_L(1) Maps.comp_char by auto have B: "Maps.Map (\\u\<^sub>1\\ \ \\\.chine \ \\.p\<^sub>0\\) = Maps.Comp \u\<^sub>1\ \\.chine \ \\.p\<^sub>0\" using comp_R(1) Maps.comp_char by auto have C: "Maps.Comp \t\<^sub>0\ \\.chine \ \\.p\<^sub>1\ = Maps.Comp \u\<^sub>1\ \\.chine \ \\.p\<^sub>0\" proof (intro Maps.Comp_eqI) show "t\<^sub>0 \ \.chine \ \\.p\<^sub>1 \ Maps.Comp \t\<^sub>0\ \\.chine \ \\.p\<^sub>1\" proof (intro Maps.in_CompI) show "is_iso_class \\.chine \ \\.p\<^sub>1\" using prj_chine(2) is_iso_classI isomorphic_implies_hpar(2) by blast show "is_iso_class \t\<^sub>0\" using is_iso_classI by auto show "\.chine \ \\.p\<^sub>1 \ \\.chine \ \\.p\<^sub>1\" using ide_in_iso_class prj_chine(2) isomorphic_implies_hpar(2) by blast show "t\<^sub>0 \ \t\<^sub>0\" using ide_in_iso_class by simp show "t\<^sub>0 \ \.chine \ \\.p\<^sub>1 \ t\<^sub>0 \ \.chine \ \\.p\<^sub>1" using isomorphic_reflexive prj_chine(2) isomorphic_implies_hpar(2) by auto qed show "u\<^sub>1 \ \.chine \ \\.p\<^sub>0 \ Maps.Comp \u\<^sub>1\ \\.chine \ \\.p\<^sub>0\" proof (intro Maps.in_CompI) show "is_iso_class \\.chine \ \\.p\<^sub>0\" using is_iso_classI by simp show "is_iso_class \u\<^sub>1\" using is_iso_classI by simp show "\.chine \ \\.p\<^sub>0 \ \\.chine \ \\.p\<^sub>0\" using ide_in_iso_class by simp show "u\<^sub>1 \ iso_class u\<^sub>1" using ide_in_iso_class by simp show "u\<^sub>1 \ \.chine \ \\.p\<^sub>0 \ u\<^sub>1 \ \.chine \ \\.p\<^sub>0" using isomorphic_reflexive isomorphic_implies_hpar(2) by auto qed show "t\<^sub>0 \ \.chine \ \\.p\<^sub>1 \ u\<^sub>1 \ \.chine \ \\.p\<^sub>0" proof - have "t\<^sub>0 \ \.chine \ \\.p\<^sub>1 \ (t\<^sub>0 \ \.chine) \ \\.p\<^sub>1" using assoc'_in_hom [of t\<^sub>0 \.chine \\.p\<^sub>1] iso_assoc' isomorphic_def r\<^sub>0s\<^sub>1.p\<^sub>1_simps by auto also have "... \ r\<^sub>0 \ \\.p\<^sub>1" using \.leg0_uniquely_isomorphic hcomp_isomorphic_ide by (simp add: \.T0.antipar(1)) also have "... \ s\<^sub>1 \ \\.p\<^sub>0" using isomorphic_def r\<^sub>0s\<^sub>1.\_uniqueness(2) by blast also have "... \ (u\<^sub>1 \ \.chine) \ \\.p\<^sub>0" using \.leg1_uniquely_isomorphic hcomp_isomorphic_ide by auto also have "... \ u\<^sub>1 \ \.chine \ \\.p\<^sub>0" using assoc_in_hom [of u\<^sub>1 \.chine \\.p\<^sub>0] iso_assoc isomorphic_def by auto finally show ?thesis by simp qed qed show "Maps.Map (\\t\<^sub>0\\ \ \\\.chine \ \\.p\<^sub>1\\) = Maps.Map (\\u\<^sub>1\\ \ \\\.chine \ \\.p\<^sub>0\\)" using A B C by simp qed lemma csq: shows "Maps.commutative_square \\t\<^sub>0\\ \\u\<^sub>1\\ \\\.chine \ \\.p\<^sub>1\\ \\\.chine \ \\.p\<^sub>0\\" proof show "Maps.cospan \\t\<^sub>0\\ \\u\<^sub>1\\" using comp_L(1) comp_R(1) comp_L_eq_comp_R by (metis (no_types, lifting) Maps.cod_comp Maps.seq_char) show "Maps.span \\\.chine \ \\.p\<^sub>1\\ \\\.chine \ \\.p\<^sub>0\\" using comp_L(1) comp_R(1) comp_L_eq_comp_R by (metis (no_types, lifting) Maps.dom_comp Maps.seq_char) show "Maps.dom \\t\<^sub>0\\ = Maps.cod \\\.chine \ \\.p\<^sub>1\\" using comp_L(1) by auto show "\\t\<^sub>0\\ \ \\\.chine \ \\.p\<^sub>1\\ = \\u\<^sub>1\\ \ \\\.chine \ \\.p\<^sub>0\\" using comp_L_eq_comp_R by simp qed lemma CLS_chine: shows "\\chine\\ = Maps.tuple \\\.chine \ \\.p\<^sub>1\\ \\t\<^sub>0\\ \\u\<^sub>1\\ \\\.chine \ \\.p\<^sub>0\\" proof - let ?T = "Maps.tuple \\\.chine \ \\.p\<^sub>1\\ \\t\<^sub>0\\ \\u\<^sub>1\\ \\\.chine \ \\.p\<^sub>0\\" have "\!l. \\t\<^sub>0u\<^sub>1.p\<^sub>1\\ \ l = \\\.chine \ \\.p\<^sub>1\\ \ \\t\<^sub>0u\<^sub>1.p\<^sub>0\\ \ l = \\\.chine \ \\.p\<^sub>0\\" using csq \\.prj_char Maps.universal [of "\\t\<^sub>0\\" "\\u\<^sub>1\\" "\\\.chine \ \\.p\<^sub>1\\" "\\\.chine \ \\.p\<^sub>0\\"] by simp moreover have "\\\\.p\<^sub>1\\ \ ?T = \\\.chine \ \\.p\<^sub>1\\ \ \\\\.p\<^sub>0\\ \ ?T = \\\.chine \ \\.p\<^sub>0\\" using csq \\.prj_char Maps.prj_tuple [of "\\t\<^sub>0\\" "\\u\<^sub>1\\" "\\\.chine \ \\.p\<^sub>1\\" "\\\.chine \ \\.p\<^sub>0\\"] by simp moreover have "\\t\<^sub>0u\<^sub>1.p\<^sub>1\\ \ \\chine\\ = \\\.chine \ \\.p\<^sub>1\\ \ \\t\<^sub>0u\<^sub>1.p\<^sub>0\\ \ \\chine\\ = \\\.chine \ \\.p\<^sub>0\\" using prj_chine \\.leg0_is_map \\.leg1_is_map is_map t\<^sub>0u\<^sub>1.leg1_is_map t\<^sub>0u\<^sub>1.satisfies_T0 Maps.comp_CLS by blast ultimately show "\\chine\\ = ?T" by auto qed end subsection "Equivalence of B and Span(Maps(B))" subsubsection "The Functor SPN" text \ We now define a function \SPN\ on arrows and will ultimately show that it extends to a biequivalence from the underlying bicategory \B\ to \Span(Maps(B))\. The idea is that \SPN\ takes \\\ : r \ s\\ to the isomorphism class of an induced arrow of spans from the chosen tabulation of \r\ to the chosen tabulation of \s\. To obtain this, we first use isomorphisms \r.tab\<^sub>1 \ r.tab\<^sub>0\<^sup>* \ r\ and \s.tab\<^sub>1 \ s.tab\<^sub>0\<^sup>* \ s\ to transform \\\ to \\\' : r.tab\<^sub>1 \ r.tab\<^sub>0\<^sup>* \ s.tab\<^sub>1 \ s.tab\<^sub>0\<^sup>*\\. We then take the adjoint transpose of \\'\ to obtain \\\ : r.tab\<^sub>1 \ (s.tab\<^sub>1 \ s.tab\<^sub>0\<^sup>*) \ r.tab\<^sub>0\\. The 2-cell \\\ induces a map \w\ which is an arrow of spans from \(r.tab\<^sub>0, r.tab\<^sub>1)\ to \(s.tab\<^sub>0, s.tab\<^sub>1)\. We take the arrow of \Span(Maps(B))\ defined by \w\ as the value of \SPN \\. Ensuring that \SPN\ is functorial is a somewhat delicate point, which requires that all the underlying definitions that have been set up are ``just so'', with no extra choices other than those that are forced, and with the tabulation assigned to each 1-cell \r\ in the proper relationship with the canonical tabulation assigned to its chosen factorization \r = g \ f\<^sup>*\. \ context bicategory_of_spans begin interpretation Maps: maps_category V H \ \ src trg .. interpretation Span: span_bicategory Maps.comp Maps.PRJ\<^sub>0 Maps.PRJ\<^sub>1 .. no_notation Fun.comp (infixl "\" 55) notation Span.vcomp (infixr "\" 55) notation Span.hcomp (infixr "\" 53) notation Maps.comp (infixr "\" 55) notation isomorphic (infix "\" 50) definition spn where "spn \ \ arrow_of_tabulations_in_maps.chine V H \ \ src trg (tab_of_ide (dom \)) (tab\<^sub>0 (dom \)) (cod \) (tab_of_ide (cod \)) (tab\<^sub>0 (cod \)) (tab\<^sub>1 (cod \)) \" lemma is_induced_map_spn: assumes "arr \" shows "arrow_of_tabulations_in_maps.is_induced_map V H \ \ src trg (tab_of_ide (dom \)) (tab\<^sub>0 (dom \)) (cod \) (tab_of_ide (cod \)) (tab\<^sub>0 (cod \)) (tab\<^sub>1 (cod \)) \ (spn \)" proof - interpret \: arrow_in_bicategory_of_spans V H \ \ src trg \dom \\ \cod \\ \ using assms by unfold_locales auto interpret \: arrow_of_tabulations_in_maps V H \ \ src trg \dom \\ \.r.tab \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \cod \\ \.s.tab \tab\<^sub>0 (cod \)\ \tab\<^sub>1 (cod \)\ \ using \.is_arrow_of_tabulations_in_maps by simp show ?thesis unfolding spn_def using \.chine_is_induced_map by blast qed lemma spn_props: assumes "arr \" shows "\spn \ : src (tab\<^sub>0 (dom \)) \ src (tab\<^sub>0 (cod \))\" and "is_left_adjoint (spn \)" and "tab\<^sub>0 (cod \) \ spn \ \ tab\<^sub>0 (dom \)" and "tab\<^sub>1 (cod \) \ spn \ \ tab\<^sub>1 (dom \)" proof - interpret \: arrow_in_bicategory_of_spans V H \ \ src trg \dom \\ \cod \\ \ using assms by unfold_locales auto interpret \: arrow_of_tabulations_in_maps V H \ \ src trg \dom \\ \.r.tab \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \cod \\ \.s.tab \tab\<^sub>0 (cod \)\ \tab\<^sub>1 (cod \)\ \ using \.is_arrow_of_tabulations_in_maps by simp show "\spn \ : src (tab\<^sub>0 (dom \)) \ src (tab\<^sub>0 (cod \))\" using spn_def by simp show "is_left_adjoint (spn \)" using spn_def by (simp add: \.is_map) show "tab\<^sub>0 (cod \) \ spn \ \ tab\<^sub>0 (dom \)" using spn_def isomorphic_def \.leg0_uniquely_isomorphic(1) by auto show "tab\<^sub>1 (cod \) \ spn \ \ tab\<^sub>1 (dom \)" using spn_def isomorphic_def isomorphic_symmetric \.leg1_uniquely_isomorphic(1) by auto qed lemma spn_in_hom [intro]: assumes "arr \" shows "\spn \ : src (tab\<^sub>0 (dom \)) \ src (tab\<^sub>0 (cod \))\" and "\spn \ : spn \ \ spn \\" using assms spn_props left_adjoint_is_ide by auto lemma spn_simps [simp]: assumes "arr \" shows "is_left_adjoint (spn \)" and "ide (spn \)" and "src (spn \) = src (tab\<^sub>0 (dom \))" and "trg (spn \) = src (tab\<^sub>0 (cod \))" using assms spn_props left_adjoint_is_ide by auto text \ We need the next result to show that \SPN\ is functorial; in particular, that it takes \\r : r \ r\\ in the underlying bicategory to a 1-cell in \Span(Maps(B))\. The 1-cells in \Span(Maps(B))\ have objects of \Maps(B)\ as their chines, and objects of \Maps(B)\ are isomorphism classes of objects in the underlying bicategory \B\. So we need the induced map associated with \r\ to be isomorphic to an object. \ lemma spn_ide: assumes "ide r" shows "spn r \ src (tab\<^sub>0 r)" proof - interpret r: identity_in_bicategory_of_spans V H \ \ src trg r using assms by unfold_locales auto interpret r: arrow_of_tabulations_in_maps V H \ \ src trg r r.tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ r r.tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ r using r.is_arrow_of_tabulations_in_maps by simp interpret tab: tabulation V H \ \ src trg r \r.tab\ \tab\<^sub>0 r\ \dom r.tab\ using assms r.tab_is_tabulation by simp interpret tab: tabulation_in_maps V H \ \ src trg r \r.tab\ \tab\<^sub>0 r\ \dom r.tab\ by (unfold_locales, simp_all) have "tab.is_induced_by_cell (spn r) (tab\<^sub>0 r) r.tab" using spn_def comp_ide_arr r.chine_is_induced_map by auto thus ?thesis using tab.induced_map_unique [of "tab\<^sub>0 r" "r.tab" "spn r" "src r.s\<^sub>0"] tab.apex_is_induced_by_cell by (simp add: comp_assoc) qed text \ The other key result we need to show that \SPN\ is functorial is to show that the induced map of a composite is isomorphic to the composite of induced maps. \ lemma spn_hcomp: assumes "seq \ \" and "g \ spn \" and "f \ spn \" shows "spn (\ \ \) \ g \ f" proof - interpret \: arrow_in_bicategory_of_spans V H \ \ src trg \dom \\ \cod \\ \ using assms by unfold_locales auto interpret \: arrow_of_tabulations_in_maps V H \ \ src trg \dom \\ \.r.tab \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \cod \\ \.s.tab \tab\<^sub>0 (cod \)\ \tab\<^sub>1 (cod \)\ \ using \.is_arrow_of_tabulations_in_maps by simp interpret \: arrow_in_bicategory_of_spans V H \ \ src trg \dom \\ \dom \\ \ using assms apply unfold_locales apply auto[1] by (elim seqE, auto) interpret \: arrow_of_tabulations_in_maps V H \ \ src trg \dom \\ \.r.tab \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \dom \\ \.r.tab \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \ using \.is_arrow_of_tabulations_in_maps by simp interpret \\: vertical_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \dom \\ \.r.tab \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \dom \\ \.r.tab \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \cod \\ \.s.tab \tab\<^sub>0 (cod \)\ \tab\<^sub>1 (cod \)\ \ \ .. have "g \ \.chine" using assms(2) spn_def by auto moreover have "f \ \.chine" using assms(1) assms(3) spn_def by auto moreover have "src g = trg f" using calculation(1-2) isomorphic_implies_hpar(3-4) by auto moreover have "src g = trg \.chine" using calculation(1) isomorphic_implies_hpar(3) by auto ultimately have "g \ f \ \.chine \ \.chine" using hcomp_ide_isomorphic hcomp_isomorphic_ide isomorphic_transitive by (meson \.is_ide isomorphic_implies_ide(1)) also have "... \ spn (\ \ \)" using spn_def \\.chine_char isomorphic_symmetric by (metis \\.in_hom in_homE) finally show ?thesis using isomorphic_symmetric by simp qed abbreviation (input) SPN\<^sub>0 where "SPN\<^sub>0 r \ Span.mkIde \\tab\<^sub>0 r\\ \\tab\<^sub>1 r\\" definition SPN where "SPN \ \ if arr \ then \Chn = \\spn \\\, Dom = \Leg0 = \\tab\<^sub>0 (dom \)\\, Leg1 = \\tab\<^sub>1 (dom \)\\\, Cod = \Leg0 = \\tab\<^sub>0 (cod \)\\, Leg1 = \\tab\<^sub>1 (cod \)\\\\ else Span.null" lemma Dom_SPN [simp]: assumes "arr \" shows "Dom (SPN \) = \Leg0 = \\tab\<^sub>0 (dom \)\\, Leg1 = \\tab\<^sub>1 (dom \)\\\" using assms SPN_def by simp lemma Cod_SPN [simp]: assumes "arr \" shows "Cod (SPN \) = \Leg0 = \\tab\<^sub>0 (cod \)\\, Leg1 = \\tab\<^sub>1 (cod \)\\\" using assms SPN_def by simp text \Now we have to show this does the right thing for us.\ lemma SPN_in_hom: assumes "arr \" shows "Span.in_hom (SPN \) (SPN\<^sub>0 (dom \)) (SPN\<^sub>0 (cod \))" proof interpret Dom: span_in_category Maps.comp \Dom (SPN \)\ proof interpret r: identity_in_bicategory_of_spans V H \ \ src trg \dom \\ using assms by unfold_locales auto show "Maps.span (Leg0 (Dom (SPN \))) (Leg1 (Dom (SPN \)))" using assms Maps.CLS_in_hom SPN_def by (metis (no_types, lifting) Maps.in_homE bicategory_of_spans.Dom_SPN bicategory_of_spans_axioms r.leg1_is_map r.leg1_simps(3) r.satisfies_T0 span_data.simps(1) span_data.simps(2)) qed interpret Dom': span_in_category Maps.comp \\Leg0 = \\tab\<^sub>0 (dom \)\\, Leg1 = \\tab\<^sub>1 (dom \)\\\\ using assms Dom.span_in_category_axioms SPN_def by simp interpret Cod: span_in_category Maps.comp \Cod (SPN \)\ proof interpret s: identity_in_bicategory_of_spans V H \ \ src trg \cod \\ using assms by unfold_locales auto show "Maps.span (Leg0 (Cod (SPN \))) (Leg1 (Cod (SPN \)))" using assms Maps.CLS_in_hom SPN_def by (metis (no_types, lifting) bicategory_of_spans.Cod_SPN bicategory_of_spans_axioms ide_dom s.base_simps(2) s.base_simps(3) s.determines_span span_in_category.is_span) qed interpret Cod': span_in_category Maps.comp \\Leg0 = \\tab\<^sub>0 (cod \)\\, Leg1 = \\tab\<^sub>1 (cod \)\\\\ using assms Cod.span_in_category_axioms SPN_def by simp show 1: "Span.arr (SPN \)" proof (unfold Span.arr_char) show "arrow_of_spans Maps.comp (SPN \)" proof (unfold_locales) show "Maps.in_hom (Chn (SPN \)) Dom.apex Cod.apex" unfolding SPN_def Maps.in_hom_char using assms Dom'.apex_def Cod'.apex_def Dom'.is_span Cod'.is_span Maps.arr_char by auto show "Cod.leg0 \ Chn (SPN \) = Dom.leg0" unfolding SPN_def using assms spn_props [of \] Maps.comp_CLS [of "tab\<^sub>0 (cod \)" "spn \"] by simp show "Cod.leg1 \ Chn (SPN \) = Dom.leg1" unfolding SPN_def using assms spn_props [of \] Maps.comp_CLS [of "tab\<^sub>1 (cod \)" "spn \"] by simp qed qed show "Span.dom (SPN \) = SPN\<^sub>0 (dom \)" using assms 1 Span.dom_char Dom'.apex_def SPN_def by simp show "Span.cod (SPN \) = SPN\<^sub>0 (cod \)" using assms 1 Span.cod_char Cod'.apex_def SPN_def by simp qed interpretation SPN: "functor" V Span.vcomp SPN proof show "\\. \ arr \ \ SPN \ = Span.null" unfolding SPN_def by simp show 1: "\\. arr \ \ Span.arr (SPN \)" using SPN_in_hom by auto show "\\. arr \ \ Span.dom (SPN \) = SPN (dom \)" proof - fix \ assume \: "arr \" have 1: "Maps.arr (Maps.MkArr (src (tab\<^sub>0 (dom \))) (src \) \tab\<^sub>0 (dom \)\)" proof - have "src (tab\<^sub>0 (dom \)) \ Collect obj" using \ by simp moreover have "src \ \ Collect obj" using \ by simp moreover have "\tab\<^sub>0 (dom \)\ \ Maps.Hom (src (tab\<^sub>0 (local.dom \))) (src \)" proof - have "\tab\<^sub>0 (dom \) : src (tab\<^sub>0 (dom \)) \ src \\" using \ by simp moreover have "is_left_adjoint (tab\<^sub>0 (dom \))" using \ tab\<^sub>0_simps [of "dom \"] by auto ultimately show ?thesis by auto qed ultimately show ?thesis by simp qed have "\spn (dom \)\ = \src (tab\<^sub>0 (dom \))\" using \ spn_ide iso_class_eqI by auto hence "SPN (dom \) = SPN\<^sub>0 (dom \)" unfolding SPN_def using \ 1 Maps.dom_char by simp thus "Span.dom (SPN \) = SPN (dom \)" using \ SPN_in_hom by auto qed show "\\. arr \ \ Span.cod (SPN \) = SPN (cod \)" proof - fix \ assume \: "arr \" have 1: "Maps.arr (Maps.MkArr (src (tab\<^sub>0 (cod \))) (src \) \tab\<^sub>0 (cod \)\)" proof - have "src (tab\<^sub>0 (cod \)) \ Collect obj" using \ by simp moreover have "src \ \ Collect obj" using \ by simp moreover have "\tab\<^sub>0 (cod \)\ \ Maps.Hom (src (tab\<^sub>0 (cod \))) (src \)" proof - have "\tab\<^sub>0 (cod \) : src (tab\<^sub>0 (cod \)) \ src \\" using \ by simp moreover have "is_left_adjoint (tab\<^sub>0 (cod \))" using \ by simp ultimately show ?thesis by auto qed ultimately show ?thesis by simp qed have "\spn (cod \)\ = \src (tab\<^sub>0 (cod \))\" using \ spn_ide iso_class_eqI by auto hence "SPN (cod \) = SPN\<^sub>0 (cod \)" unfolding SPN_def using \ 1 Maps.dom_char by simp thus "Span.cod (SPN \) = SPN (cod \)" using \ SPN_in_hom by auto qed show "\\ \. seq \ \ \ SPN (\ \ \) = SPN \ \ SPN \" proof - fix \ \ assume seq: "seq \ \" have "Dom (SPN (\ \ \)) = Dom (SPN \ \ SPN \)" using seq 1 Span.vcomp_def Span.arr_char by (elim seqE, simp) moreover have "Cod (SPN (\ \ \)) = Cod (SPN \ \ SPN \)" using seq 1 Span.vcomp_def Span.arr_char by (elim seqE, simp) moreover have "Chn (SPN (\ \ \)) = Chn (SPN \ \ SPN \)" proof - have *: "\spn (\ \ \)\ = Maps.Comp \spn \\ \spn \\" proof show "\spn (\ \ \)\ \ Maps.Comp \spn \\ \spn \\" proof fix h assume h: "h \ \spn (\ \ \)\" show "h \ Maps.Comp \spn \\ \spn \\" proof - have 1: "spn \ \ \spn \\" using seq ide_in_iso_class by auto moreover have 2: "spn \ \ \spn \\" using seq ide_in_iso_class by auto moreover have "spn \ \ spn \ \ h" - proof - + proof - have "spn \ \ spn \ \ spn (\ \ \)" using seq spn_hcomp 1 2 iso_class_def isomorphic_reflexive isomorphic_symmetric by simp thus ?thesis using h isomorphic_transitive iso_class_def by simp qed ultimately show ?thesis unfolding Maps.Comp_def by (metis (mono_tags, lifting) is_iso_classI spn_simps(2) mem_Collect_eq seq seqE) qed qed show "Maps.Comp \spn \\ \spn \\ \ \spn (\ \ \)\" proof fix h assume h: "h \ Maps.Comp \spn \\ \spn \\" show "h \ \spn (\ \ \)\" proof - obtain f g where 1: "g \ \spn \\ \ f \ \spn \\ \ g \ f \ h" using h Maps.Comp_def [of "iso_class (spn \)" "iso_class (spn \)"] iso_class_def iso_class_elems_isomorphic by blast have fg: "g \ spn \ \ f \ spn \ \ g \ f \ h" proof - have "spn \ \ \spn \\ \ spn \ \ \spn \\" using seq ide_in_iso_class by auto thus ?thesis using 1 iso_class_elems_isomorphic isomorphic_symmetric is_iso_classI by (meson spn_simps(2) seq seqE) qed have "g \ f \ \spn (\ \ \)\" using seq fg 1 spn_hcomp iso_class_def isomorphic_symmetric by simp thus ?thesis using fg isomorphic_transitive iso_class_def by blast qed qed qed have "Chn (SPN \ \ SPN \) = Maps.MkArr (src (tab\<^sub>0 (cod \))) (src (tab\<^sub>0 (cod \))) \spn \\ \ Maps.MkArr (src (tab\<^sub>0 (dom \))) (src (tab\<^sub>0 (cod \))) \spn \\" using 1 seq SPN_def Span.vcomp_def Span.arr_char apply (elim seqE) apply simp by (metis (no_types, lifting) seq vseq_implies_hpar(1) vseq_implies_hpar(2)) also have "... = Maps.MkArr (src (tab\<^sub>0 (dom \))) (src (tab\<^sub>0 (cod \))) (Maps.Comp \spn \\ \spn \\)" proof - have "Maps.seq (Maps.MkArr (src (tab\<^sub>0 (cod \))) (src (tab\<^sub>0 (cod \))) \spn \\) (Maps.MkArr (src (tab\<^sub>0 (dom \))) (src (tab\<^sub>0 (cod \))) \spn \\)" proof show "Maps.in_hom (Maps.MkArr (src (tab\<^sub>0 (local.dom \))) (src (tab\<^sub>0 (cod \))) \spn \\) (Maps.MkIde (src (tab\<^sub>0 (dom \)))) (Maps.MkIde (src (tab\<^sub>0 (cod \))))" proof - have "src (tab\<^sub>0 (dom \)) \ Collect obj" using in_hhom_def seq by auto moreover have "src (tab\<^sub>0 (cod \)) \ Collect obj" using seq by auto moreover have "\spn \\ \ Maps.Hom (src (tab\<^sub>0 (dom \))) (src (tab\<^sub>0 (cod \)))" using spn_props by (metis (mono_tags, lifting) mem_Collect_eq seq seqE) ultimately show ?thesis using Maps.MkArr_in_hom by simp qed show "Maps.in_hom (Maps.MkArr (src (tab\<^sub>0 (cod \))) (src (tab\<^sub>0 (cod \))) \spn \\) (Maps.MkIde (src (tab\<^sub>0 (cod \)))) (Maps.MkIde (src (tab\<^sub>0 (cod \))))" proof - have "src (tab\<^sub>0 (cod \)) \ Collect obj" using in_hhom_def seq by auto moreover have "src (tab\<^sub>0 (cod \)) \ Collect obj" using seq by auto moreover have "\spn \\ \ Maps.Hom (src (tab\<^sub>0 (cod \))) (src (tab\<^sub>0 (cod \)))" using spn_props by (metis (mono_tags, lifting) mem_Collect_eq seq seqE) ultimately show ?thesis using Maps.MkArr_in_hom by simp qed qed thus ?thesis using Maps.comp_char [of "Maps.MkArr (src (tab\<^sub>0 (cod \))) (src (tab\<^sub>0 (cod \))) \spn \\" "Maps.MkArr (src (tab\<^sub>0 (dom \))) (src (tab\<^sub>0 (cod \))) \spn \\"] by simp qed also have "... = Maps.MkArr (src (tab\<^sub>0 (dom \))) (src (tab\<^sub>0 (cod \))) \spn (\ \ \)\" using * by simp also have "... = Chn (SPN (\ \ \))" using seq SPN_def Span.vcomp_def by (elim seqE, simp) finally show ?thesis by simp qed ultimately show "SPN (\ \ \) = SPN \ \ SPN \" by simp qed qed lemma SPN_is_functor: shows "functor V Span.vcomp SPN" .. interpretation SPN: weak_arrow_of_homs V src trg Span.vcomp Span.src Span.trg SPN proof show "\\. arr \ \ Span.isomorphic (SPN (src \)) (Span.src (SPN \))" proof - fix \ assume \: "arr \" let ?src = "Maps.MkIde (src \)" have src: "Maps.ide ?src" using \ by simp interpret src: identity_in_bicategory_of_spans V H \ \ src trg \src \\ using \ by unfold_locales auto interpret src: arrow_of_tabulations_in_maps V H \ \ src trg \src \\ src.tab \tab\<^sub>0 (src \)\ \tab\<^sub>1 (src \)\ \src \\ src.tab \tab\<^sub>0 (src \)\ \tab\<^sub>1 (src \)\ \src \\ using src.is_arrow_of_tabulations_in_maps by simp interpret src: span_in_category Maps.comp \\Leg0 = ?src, Leg1 = ?src\\ using src by (unfold_locales, simp) let ?tab\<^sub>0 = "Maps.MkArr (src (tab\<^sub>0 (src \))) (src \) \tab\<^sub>0 (src \)\" have tab\<^sub>0_src: "\tab\<^sub>0 (src \) : src (tab\<^sub>0 (src \)) \ src \\ \ is_left_adjoint (tab\<^sub>0 (src \)) \ \tab\<^sub>0 (src \)\ = \tab\<^sub>0 (src \)\" using \ by simp have tab\<^sub>0: "Maps.arr ?tab\<^sub>0" using \ Maps.arr_MkArr tab\<^sub>0_src by blast let ?tab\<^sub>1 = "Maps.MkArr (src (tab\<^sub>0 (src \))) (src \) \tab\<^sub>1 (src \)\" have tab\<^sub>1_src: "\tab\<^sub>1 (src \) : src (tab\<^sub>0 (src \)) \ src \\ \ is_left_adjoint (tab\<^sub>1 (src \)) \ \tab\<^sub>1 (src \)\ = \tab\<^sub>1 (src \)\" using \ by simp have tab\<^sub>1: "Maps.arr ?tab\<^sub>1" using \ Maps.arr_MkArr tab\<^sub>1_src by blast interpret tab: span_in_category Maps.comp \\Leg0 = ?tab\<^sub>0, Leg1 = ?tab\<^sub>1\\ using tab\<^sub>0 tab\<^sub>1 Maps.dom_char Maps.cod_char by (unfold_locales, simp) have "src \ \ tab\<^sub>0 (src \) \ tab\<^sub>0 (src \)" using \ iso_lunit isomorphic_def by (metis lunit_in_hom(2) src.ide_u src.u_simps(3) src_src) hence "src \ \ tab\<^sub>0 (src \) \ tab\<^sub>1 (src \)" using \ src.obj_has_symmetric_tab isomorphic_transitive by blast have "\tab\<^sub>0 (src \)\ \ Maps.Hom (src (tab\<^sub>0 (src \))) (src \)" using \ tab\<^sub>0_src by blast have "\src \\ \ Maps.Hom (src \) (src \)" proof - have "\src \ : src \ \ src \\ \ is_left_adjoint (src \) \ \src \\ = \src \\" using \ obj_is_self_adjoint by simp thus ?thesis by auto qed interpret SPN_src: arrow_of_spans Maps.comp \SPN (src \)\ using \ SPN.preserves_reflects_arr Span.arr_char by blast have SPN_src: "SPN (src \) = \Chn = Maps.MkArr (src (tab\<^sub>0 (src \))) (src (tab\<^sub>0 (src \))) \spn (src \)\, Dom = \Leg0 = ?tab\<^sub>0, Leg1 = ?tab\<^sub>1\, Cod = \Leg0 = ?tab\<^sub>0, Leg1 = ?tab\<^sub>1\\" unfolding SPN_def using \ by simp interpret src_SPN: arrow_of_spans Maps.comp \Span.src (SPN \)\ using \ SPN.preserves_reflects_arr Span.arr_char by blast have src_SPN: "Span.src (SPN \) = \Chn = ?src, Dom = \Leg0 = ?src, Leg1 = ?src\, Cod = \Leg0 = ?src, Leg1 = ?src\\" proof - let ?tab\<^sub>0_dom = "Maps.MkArr (src (tab\<^sub>0 (dom \))) (src \) \tab\<^sub>0 (dom \)\" have "Maps.arr ?tab\<^sub>0_dom" proof - have "\tab\<^sub>0 (dom \) : src (tab\<^sub>0 (dom \)) \ src \\ \ is_left_adjoint (tab\<^sub>0 (dom \)) \ \tab\<^sub>0 (dom \)\ = \tab\<^sub>0 (dom \)\" using \ by simp thus ?thesis using \ Maps.arr_MkArr by blast qed thus ?thesis using \ Maps.cod_char Span.src_def by simp qed text \ The idea of the proof is that @{term "iso_class (tab\<^sub>0 (src \))"} is invertible in \Maps(B)\ and determines an invertible arrow of spans from @{term "SPN (src \)"} to @{term "Span.src (SPN \)"}. \ let ?\ = "\Chn = ?tab\<^sub>0, Dom = Dom (SPN (src \)), Cod = Cod (Span.src (SPN \))\" interpret \: arrow_of_spans Maps.comp ?\ apply (unfold_locales, simp_all) proof - show "Maps.in_hom ?tab\<^sub>0 SPN_src.dom.apex src_SPN.cod.apex" using \ tab\<^sub>0 Maps.dom_char Maps.cod_char SPN_src src_SPN tab.apex_def src_SPN.cod.apex_def apply (intro Maps.in_homI) by simp_all show "src_SPN.cod.leg0 \ ?tab\<^sub>0 = SPN_src.dom.leg0" proof - have "Maps.seq src_SPN.cod.leg0 ?tab\<^sub>0" using \ src_SPN tab\<^sub>0 Maps.dom_char Maps.cod_char by (intro Maps.seqI, auto) moreover have "Maps.Comp \src \\ \tab\<^sub>0 (src \)\ = \tab\<^sub>0 (src \)\" proof - have "tab\<^sub>0 (src \) \ Maps.Comp \src \\ \tab\<^sub>0 (src \)\" using \ is_iso_classI ide_in_iso_class [of "src \"] ide_in_iso_class [of "tab\<^sub>0 (src \)"] \src \ \ tab\<^sub>0 (src \) \ tab\<^sub>0 (src \)\ by auto thus ?thesis using Maps.Comp_eq_iso_class_memb \\tab\<^sub>0 (src \)\ \ Maps.Hom (src (tab\<^sub>0 (src \))) (src \)\ \\src \\ \ Maps.Hom (src \) (src \)\ by meson qed ultimately show ?thesis using \ Maps.comp_char [of src_SPN.cod.leg0 ?tab\<^sub>0] src_SPN by simp qed show "src_SPN.cod.leg1 \ ?tab\<^sub>0 = SPN_src.dom.leg1" proof - have "Maps.seq src_SPN.cod.leg1 ?tab\<^sub>0" using \ src_SPN tab\<^sub>0 Maps.dom_char Maps.cod_char by (intro Maps.seqI, auto) moreover have "Maps.Comp \src \\ \tab\<^sub>0 (src \)\ = \tab\<^sub>1 (src \)\" proof - have "tab\<^sub>1 (src \) \ Maps.Comp \src \\ \tab\<^sub>0 (src \)\" using \ is_iso_classI ide_in_iso_class [of "src \"] ide_in_iso_class [of "tab\<^sub>0 (src \)"] \isomorphic (src \ \ tab\<^sub>0 (src \)) (tab\<^sub>1 (src \))\ by auto thus ?thesis using Maps.Comp_eq_iso_class_memb \\tab\<^sub>0 (src \)\ \ Maps.Hom (src (tab\<^sub>0 (src \))) (src \)\ \\src \\ \ Maps.Hom (src \) (src \)\ by meson qed ultimately show ?thesis using \ Maps.comp_char [of src_SPN.cod.leg1 ?tab\<^sub>0] src_SPN by simp qed qed have "Span.in_hom ?\ (SPN (src \)) (Span.src (SPN \))" using \ tab\<^sub>0 spn_ide [of "src \"] iso_class_eqI Span.arr_char Span.dom_char Span.cod_char \.arrow_of_spans_axioms SPN_src src_SPN src.apex_def tab.apex_def Maps.dom_char apply (intro Span.in_homI) by auto (* The preceding cannot be written "by (intro Span.in_homI, auto)", why? *) moreover have "Maps.iso ?tab\<^sub>0" using \ tab\<^sub>0 ide_in_iso_class src.is_map_iff_tab\<^sub>0_is_equivalence obj_is_self_adjoint Maps.iso_char' [of ?tab\<^sub>0] by auto ultimately show "Span.isomorphic (SPN (src \)) (Span.src (SPN \))" using Span.isomorphic_def Span.iso_char by auto qed show "\\. arr \ \ Span.isomorphic (SPN (trg \)) (Span.trg (SPN \))" proof - fix \ assume \: "arr \" let ?trg = "Maps.MkIde (trg \)" have trg: "Maps.ide ?trg" using \ by simp interpret trg: identity_in_bicategory_of_spans V H \ \ src trg \trg \\ using \ by unfold_locales auto interpret trg: span_in_category Maps.comp \\Leg0 = ?trg, Leg1 = ?trg\\ using trg by (unfold_locales, simp) let ?tab\<^sub>0 = "Maps.MkArr (src (tab\<^sub>0 (trg \))) (trg \) \tab\<^sub>0 (trg \)\" have tab\<^sub>0_trg: "\tab\<^sub>0 (trg \) : src (tab\<^sub>0 (trg \)) \ trg \\ \ is_left_adjoint (tab\<^sub>0 (trg \)) \ \tab\<^sub>0 (trg \)\ = \tab\<^sub>0 (trg \)\" using \ by simp have tab\<^sub>0: "Maps.arr ?tab\<^sub>0" using \ Maps.arr_MkArr tab\<^sub>0_trg by blast let ?tab\<^sub>1 = "Maps.MkArr (src (tab\<^sub>0 (trg \))) (trg \) \tab\<^sub>1 (trg \)\" have tab\<^sub>1_trg: "\tab\<^sub>1 (trg \) : src (tab\<^sub>0 (trg \)) \ trg \\ \ is_left_adjoint (tab\<^sub>1 (trg \)) \ \tab\<^sub>1 (trg \)\ = \tab\<^sub>1 (trg \)\" using \ by simp have tab\<^sub>1: "Maps.arr ?tab\<^sub>1" using \ Maps.arr_MkArr tab\<^sub>1_trg by blast interpret tab: span_in_category Maps.comp \\Leg0 = ?tab\<^sub>0, Leg1 = ?tab\<^sub>1\\ using tab\<^sub>0 tab\<^sub>1 Maps.dom_char Maps.cod_char by (unfold_locales, simp) have "trg \ \ tab\<^sub>1 (trg \) \ tab\<^sub>0 (trg \)" proof - have "\\[tab\<^sub>1 (trg \)] : trg \ \ tab\<^sub>1 (trg \) \ tab\<^sub>1 (trg \)\" using \ by simp moreover have "iso \[tab\<^sub>1 (trg \)]" using \ iso_lunit by simp ultimately have "trg \ \ tab\<^sub>1 (trg \) \ tab\<^sub>1 (trg \)" using isomorphic_def by auto also have "tab\<^sub>1 (trg \) \ tab\<^sub>0 (trg \)" using \ trg.obj_has_symmetric_tab isomorphic_symmetric by auto finally show ?thesis by blast qed hence "trg \ \ tab\<^sub>1 (trg \) \ tab\<^sub>1 (trg \)" using \ trg.obj_has_symmetric_tab isomorphic_transitive by blast have "\tab\<^sub>1 (trg \)\ \ Maps.Hom (src (tab\<^sub>0 (trg \))) (trg \)" proof - have "\tab\<^sub>1 (trg \) : src (tab\<^sub>0 (trg \)) \ trg \\ \ is_left_adjoint (tab\<^sub>0 (trg \)) \ \tab\<^sub>0 (trg \)\ = \tab\<^sub>0 (trg \)\" using \ by simp thus ?thesis by auto qed have "\trg \\ \ Maps.Hom (trg \) (trg \)" proof - have "\trg \ : trg \ \ trg \\ \ is_left_adjoint (trg \) \ \trg \\ = \trg \\" using \ obj_is_self_adjoint by simp thus ?thesis by auto qed interpret SPN_trg: arrow_of_spans Maps.comp \SPN (trg \)\ using \ SPN.preserves_reflects_arr Span.arr_char by blast have SPN_trg: "SPN (trg \) = \Chn = Maps.MkArr (src (tab\<^sub>1 (trg \))) (src (tab\<^sub>1 (trg \))) \spn (trg \)\, Dom = \Leg0 = ?tab\<^sub>0, Leg1 = ?tab\<^sub>1\, Cod = \Leg0 = ?tab\<^sub>0, Leg1 = ?tab\<^sub>1\\" unfolding SPN_def using \ by simp interpret trg_SPN: arrow_of_spans Maps.comp \Span.trg (SPN \)\ using \ SPN.preserves_reflects_arr Span.arr_char by blast have trg_SPN: "Span.trg (SPN \) = \Chn = ?trg, Dom = \Leg0 = ?trg, Leg1 = ?trg\, Cod = \Leg0 = ?trg, Leg1 = ?trg\\" proof - let ?tab\<^sub>1_dom = "Maps.MkArr (src (tab\<^sub>1 (dom \))) (trg \) \tab\<^sub>1 (dom \)\" have "Maps.arr ?tab\<^sub>1_dom" proof - have "\tab\<^sub>1 (dom \) : src (tab\<^sub>1 (dom \)) \ trg \\ \ is_left_adjoint (tab\<^sub>1 (dom \)) \ \tab\<^sub>1 (dom \)\ = \tab\<^sub>1 (dom \)\" using \ by simp thus ?thesis using \ Maps.arr_MkArr by blast qed thus ?thesis using \ Maps.cod_char Span.trg_def by simp qed let ?\ = "\Chn = ?tab\<^sub>1, Dom = Dom (SPN (trg \)), Cod = Cod (Span.trg (SPN \))\" interpret \: arrow_of_spans Maps.comp ?\ apply (unfold_locales, simp_all) proof - show "Maps.in_hom ?tab\<^sub>1 SPN_trg.dom.apex trg_SPN.cod.apex" using \ tab\<^sub>0 tab\<^sub>1 Maps.dom_char Maps.cod_char SPN_trg trg_SPN tab.apex_def trg_SPN.cod.apex_def apply (intro Maps.in_homI) by simp_all (* The preceding cannot be written "by (intro Maps.in_homI, simp_all)", why? *) show "Maps.comp trg_SPN.cod.leg0 ?tab\<^sub>1 = SPN_trg.dom.leg0" proof - have "Maps.seq trg_SPN.cod.leg0 ?tab\<^sub>1" using \ trg_SPN tab\<^sub>1 Maps.dom_char Maps.cod_char by (intro Maps.seqI, auto) moreover have "Maps.Comp \trg \\ \tab\<^sub>1 (trg \)\ = \tab\<^sub>1 (trg \)\" proof - have "tab\<^sub>1 (trg \) \ Maps.Comp \trg \\ \tab\<^sub>1 (trg \)\" using \ is_iso_classI ide_in_iso_class [of "trg \"] ide_in_iso_class [of "tab\<^sub>1 (trg \)"] \trg \ \ tab\<^sub>1 (trg \) \ tab\<^sub>1 (trg \)\ by auto thus ?thesis using Maps.Comp_eq_iso_class_memb \iso_class (tab\<^sub>1 (trg \)) \ Maps.Hom (src (tab\<^sub>0 (trg \))) (trg \)\ \iso_class (trg \) \ Maps.Hom (trg \) (trg \)\ by meson qed moreover have "\tab\<^sub>1 (trg \)\ = \tab\<^sub>0 (trg \)\" using \ iso_class_eqI trg.obj_has_symmetric_tab by auto ultimately show ?thesis using \ Maps.comp_char [of trg_SPN.cod.leg0 ?tab\<^sub>1] trg_SPN by simp qed show "trg_SPN.cod.leg1 \ ?tab\<^sub>1 = SPN_trg.dom.leg1" proof - have "Maps.seq trg_SPN.cod.leg1 ?tab\<^sub>1" using \ trg_SPN tab\<^sub>1 Maps.dom_char Maps.cod_char by (intro Maps.seqI, auto) moreover have "Maps.Comp \trg \\ \tab\<^sub>1 (trg \)\ = \tab\<^sub>1 (trg \)\" proof - have "tab\<^sub>1 (trg \) \ Maps.Comp \trg \\ \tab\<^sub>1 (trg \)\" using \ is_iso_classI ide_in_iso_class [of "trg \"] ide_in_iso_class [of "tab\<^sub>1 (trg \)"] \trg \ \ tab\<^sub>1 (trg \) \ tab\<^sub>1 (trg \)\ by auto thus ?thesis using Maps.Comp_eq_iso_class_memb \\tab\<^sub>1 (trg \)\ \ Maps.Hom (src (tab\<^sub>0 (trg \))) (trg \)\ \\trg \\ \ Maps.Hom (trg \) (trg \)\ by meson qed ultimately show ?thesis using \ Maps.comp_char [of trg_SPN.cod.leg1 ?tab\<^sub>1] trg_SPN by simp qed qed have \: "Span.in_hom ?\ (SPN (trg \)) (Span.trg (SPN \))" using \ tab\<^sub>0 spn_ide [of "trg \"] iso_class_eqI Span.arr_char Span.dom_char Span.cod_char \.arrow_of_spans_axioms SPN_trg trg_SPN trg.apex_def tab.apex_def Maps.dom_char apply (intro Span.in_homI) by auto have "Maps.iso ?tab\<^sub>1" proof - have "Maps.iso ?tab\<^sub>0" using \ tab\<^sub>0 ide_in_iso_class trg.is_map_iff_tab\<^sub>0_is_equivalence obj_is_self_adjoint Maps.iso_char' [of ?tab\<^sub>0] by auto moreover have "?tab\<^sub>0 = ?tab\<^sub>1" proof - have "\tab\<^sub>0 (trg \)\ = \tab\<^sub>1 (trg \)\" using \ iso_class_eqI trg.obj_has_symmetric_tab by auto thus ?thesis by simp qed ultimately show ?thesis by simp qed thus "Span.isomorphic (SPN (trg \)) (Span.trg (SPN \))" using \ Span.isomorphic_def Span.iso_char by auto qed qed lemma SPN_is_weak_arrow_of_homs: shows "weak_arrow_of_homs V src trg Span.vcomp Span.src Span.trg SPN" .. end subsubsection "Compositors" text \ To complete the proof that \SPN\ is a pseudofunctor, we need to obtain a natural isomorphism \\\, whose component at \(r, s)\ is an isomorphism \\ (r, s)\ from the horizontal composite \SPN r \ SPN s\ to \SPN (r \ s)\ in \Span(Maps(B))\, and we need to prove that the coherence conditions are satisfied. We have shown that the tabulations of \r\ and \s\ compose to yield a tabulation of \r \ s\. Since tabulations of the same arrow are equivalent, this tabulation must be equivalent to the chosen tabulation of \r \ s\. We therefore obtain an equivalence map from the apex of \SPN r \ SPN s\ to the apex of \SPN (r \ s)\ which commutes with the legs of these spans up to isomorphism. This equivalence map determines an invertible arrow in \Span(Maps(B))\. Moreover, by property \T2\, any two such equivalence maps are connected by a unique 2-cell, which is consequently an isomorphism. This shows that the arrow in \Span(Maps(B))\ is uniquely determined, which fact we can exploit to establish the required coherence conditions. \ locale two_composable_identities_in_bicategory_of_spans = bicategory_of_spans V H \ \ src trg + r: identity_in_bicategory_of_spans V H \ \ src trg r + s: identity_in_bicategory_of_spans V H \ \ src trg s for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and r :: 'a and s :: 'a + assumes composable: "src r = trg s" begin notation isomorphic (infix "\" 50) interpretation r: arrow_in_bicategory_of_spans V H \ \ src trg r r r by unfold_locales auto interpretation r: arrow_of_tabulations_in_maps V H \ \ src trg r r.tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ r r.tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ r using r.is_arrow_of_tabulations_in_maps by simp interpretation s: arrow_in_bicategory_of_spans V H \ \ src trg s s s by unfold_locales auto interpretation s: arrow_of_tabulations_in_maps V H \ \ src trg s s.tab \tab\<^sub>0 s\ \tab\<^sub>1 s\ s s.tab \tab\<^sub>0 s\ \tab\<^sub>1 s\ s using s.is_arrow_of_tabulations_in_maps by simp sublocale identity_in_bicategory_of_spans V H \ \ src trg \r \ s\ apply unfold_locales by (simp add: composable) sublocale horizontal_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg r r.tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ s s.tab \tab\<^sub>0 s\ \tab\<^sub>1 s\ r r.tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ s s.tab \tab\<^sub>0 s\ \tab\<^sub>1 s\ r s using composable by unfold_locales auto abbreviation p\<^sub>0 where "p\<^sub>0 \ \\.p\<^sub>0" abbreviation p\<^sub>1 where "p\<^sub>1 \ \\.p\<^sub>1" text \ We will take as the composition isomorphism from \SPN r \ SPN s\ to \SPN (r \ s)\ the arrow of tabulations, induced by the identity \r \ s\, from the composite of the chosen tabulations of \r\ and \s\ to the chosen tabulation of \r \ s\. As this arrow of tabulations is induced by an identity, it is an equivalence map. \ interpretation cmp: identity_arrow_of_tabulations_in_maps V H \ \ src trg \r \ s\ \\.tab \tab\<^sub>0 s \ \\.p\<^sub>0\ \tab\<^sub>1 r \ \\.p\<^sub>1\ \r \ s\ tab \tab\<^sub>0 (r \ s)\ \tab\<^sub>1 (r \ s)\ \r \ s\ using composable by unfold_locales auto lemma cmp_interpretation: shows "identity_arrow_of_tabulations_in_maps V H \ \ src trg (r \ s) \\.tab (tab\<^sub>0 s \ \\.p\<^sub>0) (tab\<^sub>1 r \ \\.p\<^sub>1) (r \ s) tab (tab\<^sub>0 (r \ s)) (tab\<^sub>1 (r \ s)) (r \ s)" .. definition cmp where "cmp = cmp.chine" lemma cmp_props: shows "\cmp : src \\.tab \ src tab\" and "\cmp : cmp \ cmp\" and "equivalence_map cmp" and "tab\<^sub>0 (r \ s) \ cmp \ tab\<^sub>0 s \ \\.p\<^sub>0" and "tab\<^sub>1 (r \ s) \ cmp \ tab\<^sub>1 r \ \\.p\<^sub>1" using cmp_def cmp.leg0_uniquely_isomorphic(1) cmp.leg1_uniquely_isomorphic(1) isomorphic_symmetric cmp.chine_is_equivalence by auto lemma cmp_in_hom [intro]: shows "\cmp : src \\.tab \ src tab\" and "\cmp : cmp \ cmp\" using cmp_props by auto lemma cmp_simps [simp]: shows "arr cmp" and "ide cmp" and "src cmp = src \\.tab" and "trg cmp = src tab" and "dom cmp = cmp" and "cod cmp = cmp" using cmp_props equivalence_map_is_ide by auto text \ Now we have to use the above properties of the underlying bicategory to exhibit the composition isomorphisms as actual arrows in \Span(Maps(B))\ and to prove the required naturality and coherence conditions. \ interpretation Maps: maps_category V H \ \ src trg .. interpretation Span: span_bicategory Maps.comp Maps.PRJ\<^sub>0 Maps.PRJ\<^sub>1 .. no_notation Fun.comp (infixl "\" 55) notation Span.vcomp (infixr "\" 55) notation Span.hcomp (infixr "\" 53) notation Maps.comp (infixr "\" 55) interpretation SPN: "functor" V Span.vcomp SPN using SPN_is_functor by simp interpretation SPN: weak_arrow_of_homs V src trg Span.vcomp Span.src Span.trg SPN using SPN_is_weak_arrow_of_homs by simp interpretation SPN_r_SPN_s: arrow_of_spans Maps.comp \SPN r \ SPN s\ using composable Span.ide_char [of "SPN r \ SPN s"] by simp interpretation SPN_r_SPN_s: identity_arrow_of_spans Maps.comp \SPN r \ SPN s\ using composable Span.ide_char [of "SPN r \ SPN s"] by (unfold_locales, simp) interpretation SPN_rs: arrow_of_spans Maps.comp \SPN (r \ s)\ using composable Span.arr_char r.base_simps(2) s.base_simps(2) by blast interpretation SPN_rs: identity_arrow_of_spans Maps.comp \SPN (r \ s)\ using composable Span.ide_char SPN.preserves_ide r.is_ide s.is_ide by (unfold_locales, simp) text \ The following are the legs (as arrows of \Maps\) of the spans \SPN r\ and \SPN s\. \ definition R\<^sub>0 where "R\<^sub>0 = \\tab\<^sub>0 r\\" definition R\<^sub>1 where "R\<^sub>1 = \\tab\<^sub>1 r\\" definition S\<^sub>0 where "S\<^sub>0 = \\tab\<^sub>0 s\\" definition S\<^sub>1 where "S\<^sub>1 = \\tab\<^sub>1 s\\" lemma span_legs_eq: shows "Leg0 (Dom (SPN r)) = R\<^sub>0" and "Leg1 (Dom (SPN r)) = R\<^sub>1" and "Leg0 (Dom (SPN s)) = S\<^sub>0" and "Leg1 (Dom (SPN s)) = S\<^sub>1" using SPN_def R\<^sub>0_def R\<^sub>1_def S\<^sub>0_def S\<^sub>1_def composable by auto lemma R\<^sub>0_in_hom [intro]: shows "Maps.in_hom R\<^sub>0 (Maps.MkIde (src r.s\<^sub>0)) (Maps.MkIde (src r))" by (simp add: Maps.MkArr_in_hom' R\<^sub>0_def) lemma R\<^sub>1_in_hom [intro]: shows "Maps.in_hom R\<^sub>1 (Maps.MkIde (src r.s\<^sub>0)) (Maps.MkIde (trg r))" by (simp add: Maps.MkArr_in_hom' R\<^sub>1_def) lemma S\<^sub>0_in_hom [intro]: shows "Maps.in_hom S\<^sub>0 (Maps.MkIde (src s.s\<^sub>0)) (Maps.MkIde (src s))" by (simp add: Maps.MkArr_in_hom' S\<^sub>0_def) lemma S\<^sub>1_in_hom [intro]: shows "Maps.in_hom S\<^sub>1 (Maps.MkIde (src s.s\<^sub>0)) (Maps.MkIde (trg s))" by (simp add: Maps.MkArr_in_hom' S\<^sub>1_def) lemma RS_simps [simp]: shows "Maps.arr R\<^sub>0" and "Maps.dom R\<^sub>0 = Maps.MkIde (src r.s\<^sub>0)" and "Maps.cod R\<^sub>0 = Maps.MkIde (src r)" and "Maps.Dom R\<^sub>0 = src r.s\<^sub>0" and "Maps.Cod R\<^sub>0 = src r" and "Maps.arr R\<^sub>1" and "Maps.dom R\<^sub>1 = Maps.MkIde (src r.s\<^sub>0)" and "Maps.cod R\<^sub>1 = Maps.MkIde (trg r)" and "Maps.Dom R\<^sub>1 = src r.s\<^sub>0" and "Maps.Cod R\<^sub>1 = trg r" and "Maps.arr S\<^sub>0" and "Maps.dom S\<^sub>0 = Maps.MkIde (src s.s\<^sub>0)" and "Maps.cod S\<^sub>0 = Maps.MkIde (src s)" and "Maps.Dom S\<^sub>0 = src s.s\<^sub>0" and "Maps.Cod S\<^sub>0 = src s" and "Maps.arr S\<^sub>1" and "Maps.dom S\<^sub>1 = Maps.MkIde (src s.s\<^sub>0)" and "Maps.cod S\<^sub>1 = Maps.MkIde (trg s)" and "Maps.Dom S\<^sub>1 = src s.s\<^sub>0" and "Maps.Cod S\<^sub>1 = trg s" using R\<^sub>0_in_hom R\<^sub>1_in_hom S\<^sub>0_in_hom S\<^sub>1_in_hom composable by (auto simp add: R\<^sub>0_def R\<^sub>1_def S\<^sub>0_def S\<^sub>1_def) text \ The apex of the composite span @{term "SPN r \ SPN s"} (defined in terms of pullback) coincides with the apex of the composite tabulation \\\\ (defined using the chosen tabulation of \(tab\<^sub>0 r)\<^sup>* \ tab\<^sub>1 s)\). We need this to be true in order to define the compositor of a pseudofunctor from the underlying bicategory \B\ to \Span(Maps(B))\. It is only true if we have carefully chosen pullbacks in \Maps(B)\ in order to ensure the relationship with the chosen tabulations. \ lemma SPN_r_SPN_s_apex_eq: shows "SPN_r_SPN_s.apex = Maps.MkIde (src \\.tab)" proof - have "obj (Maps.Cod SPN_r_SPN_s.leg0)" using Maps.arr_char [of "SPN_r_SPN_s.leg0"] by simp moreover have "obj (Maps.Dom SPN_r_SPN_s.leg0)" using Maps.arr_char [of "SPN_r_SPN_s.leg0"] by simp moreover have "SPN_r_SPN_s.leg0 \ Maps.Null" using Maps.arr_char [of "SPN_r_SPN_s.leg0"] by simp moreover have "Maps.Dom SPN_r_SPN_s.leg0 = src \\.tab" proof - interpret REP_S\<^sub>1: map_in_bicategory V H \ \ src trg \Maps.REP S\<^sub>1\ using Maps.REP_in_Map Maps.arr_char Maps.in_HomD S\<^sub>1_def apply unfold_locales by (meson Maps.REP_in_hhom(2) S\<^sub>1_in_hom) interpret REP_R\<^sub>0: map_in_bicategory V H \ \ src trg \Maps.REP R\<^sub>0\ using Maps.REP_in_Map Maps.arr_char Maps.in_HomD R\<^sub>0_def apply unfold_locales by (meson Maps.REP_in_hhom(2) R\<^sub>0_in_hom) have "Maps.Dom SPN_r_SPN_s.leg0 = Maps.Dom (S\<^sub>0 \ Maps.PRJ\<^sub>0 R\<^sub>0 S\<^sub>1)" using composable Span.hcomp_def S\<^sub>0_def R\<^sub>0_def S\<^sub>1_def by simp also have "... = Maps.Dom \\tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1)\\" proof - have "is_left_adjoint (tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1))" proof - have "ide ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1)" proof - have "src (Maps.REP R\<^sub>0)\<^sup>* = trg (Maps.REP S\<^sub>1)" using REP_R\<^sub>0.is_map REP_S\<^sub>1.is_map left_adjoint_is_ide R\<^sub>0_def S\<^sub>1_def by (metis (no_types, lifting) Maps.REP_CLS REP_R\<^sub>0.antipar(2) isomorphic_implies_hpar(4) composable r.leg0_simps(3) r.satisfies_T0 s.leg1_is_map s.leg1_simps(3) s.leg1_simps(4)) thus ?thesis by simp qed thus ?thesis by simp qed moreover have "Maps.Dom (S\<^sub>0 \ \\tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1)\\) = src (tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1))" proof - have "Maps.arr (\\prj\<^sub>0 (Maps.REP S\<^sub>1) (Maps.REP R\<^sub>0)\\)" using Maps.CLS_in_hom Maps.prj0_simps(1) Maps.PRJ\<^sub>0_def composable by fastforce moreover have "Maps.Dom S\<^sub>0 = Maps.Cod \\prj\<^sub>0 (Maps.REP S\<^sub>1) (Maps.REP R\<^sub>0)\\" proof - have "Maps.Cod \\prj\<^sub>0 (Maps.REP S\<^sub>1) (Maps.REP R\<^sub>0)\\ = trg (prj\<^sub>0 (Maps.REP S\<^sub>1) (Maps.REP R\<^sub>0))" by simp also have "... = src (Maps.REP S\<^sub>1)" proof - have "ide (Maps.REP S\<^sub>1)" by simp moreover have "is_left_adjoint (Maps.REP R\<^sub>0)" by auto moreover have "trg (Maps.REP S\<^sub>1) = trg (Maps.REP R\<^sub>0)" by (simp add: composable) ultimately show ?thesis using S\<^sub>1_def Maps.REP_CLS r.leg0_is_map s.leg1_is_map by simp qed also have "... = src (tab\<^sub>0 s)" using tab\<^sub>0_in_hom(1) by simp also have "... = Maps.Dom S\<^sub>0" using S\<^sub>0_def by simp finally show ?thesis by simp qed ultimately have "Maps.Dom (S\<^sub>0 \ \\tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1)\\) = Maps.Dom \\tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1)\\" using Maps.CLS_in_hom by simp thus ?thesis by simp qed ultimately show ?thesis using Maps.PRJ\<^sub>0_def composable Maps.Dom.simps(1) RS_simps(1) RS_simps(16) RS_simps(18) RS_simps(3) by presburger qed also have "... = src (tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1))" by simp finally have "Maps.Dom SPN_r_SPN_s.leg0 = src (tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1))" by simp also have "... = src (tab\<^sub>0 (r.s\<^sub>0\<^sup>* \ s.s\<^sub>1))" proof - interpret r\<^sub>0's\<^sub>1: identity_in_bicategory_of_spans V H \ \ src trg \r.s\<^sub>0\<^sup>* \ s.s\<^sub>1\ using composable by (unfold_locales, simp) have "(Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1 \ r.s\<^sub>0\<^sup>* \ s.s\<^sub>1" proof - have "(Maps.REP R\<^sub>0)\<^sup>* \ r.s\<^sub>0\<^sup>*" proof - have 1: "adjoint_pair (Maps.REP R\<^sub>0) (Maps.REP R\<^sub>0)\<^sup>*" using REP_R\<^sub>0.is_map left_adjoint_extends_to_adjoint_pair by blast moreover have "adjoint_pair r.s\<^sub>0 (Maps.REP R\<^sub>0)\<^sup>*" proof - have "Maps.REP R\<^sub>0 \ r.s\<^sub>0" unfolding R\<^sub>0_def using Maps.REP_CLS r.leg0_is_map composable by force thus ?thesis using 1 adjoint_pair_preserved_by_iso isomorphic_def REP_R\<^sub>0.triangle_in_hom(4) REP_R\<^sub>0.triangle_right' by auto qed ultimately show ?thesis using r.leg0_is_map left_adjoint_determines_right_up_to_iso left_adjoint_extends_to_adjoint_pair by auto qed moreover have "Maps.REP S\<^sub>1 \ s.s\<^sub>1" unfolding S\<^sub>1_def using Maps.REP_CLS s.leg1_is_map composable by force moreover have "\a. a \ (tab\<^sub>0 r)\<^sup>* \ tab\<^sub>1 s \ (Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1 \ a" using calculation composable isomorphic_implies_hpar(3) hcomp_ide_isomorphic hcomp_isomorphic_ide [of "(Maps.REP R\<^sub>0)\<^sup>*" "r.s\<^sub>0\<^sup>*" s.s\<^sub>1] by auto ultimately show ?thesis using isomorphic_transitive by blast qed thus ?thesis using r\<^sub>0's\<^sub>1.isomorphic_implies_same_tab isomorphic_symmetric by metis qed also have "... = src \\.tab" using VV.ide_char VV.arr_char composable Span.hcomp_def \\.tab_simps(2) by auto finally show ?thesis by simp qed ultimately show ?thesis using composable Maps.arr_char Maps.dom_char SPN_r_SPN_s.dom.apex_def apply auto by (metis (no_types, lifting) Maps.not_arr_null SPN_r_SPN_s.chine_eq_apex SPN_r_SPN_s.chine_simps(1)) qed text \ We will be taking the arrow @{term "CLS cmp"} of \Maps\ as the composition isomorphism from @{term "SPN r \ SPN s"} to @{term "SPN (r \ s)"}. The following result shows that it has the right domain and codomain for that purpose. \ lemma iso_class_cmp_in_hom: shows "Maps.in_hom (Maps.MkArr (src \\.tab) (src tab) \cmp\) SPN_r_SPN_s.apex SPN_rs.apex" and "Maps.in_hom \\cmp\\ SPN_r_SPN_s.apex SPN_rs.apex" proof - show "Maps.in_hom (Maps.MkArr (src \\.tab) (src tab) \cmp\) SPN_r_SPN_s.apex SPN_rs.apex" proof - have "obj (src \\.tab)" using obj_src \\.tab_in_hom by blast moreover have "obj (src tab)" using obj_src by simp moreover have "\cmp\ \ Maps.Hom (src \\.tab) (src tab)" by (metis (mono_tags, lifting) cmp.is_map cmp_def cmp_props(1) mem_Collect_eq) moreover have "SPN_r_SPN_s.apex = Maps.MkIde (src \\.tab)" using SPN_r_SPN_s_apex_eq by simp moreover have "SPN_rs.apex = Maps.MkIde (src tab)" using SPN_def composable SPN_rs.cod.apex_def Maps.arr_char Maps.dom_char SPN_rs.dom.leg_simps(1) by fastforce ultimately show ?thesis using Maps.MkArr_in_hom by simp qed thus "Maps.in_hom \\cmp\\ SPN_r_SPN_s.apex SPN_rs.apex" by simp qed interpretation r\<^sub>0's\<^sub>1: two_composable_identities_in_bicategory_of_spans V H \ \ src trg \(Maps.REP R\<^sub>0)\<^sup>*\ \Maps.REP S\<^sub>1\ proof show "ide (Maps.REP S\<^sub>1)" using Maps.REP_in_Map Maps.arr_char left_adjoint_is_ide by (meson Maps.REP_in_hhom(2) S\<^sub>1_in_hom) show "ide (Maps.REP R\<^sub>0)\<^sup>*" using Maps.REP_in_Map Maps.arr_char left_adjoint_is_ide Maps.REP_in_hhom(2) R\<^sub>0_in_hom by auto show "src (Maps.REP R\<^sub>0)\<^sup>* = trg (Maps.REP S\<^sub>1)" using Maps.REP_in_hhom(2) R\<^sub>0_in_hom composable by auto qed interpretation R\<^sub>0'S\<^sub>1: identity_in_bicategory_of_spans V H \ \ src trg \(tab\<^sub>0 r)\<^sup>* \ tab\<^sub>1 s\ by (unfold_locales, simp add: composable) lemma prj_tab_agreement: shows "(tab\<^sub>0 r)\<^sup>* \ tab\<^sub>1 s \ (Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1" and "\\.p\<^sub>0 \ prj\<^sub>0 (Maps.REP S\<^sub>1) (Maps.REP R\<^sub>0)" and "\\.p\<^sub>1 \ prj\<^sub>1 (Maps.REP S\<^sub>1) (Maps.REP R\<^sub>0)" proof - show 1: "(tab\<^sub>0 r)\<^sup>* \ tab\<^sub>1 s \ (Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1" proof - have "(tab\<^sub>0 r)\<^sup>* \ (Maps.REP R\<^sub>0)\<^sup>*" using Maps.REP_CLS isomorphic_symmetric R\<^sub>0_def composable r.satisfies_T0 isomorphic_to_left_adjoint_implies_isomorphic_right_adjoint by fastforce moreover have "tab\<^sub>1 s \ Maps.REP S\<^sub>1" by (metis Maps.REP_CLS isomorphic_symmetric S\<^sub>1_def s.leg1_is_map s.leg1_simps(3-4)) moreover have "src (Maps.REP R\<^sub>0)\<^sup>* = trg (tab\<^sub>1 s)" using composable r.T0.antipar right_adjoint_simps(2) by fastforce ultimately show ?thesis using hcomp_isomorphic_ide [of "(tab\<^sub>0 r)\<^sup>*" "(Maps.REP R\<^sub>0)\<^sup>*" "tab\<^sub>1 s"] hcomp_ide_isomorphic isomorphic_transitive composable by auto qed show "\\.p\<^sub>0 \ tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1)" using 1 R\<^sub>0'S\<^sub>1.isomorphic_implies_same_tab isomorphic_reflexive by auto show "\\.p\<^sub>1 \ tab\<^sub>1 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1)" using 1 R\<^sub>0'S\<^sub>1.isomorphic_implies_same_tab isomorphic_reflexive by auto qed lemma chine_hcomp_SPN_SPN: shows "Span.chine_hcomp (SPN r) (SPN s) = Maps.MkIde (src \\.p\<^sub>0)" proof - have "Span.chine_hcomp (SPN r) (SPN s) = Maps.MkIde (src (tab\<^sub>0 ((Maps.REP R\<^sub>0)\<^sup>* \ Maps.REP S\<^sub>1)))" using Span.chine_hcomp_ide_ide [of "SPN r" "SPN s"] composable Maps.pbdom_def Maps.PRJ\<^sub>0_def Maps.CLS_in_hom Maps.dom_char R\<^sub>0_def S\<^sub>1_def apply simp using Maps.prj0_simps(1) RS_simps(1) RS_simps(16) RS_simps(18) RS_simps(3) by presburger also have "... = Maps.MkIde (src \\.p\<^sub>0)" using prj_tab_agreement isomorphic_implies_hpar(3) by force finally show ?thesis by simp qed end text \ The development above focused on two specific composable 1-cells in bicategory \B\. Here we reformulate those results as statements about the entire bicategory. \ context bicategory_of_spans begin interpretation Maps: maps_category V H \ \ src trg .. interpretation Span: span_bicategory Maps.comp Maps.PRJ\<^sub>0 Maps.PRJ\<^sub>1 .. no_notation Fun.comp (infixl "\" 55) notation Span.vcomp (infixr "\" 55) notation Span.hcomp (infixr "\" 53) notation Maps.comp (infixr "\" 55) notation isomorphic (infix "\" 50) interpretation SPN: "functor" V Span.vcomp SPN using SPN_is_functor by simp interpretation SPN: weak_arrow_of_homs V src trg Span.vcomp Span.src Span.trg SPN using SPN_is_weak_arrow_of_homs by simp interpretation HoSPN_SPN: composite_functor VV.comp Span.VV.comp Span.vcomp SPN.FF \\\\. fst \\ \ snd \\\ .. interpretation SPNoH: composite_functor VV.comp V Span.vcomp \\\\. fst \\ \ snd \\\ SPN .. text \ Given arbitrary composable 1-cells \r\ and \s\, obtain an arrow of spans in \Maps\ having the isomorphism class of \rs.cmp\ as its chine. \ definition CMP where "CMP r s \ \Chn = \\two_composable_identities_in_bicategory_of_spans.cmp V H \ \ src trg r s\\, Dom = Dom (SPN r \ SPN s), Cod = Dom (SPN (r \ s))\" lemma compositor_in_hom [intro]: assumes "ide r" and "ide s" and "src r = trg s" shows "Span.in_hhom (CMP r s) (SPN.map\<^sub>0 (src s)) (SPN.map\<^sub>0 (trg r))" and "Span.in_hom (CMP r s) (HoSPN_SPN.map (r, s)) (SPNoH.map (r, s))" proof - have rs: "VV.ide (r, s)" using assms VV.ide_char VV.arr_char by simp interpret rs: two_composable_identities_in_bicategory_of_spans V H \ \ src trg r s using rs VV.ide_char VV.arr_char by unfold_locales auto interpret cmp: arrow_of_tabulations_in_maps V H \ \ src trg \r \ s\ rs.\\.tab \tab\<^sub>0 s \ rs.\\.p\<^sub>0\ \tab\<^sub>1 r \ rs.\\.p\<^sub>1\ \r \ s\ rs.tab \tab\<^sub>0 (r \ s)\ \tab\<^sub>1 (r \ s)\ \r \ s\ by unfold_locales auto have "rs.cmp = cmp.chine" using rs.cmp_def by simp interpret SPN_r_SPN_s: arrow_of_spans Maps.comp \SPN r \ SPN s\ using rs.composable Span.ide_char [of "SPN r \ SPN s"] by simp interpret SPN_r_SPN_s: identity_arrow_of_spans Maps.comp \SPN r \ SPN s\ using rs.composable Span.ide_char [of "SPN r \ SPN s"] by (unfold_locales, simp) interpret SPN_rs: arrow_of_spans Maps.comp \SPN (r \ s)\ using Span.arr_char rs.is_ide SPN.preserves_arr by blast interpret SPN_rs: identity_arrow_of_spans Maps.comp \SPN (r \ s)\ using Span.ide_char rs.is_ide SPN.preserves_ide by (unfold_locales, simp) interpret Dom: span_in_category Maps.comp \Dom (CMP r s)\ by (unfold_locales, simp add: CMP_def) interpret Cod: span_in_category Maps.comp \Cod (CMP r s)\ proof - (* TODO: I don't understand what makes this so difficult. *) have "\tab\<^sub>0 (r \ s) : src (tab\<^sub>0 (r \ s)) \ src s\ \ is_left_adjoint (tab\<^sub>0 (r \ s)) \ \tab\<^sub>0 (r \ s)\ = \tab\<^sub>0 (r \ s)\" by simp hence "\f. \f : src (tab\<^sub>0 (r \ s)) \ src s\ \ is_left_adjoint f \ \tab\<^sub>0 (r \ s)\ = \f\" by blast moreover have "\f. \f : src (tab\<^sub>0 (r \ s)) \ trg r\ \ is_left_adjoint f \ \tab\<^sub>1 (r \ s)\ = \f\" by (metis rs.base_simps(2) rs.leg1_in_hom(1) rs.leg1_is_map trg_hcomp) ultimately show "span_in_category Maps.comp (Cod (CMP r s))" using assms Maps.arr_char Maps.dom_char CMP_def by unfold_locales auto qed interpret r\<^sub>0's\<^sub>1: two_composable_identities_in_bicategory_of_spans V H \ \ src trg \(Maps.REP rs.R\<^sub>0)\<^sup>*\ \Maps.REP rs.S\<^sub>1\ proof show "ide (Maps.REP rs.S\<^sub>1)" using Maps.REP_in_Map Maps.arr_char left_adjoint_is_ide by (meson Maps.REP_in_hhom(2) rs.S\<^sub>1_in_hom) show "ide (Maps.REP rs.R\<^sub>0)\<^sup>*" using Maps.REP_in_Map Maps.arr_char left_adjoint_is_ide Maps.REP_in_hhom(2) rs.R\<^sub>0_in_hom by auto show "src (Maps.REP rs.R\<^sub>0)\<^sup>* = trg (Maps.REP rs.S\<^sub>1)" using Maps.REP_in_hhom(2) rs.R\<^sub>0_in_hom rs.composable by auto qed interpret R\<^sub>0'S\<^sub>1: identity_in_bicategory_of_spans V H \ \ src trg \(tab\<^sub>0 r)\<^sup>* \ tab\<^sub>1 s\ by (unfold_locales, simp add: rs.composable) text \ Here we obtain explicit formulas for the legs and apex of \SPN_r_SPN_s\ and \SPN_rs\. \ have SPN_r_SPN_s_leg0_eq: "SPN_r_SPN_s.leg0 = Maps.comp rs.S\<^sub>0 (Maps.PRJ\<^sub>0 rs.R\<^sub>0 rs.S\<^sub>1)" using rs.composable Span.hcomp_def rs.S\<^sub>0_def rs.R\<^sub>0_def rs.S\<^sub>1_def by simp have SPN_r_SPN_s_leg1_eq: "SPN_r_SPN_s.leg1 = Maps.comp rs.R\<^sub>1 (Maps.PRJ\<^sub>1 rs.R\<^sub>0 rs.S\<^sub>1)" using rs.composable Span.hcomp_def rs.R\<^sub>1_def rs.R\<^sub>0_def rs.S\<^sub>1_def by simp have "SPN_r_SPN_s.apex = Maps.MkIde (src rs.\\.tab)" using rs.SPN_r_SPN_s_apex_eq by auto have SPN_rs_leg0_eq: "SPN_rs.leg0 = \\tab\<^sub>0 (r \ s)\\" unfolding SPN_def using rs by simp have SPN_rs_leg1_eq: "SPN_rs.leg1 = \\tab\<^sub>1 (r \ s)\\" unfolding SPN_def using rs by simp have "SPN_rs.apex = Maps.MkIde (src (tab_of_ide (r \ s)))" using SPN_rs.dom.apex_def Maps.dom_char SPN_rs_leg0_eq SPN_rs.dom.leg_simps(1) by simp text \ The composition isomorphism @{term "CMP r s"} is an arrow of spans in \Maps(B)\. \ interpret arrow_of_spans Maps.comp \CMP r s\ proof show 1: "Maps.in_hom (Chn (CMP r s)) Dom.apex Cod.apex" using rs.iso_class_cmp_in_hom rs.composable CMP_def by simp show "Cod.leg0 \ Chn (CMP r s) = Dom.leg0" proof (intro Maps.arr_eqI) show 2: "Maps.seq Cod.leg0 (Chn (CMP r s))" using 1 Maps.dom_char Maps.cod_char by blast show 3: "Maps.arr Dom.leg0" by simp show "Maps.Dom (Cod.leg0 \ Chn (CMP r s)) = Maps.Dom Dom.leg0" using 1 2 Maps.dom_char Maps.cod_char Maps.comp_char Dom.leg_in_hom Maps.in_hom_char Maps.seq_char by auto show "Maps.Cod (Cod.leg0 \ Chn (CMP r s)) = Maps.Cod Dom.leg0" using 2 3 Maps.comp_char [of Cod.leg0 "Chn (CMP r s)"] Dom.leg_simps Dom.apex_def Maps.dom_char SPN_r_SPN_s_leg0_eq Maps.comp_char [of rs.S\<^sub>0 "Maps.PRJ\<^sub>0 rs.R\<^sub>0 rs.S\<^sub>1"] CMP_def by simp show "Maps.Map (Cod.leg0 \ Chn (CMP r s)) = Maps.Map Dom.leg0" proof - have "Maps.Map (Cod.leg0 \ Chn (CMP r s)) = Maps.Comp \tab\<^sub>0 (r \ s)\ \rs.cmp\" using 1 2 Maps.dom_char Maps.cod_char Maps.comp_char [of Cod.leg0 "Chn (CMP r s)"] CMP_def by simp also have "... = Maps.Comp \tab\<^sub>0 s\ \rs.\\.p\<^sub>0\" proof - have "Maps.Comp \tab\<^sub>0 (r \ s)\ \rs.cmp\ = \tab\<^sub>0 (r \ s) \ rs.cmp\" using Maps.Comp_eq_iso_class_memb Maps.CLS_hcomp cmp.is_map rs.cmp_def by auto also have "... = Maps.Comp \tab\<^sub>0 s\ \rs.\\.p\<^sub>0\" using Maps.Comp_eq_iso_class_memb Maps.CLS_hcomp iso_class_eqI rs.cmp_props(4) by auto finally show ?thesis by simp qed also have "... = Maps.Map Dom.leg0" proof - have "Maps.seq rs.S\<^sub>0 (Maps.PRJ\<^sub>0 rs.R\<^sub>0 rs.S\<^sub>1)" by (intro Maps.seqI, simp_all add: rs.composable) moreover have "\prj\<^sub>0 (Maps.REP rs.S\<^sub>1) (Maps.REP rs.R\<^sub>0)\ = \rs.\\.p\<^sub>0\" using "rs.prj_tab_agreement" iso_class_eqI by auto moreover have "Maps.Dom (Maps.PRJ\<^sub>0 rs.R\<^sub>0 rs.S\<^sub>1) = src rs.\\.p\<^sub>0" using rs.prj_tab_agreement Maps.PRJ\<^sub>0_def rs.composable isomorphic_implies_hpar(3) by auto ultimately show ?thesis using SPN_r_SPN_s_leg0_eq Maps.comp_char [of rs.S\<^sub>0 "Maps.PRJ\<^sub>0 rs.R\<^sub>0 rs.S\<^sub>1"] rs.S\<^sub>0_def Maps.PRJ\<^sub>0_def rs.composable CMP_def by simp qed finally show ?thesis by simp qed qed show "Cod.leg1 \ Chn (CMP r s) = Dom.leg1" proof (intro Maps.arr_eqI) show 2: "Maps.seq Cod.leg1 (Chn (CMP r s))" using 1 Maps.dom_char Maps.cod_char by blast show 3: "Maps.arr Dom.leg1" by simp show "Maps.Dom (Cod.leg1 \ Chn (CMP r s)) = Maps.Dom Dom.leg1" using 1 2 Maps.dom_char Maps.cod_char Maps.comp_char Dom.leg_in_hom Maps.in_hom_char Maps.seq_char by auto show "Maps.Cod (Cod.leg1 \ Chn (CMP r s)) = Maps.Cod Dom.leg1" using 2 3 Maps.comp_char [of Cod.leg1 "Chn (CMP r s)"] Dom.apex_def Maps.dom_char SPN_r_SPN_s_leg1_eq Maps.comp_char [of rs.R\<^sub>1 "Maps.PRJ\<^sub>1 rs.R\<^sub>0 rs.S\<^sub>1"] CMP_def by simp show "Maps.Map (Cod.leg1 \ Chn (CMP r s)) = Maps.Map Dom.leg1" proof - have "Maps.Map (Cod.leg1 \ Chn (CMP r s)) = Maps.Comp \tab\<^sub>1 (r \ s)\ \rs.cmp\" using 1 2 Maps.dom_char Maps.cod_char Maps.comp_char [of Cod.leg1 "Chn (CMP r s)"] CMP_def by simp also have "... = Maps.Comp \tab\<^sub>1 r\ \rs.\\.p\<^sub>1\" proof - have "Maps.Comp \tab\<^sub>1 (r \ s)\ \rs.cmp\ = \tab\<^sub>1 (r \ s) \ rs.cmp\" using Maps.Comp_eq_iso_class_memb Maps.CLS_hcomp cmp.is_map rs.cmp_def by auto also have "... = Maps.Comp \tab\<^sub>1 r\ \rs.\\.p\<^sub>1\" using Maps.Comp_eq_iso_class_memb Maps.CLS_hcomp [of "tab\<^sub>1 r" rs.\\.p\<^sub>1] iso_class_eqI rs.cmp_props(5) by auto finally show ?thesis by simp qed also have "... = Maps.Map Dom.leg1" proof - have "Maps.seq rs.R\<^sub>1 (Maps.PRJ\<^sub>1 rs.R\<^sub>0 rs.S\<^sub>1)" by (intro Maps.seqI, simp_all add: rs.composable) moreover have "\prj\<^sub>1 (Maps.REP rs.S\<^sub>1) (Maps.REP rs.R\<^sub>0)\ = \rs.\\.p\<^sub>1\" using rs.prj_tab_agreement iso_class_eqI by auto moreover have "Maps.Dom (Maps.PRJ\<^sub>1 rs.R\<^sub>0 rs.S\<^sub>1) = src rs.\\.p\<^sub>1" using rs.prj_tab_agreement Maps.PRJ\<^sub>1_def rs.composable isomorphic_implies_hpar(3) by auto ultimately show ?thesis using SPN_r_SPN_s_leg1_eq Maps.comp_char [of rs.R\<^sub>1 "Maps.PRJ\<^sub>1 rs.R\<^sub>0 rs.S\<^sub>1"] rs.R\<^sub>1_def Maps.PRJ\<^sub>1_def rs.composable CMP_def by simp qed finally show ?thesis by simp (* * Very simple, right? Yeah, once you sort through the notational morass and * figure out what equals what. *) qed qed qed show "Span.in_hom (CMP r s) (HoSPN_SPN.map (r, s)) (SPNoH.map (r, s))" using Span.arr_char arrow_of_spans_axioms Span.dom_char Span.cod_char CMP_def SPN.FF_def VV.arr_char rs.composable by auto thus "Span.in_hhom (CMP r s) (SPN.map\<^sub>0 (src s)) (SPN.map\<^sub>0 (trg r))" using assms VV.ide_char VV.arr_char VV.in_hom_char SPN.FF_def apply (intro Span.in_hhomI) apply auto using Span.src_dom [of "CMP r s"] Span.trg_dom [of "CMP r s"] apply (elim Span.in_homE) apply auto using Span.src_dom [of "CMP r s"] Span.trg_dom [of "CMP r s"] apply (elim Span.in_homE) by auto qed lemma compositor_simps [simp]: assumes "ide r" and "ide s" and "src r = trg s" shows "Span.arr (CMP r s)" and "Span.src (CMP r s) = SPN.map\<^sub>0 (src s)" and "Span.trg (CMP r s) = SPN.map\<^sub>0 (trg r)" and "Span.dom (CMP r s) = HoSPN_SPN.map (r, s)" and "Span.cod (CMP r s) = SPNoH.map (r, s)" using assms compositor_in_hom [of r s] by auto lemma compositor_is_iso: assumes "ide r" and "ide s" and "src r = trg s" shows "Span.iso (CMP r s)" proof - interpret rs: two_composable_identities_in_bicategory_of_spans V H \ \ src trg r s using assms by unfold_locales auto have "Span.arr (CMP r s)" using assms compositor_in_hom by blast moreover have "Maps.iso \\rs.cmp\\" using assms Maps.iso_char' by (metis (mono_tags, lifting) Maps.CLS_in_hom Maps.Map.simps(1) Maps.in_homE equivalence_is_left_adjoint ide_in_iso_class rs.cmp_props(3) rs.cmp_simps(2)) ultimately show ?thesis unfolding CMP_def using assms Span.iso_char by simp qed interpretation \: transformation_by_components VV.comp Span.vcomp HoSPN_SPN.map SPNoH.map \\rs. CMP (fst rs) (snd rs)\ proof fix rs assume rs: "VV.ide rs" let ?r = "fst rs" let ?s = "snd rs" show "Span.in_hom (CMP ?r ?s) (HoSPN_SPN.map rs) (SPNoH.map rs)" using rs compositor_in_hom [of ?r ?s] VV.ide_char VV.arr_char by simp next fix \\ assume \\: "VV.arr \\" let ?\ = "fst \\" let ?\ = "snd \\" show "CMP (fst (VV.cod \\)) (snd (VV.cod \\)) \ HoSPN_SPN.map \\ = SPNoH.map \\ \ CMP (fst (VV.dom \\)) (snd (VV.dom \\))" proof - let ?LHS = "CMP (fst (VV.cod \\)) (snd (VV.cod \\)) \ HoSPN_SPN.map \\" let ?RHS = "SPNoH.map \\ \ CMP (fst (VV.dom \\)) (snd (VV.dom \\))" have LHS: "Span.in_hom ?LHS (HoSPN_SPN.map (VV.dom \\)) (SPNoH.map (VV.cod \\))" proof show "Span.in_hom (HoSPN_SPN.map \\) (HoSPN_SPN.map (VV.dom \\)) (HoSPN_SPN.map (VV.cod \\))" using \\ by blast show "Span.in_hom (CMP (fst (VV.cod \\)) (snd (VV.cod \\))) (HoSPN_SPN.map (VV.cod \\)) (SPNoH.map (VV.cod \\))" using \\ VV.cod_simp by (auto simp add: VV.arr_char) qed have RHS: "Span.in_hom ?RHS (HoSPN_SPN.map (VV.dom \\)) (SPNoH.map (VV.cod \\))" using \\ VV.dom_simp VV.cod_simp by (auto simp add: VV.arr_char) show "?LHS = ?RHS" proof (intro Span.arr_eqI) show "Span.par ?LHS ?RHS" apply (intro conjI) using LHS RHS apply auto[2] proof - show "Span.dom ?LHS = Span.dom ?RHS" proof - have "Span.dom ?LHS = HoSPN_SPN.map (VV.dom \\)" using LHS by auto also have "... = Span.dom ?RHS" using RHS by auto finally show ?thesis by simp qed show "Span.cod ?LHS = Span.cod ?RHS" proof - have "Span.cod ?LHS = SPNoH.map (VV.cod \\)" using LHS by auto also have "... = Span.cod ?RHS" using RHS by auto finally show ?thesis by simp qed qed show "Chn ?LHS = Chn ?RHS" proof - interpret dom_\_\: two_composable_identities_in_bicategory_of_spans V H \ \ src trg \dom ?\\ \dom ?\\ using \\ VV.ide_char VV.arr_char by unfold_locales auto interpret cod_\_\: two_composable_identities_in_bicategory_of_spans V H \ \ src trg \cod ?\\ \cod ?\\ using \\ VV.ide_char VV.arr_char by unfold_locales auto interpret \_\: horizontal_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \dom ?\\ \tab_of_ide (dom ?\)\ \tab\<^sub>0 (dom ?\)\ \tab\<^sub>1 (dom ?\)\ \dom ?\\ \tab_of_ide (dom ?\)\ \tab\<^sub>0 (dom ?\)\ \tab\<^sub>1 (dom ?\)\ \cod ?\\ \tab_of_ide (cod ?\)\ \tab\<^sub>0 (cod ?\)\ \tab\<^sub>1 (cod ?\)\ \cod ?\\ \tab_of_ide (cod ?\)\ \tab\<^sub>0 (cod ?\)\ \tab\<^sub>1 (cod ?\)\ ?\ ?\ using \\ VV.arr_char by unfold_locales auto let ?\\ = "?\ \ ?\" interpret dom_\\: identity_in_bicategory_of_spans V H \ \ src trg \dom ?\\\ using \\ by (unfold_locales, simp) interpret cod_\\: identity_in_bicategory_of_spans V H \ \ src trg \cod ?\\\ using \\ by (unfold_locales, simp) interpret \\: arrow_of_tabulations_in_maps V H \ \ src trg \dom ?\\\ \tab_of_ide (dom ?\\)\ \tab\<^sub>0 (dom ?\\)\ \tab\<^sub>1 (dom ?\\)\ \cod ?\\\ \tab_of_ide (cod ?\\)\ \tab\<^sub>0 (cod ?\\)\ \tab\<^sub>1 (cod ?\\)\ ?\\ using \\ by unfold_locales auto have Chn_LHS_eq: "Chn ?LHS = \\cod_\_\.cmp\\ \ Span.chine_hcomp (SPN (fst \\)) (SPN (snd \\))" proof - have "Chn ?LHS = Chn (CMP (fst (VV.cod \\)) (snd (VV.cod \\))) \ Chn (HoSPN_SPN.map \\)" using \\ LHS Span.Chn_vcomp by blast also have "... = \\cod_\_\.cmp\\ \ Chn (HoSPN_SPN.map \\)" using \\ VV.arr_char VV.cod_char CMP_def by simp also have "... = \\cod_\_\.cmp\\ \ Span.chine_hcomp (SPN (fst \\)) (SPN (snd \\))" using \\ VV.arr_char SPN.FF_def Span.hcomp_def by simp finally show ?thesis by blast qed have Chn_RHS_eq: "Chn ?RHS = Maps.MkArr (src (tab\<^sub>0 (dom ?\ \ dom ?\))) (src (tab\<^sub>0 (cod ?\ \ cod ?\))) \\\.chine\ \ Maps.MkArr (src dom_\_\.\\.p\<^sub>0) (src (tab_of_ide (dom ?\ \ dom ?\))) \dom_\_\.cmp\" proof - have "Chn ?RHS = Chn (SPN (?\ \ ?\)) \ Maps.MkArr (src dom_\_\.\\.p\<^sub>0) (src (tab_of_ide (dom ?\ \ dom ?\))) \dom_\_\.cmp\" using \\ RHS Span.vcomp_def VV.arr_char CMP_def Span.arr_char Span.not_arr_Null VV.dom_simp by auto moreover have "Chn (SPN (?\ \ ?\)) = Maps.MkArr (src (tab\<^sub>0 (dom ?\ \ dom ?\))) (src (tab\<^sub>0 (cod ?\ \ cod ?\))) \\\.chine\" proof - have "Chn (SPN (?\ \ ?\)) = Maps.MkArr (src (tab\<^sub>0 (dom ?\ \ dom ?\))) (src (tab\<^sub>0 (cod ?\ \ cod ?\))) \spn ?\\\" using \\ SPN_def by simp also have "... = Maps.MkArr (src (tab\<^sub>0 (dom ?\ \ dom ?\))) (src (tab\<^sub>0 (cod ?\ \ cod ?\))) \\\.chine\" using spn_def by simp finally show ?thesis by simp qed ultimately show ?thesis by simp qed let ?Chn_LHS = "Maps.MkArr (src cod_\_\.\\.p\<^sub>0) (src (tab_of_ide (cod ?\ \ cod ?\))) \cod_\_\.cmp\ \ Span.chine_hcomp (SPN ?\) (SPN ?\)" let ?Chn_RHS = "Maps.MkArr (src (tab\<^sub>0 (dom ?\ \ dom ?\))) (src (tab\<^sub>0 (cod ?\ \ cod ?\))) \\\.chine\ \ Maps.MkArr (src dom_\_\.\\.p\<^sub>0) (src (tab_of_ide (dom ?\ \ dom ?\))) \dom_\_\.cmp\" have "?Chn_LHS = ?Chn_RHS" proof (intro Maps.arr_eqI) interpret LHS: arrow_of_spans Maps.comp ?LHS using LHS Span.arr_char by auto interpret RHS: arrow_of_spans Maps.comp ?RHS using RHS Span.arr_char by auto show 1: "Maps.arr ?Chn_LHS" using LHS.chine_in_hom Chn_LHS_eq by auto show 2: "Maps.arr ?Chn_RHS" using RHS.chine_in_hom Chn_RHS_eq by auto text \ Here is where we use \dom_\_\.chine_hcomp_SPN_SPN\, which depends on our having chosen the ``right'' pullbacks for \Maps(B)\. The map \Chn_LHS\ has as its domain the apex of the horizontal composite of the components of @{term "VV.dom \\"}, whereas \Chn_RHS\ has as its domain the apex of the chosen tabulation of \r\<^sub>0\<^sup>* \ s\<^sub>1\. We need these to be equal in order for \Chn_LHS\ and \Chn_RHS\ to be equal. \ show "Maps.Dom ?Chn_LHS = Maps.Dom ?Chn_RHS" proof - have "Maps.Dom ?Chn_LHS = Maps.Dom (Maps.dom ?Chn_LHS)" using \\ 1 Maps.Dom_dom by presburger also have "... = Maps.Dom (Span.chine_hcomp (SPN (dom ?\)) (SPN (dom ?\)))" proof - have "... = Maps.Dom (Maps.dom (Span.chine_hcomp (SPN ?\) (SPN ?\)))" using 1 Maps.seq_char Maps.Dom_comp by auto also have "... = Maps.Dom (Maps.pbdom (Leg0 (Dom (SPN ?\))) (Leg1 (Dom (SPN ?\))))" using \\ VV.arr_char Span.chine_hcomp_in_hom [of "SPN ?\" "SPN ?\"] by auto also have "... = Maps.Dom (Maps.dom (Maps.pbdom (Leg0 (Dom (SPN ?\))) (Leg1 (Dom (SPN ?\)))))" proof - have "Maps.cospan (Leg0 (Dom (SPN (fst \\)))) (Leg1 (Dom (SPN (snd \\))))" using \\ VV.arr_char SPN_in_hom Span.arr_char Span.dom_char SPN_def Maps.CLS_in_hom Maps.arr_char Maps.cod_char dom_\_\.composable dom_\_\.RS_simps(16) dom_\_\.S\<^sub>1_def dom_\_\.RS_simps(1) dom_\_\.R\<^sub>0_def Maps.pbdom_in_hom by simp thus ?thesis using \\ VV.arr_char Maps.pbdom_in_hom by simp qed also have "... = Maps.Dom (Maps.dom (Maps.pbdom (Leg0 (Dom (SPN (dom ?\)))) (Leg1 (Dom (SPN (dom ?\))))))" using \\ SPN_def VV.arr_char by simp also have "... = Maps.Dom (Maps.dom (Span.chine_hcomp (SPN (dom ?\)) (SPN (dom ?\))))" using \\ VV.arr_char ide_dom by (simp add: Span.chine_hcomp_ide_ide) also have "... = Maps.Dom (Span.chine_hcomp (SPN (dom ?\)) (SPN (dom ?\)))" using Maps.Dom_dom Maps.in_homE SPN.preserves_reflects_arr SPN.preserves_src SPN.preserves_trg Span.chine_hcomp_in_hom dom_\_\.composable dom_\_\.r.base_simps(2) dom_\_\.s.base_simps(2) by (metis (no_types, lifting)) finally show ?thesis by simp qed also have "... = src dom_\_\.\\.p\<^sub>0" using "dom_\_\.chine_hcomp_SPN_SPN" by simp also have "... = Maps.Dom ?Chn_RHS" using 2 Maps.seq_char Maps.Dom_comp by auto finally show ?thesis by simp qed show "Maps.Cod ?Chn_LHS = Maps.Cod ?Chn_RHS" proof - have "Maps.Cod ?Chn_LHS = src (tab_of_ide (cod ?\ \ cod ?\))" using \\ 1 VV.arr_char Maps.seq_char by auto also have "... = src (tab\<^sub>0 (cod ?\ \ cod ?\))" using \\ VV.arr_char cod_\\.tab_simps(2) by auto also have "... = Maps.Cod ?Chn_RHS" by (metis (no_types, lifting) "2" Maps.Cod.simps(1) Maps.Cod_comp Maps.seq_char) finally show ?thesis by simp qed show "Maps.Map ?Chn_LHS = Maps.Map ?Chn_RHS" proof - have RHS: "Maps.Map ?Chn_RHS = iso_class (\\.chine \ dom_\_\.cmp)" proof - have "Maps.Map ?Chn_RHS = Maps.Comp \\\.chine\ \dom_\_\.cmp\" using \\ 2 VV.arr_char Maps.Map_comp Maps.comp_char [of "Maps.MkArr (src (tab\<^sub>0 (dom ?\ \ dom ?\))) (src (tab\<^sub>0 (cod ?\ \ cod ?\))) \\\.chine\" "Maps.MkArr (src dom_\_\.\\.p\<^sub>0) (src (tab_of_ide (dom ?\ \ dom ?\))) \dom_\_\.cmp\"] by simp also have "... = \\\.chine \ dom_\_\.cmp\" proof - have "\dom_\_\.cmp\ \ Maps.Hom (src dom_\_\.\\.p\<^sub>0) (src (tab\<^sub>0 (dom ?\ \ dom ?\)))" proof - have "\dom_\_\.cmp\ \ Maps.Hom (src dom_\_\.\\.tab) (src (tab_of_ide (dom ?\ \ dom ?\)))" using \\ VV.arr_char dom_\_\.cmp_props(1-3) by (metis (mono_tags, lifting) equivalence_is_left_adjoint mem_Collect_eq) thus ?thesis using \\ VV.arr_char dom_\\.tab_simps(2) by simp qed moreover have "\\\.chine\ \ Maps.Hom (src (tab\<^sub>0 (dom ?\ \ dom ?\))) (src (tab\<^sub>0 (cod ?\ \ cod ?\)))" using \\ VV.arr_char \\.chine_in_hom \\.is_map by auto moreover have "\\.chine \ dom_\_\.cmp \ Maps.Comp \\\.chine\ \dom_\_\.cmp\" proof show "is_iso_class \dom_\_\.cmp\" using is_iso_classI by simp show "is_iso_class \\\.chine\" using is_iso_classI by simp show "dom_\_\.cmp \ \dom_\_\.cmp\" using ide_in_iso_class [of dom_\_\.cmp] by simp show "\\.chine \ \\\.chine\" using ide_in_iso_class by simp show "\\.chine \ dom_\_\.cmp \ \\.chine \ dom_\_\.cmp" using \\ VV.arr_char \\.chine_simps dom_\_\.cmp_simps dom_\\.tab_simps(2) isomorphic_reflexive by auto qed ultimately show ?thesis using \\ dom_\_\.cmp_props \\.chine_in_hom \\.chine_is_induced_map Maps.Comp_eq_iso_class_memb by blast qed finally show ?thesis by simp qed have LHS: "Maps.Map ?Chn_LHS = \cod_\_\.cmp \ \_\.chine\" proof - have "Maps.Map ?Chn_LHS = Maps.Comp \cod_\_\.cmp\ (Maps.Map (Maps.tuple (Maps.CLS (spn ?\ \ dom_\_\.\\.p\<^sub>1)) (Maps.CLS (tab\<^sub>0 (cod ?\))) (Maps.CLS (tab\<^sub>1 (cod ?\))) (Maps.CLS (spn ?\ \ dom_\_\.\\.p\<^sub>0))))" proof - have "Maps.Map ?Chn_LHS = Maps.Comp \cod_\_\.cmp\ (Maps.Map (Span.chine_hcomp (SPN ?\) (SPN ?\)))" using \\ 1 VV.arr_char Maps.Map_comp cod_\\.tab_simps(2) Maps.comp_char [of "Maps.MkArr (src cod_\_\.\\.p\<^sub>0) (src (tab_of_ide (cod ?\ \ cod ?\))) \cod_\_\.cmp\" "Span.chine_hcomp (SPN ?\) (SPN ?\)"] by simp moreover have "Span.chine_hcomp (SPN ?\) (SPN ?\) = Maps.tuple (Maps.CLS (spn ?\ \ dom_\_\.\\.p\<^sub>1)) (Maps.CLS (tab\<^sub>0 (cod ?\))) (Maps.CLS (tab\<^sub>1 (cod ?\))) (Maps.CLS (spn ?\ \ dom_\_\.\\.p\<^sub>0))" proof - have "Maps.PRJ\<^sub>0 (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>0 (dom ?\)\) (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>1 (dom ?\)\) = \\dom_\_\.\\.p\<^sub>0\\ \ Maps.PRJ\<^sub>1 (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>0 (dom ?\)\) (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>1 (dom ?\)\) = \\dom_\_\.\\.p\<^sub>1\\" proof - interpret X: identity_in_bicategory_of_spans V H \ \ src trg \(tab\<^sub>0 (dom ?\))\<^sup>* \ tab\<^sub>1 (dom ?\)\ using \\ VV.arr_char by (unfold_locales, simp) have "Maps.PRJ\<^sub>0 (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>0 (dom ?\)\) (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>1 (dom ?\)\) = \\tab\<^sub>0 ((Maps.REP (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg (snd \\)) \tab\<^sub>0 (dom ?\)\))\<^sup>* \ Maps.REP (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>1 (dom ?\)\))\\" unfolding Maps.PRJ\<^sub>0_def using \\ VV.arr_char dom_\_\.RS_simps(1) dom_\_\.RS_simps(16) dom_\_\.RS_simps(18) dom_\_\.RS_simps(3) dom_\_\.R\<^sub>0_def dom_\_\.S\<^sub>1_def by auto moreover have "Maps.PRJ\<^sub>1 (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>0 (dom ?\)\) (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>1 (dom ?\)\) = \\tab\<^sub>1 ((Maps.REP (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg (snd \\)) \tab\<^sub>0 (dom ?\)\))\<^sup>* \ Maps.REP (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>1 (dom ?\)\))\\" unfolding Maps.PRJ\<^sub>1_def using \\ VV.arr_char dom_\_\.RS_simps(1) dom_\_\.RS_simps(16) dom_\_\.RS_simps(18) dom_\_\.RS_simps(3) dom_\_\.R\<^sub>0_def dom_\_\.S\<^sub>1_def by auto moreover have "(Maps.REP (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg (snd \\)) \tab\<^sub>0 (dom ?\)\))\<^sup>* \ Maps.REP (Maps.MkArr (src (tab\<^sub>0 (dom ?\))) (trg ?\) \tab\<^sub>1 (dom ?\)\) \ (tab\<^sub>0 (dom ?\))\<^sup>* \ tab\<^sub>1 (dom ?\)" using VV.arr_char \\ dom_\_\.S\<^sub>1_def dom_\_\.s.leg1_simps(3) dom_\_\.s.leg1_simps(4) trg_dom dom_\_\.R\<^sub>0_def dom_\_\.prj_tab_agreement(1) isomorphic_symmetric by simp ultimately show ?thesis using X.isomorphic_implies_same_tab isomorphic_symmetric by metis qed thus ?thesis unfolding Span.chine_hcomp_def using \\ VV.arr_char SPN_def isomorphic_reflexive Maps.comp_CLS [of "spn ?\" dom_\_\.\\.p\<^sub>1 "spn ?\ \ dom_\_\.\\.p\<^sub>1"] Maps.comp_CLS [of "spn ?\" dom_\_\.\\.p\<^sub>0 "spn ?\ \ dom_\_\.\\.p\<^sub>0"] by simp qed moreover have "Maps.Dom (Span.chine_hcomp (SPN ?\) (SPN ?\)) = src dom_\_\.\\.p\<^sub>0" by (metis (no_types, lifting) "1" "2" Maps.Dom.simps(1) Maps.comp_char \Maps.Dom ?Chn_LHS = Maps.Dom ?Chn_RHS\) ultimately show ?thesis by simp qed also have "... = Maps.Comp \cod_\_\.cmp\ \\_\.chine\" proof - let ?tuple = "Maps.tuple \\spn (fst \\) \ dom_\_\.\\.p\<^sub>1\\ \\tab\<^sub>0 (cod ?\)\\ \\tab\<^sub>1 (cod ?\)\\ \\spn (snd \\) \ dom_\_\.\\.p\<^sub>0\\" have "iso_class \_\.chine = Maps.Map ?tuple" using \_\.CLS_chine spn_def Maps.Map.simps(1) by (metis (no_types, lifting)) thus ?thesis by simp qed also have "... = \cod_\_\.cmp \ \_\.chine\" proof - have "\\_\.chine\ \ Maps.Hom (src dom_\_\.\\.p\<^sub>0) (src cod_\_\.\\.p\<^sub>0)" proof - have "\\_\.chine : src dom_\_\.\\.p\<^sub>0 \ src cod_\_\.\\.p\<^sub>0\" using \\ VV.arr_char by simp thus ?thesis using \_\.is_map ide_in_iso_class left_adjoint_is_ide by blast qed moreover have "\cod_\_\.cmp\ \ Maps.Hom (src cod_\_\.\\.p\<^sub>0) (src (tab\<^sub>0 (cod ?\ \ cod ?\)))" proof - have "\cod_\_\.cmp : src cod_\_\.\\.p\<^sub>0 \ src (tab\<^sub>0 (cod ?\ \ cod ?\))\" using \\ VV.arr_char cod_\_\.cmp_in_hom cod_\\.tab_simps(2) by simp thus ?thesis using cod_\_\.cmp_props equivalence_is_left_adjoint left_adjoint_is_ide ide_in_iso_class [of cod_\_\.cmp] by (metis (mono_tags, lifting) mem_Collect_eq) qed moreover have "cod_\_\.cmp \ \_\.chine \ Maps.Comp \cod_\_\.cmp\ \\_\.chine\" proof show "is_iso_class \\_\.chine\" using \_\.w_simps(1) is_iso_classI by blast show "is_iso_class \cod_\_\.cmp\" using cod_\_\.cmp_simps(2) is_iso_classI by blast show "\_\.chine \ \\_\.chine\" using ide_in_iso_class by simp show "cod_\_\.cmp \ \cod_\_\.cmp\" using ide_in_iso_class by simp show "cod_\_\.cmp \ \_\.chine \ cod_\_\.cmp \ \_\.chine" by (simp add: isomorphic_reflexive) qed ultimately show ?thesis using \\ cod_\_\.cmp_props \_\.chine_in_hom \_\.chine_is_induced_map Maps.Comp_eq_iso_class_memb by simp qed finally show ?thesis by simp qed have EQ: "\\\.chine \ dom_\_\.cmp\ = \cod_\_\.cmp \ \_\.chine\" proof (intro iso_class_eqI) show "\\.chine \ dom_\_\.cmp \ cod_\_\.cmp \ \_\.chine" proof - interpret dom_cmp: identity_arrow_of_tabulations_in_maps V H \ \ src trg \dom ?\\\ dom_\_\.\\.tab \tab\<^sub>0 (dom ?\) \ dom_\_\.\\.p\<^sub>0\ \tab\<^sub>1 (dom ?\) \ dom_\_\.\\.p\<^sub>1\ \dom ?\\\ \tab_of_ide (dom ?\ \ dom ?\)\ \tab\<^sub>0 (dom ?\ \ dom ?\)\ \tab\<^sub>1 (dom ?\ \ dom ?\)\ \dom ?\\\ using \\ VV.arr_char dom_\_\.cmp_interpretation by simp interpret cod_cmp: identity_arrow_of_tabulations_in_maps V H \ \ src trg \cod ?\\\ cod_\_\.\\.tab \tab\<^sub>0 (cod ?\) \ cod_\_\.\\.p\<^sub>0\ \tab\<^sub>1 (cod ?\) \ cod_\_\.\\.p\<^sub>1\ \cod ?\\\ \tab_of_ide (cod ?\ \ cod ?\)\ \tab\<^sub>0 (cod ?\ \ cod ?\)\ \tab\<^sub>1 (cod ?\ \ cod ?\)\ \cod ?\\\ using \\ VV.arr_char cod_\_\.cmp_interpretation by simp interpret L: vertical_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \dom ?\\\ \dom_\_\.\\.tab\ \tab\<^sub>0 (dom ?\) \ dom_\_\.\\.p\<^sub>0\ \tab\<^sub>1 (dom ?\) \ dom_\_\.\\.p\<^sub>1\ \dom ?\\\ \tab_of_ide (dom ?\\)\ \tab\<^sub>0 (dom ?\\)\ \tab\<^sub>1 (dom ?\\)\ \cod ?\\\ cod_\\.tab \tab\<^sub>0 (cod ?\\)\ \tab\<^sub>1 (cod ?\\)\ \dom ?\\\ \?\ \ ?\\ using \\ VV.arr_char dom_\_\.cmp_in_hom by unfold_locales auto interpret R: vertical_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \dom ?\\\ \dom_\_\.\\.tab\ \tab\<^sub>0 (dom ?\) \ dom_\_\.\\.p\<^sub>0\ \tab\<^sub>1 (dom ?\) \ dom_\_\.\\.p\<^sub>1\ \cod ?\\\ \cod_\_\.\\.tab\ \tab\<^sub>0 (cod ?\) \ cod_\_\.\\.p\<^sub>0\ \tab\<^sub>1 (cod ?\) \ cod_\_\.\\.p\<^sub>1\ \cod ?\\\ cod_\\.tab \tab\<^sub>0 (cod ?\\)\ \tab\<^sub>1 (cod ?\\)\ \?\ \ ?\\ \cod ?\\\ using \\ VV.arr_char cod_\_\.cmp_in_hom by unfold_locales auto have "\\.chine \ dom_\_\.cmp \ L.chine" using \\ VV.arr_char L.chine_char dom_\_\.cmp_def isomorphic_symmetric by simp also have "... = R.chine" using L.is_ide \\ comp_arr_dom comp_cod_arr isomorphic_reflexive by force also have "... \ cod_\_\.cmp \ \_\.chine" using \\ VV.arr_char R.chine_char cod_\_\.cmp_def by simp finally show ?thesis by simp qed qed show ?thesis using LHS RHS EQ by simp qed qed thus ?thesis using Chn_LHS_eq Chn_RHS_eq by simp qed qed qed qed interpretation \: natural_isomorphism VV.comp Span.vcomp HoSPN_SPN.map SPNoH.map \.map using VV.ide_char VV.arr_char \.map_simp_ide compositor_is_iso by (unfold_locales, simp) lemma compositor_is_natural_transformation: shows "transformation_by_components VV.comp Span.vcomp HoSPN_SPN.map SPNoH.map (\rs. CMP (fst rs) (snd rs))" .. lemma compositor_is_natural_isomorphism: shows "natural_isomorphism VV.comp Span.vcomp HoSPN_SPN.map SPNoH.map \.map" .. end subsubsection "Associativity Coherence" locale three_composable_identities_in_bicategory_of_spans = bicategory_of_spans V H \ \ src trg + f: identity_in_bicategory_of_spans V H \ \ src trg f + g: identity_in_bicategory_of_spans V H \ \ src trg g + h: identity_in_bicategory_of_spans V H \ \ src trg h for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src :: "'a \ 'a" and trg :: "'a \ 'a" and f :: 'a and g :: 'a and h :: 'a + assumes fg: "src f = trg g" and gh: "src g = trg h" begin interpretation f: arrow_of_tabulations_in_maps V H \ \ src trg f f.tab \tab\<^sub>0 f\ \tab\<^sub>1 f\ f f.tab \tab\<^sub>0 f\ \tab\<^sub>1 f\ f using f.is_arrow_of_tabulations_in_maps by simp interpretation h: arrow_of_tabulations_in_maps V H \ \ src trg h h.tab \tab\<^sub>0 h\ \tab\<^sub>1 h\ h h.tab \tab\<^sub>0 h\ \tab\<^sub>1 h\ h using h.is_arrow_of_tabulations_in_maps by simp interpretation E: self_evaluation_map V H \ \ src trg .. notation E.eval ("\_\") interpretation Maps: maps_category V H \ \ src trg .. interpretation Span: span_bicategory Maps.comp Maps.PRJ\<^sub>0 Maps.PRJ\<^sub>1 .. no_notation Fun.comp (infixl "\" 55) notation Span.vcomp (infixr "\" 55) notation Span.hcomp (infixr "\" 53) notation Maps.comp (infixr "\" 55) notation isomorphic (infix "\" 50) interpretation SPN: "functor" V Span.vcomp SPN using SPN_is_functor by simp interpretation SPN: weak_arrow_of_homs V src trg Span.vcomp Span.src Span.trg SPN using SPN_is_weak_arrow_of_homs by simp interpretation SPN_SPN: "functor" VV.comp Span.VV.comp SPN.FF using SPN.functor_FF by auto interpretation HoSPN_SPN: composite_functor VV.comp Span.VV.comp Span.vcomp SPN.FF \\\\. fst \\ \ snd \\\ .. interpretation SPNoH: composite_functor VV.comp V Span.vcomp \\\\. fst \\ \ snd \\\ SPN .. text \ Here come a lot of interpretations for ``composite things''. We need these in order to have relatively short, systematic names for entities that will appear in the lemmas to follow. The names of the interpretations use a prefix notation, where \H\ refers to horizontal composition of 1-cells and \T\ refers to composite of tabulations. So, for example, \THfgh\ refers to the composite of the tabulation associated with the horizontal composition \f \ g\ with the tabulation associated with \h\. \ interpretation HHfgh: identity_in_bicategory_of_spans V H \ \ src trg \(f \ g) \ h\ using fg gh by unfold_locales auto interpretation HfHgh: identity_in_bicategory_of_spans V H \ \ src trg \f \ g \ h\ using fg gh by unfold_locales auto interpretation Tfg: two_composable_identities_in_bicategory_of_spans V H \ \ src trg f g using fg gh by unfold_locales auto interpretation Tgh: two_composable_identities_in_bicategory_of_spans V H \ \ src trg g h using fg gh by unfold_locales auto interpretation THfgh: two_composable_identities_in_bicategory_of_spans V H \ \ src trg \f \ g\ h using fg gh by unfold_locales auto interpretation THfgh: tabulation V H \ \ src trg \(f \ g) \ h\ THfgh.\\.tab \tab\<^sub>0 h \ THfgh.\\.p\<^sub>0\ \tab\<^sub>1 (f \ g) \ THfgh.\\.p\<^sub>1\ using THfgh.\\.composite_is_tabulation by simp interpretation TfHgh: two_composable_identities_in_bicategory_of_spans V H \ \ src trg f \g \ h\ using fg gh by unfold_locales auto interpretation TfHgh: tabulation V H \ \ src trg \f \ g \ h\ TfHgh.\\.tab \tab\<^sub>0 (g \ h) \ TfHgh.\\.p\<^sub>0\ \tab\<^sub>1 f \ TfHgh.\\.p\<^sub>1\ using TfHgh.\\.composite_is_tabulation by simp interpretation Tfg_Hfg: arrow_of_tabulations_in_maps V H \ \ src trg \f \ g\ Tfg.\\.tab \tab\<^sub>0 g \ Tfg.\\.p\<^sub>0\ \tab\<^sub>1 f \ Tfg.\\.p\<^sub>1\ \f \ g\ \tab_of_ide (f \ g)\ \tab\<^sub>0 (f \ g)\ \tab\<^sub>1 (f \ g)\ \f \ g\ by unfold_locales auto interpretation Tgh_Hgh: arrow_of_tabulations_in_maps V H \ \ src trg \g \ h\ Tgh.\\.tab \tab\<^sub>0 h \ Tgh.\\.p\<^sub>0\ \tab\<^sub>1 g \ Tgh.\\.p\<^sub>1\ \g \ h\ \tab_of_ide (g \ h)\ \tab\<^sub>0 (g \ h)\ \tab\<^sub>1 (g \ h)\ \g \ h\ by unfold_locales auto interpretation THfgh_HHfgh: arrow_of_tabulations_in_maps V H \ \ src trg \(f \ g) \ h\ THfgh.\\.tab \tab\<^sub>0 h \ THfgh.\\.p\<^sub>0\ \tab\<^sub>1 (f \ g) \ THfgh.\\.p\<^sub>1\ \(f \ g) \ h\ \tab_of_ide ((f \ g) \ h)\ \tab\<^sub>0 ((f \ g) \ h)\ \tab\<^sub>1 ((f \ g) \ h)\ \(f \ g) \ h\ using fg gh by unfold_locales auto interpretation TfHgh_HfHgh: arrow_of_tabulations_in_maps V H \ \ src trg \f \ g \ h\ TfHgh.\\.tab \tab\<^sub>0 (g \ h) \ TfHgh.\\.p\<^sub>0\ \tab\<^sub>1 f \ TfHgh.\\.p\<^sub>1\ \f \ g \ h\ \tab_of_ide (f \ g \ h)\ \tab\<^sub>0 (f \ g \ h)\ \tab\<^sub>1 (f \ g \ h)\ \f \ g \ h\ using fg gh by unfold_locales auto interpretation TTfgh: composite_tabulation_in_maps V H \ \ src trg \f \ g\ Tfg.\\.tab \tab\<^sub>0 g \ Tfg.\\.p\<^sub>0\ \tab\<^sub>1 f \ Tfg.\\.p\<^sub>1\ h \tab_of_ide h\ \tab\<^sub>0 h\ \tab\<^sub>1 h\ using fg gh by unfold_locales auto interpretation TTfgh_THfgh: horizontal_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \f \ g\ Tfg.\\.tab \tab\<^sub>0 g \ Tfg.\\.p\<^sub>0\ \tab\<^sub>1 f \ Tfg.\\.p\<^sub>1\ h \tab_of_ide h\ \tab\<^sub>0 h\ \tab\<^sub>1 h\ \f \ g\ \tab_of_ide (f \ g)\ \tab\<^sub>0 (f \ g)\ \tab\<^sub>1 (f \ g)\ h \tab_of_ide h\ \tab\<^sub>0 h\ \tab\<^sub>1 h\ \f \ g\ h .. interpretation TfTgh: composite_tabulation_in_maps V H \ \ src trg f \tab_of_ide f\ \tab\<^sub>0 f\ \tab\<^sub>1 f\ \g \ h\ Tgh.\\.tab \tab\<^sub>0 h \ Tgh.\\.p\<^sub>0\ \tab\<^sub>1 g \ Tgh.\\.p\<^sub>1\ using fg gh by unfold_locales auto interpretation TfTgh_TfHgh: horizontal_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg f \tab_of_ide f\ \tab\<^sub>0 f\ \tab\<^sub>1 f\ \g \ h\ Tgh.\\.tab \tab\<^sub>0 h \ Tgh.\\.p\<^sub>0\ \tab\<^sub>1 g \ Tgh.\\.p\<^sub>1\ f \tab_of_ide f\ \tab\<^sub>0 f\ \tab\<^sub>1 f\ \g \ h\ \tab_of_ide (g \ h)\ \tab\<^sub>0 (g \ h)\ \tab\<^sub>1 (g \ h)\ f \g \ h\ .. interpretation TfTgh_TfTgh: horizontal_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg f \tab_of_ide f\ \tab\<^sub>0 f\ \tab\<^sub>1 f\ \g \ h\ Tgh.\\.tab \tab\<^sub>0 h \ Tgh.\\.p\<^sub>0\ \tab\<^sub>1 g \ Tgh.\\.p\<^sub>1\ f \tab_of_ide f\ \tab\<^sub>0 f\ \tab\<^sub>1 f\ \g \ h\ Tgh.\\.tab \tab\<^sub>0 h \ Tgh.\\.p\<^sub>0\ \tab\<^sub>1 g \ Tgh.\\.p\<^sub>1\ f \g \ h\ .. text \ The following interpretation defines the associativity between the peaks of the two composite tabulations \TTfgh\ (associated to the left) and \TfTgh\ (associated to the right). \ (* TODO: Try to get rid of the .\\ in, e.g., Tfg.\\.p\<^sub>1. *) interpretation TTfgh_TfTgh: arrow_of_tabulations_in_maps V H \ \ src trg \(f \ g) \ h\ TTfgh.tab \tab\<^sub>0 h \ TTfgh.p\<^sub>0\ \(tab\<^sub>1 f \ Tfg.\\.p\<^sub>1) \ TTfgh.p\<^sub>1\ \f \ g \ h\ TfTgh.tab \(tab\<^sub>0 h \ Tgh.\\.p\<^sub>0) \ TfTgh.p\<^sub>0\ \tab\<^sub>1 f \ TfTgh.p\<^sub>1\ \\[f, g, h]\ using fg gh by unfold_locales auto text \ This interpretation defines the map, from the apex of the tabulation associated with the horizontal composite \(f \ g) \ h\ to the apex of the tabulation associated with the horizontal composite \f \ g \ h\, induced by the associativity isomorphism \\[f, g, h]\ from \(f \ g) \ h\ to \f \ g \ h\. \ interpretation HHfgh_HfHgh: arrow_of_tabulations_in_maps V H \ \ src trg \dom (\ (f, g, h))\ \tab_of_ide (dom (\ (f, g, h)))\ \tab\<^sub>0 (dom (\ (f, g, h)))\ \tab\<^sub>1 (dom (\ (f, g, h)))\ \cod (\ (f, g, h))\ \tab_of_ide (cod (\ (f, g, h)))\ \tab\<^sub>0 (cod (\ (f, g, h)))\ \tab\<^sub>1 (cod (\ (f, g, h)))\ \\ (f, g, h)\ proof - have "arrow_of_tabulations_in_maps V H \ \ src trg ((f \ g) \ h) (tab_of_ide ((f \ g) \ h)) (tab\<^sub>0 ((f \ g) \ h)) (tab\<^sub>1 ((f \ g) \ h)) (f \ g \ h) (tab_of_ide (f \ g \ h)) (tab\<^sub>0 (f \ g \ h)) (tab\<^sub>1 (f \ g \ h)) \[f, g, h]" using fg gh by unfold_locales auto thus "arrow_of_tabulations_in_maps V H \ \ src trg (dom (\ (f, g, h))) (tab_of_ide (dom (\ (f, g, h)))) (tab\<^sub>0 (dom (\ (f, g, h)))) (tab\<^sub>1 (dom (\ (f, g, h)))) (cod (\ (f, g, h))) (tab_of_ide (cod (\ (f, g, h)))) (tab\<^sub>0 (cod (\ (f, g, h)))) (tab\<^sub>1 (cod (\ (f, g, h)))) (\ (f, g, h))" using fg gh \_def by auto qed interpretation SPN_f: arrow_of_spans Maps.comp \SPN f\ using SPN_in_hom Span.arr_char [of "SPN f"] by simp interpretation SPN_g: arrow_of_spans Maps.comp \SPN g\ using SPN_in_hom Span.arr_char [of "SPN g"] by simp interpretation SPN_h: arrow_of_spans Maps.comp \SPN h\ using SPN_in_hom Span.arr_char [of "SPN h"] by simp interpretation SPN_fgh: three_composable_identity_arrows_of_spans Maps.comp Maps.PRJ\<^sub>0 Maps.PRJ\<^sub>1 \SPN f\ \SPN g\ \SPN h\ using fg gh Span.arr_char SPN_in_hom SPN.preserves_ide Span.ide_char apply unfold_locales by auto text \ The following relates the projections associated with the composite span \SPN_fgh\ with tabulations in the underlying bicategory. \ lemma prj_char: shows "SPN_fgh.Prj\<^sub>1\<^sub>1 = \\Tfg.\\.p\<^sub>1 \ TTfgh.p\<^sub>1\\" and "SPN_fgh.Prj\<^sub>0\<^sub>1 = \\Tfg.\\.p\<^sub>0 \ TTfgh.p\<^sub>1\\" and "SPN_fgh.Prj\<^sub>0 = \\TTfgh.p\<^sub>0\\" and "SPN_fgh.Prj\<^sub>1 = \\TfTgh.p\<^sub>1\\" and "SPN_fgh.Prj\<^sub>1\<^sub>0 = \\Tgh.\\.p\<^sub>1 \ TfTgh.p\<^sub>0\\" and "SPN_fgh.Prj\<^sub>0\<^sub>0 = \\Tgh.\\.p\<^sub>0 \ TfTgh.p\<^sub>0\\" proof - show "SPN_fgh.Prj\<^sub>1\<^sub>1 = \\Tfg.\\.p\<^sub>1 \ TTfgh.p\<^sub>1\\" proof - have "ide (Tfg.\\.p\<^sub>1 \ TTfgh.p\<^sub>1)" by (metis TTfgh.composable TTfgh.leg1_simps(2) Tfg.\\.T0.antipar(2) Tfg.\\.T0.ide_right Tfg_Hfg.u_simps(3) f.T0.antipar(2) f.T0.ide_right f.u_simps(3) fg g.ide_leg1 g.leg1_simps(4) h.ide_leg1 h.leg1_simps(4) ide_hcomp hseqE hcomp_simps(1) tab\<^sub>1_simps(1)) thus ?thesis using fg gh Tfg.\\.prj_char TTfgh.prj_char isomorphic_reflexive Maps.comp_CLS [of "tab\<^sub>0 g" Tfg.\\.p\<^sub>0 "tab\<^sub>0 g \ Tfg.\\.p\<^sub>0"] Maps.comp_CLS [of Tfg.\\.p\<^sub>1 TTfgh.p\<^sub>1 "Tfg.\\.p\<^sub>1 \ TTfgh.p\<^sub>1"] by (simp add: TTfgh.composable Tfg.\\.T0.antipar(2)) qed show "SPN_fgh.Prj\<^sub>0\<^sub>1 = \\Tfg.\\.p\<^sub>0 \ TTfgh.p\<^sub>1\\" proof - have "ide (Tfg.\\.p\<^sub>0 \ TTfgh.p\<^sub>1)" by (metis TTfgh.leg1_simps(2) bicategory_of_spans.tab\<^sub>0_simps(1) bicategory_of_spans.tab\<^sub>1_simps(1) bicategory_of_spans_axioms Tfg.\\.T0.antipar(2) Tfg.\\.T0.ide_right Tfg.composable f.T0.antipar(2) f.T0.ide_right f.u_simps(3) g.ide_leg1 g.leg1_simps(4) Tfg.u_simps(3) THfgh.composable h.ide_leg1 h.leg1_simps(4) ide_hcomp hseqE hcomp_simps(1) tab\<^sub>1_simps(3)) thus ?thesis using fg gh Tfg.\\.prj_char TTfgh.prj_char isomorphic_reflexive Maps.comp_CLS [of "tab\<^sub>0 g" Tfg.\\.p\<^sub>0 "tab\<^sub>0 g \ Tfg.\\.p\<^sub>0"] Maps.comp_CLS [of Tfg.\\.p\<^sub>0 TTfgh.p\<^sub>1 "Tfg.\\.p\<^sub>0 \ TTfgh.p\<^sub>1"] by (simp add: Tfg.\\.T0.antipar(2) THfgh.composable) qed show "SPN_fgh.Prj\<^sub>0 = \\TTfgh.p\<^sub>0\\" using isomorphic_reflexive TTfgh.prj_char Tfg.\\.prj_char Maps.comp_CLS [of "tab\<^sub>0 g" Tfg.\\.p\<^sub>0 "tab\<^sub>0 g \ Tfg.\\.p\<^sub>0"] by (simp add: Tfg.composable) show "SPN_fgh.Prj\<^sub>1 = \\TfTgh.p\<^sub>1\\" using Tgh.\\.prj_char isomorphic_reflexive Tgh.composable Maps.comp_CLS [of "tab\<^sub>1 g" Tgh.\\.p\<^sub>1 "tab\<^sub>1 g \ Tgh.\\.p\<^sub>1"] TfTgh.prj_char by simp show "SPN_fgh.Prj\<^sub>1\<^sub>0 = \\Tgh.\\.p\<^sub>1 \ TfTgh.p\<^sub>0\\" using fg gh Tgh.\\.prj_char TfTgh.prj_char isomorphic_reflexive Maps.comp_CLS [of "tab\<^sub>1 g" "prj\<^sub>1 (tab\<^sub>1 h) (tab\<^sub>0 g)" "tab\<^sub>1 g \ Tgh.\\.p\<^sub>1"] Maps.comp_CLS [of Tgh.\\.p\<^sub>1 TfTgh.p\<^sub>0 "Tgh.\\.p\<^sub>1 \ TfTgh.p\<^sub>0"] by simp show "SPN_fgh.Prj\<^sub>0\<^sub>0 = \\Tgh.\\.p\<^sub>0 \ TfTgh.p\<^sub>0\\" using fg gh Tgh.\\.prj_char TfTgh.prj_char isomorphic_reflexive Maps.comp_CLS [of "tab\<^sub>1 g" "Tgh.\\.p\<^sub>1" "tab\<^sub>1 g \ Tgh.\\.p\<^sub>1"] Maps.comp_CLS [of Tgh.\\.p\<^sub>0 TfTgh.p\<^sub>0 "Tgh.\\.p\<^sub>0 \ TfTgh.p\<^sub>0"] by simp qed interpretation \: transformation_by_components VV.comp Span.vcomp HoSPN_SPN.map SPNoH.map \\rs. CMP (fst rs) (snd rs)\ using compositor_is_natural_transformation by simp interpretation \: natural_isomorphism VV.comp Span.vcomp HoSPN_SPN.map SPNoH.map \.map using compositor_is_natural_isomorphism by simp (* * TODO: Figure out how this subcategory gets introduced. * The simps in the locale are used in the subsequent proofs. *) interpretation VVV': subcategory VxVxV.comp \\\\\. arr (fst \\\) \ arr (fst (snd \\\)) \ arr (snd (snd \\\)) \ src (fst (snd \\\)) = trg (snd (snd \\\)) \ src (fst \\\) = trg (fst (snd \\\))\ using fg gh VVV.arr_char VV.arr_char VVV.subcategory_axioms by simp text \ We define abbreviations for the left and right-hand sides of the equation for associativity coherence. \ (* * TODO: \ doesn't really belong in this locale. Replace it with CMP and rearrange * material so that this locale comes first and the definition of \ comes later * in bicategory_of_spans. *) abbreviation LHS where "LHS \ SPN \[f, g, h] \ \.map (f \ g, h) \ (\.map (f, g) \ SPN h)" abbreviation RHS where "RHS \ \.map (f, g \ h) \ (SPN f \ \.map (g, h)) \ Span.assoc (SPN f) (SPN g) (SPN h)" lemma arr_LHS: shows "Span.arr LHS" using fg gh VVV.arr_char VVV.ide_char VV.arr_char VV.ide_char Span.hseqI' HoHV_def compositor_in_hom \_def apply (intro Span.seqI) apply simp_all using SPN.FF_def apply simp proof - have "SPN ((f \ g) \ h) = Span.cod (CMP (f \ g) h)" using fg gh compositor_in_hom by simp also have "... = Span.cod (CMP (f \ g) h \ (CMP f g \ SPN h))" proof - have "Span.seq (CMP (f \ g) h) (CMP f g \ SPN h)" proof (intro Span.seqI Span.hseqI) show 1: "Span.in_hhom (SPN h) (SPN.map\<^sub>0 (src h)) (SPN.map\<^sub>0 (trg h))" using SPN.preserves_src SPN.preserves_trg by simp show 2: "Span.in_hhom (CMP f g) (SPN.map\<^sub>0 (trg h)) (SPN.map\<^sub>0 (trg f))" using compositor_in_hom SPN_fgh.\\.composable fg by auto show 3: "Span.arr (CMP (f \ g) h)" using TTfgh.composable Tfg.\\.ide_base compositor_simps(1) h.is_ide by auto show "Span.dom (CMP (f \ g) h) = Span.cod (CMP f g \ SPN h)" using 1 2 3 fg gh compositor_in_hom SPN_fgh.\\.composable SPN_in_hom SPN.FF_def by auto qed thus ?thesis by simp qed finally show "SPN ((f \ g) \ h) = Span.cod (CMP (f \ g) h \ (CMP f g \ SPN h))" by blast qed lemma arr_RHS: shows "Span.arr RHS" using fg gh VV.ide_char VV.arr_char \.map_simp_ide SPN.FF_def Span.hseqI' by (intro Span.seqI, simp_all) lemma par_LHS_RHS: shows "Span.par LHS RHS" proof (intro conjI) show "Span.arr LHS" using arr_LHS by simp show "Span.arr RHS" using arr_RHS by simp show "Span.dom LHS = Span.dom RHS" proof - have "Span.dom LHS = Span.dom (\.map (f, g) \ SPN h)" using arr_LHS by auto also have "... = Span.dom (\.map (f, g)) \ Span.dom (SPN h)" using arr_LHS Span.dom_hcomp [of "SPN h" "\.map (f, g)"] by blast also have "... = (SPN f \ SPN g) \ SPN h" using fg \.map_simp_ide VV.ide_char VV.arr_char SPN.FF_def by simp also have "... = Span.dom (Span.assoc (SPN f) (SPN g) (SPN h))" using fg gh VVV.arr_char VVV.ide_char VV.arr_char VV.ide_char by simp also have "... = Span.dom RHS" using \Span.arr RHS\ by auto finally show ?thesis by blast qed show "Span.cod LHS = Span.cod RHS" proof - have "Span.cod LHS = Span.cod (SPN \[f, g, h])" using arr_LHS by simp also have "... = SPN (f \ g \ h)" unfolding \_def using fg gh VVV.ide_char VVV.arr_char VV.ide_char VV.arr_char HoVH_def by simp also have "... = Span.cod RHS" using arr_RHS fg gh \.map_simp_ide VV.ide_char VV.arr_char SPN.FF_def compositor_in_hom by simp finally show ?thesis by blast qed qed lemma Chn_LHS_eq: shows "Chn LHS = \\HHfgh_HfHgh.chine\\ \ \\THfgh_HHfgh.chine\\ \ \\TTfgh_THfgh.chine\\" proof - have "Chn LHS = \\HHfgh_HfHgh.chine\\ \ \\THfgh_HHfgh.chine\\ \ Span.chine_hcomp (CMP f g) (SPN h)" proof - have "Chn LHS = Chn (SPN \[f, g, h]) \ Chn (CMP (f \ g) h) \ Chn (CMP f g \ SPN h)" using fg gh arr_LHS \.map_simp_ide VV.ide_char VV.arr_char Span.Chn_vcomp by auto moreover have "Chn (SPN \[f, g, h]) = Maps.CLS HHfgh_HfHgh.chine" using fg gh SPN_def VVV.arr_char VV.arr_char spn_def \_def by simp moreover have "Chn (CMP (f \ g) h) = Maps.CLS THfgh_HHfgh.chine" using fg gh CMP_def THfgh.cmp_def by simp moreover have "Chn (CMP f g \ SPN h) = Span.chine_hcomp (CMP f g) (SPN h)" using fg gh Span.hcomp_def by simp ultimately show ?thesis by simp qed moreover have "Span.chine_hcomp (CMP f g) (SPN h) = \\TTfgh_THfgh.chine\\" proof - have "Span.chine_hcomp (CMP f g) (SPN h) = Maps.tuple (\\Tfg.cmp\\ \ Maps.PRJ\<^sub>1 \\tab\<^sub>0 g \ Tfg.\\.p\<^sub>0\\ \\tab\<^sub>1 h\\) \\tab\<^sub>0 (f \ g)\\ \\tab\<^sub>1 h\\ (\\spn h\\ \ Maps.PRJ\<^sub>0 \\tab\<^sub>0 g \ Tfg.\\.p\<^sub>0\\ \\tab\<^sub>1 h\\)" proof - have "\\tab\<^sub>0 g\\ \ \\Tfg.\\.p\<^sub>0\\ = \\tab\<^sub>0 g \ Tfg.\\.p\<^sub>0\\" using fg isomorphic_reflexive Maps.comp_CLS [of "tab\<^sub>0 g" "Tfg.\\.p\<^sub>0" "tab\<^sub>0 g \ Tfg.\\.p\<^sub>0"] by simp moreover have "span_in_category.apex Maps.comp \Leg0 = \\tab\<^sub>0 h\\, Leg1 = \\tab\<^sub>1 h\\\ = \\spn h\\" proof - interpret h: span_in_category Maps.comp \\Leg0 = \\tab\<^sub>0 h\\, Leg1 = \\tab\<^sub>1 h\\\\ using h.determines_span by simp interpret dom_h: identity_arrow_of_tabulations_in_maps V H \ \ src trg \dom h\ \tab_of_ide (dom h)\ \tab\<^sub>0 (dom h)\ \tab\<^sub>1 (dom h)\ \cod h\ \tab_of_ide (cod h)\ \tab\<^sub>0 (cod h)\ \tab\<^sub>1 (cod h)\ h by (simp add: h.is_arrow_of_tabulations_in_maps identity_arrow_of_tabulations_in_maps.intro identity_arrow_of_tabulations_in_maps_axioms.intro) have "Maps.arr h.leg0" using h.leg_simps(1) by simp hence "Maps.dom h.leg0 = \\dom_h.chine\\" using Maps.dom_char Maps.CLS_in_hom apply simp proof - have "h.is_induced_map (src (tab\<^sub>0 h))" using h.is_induced_map_iff dom_h.\_eq_\ h.apex_is_induced_by_cell by force hence "src (tab\<^sub>0 h) \ h.chine" using h.chine_is_induced_map h.induced_map_unique by simp thus "\src (tab\<^sub>0 h)\ = \h.chine\" using iso_class_eqI by simp qed thus ?thesis using h.apex_def spn_def by simp qed ultimately show ?thesis unfolding Span.chine_hcomp_def using fg gh CMP_def Tfg.\\.prj_char Span.hcomp_def by simp qed also have "... = \\TTfgh_THfgh.chine\\" proof - have "\\TTfgh_THfgh.chine\\ = Maps.tuple \\Tfg_Hfg.chine \ TTfgh.p\<^sub>1\\ \\tab\<^sub>0 (f \ g)\\ \\tab\<^sub>1 h\\ \\h.chine \ TTfgh.p\<^sub>0\\" using TTfgh_THfgh.CLS_chine by simp also have "... = Maps.tuple (\\Tfg_Hfg.chine\\ \ \\TTfgh.p\<^sub>1\\) \\tab\<^sub>0 (f \ g)\\ \\tab\<^sub>1 h\\ (\\h.chine\\ \ \\TTfgh.p\<^sub>0\\)" proof - have "\\Tfg_Hfg.chine \ TTfgh.p\<^sub>1\\ = \\Tfg_Hfg.chine\\ \ \\TTfgh.p\<^sub>1\\" proof - have "is_left_adjoint TTfgh.p\<^sub>1" using Tfg.\\.T0.antipar(2) THfgh.composable by simp moreover have "Tfg_Hfg.chine \ TTfgh.p\<^sub>1 \ Tfg_Hfg.chine \ TTfgh.p\<^sub>1" using TTfgh_THfgh.prj_chine(2) isomorphic_reflexive isomorphic_implies_hpar(2) by blast ultimately show ?thesis using Tfg_Hfg.is_map Maps.comp_CLS [of Tfg_Hfg.chine TTfgh.p\<^sub>1 "Tfg_Hfg.chine \ TTfgh.p\<^sub>1"] by simp qed moreover have "\\h.chine \ TTfgh.p\<^sub>0\\ = \\h.chine\\ \ \\TTfgh.p\<^sub>0\\" proof - have "is_left_adjoint TTfgh.p\<^sub>0" by (simp add: Tfg.\\.T0.antipar(2) THfgh.composable) moreover have "h.chine \ TTfgh.p\<^sub>0 \ h.chine \ TTfgh.p\<^sub>0" using TTfgh_THfgh.prj_chine(1) isomorphic_reflexive isomorphic_implies_hpar(2) by blast ultimately show ?thesis using h.is_map Maps.comp_CLS [of h.chine TTfgh.p\<^sub>0 "h.chine \ TTfgh.p\<^sub>0"] by simp qed ultimately show ?thesis by argo qed also have "... = Maps.tuple (\\Tfg.cmp\\ \ Maps.PRJ\<^sub>1 \\tab\<^sub>0 g \ Tfg.\\.p\<^sub>0\\ \\tab\<^sub>1 h\\) \\tab\<^sub>0 (f \ g)\\ \\tab\<^sub>1 h\\ (\\spn h\\ \ Maps.PRJ\<^sub>0 \\tab\<^sub>0 g \ Tfg.\\.p\<^sub>0\\ \\tab\<^sub>1 h\\)" using Tfg.cmp_def spn_def TTfgh.prj_char by simp finally show ?thesis by simp qed finally show ?thesis by blast qed ultimately show ?thesis by simp qed abbreviation tuple_BC where "tuple_BC \ Maps.tuple SPN_fgh.Prj\<^sub>0\<^sub>1 SPN_fgh.\.leg0 SPN_fgh.\.leg1 SPN_fgh.Prj\<^sub>0" abbreviation tuple_ABC where "tuple_ABC \ Maps.tuple SPN_fgh.Prj\<^sub>1\<^sub>1 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) tuple_BC" abbreviation tuple_BC' where "tuple_BC' \ Maps.tuple \\Tfg.\\.p\<^sub>0 \ TTfgh.p\<^sub>1\\ \\tab\<^sub>0 g\\ \\tab\<^sub>1 h\\ \\TTfgh.p\<^sub>0\\" abbreviation tuple_ABC' where "tuple_ABC' \ Maps.tuple \\Tfg.\\.p\<^sub>1 \ TTfgh.p\<^sub>1\\ \\tab\<^sub>0 f\\ \\tab\<^sub>1 g \ Tgh.\\.p\<^sub>1\\ tuple_BC'" lemma csq: shows "Maps.commutative_square SPN_fgh.\.leg0 SPN_fgh.\.leg1 SPN_fgh.Prj\<^sub>0\<^sub>1 SPN_fgh.Prj\<^sub>0" and "Maps.commutative_square SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) SPN_fgh.Prj\<^sub>1\<^sub>1 tuple_BC" proof - show 1: "Maps.commutative_square SPN_fgh.\.leg0 SPN_fgh.\.leg1 SPN_fgh.Prj\<^sub>0\<^sub>1 SPN_fgh.Prj\<^sub>0" proof show "Maps.cospan SPN_fgh.\.leg0 SPN_fgh.\.leg1" using SPN_fgh.\\.legs_form_cospan(1) by simp show "Maps.span SPN_fgh.Prj\<^sub>0\<^sub>1 SPN_fgh.Prj\<^sub>0" using SPN_fgh.prj_simps(2-3,5-6) by presburger show "Maps.dom SPN_fgh.\.leg0 = Maps.cod SPN_fgh.Prj\<^sub>0\<^sub>1" using SPN_fgh.prj_simps(8) SPN_g.dom.is_span SPN_g.dom.leg_simps(2) by auto show "SPN_fgh.\.leg0 \ SPN_fgh.Prj\<^sub>0\<^sub>1 = SPN_fgh.\.leg1 \ SPN_fgh.Prj\<^sub>0" by (metis (no_types, lifting) Maps.cod_comp Maps.comp_assoc Maps.pullback_commutes' SPN_fgh.\\.dom.leg_simps(1) SPN_fgh.\\.leg0_composite SPN_fgh.cospan_\\) qed show "Maps.commutative_square SPN_fgh.\.leg0 (Maps.comp SPN_fgh.\.leg1 SPN_fgh.\\.prj\<^sub>1) SPN_fgh.Prj\<^sub>1\<^sub>1 tuple_BC" proof show "Maps.cospan SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" using fg gh SPN_fgh.prj_simps(10) by blast show "Maps.span SPN_fgh.Prj\<^sub>1\<^sub>1 tuple_BC" using fg gh 1 Maps.tuple_simps(1) Maps.tuple_simps(2) SPN_fgh.prj_simps(1) SPN_fgh.prj_simps(4) SPN_fgh.prj_simps(5) by presburger show "Maps.dom SPN_fgh.\.leg0 = Maps.cod SPN_fgh.Prj\<^sub>1\<^sub>1" using fg gh SPN_f.dom.leg_simps(2) SPN_fgh.prj_simps(7) by auto show "SPN_fgh.\.leg0 \ SPN_fgh.Prj\<^sub>1\<^sub>1 = (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ tuple_BC" using 1 fg gh Maps.comp_assoc Maps.prj_tuple by (metis (no_types, lifting) Maps.pullback_commutes' SPN_fgh.cospan_\\) qed qed lemma tuple_ABC_eq_ABC': shows "tuple_BC = tuple_BC'" and "tuple_ABC = tuple_ABC'" proof - have "SPN_fgh.Prj\<^sub>1\<^sub>1 = \\Tfg.\\.p\<^sub>1 \ TTfgh.p\<^sub>1\\" using prj_char by simp moreover have "SPN_fgh.\.leg0 = \\tab\<^sub>0 f\\" by simp moreover have "SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1 = \\tab\<^sub>1 g \ Tgh.\\.p\<^sub>1\\" using Tgh.\\.prj_char isomorphic_reflexive Tgh.composable Maps.comp_CLS [of "tab\<^sub>1 g" Tgh.\\.p\<^sub>1 "tab\<^sub>1 g \ Tgh.\\.p\<^sub>1"] by (simp add: g.T0.antipar(2)) moreover show "tuple_BC = tuple_BC'" using prj_char Tfg.\\.prj_char by simp ultimately show "tuple_ABC = tuple_ABC'" by argo qed lemma tuple_BC_in_hom: shows "Maps.in_hom tuple_BC (Maps.MkIde (src TTfgh.p\<^sub>0)) (Maps.MkIde (src Tgh.\\.p\<^sub>0))" proof show 1: "Maps.arr tuple_BC" using csq(1) by simp have 2: "Maps.commutative_square \\tab\<^sub>0 g\\ \\tab\<^sub>1 h\\ \\Tfg.\\.p\<^sub>0 \ TTfgh.p\<^sub>1\\ \\TTfgh.p\<^sub>0\\" by (metis Tfg.S\<^sub>0_def Tfg.span_legs_eq(3) Tgh.S\<^sub>1_def Tgh.span_legs_eq(4) csq(1) prj_char(2) prj_char(3)) show "Maps.dom tuple_BC = Maps.MkIde (src TTfgh.p\<^sub>0)" proof - have "Maps.dom tuple_BC' = Maps.dom \\Tfg.\\.p\<^sub>0 \ TTfgh.p\<^sub>1\\" using 2 Maps.tuple_simps by simp also have "... = Chn (Span.hcomp (Span.hcomp (SPN f) (SPN g)) (SPN h))" using Maps.dom_char by (metis SPN_fgh.prj_simps(5) prj_char(2)) also have "... = Maps.MkIde (src TTfgh.p\<^sub>0)" using 1 fg gh Maps.dom_char csq(1) prj_char(3) tuple_ABC_eq_ABC'(1) Maps.Dom.simps(1) Maps.tuple_simps(2) SPN_fgh.prj_simps(3,5-6) by presburger finally have "Maps.dom tuple_BC' = Maps.MkIde (src TTfgh.p\<^sub>0)" by blast thus ?thesis using tuple_ABC_eq_ABC' by simp qed show "Maps.cod tuple_BC = Maps.MkIde (src Tgh.\\.p\<^sub>0)" proof - have "Maps.cod tuple_BC' = Maps.pbdom \\tab\<^sub>0 g\\ \\tab\<^sub>1 h\\" using 1 2 fg gh Maps.tuple_in_hom by blast also have "... = Maps.MkIde (src Tgh.\\.p\<^sub>0)" using 1 2 fg gh Maps.pbdom_def by (metis (no_types, lifting) SPN.preserves_ide SPN_fgh.\\.are_identities(2) SPN_fgh.\\.composable Span.chine_hcomp_ide_ide Tfg.S\<^sub>0_def Tfg.span_legs_eq(3) Tgh.S\<^sub>1_def Tgh.chine_hcomp_SPN_SPN Tgh.span_legs_eq(4) g.is_ide) finally show ?thesis using tuple_ABC_eq_ABC' by simp qed qed lemma tuple_ABC_in_hom: shows "Maps.in_hom tuple_ABC (Maps.MkIde (src TTfgh.p\<^sub>0)) (Maps.MkIde (src TfTgh.p\<^sub>0))" proof show 1: "Maps.arr tuple_ABC" using SPN_fgh.chine_assoc_def SPN_fgh.chine_assoc_in_hom by auto show "Maps.dom tuple_ABC = Maps.MkIde (src TTfgh.p\<^sub>0)" proof - have "Maps.dom tuple_ABC = Maps.dom SPN_fgh.chine_assoc" by (simp add: SPN_fgh.chine_assoc_def) also have "... = Chn ((SPN f \ SPN g) \ SPN h)" using SPN_fgh.chine_assoc_in_hom by blast also have "... = Maps.MkIde (src TTfgh.p\<^sub>0)" by (metis (lifting) Maps.Dom.simps(1) Maps.dom_char SPN_fgh.prj_simps(3) SPN_fgh.prj_simps(6) prj_char(3)) finally show ?thesis by blast qed show "Maps.cod tuple_ABC = Maps.MkIde (src TfTgh.p\<^sub>0)" proof - have "Maps.cod tuple_ABC = Maps.cod SPN_fgh.chine_assoc" by (simp add: SPN_fgh.chine_assoc_def) also have 1: "... = Chn (SPN f \ SPN g \ SPN h)" using SPN_fgh.chine_assoc_in_hom by blast also have "... = Maps.MkIde (src TfTgh.p\<^sub>0)" by (metis (lifting) Maps.Dom.simps(1) Maps.cod_char Maps.seq_char SPN_fgh.prj_chine_assoc(1) SPN_fgh.prj_simps(1) TfTgh.leg1_in_hom(1) TfTgh_TfTgh.u_in_hom 1 in_hhomE prj_char(4) src_hcomp) finally show ?thesis by argo qed qed lemma Chn_RHS_eq: shows "Chn RHS = \\TfHgh_HfHgh.chine\\ \ \\TfTgh_TfHgh.chine\\ \ tuple_ABC'" proof - have "Chn RHS = Chn (\.map (f, g \ h)) \ Chn (SPN f \ \.map (g, h)) \ Chn (Span.assoc (SPN f) (SPN g) (SPN h))" proof - have "Chn RHS = Chn (\.map (f, g \ h)) \ Chn ((SPN f \ \.map (g, h)) \ Span.assoc (SPN f) (SPN g) (SPN h))" using arr_RHS Span.vcomp_eq Span.Chn_vcomp by blast also have "... = Chn (\.map (f, g \ h)) \ Chn (SPN f \ \.map (g, h)) \ Chn (Span.assoc (SPN f) (SPN g) (SPN h))" proof - have "Span.seq (SPN f \ \.map (g, h)) (Span.assoc (SPN f) (SPN g) (SPN h))" using arr_RHS by auto thus ?thesis using fg gh Span.vcomp_eq [of "SPN f \ \.map (g, h)" "Span.assoc (SPN f) (SPN g) (SPN h)"] by simp qed finally show ?thesis by blast qed moreover have "Chn (\.map (f, g \ h)) = \\TfHgh_HfHgh.chine\\" using arr_RHS fg gh \.map_simp_ide VV.ide_char VV.arr_char CMP_def TfHgh.cmp_def by simp moreover have "Chn (SPN f \ \.map (g, h)) = Span.chine_hcomp (SPN f) (CMP g h)" using fg gh Span.hcomp_def \.map_simp_ide VV.ide_char VV.arr_char SPN.FF_def by simp moreover have "Chn (Span.assoc (SPN f) (SPN g) (SPN h)) = tuple_ABC" using fg gh Span.\_ide VVV.ide_char VVV.arr_char VV.ide_char VV.arr_char SPN_fgh.chine_assoc_def Span.\_def by simp moreover have "Span.chine_hcomp (SPN f) (CMP g h) = \\TfTgh_TfHgh.chine\\" proof - have "Span.chine_hcomp (SPN f) (CMP g h) = Maps.tuple (\\f.chine\\ \ \\TfTgh.p\<^sub>1\\) \\tab\<^sub>0 f\\ \\tab\<^sub>1 (g \ h)\\ (\\Tgh_Hgh.chine\\ \ \\TfTgh.p\<^sub>0\\)" proof - interpret f: span_in_category Maps.comp \\Leg0 = Maps.MkArr (src (tab\<^sub>0 f)) (trg g) \tab\<^sub>0 f\, Leg1 = Maps.MkArr (src (tab\<^sub>0 f)) (trg f) \tab\<^sub>1 f\\\ using f.determines_span by (simp add: Tfg.composable) interpret f: arrow_of_tabulations_in_maps V H \ \ src trg f f.tab \tab\<^sub>0 f\ \tab\<^sub>1 f\ f f.tab \tab\<^sub>0 f\ \tab\<^sub>1 f\ f using f.is_arrow_of_tabulations_in_maps by simp have "f.apex = Maps.CLS f.chine" proof (intro Maps.arr_eqI) show "Maps.arr f.apex" by simp show "Maps.arr \\f.chine\\" using Maps.CLS_in_hom f.is_map by blast show "Maps.Dom f.apex = Maps.Dom \\f.chine\\" using f.apex_def Tfg.RS_simps(2) Tfg.R\<^sub>0_def Tfg.composable by auto show "Maps.Cod f.apex = Maps.Cod \\f.chine\\" using f.apex_def Tfg.RS_simps(2) Tfg.R\<^sub>0_def Tfg.composable by auto show "Maps.Map f.apex = Maps.Map \\f.chine\\" proof - have "Maps.Map f.apex = \src (tab\<^sub>0 f)\" using f.apex_def Maps.dom_char Tfg.RS_simps(2) Tfg.R\<^sub>0_def Tfg.composable by auto also have "... = \f.chine\" proof (intro iso_class_eqI) have "f.is_induced_map (src (tab\<^sub>0 f))" using f.apex_is_induced_by_cell comp_cod_arr by auto thus "src (tab\<^sub>0 f) \ f.chine" using f.induced_map_unique f.chine_is_induced_map by simp qed also have "... = Maps.Map \\f.chine\\" by simp finally show ?thesis by simp qed qed thus ?thesis unfolding Span.chine_hcomp_def using fg gh CMP_def Tgh.\\.prj_char Span.hcomp_def isomorphic_reflexive Maps.comp_CLS [of "tab\<^sub>1 g" Tgh.\\.p\<^sub>1 "tab\<^sub>1 g \ Tgh.\\.p\<^sub>1"] Tgh.cmp_def TfTgh.prj_char by simp qed also have "... = Maps.tuple \\f.chine \ TfTgh.p\<^sub>1\\ \\tab\<^sub>0 f\\ \\tab\<^sub>1 (g \ h)\\ \\Tgh_Hgh.chine \ TfTgh.p\<^sub>0\\" using isomorphic_reflexive TfHgh.composable f.is_map TfHgh.composable Tgh_Hgh.is_map Maps.comp_CLS [of f.chine TfTgh.p\<^sub>1 "f.chine \ TfTgh.p\<^sub>1"] Maps.comp_CLS [of Tgh_Hgh.chine TfTgh.p\<^sub>0 "Tgh_Hgh.chine \ TfTgh.p\<^sub>0"] by auto also have "... = \\TfTgh_TfHgh.chine\\" using TfTgh_TfHgh.CLS_chine by simp finally show ?thesis by blast qed ultimately have "Chn RHS =\\TfHgh_HfHgh.chine\\ \ \\TfTgh_TfHgh.chine\\ \ tuple_ABC" by simp also have "... = \\TfHgh_HfHgh.chine\\ \ \\TfTgh_TfHgh.chine\\ \ tuple_ABC'" using tuple_ABC_eq_ABC' by simp finally show ?thesis by simp qed interpretation g\<^sub>0h\<^sub>1: cospan_of_maps_in_bicategory_of_spans V H \ \ src trg \tab\<^sub>1 h\ \tab\<^sub>0 g\ using gh by unfold_locales auto interpretation f\<^sub>0g\<^sub>1: cospan_of_maps_in_bicategory_of_spans V H \ \ src trg \tab\<^sub>1 g\ \tab\<^sub>0 f\ using fg by unfold_locales auto interpretation f\<^sub>0gh\<^sub>1: cospan_of_maps_in_bicategory_of_spans V H \ \ src trg \tab\<^sub>1 g \ Tgh.\\.p\<^sub>1\ \tab\<^sub>0 f\ using fg gh Tgh.\\.leg1_is_map by unfold_locales auto interpretation fg\<^sub>0h\<^sub>1: cospan_of_maps_in_bicategory_of_spans V H \ \ src trg \tab\<^sub>1 h\ \tab\<^sub>0 g \ Tfg.p\<^sub>0\ using TTfgh.r\<^sub>0s\<^sub>1_is_cospan by simp lemma src_tab_eq: shows "(\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ TfTgh.composite_cell TTfgh_TfTgh.chine TTfgh_TfTgh.the_\ \ TTfgh_TfTgh.the_\ = TTfgh.tab" proof - have "TfTgh.composite_cell TTfgh_TfTgh.chine TTfgh_TfTgh.the_\ \ TTfgh_TfTgh.the_\ = (\[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ TTfgh.tab" unfolding TTfgh.tab_def using TTfgh_TfTgh.chine_is_induced_map TTfgh.tab_def TTfgh_TfTgh.\_simps(4) by auto moreover have "iso (\[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0)" by (simp add: fg gh) moreover have "inv (\[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) = \\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0" using fg gh by simp ultimately show ?thesis using TTfgh_TfTgh.\_simps(1) invert_side_of_triangle(1) [of "TfTgh.composite_cell TTfgh_TfTgh.chine TTfgh_TfTgh.the_\ \ TTfgh_TfTgh.the_\" "\[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0" TTfgh.tab] by argo qed text \ We need to show that the associativity isomorphism (defined in terms of tupling) coincides with \TTfgh_TfTgh.chine\ (defined in terms of tabulations). In order to do this, we need to know how the latter commutes with projections. That is the purpose of the following lemma. Unfortunately, it requires some lengthy calculations, which I haven't seen any way to avoid. \ lemma prj_chine: shows "\\TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine\\ = \\Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1\\" and "\\Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\ = \\Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1\\" and "\\Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\ = \\TTfgh.p\<^sub>0\\" proof - have 1: "ide TfTgh.p\<^sub>1" by (simp add: TfTgh.composable) have 2: "ide TTfgh_TfTgh.chine" by simp have 3: "src TfTgh.p\<^sub>1 = trg TTfgh_TfTgh.chine" using TTfgh_TfTgh.chine_in_hom(1) by simp have 4: "src (tab\<^sub>1 f) = trg TfTgh.p\<^sub>1" using TfTgh.leg1_simps(2) by blast text \ The required isomorphisms will each be established via \T2\, using the equation \src_tab_eq\ (associativities omitted from diagram): $$ \begin{array}{l} \xymatrix{ && \xtwocell[dddd]{}\omit{^{\rm the\_}\nu} & \scriptstyle{{\rm TTfgh}.{\rm apex}} \ar[dd]^{{\rm chine}} \ar[dddlll]_{{\rm TfTgh}.p_1} \ar[dddrrr]^{{\rm TfTgh}.p_0} & \xtwocell[dddd]{}\omit{^{\rm the\_}\theta} \\ &&&&& \\ &&& \scriptstyle{{\rm TfTgh.apex}} \ar[ddll]_{{\rm TfTgh}.p_1} \ar[dr]^{{\rm TfTgh}.p_0} && \\ \scriptstyle{f.{\rm apex}} \ar[dd]_{f.{\rm tab}_1} && \dtwocell\omit{^<-7>{f_0gh_1.\phi}} && \scriptstyle{{\rm Tgh.apex}} \ar[dl]_{{\rm Tgh}.p_1} \ar[dr]^{{\rm Tgh}.p_0} \ddtwocell\omit{^{g_0h_1.\phi}} && \scriptstyle{h.{\rm apex}} \ar[dd]^{h.{\rm tab}_0} \\ & \scriptstyle{f.{\rm apex}} \ar[dl]_{f.{\rm tab}_1} \ar[dr]^{f.{\rm tab}_0} \dtwocell\omit{^f.{\rm tab}} && \scriptstyle{g.{\rm apex}} \ar[dl]_{g.{\rm tab}_1} \ar[dr]^{g.{\rm tab}_0} \dtwocell\omit{^g.{\rm tab}} && \scriptstyle{h.{\rm apex}} \ar[dl]_{h.{\rm tab}_1} \ar[dr]^{h.{\rm tab}_0} \dtwocell\omit{^h.{\rm tab}} \\ \scriptstyle{{\rm trg}~f} && \scriptstyle{{\rm src}~f = {\rm trg}~g} \ar[ll]^{f} && \scriptstyle{{\rm src}~g = {\rm trg}~h} \ar[ll]^{g} && \scriptstyle{{\rm src}~h} \ar[ll]^{h} } \\ \\ \hspace{7cm}= \\ \\ \xymatrix{ &&& \scriptstyle{{\rm TTfgh.apex}} \ar[dl]_{{\rm TTfgh}.p_1} \ar[ddrr]^{{\rm TTfgh}.p_0} && \\ && \scriptstyle{{\rm Tfg.apex}} \ar[dl]_{{\rm Tfg}.p_1} \ar[dr]^{{\rm Tfg}.p_0} \ddtwocell\omit{^{f_0g_1.\phi}} & \dtwocell\omit{^<-7>{fg_0h_1.\phi}} &&& \\ & \scriptstyle{f.{\rm apex}} \ar[dl]_{f.{\rm tab}_1} \ar[dr]^{f.{\rm tab}_0} \dtwocell\omit{^f.{\rm tab}} && \scriptstyle{g.{\rm apex}} \ar[dl]_{g.{\rm tab}_1} \ar[dr]^{g.{\rm tab}_0} \dtwocell\omit{^g.{\rm tab}} && \scriptstyle{h.{\rm apex}} \ar[dl]_{h.{\rm tab}_1} \ar[dr]^{h.{\rm tab}_0} \dtwocell\omit{^h.{\rm tab}} \\ \scriptstyle{{\rm trg}~f} && \scriptstyle{{\rm src}~f = {\rm trg}~g} \ar[ll]^{f} && \scriptstyle{{\rm src}~g = {\rm trg}~h} \ar[ll]^{g} && \scriptstyle{{\rm src}~h} \ar[ll]^{h} } \end{array} $$ There is a sequential dependence between the proofs, such as we have already seen for \horizontal_composite_of_arrows_of_tabulations_in_maps.prj_chine\. \ define u\<^sub>f where "u\<^sub>f = g \ h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0" define w\<^sub>f where "w\<^sub>f = Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1" define w\<^sub>f' where "w\<^sub>f' = TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine" define \\<^sub>f where "\\<^sub>f = (g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (g \ h.tab \ TTfgh.p\<^sub>0) \ (g \ fg\<^sub>0h\<^sub>1.\) \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ ((g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ (f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" define \\<^sub>f' where "\\<^sub>f' = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]" define \\<^sub>f where "\\<^sub>f = \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" have w\<^sub>f: "ide w\<^sub>f" using w\<^sub>f_def fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by auto have w\<^sub>f_is_map: "is_left_adjoint w\<^sub>f" using w\<^sub>f_def fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by (simp add: left_adjoints_compose) have w\<^sub>f': "ide w\<^sub>f'" unfolding w\<^sub>f'_def by simp have w\<^sub>f'_is_map: "is_left_adjoint w\<^sub>f'" unfolding w\<^sub>f'_def using 3 TTfgh_TfTgh.is_map f\<^sub>0gh\<^sub>1.leg1_is_map by (simp add: left_adjoints_compose) have \\<^sub>f: "\\\<^sub>f : tab\<^sub>0 f \ w\<^sub>f \ u\<^sub>f\" proof (unfold \\<^sub>f_def w\<^sub>f_def u\<^sub>f_def, intro comp_in_homI) show "\\\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] : tab\<^sub>0 f \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1 \ (tab\<^sub>0 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1\" using f\<^sub>0g\<^sub>1.leg1_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.cospan g\<^sub>0h\<^sub>1.cospan by auto show "\f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1 : (tab\<^sub>0 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1 \ (tab\<^sub>1 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1\" using f\<^sub>0g\<^sub>1.\_in_hom(2) Tfg.\\.T0.antipar(1) by (intro hcomp_in_vhom, auto) show "\(g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1 : (tab\<^sub>1 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1 \ ((g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1\" using Tfg.\\.T0.antipar(1) by (intro hcomp_in_vhom, auto) show "\\[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1 : ((g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1 \ (g \ tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by (intro hcomp_in_vhom, auto) show "\\[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] : (g \ tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1 \ g \ (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by auto show "\g \ fg\<^sub>0h\<^sub>1.\ : g \ (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1 \ g \ tab\<^sub>1 h \ TTfgh.p\<^sub>0\" using fg\<^sub>0h\<^sub>1.\_in_hom fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by (intro hcomp_in_vhom, auto) show "\g \ h.tab \ TTfgh.p\<^sub>0 : g \ tab\<^sub>1 h \ TTfgh.p\<^sub>0 \ g \ (h \ tab\<^sub>0 h) \ TTfgh.p\<^sub>0\" using gh fg\<^sub>0h\<^sub>1.\_in_hom fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by (intro hcomp_in_vhom, auto) show "\g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0] : g \ (h \ tab\<^sub>0 h) \ TTfgh.p\<^sub>0 \ g \ h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0\" using gh fg\<^sub>0h\<^sub>1.\_in_hom fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by (intro hcomp_in_vhom, auto) qed have \\<^sub>f': "\\\<^sub>f' : tab\<^sub>0 f \ w\<^sub>f' \ u\<^sub>f\" proof (unfold \\<^sub>f'_def w\<^sub>f'_def u\<^sub>f_def, intro comp_in_homI) show "\\\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] : tab\<^sub>0 f \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine \ (tab\<^sub>0 f \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine\" using "1" "2" "3" "4" assoc'_in_hom(2) f.ide_u f.leg1_simps(3) by auto show "\f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine : (tab\<^sub>0 f \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine \ ((tab\<^sub>1 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine\" using f\<^sub>0gh\<^sub>1.\_in_hom(2) by (intro hcomp_in_vhom, auto) show "\((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine : ((tab\<^sub>1 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine \ (((g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine\" using f\<^sub>0gh\<^sub>1.cospan g\<^sub>0h\<^sub>1.cospan by (intro hcomp_in_vhom, auto) show "\(\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine : (((g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine \ ((g \ tab\<^sub>0 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine\" using f\<^sub>0gh\<^sub>1.cospan g\<^sub>0h\<^sub>1.cospan by (intro hcomp_in_vhom, auto) show "\((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine : ((g \ tab\<^sub>0 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine \ ((g \ tab\<^sub>1 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine\" using f\<^sub>0gh\<^sub>1.cospan g\<^sub>0h\<^sub>1.cospan g\<^sub>0h\<^sub>1.\_in_hom(2) by (intro hcomp_in_vhom, auto) show "\((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine : ((g \ tab\<^sub>1 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine \ ((g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine\" using f\<^sub>0gh\<^sub>1.cospan g\<^sub>0h\<^sub>1.cospan by (intro hcomp_in_vhom, auto) show "\can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) : ((g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine \ g \ h \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine\" using f\<^sub>0gh\<^sub>1.cospan g\<^sub>0h\<^sub>1.cospan by auto show "\g \ h \ TTfgh_TfTgh.the_\ : g \ h \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine \ g \ h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0\" using f\<^sub>0gh\<^sub>1.cospan g\<^sub>0h\<^sub>1.cospan TTfgh_TfTgh.the_\_in_hom by (intro hcomp_in_vhom, auto) qed have \\<^sub>f: "\\\<^sub>f : tab\<^sub>1 f \ w\<^sub>f \ tab\<^sub>1 f \ w\<^sub>f'\" proof (unfold \\<^sub>f_def w\<^sub>f_def w\<^sub>f'_def, intro comp_in_homI) show "\\\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] : tab\<^sub>1 f \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1 \ (tab\<^sub>1 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1\" using TTfgh.leg1_in_hom(2) assoc'_in_hom by auto show "\TTfgh_TfTgh.the_\ : (tab\<^sub>1 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1 \ (tab\<^sub>1 f \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine\" using TTfgh_TfTgh.the_\_in_hom TTfgh_TfTgh.the_\_props by simp show "\\[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] : (tab\<^sub>1 f \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine \ tab\<^sub>1 f \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine\" using 1 2 3 4 by auto qed have iso_\\<^sub>f: "iso \\<^sub>f" unfolding \\<^sub>f_def using 1 2 3 4 \\<^sub>f \\<^sub>f_def isos_compose apply (intro isos_compose) apply (metis TTfgh.composable TTfgh.leg1_in_hom(2) Tfg.\\.T0.antipar(2) Tfg.\\.T0.ide_right Tfg.\\.leg1_in_hom(2) Tfg_Hfg.u_simps(3) f.T0.antipar(2) f.T0.ide_right f.ide_leg1 f\<^sub>0g\<^sub>1.cospan g.ide_leg1 h.ide_leg1 h.leg1_simps(4) hcomp_in_vhomE ide_hcomp iso_assoc' tab\<^sub>1_simps(1)) using TTfgh_TfTgh.the_\_props(2) f.ide_leg1 iso_assoc by blast+ have u\<^sub>f: "ide u\<^sub>f" using \\<^sub>f ide_cod by blast have w\<^sub>f_in_hhom: "in_hhom w\<^sub>f (src u\<^sub>f) (src (tab\<^sub>0 f))" using u\<^sub>f w\<^sub>f u\<^sub>f_def w\<^sub>f_def by simp have w\<^sub>f'_in_hhom: "in_hhom w\<^sub>f' (src u\<^sub>f) (src (tab\<^sub>0 f))" using u\<^sub>f w\<^sub>f' w\<^sub>f'_def u\<^sub>f_def by simp have 5: "\!\. \\ : w\<^sub>f \ w\<^sub>f'\ \ \\<^sub>f = tab\<^sub>1 f \ \ \ \\<^sub>f = \\<^sub>f' \ (tab\<^sub>0 f \ \)" proof - have eq\<^sub>f: "f.composite_cell w\<^sub>f \\<^sub>f = f.composite_cell w\<^sub>f' \\<^sub>f' \ \\<^sub>f" proof - text \ I don't see any alternative here to just grinding out the calculation. The idea is to bring \f.composite_cell w\<^sub>f \\<^sub>f\ into a form in which \src_tab_eq\ can be applied to eliminate \\\<^sub>f\ in favor of \\\<^sub>f'\. \ have "f.composite_cell w\<^sub>f \\<^sub>f = ((f \ g \ \[h, tab\<^sub>0 h, fg\<^sub>0h\<^sub>1.p\<^sub>0]) \ (f \ g \ h.tab \ fg\<^sub>0h\<^sub>1.p\<^sub>0) \ (f \ g \ fg\<^sub>0h\<^sub>1.\) \ (f \ \[g, tab\<^sub>0 g \ f\<^sub>0g\<^sub>1.p\<^sub>0, fg\<^sub>0h\<^sub>1.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, f\<^sub>0g\<^sub>1.p\<^sub>0] \ fg\<^sub>0h\<^sub>1.p\<^sub>1) \ (f \ (g.tab \ f\<^sub>0g\<^sub>1.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.p\<^sub>1) \ (f \ f\<^sub>0g\<^sub>1.\ \ fg\<^sub>0h\<^sub>1.p\<^sub>1) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, f\<^sub>0g\<^sub>1.p\<^sub>1, fg\<^sub>0h\<^sub>1.p\<^sub>1])) \ \[f, tab\<^sub>0 f, f\<^sub>0g\<^sub>1.p\<^sub>1 \ fg\<^sub>0h\<^sub>1.p\<^sub>1] \ (f.tab \ f\<^sub>0g\<^sub>1.p\<^sub>1 \ fg\<^sub>0h\<^sub>1.p\<^sub>1)" unfolding w\<^sub>f_def \\<^sub>f_def using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps Tgh.composable whisker_left by simp (* 12 sec, 30 sec cpu *) also have "... = (f \ g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (f \ g \ h.tab \ TTfgh.p\<^sub>0) \ (f \ g \ fg\<^sub>0h\<^sub>1.\) \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ (f \ f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" using comp_assoc by simp also have "... = (\[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \\<^sup>-\<^sup>1[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (f \ g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0])) \ (f \ g \ h.tab \ TTfgh.p\<^sub>0) \ (f \ g \ fg\<^sub>0h\<^sub>1.\) \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ (f \ f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" proof - have "(\[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \\<^sup>-\<^sup>1[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0]) \ (f \ g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) = f \ g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_cod_arr comp_assoc_assoc' by simp thus ?thesis using comp_assoc by simp qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (f \ g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0])) \ (f \ g \ h.tab \ TTfgh.p\<^sub>0) \ (f \ g \ fg\<^sub>0h\<^sub>1.\) \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ (f \ f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" using comp_assoc by presburger also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (\\<^sup>-\<^sup>1[f, g, (h \ tab\<^sub>0 h) \ TTfgh.p\<^sub>0] \ (f \ g \ h.tab \ TTfgh.p\<^sub>0)) \ (f \ g \ fg\<^sub>0h\<^sub>1.\) \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ (f \ f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_assoc assoc'_naturality [of f g "\[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]"] by simp also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ (\\<^sup>-\<^sup>1[f, g, tab\<^sub>1 h \ TTfgh.p\<^sub>0] \ (f \ g \ fg\<^sub>0h\<^sub>1.\)) \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ (f \ f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_assoc assoc'_naturality [of f g "h.tab \ TTfgh.p\<^sub>0"] by simp also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ (f \ f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ ((f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1]) \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_assoc assoc'_naturality [of f g fg\<^sub>0h\<^sub>1.\] by simp also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ ((f \ f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \[f, tab\<^sub>0 f \ Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" proof - have "(f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1] = \[f, tab\<^sub>0 f \ Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "(f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1] = \(\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\tab\<^sub>0 f\<^bold>\, \<^bold>\Tfg.p\<^sub>1\<^bold>\, \<^bold>\TTfgh.p\<^sub>1\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\tab\<^sub>0 f\<^bold>\, \<^bold>\Tfg.p\<^sub>1\<^bold>\ \<^bold>\ \<^bold>\TTfgh.p\<^sub>1\<^bold>\\<^bold>]\" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps \'_def \_def by simp also have "... = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\tab\<^sub>0 f\<^bold>\ \<^bold>\ \<^bold>\Tfg.p\<^sub>1\<^bold>\, \<^bold>\TTfgh.p\<^sub>1\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\tab\<^sub>0 f\<^bold>\, \<^bold>\Tfg.p\<^sub>1\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TTfgh.p\<^sub>1\<^bold>\) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 f\<^bold>\, \<^bold>\Tfg.p\<^sub>1\<^bold>\, \<^bold>\TTfgh.p\<^sub>1\<^bold>\\<^bold>]\" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps by (intro E.eval_eqI, simp_all) also have "... = \[f, tab\<^sub>0 f \ Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps \'_def \_def by simp finally show ?thesis by blast qed thus ?thesis using comp_assoc by presburger qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ ((f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ \[f, tab\<^sub>1 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ ((f \ f\<^sub>0g\<^sub>1.\) \ TTfgh.p\<^sub>1) \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" proof - have "(f \ f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \[f, tab\<^sub>0 f \ Tfg.p\<^sub>1, TTfgh.p\<^sub>1] = \[f, tab\<^sub>1 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((f \ f\<^sub>0g\<^sub>1.\) \ TTfgh.p\<^sub>1)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.\_in_hom assoc_naturality [of f f\<^sub>0g\<^sub>1.\ TTfgh.p\<^sub>1] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1) \ ((f \ f\<^sub>0g\<^sub>1.\) \ TTfgh.p\<^sub>1) \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1)" proof - have "(f \ (g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ \[f, tab\<^sub>1 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] = \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.\_in_hom assoc_naturality [of f "g.tab \ Tfg.p\<^sub>0" TTfgh.p\<^sub>1] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ ((f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ ((f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1) \ ((f \ f\<^sub>0g\<^sub>1.\) \ TTfgh.p\<^sub>1) \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ ((f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps assoc'_naturality [of f.tab Tfg.p\<^sub>1 TTfgh.p\<^sub>1] comp_assoc by simp also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((((f \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ ((f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1)) \ ((f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1)) \ ((f \ f\<^sub>0g\<^sub>1.\) \ TTfgh.p\<^sub>1) \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ ((f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "(((f \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ ((f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1)) \ ((f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1) = (f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_cod_arr whisker_right comp_assoc_assoc' whisker_left [of f "\\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0]" "\[g, tab\<^sub>0 g, Tfg.p\<^sub>0]"] by simp thus ?thesis using comp_assoc by simp qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((f \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ ((f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ ((f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1) \ ((f \ f\<^sub>0g\<^sub>1.\) \ TTfgh.p\<^sub>1) \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ ((f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using comp_assoc by presburger also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((f \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ (((\[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (\\<^sup>-\<^sup>1[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1)) \ ((f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1)) \ ((f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1) \ ((f \ f\<^sub>0g\<^sub>1.\) \ TTfgh.p\<^sub>1) \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ ((f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "((\[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (\\<^sup>-\<^sup>1[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1)) \ ((f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) = (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1" using fg fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_cod_arr comp_assoc_assoc' whisker_right [of TTfgh.p\<^sub>1 "\[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0]" "\\<^sup>-\<^sup>1[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0]"] by simp thus ?thesis using comp_assoc by simp qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((f \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ (\[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ ((\\<^sup>-\<^sup>1[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ ((f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ ((f \ (g.tab \ Tfg.p\<^sub>0)) \ TTfgh.p\<^sub>1) \ ((f \ f\<^sub>0g\<^sub>1.\) \ TTfgh.p\<^sub>1) \ (\[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ TTfgh.p\<^sub>1) \ ((f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1)) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using comp_assoc by presburger also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ (\\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((f \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ (\[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1)) \ (\\<^sup>-\<^sup>1[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ (f \ (g.tab \ Tfg.p\<^sub>0)) \ (f \ f\<^sub>0g\<^sub>1.\) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps whisker_right comp_assoc by simp also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \[f \ g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\\<^sup>-\<^sup>1[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ (f \ (g.tab \ Tfg.p\<^sub>0)) \ (f \ f\<^sub>0g\<^sub>1.\) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "\\<^sup>-\<^sup>1[f, g, (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1] \ (f \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ \[f, (g \ tab\<^sub>0 g) \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ ((f \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ TTfgh.p\<^sub>1) \ (\[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\g\<^bold>\, (\<^bold>\tab\<^sub>0 g\<^bold>\ \<^bold>\ \<^bold>\Tfg.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh.p\<^sub>1\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\tab\<^sub>0 g\<^bold>\ \<^bold>\ \<^bold>\Tfg.p\<^sub>0\<^bold>\, \<^bold>\TTfgh.p\<^sub>1\<^bold>\\<^bold>]) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\tab\<^sub>0 g\<^bold>\, \<^bold>\Tfg.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TTfgh.p\<^sub>1\<^bold>\) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\f\<^bold>\, (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 g\<^bold>\) \<^bold>\ \<^bold>\Tfg.p\<^sub>0\<^bold>\, \<^bold>\TTfgh.p\<^sub>1\<^bold>\\<^bold>] \<^bold>\ ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\tab\<^sub>0 g\<^bold>\, \<^bold>\Tfg.p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\TTfgh.p\<^sub>1\<^bold>\) \<^bold>\ (\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\g\<^bold>\, \<^bold>\tab\<^sub>0 g\<^bold>\ \<^bold>\ \<^bold>\Tfg.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TTfgh.p\<^sub>1\<^bold>\)\" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps \'_def \_def by simp also have "... = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\, \<^bold>\tab\<^sub>0 g\<^bold>\ \<^bold>\ \<^bold>\Tfg.p\<^sub>0\<^bold>\, \<^bold>\TTfgh.p\<^sub>1\<^bold>\\<^bold>]\" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps by (intro E.eval_eqI, auto) also have "... = \[f \ g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps \'_def \_def by simp finally show ?thesis using comp_assoc by presburger qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((\[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \\<^sup>-\<^sup>1[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0]) \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0])) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \[f \ g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\\<^sup>-\<^sup>1[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ (f \ (g.tab \ Tfg.p\<^sub>0)) \ (f \ f\<^sub>0g\<^sub>1.\) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "(\[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \\<^sup>-\<^sup>1[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0]) \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) = ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0])" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps comp_cod_arr comp_assoc_assoc' by simp thus ?thesis by simp qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ ((f \ g) \ h.tab \ TTfgh.p\<^sub>0) \ ((f \ g) \ fg\<^sub>0h\<^sub>1.\) \ \[f \ g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\\<^sup>-\<^sup>1[f, g, tab\<^sub>0 g \ Tfg.p\<^sub>0] \ (f \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0]) \ (f \ (g.tab \ Tfg.p\<^sub>0)) \ (f \ f\<^sub>0g\<^sub>1.\) \ \[f, tab\<^sub>0 f, Tfg.p\<^sub>1] \ (f.tab \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1)) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using comp_assoc by presburger also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ TTfgh.tab \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using TTfgh.tab_def Tfg.\\.tab_def by simp also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ (f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ (g \ h.tab \ Tgh.p\<^sub>0) \ (g \ g\<^sub>0h\<^sub>1.\) \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine) \ TTfgh_TfTgh.the_\) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using src_tab_eq TfTgh.tab_def Tgh.\\.tab_def comp_assoc by simp text \Now we have to make this look like \f.composite_cell w\<^sub>f' \\<^sub>f' \ \\<^sub>f\.\ also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ (f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ (f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ (f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\)) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine) \ TTfgh_TfTgh.the_\) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ (g \ h.tab \ Tgh.p\<^sub>0) \ (g \ g\<^sub>0h\<^sub>1.\) \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0 = (f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ (f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ (f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ (f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0)" using fg gh whisker_right whisker_left by simp thus ?thesis using comp_assoc by presburger qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ (\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ ((f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine) \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ (f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ (f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ (f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ (f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine = (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ (\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ ((f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine)" (* using fg gh whisker_right [of TTfgh_TfTgh.chine] by auto (* 2 min *) *) proof - have "arr (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ (f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ (f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ (f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ (f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using fg gh by (intro seqI' comp_in_homI) auto moreover have "arr ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ (f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ (f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ (f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ (f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast moreover have "arr ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ (f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ (f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ (f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast moreover have "arr ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ (f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ (f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast moreover have "arr ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ (f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast moreover have "arr ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ (f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast moreover have "arr ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ (f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast moreover have "arr ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ (f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast moreover have "arr ((f \ f\<^sub>0gh\<^sub>1.\) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast moreover have "arr (\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ (f.tab \ TfTgh.p\<^sub>1))" using calculation by blast ultimately show ?thesis using whisker_right [of TTfgh_TfTgh.chine] TTfgh_TfTgh.is_ide by presburger qed thus ?thesis using comp_assoc by presburger qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ (\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ (((f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]) \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "((f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] = (f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps comp_arr_dom comp_assoc_assoc' by simp thus ?thesis by simp qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ (\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ (((f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using comp_assoc by presburger also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ (\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "((f.tab \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps assoc'_naturality [of f.tab TfTgh.p\<^sub>1 TTfgh_TfTgh.chine] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ (\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ ((\\<^sup>-\<^sup>1[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine]) \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine)) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "(\\<^sup>-\<^sup>1[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine]) \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) = f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps comp_cod_arr comp_assoc_assoc' by simp thus ?thesis using comp_assoc by simp qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ ((\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine]) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" using comp_assoc by presburger also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, tab\<^sub>0 f \ TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "(\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[f, tab\<^sub>0 f \ TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine])" proof - have "(\[f, tab\<^sub>0 f, TfTgh.p\<^sub>1] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f \ tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] = \(\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\tab\<^sub>0 f\<^bold>\, \<^bold>\TfTgh.p\<^sub>1\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 f\<^bold>\, \<^bold>\TfTgh.p\<^sub>1\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\tab\<^sub>0 f\<^bold>\, \<^bold>\TfTgh.p\<^sub>1\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\" using \'_def \_def by simp also have "... = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\tab\<^sub>0 f\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>1\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\tab\<^sub>0 f\<^bold>\, \<^bold>\TfTgh.p\<^sub>1\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>])\" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps by (intro E.eval_eqI, auto) also have "... = \\<^sup>-\<^sup>1[f, tab\<^sub>0 f \ TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine])" using \'_def \_def by simp finally show ?thesis by simp qed thus ?thesis using comp_assoc by presburger qed also have "... = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ h) \ (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (f \ (\\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ ((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine])) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, tab\<^sub>0 f \ TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[f, (g \ h) \ (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (f \ (\\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine)" proof - (* * This one can't be shortcut with a straight coherence-based proof, * due to the presence of f\<^sub>0gh\<^sub>1.\, g\<^sub>0h\<^sub>1.\, h.tab, with associativities that * do not respect their domain and codomain. * * I also tried to avoid distributing the "f \" in advance, in order to * reduce the number of associativity proof steps, but it then becomes * less automatic to prove the necessary "arr" facts to do the proof. * So unfortunately the mindless grind seems to be the path of least * resistance. *) have "((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ f\<^sub>0gh\<^sub>1.\) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, tab\<^sub>0 f \ TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] = ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (tab\<^sub>1 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps assoc'_naturality [of f f\<^sub>0gh\<^sub>1.\ TTfgh_TfTgh.chine] comp_assoc by simp also have "... = ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, ((g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine)" proof - have "((f \ (g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (tab\<^sub>1 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[f, ((g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps assoc'_naturality [of f "(g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0" TTfgh_TfTgh.chine] by simp thus ?thesis using comp_assoc by presburger qed also have "... = ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ tab\<^sub>0 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ (f \ (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine)" proof - have "((f \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, ((g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[f, (g \ tab\<^sub>0 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps assoc'_naturality [of f "\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0" TTfgh_TfTgh.chine] by simp thus ?thesis using comp_assoc by presburger qed also have "... = ((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ tab\<^sub>1 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ (f \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine)" proof - have "((f \ (g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ tab\<^sub>0 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[f, (g \ tab\<^sub>1 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps assoc'_naturality [of f "(g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0" TTfgh_TfTgh.chine] by simp thus ?thesis using comp_assoc by presburger qed also have "... = (((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ (f \ ((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine)" proof - have "((f \ (g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ tab\<^sub>1 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[f, (g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ ((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps assoc'_naturality [of f "(g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0" TTfgh_TfTgh.chine] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[f, (g \ h) \ (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (f \ (\\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine)" proof - (* OK, we can perhaps shortcut the last few steps... *) have "((f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0]) \ TTfgh_TfTgh.chine) \ ((f \ \\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((f \ (g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ ((\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\, \<^bold>\Tgh.p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\, (\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps \'_def \_def by simp also have "... = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\, (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\\<^bold>[\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ ((\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\, \<^bold>\Tgh.p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)\" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps apply (intro E.eval_eqI) by simp_all also have "... = \\<^sup>-\<^sup>1[f, (g \ h) \ (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (f \ (\\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using fg gh fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.p\<^sub>0_simps f\<^sub>0g\<^sub>1.p\<^sub>1_simps \'_def \_def by simp finally show ?thesis using comp_assoc by presburger qed finally show ?thesis using comp_assoc by presburger qed thus ?thesis using comp_assoc by presburger qed also have "... = (\[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\)) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ h) \ (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (f \ (\\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "(f \ ((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ (f \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]) = (f \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine])" using fg gh whisker_left by simp (* 15 sec elapsed, 30 sec cpu *) thus ?thesis using comp_assoc by presburger qed also have "... = (f \ g \ h \ TTfgh_TfTgh.the_\) \ (\[f, g, h \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ \[f \ g, h, ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g, h] \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ h) \ (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (f \ (\\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)) \ (f \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "\[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ \[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) = \[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (\[f \ g, h, tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ (((f \ g) \ h) \ TTfgh_TfTgh.the_\)) \ (\\<^sup>-\<^sup>1[f, g, h] \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" proof - have "(\\<^sup>-\<^sup>1[f, g, h] \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ ((f \ g \ h) \ TTfgh_TfTgh.the_\) = \\<^sup>-\<^sup>1[f, g, h] \ TTfgh_TfTgh.the_\" using fg gh comp_arr_dom comp_cod_arr interchange [of "\\<^sup>-\<^sup>1[f, g, h]" "f \ g \ h" "tab\<^sub>0 h \ TTfgh.p\<^sub>0" TTfgh_TfTgh.the_\] by simp also have "... = (((f \ g) \ h) \ TTfgh_TfTgh.the_\) \ (\\<^sup>-\<^sup>1[f, g, h] \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using fg gh comp_arr_dom comp_cod_arr interchange [of "(f \ g) \ h" "\\<^sup>-\<^sup>1[f, g, h]" TTfgh_TfTgh.the_\ "((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine"] by simp finally show ?thesis using comp_assoc by presburger qed also have "... = (\[f, g, h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0] \ ((f \ g) \ h \ TTfgh_TfTgh.the_\)) \ \[f \ g, h, ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g, h] \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using fg gh assoc_naturality [of "f \ g" h TTfgh_TfTgh.the_\] comp_assoc by simp also have "... = (f \ g \ h \ TTfgh_TfTgh.the_\) \ \[f, g, h \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ \[f \ g, h, ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g, h] \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using fg gh assoc_naturality [of f g "h \ TTfgh_TfTgh.the_\"] comp_assoc by simp finally show ?thesis using comp_assoc by presburger qed also have "... = ((f \ g \ h \ TTfgh_TfTgh.the_\) \ (f \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)) \ (f \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine])) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "\[f, g, h \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ \[f \ g, h, ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g, h] \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ h) \ (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (f \ (\\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) = f \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" proof - have "\[f, g, h \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ \[f \ g, h, ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g, h] \ ((tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \[f \ g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[f, g \ h, (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[f, (g \ h) \ (tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f \ \[g \ h, tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0] \ TTfgh_TfTgh.chine) \ (f \ (\\<^sup>-\<^sup>1[g, h, tab\<^sub>0 h \ Tgh.p\<^sub>0] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f \ ((g \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0]) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\g\<^bold>\, \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^bold>[\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\, \<^bold>\h\<^bold>\, ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\g\<^bold>\, \<^bold>\h\<^bold>\\<^bold>] \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ \<^bold>\\<^bold>[\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\, (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\, (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\f\<^bold>\, (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ ((\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\\<^bold>[\<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\, \<^bold>\Tgh.p\<^sub>0\<^bold>\\<^bold>]) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)\" using \'_def \_def by simp also have "... = can (\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)) (\<^bold>\f\<^bold>\ \<^bold>\ (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\))" using fg gh apply (unfold can_def) apply (intro E.eval_eqI) by simp_all also have "... = f \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" using fg gh whisker_can_left_0 by simp finally show ?thesis by blast qed thus ?thesis using comp_assoc by presburger qed also have "... = (f \ (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]) \ \[f, tab\<^sub>0 f, TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine] \ (f.tab \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>1 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]" proof - have "((f \ g \ h \ TTfgh_TfTgh.the_\) \ (f \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)) \ (f \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine])) = f \ (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine]" proof - have 1: "arr ((g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine])" using fg gh apply (intro seqI' comp_in_homI) by auto moreover have 2: "arr (can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine])" using calculation by blast ultimately show ?thesis using whisker_left f.ide_base by presburger qed thus ?thesis using comp_assoc by presburger qed also have "... = f.composite_cell w\<^sub>f' \\<^sub>f' \ \\<^sub>f" unfolding w\<^sub>f'_def \\<^sub>f'_def \\<^sub>f_def using comp_assoc by presburger finally show ?thesis by blast qed show ?thesis using w\<^sub>f w\<^sub>f' \\<^sub>f \\<^sub>f' \\<^sub>f f.T2 [of w\<^sub>f w\<^sub>f' \\<^sub>f u\<^sub>f \\<^sub>f' \\<^sub>f] eq\<^sub>f by fast qed obtain \\<^sub>f where \\<^sub>f: "\\\<^sub>f : w\<^sub>f \ w\<^sub>f'\ \ \\<^sub>f = tab\<^sub>1 f \ \\<^sub>f \ \\<^sub>f = \\<^sub>f' \ (tab\<^sub>0 f \ \\<^sub>f)" using 5 by auto show "\\TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine\\ = \\Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1\\" proof - have "iso \\<^sub>f" using \\<^sub>f BS3 w\<^sub>f_is_map w\<^sub>f'_is_map by blast hence "isomorphic w\<^sub>f w\<^sub>f'" using \\<^sub>f isomorphic_def isomorphic_symmetric by auto thus ?thesis using w\<^sub>f w\<^sub>f_def w\<^sub>f'_def Maps.CLS_eqI isomorphic_symmetric by auto qed text \ On to the next equation: \[ \\\Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\ = \\Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1\\\. \] We have to make use of the equation \\\<^sub>f = \\<^sub>f' \ (tab\<^sub>0 f \ \\<^sub>f)\ in this part, similarly to how the equation \src_tab_eq\ was used to replace \TTfgh.tab\ in the first part. \ define u\<^sub>g where "u\<^sub>g = h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0" define w\<^sub>g where "w\<^sub>g = Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1" define w\<^sub>g' where "w\<^sub>g' = Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine" define \\<^sub>g where "\\<^sub>g = \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0] \ (h.tab \ TTfgh.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.\ \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" define \\<^sub>g' where "\\<^sub>g' = (h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ ((h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" define \\<^sub>g where "\\<^sub>g = \[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[tab\<^sub>1 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ (tab\<^sub>0 f \ \\<^sub>f) \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" have u\<^sub>g: "ide u\<^sub>g" unfolding u\<^sub>g_def by simp have w\<^sub>g: "ide w\<^sub>g" unfolding w\<^sub>g_def using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by auto have w\<^sub>g_is_map: "is_left_adjoint w\<^sub>g" unfolding w\<^sub>g_def using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps left_adjoints_compose by simp have w\<^sub>g': "ide w\<^sub>g'" unfolding w\<^sub>g'_def by simp have w\<^sub>g'_is_map: "is_left_adjoint w\<^sub>g'" unfolding w\<^sub>g'_def using TTfgh_TfTgh.is_map left_adjoints_compose by simp have \\<^sub>g: "\\\<^sub>g : tab\<^sub>0 g \ w\<^sub>g \ u\<^sub>g\" using w\<^sub>g_def u\<^sub>g_def \\<^sub>g_def fg\<^sub>0h\<^sub>1.p\<^sub>1_simps fg\<^sub>0h\<^sub>1.\_in_hom by auto have \\<^sub>g': "\\\<^sub>g' : tab\<^sub>0 g \ w\<^sub>g' \ u\<^sub>g\" unfolding w\<^sub>g'_def u\<^sub>g_def \\<^sub>g'_def by (intro comp_in_homI) auto have w\<^sub>g_in_hhom: "in_hhom w\<^sub>g (src u\<^sub>g) (src (tab\<^sub>0 g))" unfolding w\<^sub>g_def u\<^sub>g_def by auto have w\<^sub>g'_in_hhom: "in_hhom w\<^sub>g' (src u\<^sub>g) (src (tab\<^sub>0 g))" unfolding w\<^sub>g'_def u\<^sub>g_def by auto have \\<^sub>g: "\\\<^sub>g : tab\<^sub>1 g \ w\<^sub>g \ tab\<^sub>1 g \ w\<^sub>g'\" proof (unfold \\<^sub>g_def w\<^sub>g_def, intro comp_in_homI) (* auto can solve this, but it's too slow *) show "\\\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] : tab\<^sub>1 g \ Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1 \ (tab\<^sub>1 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by auto show "\inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1 : (tab\<^sub>1 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1 \ (tab\<^sub>0 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.\_in_hom f\<^sub>0g\<^sub>1.\_uniqueness(2) by (intro hcomp_in_vhom) auto show "\\[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] : (tab\<^sub>0 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1 \ tab\<^sub>0 f \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps \\<^sub>f w\<^sub>f_def w\<^sub>f'_def by auto show "\tab\<^sub>0 f \ \\<^sub>f : tab\<^sub>0 f \ Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1 \ tab\<^sub>0 f \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps \\<^sub>f w\<^sub>f_def w\<^sub>f'_def by auto show "\\\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] : tab\<^sub>0 f \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine \ (tab\<^sub>0 f \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine\" by auto show "\f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine : (tab\<^sub>0 f \ TfTgh.p\<^sub>1) \ TTfgh_TfTgh.chine \ ((tab\<^sub>1 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine\" using f\<^sub>0gh\<^sub>1.\_in_hom by (intro hcomp_in_vhom) auto show "\\[tab\<^sub>1 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] : ((tab\<^sub>1 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine \ (tab\<^sub>1 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\" by auto show "\\[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] : (tab\<^sub>1 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine \ tab\<^sub>1 g \ w\<^sub>g'\" using w\<^sub>g'_def by auto qed have eq\<^sub>g: "g.composite_cell w\<^sub>g \\<^sub>g = g.composite_cell w\<^sub>g' \\<^sub>g' \ \\<^sub>g" proof - have "g.composite_cell w\<^sub>g \\<^sub>g = (g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0] \ (h.tab \ TTfgh.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.\ \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1] \ (g.tab \ Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1)" unfolding w\<^sub>g_def \\<^sub>g_def by simp also have "... = (g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (g \ h.tab \ TTfgh.p\<^sub>0) \ (g \ fg\<^sub>0h\<^sub>1.\) \ ((g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1]) \ (g.tab \ Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1)" using fg gh f\<^sub>0g\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps whisker_left comp_assoc by simp also have "... = (g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (g \ h.tab \ TTfgh.p\<^sub>0) \ (g \ fg\<^sub>0h\<^sub>1.\) \ (\[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]))) \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1] \ (g.tab \ Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1)" proof - have "(\[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) = g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_cod_arr comp_assoc_assoc' by simp thus ?thesis by (simp add: comp_assoc) qed also have "... = (g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (g \ h.tab \ TTfgh.p\<^sub>0) \ (g \ fg\<^sub>0h\<^sub>1.\) \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ \[g, tab\<^sub>0 g, Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1]) \ (g.tab \ Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1)" using comp_assoc by presburger also have "... = (g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (g \ h.tab \ TTfgh.p\<^sub>0) \ (g \ fg\<^sub>0h\<^sub>1.\) \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ (\\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (g.tab \ Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1))" using fg gh f\<^sub>0g\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>0_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_assoc pentagon' invert_opposite_sides_of_square [of "\\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1" "(\\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ (g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1])" "\\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" "\\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1]"] by simp also have "... = (g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (g \ h.tab \ TTfgh.p\<^sub>0) \ (g \ fg\<^sub>0h\<^sub>1.\) \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ ((g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps assoc'_naturality [of g.tab Tfg.p\<^sub>0 TTfgh.p\<^sub>1] by simp also have "... = (g \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]) \ (g \ h.tab \ TTfgh.p\<^sub>0) \ (g \ fg\<^sub>0h\<^sub>1.\) \ \[g, tab\<^sub>0 g \ Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ (\[g, tab\<^sub>0 g, Tfg.p\<^sub>0] \ TTfgh.p\<^sub>1) \ ((g.tab \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ (f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" proof - have "(f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] = ((f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ (\\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1]) \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1)) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" using comp_assoc by presburger also have "... = ((f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ ((tab\<^sub>0 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1) \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1)) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps whisker_right comp_assoc_assoc' by simp also have "... = ((f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1)) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0g\<^sub>1.\_uniqueness comp_cod_arr by simp also have "... = ((tab\<^sub>1 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" proof - have "(f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) = f\<^sub>0g\<^sub>1.\ \ inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1" using f\<^sub>0g\<^sub>1.\_uniqueness whisker_right by simp also have "... = (tab\<^sub>1 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1" using f\<^sub>0g\<^sub>1.\_uniqueness comp_arr_inv' by simp finally show ?thesis by simp qed also have "... = \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_cod_arr by simp finally have "(f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] = \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" by simp thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sub>f \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" unfolding \\<^sub>f_def using comp_assoc by presburger also have "... = \\<^sub>f' \ (tab\<^sub>0 f \ \\<^sub>f) \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" using \\<^sub>f comp_assoc by simp also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ (tab\<^sub>0 f \ \\<^sub>f) \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" unfolding \\<^sub>f'_def using comp_assoc by presburger also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (\\<^sup>-\<^sup>1[tab\<^sub>1 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \[tab\<^sub>1 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine)) \ \\<^sup>-\<^sup>1[tab\<^sub>0 f, TfTgh.p\<^sub>1, TTfgh_TfTgh.chine] \ (tab\<^sub>0 f \ \\<^sub>f) \ \[tab\<^sub>0 f, Tfg.p\<^sub>1, TTfgh.p\<^sub>1] \ (inv f\<^sub>0g\<^sub>1.\ \ TTfgh.p\<^sub>1) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]" proof - have "(\\<^sup>-\<^sup>1[tab\<^sub>1 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \[tab\<^sub>1 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ (f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine) = f\<^sub>0gh\<^sub>1.\ \ TTfgh_TfTgh.chine" using f\<^sub>0gh\<^sub>1.p\<^sub>0_simps comp_cod_arr comp_arr_dom comp_assoc_assoc' by simp thus ?thesis using comp_assoc by fastforce qed also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \\<^sub>g" unfolding \\<^sub>g_def using comp_assoc by presburger also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \\<^sub>g" proof - have "(((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" using f\<^sub>0gh\<^sub>1.p\<^sub>0_simps assoc'_naturality [of "(g.tab \ Tgh.p\<^sub>1)" TfTgh.p\<^sub>0 TTfgh_TfTgh.chine] by simp thus ?thesis using comp_assoc by presburger qed also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sub>g" proof - have "((g.tab \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>1 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" using g\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps assoc'_naturality [of g.tab Tgh.p\<^sub>1 "TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine"] by simp thus ?thesis using comp_assoc by presburger qed also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ ((\\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)) \ \\<^sub>g" proof - have "(\\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) = g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine" using comp_cod_arr comp_assoc_assoc' by simp thus ?thesis using comp_assoc g\<^sub>0h\<^sub>1.\_in_hom by simp qed also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)) \ \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ ((\\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)) \ \\<^sub>g" proof - have "(\\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) = (\\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((g \ (tab\<^sub>0 g \ Tgh.p\<^sub>1)) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using g\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps comp_assoc comp_assoc_assoc' by simp also have "... = (\\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using g\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps comp_cod_arr comp_assoc_assoc' by simp also have "... = (((g \ (tab\<^sub>0 g \ Tgh.p\<^sub>1)) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine)" using g\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps whisker_right comp_assoc_assoc' by simp also have "... = (\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine" using g\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps comp_cod_arr by simp finally show ?thesis by presburger qed also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ ((((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (\\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)) \ \\<^sub>g" using comp_assoc by presburger also have "... = (g \ h \ TTfgh_TfTgh.the_\) \ (can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ \\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ (g \ (h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (g \ g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (\[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sub>g" proof - have "(((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g \ (h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (g \ g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" proof - have "(((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ (((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ ((((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" using comp_assoc by presburger also have "... = ((((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g \ tab\<^sub>1 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine]) \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" proof - have "(((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[g \ tab\<^sub>1 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" using gh f\<^sub>0gh\<^sub>1.p\<^sub>0_simps assoc'_naturality [of "g \ g\<^sub>0h\<^sub>1.\" TfTgh.p\<^sub>0 TTfgh_TfTgh.chine] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ ((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" proof - have "(((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g \ tab\<^sub>1 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" using gh f\<^sub>0gh\<^sub>1.p\<^sub>0_simps assoc'_naturality [of "g \ h.tab \ Tgh.p\<^sub>0" TfTgh.p\<^sub>0 TTfgh_TfTgh.chine] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ (((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g, tab\<^sub>1 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ (g \ g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" proof - have "((g \ g\<^sub>0h\<^sub>1.\) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[g, tab\<^sub>1 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g \ g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" using gh f\<^sub>0gh\<^sub>1.p\<^sub>0_simps assoc'_naturality [of g g\<^sub>0h\<^sub>1.\ "TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine"] by simp thus ?thesis using comp_assoc by presburger qed also have "... = \\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g \ (h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (g \ g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" proof - have "((g \ h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[g, tab\<^sub>1 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = \\<^sup>-\<^sup>1[g, (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g \ (h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)" using gh f\<^sub>0gh\<^sub>1.p\<^sub>0_simps assoc'_naturality [of g "h.tab \ Tgh.p\<^sub>0" "TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine"] by simp thus ?thesis using comp_assoc by presburger qed finally show ?thesis by simp qed thus ?thesis using comp_assoc by presburger qed also have "... = ((g \ h \ TTfgh_TfTgh.the_\) \ (g \ can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)) \ (g \ (h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (g \ g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine])) \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sub>g" proof - have "can (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ \\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = g \ can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" proof - have "\\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = can (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) ((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" proof - have "\\<^sup>-\<^sup>1[g \ (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\" using gh f\<^sub>0gh\<^sub>1.p\<^sub>0_simps canI_associator_0 \'_def \_def by simp also have "... = can (((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) ((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" unfolding can_def using gh apply (intro E.eval_eqI) by simp_all finally show ?thesis by blast qed moreover have "\\<^sup>-\<^sup>1[g, (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = can ((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\g\<^bold>\ \<^bold>\ ((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" proof - have "\\<^sup>-\<^sup>1[g, (h \ tab\<^sub>0 h) \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\g\<^bold>\, (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\" using gh f\<^sub>0gh\<^sub>1.p\<^sub>0_simps canI_associator_0 \'_def \_def by simp also have "... = can ((\<^bold>\g\<^bold>\ \<^bold>\ (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\g\<^bold>\ \<^bold>\ ((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" unfolding can_def using gh apply (intro E.eval_eqI) by simp_all finally show ?thesis by blast qed ultimately show ?thesis using gh whisker_can_left_0 by simp qed moreover have "\[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" proof - have "\[g, tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[g \ tab\<^sub>0 g \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ ((\[g, tab\<^sub>0 g, Tgh.p\<^sub>1] \ TfTgh.p\<^sub>0) \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[(g \ tab\<^sub>0 g) \ Tgh.p\<^sub>1, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g \ tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] = \\<^bold>\\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\tab\<^sub>0 g\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>1\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^bold>[\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 g\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>1\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ ((\<^bold>\\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\tab\<^sub>0 g\<^bold>\, \<^bold>\Tgh.p\<^sub>1\<^bold>\\<^bold>] \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[(\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 g\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>1\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 g\<^bold>\, \<^bold>\Tgh.p\<^sub>1\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\g\<^bold>\, \<^bold>\tab\<^sub>0 g\<^bold>\, \<^bold>\Tgh.p\<^sub>1\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\" using gh g\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps \'_def \_def by simp also have "... = \\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\tab\<^sub>0 g\<^bold>\, \<^bold>\Tgh.p\<^sub>1\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\" apply (intro E.eval_eqI) by simp_all also have "... = g \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" using gh g\<^sub>0h\<^sub>1.p\<^sub>1_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps \'_def \_def by simp finally show ?thesis by simp qed ultimately show ?thesis using comp_assoc by presburger qed also have "... = (g \ (h \ TTfgh_TfTgh.the_\) \ (can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)) \ ((h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \[g, tab\<^sub>0 g, Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g.tab \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sub>g" using gh whisker_left by auto (* 11 sec *) also have "... = g.composite_cell w\<^sub>g' \\<^sub>g' \ \\<^sub>g" unfolding w\<^sub>g'_def \\<^sub>g'_def using comp_assoc by presburger finally show ?thesis by blast qed have 6: "\!\. \\ : w\<^sub>g \ w\<^sub>g'\ \ \\<^sub>g = tab\<^sub>1 g \ \ \ \\<^sub>g = \\<^sub>g' \ (tab\<^sub>0 g \ \)" using w\<^sub>g w\<^sub>g' \\<^sub>g \\<^sub>g' \\<^sub>g eq\<^sub>g g.T2 [of w\<^sub>g w\<^sub>g' \\<^sub>g u\<^sub>g \\<^sub>g' \\<^sub>g] by blast obtain \\<^sub>g where \\<^sub>g: "\\\<^sub>g : w\<^sub>g \ w\<^sub>g'\ \ \\<^sub>g = tab\<^sub>1 g \ \\<^sub>g \ \\<^sub>g = \\<^sub>g' \ (tab\<^sub>0 g \ \\<^sub>g)" using 6 by auto show "\\Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\ = \\Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1\\" proof - have "iso \\<^sub>g" using \\<^sub>g BS3 w\<^sub>g_is_map w\<^sub>g'_is_map by blast hence "isomorphic w\<^sub>g w\<^sub>g'" using \\<^sub>g isomorphic_def isomorphic_symmetric by auto thus ?thesis using w\<^sub>g w\<^sub>g' w\<^sub>g_def w\<^sub>g'_def Maps.CLS_eqI by auto qed text \Now the last equation: similar, but somewhat simpler.\ define u\<^sub>h where "u\<^sub>h = tab\<^sub>0 h \ TTfgh.p\<^sub>0" define w\<^sub>h where "w\<^sub>h = TTfgh.p\<^sub>0" define w\<^sub>h' where "w\<^sub>h' = Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine" define \\<^sub>h where "\\<^sub>h = tab\<^sub>0 h \ TTfgh.p\<^sub>0" define \\<^sub>h' where "\\<^sub>h' = TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" define \\<^sub>h where "\\<^sub>h = \[tab\<^sub>1 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" have u\<^sub>h: "ide u\<^sub>h" unfolding u\<^sub>h_def by simp have w\<^sub>h: "ide w\<^sub>h" unfolding w\<^sub>h_def by simp have w\<^sub>h_is_map: "is_left_adjoint w\<^sub>h" unfolding w\<^sub>h_def by simp have w\<^sub>h': "ide w\<^sub>h'" unfolding w\<^sub>h'_def by simp have w\<^sub>h'_is_map: "is_left_adjoint w\<^sub>h'" unfolding w\<^sub>h'_def using g\<^sub>0h\<^sub>1.p\<^sub>0_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps TTfgh_TfTgh.is_map left_adjoints_compose by simp have \\<^sub>h: "\\\<^sub>h : tab\<^sub>0 h \ w\<^sub>h \ u\<^sub>h\" unfolding \\<^sub>h_def w\<^sub>h_def u\<^sub>h_def by auto have \\<^sub>h': "\\\<^sub>h' : tab\<^sub>0 h \ w\<^sub>h' \ u\<^sub>h\" unfolding \\<^sub>h'_def w\<^sub>h'_def u\<^sub>h_def using g\<^sub>0h\<^sub>1.p\<^sub>0_simps f\<^sub>0gh\<^sub>1.p\<^sub>0_simps by (intro comp_in_homI) auto have \\<^sub>h: "\\\<^sub>h : tab\<^sub>1 h \ w\<^sub>h \ tab\<^sub>1 h \ w\<^sub>h'\" proof (unfold \\<^sub>h_def w\<^sub>h_def w\<^sub>h'_def, intro comp_in_homI) (* auto can solve this, but it's too slow *) show "\inv fg\<^sub>0h\<^sub>1.\ : tab\<^sub>1 h \ TTfgh.p\<^sub>0 \ (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1\" using fg\<^sub>0h\<^sub>1.\_uniqueness by blast show "\\[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] : (tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1 \ tab\<^sub>0 g \ Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by auto show "\tab\<^sub>0 g \ \\<^sub>g : tab\<^sub>0 g \ Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1 \ tab\<^sub>0 g \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\" using \\<^sub>g w\<^sub>g_def w\<^sub>g'_def fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by auto show "\\\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] : tab\<^sub>0 g \ Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine \ (tab\<^sub>0 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by auto show "\g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine : (tab\<^sub>0 g \ Tgh.p\<^sub>1) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine \ (tab\<^sub>1 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by force show "\\[tab\<^sub>1 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] : (tab\<^sub>1 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine \ tab\<^sub>1 h \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps by auto qed have eq\<^sub>h: "h.composite_cell w\<^sub>h \\<^sub>h = h.composite_cell w\<^sub>h' \\<^sub>h' \ \\<^sub>h" proof - text \ Once again, the strategy is to form the subexpression \[ \\[h, tab\<^sub>0 h, TTfgh.p\<^sub>0] \ (h.tab \ TTfgh.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.\ \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]\ \] which is equal to \\\<^sub>g\, so that we can make use of the equation \\\<^sub>g = \\<^sub>g' \ (tab\<^sub>0 g \ \\<^sub>g)\. \ have "h.composite_cell w\<^sub>h \\<^sub>h = (h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0] \ (h.tab \ TTfgh.p\<^sub>0)" unfolding w\<^sub>h_def \\<^sub>h_def by simp also have "... = \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0] \ (h.tab \ TTfgh.p\<^sub>0)" proof - have "(h \ tab\<^sub>0 h \ TTfgh.p\<^sub>0) \ \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0] = \[h, tab\<^sub>0 h, TTfgh.p\<^sub>0]" using comp_cod_arr by simp thus ?thesis using comp_assoc by metis qed also have "... = (\[h, tab\<^sub>0 h, TTfgh.p\<^sub>0] \ (h.tab \ TTfgh.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.\ \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" proof - have "(h.tab \ TTfgh.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.\ \ (\\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ inv fg\<^sub>0h\<^sub>1.\ = (h.tab \ TTfgh.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.\ \ ((tab\<^sub>0 g \ Tfg.p\<^sub>0) \ TTfgh.p\<^sub>1) \ inv fg\<^sub>0h\<^sub>1.\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps comp_assoc_assoc' by simp also have "... = (h.tab \ TTfgh.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.\ \ inv fg\<^sub>0h\<^sub>1.\" using fg\<^sub>0h\<^sub>1.p\<^sub>1_simps fg\<^sub>0h\<^sub>1.\_uniqueness comp_cod_arr by simp also have "... = (h.tab \ TTfgh.p\<^sub>0) \ (tab\<^sub>1 h \ TTfgh.p\<^sub>0)" using comp_arr_inv' fg\<^sub>0h\<^sub>1.\_uniqueness by simp also have "... = h.tab \ TTfgh.p\<^sub>0" using comp_arr_dom fg\<^sub>0h\<^sub>1.p\<^sub>0_simps by simp finally have "(h.tab \ TTfgh.p\<^sub>0) \ fg\<^sub>0h\<^sub>1.\ \ (\\<^sup>-\<^sup>1[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1]) \ inv fg\<^sub>0h\<^sub>1.\ = h.tab \ TTfgh.p\<^sub>0" by simp thus ?thesis using comp_assoc by simp qed also have "... = \\<^sub>g \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" unfolding \\<^sub>g_def by simp also have "... = (\\<^sub>g' \ (tab\<^sub>0 g \ \\<^sub>g)) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" using \\<^sub>g by simp also have "... = (h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ ((h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" unfolding \\<^sub>g'_def using comp_assoc by presburger also have "... = (h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ ((\\<^sup>-\<^sup>1[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ ((h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)) \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" proof - have "(\\<^sup>-\<^sup>1[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ ((h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) = (h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine" using comp_cod_arr comp_assoc_assoc' by simp thus ?thesis using comp_assoc by simp qed also have "... = (h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ \\<^sup>-\<^sup>1[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (\[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ ((h.tab \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)) \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" using comp_assoc by presburger also have "... = (h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ \\<^sup>-\<^sup>1[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (h.tab \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" using assoc_naturality [of h.tab Tgh.p\<^sub>0 "TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine"] comp_assoc by simp also have "... = (h \ TTfgh_TfTgh.the_\) \ can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ \\<^sup>-\<^sup>1[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ ((\\<^sup>-\<^sup>1[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ (h.tab \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine)) \ \[tab\<^sub>1 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" proof - have "(\\<^sup>-\<^sup>1[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ (h.tab \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) = h.tab \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine" using comp_cod_arr comp_assoc_assoc' by simp thus ?thesis using comp_assoc by simp qed also have "... = (h \ TTfgh_TfTgh.the_\) \ (can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (\\<^sup>-\<^sup>1[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine])) \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (h.tab \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" using comp_assoc by presburger also have "... = ((h \ TTfgh_TfTgh.the_\) \ (h \ can (((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\))) \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (h.tab \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" proof - have "can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (\\<^sup>-\<^sup>1[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) = can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\, \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\, \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\" using \'_def \_def by simp also have "... = can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ can (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" proof - have "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\, \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\h\<^bold>\, \<^bold>\tab\<^sub>0 h\<^bold>\, \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\ = can (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" unfolding can_def apply (intro E.eval_eqI) by simp_all thus ?thesis by simp qed also have "... = can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" by simp also have "... = h \ can (((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" using whisker_can_left_0 by simp finally have "can (\<^bold>\h\<^bold>\ \<^bold>\ ((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (((\<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\tab\<^sub>0 h\<^bold>\) \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) \ (\\<^sup>-\<^sup>1[h \ tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) = h \ can (((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)" by simp thus ?thesis using comp_assoc by presburger qed also have "... = (h \ TTfgh_TfTgh.the_\ \ can (((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\)) \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (h.tab \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" using whisker_left [of h] comp_assoc by simp also have "... = (h \ TTfgh_TfTgh.the_\ \ \\<^sup>-\<^sup>1[tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]) \ \[h, tab\<^sub>0 h, Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (h.tab \ Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \[tab\<^sub>1 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (g\<^sub>0h\<^sub>1.\ \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine) \ \\<^sup>-\<^sup>1[tab\<^sub>0 g, Tgh.p\<^sub>1, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine] \ (tab\<^sub>0 g \ \\<^sub>g) \ \[tab\<^sub>0 g, Tfg.p\<^sub>0, TTfgh.p\<^sub>1] \ inv fg\<^sub>0h\<^sub>1.\" proof - have "can (((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\, \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>] \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[\<^bold>\tab\<^sub>0 h\<^bold>\, \<^bold>\Tgh.p\<^sub>0\<^bold>\, \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\\<^bold>]\" unfolding can_def apply (intro E.eval_eqI) by auto also have "... = \\<^sup>-\<^sup>1[tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" using \'_def \_def by simp finally have "can (((\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\) \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) (\<^bold>\tab\<^sub>0 h\<^bold>\ \<^bold>\ \<^bold>\Tgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TfTgh.p\<^sub>0\<^bold>\ \<^bold>\ \<^bold>\TTfgh_TfTgh.chine\<^bold>\) = \\<^sup>-\<^sup>1[tab\<^sub>0 h \ Tgh.p\<^sub>0, TfTgh.p\<^sub>0, TTfgh_TfTgh.chine] \ \\<^sup>-\<^sup>1[tab\<^sub>0 h, Tgh.p\<^sub>0, TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine]" by simp thus ?thesis by simp qed also have "... = h.composite_cell w\<^sub>h' \\<^sub>h' \ \\<^sub>h" unfolding w\<^sub>h'_def \\<^sub>h'_def \\<^sub>h_def using comp_assoc by presburger finally show ?thesis by simp qed have 7: "\!\. \\ : w\<^sub>h \ w\<^sub>h'\ \ \\<^sub>h = tab\<^sub>1 h \ \ \ \\<^sub>h = \\<^sub>h' \ (tab\<^sub>0 h \ \)" using w\<^sub>h w\<^sub>h' \\<^sub>h \\<^sub>h' \\<^sub>h eq\<^sub>h h.T2 [of w\<^sub>h w\<^sub>h' \\<^sub>h u\<^sub>h \\<^sub>h' \\<^sub>h] by blast obtain \\<^sub>h where \\<^sub>h: "\\\<^sub>h : w\<^sub>h \ w\<^sub>h'\ \ \\<^sub>h = tab\<^sub>1 h \ \\<^sub>h \ \\<^sub>h = \\<^sub>h' \ (tab\<^sub>0 h \ \\<^sub>h)" using 7 by auto show "\\Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\ = \\TTfgh.p\<^sub>0\\" proof - have "iso \\<^sub>h" using \\<^sub>h BS3 w\<^sub>h_is_map w\<^sub>h'_is_map by blast hence "isomorphic w\<^sub>h w\<^sub>h'" using \\<^sub>h isomorphic_def isomorphic_symmetric by auto thus ?thesis using w\<^sub>h w\<^sub>h' w\<^sub>h_def w\<^sub>h'_def Maps.CLS_eqI [of w\<^sub>h w\<^sub>h'] by simp qed qed text \ Finally, we can show that @{term TTfgh_TfTgh.chine} is given by tupling. \ lemma CLS_chine: shows "\\TTfgh_TfTgh.chine\\ = tuple_ABC" proof - have "tuple_ABC = SPN_fgh.chine_assoc" using SPN_fgh.chine_assoc_def by simp also have "... = \\TTfgh_TfTgh.chine\\" proof (intro Maps.arr_eqI) show "Maps.arr SPN_fgh.chine_assoc" using SPN_fgh.chine_assoc_in_hom by auto show "Maps.arr \\TTfgh_TfTgh.chine\\" using Maps.CLS_in_hom TTfgh_TfTgh.is_map by blast show "Maps.Dom SPN_fgh.chine_assoc = Maps.Dom \\TTfgh_TfTgh.chine\\" using SPN_fgh.chine_assoc_def Maps.dom_char tuple_ABC_in_hom TTfgh_TfTgh.chine_in_hom by fastforce show "Maps.Cod SPN_fgh.chine_assoc = Maps.Cod \\TTfgh_TfTgh.chine\\" proof - have "Maps.Cod SPN_fgh.chine_assoc = Maps.Cod tuple_ABC" using SPN_fgh.chine_assoc_def by simp also have "... = src (prj\<^sub>0 (tab\<^sub>1 g \ prj\<^sub>1 (tab\<^sub>1 h) (tab\<^sub>0 g)) (tab\<^sub>0 f))" by (metis (lifting) Maps.Dom.simps(1) Maps.seq_char SPN_fgh.prj_chine_assoc(1) SPN_fgh.prj_simps(1) calculation f\<^sub>0gh\<^sub>1.leg1_simps(3) prj_char(4)) also have "... = Maps.Cod \\TTfgh_TfTgh.chine\\" using Maps.cod_char TTfgh_TfTgh.chine_in_hom by simp finally show ?thesis by blast qed show "Maps.Map SPN_fgh.chine_assoc = Maps.Map \\TTfgh_TfTgh.chine\\" proof - have 0: "Chn (Span.hcomp (SPN f) (Span.hcomp (SPN g) (SPN h))) = Maps.MkIde (src TfTgh.p\<^sub>0)" using fg gh by (metis (mono_tags, lifting) Maps.in_homE Maps.seqE SPN_fgh.prj_chine_assoc(1) SPN_fgh.prj_simps(1) SPN_fgh.prj_simps(13) calculation tuple_ABC_in_hom) have "tuple_ABC = \\TTfgh_TfTgh.chine\\" proof (intro Maps.prj_joint_monic [of SPN_fgh.\.leg0 "SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1" tuple_ABC "\\TTfgh_TfTgh.chine\\"]) show "Maps.cospan SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" using SPN_fgh.\\.dom.is_span SPN_fgh.\\.leg1_composite SPN_fgh.cospan_\\ by auto show "Maps.seq SPN_fgh.Prj\<^sub>1 tuple_ABC" using 0 tuple_ABC_in_hom SPN_fgh.prj_in_hom(4) by auto show "Maps.seq SPN_fgh.Prj\<^sub>1 \\TTfgh_TfTgh.chine\\" proof show "Maps.in_hom \\TTfgh_TfTgh.chine\\ \\src TTfgh_TfTgh.chine\\ \\trg TTfgh_TfTgh.chine\\" using fg gh TTfgh_TfTgh.chine_in_hom Maps.CLS_in_hom TTfgh_TfTgh.is_map by blast show "Maps.in_hom SPN_fgh.Prj\<^sub>1 \\trg TTfgh_TfTgh.chine\\ SPN_fgh.\.apex" proof show "Maps.cospan SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" using SPN_fgh.prj_in_hom(4) by blast show "\\trg TTfgh_TfTgh.chine\\ = Maps.pbdom SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" proof - have "\\trg TTfgh_TfTgh.chine\\ = Maps.MkIde (src TfTgh.p\<^sub>0)" by simp also have "... = Maps.pbdom SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" using 0 Maps.pbdom_def SPN_fgh.chine_composite(2) by presburger finally show ?thesis by blast qed show "SPN_fgh.\.apex = Maps.dom SPN_fgh.\.leg0" using SPN_f.dom.apex_def by blast qed qed have 2: "Maps.commutative_square SPN_fgh.\.leg0 SPN_fgh.\.leg1 SPN_fgh.Prj\<^sub>0\<^sub>1 SPN_fgh.Prj\<^sub>0" proof show "Maps.cospan SPN_fgh.\.leg0 SPN_fgh.\.leg1" using SPN_fgh.\\.legs_form_cospan(1) by simp show "Maps.span SPN_fgh.Prj\<^sub>0\<^sub>1 SPN_fgh.Prj\<^sub>0" using SPN_fgh.prj_simps(2-3,5-6) by presburger show "Maps.dom SPN_fgh.\.leg0 = Maps.cod SPN_fgh.Prj\<^sub>0\<^sub>1" using SPN_fgh.prj_simps(8) SPN_g.dom.is_span SPN_g.dom.leg_simps(2) by auto show "SPN_fgh.\.leg0 \ SPN_fgh.Prj\<^sub>0\<^sub>1 = SPN_fgh.\.leg1 \ SPN_fgh.Prj\<^sub>0" by (metis (no_types, lifting) Maps.cod_comp Maps.comp_assoc Maps.pullback_commutes' SPN_fgh.\\.dom.leg_simps(1) SPN_fgh.\\.leg0_composite SPN_fgh.cospan_\\) qed have 1: "Maps.commutative_square SPN_fgh.\.leg0 (Maps.comp SPN_fgh.\.leg1 SPN_fgh.\\.prj\<^sub>1) SPN_fgh.Prj\<^sub>1\<^sub>1 tuple_BC" proof show "Maps.cospan SPN_fgh.\.leg0 (Maps.comp SPN_fgh.\.leg1 SPN_fgh.\\.prj\<^sub>1)" using fg gh SPN_fgh.prj_simps(10) by blast show "Maps.span SPN_fgh.Prj\<^sub>1\<^sub>1 tuple_BC" using fg gh csq(2) by blast show "Maps.dom SPN_fgh.\.leg0 = Maps.cod SPN_fgh.Prj\<^sub>1\<^sub>1" using fg gh SPN_f.dom.leg_simps(2) SPN_fgh.prj_simps(7) by auto show "SPN_fgh.\.leg0 \ SPN_fgh.Prj\<^sub>1\<^sub>1 = (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ tuple_BC" using 2 fg gh Maps.comp_assoc csq(2) Maps.prj_tuple [of SPN_fgh.\.leg0 SPN_fgh.\.leg1 SPN_fgh.Prj\<^sub>0\<^sub>1 SPN_fgh.Prj\<^sub>0] by blast qed show "SPN_fgh.Prj\<^sub>1 \ tuple_ABC = SPN_fgh.Prj\<^sub>1 \ Maps.CLS TTfgh_TfTgh.chine" proof - have "SPN_fgh.Prj\<^sub>1 \ tuple_ABC = SPN_fgh.Prj\<^sub>1\<^sub>1" using csq(2) by simp also have "... = \\Tfg.p\<^sub>1 \ TTfgh.p\<^sub>1\\" using prj_char by simp also have "... = \\TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine\\" using prj_chine(1) by simp also have "... = \\TfTgh.p\<^sub>1\\ \ \\TTfgh_TfTgh.chine\\" proof - have "is_left_adjoint TfTgh.p\<^sub>1" by (simp add: fg) moreover have "is_left_adjoint TTfgh_TfTgh.chine" using TTfgh_TfTgh.is_map by simp moreover have "TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine \ TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine" using fg gh isomorphic_reflexive by simp ultimately show ?thesis using Maps.comp_CLS [of TfTgh.p\<^sub>1 TTfgh_TfTgh.chine "TfTgh.p\<^sub>1 \ TTfgh_TfTgh.chine"] by simp qed also have "... = SPN_fgh.Prj\<^sub>1 \ Maps.CLS TTfgh_TfTgh.chine" using prj_char by simp finally show ?thesis by blast qed show "Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ tuple_ABC = Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\" proof - have "Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ tuple_ABC = tuple_BC" using csq(2) Maps.prj_tuple [of SPN_fgh.\.leg0 "SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1" SPN_fgh.Prj\<^sub>1\<^sub>1 tuple_BC] by simp also have "... = Maps.comp (Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (Maps.comp SPN_fgh.\.leg1 SPN_fgh.\\.prj\<^sub>1)) \\TTfgh_TfTgh.chine\\" proof (intro Maps.prj_joint_monic [of SPN_fgh.\.leg0 SPN_fgh.\.leg1 tuple_BC "Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\"]) show "Maps.cospan SPN_fgh.\.leg0 SPN_fgh.\.leg1" using SPN_fgh.\\.legs_form_cospan(1) by simp show "Maps.seq SPN_fgh.\\.prj\<^sub>1 tuple_BC" proof show "Maps.in_hom tuple_BC (Maps.MkIde (src TTfgh.p\<^sub>0)) (Maps.MkIde (src Tgh.p\<^sub>0))" using tuple_BC_in_hom by simp show "Maps.in_hom SPN_fgh.\\.prj\<^sub>1 (Maps.MkIde (src Tgh.p\<^sub>0)) SPN_fgh.\.apex" proof - have "Maps.pbdom SPN_fgh.\.leg0 SPN_fgh.\.leg1 = Maps.MkIde (src Tgh.p\<^sub>0)" using fg gh Maps.pbdom_def by (metis (no_types, lifting) SPN.preserves_ide SPN_fgh.\\.are_identities(2) SPN_fgh.\\.composable Span.chine_hcomp_ide_ide Tgh.chine_hcomp_SPN_SPN g.is_ide) thus ?thesis using SPN_fgh.\\.prj_in_hom(1) by simp qed qed show "Maps.seq SPN_fgh.\\.prj\<^sub>1 (Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\)" proof show "Maps.in_hom SPN_fgh.\\.prj\<^sub>1 (Maps.pbdom SPN_fgh.\.leg0 SPN_fgh.\.leg1) SPN_fgh.\.apex" using SPN_fgh.\\.prj_in_hom(1) by simp show "Maps.in_hom (Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\) \\src TTfgh_TfTgh.chine\\ (Maps.pbdom SPN_fgh.\.leg0 SPN_fgh.\.leg1)" proof show "Maps.in_hom \\TTfgh_TfTgh.chine\\ \\src TTfgh_TfTgh.chine\\ \\trg TTfgh_TfTgh.chine\\" using fg gh TTfgh_TfTgh.chine_in_hom Maps.CLS_in_hom TTfgh_TfTgh.is_map by blast show "Maps.in_hom (Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)) \\trg TTfgh_TfTgh.chine\\ (Maps.pbdom SPN_fgh.\.leg0 SPN_fgh.\.leg1)" proof show "Maps.cospan SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" using SPN_fgh.prj_in_hom(4) by blast show "\\trg TTfgh_TfTgh.chine\\ = Maps.pbdom SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" proof - have "\\trg TTfgh_TfTgh.chine\\ = Maps.MkIde (src TfTgh.p\<^sub>0)" by simp also have "... = Maps.pbdom SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" using 0 Maps.pbdom_def SPN_fgh.chine_composite(2) by presburger finally show ?thesis by blast qed show "Maps.pbdom SPN_fgh.\.leg0 SPN_fgh.\.leg1 = Maps.dom (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1)" using fg gh Maps.pbdom_def SPN_fgh.\\.apex_composite SPN_fgh.\\.dom.apex_def SPN_fgh.\\.dom.is_span SPN_fgh.\\.leg1_composite by presburger qed qed qed show "SPN_fgh.\\.prj\<^sub>0 \ tuple_BC = SPN_fgh.\\.prj\<^sub>0 \ Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\" proof - have "SPN_fgh.\\.prj\<^sub>0 \ tuple_BC = SPN_fgh.Prj\<^sub>0" using csq(1) by simp also have "... = SPN_fgh.\\.prj\<^sub>0 \ Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\" proof - have "SPN_fgh.\\.prj\<^sub>0 \ Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\ = \\Tgh.p\<^sub>0\\ \ \\TfTgh.p\<^sub>0\\ \ \\TTfgh_TfTgh.chine\\" using fg gh Tgh.\\.prj_char TfTgh.prj_char(1) isomorphic_reflexive Maps.comp_CLS [of "tab\<^sub>1 g" "prj\<^sub>1 (tab\<^sub>1 h) (tab\<^sub>0 g)" "tab\<^sub>1 g \ Tgh.p\<^sub>1"] by simp also have "... = \\Tgh.p\<^sub>0\\ \ \\TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\" using fg gh TTfgh_TfTgh.is_map isomorphic_reflexive Maps.comp_CLS [of TfTgh.p\<^sub>0 TTfgh_TfTgh.chine "TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine"] by simp also have "... = \\Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\" using fg gh TTfgh_TfTgh.is_map left_adjoints_compose isomorphic_reflexive Maps.comp_CLS [of Tgh.p\<^sub>0 "TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine" "Tgh.p\<^sub>0 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine"] by simp also have "... = \\TTfgh.p\<^sub>0\\" using prj_chine(3) by simp also have "... = SPN_fgh.Prj\<^sub>0" using prj_char by simp finally show ?thesis by argo qed finally show ?thesis by blast qed show "SPN_fgh.\\.prj\<^sub>1 \ tuple_BC = SPN_fgh.\\.prj\<^sub>1 \ Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\" proof - have "SPN_fgh.\\.prj\<^sub>1 \ tuple_BC = SPN_fgh.Prj\<^sub>0\<^sub>1" using csq(1) by simp also have "... = SPN_fgh.\\.prj\<^sub>1 \ Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\" proof - have "SPN_fgh.\\.prj\<^sub>1 \ Maps.PRJ\<^sub>0 SPN_fgh.\.leg0 (SPN_fgh.\.leg1 \ SPN_fgh.\\.prj\<^sub>1) \ \\TTfgh_TfTgh.chine\\ = \\Tgh.p\<^sub>1\\ \ \\TfTgh.p\<^sub>0\\ \ \\TTfgh_TfTgh.chine\\" using fg gh Tgh.\\.prj_char TfTgh.prj_char(1) isomorphic_reflexive Maps.comp_CLS [of "tab\<^sub>1 g" "prj\<^sub>1 (tab\<^sub>1 h) (tab\<^sub>0 g)" "tab\<^sub>1 g \ Tgh.p\<^sub>1"] by simp also have "... = \\Tgh.p\<^sub>1\\ \ \\TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\" using fg gh TTfgh_TfTgh.is_map isomorphic_reflexive Maps.comp_CLS [of TfTgh.p\<^sub>0 TTfgh_TfTgh.chine "TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine"] by simp also have "... = \\Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine\\" using fg gh TTfgh_TfTgh.is_map left_adjoints_compose isomorphic_reflexive Maps.comp_CLS [of Tgh.p\<^sub>1 "TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine" "Tgh.p\<^sub>1 \ TfTgh.p\<^sub>0 \ TTfgh_TfTgh.chine"] by simp also have "... = \\Tfg.p\<^sub>0 \ TTfgh.p\<^sub>1\\" using prj_chine(2) by simp also have "... = SPN_fgh.Prj\<^sub>0\<^sub>1" using prj_char by simp finally show ?thesis by argo qed finally show ?thesis by blast qed qed finally show ?thesis by simp qed qed thus ?thesis using SPN_fgh.chine_assoc_def by simp qed qed finally show ?thesis by simp qed text \ At long last, we can show associativity coherence for \SPN\. \ lemma assoc_coherence: shows "LHS = RHS" proof (intro Span.arr_eqI) show "Span.par LHS RHS" using par_LHS_RHS by blast show "Chn LHS = Chn RHS" proof - have "Chn LHS = \\HHfgh_HfHgh.chine\\ \ \\THfgh_HHfgh.chine\\ \ \\TTfgh_THfgh.chine\\" using Chn_LHS_eq by simp also have "... = \\HHfgh_HfHgh.chine \ THfgh_HHfgh.chine \ TTfgh_THfgh.chine\\" proof - have "\\THfgh_HHfgh.chine\\ \ \\TTfgh_THfgh.chine\\ = \\THfgh_HHfgh.chine \ TTfgh_THfgh.chine\\" using fg gh isomorphic_reflexive HHfgh_HfHgh.is_map THfgh_HHfgh.is_map TTfgh_THfgh.is_map left_adjoints_compose Maps.comp_CLS [of THfgh_HHfgh.chine TTfgh_THfgh.chine "THfgh_HHfgh.chine \ TTfgh_THfgh.chine"] by simp moreover have "\\HHfgh_HfHgh.chine\\ \ \\THfgh_HHfgh.chine \ TTfgh_THfgh.chine\\ = \\HHfgh_HfHgh.chine \ THfgh_HHfgh.chine \ TTfgh_THfgh.chine\\" proof - have "ide (HHfgh_HfHgh.chine \ THfgh_HHfgh.chine \ TTfgh_THfgh.chine)" proof - have "ide (THfgh_HHfgh.chine \ TTfgh_THfgh.chine)" using fg gh HHfgh_HfHgh.is_map THfgh_HHfgh.is_map TTfgh_THfgh.is_map left_adjoint_is_ide left_adjoints_compose by auto moreover have "src HHfgh_HfHgh.chine = trg (THfgh_HHfgh.chine \ TTfgh_THfgh.chine)" using fg gh HHfgh_HfHgh.chine_in_hom \_def by auto ultimately show ?thesis by simp qed thus ?thesis using fg gh isomorphic_reflexive HHfgh_HfHgh.is_map THfgh_HHfgh.is_map TTfgh_THfgh.is_map left_adjoints_compose Maps.comp_CLS [of HHfgh_HfHgh.chine "THfgh_HHfgh.chine \ TTfgh_THfgh.chine" "HHfgh_HfHgh.chine \ THfgh_HHfgh.chine \ TTfgh_THfgh.chine"] by auto qed ultimately show ?thesis by argo qed also have "... = \\TfHgh_HfHgh.chine \ TfTgh_TfHgh.chine \ TTfgh_TfTgh.chine\\" proof - interpret A: vertical_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \(f \ g) \ h\ TTfgh.tab \tab\<^sub>0 h \ TTfgh.p\<^sub>0\ \(tab\<^sub>1 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1\ \f \ g \ h\ TfTgh.tab \(tab\<^sub>0 h \ Tgh.p\<^sub>0) \ TfTgh.p\<^sub>0\ \tab\<^sub>1 f \ TfTgh.p\<^sub>1\ \f \ g \ h\ TfHgh.\\.tab \tab\<^sub>0 (g \ h) \ TfHgh.\\.p\<^sub>0\ \tab\<^sub>1 f \ TfHgh.\\.p\<^sub>1\ \\[f, g, h]\ \f \ g \ h\ .. interpret B: vertical_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \(f \ g) \ h\ TTfgh.tab \tab\<^sub>0 h \ TTfgh.p\<^sub>0\ \(tab\<^sub>1 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1\ \f \ g \ h\ TfHgh.\\.tab \tab\<^sub>0 (g \ h) \ TfHgh.\\.p\<^sub>0\ \tab\<^sub>1 f \ TfHgh.\\.p\<^sub>1\ \f \ g \ h\ HfHgh.tab \tab\<^sub>0 (f \ g \ h)\ \tab\<^sub>1 (f \ g \ h)\ \\[f, g, h]\ \f \ g \ h\ using fg gh by unfold_locales auto interpret C: vertical_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \(f \ g) \ h\ THfgh.\\.tab \tab\<^sub>0 h \ THfgh.\\.p\<^sub>0\ \tab\<^sub>1 (f \ g) \ THfgh.\\.p\<^sub>1\ \(f \ g) \ h\ HHfgh.tab \tab\<^sub>0 ((f \ g) \ h)\ \tab\<^sub>1 ((f \ g) \ h)\ \f \ g \ h\ HfHgh.tab \tab\<^sub>0 (f \ g \ h)\ \tab\<^sub>1 (f \ g \ h)\ \(f \ g) \ h\ \\[f, g, h]\ using fg gh by unfold_locales auto interpret D: vertical_composite_of_arrows_of_tabulations_in_maps V H \ \ src trg \(f \ g) \ h\ TTfgh.tab \tab\<^sub>0 h \ TTfgh.p\<^sub>0\ \(tab\<^sub>1 f \ Tfg.p\<^sub>1) \ TTfgh.p\<^sub>1\ \(f \ g) \ h\ THfgh.\\.tab \tab\<^sub>0 h \ THfgh.\\.p\<^sub>0\ \tab\<^sub>1 (f \ g) \ THfgh.\\.p\<^sub>1\ \f \ g \ h\ HfHgh.tab \tab\<^sub>0 (f \ g \ h)\ \tab\<^sub>1 (f \ g \ h)\ \(f \ g) \ h\ \\[f, g, h]\ using fg gh by unfold_locales auto have "HHfgh_HfHgh.chine \ THfgh_HHfgh.chine \ TTfgh_THfgh.chine \ D.chine" proof - have "D.chine \ D.\.chine \ TTfgh_THfgh.chine" using D.chine_char by simp also have "... \ C.chine \ TTfgh_THfgh.chine" using fg gh comp_arr_dom isomorphic_reflexive by simp also have "... \ (C.\.chine \ THfgh_HHfgh.chine) \ TTfgh_THfgh.chine" using C.chine_char hcomp_isomorphic_ide by simp also have "... \ (HHfgh_HfHgh.chine \ THfgh_HHfgh.chine) \ TTfgh_THfgh.chine" proof - have "C.\.chine = HHfgh_HfHgh.chine" using fg gh comp_arr_dom comp_cod_arr \_def by simp hence "isomorphic C.\.chine HHfgh_HfHgh.chine" using isomorphic_reflexive by simp thus ?thesis using hcomp_isomorphic_ide by simp qed also have "... \ HHfgh_HfHgh.chine \ THfgh_HHfgh.chine \ TTfgh_THfgh.chine" proof - have "ide HHfgh_HfHgh.chine \ ide THfgh_HHfgh.chine \ ide TTfgh_THfgh.chine" by simp moreover have "src HHfgh_HfHgh.chine = trg THfgh_HHfgh.chine \ src THfgh_HHfgh.chine = trg TTfgh_THfgh.chine" using fg gh HHfgh_HfHgh.chine_in_hom THfgh_HHfgh.chine_in_hom TTfgh_THfgh.chine_in_hom \_def by auto ultimately show ?thesis using fg gh iso_assoc isomorphic_def assoc_in_hom [of HHfgh_HfHgh.chine THfgh_HHfgh.chine TTfgh_THfgh.chine] by auto qed finally show ?thesis using isomorphic_symmetric by blast qed also have "... \ B.chine" proof - have "D.chine = B.chine" using fg gh comp_arr_dom comp_cod_arr by simp thus ?thesis using isomorphic_reflexive by simp qed also have "... \ TfHgh_HfHgh.chine \ TfTgh_TfHgh.chine \ TTfgh_TfTgh.chine" proof - have "B.chine \ TfHgh_HfHgh.chine \ B.\.chine" using B.chine_char by simp also have "... \ TfHgh_HfHgh.chine \ A.chine" using fg gh comp_cod_arr isomorphic_reflexive by simp also have "... \ TfHgh_HfHgh.chine \ TfTgh_TfHgh.chine \ TTfgh_TfTgh.chine" using A.chine_char hcomp_ide_isomorphic by simp finally show ?thesis by blast qed finally have "HHfgh_HfHgh.chine \ THfgh_HHfgh.chine \ TTfgh_THfgh.chine \ TfHgh_HfHgh.chine \ TfTgh_TfHgh.chine \ TTfgh_TfTgh.chine" by blast thus ?thesis using fg gh Maps.CLS_eqI isomorphic_implies_hpar(1) by blast qed also have "... = \\TfHgh_HfHgh.chine\\ \ \\TfTgh_TfHgh.chine\\ \ \\TTfgh_TfTgh.chine\\" using fg gh isomorphic_reflexive TfTgh_TfHgh.is_map TfHgh_HfHgh.is_map TTfgh_TfTgh.is_map left_adjoints_compose Maps.comp_CLS [of TfTgh_TfHgh.chine TTfgh_TfTgh.chine "TfTgh_TfHgh.chine \ TTfgh_TfTgh.chine"] Maps.comp_CLS [of TfHgh_HfHgh.chine "TfTgh_TfHgh.chine \ TTfgh_TfTgh.chine" "TfHgh_HfHgh.chine \ TfTgh_TfHgh.chine \ TTfgh_TfTgh.chine"] by simp also have "... = Chn RHS" using Chn_RHS_eq CLS_chine tuple_ABC_eq_ABC'(2) by simp finally show ?thesis by blast qed qed end subsubsection "SPN is an Equivalence Pseudofunctor" context bicategory_of_spans begin interpretation Maps: maps_category V H \ \ src trg .. interpretation Span: span_bicategory Maps.comp Maps.PRJ\<^sub>0 Maps.PRJ\<^sub>1 .. no_notation Fun.comp (infixl "\" 55) notation Span.vcomp (infixr "\" 55) notation Span.hcomp (infixr "\" 53) notation Maps.comp (infixr "\" 55) notation isomorphic (infix "\" 50) interpretation SPN: "functor" V Span.vcomp SPN using SPN_is_functor by simp interpretation SPN: weak_arrow_of_homs V src trg Span.vcomp Span.src Span.trg SPN using SPN_is_weak_arrow_of_homs by simp interpretation HoSPN_SPN: composite_functor VV.comp Span.VV.comp Span.vcomp SPN.FF \\\\. Span.hcomp (fst \\) (snd \\)\ .. interpretation SPNoH: composite_functor VV.comp V Span.vcomp \\\\. fst \\ \ snd \\\ SPN .. interpretation \: transformation_by_components VV.comp Span.vcomp HoSPN_SPN.map SPNoH.map \\rs. CMP (fst rs) (snd rs)\ using compositor_is_natural_transformation by simp interpretation \: natural_isomorphism VV.comp Span.vcomp HoSPN_SPN.map SPNoH.map \.map using compositor_is_natural_isomorphism by simp abbreviation \ where "\ \ \.map" interpretation SPN: pseudofunctor V H \ \ src trg Span.vcomp Span.hcomp Span.assoc Span.unit Span.src Span.trg SPN \ proof show "\f g h. \ ide f; ide g; ide h; src f = trg g; src g = trg h \ \ SPN \[f, g, h] \ \ (f \ g, h) \ (\ (f, g) \ SPN h) = \ (f, g \ h) \ (SPN f \ \ (g, h)) \ Span.assoc (SPN f) (SPN g) (SPN h)" proof - fix f g h assume f: "ide f" and g: "ide g" and h: "ide h" assume fg: "src f = trg g" and gh: "src g = trg h" interpret fgh: three_composable_identities_in_bicategory_of_spans V H \ \ src trg f g h using f g h fg gh by (unfold_locales, simp) show "fgh.LHS = fgh.RHS" using fgh.assoc_coherence by simp qed qed lemma SPN_is_pseudofunctor: shows "pseudofunctor V H \ \ src trg Span.vcomp Span.hcomp Span.assoc Span.unit Span.src Span.trg SPN \" .. interpretation SPN: equivalence_pseudofunctor V H \ \ src trg Span.vcomp Span.hcomp Span.assoc Span.unit Span.src Span.trg SPN \ proof show "\\ \'. \par \ \'; SPN \ = SPN \'\ \ \ = \'" proof - fix \ \' assume par: "par \ \'" assume eq: "SPN \ = SPN \'" interpret dom_\: identity_in_bicategory_of_spans V H \ \ src trg \dom \\ using par apply unfold_locales by auto interpret cod_\: identity_in_bicategory_of_spans V H \ \ src trg \cod \\ using par apply unfold_locales by auto interpret \: arrow_of_tabulations_in_maps V H \ \ src trg \dom \\ \tab_of_ide (dom \)\ \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \cod \\ \tab_of_ide (cod \)\ \tab\<^sub>0 (cod \)\ \tab\<^sub>1 (cod \)\ \ using par apply unfold_locales by auto interpret \: arrow_in_bicategory_of_spans V H \ \ src trg \dom \\ \cod \\ \ using par apply unfold_locales by auto interpret \': arrow_of_tabulations_in_maps V H \ \ src trg \dom \\ \tab_of_ide (dom \)\ \tab\<^sub>0 (dom \)\ \tab\<^sub>1 (dom \)\ \cod \\ \tab_of_ide (cod \)\ \tab\<^sub>0 (cod \)\ \tab\<^sub>1 (cod \)\ \' using par apply unfold_locales by auto interpret \': arrow_in_bicategory_of_spans V H \ \ src trg \dom \\ \cod \\ \' using par apply unfold_locales by auto have "\.chine \ \'.chine" using par eq SPN_def spn_def Maps.CLS_eqI \.is_ide by auto hence "\.\ = \'.\" using \.\_naturality \'.\_naturality by (metis \.\_simps(4) \'.\_simps(4) \.chine_is_induced_map \'.chine_is_induced_map \.induced_map_preserved_by_iso) thus "\ = \'" using par \.\_in_terms_of_\ \'.\_in_terms_of_\ by metis qed show "\a'. Span.obj a' \ \a. obj a \ Span.equivalent_objects (SPN.map\<^sub>0 a) a'" proof - fix a' assume a': "Span.obj a'" let ?a = "Maps.Dom (Chn a')" have a: "obj ?a" using a' Span.obj_char Span.ide_char Maps.ide_char by blast moreover have "Span.equivalent_objects (SPN.map\<^sub>0 ?a) a'" proof - have "SPN.map\<^sub>0 ?a = a'" proof (intro Span.arr_eqI) have "Chn (SPN.map\<^sub>0 ?a) = Chn (Span.src (SPN ?a))" using a a' by auto also have "... = Maps.MkIde (Maps.Dom (Chn a'))" proof - have "Maps.arr \\tab\<^sub>0 (dom (Maps.Dom (Chn a')))\\" proof - have "is_left_adjoint (tab\<^sub>0 (dom (Maps.Dom (Chn a'))))" using a by auto thus ?thesis using Maps.CLS_in_hom by auto qed moreover have "arr (Maps.Dom (Chn a'))" using a by auto moreover have "Span.arr (SPN (Maps.Dom (Chn a')))" using a a' SPN_in_hom by auto ultimately show ?thesis using a a' SPN_def Span.src_def Maps.cod_char obj_simps(2) by simp qed also have "... = Chn a'" using a' Maps.MkIde_Dom Span.obj_char Span.ide_char by simp finally show "Chn (SPN.map\<^sub>0 ?a) = Chn a'" by simp show "Span.par (SPN.map\<^sub>0 (Maps.Dom (Chn a'))) a'" using a a' Span.obj_char apply (intro conjI) using SPN.map\<^sub>0_simps(1) Span.obj_def apply blast apply simp apply (metis (no_types, lifting) SPN.map\<^sub>0_def SPN.preserves_arr Span.obj_src \Chn (SPN.map\<^sub>0 (Maps.Dom (Chn a'))) = Chn a'\ obj_def) by (metis (no_types, lifting) SPN.map\<^sub>0_def SPN.preserves_arr Span.obj_src \Chn (SPN.map\<^sub>0 (Maps.Dom (Chn a'))) = Chn a'\ obj_def) qed thus ?thesis using Span.equivalent_objects_reflexive by (simp add: a') qed ultimately show "\a. obj a \ Span.equivalent_objects (SPN.map\<^sub>0 a) a'" by auto qed show "\a b g. \obj a; obj b; Span.in_hhom g (SPN.map\<^sub>0 a) (SPN.map\<^sub>0 b); Span.ide g\ \ \f. \f : a \ b\ \ ide f \ Span.isomorphic (SPN f) g" proof - fix a b g assume a: "obj a" and b: "obj b" and g_in_hhom: "Span.in_hhom g (SPN.map\<^sub>0 a) (SPN.map\<^sub>0 b)" and ide_g: "Span.ide g" have arr_a: "arr a" using a by auto have arr_b: "arr b" using b by auto show "\f. \f : a \ b\ \ ide f \ Span.isomorphic (SPN f) g" proof - interpret g: arrow_of_spans Maps.comp g using ide_g Span.ide_char by blast interpret g: identity_arrow_of_spans Maps.comp g using ide_g Span.ide_char by unfold_locales auto interpret REP_leg0: map_in_bicategory V H \ \ src trg \Maps.REP g.leg0\ using Maps.REP_in_Map [of g.leg0] by unfold_locales auto have 0: "\Maps.REP g.leg0 : src (Maps.REP g.apex) \ Maps.Cod g.leg0\" using g.dom.leg_in_hom Maps.REP_in_hhom by (metis (no_types, lifting) Maps.Dom_cod Maps.REP_simps(2) Maps.arr_cod g.dom.leg_simps(1)) have 1: "\Maps.REP g.leg1 : src (Maps.REP g.apex) \ Maps.Cod g.leg1\" using g.dom.leg_in_hom Maps.REP_in_hhom by (metis (no_types, lifting) Maps.Dom_cod Maps.REP_simps(2) Maps.arr_cod g.dom.leg_simps(3)) let ?f = "Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*" have f_in_hhom: "\?f : a \ b\" proof show "\Maps.REP g.leg1 : src (Maps.REP g.apex) \ b\" proof - have "\Maps.REP g.leg1 : src (Maps.REP g.apex) \ Maps.Cod g.leg1\" using 1 by simp moreover have "Maps.Cod g.leg1 = b" proof - have "src (Maps.REP g.dtrg) = src (Maps.REP (Leg0 (Dom (SPN.map\<^sub>0 b))))" using g_in_hhom Span.trg_def [of g] by auto also have "... = src (Maps.REP (Maps.cod \\tab\<^sub>0 b\\))" using b arr_b SPN.map\<^sub>0_def Span.src_def SPN_in_hom by auto also have "... = src (Maps.REP \\trg (tab\<^sub>0 b)\\)" using b Maps.CLS_in_hom [of "tab\<^sub>0 b"] by force also have "... = src (Maps.REP \\b\\)" using b by fastforce also have "... = b" using b obj_simps by auto finally show ?thesis by simp qed ultimately show ?thesis by argo qed show "\(Maps.REP g.leg0)\<^sup>* : a \ src (Maps.REP g.apex)\" proof - have "\Maps.REP g.leg0 : src (Maps.REP g.apex) \ a\" proof - have "src (Maps.REP g.dsrc) = src (Maps.REP (Leg0 (Dom (SPN.map\<^sub>0 a))))" using g_in_hhom Span.src_def [of g] by auto also have "... = src (Maps.REP (Maps.cod \\tab\<^sub>0 a\\))" using a arr_a SPN.map\<^sub>0_def Span.src_def SPN_in_hom by auto also have "... = src (Maps.REP \\trg (tab\<^sub>0 a)\\)" using a Maps.CLS_in_hom [of "tab\<^sub>0 a"] by force also have "... = src (Maps.REP \\a\\)" using a by fastforce also have "... = a" using a obj_simps by auto finally show ?thesis by fast qed thus ?thesis using REP_leg0.antipar REP_leg0.ide_right apply (intro in_hhomI) by auto qed qed moreover have ide_f: "ide ?f" using REP_leg0.antipar f_in_hhom by fastforce moreover have "Span.isomorphic (SPN ?f) g" proof - have SPN_f_eq: "SPN ?f = \Chn = \\spn ?f\\, Dom = \Leg0 = \\tab\<^sub>0 ?f\\, Leg1 = \\tab\<^sub>1 ?f\\\, Cod = \Leg0 = \\tab\<^sub>0 ?f\\, Leg1 = \\tab\<^sub>1 ?f\\\\" using calculation(1) SPN_def [of ?f] REP_leg0.antipar by auto text \ We need an invertible arrow of spans from \SPN f\ to \g\. There exists a tabulation \(REP g.leg0, \, REP g.leg1)\ of \f\. There is also a tabulation \(tab\<^sub>0 f, \', tab\<^sub>1 f) of f\. As these are tabulations of the same arrow, they are equivalent. This yields an equivalence map which is an arrow of spans from \(tab\<^sub>0 f, tab\<^sub>1 f)\ to \(REP g.leg0, \, REP g.leg1)\. Its isomorphism class is an invertible arrow of spans in maps from \(CLS (tab\<^sub>0 f), CLS (tab\<^sub>1 f))\ to \(g.leg0, g.leg1)\. \ interpret f: identity_in_bicategory_of_spans V H \ \ src trg ?f using ide_f apply unfold_locales by auto interpret f: arrow_of_tabulations_in_maps V H \ \ src trg ?f f.tab \tab\<^sub>0 ?f\ \tab\<^sub>1 ?f\ ?f f.tab \tab\<^sub>0 ?f\ \tab\<^sub>1 ?f\ ?f using f.is_arrow_of_tabulations_in_maps by simp interpret g: span_of_maps V H \ \ src trg \Maps.REP g.leg0\ \Maps.REP g.leg1\ using Span.arr_char by (unfold_locales, blast+) have 2: "src (Maps.REP g.leg0) = src (Maps.REP g.leg1)" using 0 1 by fastforce hence "\\. tabulation (\) (\) \ \ src trg ?f \ (Maps.REP g.leg0) (Maps.REP g.leg1)" using BS2' [of "Maps.REP g.leg0" "Maps.REP g.leg1" ?f] isomorphic_reflexive Span.arr_char by auto hence "tabulation V H \ \ src trg ?f (REP_leg0.trnr\<^sub>\ (Maps.REP g.leg1) ?f) (Maps.REP g.leg0) (Maps.REP g.leg1)" using 2 REP_leg0.canonical_tabulation [of "Maps.REP g.leg1"] by auto hence 3: "\w w' \ \ \ \ \' \'. equivalence_in_bicategory (\) (\) \ \ src trg w' w \ \ \ \w : src (tab\<^sub>0 ?f) \ src (Maps.REP g.leg0)\ \ \w' : src (Maps.REP g.leg0) \ src (tab\<^sub>0 ?f)\ \ \\ : Maps.REP g.leg0 \ w \ tab\<^sub>0 ?f\ \ \\ : tab\<^sub>1 ?f \ Maps.REP g.leg1 \ w\ \ iso \ \ f.tab = (?f \ \) \ \[?f, Maps.REP g.leg0, w] \ (REP_leg0.trnr\<^sub>\ (Maps.REP g.leg1) ?f \ w) \ \ \ \\' : tab\<^sub>0 ?f \ w' \ Maps.REP g.leg0\ \ \\' : Maps.REP g.leg1 \ tab\<^sub>1 ?f \ w'\ \ iso \' \ REP_leg0.trnr\<^sub>\ (Maps.REP g.leg1) ?f = (?f \ \') \ \[?f, tab\<^sub>0 ?f, w'] \ (f.tab \ w') \ \'" using f.apex_unique_up_to_equivalence [of "REP_leg0.trnr\<^sub>\ (Maps.REP g.leg1) ?f" "Maps.REP g.leg0" "Maps.REP g.leg1"] by simp obtain w w' \ \ \ \ \' \' where 4: "equivalence_in_bicategory (\) (\) \ \ src trg w' w \ \ \ \w : src (tab\<^sub>0 ?f) \ src (Maps.REP g.leg0)\ \ \w' : src (Maps.REP g.leg0) \ src (tab\<^sub>0 ?f)\ \ \\ : Maps.REP g.leg0 \ w \ tab\<^sub>0 ?f\ \ \\ : tab\<^sub>1 ?f \ Maps.REP g.leg1 \ w\ \ iso \ \ f.tab = (?f \ \) \ \[?f, Maps.REP g.leg0, w] \ (REP_leg0.trnr\<^sub>\ (Maps.REP g.leg1) ?f \ w) \ \ \ \\' : tab\<^sub>0 ?f \ w' \ Maps.REP g.leg0\ \ \\' : Maps.REP g.leg1 \ tab\<^sub>1 ?f \ w'\ \ iso \' \ REP_leg0.trnr\<^sub>\ (Maps.REP g.leg1) ?f = (?f \ \') \ \[?f, tab\<^sub>0 ?f, w'] \ (f.tab \ w') \ \'" using 3 by meson hence w\\: "equivalence_map w \ \w : src (tab\<^sub>0 ?f) \ src (Maps.REP g.leg0)\ \ \\ : Maps.REP g.leg0 \ w \ tab\<^sub>0 ?f\ \ \\ : tab\<^sub>1 ?f \ Maps.REP g.leg1 \ w\ \ iso \" using equivalence_map_def quasi_inverses_def quasi_inverses_symmetric by meson let ?W = "\Chn = \\w\\, Dom = Dom (SPN ?f), Cod = Dom g\" have W_in_hom: "Span.in_hom ?W (SPN ?f) g" proof have "arrow_of_spans Maps.comp ?W" proof interpret Dom_W: span_in_category Maps.comp \Dom ?W\ proof (unfold_locales, intro conjI) show "Maps.arr (Leg0 (Dom ?W))" apply (intro Maps.arrI) apply auto by (metis f.base_simps(2) f.satisfies_T0 f.u_in_hom src_hcomp) show "Maps.arr (Leg1 (Dom ?W))" using 1 apply (intro Maps.arrI) apply auto proof - let ?f = "tab\<^sub>1 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)" assume 1: "\Maps.REP g.leg1 : Maps.Dom g.apex \ Maps.Cod g.leg1\" have "\?f : src (tab\<^sub>0 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)) \ Maps.Cod g.leg1\ \ is_left_adjoint ?f \ \tab\<^sub>1 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)\ = \?f\" using 1 by simp thus "\f. \f : src (tab\<^sub>0 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)) \ Maps.Cod g.leg1\ \ is_left_adjoint f \ \tab\<^sub>1 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)\ = \f\" by blast qed show "Maps.dom (Leg0 (Dom ?W)) = Maps.dom (Leg1 (Dom ?W))" proof - have "Maps.dom (Leg0 (Dom ?W)) = Maps.MkIde (src (tab\<^sub>0 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)))" using Maps.dom_char apply simp by (metis (no_types, lifting) Maps.CLS_in_hom Maps.in_homE f.base_simps(2) f.satisfies_T0 f.u_simps(3) hcomp_simps(1)) also have "... = Maps.dom (Leg1 (Dom ?W))" using Maps.dom_char Maps.CLS_in_hom f.leg1_is_map f_in_hhom apply simp by (metis (no_types, lifting) Maps.in_homE Maps.REP_simps(3) f.base_simps(2) f.leg1_is_map f.leg1_simps(3) f.leg1_simps(4) g.dom.leg_simps(3) trg_hcomp) finally show ?thesis by blast qed qed show "Maps.span (Leg0 (Dom ?W)) (Leg1 (Dom ?W))" using Dom_W.span_in_category_axioms Dom_W.is_span by blast interpret Cod_W: span_in_category Maps.comp \Cod ?W\ apply unfold_locales by fastforce show "Maps.span (Leg0 (Cod ?W)) (Leg1 (Cod ?W))" by fastforce show "Maps.in_hom (Chn ?W) Dom_W.apex Cod_W.apex" proof show 1: "Maps.arr (Chn ?W)" using w\\ Maps.CLS_in_hom [of w] equivalence_is_adjoint by auto show "Maps.dom (Chn ?W) = Dom_W.apex" proof - have "Maps.dom (Chn ?W) = Maps.MkIde (src w)" using 1 w\\ Maps.dom_char by simp also have "... = Dom_W.apex" proof - have "src w = src (tab\<^sub>0 ?f)" using w\\ by blast thus ?thesis using Dom_W.apex_def Maps.arr_char Maps.dom_char apply simp by (metis (no_types, lifting) f.base_simps(2) f.satisfies_T0 f.u_in_hom hcomp_simps(1)) qed finally show ?thesis by fastforce qed show "Maps.cod (Chn ?W) = Cod_W.apex" proof - have "Maps.cod (Chn ?W) = Maps.MkIde (trg w)" using 1 w\\ Maps.cod_char by simp also have "... = Cod_W.apex" proof - have "trg w = src (Maps.REP g.leg0)" using w\\ by blast thus ?thesis using Cod_W.apex_def Maps.arr_char Maps.cod_char apply simp using g.dom.apex_def Maps.dom_char Maps.REP_simps(2) g.dom.is_span by presburger qed finally show ?thesis by fastforce qed qed show "Cod_W.leg0 \ Chn ?W = Dom_W.leg0" proof - have "Cod_W.leg0 \ Chn ?W = g.leg0 \ \\w\\" by simp also have "... = \\Maps.REP g.leg0\\ \ \\w\\" using g.dom.leg_simps(1) Maps.CLS_REP [of g.leg0] by simp also have "... = \\Maps.REP g.leg0 \ w\\" proof - have "is_left_adjoint (Maps.REP g.leg0)" by fast moreover have "is_left_adjoint w" using w\\ equivalence_is_adjoint by simp moreover have "Maps.REP g.leg0 \ w \ Maps.REP g.leg0 \ w" using w\\ isomorphic_reflexive Maps.REP_in_hhom by (metis (no_types, lifting) REP_leg0.ide_left adjoint_pair_antipar(1) calculation(2) ide_hcomp in_hhomE) ultimately show ?thesis using w\\ Maps.comp_CLS isomorphic_reflexive equivalence_is_adjoint by blast qed also have "... = \\tab\<^sub>0 ?f\\" proof - have "iso \" proof - have "is_left_adjoint (Maps.REP g.leg0 \ w)" using w\\ equivalence_is_adjoint Maps.REP_in_hhom by (simp add: g.leg0_is_map in_hhom_def left_adjoints_compose) moreover have "is_left_adjoint (tab\<^sub>0 ?f)" by simp ultimately show ?thesis using w\\ BS3 by blast qed thus ?thesis using w\\ Maps.CLS_eqI equivalence_is_adjoint by (meson isomorphic_def isomorphic_implies_hpar(1)) qed finally show ?thesis by fastforce qed show "Cod_W.leg1 \ Chn ?W = Dom_W.leg1" proof - have "Cod_W.leg1 \ Chn ?W = g.leg1 \ \\w\\" by simp also have "... = \\Maps.REP g.leg1\\ \ \\w\\" using g.dom.leg_simps(3) Maps.CLS_REP by presburger also have "... = \\Maps.REP g.leg1 \ w\\" proof - have "is_left_adjoint (Maps.REP g.leg1)" by fast moreover have "is_left_adjoint w" using w\\ equivalence_is_adjoint by simp moreover have "Maps.REP g.leg1 \ w \ Maps.REP g.leg1 \ w" using w\\ isomorphic_reflexive Maps.REP_in_hhom by (metis (no_types, lifting) "2" calculation(2) g.dom.is_span hcomp_ide_isomorphic Maps.ide_REP in_hhomE right_adjoint_determines_left_up_to_iso) ultimately show ?thesis using w\\ Maps.comp_CLS isomorphic_reflexive equivalence_is_adjoint by blast qed also have "... = \\tab\<^sub>1 ?f\\" proof - have "ide (Maps.REP g.leg1 \ w)" using 2 w\\ equivalence_map_is_ide by auto moreover have "Maps.REP g.leg1 \ w \ tab\<^sub>1 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)" using w\\ equivalence_is_adjoint f.leg1_is_map right_adjoint_determines_left_up_to_iso adjoint_pair_preserved_by_iso by (meson adjoint_pair_antipar(2) ide_in_hom(2) ide_is_iso) ultimately show ?thesis using Maps.CLS_eqI by blast qed finally show ?thesis by fastforce qed qed thus W: "Span.arr ?W" using Span.arr_char by blast interpret Dom_W: span_in_category Maps.comp \\Leg0 = Maps.MkArr (src (tab\<^sub>0 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*))) (src (Maps.REP g.leg0)\<^sup>*) (iso_class (tab\<^sub>0 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*))), Leg1 = Maps.MkArr (src (tab\<^sub>0 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*))) (Maps.Cod g.leg1) (iso_class (tab\<^sub>1 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)))\\ using W Span.arr_char by (simp add: arrow_of_spans_def) interpret Cod_W: span_in_category Maps.comp \Cod ?W\ using W Span.arr_char by (simp add: arrow_of_spans_def) show "Span.dom ?W = SPN ?f" proof - have "Span.dom ?W = \Chn = Dom_W.apex, Dom = \Leg0 = \\tab\<^sub>0 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)\\, Leg1 = \\tab\<^sub>1 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)\\\, Cod = \Leg0 = \\tab\<^sub>0 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)\\, Leg1 = \\tab\<^sub>1 (Maps.REP g.leg1 \ (Maps.REP g.leg0)\<^sup>*)\\\\" using 0 W Span.dom_char by simp also have "... = SPN ?f" using SPN_def Dom_W.apex_def Maps.dom_char Dom_W.is_span iso_class_eqI spn_ide apply simp using ide_f by blast finally show ?thesis by blast qed show "Span.cod ?W = g" using 0 W Span.cod_char Cod_W.apex_def by simp qed moreover have "Span.iso ?W" proof - have "Maps.iso \\w\\" proof - have "Maps.arr \\w\\ \ w \ Maps.Map \\w\\ \ equivalence_map w" proof (intro conjI) show 1: "Maps.arr \\w\\" using w\\ Maps.CLS_in_hom equivalence_is_adjoint by blast show "equivalence_map w" using w\\ by blast show "w \ Maps.Map \\w\\" using 1 w\\ equivalence_is_adjoint Maps.arr_char by (simp add: equivalence_map_is_ide ide_in_iso_class) qed thus ?thesis using Maps.iso_char' by blast qed thus ?thesis using w\\ W_in_hom Span.iso_char by auto qed ultimately show ?thesis using Span.isomorphic_def by blast qed ultimately show ?thesis by blast qed qed show "\r s \. \ide r; ide s; src r = src s; trg r = trg s; Span.in_hom \ (SPN r) (SPN s)\ \ \\. \\ : r \ s\ \ SPN \ = \" proof - fix r s \ assume r: "ide r" and s: "ide s" assume src_eq: "src r = src s" and trg_eq: "trg r = trg s" assume \: "Span.in_hom \ (SPN r) (SPN s)" interpret \: arrow_of_spans Maps.comp \ using \ Span.arr_char by auto interpret r: identity_in_bicategory_of_spans V H \ \ src trg r using r by unfold_locales auto interpret s: identity_in_bicategory_of_spans V H \ \ src trg s using s by unfold_locales auto interpret s: arrow_of_tabulations_in_maps V H \ \ src trg s s.tab \tab\<^sub>0 s\ \tab\<^sub>1 s\ s s.tab \tab\<^sub>0 s\ \tab\<^sub>1 s\ s using s.is_arrow_of_tabulations_in_maps by simp have \_dom_leg0_eq: "\.dom.leg0 = \\tab\<^sub>0 r\\" using \ Span.dom_char SPN_def [of r] by auto have \_dom_leg1_eq: "\.dom.leg1 = \\tab\<^sub>1 r\\" using \ Span.dom_char SPN_def [of r] by auto have \_cod_leg0_eq: "\.cod.leg0 = \\tab\<^sub>0 s\\" using \ Span.cod_char SPN_def [of s] by auto have \_cod_leg1_eq: "\.cod.leg1 = \\tab\<^sub>1 s\\" using \ Span.cod_char SPN_def [of s] by auto have 1: "tab\<^sub>0 s \ Maps.REP \.chine \ tab\<^sub>0 r" proof - have "tab\<^sub>0 s \ Maps.REP \.chine \ Maps.REP \.cod.leg0 \ Maps.REP \.chine" proof - have "Maps.REP \.cod.leg0 \ tab\<^sub>0 s" using \_cod_leg0_eq Maps.CLS_REP Maps.CLS_eqI Maps.REP_CLS s.satisfies_T0 by presburger moreover have "src (tab\<^sub>0 s) = trg (Maps.REP \.chine)" using Maps.seq_char [of "\\tab\<^sub>0 s\\" \.chine] \.cod.leg_simps(1) \.leg0_commutes \_cod_leg0_eq by auto ultimately show ?thesis using hcomp_isomorphic_ide [of "tab\<^sub>0 s" "Maps.REP \.cod.leg0" "Maps.REP \.chine"] isomorphic_symmetric by fastforce qed also have "... \ Maps.REP \.dom.leg0" proof - have "\\Maps.REP \.cod.leg0\\ \ \\Maps.REP \.chine\\ = \\Maps.REP \.dom.leg0\\" using \.leg0_commutes Maps.CLS_REP \.chine_simps(1) \.cod.leg_simps(1) \.dom.leg_simps(1) by presburger hence "\\Maps.REP \.cod.leg0 \ Maps.REP \.chine\\ = \\Maps.REP \.dom.leg0\\" using Maps.comp_CLS [of "Maps.REP \.cod.leg0" "Maps.REP \.chine" "Maps.REP \.cod.leg0 \ Maps.REP \.chine"] isomorphic_reflexive by (metis (no_types, lifting) Maps.seq_char Maps.REP_in_hhom(2) Maps.REP_simps(2-3) \.chine_in_hom \.cod.leg_in_hom(1) \.dom.leg_simps(1) \.leg0_commutes ide_hcomp Maps.ide_REP) thus ?thesis using Maps.CLS_eqI Maps.seq_char Maps.ide_REP by (meson calculation isomorphic_implies_ide(2)) qed also have "... \ tab\<^sub>0 r" using \_dom_leg0_eq Maps.CLS_REP Maps.CLS_eqI Maps.REP_CLS r.satisfies_T0 by presburger finally show ?thesis by blast qed obtain \ where \: "\\ : tab\<^sub>0 s \ Maps.REP \.chine \ tab\<^sub>0 r\ \ iso \" using 1 by blast have 2: "tab\<^sub>1 s \ Maps.REP \.chine \ tab\<^sub>1 r" proof - have "tab\<^sub>1 s \ Maps.REP \.chine \ Maps.REP \.cod.leg1 \ Maps.REP \.chine" proof - have "Maps.REP \.cod.leg1 \ tab\<^sub>1 s" using \_cod_leg1_eq Maps.CLS_REP Maps.CLS_eqI Maps.REP_CLS s.leg1_is_map by presburger moreover have "src (Maps.REP \.cod.leg1) = trg (Maps.REP \.chine)" using Maps.seq_char by auto ultimately show ?thesis using hcomp_isomorphic_ide [of "Maps.REP \.cod.leg1" "tab\<^sub>1 s" "Maps.REP \.chine"] isomorphic_symmetric by fastforce qed also have "... \ Maps.REP \.dom.leg1" proof - have "\\Maps.REP \.cod.leg1\\ \ \\Maps.REP \.chine\\ = \\Maps.REP \.dom.leg1\\" using \.leg1_commutes Maps.CLS_REP \.chine_simps(1) \.cod.leg_simps(3) \.dom.leg_simps(3) by presburger hence "\\Maps.REP \.cod.leg1 \ Maps.REP \.chine\\ = \\Maps.REP \.dom.leg1\\" using Maps.comp_CLS [of "Maps.REP \.cod.leg1" "Maps.REP \.chine" "Maps.REP \.cod.leg1 \ Maps.REP \.chine"] isomorphic_reflexive by (metis (no_types, lifting) Maps.seq_char Maps.REP_in_hhom(2) Maps.REP_simps(2) Maps.REP_simps(3) \.chine_in_hom \.cod.leg_in_hom(2) \.dom.leg_simps(3) \.leg1_commutes ide_hcomp Maps.ide_REP) thus ?thesis using Maps.CLS_eqI Maps.seq_char Maps.ide_REP by (meson calculation isomorphic_implies_ide(2)) qed also have "... \ tab\<^sub>1 r" using \_dom_leg1_eq Maps.CLS_REP Maps.CLS_eqI Maps.REP_CLS r.leg1_is_map by presburger finally show ?thesis by blast qed obtain \ where \: "\\ : tab\<^sub>1 r \ tab\<^sub>1 s \ Maps.REP \.chine\ \ iso \" using 2 isomorphic_symmetric by blast define \ where "\ \ (s \ \) \ \[s, tab\<^sub>0 s, Maps.REP \.chine] \ (s.tab \ Maps.REP \.chine) \ \" have \: "\\ : tab\<^sub>1 r \ s \ tab\<^sub>0 r\" proof (unfold \_def, intro comp_in_homI) show "\\ : tab\<^sub>1 r \ tab\<^sub>1 s \ Maps.REP \.chine\" using \ by simp show 3: "\s.tab \ Maps.REP \.chine : tab\<^sub>1 s \ Maps.REP \.chine \ (s \ tab\<^sub>0 s) \ Maps.REP \.chine\" apply (intro hcomp_in_vhom) apply auto using "1" by fastforce show "\\[s, tab\<^sub>0 s, Maps.REP \.chine] : (s \ tab\<^sub>0 s) \ Maps.REP \.chine \ s \ tab\<^sub>0 s \ Maps.REP \.chine\" using s assoc_in_hom [of s "tab\<^sub>0 s" "Maps.REP \.chine"] by (metis (no_types, lifting) Maps.ide_REP 3 \.chine_simps(1) hcomp_in_vhomE ideD(2) ideD(3) s.ide_u s.tab_simps(2) s.u_simps(3)) show "\s \ \ : s \ tab\<^sub>0 s \ Maps.REP \.chine \ s \ tab\<^sub>0 r\" using 1 s \ isomorphic_implies_hpar(4) src_eq by auto qed define \ where "\ \ r.T0.trnr\<^sub>\ s \ \ inv (r.T0.trnr\<^sub>\ r r.tab)" have \: "\\ : r \ s\" proof (unfold \_def, intro comp_in_homI) show "\inv (r.T0.trnr\<^sub>\ r r.tab) : r \ tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*\" using r.yields_isomorphic_representation by fastforce show "\r.T0.trnr\<^sub>\ s \ : tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>* \ s\" using s \ src_eq r.T0.adjoint_transpose_right(2) [of s "tab\<^sub>1 r"] by auto qed interpret \: arrow_in_bicategory_of_spans V H \ \ src trg r s \ using \ by unfold_locales auto interpret \: arrow_of_tabulations_in_maps V H \ \ src trg r r.tab \tab\<^sub>0 r\ \tab\<^sub>1 r\ s s.tab \tab\<^sub>0 s\ \tab\<^sub>1 s\ \ using \.is_arrow_of_tabulations_in_maps by simp have \_eq: "\ = \.\" proof - have "r.T0.trnr\<^sub>\ s \ \ inv (r.T0.trnr\<^sub>\ r r.tab) = r.T0.trnr\<^sub>\ s \.\ \ inv (r.T0.trnr\<^sub>\ r r.tab)" using \ \_def \.\_in_terms_of_\ by auto hence "r.T0.trnr\<^sub>\ s \ = r.T0.trnr\<^sub>\ s \.\" using r s \ r.T0.adjoint_transpose_right(2) r.yields_isomorphic_representation iso_inv_iso iso_is_retraction retraction_is_epi epiE by (metis \.in_hom \_def arrI) thus ?thesis using \ \.\_in_hom(2) src_eq r.T0.adjoint_transpose_right(6) bij_betw_imp_inj_on [of "r.T0.trnr\<^sub>\ s" "hom (tab\<^sub>1 r) (s \ tab\<^sub>0 r)" "hom (tab\<^sub>1 r \ (tab\<^sub>0 r)\<^sup>*) s"] inj_on_def [of "r.T0.trnr\<^sub>\ s" "hom (tab\<^sub>1 r) (s \ tab\<^sub>0 r)"] by simp qed have "\.is_induced_map (Maps.REP \.chine)" using \ \ \_eq \_def \.is_induced_map_iff \.chine_simps(1) Maps.ide_REP by blast hence 3: "Maps.REP \.chine \ \.chine" using \.chine_is_induced_map \.induced_map_unique by simp have "SPN \ = \" proof (intro Span.arr_eqI) show "Span.par (SPN \) \" using \ \ SPN_in_hom by (metis (no_types, lifting) SPN.preserves_cod SPN.preserves_dom Span.in_homE in_homE) show "Chn (SPN \) = \.chine" proof - have "Chn (SPN \) = \\spn \\\" using \ SPN_def spn_def by auto also have "... = \\\.chine\\" using \ spn_def by fastforce also have "... = \\Maps.REP \.chine\\" using 3 isomorphic_symmetric Maps.CLS_eqI iso_class_eqI isomorphic_implies_hpar(3) isomorphic_implies_hpar(4) by auto also have "... = \.chine" using Maps.CLS_REP \.chine_simps(1) by blast finally show ?thesis by blast qed qed thus "\\. \\ : r \ s\ \ SPN \ = \" using \ by auto qed qed theorem SPN_is_equivalence_pseudofunctor: shows "equivalence_pseudofunctor V H \ \ src trg Span.vcomp Span.hcomp Span.assoc Span.unit Span.src Span.trg SPN \" .. text \ We have completed the proof of the second half of the main result (CKS Theorem 4): \B\ is biequivalent (via \SPN\) to \Span(Maps(B))\. \ corollary shows "equivalent_bicategories V H \ \ src trg Span.vcomp Span.hcomp Span.assoc Span.unit Span.src Span.trg" using SPN_is_equivalence_pseudofunctor equivalent_bicategories_def by blast end end diff --git a/thys/Bicategory/Coherence.thy b/thys/Bicategory/Coherence.thy --- a/thys/Bicategory/Coherence.thy +++ b/thys/Bicategory/Coherence.thy @@ -1,3957 +1,3959 @@ (* Title: Coherence Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) section "Coherence" theory Coherence imports Bicategory begin text \ \sloppypar In this section, we generalize to bicategories the proof of the Coherence Theorem that we previously gave for monoidal categories (see \MonoidalCategory.evaluation_map.coherence\ in @{session MonoidalCategory}). As was the case for the previous proof, the current proof takes a syntactic approach. First we define a formal ``bicategorical language'' of terms constructed using syntactic operators that correspond to the various operations (vertical and horizontal composition, associators and unitors) found in a bicategory. Terms of the language are classified as formal ``arrows'', ``identities'', or ``objects'' according to the syntactic operators used in their formation. A class of terms called ``canonical'' is also defined in this way. Functions that map ``arrows'' to their ``domain'' and ``codomain'', and to their ``source'' and ``target'' are defined by recursion on the structure of terms. Next, we define a notion of ``normal form'' for terms in this language and we give a recursive definition of a function that maps terms to their normal forms. Normalization moves vertical composition inside of horizontal composition and ``flattens'' horizontal composition by associating all horizontal compositions to the right. In addition, normalization deletes from a term any horizontal composites involving an arrow and its source or target, replacing such composites by just the arrow itself. We then define a ``reduction function'' that maps each identity term \t\ to a ``canonical'' term \t\<^bold>\\ that connects \t\ with its normal form. The definition of reduction is also recursive, but it is somewhat more complex than normalization in that it involves two mutually recursive functions: one that applies to any identity term and another that applies only to terms that are the horizontal composite of two identity terms. The next step is to define an ``evaluation function'' that evaluates terms in a given bicategory (which is left as an unspecified parameter). We show that evaluation respects bicategorical structure: the domain, codomain, source, and target mappings on terms correspond under evaluation to the actual domain, codomain, source and target mappings on the given bicategory, the vertical and horizontal composition on terms correspond to the actual vertical and horizontal composition of the bicategory, and unit and associativity terms evaluate to the actual unit and associativity isomorphisms of the bicategory. In addition, ``object terms'' evaluate to objects (\emph{i.e.}~0-cells), ``identity terms'' evaluate to identities (\emph{i.e.}~1-cells), ``arrow terms'' evaluate to arrows (\emph{i.e.}~2-cells), and ``canonical terms'' evaluate to canonical isomorphisms. A term is defined to be ``coherent'' if, roughly speaking, it is a formal arrow whose evaluation commutes with the evaluations of the reductions to normal form of its domain and codomain. We then prove the Coherence Theorem, expressed in the form: ``every arrow is coherent.'' This implies a more classical version of the Coherence Theorem, which says that: ``syntactically parallel arrows with the same normal form have equal evaluations''. \ subsection "Bicategorical Language" text \ For the most part, the definition of the ``bicategorical language'' of terms is a straightforward generalization of the ``monoidal language'' that we used for monoidal categories. Some modifications are required, however, due to the fact that horizontal composition in a bicategory is a partial operation, whereas the the tensor product in a monoidal category is well-defined for all pairs of arrows. One difference is that we have found it necessary to introduce a new class of primitive terms whose elements represent ``formal objects'', so that there is some way to identify the source and target of what would otherwise be an empty horizontal composite. This was not an issue for monoidal categories, because the totality of horizontal composition meant that there was no need for syntactically defined sources and targets. Another difference is what we have chosen for the ``generators'' of the language and how they are used to form primitive terms. For monoidal categories, we supposed that we were given a category \C\ and the syntax contained a constructor to form a primitive term corresponding to each arrow of \C\. We assumed a category as the given data, rather than something less structured, such as a graph, because we were primarily interested in the tensor product and the associators and unitors, and were relatively uninterested in the strictly associative and unital composition of the underlying category. For bicategories, we also take the vertical composition as given for the same reasons; however, this is not yet sufficient due to the fact that horizontal composition in a bicategory is a partial operation, in contrast to the tensor product in a monoidal category, which is defined for all pairs of arrows. To deal with this issue, for bicategories we assume that source and target mappings are also given, so that the given data forms a category with ``horizontal homs''. The given source and target mappings are extended to all terms and used to define when two terms are ``formally horizontally composable''. \ locale bicategorical_language = category V + horizontal_homs V src trg for V :: "'a comp" (infixr "\" 55) and src :: "'a \ 'a" and trg :: "'a \ 'a" begin text \ Constructor \Prim\<^sub>0\ is used to construct ``formal objects'' and \Prim\ is used to construct primitive terms that are not formal objects. \ datatype (discs_sels) 't "term" = Prim\<^sub>0 't ("\<^bold>\_\<^bold>\\<^sub>0") | Prim 't ("\<^bold>\_\<^bold>\") | Hcomp "'t term" "'t term" (infixr "\<^bold>\" 53) | Vcomp "'t term" "'t term" (infixr "\<^bold>\" 55) | Lunit "'t term" ("\<^bold>\\<^bold>[_\<^bold>]") | Lunit' "'t term" ("\<^bold>\\<^sup>-\<^sup>1\<^bold>[_\<^bold>]") | Runit "'t term" ("\<^bold>\\<^bold>[_\<^bold>]") | Runit' "'t term" ("\<^bold>\\<^sup>-\<^sup>1\<^bold>[_\<^bold>]") | Assoc "'t term" "'t term" "'t term" ("\<^bold>\\<^bold>[_, _, _\<^bold>]") | Assoc' "'t term" "'t term" "'t term" ("\<^bold>\\<^sup>-\<^sup>1\<^bold>[_, _, _\<^bold>]") text \ We define formal domain, codomain, source, and target functions on terms. \ primrec Src :: "'a term \ 'a term" where "Src \<^bold>\\\<^bold>\\<^sub>0 = \<^bold>\\\<^bold>\\<^sub>0" | "Src \<^bold>\\\<^bold>\ = \<^bold>\src \\<^bold>\\<^sub>0" | "Src (t \<^bold>\ u) = Src u" | "Src (t \<^bold>\ u) = Src t" | "Src \<^bold>\\<^bold>[t\<^bold>] = Src t" | "Src \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Src t" | "Src \<^bold>\\<^bold>[t\<^bold>] = Src t" | "Src \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Src t" | "Src \<^bold>\\<^bold>[t, u, v\<^bold>] = Src v" | "Src \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = Src v" primrec Trg :: "'a term \ 'a term" where "Trg \<^bold>\\\<^bold>\\<^sub>0 = \<^bold>\\\<^bold>\\<^sub>0" | "Trg \<^bold>\\\<^bold>\ = \<^bold>\trg \\<^bold>\\<^sub>0" | "Trg (t \<^bold>\ u) = Trg t" | "Trg (t \<^bold>\ u) = Trg t" | "Trg \<^bold>\\<^bold>[t\<^bold>] = Trg t" | "Trg \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Trg t" | "Trg \<^bold>\\<^bold>[t\<^bold>] = Trg t" | "Trg \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Trg t" | "Trg \<^bold>\\<^bold>[t, u, v\<^bold>] = Trg t" | "Trg \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = Trg t" primrec Dom :: "'a term \ 'a term" where "Dom \<^bold>\\\<^bold>\\<^sub>0 = \<^bold>\\\<^bold>\\<^sub>0" | "Dom \<^bold>\\\<^bold>\ = \<^bold>\dom \\<^bold>\" | "Dom (t \<^bold>\ u) = Dom t \<^bold>\ Dom u" | "Dom (t \<^bold>\ u) = Dom u" | "Dom \<^bold>\\<^bold>[t\<^bold>] = Trg t \<^bold>\ Dom t" | "Dom \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Dom t" | "Dom \<^bold>\\<^bold>[t\<^bold>] = Dom t \<^bold>\ Src t" | "Dom \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Dom t" | "Dom \<^bold>\\<^bold>[t, u, v\<^bold>] = (Dom t \<^bold>\ Dom u) \<^bold>\ Dom v" | "Dom \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = Dom t \<^bold>\ (Dom u \<^bold>\ Dom v)" primrec Cod :: "'a term \ 'a term" where "Cod \<^bold>\\\<^bold>\\<^sub>0 = \<^bold>\\\<^bold>\\<^sub>0" | "Cod \<^bold>\\\<^bold>\ = \<^bold>\cod \\<^bold>\" | "Cod (t \<^bold>\ u) = Cod t \<^bold>\ Cod u" | "Cod (t \<^bold>\ u) = Cod t" | "Cod \<^bold>\\<^bold>[t\<^bold>] = Cod t" | "Cod \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Trg t \<^bold>\ Cod t" | "Cod \<^bold>\\<^bold>[t\<^bold>] = Cod t" | "Cod \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Cod t \<^bold>\ Src t" | "Cod \<^bold>\\<^bold>[t, u, v\<^bold>] = Cod t \<^bold>\ (Cod u \<^bold>\ Cod v)" | "Cod \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = (Cod t \<^bold>\ Cod u) \<^bold>\ Cod v" text \ A term is a ``formal arrow'' if it is constructed from primitive arrows in such a way that horizontal and vertical composition are applied only to formally composable pairs of terms. The definitions of ``formal identity'' and ``formal object'' follow a similar pattern. \ primrec Arr :: "'a term \ bool" where "Arr \<^bold>\\\<^bold>\\<^sub>0 = obj \" | "Arr \<^bold>\\\<^bold>\ = arr \" | "Arr (t \<^bold>\ u) = (Arr t \ Arr u \ Src t = Trg u)" | "Arr (t \<^bold>\ u) = (Arr t \ Arr u \ Dom t = Cod u)" | "Arr \<^bold>\\<^bold>[t\<^bold>] = Arr t" | "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Arr t" | "Arr \<^bold>\\<^bold>[t\<^bold>] = Arr t" | "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Arr t" | "Arr \<^bold>\\<^bold>[t, u, v\<^bold>] = (Arr t \ Arr u \ Arr v \ Src t = Trg u \ Src u = Trg v)" | "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = (Arr t \ Arr u \ Arr v \ Src t = Trg u \ Src u = Trg v)" primrec Ide :: "'a term \ bool" where "Ide \<^bold>\\\<^bold>\\<^sub>0 = obj \" | "Ide \<^bold>\\\<^bold>\ = ide \" | "Ide (t \<^bold>\ u) = (Ide t \ Ide u \ Src t = Trg u)" | "Ide (t \<^bold>\ u) = False" | "Ide \<^bold>\\<^bold>[t\<^bold>] = False" | "Ide \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = False" | "Ide \<^bold>\\<^bold>[t\<^bold>] = False" | "Ide \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = False" | "Ide \<^bold>\\<^bold>[t, u, v\<^bold>] = False" | "Ide \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = False" primrec Obj :: "'a term \ bool" where "Obj \<^bold>\\\<^bold>\\<^sub>0 = obj \" | "Obj \<^bold>\\\<^bold>\ = False" | "Obj (t \<^bold>\ u) = False" | "Obj (t \<^bold>\ u) = False" | "Obj \<^bold>\\<^bold>[t\<^bold>] = False" | "Obj \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = False" | "Obj \<^bold>\\<^bold>[t\<^bold>] = False" | "Obj \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = False" | "Obj \<^bold>\\<^bold>[t, u, v\<^bold>] = False" | "Obj \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = False" abbreviation HSeq :: "'a term \ 'a term \ bool" where "HSeq t u \ Arr t \ Arr u \ Src t = Trg u" abbreviation VSeq :: "'a term \ 'a term \ bool" where "VSeq t u \ Arr t \ Arr u \ Dom t = Cod u" abbreviation HPar :: "'a term => 'a term \ bool" where "HPar t u \ Arr t \ Arr u \ Src t = Src u \ Trg t = Trg u" abbreviation VPar :: "'a term => 'a term \ bool" where "VPar t u \ Arr t \ Arr u \ Dom t = Dom u \ Cod t = Cod u" abbreviation HHom :: "'a term \ 'a term \ 'a term set" where "HHom a b \ { t. Arr t \ Src t = a \ Trg t = b }" abbreviation VHom :: "'a term \ 'a term \ 'a term set" where "VHom f g \ { t. Arr t \ Dom t = f \ Cod t = g }" lemma is_Prim0_Src: shows "is_Prim\<^sub>0 (Src t)" by (induct t; simp) lemma is_Prim0_Trg: shows "is_Prim\<^sub>0 (Trg t)" by (induct t; simp) lemma Src_Src [simp]: shows "Arr t \ Src (Src t) = Src t" by (induct t) auto lemma Trg_Trg [simp]: shows "Arr t \ Trg (Trg t) = Trg t" by (induct t) auto lemma Src_Trg [simp]: shows "Arr t \ Src (Trg t) = Trg t" by (induct t) auto lemma Trg_Src [simp]: shows "Arr t \ Trg (Src t) = Src t" by (induct t) auto lemma Dom_Src [simp]: shows "Arr t \ Dom (Src t) = Src t" by (induct t) auto lemma Dom_Trg [simp]: shows "Arr t \ Dom (Trg t) = Trg t" by (induct t) auto lemma Cod_Src [simp]: shows "Arr t \ Cod (Src t) = Src t" by (induct t) auto lemma Cod_Trg [simp]: shows "Arr t \ Cod (Trg t) = Trg t" by (induct t) auto lemma Src_Dom_Cod: shows "Arr t \ Src (Dom t) = Src t \ Src (Cod t) = Src t" using src_dom src_cod by (induct t) auto lemma Src_Dom [simp]: shows "Arr t \ Src (Dom t) = Src t" using Src_Dom_Cod by blast lemma Src_Cod [simp]: shows "Arr t \ Src (Cod t) = Src t" using Src_Dom_Cod by blast lemma Trg_Dom_Cod: shows "Arr t \ Trg (Dom t) = Trg t \ Trg (Cod t) = Trg t" using trg_dom trg_cod by (induct t) auto lemma Trg_Dom [simp]: shows "Arr t \ Trg (Dom t) = Trg t" using Trg_Dom_Cod by blast lemma Trg_Cod [simp]: shows "Arr t \ Trg (Cod t) = Trg t" using Trg_Dom_Cod by blast lemma VSeq_implies_HPar: shows "VSeq t u \ HPar t u" using Src_Dom [of t] Src_Cod [of u] Trg_Dom [of t] Trg_Cod [of u] by auto lemma Dom_Dom [simp]: shows "Arr t \ Dom (Dom t) = Dom t" by (induct t, auto) lemma Cod_Cod [simp]: shows "Arr t \ Cod (Cod t) = Cod t" by (induct t, auto) lemma Dom_Cod [simp]: shows "Arr t \ Dom (Cod t) = Cod t" by (induct t, auto) lemma Cod_Dom [simp]: shows "Arr t \ Cod (Dom t) = Dom t" by (induct t, auto) lemma Obj_implies_Ide (*[simp]*): shows "Obj t \ Ide t" by (induct t) auto lemma Ide_implies_Arr [simp]: shows "Ide t \ Arr t" by (induct t, auto) lemma Dom_Ide: shows "Ide t \ Dom t = t" by (induct t, auto) lemma Cod_Ide: shows "Ide t \ Cod t = t" by (induct t, auto) lemma Obj_Src [simp]: shows "Arr t \ Obj (Src t)" by (induct t) auto lemma Obj_Trg [simp]: shows "Arr t \ Obj (Trg t)" by (induct t) auto lemma Ide_Dom [simp]: shows "Arr t \ Ide (Dom t)" using Obj_implies_Ide by (induct t, auto) lemma Ide_Cod [simp]: shows "Arr t \ Ide (Cod t)" using Obj_implies_Ide by (induct t, auto) lemma Arr_in_Hom: assumes "Arr t" shows "t \ HHom (Src t) (Trg t)" and "t \ VHom (Dom t) (Cod t)" proof - have 1: "Arr t \ t \ HHom (Src t) (Trg t) \ t \ VHom (Dom t) (Cod t)" by (induct t, auto) show "t \ HHom (Src t) (Trg t)" using assms 1 by simp show "t \ VHom (Dom t) (Cod t)" using assms 1 by simp qed lemma Ide_in_Hom: assumes "Ide t" shows "t \ HHom (Src t) (Trg t)" and "t \ VHom t t" proof - have 1: "Ide t \ t \ HHom (Src t) (Trg t) \ t \ VHom t t" by (induct t, auto) show "t \ HHom (Src t) (Trg t)" using assms 1 by simp show "t \ VHom t t" using assms 1 by simp qed lemma Obj_in_Hom: assumes "Obj t" shows "t \ HHom t t" and "t \ VHom t t" proof - have 1: "Obj t \ t \ HHom t t \ t \ VHom t t" by (induct t, auto) show "t \ HHom t t" using assms 1 by simp show "t \ VHom t t" using assms 1 by simp qed text \ A formal arrow is ``canonical'' if the only primitive arrows used in its construction are objects and identities. \ primrec Can :: "'a term \ bool" where "Can \<^bold>\\\<^bold>\\<^sub>0 = obj \" | "Can \<^bold>\\\<^bold>\ = ide \" | "Can (t \<^bold>\ u) = (Can t \ Can u \ Src t = Trg u)" | "Can (t \<^bold>\ u) = (Can t \ Can u \ Dom t = Cod u)" | "Can \<^bold>\\<^bold>[t\<^bold>] = Can t" | "Can \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Can t" | "Can \<^bold>\\<^bold>[t\<^bold>] = Can t" | "Can \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = Can t" | "Can \<^bold>\\<^bold>[t, u, v\<^bold>] = (Can t \ Can u \ Can v \ Src t = Trg u \ Src u = Trg v)" | "Can \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = (Can t \ Can u \ Can v \ Src t = Trg u \ Src u = Trg v)" lemma Ide_implies_Can: shows "Ide t \ Can t" by (induct t, auto) lemma Can_implies_Arr: shows "Can t \ Arr t" by (induct t, auto) text \ Canonical arrows can be formally inverted. \ primrec Inv :: "'a term \ 'a term" where "Inv \<^bold>\\\<^bold>\\<^sub>0 = \<^bold>\\\<^bold>\\<^sub>0" | "Inv \<^bold>\\\<^bold>\ = \<^bold>\inv \\<^bold>\" | "Inv (t \<^bold>\ u) = (Inv t \<^bold>\ Inv u)" | "Inv (t \<^bold>\ u) = (Inv u \<^bold>\ Inv t)" | "Inv \<^bold>\\<^bold>[t\<^bold>] = \<^bold>\\<^sup>-\<^sup>1\<^bold>[Inv t\<^bold>]" | "Inv \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = \<^bold>\\<^bold>[Inv t\<^bold>]" | "Inv \<^bold>\\<^bold>[t\<^bold>] = \<^bold>\\<^sup>-\<^sup>1\<^bold>[Inv t\<^bold>]" | "Inv \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = \<^bold>\\<^bold>[Inv t\<^bold>]" | "Inv \<^bold>\\<^bold>[t, u, v\<^bold>] = \<^bold>\\<^sup>-\<^sup>1\<^bold>[Inv t, Inv u, Inv v\<^bold>]" | "Inv \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = \<^bold>\\<^bold>[Inv t, Inv u, Inv v\<^bold>]" lemma Src_Inv [simp]: shows "Can t \ Src (Inv t) = Src t" using Can_implies_Arr VSeq_implies_HPar apply (induct t, auto) by metis lemma Trg_Inv [simp]: shows "Can t \ Trg (Inv t) = Trg t" using Can_implies_Arr VSeq_implies_HPar apply (induct t, auto) by metis lemma Dom_Inv [simp]: shows "Can t \ Dom (Inv t) = Cod t" by (induct t, auto) lemma Cod_Inv [simp]: shows "Can t \ Cod (Inv t) = Dom t" by (induct t, auto) lemma Inv_preserves_Ide: shows "Ide t \ Ide (Inv t)" using Ide_implies_Can by (induct t, auto) lemma Can_Inv [simp]: shows "Can t \ Can (Inv t)" by (induct t, auto) lemma Inv_in_Hom [intro]: assumes "Can t" shows "Inv t \ HHom (Src t) (Trg t)" and "Inv t \ VHom (Cod t) (Dom t)" using assms Can_Inv Can_implies_Arr by simp_all lemma Inv_Ide [simp]: assumes "Ide a" shows "Inv a = a" using assms by (induct a, auto) lemma Inv_Inv [simp]: assumes "Can t" shows "Inv (Inv t) = t" using assms by (induct t, auto) subsection "Normal Terms" text \ We call a term ``normal'' if it is either a formal object or it is constructed from primitive arrows using only horizontal composition associated to the right. Essentially, such terms are (typed) composable sequences of arrows of @{term V}, where the empty list is represented by a formal object and \\<^bold>\\ is used as the list constructor. \ fun Nml :: "'a term \ bool" where "Nml \<^bold>\\\<^bold>\\<^sub>0 = obj \" | "Nml \<^bold>\\\<^bold>\ = arr \" | "Nml (\<^bold>\\\<^bold>\ \<^bold>\ u) = (arr \ \ Nml u \ \ is_Prim\<^sub>0 u \ \<^bold>\src \\<^bold>\\<^sub>0 = Trg u)" | "Nml _ = False" lemma Nml_HcompD: assumes "Nml (t \<^bold>\ u)" shows "\<^bold>\un_Prim t\<^bold>\ = t" and "arr (un_Prim t)" and "Nml t" and "Nml u" and "\ is_Prim\<^sub>0 u" and "\<^bold>\src (un_Prim t)\<^bold>\\<^sub>0 = Trg u" and "Src t = Trg u" proof - have 1: "t = \<^bold>\un_Prim t\<^bold>\ \ arr (un_Prim t) \ Nml t \ Nml u \ \ is_Prim\<^sub>0 u \ \<^bold>\src (un_Prim t)\<^bold>\\<^sub>0 = Trg u" using assms by (cases t; simp; cases u; simp) show "\<^bold>\un_Prim t\<^bold>\ = t" using 1 by simp show "arr (un_Prim t)" using 1 by simp show "Nml t" using 1 by simp show "Nml u" using 1 by simp show "\ is_Prim\<^sub>0 u" using 1 by simp show "\<^bold>\src (un_Prim t)\<^bold>\\<^sub>0 = Trg u" using 1 by simp show "Src t = Trg u" using assms apply (cases t) by simp_all qed lemma Nml_implies_Arr: shows "Nml t \ Arr t" by (induct t, auto simp add: Nml_HcompD) lemma Nml_Src [simp]: shows "Nml t \ Nml (Src t)" apply (induct t, simp_all) using Nml_HcompD by metis lemma Nml_Trg [simp]: shows "Nml t \ Nml (Trg t)" apply (induct t, simp_all) using Nml_HcompD by metis lemma Nml_Dom [simp]: shows "Nml t \ Nml (Dom t)" proof (induct t, simp_all add: Nml_HcompD) fix u v assume I1: "Nml (Dom u)" assume I2: "Nml (Dom v)" assume uv: "Nml (u \<^bold>\ v)" show "Nml (Dom u \<^bold>\ Dom v)" proof - have 1: "is_Prim (Dom u) \ arr (un_Prim (Dom u)) \ Dom u = \<^bold>\dom (un_Prim u)\<^bold>\" using uv by (cases u; simp; cases v, simp_all) have 2: "Nml v \ \ is_Prim\<^sub>0 v \ \ is_Vcomp v \ \ is_Lunit' v \ \ is_Runit' v" using uv by (cases u, simp_all; cases v, simp_all) have "arr (dom (un_Prim u))" using 1 by fastforce moreover have "Nml (Dom v) \ \ is_Prim\<^sub>0 v" using 2 I2 by (cases v, simp_all) moreover have "\<^bold>\src (dom (un_Prim u))\<^bold>\\<^sub>0 = Trg (Dom v)" proof - have "Trg (Dom v) = Src (Dom u)" using uv Nml_implies_Arr by fastforce also have "... = \<^bold>\src (dom (un_Prim u))\<^bold>\\<^sub>0" using 1 by fastforce finally show ?thesis by argo qed moreover have "\ is_Prim\<^sub>0 (Dom v)" using 2 by (cases v, simp_all) ultimately show ?thesis using 1 2 by simp qed qed lemma Nml_Cod [simp]: shows "Nml t \ Nml (Cod t)" proof (induct t, simp_all add: Nml_HcompD) fix u v assume I1: "Nml (Cod u)" assume I2: "Nml (Cod v)" assume uv: "Nml (u \<^bold>\ v)" show "Nml (Cod u \<^bold>\ Cod v)" proof - have 1: "is_Prim (Cod u) \ arr (un_Prim (Cod u)) \ Cod u = \<^bold>\cod (un_Prim u)\<^bold>\" using uv by (cases u; simp; cases v, simp_all) have 2: "Nml v \ \ is_Prim\<^sub>0 v \ \ is_Vcomp v \ \ is_Lunit' v \ \ is_Runit' v" using uv by (cases u; simp; cases v, simp_all) have "arr (cod (un_Prim u))" using 1 by fastforce moreover have "Nml (Cod v) \ \ is_Prim\<^sub>0 v" using 2 I2 by (cases v, simp_all) moreover have "\<^bold>\src (cod (un_Prim u))\<^bold>\\<^sub>0 = Trg (Cod v)" proof - have "Trg (Cod v) = Src (Cod u)" using uv Nml_implies_Arr by fastforce also have "... = \<^bold>\src (cod (un_Prim u))\<^bold>\\<^sub>0" using 1 by fastforce finally show ?thesis by argo qed moreover have "\ is_Prim\<^sub>0 (Cod v)" using 2 by (cases v; simp) ultimately show ?thesis using 1 2 by simp qed qed lemma Nml_Inv [simp]: assumes "Can t" and "Nml t" shows "Nml (Inv t)" proof - have "Can t \ Nml t \ Nml (Inv t)" apply (induct t, simp_all) proof - fix u v assume I1: "Nml u \ Nml (Inv u)" assume I2: "Nml v \ Nml (Inv v)" assume uv: "Can u \ Can v \ Src u = Trg v \ Nml (u \<^bold>\ v)" show "Nml (Inv u \<^bold>\ Inv v)" proof - have u: "Arr u \ Can u" using uv Can_implies_Arr by blast have v: "Arr v \ Can v" using uv Can_implies_Arr by blast have 1: "\<^bold>\un_Prim u\<^bold>\ = u \ ide (un_Prim u) \ Nml u \ Nml v \ \ is_Prim\<^sub>0 v \ \<^bold>\src (un_Prim u)\<^bold>\\<^sub>0 = Trg v" using uv Nml_HcompD [of u v] apply simp using uv by (cases u, simp_all) have 2: "\<^bold>\un_Prim (Inv u)\<^bold>\ = Inv u \ arr (un_Prim (Inv u)) \ Nml (Inv u)" using 1 by (cases u; simp) moreover have "Nml (Inv v) \ \ is_Prim\<^sub>0 (Inv v)" using 1 I2 by (cases v, simp_all) moreover have "\<^bold>\src (un_Prim (Inv u))\<^bold>\\<^sub>0 = Trg (Inv v)" using 1 2 v by (cases u, simp_all) ultimately show ?thesis by (cases u, simp_all) qed qed thus ?thesis using assms by blast qed text \ The following function defines a horizontal composition for normal terms. If such terms are regarded as lists, this is just (typed) list concatenation. \ fun HcompNml (infixr "\<^bold>\\<^bold>\\<^bold>\" 53) where "\<^bold>\\\<^bold>\\<^sub>0 \<^bold>\\<^bold>\\<^bold>\ u = u" | "t \<^bold>\\<^bold>\\<^bold>\ \<^bold>\\\<^bold>\\<^sub>0 = t" | "\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u = \<^bold>\\\<^bold>\ \<^bold>\ u" | "(t \<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = t \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" | "t \<^bold>\\<^bold>\\<^bold>\ u = undefined" lemma HcompNml_Prim [simp]: assumes "\ is_Prim\<^sub>0 t" shows "\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ t = \<^bold>\\\<^bold>\ \<^bold>\ t" using assms by (cases t, simp_all) lemma HcompNml_term_Prim\<^sub>0 [simp]: assumes "Src t = Trg \<^bold>\\\<^bold>\\<^sub>0" shows "t \<^bold>\\<^bold>\\<^bold>\ \<^bold>\\\<^bold>\\<^sub>0 = t" using assms by (cases t, simp_all) lemma HcompNml_Nml: assumes "Nml (t \<^bold>\ u)" shows "t \<^bold>\\<^bold>\\<^bold>\ u = t \<^bold>\ u" using assms HcompNml_Prim by (metis Nml_HcompD(1) Nml_HcompD(5)) lemma Nml_HcompNml: assumes "Nml t" and "Nml u" and "Src t = Trg u" shows "Nml (t \<^bold>\\<^bold>\\<^bold>\ u)" and "Dom (t \<^bold>\\<^bold>\\<^bold>\ u) = Dom t \<^bold>\\<^bold>\\<^bold>\ Dom u" and "Cod (t \<^bold>\\<^bold>\\<^bold>\ u) = Cod t \<^bold>\\<^bold>\\<^bold>\ Cod u" and "Src (t \<^bold>\\<^bold>\\<^bold>\ u) = Src u" and "Trg (t \<^bold>\\<^bold>\\<^bold>\ u) = Trg t" proof - have 0: "\u. \ Nml t; Nml u; Src t = Trg u \ \ Nml (t \<^bold>\\<^bold>\\<^bold>\ u) \ Dom (t \<^bold>\\<^bold>\\<^bold>\ u) = Dom t \<^bold>\\<^bold>\\<^bold>\ Dom u \ Cod (t \<^bold>\\<^bold>\\<^bold>\ u) = Cod t \<^bold>\\<^bold>\\<^bold>\ Cod u \ Src (t \<^bold>\\<^bold>\\<^bold>\ u) = Src u \ Trg (t \<^bold>\\<^bold>\\<^bold>\ u) = Trg t" proof (induct t, simp_all add: Nml_HcompD(1-4)) fix \ :: 'a and u :: "'a term" assume \: "arr \" assume u: "Nml u" assume 1: "\<^bold>\src \\<^bold>\\<^sub>0 = Trg u" show "Nml (\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) \ Dom (\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) = \<^bold>\dom \\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ Dom u \ Cod (\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) = \<^bold>\cod \\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ Cod u \ Src (\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) = Src u \ Trg (\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) = \<^bold>\trg \\<^bold>\\<^sub>0" using u \ 1 by (cases u, simp_all) next fix u v w assume I1: "\x. Nml x \ Src v = Trg x \ Nml (v \<^bold>\\<^bold>\\<^bold>\ x) \ Dom (v \<^bold>\\<^bold>\\<^bold>\ x) = Dom v \<^bold>\\<^bold>\\<^bold>\ Dom x \ Cod (v \<^bold>\\<^bold>\\<^bold>\ x) = Cod v \<^bold>\\<^bold>\\<^bold>\ Cod x \ Src (v \<^bold>\\<^bold>\\<^bold>\ x) = Src x \ Trg (v \<^bold>\\<^bold>\\<^bold>\ x) = Trg v" assume I2: "\x. Nml x \ Trg u = Trg x \ Nml (w \<^bold>\\<^bold>\\<^bold>\ x) \ Dom (w \<^bold>\\<^bold>\\<^bold>\ x) = Dom w \<^bold>\\<^bold>\\<^bold>\ Dom x \ Cod (w \<^bold>\\<^bold>\\<^bold>\ x) = Cod w \<^bold>\\<^bold>\\<^bold>\ Cod x \ Src (w \<^bold>\\<^bold>\\<^bold>\ x) = Src x \ Trg (w \<^bold>\\<^bold>\\<^bold>\ x) = Trg w" assume vw: "Nml (v \<^bold>\ w)" assume u: "Nml u" assume wu: "Src w = Trg u" show "Nml ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) \ Dom ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = (Dom v \<^bold>\ Dom w) \<^bold>\\<^bold>\\<^bold>\ Dom u \ Cod ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = (Cod v \<^bold>\ Cod w) \<^bold>\\<^bold>\\<^bold>\ Cod u \ Src ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = Src u \ Trg ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = Trg v" proof - have v: "v = \<^bold>\un_Prim v\<^bold>\ \ Nml v" using vw Nml_implies_Arr Nml_HcompD by metis have w: "Nml w \ \ is_Prim\<^sub>0 w \ \<^bold>\src (un_Prim v)\<^bold>\\<^sub>0 = Trg w" using vw by (simp add: Nml_HcompD) have "is_Prim\<^sub>0 u \ ?thesis" by (cases u; simp add: vw wu) moreover have "\ is_Prim\<^sub>0 u \ ?thesis" proof - assume 1: "\ is_Prim\<^sub>0 u" have "Src v = Trg (w \<^bold>\\<^bold>\\<^bold>\ u)" using u v w I2 [of u] by (cases v, simp_all) hence "Nml (v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u) \ Dom (v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u) = Dom v \<^bold>\\<^bold>\\<^bold>\ Dom (w \<^bold>\\<^bold>\\<^bold>\ u) \ Cod (v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u) = Cod v \<^bold>\\<^bold>\\<^bold>\ Cod (w \<^bold>\\<^bold>\\<^bold>\ u) \ Src (v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u) = Src u \ Trg (v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u) = Trg v" using u v w I1 [of "w \<^bold>\\<^bold>\\<^bold>\ u"] I2 [of u] by argo moreover have "v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u = (v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u" using 1 by (cases u, simp_all) moreover have "(Dom v \<^bold>\ Dom w) \<^bold>\\<^bold>\\<^bold>\ Dom u = Dom v \<^bold>\\<^bold>\\<^bold>\ Dom (w \<^bold>\\<^bold>\\<^bold>\ u)" using v w u vw 1 I2 Nml_Dom HcompNml_Prim Nml_HcompD(1) Nml_HcompD(5) by (cases u, simp_all) moreover have "(Cod v \<^bold>\ Cod w) \<^bold>\\<^bold>\\<^bold>\ Cod u = Cod v \<^bold>\\<^bold>\\<^bold>\ Cod (w \<^bold>\\<^bold>\\<^bold>\ u)" using v w u vw 1 I2 Nml_HcompD(1) Nml_HcompD(5) HcompNml_Prim by (cases u, simp_all) ultimately show ?thesis by argo qed ultimately show ?thesis by blast qed next fix a u assume a: "obj a" assume u: "Nml u" assume au: "\<^bold>\a\<^bold>\\<^sub>0 = Trg u" show "Nml (Trg u \<^bold>\\<^bold>\\<^bold>\ u) \ Dom (Trg u \<^bold>\\<^bold>\\<^bold>\ u) = Dom (Trg u) \<^bold>\\<^bold>\\<^bold>\ Dom u \ Cod (Trg u \<^bold>\\<^bold>\\<^bold>\ u) = Cod (Trg u) \<^bold>\\<^bold>\\<^bold>\ Cod u \ Src (Trg u \<^bold>\\<^bold>\\<^bold>\ u) = Src u \ Trg (Trg u \<^bold>\\<^bold>\\<^bold>\ u) = Trg (Trg u)" using au by (metis Cod.simps(1) Dom.simps(1) HcompNml.simps(1) Trg.simps(1) u) qed show "Nml (t \<^bold>\\<^bold>\\<^bold>\ u) " using assms 0 by blast show "Dom (t \<^bold>\\<^bold>\\<^bold>\ u) = Dom t \<^bold>\\<^bold>\\<^bold>\ Dom u" using assms 0 by blast show "Cod (t \<^bold>\\<^bold>\\<^bold>\ u) = Cod t \<^bold>\\<^bold>\\<^bold>\ Cod u" using assms 0 by blast show "Src (t \<^bold>\\<^bold>\\<^bold>\ u) = Src u" using assms 0 by blast show "Trg (t \<^bold>\\<^bold>\\<^bold>\ u) = Trg t" using assms 0 by blast qed lemma HcompNml_in_Hom [intro]: assumes "Nml t" and "Nml u" and "Src t = Trg u" shows "t \<^bold>\\<^bold>\\<^bold>\ u \ HHom (Src u) (Trg t)" and "t \<^bold>\\<^bold>\\<^bold>\ u \ VHom (Dom t \<^bold>\\<^bold>\\<^bold>\ Dom u) (Cod t \<^bold>\\<^bold>\\<^bold>\ Cod u)" using assms Nml_HcompNml Nml_implies_Arr by auto lemma Src_HcompNml: assumes "Nml t" and "Nml u" and "Src t = Trg u" shows "Src (t \<^bold>\\<^bold>\\<^bold>\ u) = Src u" using assms Nml_HcompNml(4) by simp lemma Trg_HcompNml: assumes "Nml t" and "Nml u" and "Src t = Trg u" shows "Trg (t \<^bold>\\<^bold>\\<^bold>\ u) = Trg t" using assms Nml_HcompNml(5) by simp lemma Dom_HcompNml: assumes "Nml t" and "Nml u" and "Src t = Trg u" shows "Dom (t \<^bold>\\<^bold>\\<^bold>\ u) = Dom t \<^bold>\\<^bold>\\<^bold>\ Dom u" using assms Nml_HcompNml(2) by simp lemma Cod_HcompNml: assumes "Nml t" and "Nml u" and "Src t = Trg u" shows "Cod (t \<^bold>\\<^bold>\\<^bold>\ u) = Cod t \<^bold>\\<^bold>\\<^bold>\ Cod u" using assms Nml_HcompNml(3) by simp lemma is_Hcomp_HcompNml: assumes "Nml t" and "Nml u" and "Src t = Trg u" and "\ is_Prim\<^sub>0 t" and "\ is_Prim\<^sub>0 u" shows "is_Hcomp (t \<^bold>\\<^bold>\\<^bold>\ u)" proof - have "\ \ is_Hcomp (t \<^bold>\\<^bold>\\<^bold>\ u); Nml t; Nml u; Src t = Trg u; \ is_Prim\<^sub>0 t; \ is_Prim\<^sub>0 u \ \ False" proof (induct t, simp_all add: Nml_HcompD) fix a assume a: "obj a" assume u: "Nml u" assume 1: "\ is_Hcomp u" assume 2: "\ is_Prim\<^sub>0 (Trg u)" show "False" using u 1 2 by (cases u; simp) next fix v w assume I2: "\ is_Hcomp (w \<^bold>\\<^bold>\\<^bold>\ u) \ False" assume vw: "Nml (v \<^bold>\ w)" assume u: "Nml u" assume 1: "\ is_Hcomp ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u)" assume 2: "\ is_Prim\<^sub>0 u" assume 3: "Src w = Trg u" show "False" proof - have v: "v = \<^bold>\un_Prim v\<^bold>\" - using vw Nml_HcompD by force + using vw Nml_HcompD by metis have w: "Nml w \ \ is_Prim\<^sub>0 w \ \<^bold>\src (un_Prim v)\<^bold>\\<^sub>0 = Trg w" using vw Nml_HcompD [of v w] by blast have "(v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u = v \<^bold>\ (w \<^bold>\\<^bold>\\<^bold>\ u)" proof - have "(v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u = \<^bold>\un_Prim v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ (w \<^bold>\\<^bold>\\<^bold>\ u)" using u v 2 by (cases u, simp_all) also have "... = \<^bold>\un_Prim v\<^bold>\ \<^bold>\ (w \<^bold>\\<^bold>\\<^bold>\ u)" using u w I2 by fastforce also have "... = v \<^bold>\ (w \<^bold>\\<^bold>\\<^bold>\ u)" using v by simp finally show ?thesis by simp qed thus ?thesis using 1 by simp qed qed thus ?thesis using assms by blast qed text \ The following function defines the ``dimension'' of a term, which is the number of inputs (or outputs) when the term is regarded as an interconnection matrix. For normal terms, this is just the length of the term when regarded as a list of arrows of @{term C}. This function is used as a ranking of terms in the subsequent associativity proof. \ primrec dim :: "'a term \ nat" where "dim \<^bold>\\\<^bold>\\<^sub>0 = 0" | "dim \<^bold>\\\<^bold>\ = 1" | "dim (t \<^bold>\ u) = (dim t + dim u)" | "dim (t \<^bold>\ u) = dim t" | "dim \<^bold>\\<^bold>[t\<^bold>] = dim t" | "dim \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = dim t" | "dim \<^bold>\\<^bold>[t\<^bold>] = dim t" | "dim \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] = dim t" | "dim \<^bold>\\<^bold>[t, u, v\<^bold>] = dim t + dim u + dim v" | "dim \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] = dim t + dim u + dim v" lemma HcompNml_assoc: assumes "Nml t" and "Nml u" and "Nml v" and "Src t = Trg u" and "Src u = Trg v" shows "(t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = t \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" proof - have "\n t u v. \ dim t = n; Nml t; Nml u; Nml v; Src t = Trg u; Src u = Trg v \ \ (t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = t \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" proof - fix n show "\t u v. \ dim t = n; Nml t; Nml u; Nml v; Src t = Trg u; Src u = Trg v \ \ (t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = t \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" proof (induction n rule: nat_less_induct) fix n :: nat and t :: "'a term" and u v assume I: "\mt u v. dim t = m \ Nml t \ Nml u \ Nml v \ Src t = Trg u \ Src u = Trg v \ (t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = t \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" assume dim: "dim t = n" assume t: "Nml t" assume u: "Nml u" assume v: "Nml v" assume tu: "Src t = Trg u" assume uv: "Src u = Trg v" show "(t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = t \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" proof - have "is_Prim\<^sub>0 t \ ?thesis" by (cases t; simp) moreover have "\is_Prim\<^sub>0 t \ is_Prim\<^sub>0 u \ ?thesis" by (cases t; simp; cases u; simp) moreover have "\ is_Prim\<^sub>0 t \ \ is_Prim\<^sub>0 u \ is_Prim\<^sub>0 v \ ?thesis" proof - assume 1: "\ is_Prim\<^sub>0 t" assume 2: "\ is_Prim\<^sub>0 u" assume 3: "is_Prim\<^sub>0 v" have "\is_Prim\<^sub>0 (t \<^bold>\\<^bold>\\<^bold>\ u)" using 1 2 t u tu is_Hcomp_HcompNml [of t u] by (cases t, simp, cases u, auto) thus ?thesis using 1 2 3 tu uv by (cases v, simp, cases "t \<^bold>\\<^bold>\\<^bold>\ u", simp_all) qed moreover have "\is_Prim\<^sub>0 t \ \ is_Prim\<^sub>0 u \ \ is_Prim\<^sub>0 v \ is_Prim t \ ?thesis" using v by (cases t, simp_all, cases u, simp_all; cases v, simp_all) moreover have "\is_Prim\<^sub>0 t \ \ is_Prim\<^sub>0 u \ \ is_Prim\<^sub>0 v \ is_Hcomp t \ ?thesis" proof (cases t, simp_all) fix w :: "'a term" and x :: "'a term" assume 1: " \ is_Prim\<^sub>0 u \ \ is_Prim\<^sub>0 v" assume 2: "t = (w \<^bold>\ x)" show "((w \<^bold>\ x) \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = (w \<^bold>\ x) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" proof - have w: "w = \<^bold>\un_Prim w\<^bold>\" - using t 1 2 Nml_HcompD by auto + using t 1 2 Nml_HcompD by metis have x: "Nml x" using t w 1 2 by (metis Nml.simps(3)) have "((w \<^bold>\ x) \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = (w \<^bold>\\<^bold>\\<^bold>\ (x \<^bold>\\<^bold>\\<^bold>\ u)) \<^bold>\\<^bold>\\<^bold>\ v" using u v w x 1 2 by (cases u, simp_all) also have "... = (w \<^bold>\ (x \<^bold>\\<^bold>\\<^bold>\ u)) \<^bold>\\<^bold>\\<^bold>\ v" using t w u 1 2 HcompNml_Prim is_Hcomp_HcompNml Nml_HcompD by (metis Src.simps(3) term.distinct_disc(3) tu) also have "... = w \<^bold>\\<^bold>\\<^bold>\ ((x \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v)" using u v w x 1 by (cases u, simp_all; cases v, simp_all) also have "... = w \<^bold>\\<^bold>\\<^bold>\ (x \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v))" proof - have "dim x < dim t" using 2 w by (cases w; simp) moreover have "Src x = Trg u \ Src u = Trg v" using tu uv 2 by auto ultimately show ?thesis using u v x dim I by simp qed also have "... = (w \<^bold>\ x) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" proof - have 3: "is_Hcomp (u \<^bold>\\<^bold>\\<^bold>\ v)" using u v uv 1 is_Hcomp_HcompNml by auto obtain u' :: "'a term" and v' where uv': "u \<^bold>\\<^bold>\\<^bold>\ v = u' \<^bold>\ v'" using 3 is_Hcomp_def by blast thus ?thesis by simp qed finally show ?thesis by simp qed qed moreover have "is_Prim\<^sub>0 t \ is_Prim t \ is_Hcomp t" using t by (cases t, simp_all) ultimately show ?thesis by blast qed qed qed thus ?thesis using assms by blast qed lemma HcompNml_Trg_Nml: assumes "Nml t" shows "Trg t \<^bold>\\<^bold>\\<^bold>\ t = t" proof - have "Nml t \ Trg t \<^bold>\\<^bold>\\<^bold>\ t = t" proof (induct t, simp_all add: Nml_HcompD) fix u v assume uv: "Nml (u \<^bold>\ v)" assume I1: "Trg u \<^bold>\\<^bold>\\<^bold>\ u = u" have 1: "Nml u \ Nml v \ Src u = Trg v" using uv Nml_HcompD by blast have 2: "Trg (u \<^bold>\ v) = Trg u" using uv by auto show "Trg u \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\ v = u \<^bold>\ v" proof - have "Trg u \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\ v = Trg u \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ v" using uv HcompNml_Nml by simp also have "... = (Trg u \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v" using 1 2 HcompNml_assoc Src_Trg Nml_Trg Nml_implies_Arr by simp also have "... = u \<^bold>\ v" using I1 uv HcompNml_Nml by simp finally show ?thesis by simp qed qed thus ?thesis using assms by simp qed lemma HcompNml_Nml_Src: assumes "Nml t" shows "t \<^bold>\\<^bold>\\<^bold>\ Src t = t" proof - have "Nml t \ t \<^bold>\\<^bold>\\<^bold>\ Src t = t" proof (induct t, simp_all add: Nml_HcompD) fix u v assume uv: "Nml (u \<^bold>\ v)" assume I2: "v \<^bold>\\<^bold>\\<^bold>\ Src v = v" have 1: "Nml u \ Nml v \ Src u = Trg v" using uv Nml_HcompD by blast have 2: "Src (u \<^bold>\ v) = Src v" using uv Trg_HcompNml by auto show "(u \<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ Src v = u \<^bold>\ v" proof - have "(u \<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ Src v = (u \<^bold>\\<^bold>\\<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ Src v" using uv HcompNml_Nml by simp also have "... = u \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ Src v)" using 1 2 HcompNml_assoc Trg_Src Nml_Src Nml_implies_Arr by simp also have "... = u \<^bold>\ v" using I2 uv HcompNml_Nml by simp finally show ?thesis by simp qed qed thus ?thesis using assms by simp qed lemma HcompNml_Obj_Nml: assumes "Obj t" and "Nml u" and "Src t = Trg u" shows "t \<^bold>\\<^bold>\\<^bold>\ u = u" using assms by (cases t, simp_all add: HcompNml_Trg_Nml) lemma HcompNml_Nml_Obj: assumes "Nml t" and "Obj u" and "Src t = Trg u" shows "t \<^bold>\\<^bold>\\<^bold>\ u = t" using assms by (cases u, simp_all) lemma Ide_HcompNml: assumes "Ide t" and "Ide u" and "Nml t" and "Nml u" and "Src t = Trg u" shows "Ide (t \<^bold>\\<^bold>\\<^bold>\ u)" using assms by (metis (mono_tags, lifting) Nml_HcompNml(1) Nml_implies_Arr Dom_HcompNml Ide_Dom Ide_in_Hom(2) mem_Collect_eq) lemma Can_HcompNml: assumes "Can t" and "Can u" and "Nml t" and "Nml u" and "Src t = Trg u" shows "Can (t \<^bold>\\<^bold>\\<^bold>\ u)" proof - have "\u. \ Can t \ Nml t; Can u \ Nml u; Src t = Trg u \ \ Can (t \<^bold>\\<^bold>\\<^bold>\ u)" proof (induct t, simp_all add: HcompNml_Trg_Nml HcompNml_Nml_Src) show "\x u. ide x \ arr x \ Can u \ Nml u \ \<^bold>\src x\<^bold>\\<^sub>0 = Trg u \ Can (\<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u)" by (metis Ide.simps(1-2) Ide_implies_Can Can.simps(3) Nml.elims(2) Nml.simps(2) HcompNml.simps(12) HcompNml_Prim Ide_HcompNml Src.simps(2) term.disc(2)) show "\v w u. (\u. Nml v \ Can u \ Nml u \ Trg w = Trg u \ Can (v \<^bold>\\<^bold>\\<^bold>\ u)) \ (\ua. Nml w \ Can ua \ Nml ua \ Trg u = Trg ua \ Can (w \<^bold>\\<^bold>\\<^bold>\ ua)) \ Can v \ Can w \ Src v = Trg w \ Nml (v \<^bold>\ w) \ Can u \ Nml u \ Src w = Trg u \ Can ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u)" by (metis Nml_HcompD(3-4) HcompNml_Nml Nml_HcompNml(1) HcompNml_assoc Trg_HcompNml) qed thus ?thesis using assms by blast qed lemma Inv_HcompNml: assumes "Can t" and "Can u" and "Nml t" and "Nml u" and "Src t = Trg u" shows "Inv (t \<^bold>\\<^bold>\\<^bold>\ u) = Inv t \<^bold>\\<^bold>\\<^bold>\ Inv u" proof - have "\u. \ Can t \ Nml t; Can u \ Nml u; Src t = Trg u \ \ Inv (t \<^bold>\\<^bold>\\<^bold>\ u) = Inv t \<^bold>\\<^bold>\\<^bold>\ Inv u" proof (induct t, simp_all add: HcompNml_Trg_Nml HcompNml_Nml_Src) show "\x u. \ obj x; Can u \ Nml u; \<^bold>\x\<^bold>\\<^sub>0 = Trg u \ \ Inv u = Inv (Trg u) \<^bold>\\<^bold>\\<^bold>\ Inv u" by (metis HcompNml.simps(1) Inv.simps(1)) show "\x u. ide x \ arr x \ Can u \ Nml u \ \<^bold>\src x\<^bold>\\<^sub>0 = Trg u \ Inv (\<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) = \<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ Inv u" by (metis Ide.simps(2) HcompNml.simps(2) HcompNml_Prim Inv.simps(1,3) Inv_Ide Inv_Inv is_Prim\<^sub>0_def) fix v w u assume I1: "\x. Nml v \ Can x \ Nml x \ Trg w = Trg x \ Inv (v \<^bold>\\<^bold>\\<^bold>\ x) = Inv v \<^bold>\\<^bold>\\<^bold>\ Inv x" assume I2: "\x. Nml w \ Can x \ Nml x \ Trg u = Trg x \ Inv (w \<^bold>\\<^bold>\\<^bold>\ x) = Inv w \<^bold>\\<^bold>\\<^bold>\ Inv x" assume vw: "Can v \ Can w \ Src v = Trg w \ Nml (v \<^bold>\ w)" assume wu: "Src w = Trg u" assume u: "Can u \ Nml u" have v: "Can v \ Nml v" using vw Nml_HcompD by blast have w: "Can w \ Nml w" using v vw by (cases v, simp_all) show "Inv ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = (Inv v \<^bold>\ Inv w) \<^bold>\\<^bold>\\<^bold>\ Inv u" proof - have "is_Prim\<^sub>0 u \ ?thesis" apply (cases u) by simp_all moreover have "\ is_Prim\<^sub>0 u \ ?thesis" proof - assume 1: "\ is_Prim\<^sub>0 u" have "Inv ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = Inv (v \<^bold>\\<^bold>\\<^bold>\ (w \<^bold>\\<^bold>\\<^bold>\ u))" using 1 by (cases u, simp_all) also have "... = Inv v \<^bold>\\<^bold>\\<^bold>\ Inv (w \<^bold>\\<^bold>\\<^bold>\ u)" using u v w vw wu I1 Nml_HcompNml Can_HcompNml Nml_Inv Can_Inv by simp also have "... = Inv v \<^bold>\\<^bold>\\<^bold>\ (Inv w \<^bold>\\<^bold>\\<^bold>\ Inv u)" using u v w I2 Nml_HcompNml by simp also have "... = (Inv v \<^bold>\ Inv w) \<^bold>\\<^bold>\\<^bold>\ Inv u" using v 1 by (cases u, simp_all) finally show ?thesis by blast qed ultimately show ?thesis by blast qed qed thus ?thesis using assms by blast qed text \ The following function defines vertical composition for compatible normal terms, by ``pushing the composition down'' to arrows of @{text V}. \ fun VcompNml :: "'a term \ 'a term \ 'a term" (infixr "\<^bold>\\<^bold>\\<^bold>\" 55) where "\<^bold>\\\<^bold>\\<^sub>0 \<^bold>\\<^bold>\\<^bold>\ u = u" | "\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\\\<^bold>\ = \<^bold>\\ \ \\<^bold>\" | "(u \<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ (w \<^bold>\ x) = (u \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\ v \<^bold>\\<^bold>\\<^bold>\ x)" | "t \<^bold>\\<^bold>\\<^bold>\ \<^bold>\\\<^bold>\\<^sub>0 = t" | "t \<^bold>\\<^bold>\\<^bold>\ _ = undefined \<^bold>\ undefined" text \ Note that the last clause above is not relevant to normal terms. We have chosen a provably non-normal value in order to validate associativity. \ lemma Nml_VcompNml: assumes "Nml t" and "Nml u" and "Dom t = Cod u" shows "Nml (t \<^bold>\\<^bold>\\<^bold>\ u)" and "Dom (t \<^bold>\\<^bold>\\<^bold>\ u) = Dom u" and "Cod (t \<^bold>\\<^bold>\\<^bold>\ u) = Cod t" proof - have 0: "\u. \ Nml t; Nml u; Dom t = Cod u \ \ Nml (t \<^bold>\\<^bold>\\<^bold>\ u) \ Dom (t \<^bold>\\<^bold>\\<^bold>\ u) = Dom u \ Cod (t \<^bold>\\<^bold>\\<^bold>\ u) = Cod t" proof (induct t, simp_all add: Nml_HcompD) show "\x u. obj x \ Nml u \ \<^bold>\x\<^bold>\\<^sub>0 = Cod u \ Nml (Cod u \<^bold>\\<^bold>\\<^bold>\ u) \ Dom (Cod u \<^bold>\\<^bold>\\<^bold>\ u) = Dom u \ Cod (Cod u \<^bold>\\<^bold>\\<^bold>\ u) = Cod (Cod u)" by (metis Cod.simps(1) VcompNml.simps(1)) fix \ u assume \: "arr \" assume u: "Nml u" assume 1: "\<^bold>\dom \\<^bold>\ = Cod u" show "Nml (\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) \ Dom (\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) = Dom u \ Cod (\<^bold>\\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) = \<^bold>\cod \\<^bold>\" using \ u 1 by (cases u, simp_all) next fix u v w assume I2: "\u. \ Nml u; Dom w = Cod u \ \ Nml (w \<^bold>\\<^bold>\\<^bold>\ u) \ Dom (w \<^bold>\\<^bold>\\<^bold>\ u) = Dom u \ Cod (w \<^bold>\\<^bold>\\<^bold>\ u) = Cod w" assume vw: "Nml (v \<^bold>\ w)" have v: "Nml v" - using vw Nml_HcompD by force + using vw Nml_HcompD by blast have w: "Nml w" - using vw Nml_HcompD by force + using vw Nml_HcompD by blast assume u: "Nml u" assume 1: "(Dom v \<^bold>\ Dom w) = Cod u" show "Nml ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) \ Dom ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = Dom u \ Cod ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = Cod v \<^bold>\ Cod w" using u v w 1 proof (cases u, simp_all) fix x y assume 2: "u = x \<^bold>\ y" have 4: "is_Prim x \ x = \<^bold>\un_Prim x\<^bold>\ \ arr (un_Prim x) \ Nml y \ \ is_Prim\<^sub>0 y" using u 2 by (cases x, cases y, simp_all) have 5: "is_Prim v \ v = \<^bold>\un_Prim v\<^bold>\ \ arr (un_Prim v) \ Nml w \ \ is_Prim\<^sub>0 w" using v w vw by (cases v, simp_all) have 6: "dom (un_Prim v) = cod (un_Prim x) \ Dom w = Cod y" proof - have "\<^bold>\src (un_Prim v)\<^bold>\\<^sub>0 = Trg w" using vw Nml_HcompD [of v w] by simp thus "dom (un_Prim v) = cod (un_Prim x) \ Dom w = Cod y" using 1 2 4 5 apply (cases u, simp_all) by (metis Cod.simps(2) Dom.simps(2) term.simps(2)) qed have "(v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u = \<^bold>\un_Prim v \ un_Prim x\<^bold>\ \<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ y" using 2 4 5 6 VcompNml.simps(2) [of "un_Prim v" "un_Prim x"] by simp moreover have "Nml (\<^bold>\un_Prim v \ un_Prim x\<^bold>\ \<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ y)" proof - have "Nml (w \<^bold>\\<^bold>\\<^bold>\ y)" using I2 4 5 6 by simp moreover have "\ is_Prim\<^sub>0 (w \<^bold>\\<^bold>\\<^bold>\ y)" using vw 4 5 6 I2 Nml_Cod Nml_HcompD(5) is_Prim\<^sub>0_def by (metis Cod.simps(1) Cod.simps(3)) moreover have "\<^bold>\src (un_Prim v \ un_Prim x)\<^bold>\\<^sub>0 = Trg (w \<^bold>\\<^bold>\\<^bold>\ y)" using vw 4 5 6 I2 Nml_HcompD(6) Nml_implies_Arr src.as_nat_trans.is_natural_1 src.as_nat_trans.preserves_comp_2 Trg_Cod src_cod by (metis seqI) ultimately show ?thesis using 4 5 6 Nml.simps(3) [of "un_Prim v \ un_Prim x" "(w \<^bold>\\<^bold>\\<^bold>\ y)"] by simp qed ultimately show "Nml (v \<^bold>\\<^bold>\\<^bold>\ x \<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ y) \ Dom (v \<^bold>\\<^bold>\\<^bold>\ x) = Dom x \ Dom (w \<^bold>\\<^bold>\\<^bold>\ y) = Dom y \ Cod (v \<^bold>\\<^bold>\\<^bold>\ x) = Cod v \ Cod (w \<^bold>\\<^bold>\\<^bold>\ y) = Cod w" using 4 5 6 I2 by (metis (no_types, lifting) Cod.simps(2) Dom.simps(2) VcompNml.simps(2) cod_comp dom_comp seqI) qed qed show "Nml (t \<^bold>\\<^bold>\\<^bold>\ u)" using assms 0 by blast show "Dom (t \<^bold>\\<^bold>\\<^bold>\ u) = Dom u" using assms 0 by blast show "Cod (t \<^bold>\\<^bold>\\<^bold>\ u) = Cod t" using assms 0 by blast qed lemma VcompNml_in_Hom [intro]: assumes "Nml t" and "Nml u" and "Dom t = Cod u" shows "t \<^bold>\\<^bold>\\<^bold>\ u \ HHom (Src u) (Trg u)" and "t \<^bold>\\<^bold>\\<^bold>\ u \ VHom (Dom u) (Cod t)" proof - show 1: "t \<^bold>\\<^bold>\\<^bold>\ u \ VHom (Dom u) (Cod t)" using assms Nml_VcompNml Nml_implies_Arr by simp show "t \<^bold>\\<^bold>\\<^bold>\ u \ HHom (Src u) (Trg u)" using assms 1 Src_Dom Trg_Dom Nml_implies_Arr by fastforce qed lemma Src_VcompNml: assumes "Nml t" and "Nml u" and "Dom t = Cod u" shows "Src (t \<^bold>\\<^bold>\\<^bold>\ u) = Src u" using assms VcompNml_in_Hom by simp lemma Trg_VcompNml: assumes "Nml t" and "Nml u" and "Dom t = Cod u" shows "Trg (t \<^bold>\\<^bold>\\<^bold>\ u) = Trg u" using assms VcompNml_in_Hom by simp lemma Dom_VcompNml: assumes "Nml t" and "Nml u" and "Dom t = Cod u" shows "Dom (t \<^bold>\\<^bold>\\<^bold>\ u) = Dom u" using assms Nml_VcompNml(2) by simp lemma Cod_VcompNml: assumes "Nml t" and "Nml u" and "Dom t = Cod u" shows "Cod (t \<^bold>\\<^bold>\\<^bold>\ u) = Cod t" using assms Nml_VcompNml(3) by simp lemma VcompNml_Cod_Nml [simp]: assumes "Nml t" shows "VcompNml (Cod t) t = t" proof - have "Nml t \ Cod t \<^bold>\\<^bold>\\<^bold>\ t = t" apply (induct t) by (auto simp add: Nml_HcompD comp_cod_arr) thus ?thesis using assms by blast qed lemma VcompNml_Nml_Dom [simp]: assumes "Nml t" shows "t \<^bold>\\<^bold>\\<^bold>\ (Dom t) = t" proof - have "Nml t \ t \<^bold>\\<^bold>\\<^bold>\ Dom t = t" apply (induct t) by (auto simp add: Nml_HcompD comp_arr_dom) thus ?thesis using assms by blast qed lemma VcompNml_Ide_Nml [simp]: assumes "Nml t" and "Ide a" and "Dom a = Cod t" shows "a \<^bold>\\<^bold>\\<^bold>\ t = t" using assms Ide_in_Hom by simp lemma VcompNml_Nml_Ide [simp]: assumes "Nml t" and "Ide a" and "Dom t = Cod a" shows "t \<^bold>\\<^bold>\\<^bold>\ a = t" using assms Ide_in_Hom by auto lemma VcompNml_assoc: assumes "Nml t" and "Nml u" and "Nml v" and "Dom t = Cod u" and "Dom u = Cod v" shows "(t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = t \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" proof - have "\u v. \ Nml t; Nml u; Nml v; Dom t = Cod u; Dom u = Cod v \ \ (t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = t \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" proof (induct t, simp_all) show "\x u v. obj x \ Nml u \ Nml v \ \<^bold>\x\<^bold>\\<^sub>0 = Cod u \ Dom u = Cod v \ u \<^bold>\\<^bold>\\<^bold>\ v = Cod u \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ v" by (metis VcompNml.simps(1)) fix f u v assume f: "arr f" assume u: "Nml u" assume v: "Nml v" assume 1: "\<^bold>\dom f\<^bold>\ = Cod u" assume 2: "Dom u = Cod v" show "(\<^bold>\f\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = \<^bold>\f\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" using u v f 1 2 comp_assoc apply (cases u) apply simp_all apply (cases v) by simp_all next fix u v w x assume I1: "\u v. \ Nml w; Nml u; Nml v; Dom w = Cod u; Dom u = Cod v \ \ (w \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = w \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" assume I2: "\u v. \ Nml x; Nml u; Nml v; Dom x = Cod u; Dom u = Cod v \ \ (x \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = x \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ v)" assume wx: "Nml (w \<^bold>\ x)" assume u: "Nml u" assume v: "Nml v" assume 1: "(Dom w \<^bold>\ Dom x) = Cod u" assume 2: "Dom u = Cod v" show "((w \<^bold>\ x) \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v = (w \<^bold>\ x) \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ v" proof - have w: "Nml w" using wx Nml_HcompD by blast have x: "Nml x" using wx Nml_HcompD by blast have "is_Hcomp u" using u 1 by (cases u) simp_all thus ?thesis using u v apply (cases u, simp_all, cases v, simp_all) proof - fix u1 u2 v1 v2 assume 3: "u = (u1 \<^bold>\ u2)" assume 4: "v = (v1 \<^bold>\ v2)" show "(w \<^bold>\\<^bold>\\<^bold>\ u1) \<^bold>\\<^bold>\\<^bold>\ v1 = w \<^bold>\\<^bold>\\<^bold>\ u1 \<^bold>\\<^bold>\\<^bold>\ v1 \ (x \<^bold>\\<^bold>\\<^bold>\ u2) \<^bold>\\<^bold>\\<^bold>\ v2 = x \<^bold>\\<^bold>\\<^bold>\ u2 \<^bold>\\<^bold>\\<^bold>\ v2" proof - have "Nml u1 \ Nml u2" using u 3 Nml_HcompD by blast moreover have "Nml v1 \ Nml v2" using v 4 Nml_HcompD by blast ultimately show ?thesis using w x I1 I2 1 2 3 4 by simp qed qed qed qed thus ?thesis using assms by blast qed lemma Ide_VcompNml: assumes "Ide t" and "Ide u" and "Nml t" and "Nml u" and "Dom t = Cod u" shows "Ide (t \<^bold>\\<^bold>\\<^bold>\ u)" proof - have "\u. \ Ide t; Ide u; Nml t; Nml u; Dom t = Cod u \ \ Ide (VcompNml t u)" by (induct t, simp_all) thus ?thesis using assms by blast qed lemma Can_VcompNml: assumes "Can t" and "Can u" and "Nml t" and "Nml u" and "Dom t = Cod u" shows "Can (t \<^bold>\\<^bold>\\<^bold>\ u)" proof - have "\u. \ Can t \ Nml t; Can u \ Nml u; Dom t = Cod u \ \ Can (t \<^bold>\\<^bold>\\<^bold>\ u)" proof (induct t, simp_all) fix t u v assume I1: "\v. \ Nml t; Can v \ Nml v; Dom t = Cod v \ \ Can (t \<^bold>\\<^bold>\\<^bold>\ v)" assume I2: "\v. \ Nml u; Can v \ Nml v; Dom u = Cod v \ \ Can (u \<^bold>\\<^bold>\\<^bold>\ v)" assume tu: "Can t \ Can u \ Src t = Trg u \ Nml (t \<^bold>\ u)" have t: "Can t \ Nml t" using tu Nml_HcompD by blast have u: "Can u \ Nml u" using tu Nml_HcompD by blast assume v: "Can v \ Nml v" assume 1: "(Dom t \<^bold>\ Dom u) = Cod v" show "Can ((t \<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ v)" proof - have 2: "(Dom t \<^bold>\ Dom u) = Cod v" using 1 by simp show ?thesis using v 2 proof (cases v; simp) fix w x assume wx: "v = (w \<^bold>\ x)" have "Can w \ Nml w" using v wx Nml_HcompD Can.simps(3) by blast moreover have "Can x \ Nml x" using v wx Nml_HcompD Can.simps(3) by blast moreover have "Dom t = Cod w" using 2 wx by simp moreover have ux: "Dom u = Cod x" using 2 wx by simp ultimately show "Can (t \<^bold>\\<^bold>\\<^bold>\ w) \ Can (u \<^bold>\\<^bold>\\<^bold>\ x) \ Src (t \<^bold>\\<^bold>\\<^bold>\ w) = Trg (u \<^bold>\\<^bold>\\<^bold>\ x)" using t u v tu wx I1 I2 by (metis Nml_HcompD(7) Src_VcompNml Trg_VcompNml) qed qed qed thus ?thesis using assms by blast qed lemma Inv_VcompNml: assumes "Can t" and "Can u" and "Nml t" and "Nml u" and "Dom t = Cod u" shows "Inv (t \<^bold>\\<^bold>\\<^bold>\ u) = Inv u \<^bold>\\<^bold>\\<^bold>\ Inv t" proof - have "\u. \ Can t \ Nml t; Can u \ Nml u; Dom t = Cod u \ \ Inv (t \<^bold>\\<^bold>\\<^bold>\ u) = Inv u \<^bold>\\<^bold>\\<^bold>\ Inv t" proof (induct t, simp_all) show "\x u. \ obj x; Can u \ Nml u; \<^bold>\x\<^bold>\\<^sub>0 = Cod u \ \ Inv u = Inv u \<^bold>\\<^bold>\\<^bold>\ Inv (Cod u)" by (simp add: Can_implies_Arr) show "\x u. \ ide x \ arr x; Can u \ Nml u; \<^bold>\x\<^bold>\ = Cod u \ \ Inv u = Inv u \<^bold>\\<^bold>\\<^bold>\ Inv (Cod u)" by (simp add: Can_implies_Arr) fix v w u assume vw: "Can v \ Can w \ Src v = Trg w \ Nml (v \<^bold>\ w)" have v: "Can v \ Nml w" using vw Nml_HcompD by blast have w: "Can w \ Nml w" using vw Nml_HcompD by blast assume I1: "\x. \ Nml v; Can x \ Nml x; Dom v = Cod x \ \ Inv (v \<^bold>\\<^bold>\\<^bold>\ x) = Inv x \<^bold>\\<^bold>\\<^bold>\ Inv v" assume I2: "\x. \ Nml w; Can x \ Nml x; Dom w = Cod x \ \ Inv (w \<^bold>\\<^bold>\\<^bold>\ x) = Inv x \<^bold>\\<^bold>\\<^bold>\ Inv w" assume u: "Can u \ Nml u" assume 1: "(Dom v \<^bold>\ Dom w) = Cod u" show "Inv ((v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u) = Inv u \<^bold>\\<^bold>\\<^bold>\ (Inv v \<^bold>\ Inv w)" using v 1 proof (cases w, simp_all) show "\\. obj \ \ Dom v \<^bold>\ \<^bold>\\\<^bold>\\<^sub>0 = Cod u \ w = \<^bold>\\\<^bold>\\<^sub>0 \ Can v \ Inv ((v \<^bold>\ \<^bold>\\\<^bold>\\<^sub>0) \<^bold>\\<^bold>\\<^bold>\ u) = Inv u \<^bold>\\<^bold>\\<^bold>\ (Inv v \<^bold>\ \<^bold>\\\<^bold>\\<^sub>0)" using Nml_HcompD(5) is_Prim\<^sub>0_def vw by blast show "\\. arr \ \ Dom v \<^bold>\ \<^bold>\dom \\<^bold>\ = Cod u \ w = \<^bold>\\\<^bold>\ \ Can v \ Inv ((v \<^bold>\ \<^bold>\\\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ u) = Inv u \<^bold>\\<^bold>\\<^bold>\ (Inv v \<^bold>\ \<^bold>\inv \\<^bold>\)" by (metis Ide.simps(2) Can.simps(2) Nml_HcompD(1) Dom.simps(2) Inv_Ide Dom_Inv Nml_Inv ideD(2) inv_ide VcompNml_Cod_Nml VcompNml_Nml_Dom u vw) show "\y z. Nml (y \<^bold>\ z) \ Dom v \<^bold>\ Dom y \<^bold>\ Dom z = Cod u \ w = y \<^bold>\ z \ Can v \ Inv ((v \<^bold>\ y \<^bold>\ z) \<^bold>\\<^bold>\\<^bold>\ u) = Inv u \<^bold>\\<^bold>\\<^bold>\ (Inv v \<^bold>\ Inv y \<^bold>\ Inv z)" proof - fix y z assume 2: "Nml (y \<^bold>\ z)" assume yz: "w = y \<^bold>\ z" show "Inv ((v \<^bold>\ y \<^bold>\ z) \<^bold>\\<^bold>\\<^bold>\ u) = Inv u \<^bold>\\<^bold>\\<^bold>\ (Inv v \<^bold>\ Inv y \<^bold>\ Inv z)" using u vw yz I1 I2 1 2 VcompNml_Nml_Ide apply (cases u) apply simp_all by (metis Nml_HcompD(3-4)) qed qed qed thus ?thesis using assms by blast qed lemma Can_and_Nml_implies_Ide: assumes "Can t" and "Nml t" shows "Ide t" proof - have "\ Can t; Nml t \ \ Ide t" apply (induct t) by (simp_all add: Nml_HcompD) thus ?thesis using assms by blast qed lemma VcompNml_Can_Inv [simp]: assumes "Can t" and "Nml t" shows "t \<^bold>\\<^bold>\\<^bold>\ Inv t = Cod t" using assms Can_and_Nml_implies_Ide Ide_in_Hom by simp lemma VcompNml_Inv_Can [simp]: assumes "Can t" and "Nml t" shows "Inv t \<^bold>\\<^bold>\\<^bold>\ t = Dom t" using assms Can_and_Nml_implies_Ide Ide_in_Hom by simp text \ The next fact is a syntactic version of the interchange law, for normal terms. \ lemma VcompNml_HcompNml: assumes "Nml t" and "Nml u" and "Nml v" and "Nml w" and "VSeq t v" and "VSeq u w" and "Src v = Trg w" shows "(t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = (t \<^bold>\\<^bold>\\<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ w)" proof - have "\u v w. \ Nml t; Nml u; Nml v; Nml w; VSeq t v; VSeq u w; Src t = Trg u; Src v = Trg w \ \ (t \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = (t \<^bold>\\<^bold>\\<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ w)" proof (induct t, simp_all) fix u v w x assume u: "Nml u" assume v: "Nml v" assume w: "Nml w" assume uw: "VSeq u w" show "\x. Arr v \ \<^bold>\x\<^bold>\\<^sub>0 = Cod v \ (Cod v \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = v \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ w" using u v w uw by (cases v) simp_all show "\x. \ arr x; Arr v \ \<^bold>\dom x\<^bold>\ = Cod v; \<^bold>\src x\<^bold>\\<^sub>0 = Trg u; Src v = Trg w \ \ (\<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = \<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ v \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ w" proof - fix x assume x: "arr x" assume 1: "Arr v \ \<^bold>\dom x\<^bold>\ = Cod v" assume tu: "\<^bold>\src x\<^bold>\\<^sub>0 = Trg u" assume vw: "Src v = Trg w" show "(\<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = \<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ v \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ w" proof - have 2: "v = \<^bold>\un_Prim v\<^bold>\ \ arr (un_Prim v)" using v 1 by (cases v) simp_all have "is_Prim\<^sub>0 u \ ?thesis" using u v w x tu uw vw 1 2 Cod.simps(3) VcompNml_Cod_Nml Dom.simps(2) HcompNml_Prim HcompNml_term_Prim\<^sub>0 Nml_HcompNml(3) HcompNml_Trg_Nml apply (cases u) apply simp_all by (cases w, simp_all add: Src_VcompNml) moreover have "\ is_Prim\<^sub>0 u \ ?thesis" proof - assume 3: "\ is_Prim\<^sub>0 u" hence 4: "\ is_Prim\<^sub>0 w" using u w uw by (cases u, simp_all; cases w, simp_all) have "(\<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = (\<^bold>\x\<^bold>\ \<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\ w)" proof - have "\<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u = \<^bold>\x\<^bold>\ \<^bold>\ u" using u x 3 HcompNml_Nml by (cases u, simp_all) moreover have "v \<^bold>\\<^bold>\\<^bold>\ w = v \<^bold>\ w" using w 2 4 HcompNml_Nml by (cases v, simp_all; cases w, simp_all) ultimately show ?thesis by simp qed also have 5: "... = (\<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ v) \<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ w)" by simp also have "... = (\<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ w)" using x u w uw vw 1 2 3 4 5 HcompNml_Nml HcompNml_Prim Nml_HcompNml(1) by (metis Cod.simps(3) Nml.simps(3) Dom.simps(2) Dom.simps(3) Nml_VcompNml(1) tu v) finally show ?thesis by blast qed ultimately show ?thesis by blast qed qed fix t1 t2 assume t12: "Nml (t1 \<^bold>\ t2)" assume I1: "\u v w. \ Nml t1; Nml u; Nml v; Nml w; Arr v \ Dom t1 = Cod v; VSeq u w; Trg t2 = Trg u; Src v = Trg w \ \ (t1 \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = t1 \<^bold>\\<^bold>\\<^bold>\ v \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ w" assume I2: "\u' v w. \ Nml t2; Nml u'; Nml v; Nml w; Arr v \ Dom t2 = Cod v; VSeq u' w; Trg u = Trg u'; Src v = Trg w \ \ (t2 \<^bold>\\<^bold>\\<^bold>\ u') \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = (t2 \<^bold>\\<^bold>\\<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ (u' \<^bold>\\<^bold>\\<^bold>\ w)" have t1: "t1 = \<^bold>\un_Prim t1\<^bold>\ \ arr (un_Prim t1) \ Nml t1" using t12 by (cases t1, simp_all) have t2: "Nml t2 \ \is_Prim\<^sub>0 t2" using t12 by (cases t1, simp_all) assume vw: "Src v = Trg w" assume tu: "Src t2 = Trg u" assume 1: "Arr t1 \ Arr t2 \ Src t1 = Trg t2 \ Arr v \ (Dom t1 \<^bold>\ Dom t2) = Cod v" show "((t1 \<^bold>\ t2) \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w) = (t1 \<^bold>\ t2) \<^bold>\\<^bold>\\<^bold>\ v \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ w" proof - have "is_Prim\<^sub>0 u \ ?thesis" using u v w uw tu vw t12 I1 I2 1 Obj_Src apply (cases u) apply simp_all by (cases w, simp_all add: Src_VcompNml) moreover have "\ is_Prim\<^sub>0 u \ ?thesis" proof - assume u': "\ is_Prim\<^sub>0 u" hence w': "\ is_Prim\<^sub>0 w" using u w uw by (cases u, simp_all; cases w, simp_all) show ?thesis using 1 v proof (cases v, simp_all) fix v1 v2 assume v12: "v = v1 \<^bold>\ v2" have v1: "v1 = \<^bold>\un_Prim v1\<^bold>\ \ arr (un_Prim v1) \ Nml v1" using v v12 by (cases v1, simp_all) have v2: "Nml v2 \ \ is_Prim\<^sub>0 v2" using v v12 by (cases v1, simp_all) have 2: "v = (\<^bold>\un_Prim v1\<^bold>\ \<^bold>\ v2)" using v1 v12 by simp show "((t1 \<^bold>\ t2) \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ ((v1 \<^bold>\ v2) \<^bold>\\<^bold>\\<^bold>\ w) = (t1 \<^bold>\\<^bold>\\<^bold>\ v1 \<^bold>\ t2 \<^bold>\\<^bold>\\<^bold>\ v2) \<^bold>\\<^bold>\\<^bold>\ u \<^bold>\\<^bold>\\<^bold>\ w" proof - have 3: "(t1 \<^bold>\ t2) \<^bold>\\<^bold>\\<^bold>\ u = t1 \<^bold>\\<^bold>\\<^bold>\ (t2 \<^bold>\\<^bold>\\<^bold>\ u)" using u u' by (cases u, simp_all) have 4: "v \<^bold>\\<^bold>\\<^bold>\ w = v1 \<^bold>\\<^bold>\\<^bold>\ v2 \<^bold>\\<^bold>\\<^bold>\ w" proof - have "Src v1 = Trg v2" using v v12 1 Arr.simps(3) Nml_HcompD(7) by blast moreover have "Src v2 = Trg w" using v v12 vw by simp ultimately show ?thesis using v w v1 v2 v12 2 HcompNml_assoc [of v1 v2 w] HcompNml_Nml by metis qed have "((t1 \<^bold>\ t2) \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ ((v1 \<^bold>\ v2) \<^bold>\\<^bold>\\<^bold>\ w) = (t1 \<^bold>\\<^bold>\\<^bold>\ (t2 \<^bold>\\<^bold>\\<^bold>\ u)) \<^bold>\\<^bold>\\<^bold>\ (v1 \<^bold>\\<^bold>\\<^bold>\ (v2 \<^bold>\\<^bold>\\<^bold>\ w))" using 3 4 v12 by simp also have "... = (t1 \<^bold>\\<^bold>\\<^bold>\ v1) \<^bold>\\<^bold>\\<^bold>\ ((t2 \<^bold>\\<^bold>\\<^bold>\ u) \<^bold>\\<^bold>\\<^bold>\ (v2 \<^bold>\\<^bold>\\<^bold>\ w))" proof - have "is_Hcomp (t2 \<^bold>\\<^bold>\\<^bold>\ u)" using t2 u u' tu is_Hcomp_HcompNml by auto moreover have "is_Hcomp (v2 \<^bold>\\<^bold>\\<^bold>\ w)" using v2 v12 w w' vw is_Hcomp_HcompNml by auto ultimately show ?thesis using u u' v w t1 v1 t12 v12 HcompNml_Prim by (metis VcompNml.simps(2) VcompNml.simps(3) is_Hcomp_def term.distinct_disc(3)) qed also have "... = (t1 \<^bold>\\<^bold>\\<^bold>\ v1) \<^bold>\\<^bold>\\<^bold>\ (t2 \<^bold>\\<^bold>\\<^bold>\ v2) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ w)" using u w tu uw vw t2 v2 1 2 Nml_implies_Arr I2 by auto also have "... = ((t1 \<^bold>\\<^bold>\\<^bold>\ v1) \<^bold>\ (t2 \<^bold>\\<^bold>\\<^bold>\ v2)) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ w)" proof - have "\is_Prim\<^sub>0 (u \<^bold>\\<^bold>\\<^bold>\ w)" using u w u' w' by (cases u, simp_all; cases w, simp_all) hence "((t1 \<^bold>\\<^bold>\\<^bold>\ v1) \<^bold>\ (t2 \<^bold>\\<^bold>\\<^bold>\ v2)) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ w) = (t1 \<^bold>\\<^bold>\\<^bold>\ v1) \<^bold>\\<^bold>\\<^bold>\ ((t2 \<^bold>\\<^bold>\\<^bold>\ v2) \<^bold>\\<^bold>\\<^bold>\ (u \<^bold>\\<^bold>\\<^bold>\ w))" by (cases "u \<^bold>\\<^bold>\\<^bold>\ w") simp_all thus ?thesis by presburger qed finally show ?thesis by blast qed qed qed ultimately show ?thesis by blast qed qed moreover have "Src t = Trg u" using assms Src_Dom Trg_Dom Src_Cod Trg_Cod Nml_implies_Arr by metis ultimately show ?thesis using assms by simp qed text \ The following function reduces a formal arrow to normal form. \ fun Nmlize :: "'a term \ 'a term" ("\<^bold>\_\<^bold>\") where "\<^bold>\\<^bold>\\\<^bold>\\<^sub>0\<^bold>\ = \<^bold>\\\<^bold>\\<^sub>0" | "\<^bold>\\<^bold>\\\<^bold>\\<^bold>\ = \<^bold>\\\<^bold>\" | "\<^bold>\t \<^bold>\ u\<^bold>\ = \<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\" | "\<^bold>\t \<^bold>\ u\<^bold>\ = \<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\" | "\<^bold>\\<^bold>\\<^bold>[t\<^bold>]\<^bold>\ = \<^bold>\t\<^bold>\" | "\<^bold>\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\<^bold>\ = \<^bold>\t\<^bold>\" | "\<^bold>\\<^bold>\\<^bold>[t\<^bold>]\<^bold>\ = \<^bold>\t\<^bold>\" | "\<^bold>\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\<^bold>\ = \<^bold>\t\<^bold>\" | "\<^bold>\\<^bold>\\<^bold>[t, u, v\<^bold>]\<^bold>\ = (\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\" | "\<^bold>\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\<^bold>\ = \<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ (\<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\)" lemma Nml_Nmlize: assumes "Arr t" shows "Nml \<^bold>\t\<^bold>\" and "Src \<^bold>\t\<^bold>\ = Src t" and "Trg \<^bold>\t\<^bold>\ = Trg t" and "Dom \<^bold>\t\<^bold>\ = \<^bold>\Dom t\<^bold>\" and "Cod \<^bold>\t\<^bold>\ = \<^bold>\Cod t\<^bold>\" proof - have 0: "Arr t \ Nml \<^bold>\t\<^bold>\ \ Src \<^bold>\t\<^bold>\ = Src t \ Trg \<^bold>\t\<^bold>\ = Trg t \ Dom \<^bold>\t\<^bold>\ = \<^bold>\Dom t\<^bold>\ \ Cod \<^bold>\t\<^bold>\ = \<^bold>\Cod t\<^bold>\" using Nml_HcompNml Nml_VcompNml HcompNml_assoc Src_VcompNml Trg_VcompNml VSeq_implies_HPar apply (induct t) apply auto proof - fix t assume 1: "Arr t" assume 2: "Nml \<^bold>\t\<^bold>\" assume 3: "Src \<^bold>\t\<^bold>\ = Src t" assume 4: "Trg \<^bold>\t\<^bold>\ = Trg t" assume 5: "Dom \<^bold>\t\<^bold>\ = \<^bold>\Dom t\<^bold>\" assume 6: "Cod \<^bold>\t\<^bold>\ = \<^bold>\Cod t\<^bold>\" have 7: "Nml \<^bold>\Dom t\<^bold>\" using 2 5 Nml_Dom by fastforce have 8: "Trg \<^bold>\t\<^bold>\ = \<^bold>\Trg t\<^bold>\" using 1 2 4 Nml_Trg Obj_Trg by (metis Nml.elims(2) Nmlize.simps(1) Nmlize.simps(2) Obj.simps(3)) have 9: "Nml \<^bold>\Cod t\<^bold>\" using 2 6 Nml_Cod by fastforce have 10: "Src \<^bold>\t\<^bold>\ = \<^bold>\Src t\<^bold>\" using 1 2 3 Nml_Src Obj_Src by (metis Nml.elims(2) Nmlize.simps(1) Nmlize.simps(2) Obj.simps(3)) show "\<^bold>\Dom t\<^bold>\ = \<^bold>\Trg t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t\<^bold>\" using 2 5 7 8 Nml_implies_Arr Trg_Dom HcompNml_Trg_Nml by metis show "\<^bold>\Cod t\<^bold>\ = \<^bold>\Trg t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t\<^bold>\" using 2 6 8 9 Nml_implies_Arr Trg_Cod HcompNml_Trg_Nml by metis show "\<^bold>\Dom t\<^bold>\ = \<^bold>\Dom t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Src t\<^bold>\" using 2 5 7 10 Nml_implies_Arr Src_Dom HcompNml_Nml_Src by metis show "\<^bold>\Cod t\<^bold>\ = \<^bold>\Cod t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Src t\<^bold>\" using 2 6 9 10 Nml_implies_Arr Src_Cod HcompNml_Nml_Src by metis next fix t1 t2 t3 assume "Nml \<^bold>\t1\<^bold>\" and "Nml \<^bold>\t2\<^bold>\" and "Nml \<^bold>\t3\<^bold>\" assume "Src t1 = Trg t2" and "Src t2 = Trg t3" assume "Src \<^bold>\t1\<^bold>\ = Trg t2" and "Src \<^bold>\t2\<^bold>\ = Trg t3" assume "Trg \<^bold>\t1\<^bold>\ = Trg t1" and "Trg \<^bold>\t2\<^bold>\ = Trg t2" and "Trg \<^bold>\t3\<^bold>\ = Trg t3" assume "Dom \<^bold>\t1\<^bold>\ = \<^bold>\Dom t1\<^bold>\" and "Cod \<^bold>\t1\<^bold>\ = \<^bold>\Cod t1\<^bold>\" and "Dom \<^bold>\t2\<^bold>\ = \<^bold>\Dom t2\<^bold>\" and "Cod \<^bold>\t2\<^bold>\ = \<^bold>\Cod t2\<^bold>\" and "Dom \<^bold>\t3\<^bold>\ = \<^bold>\Dom t3\<^bold>\" and "Cod \<^bold>\t3\<^bold>\ = \<^bold>\Cod t3\<^bold>\" show "\<^bold>\Dom t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t3\<^bold>\ = (\<^bold>\Dom t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t3\<^bold>\" using Nml_Dom Nml_implies_Arr Src_Dom Trg_Dom HcompNml_assoc [of "\<^bold>\Dom t1\<^bold>\" "\<^bold>\Dom t2\<^bold>\" "\<^bold>\Dom t3\<^bold>\"] \Nml \<^bold>\t1\<^bold>\\ \Nml \<^bold>\t2\<^bold>\\ \Nml \<^bold>\t3\<^bold>\\ \Dom \<^bold>\t1\<^bold>\ = \<^bold>\Dom t1\<^bold>\\ \Dom \<^bold>\t2\<^bold>\ = \<^bold>\Dom t2\<^bold>\\ \Dom \<^bold>\t3\<^bold>\ = \<^bold>\Dom t3\<^bold>\\ \Src \<^bold>\t1\<^bold>\ = Trg t2\ \Trg \<^bold>\t2\<^bold>\ = Trg t2\ \Src \<^bold>\t2\<^bold>\ = Trg t3\ \Trg \<^bold>\t3\<^bold>\ = Trg t3\ by metis show "\<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t3\<^bold>\ = (\<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t3\<^bold>\" using Nml_Cod Nml_implies_Arr Src_Cod Trg_Cod HcompNml_assoc [of "\<^bold>\Cod t1\<^bold>\" "\<^bold>\Cod t2\<^bold>\" "\<^bold>\Cod t3\<^bold>\"] \Nml \<^bold>\t1\<^bold>\\ \Nml \<^bold>\t2\<^bold>\\ \Nml \<^bold>\t3\<^bold>\\ \Cod \<^bold>\t1\<^bold>\ = \<^bold>\Cod t1\<^bold>\\ \Cod \<^bold>\t2\<^bold>\ = \<^bold>\Cod t2\<^bold>\\ \Cod \<^bold>\t3\<^bold>\ = \<^bold>\Cod t3\<^bold>\\ \Src \<^bold>\t1\<^bold>\ = Trg t2\ \Trg \<^bold>\t2\<^bold>\ = Trg t2\ \Src \<^bold>\t2\<^bold>\ = Trg t3\ \Trg \<^bold>\t3\<^bold>\ = Trg t3\ by metis qed show "Nml \<^bold>\t\<^bold>\" using assms 0 by blast show "Src \<^bold>\t\<^bold>\ = Src t" using assms 0 by blast show "Trg \<^bold>\t\<^bold>\ = Trg t" using assms 0 by blast show "Dom \<^bold>\t\<^bold>\ = \<^bold>\Dom t\<^bold>\" using assms 0 by blast show "Cod \<^bold>\t\<^bold>\ = \<^bold>\Cod t\<^bold>\" using assms 0 by blast qed lemma Nmlize_in_Hom [intro]: assumes "Arr t" shows "\<^bold>\t\<^bold>\ \ HHom (Src t) (Trg t)" and "\<^bold>\t\<^bold>\ \ VHom \<^bold>\Dom t\<^bold>\ \<^bold>\Cod t\<^bold>\" using assms Nml_Nmlize Nml_implies_Arr by auto lemma Nmlize_Src: assumes "Arr t" shows "\<^bold>\Src t\<^bold>\ = Src \<^bold>\t\<^bold>\" and "\<^bold>\Src t\<^bold>\ = Src t" proof - have 1: "Obj (Src t)" using assms by simp obtain a where a: "obj a \ Src t = \<^bold>\a\<^bold>\\<^sub>0" using 1 by (cases "Src t", simp_all) show "\<^bold>\Src t\<^bold>\ = Src t" using a by simp thus "\<^bold>\Src t\<^bold>\ = Src \<^bold>\t\<^bold>\" using assms Nmlize_in_Hom by simp qed lemma Nmlize_Trg: assumes "Arr t" shows "\<^bold>\Trg t\<^bold>\ = Trg \<^bold>\t\<^bold>\" and "\<^bold>\Trg t\<^bold>\ = Trg t" proof - have 1: "Obj (Trg t)" using assms by simp obtain a where a: "obj a \ Trg t = \<^bold>\a\<^bold>\\<^sub>0" using 1 by (cases "Trg t", simp_all) show "\<^bold>\Trg t\<^bold>\ = Trg t" using a by simp thus "\<^bold>\Trg t\<^bold>\ = Trg \<^bold>\t\<^bold>\" using assms Nmlize_in_Hom by simp qed lemma Nmlize_Dom: assumes "Arr t" shows "\<^bold>\Dom t\<^bold>\ = Dom \<^bold>\t\<^bold>\" using assms Nmlize_in_Hom by simp lemma Nmlize_Cod: assumes "Arr t" shows "\<^bold>\Cod t\<^bold>\ = Cod \<^bold>\t\<^bold>\" using assms Nmlize_in_Hom by simp lemma Ide_Nmlize_Ide: assumes "Ide t" shows "Ide \<^bold>\t\<^bold>\" proof - have "Ide t \ Ide \<^bold>\t\<^bold>\" using Ide_HcompNml Nml_Nmlize by (induct t, simp_all) thus ?thesis using assms by blast qed lemma Ide_Nmlize_Can: assumes "Can t" shows "Ide \<^bold>\t\<^bold>\" proof - have "Can t \ Ide \<^bold>\t\<^bold>\" using Can_implies_Arr Ide_HcompNml Nml_Nmlize Ide_VcompNml Nml_HcompNml apply (induct t) apply (auto simp add: Dom_Ide Cod_Ide) by (metis Ide_VcompNml) thus ?thesis using assms by blast qed lemma Can_Nmlize_Can: assumes "Can t" shows "Can \<^bold>\t\<^bold>\" using assms Ide_Nmlize_Can Ide_implies_Can by auto lemma Nmlize_Nml [simp]: assumes "Nml t" shows "\<^bold>\t\<^bold>\ = t" proof - have "Nml t \ \<^bold>\t\<^bold>\ = t" apply (induct t, simp_all) using HcompNml_Prim Nml_HcompD by metis thus ?thesis using assms by blast qed lemma Nmlize_Nmlize [simp]: assumes "Arr t" shows "\<^bold>\\<^bold>\t\<^bold>\\<^bold>\ = \<^bold>\t\<^bold>\" using assms Nml_Nmlize Nmlize_Nml by blast lemma Nmlize_Hcomp: assumes "Arr t" and "Arr u" shows "\<^bold>\t \<^bold>\ u\<^bold>\ = \<^bold>\\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\u\<^bold>\\<^bold>\" using assms Nmlize_Nmlize by simp lemma Nmlize_Hcomp_Obj_Arr [simp]: assumes "Arr u" shows "\<^bold>\\<^bold>\b\<^bold>\\<^sub>0 \<^bold>\ u\<^bold>\ = \<^bold>\u\<^bold>\" using assms by simp lemma Nmlize_Hcomp_Arr_Obj [simp]: assumes "Arr t" and "Src t = \<^bold>\a\<^bold>\\<^sub>0" shows "\<^bold>\t \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0\<^bold>\ = \<^bold>\t\<^bold>\" using assms HcompNml_Nml_Src Nmlize_in_Hom by simp lemma Nmlize_Hcomp_Prim_Arr [simp]: assumes "Arr u" and "\ is_Prim\<^sub>0 \<^bold>\u\<^bold>\" shows "\<^bold>\\<^bold>\\\<^bold>\ \<^bold>\ u\<^bold>\ = \<^bold>\\\<^bold>\ \<^bold>\ \<^bold>\u\<^bold>\" using assms by simp lemma Nmlize_Hcomp_Hcomp: assumes "Arr t" and "Arr u" and "Arr v" and "Src t = Trg u" and "Src u = Trg v" shows "\<^bold>\(t \<^bold>\ u) \<^bold>\ v\<^bold>\ = \<^bold>\\<^bold>\t\<^bold>\ \<^bold>\ (\<^bold>\u\<^bold>\ \<^bold>\ \<^bold>\v\<^bold>\)\<^bold>\" using assms Nml_Nmlize Nmlize_Nmlize by (simp add: HcompNml_assoc) lemma Nmlize_Hcomp_Hcomp': assumes "Arr t" and "Arr u" and "Arr v" and "Src t = Trg u" and "Src u = Trg v" shows "\<^bold>\t \<^bold>\ u \<^bold>\ v\<^bold>\ = \<^bold>\\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\u\<^bold>\ \<^bold>\ \<^bold>\v\<^bold>\\<^bold>\" using assms Nml_Nmlize Nmlize_Nmlize by (simp add: HcompNml_assoc) lemma Nmlize_Vcomp_Cod_Arr: assumes "Arr t" shows "\<^bold>\Cod t \<^bold>\ t\<^bold>\ = \<^bold>\t\<^bold>\" proof - have "Arr t \ \<^bold>\Cod t \<^bold>\ t\<^bold>\ = \<^bold>\t\<^bold>\" proof (induct t, simp_all) show "\x. arr x \ cod x \ x = x" using comp_cod_arr by blast fix t1 t2 show "\t1 t2. \<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t1\<^bold>\ = \<^bold>\t1\<^bold>\ \ \<^bold>\Cod t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ = \<^bold>\t2\<^bold>\ \ HSeq t1 t2 \ (\<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ (\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\) = \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\" using VcompNml_HcompNml Ide_Cod Nml_Nmlize Nmlize_in_Hom by simp show "\<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t1\<^bold>\ = \<^bold>\t1\<^bold>\ \ \<^bold>\Cod t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ = \<^bold>\t2\<^bold>\ \ VSeq t1 t2 \ \<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ = \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\" using VcompNml_assoc [of "\<^bold>\Cod t1\<^bold>\" "\<^bold>\t1\<^bold>\" "\<^bold>\t2\<^bold>\"] Ide_Cod Nml_Nmlize by simp next show "\t. \<^bold>\Cod t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t\<^bold>\ = \<^bold>\t\<^bold>\ \ Arr t \ (\<^bold>\Trg t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t\<^bold>\ = \<^bold>\t\<^bold>\" by (metis Arr.simps(6) Cod.simps(6) Nmlize.simps(3) Nmlize.simps(6) Nmlize_Cod) show "\t. \<^bold>\Cod t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t\<^bold>\ = \<^bold>\t\<^bold>\ \ Arr t \ (\<^bold>\Cod t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Src t\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t\<^bold>\ = \<^bold>\t\<^bold>\" by (simp add: Nml_Nmlize(1) Nml_Nmlize(2) Nmlize_Src(2) HcompNml_Nml_Obj) show "\t1 t2 t3. \<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t1\<^bold>\ = \<^bold>\t1\<^bold>\ \ \<^bold>\Cod t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ = \<^bold>\t2\<^bold>\ \ \<^bold>\Cod t3\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\ = \<^bold>\t3\<^bold>\ \ Arr t1 \ Arr t2 \ Arr t3 \ Src t1 = Trg t2 \ Src t2 = Trg t3 \ (\<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t3\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ ((\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\) = (\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\" using VcompNml_HcompNml Ide_Cod HcompNml_in_Hom Nml_HcompNml Nml_Nmlize Nmlize_in_Hom HcompNml_assoc by simp show "\t1 t2 t3. \<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t1\<^bold>\ = \<^bold>\t1\<^bold>\ \ \<^bold>\Cod t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ = \<^bold>\t2\<^bold>\ \ \<^bold>\Cod t3\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\ = \<^bold>\t3\<^bold>\ \ Arr t1 \ Arr t2 \ Arr t3 \ Src t1 = Trg t2 \ Src t2 = Trg t3 \ ((\<^bold>\Cod t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t3\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ (\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\) = \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\" using VcompNml_HcompNml Ide_Cod HcompNml_in_Hom Nml_HcompNml Nml_Nmlize Nmlize_in_Hom HcompNml_assoc by simp qed thus ?thesis using assms by blast qed lemma Nmlize_Vcomp_Arr_Dom: assumes "Arr t" shows "\<^bold>\t \<^bold>\ Dom t\<^bold>\ = \<^bold>\t\<^bold>\" proof - have "Arr t \ \<^bold>\t \<^bold>\ Dom t\<^bold>\ = \<^bold>\t\<^bold>\" proof (induct t, simp_all) show "\x. arr x \ x \ local.dom x = x" using comp_arr_dom by blast fix t1 t2 show "\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t1\<^bold>\ = \<^bold>\t1\<^bold>\ \ \<^bold>\t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\ = \<^bold>\t2\<^bold>\ \ HSeq t1 t2 \ (\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ (\<^bold>\Dom t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\) = \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\" using VcompNml_HcompNml Ide_Dom HcompNml_in_Hom Nml_HcompNml Nml_Nmlize Nmlize_in_Hom HcompNml_assoc by simp show "\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod t2\<^bold>\ = \<^bold>\t1\<^bold>\ \ \<^bold>\t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\ = \<^bold>\t2\<^bold>\ \ VSeq t1 t2 \ (\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\ = \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\" using VcompNml_assoc [of "\<^bold>\t1\<^bold>\" "\<^bold>\t2\<^bold>\" "\<^bold>\Dom t2\<^bold>\"] Ide_Dom Nml_Nmlize by simp next show "\t. \<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t\<^bold>\ = \<^bold>\t\<^bold>\ \ Arr t \ \<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ (\<^bold>\Trg t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t\<^bold>\) = \<^bold>\t\<^bold>\" by (simp add: Nml_Nmlize(1) Nml_Nmlize(3) Nmlize_Trg(2) HcompNml_Obj_Nml bicategorical_language.Ide_Dom bicategorical_language_axioms) show "\t. \<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t\<^bold>\ = \<^bold>\t\<^bold>\ \ Arr t \ \<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ (\<^bold>\Dom t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Src t\<^bold>\) = \<^bold>\t\<^bold>\" by (simp add: Nml_Nmlize(1) Nml_Nmlize(2) Nmlize_Src(2) HcompNml_Nml_Obj) show "\t1 t2 t3. \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t1\<^bold>\ = \<^bold>\t1\<^bold>\ \ \<^bold>\t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\ = \<^bold>\t2\<^bold>\ \ \<^bold>\t3\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t3\<^bold>\ = \<^bold>\t3\<^bold>\ \ Arr t1 \ Arr t2 \ Arr t3 \ Src t1 = Trg t2 \ Src t2 = Trg t3 \ ((\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ ((\<^bold>\Dom t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t3\<^bold>\) = (\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\" using VcompNml_HcompNml Ide_Dom HcompNml_in_Hom Nml_HcompNml Nml_Nmlize Nmlize_in_Hom HcompNml_assoc by simp show "\t1 t2 t3. \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t1\<^bold>\ = \<^bold>\t1\<^bold>\ \ \<^bold>\t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\ = \<^bold>\t2\<^bold>\ \ \<^bold>\t3\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t3\<^bold>\ = \<^bold>\t3\<^bold>\ \ Arr t1 \ Arr t2 \ Arr t3 \ Src t1 = Trg t2 \ Src t2 = Trg t3 \ (\<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ (\<^bold>\Dom t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t3\<^bold>\) = \<^bold>\t1\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t2\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\t3\<^bold>\" using VcompNml_HcompNml Ide_Dom HcompNml_in_Hom Nml_HcompNml Nml_Nmlize Nmlize_in_Hom HcompNml_assoc by simp qed thus ?thesis using assms by blast qed lemma Nmlize_Inv: assumes "Can t" shows "\<^bold>\Inv t\<^bold>\ = Inv \<^bold>\t\<^bold>\" proof - have "Can t \ \<^bold>\Inv t\<^bold>\ = Inv \<^bold>\t\<^bold>\" proof (induct t, simp_all) fix u v assume I1: "\<^bold>\Inv u\<^bold>\ = Inv \<^bold>\u\<^bold>\" assume I2: "\<^bold>\Inv v\<^bold>\ = Inv \<^bold>\v\<^bold>\" show "Can u \ Can v \ Src u = Trg v \ Inv \<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ Inv \<^bold>\v\<^bold>\ = Inv (\<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\)" using Inv_HcompNml Nml_Nmlize Can_implies_Arr Can_Nmlize_Can I1 I2 by simp show "Can u \ Can v \ Dom u = Cod v \ Inv \<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ Inv \<^bold>\u\<^bold>\ = Inv (\<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\)" using Inv_VcompNml Nml_Nmlize Can_implies_Arr Nmlize_in_Hom Can_Nmlize_Can I1 I2 by simp fix w assume I3: "\<^bold>\Inv w\<^bold>\ = Inv \<^bold>\w\<^bold>\" assume uvw: "Can u \ Can v \ Can w \ Src u = Trg v \ Src v = Trg w" show "Inv \<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ (Inv \<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ Inv \<^bold>\w\<^bold>\) = Inv ((\<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\)" using uvw I1 I2 I3 Inv_HcompNml Nml_Nmlize Can_implies_Arr Can_Nmlize_Can Nml_HcompNml Can_HcompNml HcompNml_assoc by simp show "(Inv \<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ Inv \<^bold>\v\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ Inv \<^bold>\w\<^bold>\ = Inv (\<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ (\<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\))" using uvw I1 I2 I3 Inv_HcompNml Nml_Nmlize Can_implies_Arr Can_Nmlize_Can Nml_HcompNml Can_HcompNml HcompNml_assoc Can_Inv by simp qed thus ?thesis using assms by blast qed subsection "Reductions" text \ Function \red\ defined below takes a formal identity @{term t} to a canonical arrow \f\<^bold>\ \ Hom f \<^bold>\f\<^bold>\\. The auxiliary function \red2\ takes a pair @{term "(f, g)"} of normalized formal identities and produces a canonical arrow \f \<^bold>\ g \ Hom (f \<^bold>\ g) \<^bold>\f \<^bold>\ g\<^bold>\\. \ fun red2 (infixr "\<^bold>\" 53) where "\<^bold>\b\<^bold>\\<^sub>0 \<^bold>\ u = \<^bold>\\<^bold>[u\<^bold>]" | "\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0 = \<^bold>\\<^bold>[\<^bold>\f\<^bold>\\<^bold>]" | "\<^bold>\f\<^bold>\ \<^bold>\ u = \<^bold>\f\<^bold>\ \<^bold>\ u" | "(t \<^bold>\ u) \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0 = \<^bold>\\<^bold>[t \<^bold>\ u\<^bold>]" | "(t \<^bold>\ u) \<^bold>\ v = (t \<^bold>\ \<^bold>\u \<^bold>\ v\<^bold>\) \<^bold>\ (t \<^bold>\ (u \<^bold>\ v)) \<^bold>\ \<^bold>\\<^bold>[t, u, v\<^bold>]" | "t \<^bold>\ u = undefined" fun red ("_\<^bold>\" [56] 56) where "\<^bold>\f\<^bold>\\<^sub>0\<^bold>\ = \<^bold>\f\<^bold>\\<^sub>0" | "\<^bold>\f\<^bold>\\<^bold>\ = \<^bold>\f\<^bold>\" | "(t \<^bold>\ u)\<^bold>\ = (if Nml (t \<^bold>\ u) then t \<^bold>\ u else (\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\u\<^bold>\) \<^bold>\ (t\<^bold>\ \<^bold>\ u\<^bold>\))" | "t\<^bold>\ = undefined" lemma red_Nml [simp]: assumes "Nml a" shows "a\<^bold>\ = a" using assms by (cases a, simp_all) lemma red2_Nml: assumes "Nml (a \<^bold>\ b)" shows "a \<^bold>\ b = a \<^bold>\ b" proof - have a: "a = \<^bold>\un_Prim a\<^bold>\" using assms Nml_HcompD by metis have b: "Nml b \ \ is_Prim\<^sub>0 b" using assms Nml_HcompD by metis show ?thesis using a b apply (cases b) apply simp_all apply (metis red2.simps(3)) by (metis red2.simps(4)) qed lemma Can_red2: assumes "Ide a" and "Nml a" and "Ide b" and "Nml b" and "Src a = Trg b" shows "Can (a \<^bold>\ b)" and "a \<^bold>\ b \ VHom (a \<^bold>\ b) \<^bold>\a \<^bold>\ b\<^bold>\" proof - have 0: "\b. \ Ide a \ Nml a; Ide b \ Nml b; Src a = Trg b \ \ Can (a \<^bold>\ b) \ a \<^bold>\ b \ VHom (a \<^bold>\ b) \<^bold>\a \<^bold>\ b\<^bold>\" proof (induct a, simp_all add: HcompNml_Nml_Src HcompNml_Trg_Nml) fix x b show "Ide b \ Nml b \ Can (Trg b \<^bold>\ b) \ Arr (Trg b \<^bold>\ b) \ Dom (Trg b \<^bold>\ b) = Trg b \<^bold>\ b \ Cod (Trg b \<^bold>\ b) = b" using Ide_implies_Can Ide_in_Hom Nmlize_Nml apply (cases b, simp_all) proof - fix u v assume uv: "Ide u \ Ide v \ Src u = Trg v \ Nml (u \<^bold>\ v)" show "Can (Trg u \<^bold>\ (u \<^bold>\ v)) \ Arr (Trg u \<^bold>\ (u \<^bold>\ v)) \ Dom (Trg u \<^bold>\ (u \<^bold>\ v)) = Trg u \<^bold>\ u \<^bold>\ v \ Cod (Trg u \<^bold>\ (u \<^bold>\ v)) = u \<^bold>\ v" using uv Ide_implies_Can Can_implies_Arr Ide_in_Hom by (cases u, simp_all) qed show "ide x \ arr x \ Ide b \ Nml b \ \<^bold>\src x\<^bold>\\<^sub>0 = Trg b \ Can (\<^bold>\x\<^bold>\ \<^bold>\ b) \ Arr (\<^bold>\x\<^bold>\ \<^bold>\ b) \ Dom (\<^bold>\x\<^bold>\ \<^bold>\ b) = \<^bold>\x\<^bold>\ \<^bold>\ b \ Cod (\<^bold>\x\<^bold>\ \<^bold>\ b) = \<^bold>\x\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ b" using Ide_implies_Can Can_implies_Arr Nmlize_Nml Ide_in_Hom by (cases b, simp_all) next fix u v w assume uv: "Ide u \ Ide v \ Src u = Trg v \ Nml (u \<^bold>\ v)" assume vw: "Src v = Trg w" assume w: "Ide w \ Nml w" assume I1: "\w. \ Nml u; Ide w \ Nml w; Trg v = Trg w \ \ Can (u \<^bold>\ w) \ Arr (u \<^bold>\ w) \ Dom (u \<^bold>\ w) = u \<^bold>\ w \ Cod (u \<^bold>\ w) = u \<^bold>\\<^bold>\\<^bold>\ w" assume I2: "\x. \ Nml v; Ide x \ Nml x; Trg w = Trg x \ \ Can (v \<^bold>\ x) \ Arr (v \<^bold>\ x) \ Dom (v \<^bold>\ x) = v \<^bold>\ x \ Cod (v \<^bold>\ x) = v \<^bold>\\<^bold>\\<^bold>\ x" show "Can ((u \<^bold>\ v) \<^bold>\ w) \ Arr ((u \<^bold>\ v) \<^bold>\ w) \ Dom ((u \<^bold>\ v) \<^bold>\ w) = (u \<^bold>\ v) \<^bold>\ w \ Cod ((u \<^bold>\ v) \<^bold>\ w) = (\<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ w" proof - have u: "Nml u \ Ide u" using uv Nml_HcompD by blast have v: "Nml v \ Ide v" using uv Nml_HcompD by blast have "is_Prim\<^sub>0 w \ ?thesis" proof - assume 1: "is_Prim\<^sub>0 w" have 2: "(u \<^bold>\ v) \<^bold>\ w = \<^bold>\\<^bold>[u \<^bold>\ v\<^bold>]" using 1 by (cases w, simp_all) have 3: "Can (u \<^bold>\ v) \ Arr (u \<^bold>\ v) \ Dom (u \<^bold>\ v) = u \<^bold>\ v \ Cod (u \<^bold>\ v) = u \<^bold>\ v" using u v uv 1 2 I1 Nmlize_Nml Nmlize.simps(3) by metis hence 4: "VSeq (u \<^bold>\ v) \<^bold>\\<^bold>[u \<^bold>\ v\<^bold>]" using uv by (metis (mono_tags, lifting) Arr.simps(7) Cod.simps(3) Cod.simps(7) Nml_implies_Arr Ide_in_Hom(2) mem_Collect_eq) have "Can ((u \<^bold>\ v) \<^bold>\ w)" using 1 2 3 4 uv by (simp add: Ide_implies_Can) moreover have "Dom ((u \<^bold>\ v) \<^bold>\ w) = (u \<^bold>\ v) \<^bold>\ w" using 1 2 3 4 u v w uv vw I1 Ide_in_Hom Nml_HcompNml Ide_in_Hom apply (cases w) by simp_all moreover have "Cod ((u \<^bold>\ v) \<^bold>\ w) = \<^bold>\(u \<^bold>\ v) \<^bold>\ w\<^bold>\" using 1 2 3 4 uv using Nmlize_Nml apply (cases w, simp_all) by (metis Nmlize.simps(3) Nmlize_Nml HcompNml.simps(3)) ultimately show ?thesis using w Can_implies_Arr by (simp add: 1 uv) qed moreover have "\ is_Prim\<^sub>0 w \ ?thesis" proof - assume 1: "\ is_Prim\<^sub>0 w" have 2: "(u \<^bold>\ v) \<^bold>\ w = (u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\) \<^bold>\ (u \<^bold>\ v \<^bold>\ w) \<^bold>\ \<^bold>\\<^bold>[u, v, w\<^bold>]" using 1 u v uv w by (cases w; simp) have 3: "Can (u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\) \ Dom (u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\) = u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\ \ Cod (u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\) = \<^bold>\u \<^bold>\ (v \<^bold>\ w)\<^bold>\" proof - have "Can (u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\) \ Dom (u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\) = u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\ \ Cod (u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\) = u \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\" using w uv Ide_HcompNml Nml_HcompNml(1) apply (cases u, simp_all) using u v vw I1 Nmlize_in_Hom(1) [of "v \<^bold>\ w"] Nml_Nmlize Ide_Nmlize_Ide by simp moreover have "u \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\ = \<^bold>\u \<^bold>\ (v \<^bold>\ w)\<^bold>\" using uv u w Nmlize_Hcomp Nmlize_Nmlize Nml_implies_Arr by simp ultimately show ?thesis by presburger qed have 4: "Can (v \<^bold>\ w) \ Dom (v \<^bold>\ w) = v \<^bold>\ w \ Cod (v \<^bold>\ w) = \<^bold>\v \<^bold>\ w\<^bold>\" using v w vw 1 2 I2 by simp hence 5: "Src (v \<^bold>\ w) = Src w \ Trg (v \<^bold>\ w) = Trg v" using Src_Dom Trg_Dom Can_implies_Arr by fastforce have "Can (u \<^bold>\ (v \<^bold>\ w)) \ Dom (u \<^bold>\ (v \<^bold>\ w)) = u \<^bold>\ (v \<^bold>\ w) \ Cod (u \<^bold>\ (v \<^bold>\ w)) = u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\" using u uv vw 4 5 Ide_implies_Can Ide_in_Hom by simp moreover have "\<^bold>\u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\\<^bold>\ = \<^bold>\u \<^bold>\ v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\" proof - have "\<^bold>\u \<^bold>\ \<^bold>\v \<^bold>\ w\<^bold>\\<^bold>\ = u \<^bold>\\<^bold>\\<^bold>\ (v \<^bold>\\<^bold>\\<^bold>\ w)" using u v w 4 by (metis Ide_Dom Can_implies_Arr Ide_implies_Arr Nml_Nmlize(1) Nmlize.simps(3) Nmlize_Nml) also have "... = (u \<^bold>\\<^bold>\\<^bold>\ v) \<^bold>\\<^bold>\\<^bold>\ w" using u v w uv vw HcompNml_assoc by metis also have "... = \<^bold>\u \<^bold>\ v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\" using u v w by (metis Nmlize.simps(3) Nmlize_Nml) finally show ?thesis by blast qed moreover have "Can \<^bold>\\<^bold>[u, v, w\<^bold>] \ Dom \<^bold>\\<^bold>[u, v, w\<^bold>] = (u \<^bold>\ v) \<^bold>\ w \ Cod \<^bold>\\<^bold>[u, v, w\<^bold>] = u \<^bold>\ (v \<^bold>\ w)" using uv vw w Ide_implies_Can Ide_in_Hom by auto ultimately show ?thesis using uv w 2 3 4 Nml_implies_Arr Nmlize_Nmlize Ide_implies_Can Nmlize_Nml Ide_Dom Can_implies_Arr by (metis Can.simps(4) Cod.simps(4) Dom.simps(4) Nmlize.simps(3)) qed ultimately show ?thesis by blast qed qed show "Can (a \<^bold>\ b)" using assms 0 by blast show "a \<^bold>\ b \ VHom (a \<^bold>\ b) \<^bold>\a \<^bold>\ b\<^bold>\" using 0 assms by blast qed lemma red2_in_Hom [intro]: assumes "Ide u" and "Nml u" and "Ide v" and "Nml v" and "Src u = Trg v" shows "u \<^bold>\ v \ HHom (Src v) (Trg u)" and "u \<^bold>\ v \ VHom (u \<^bold>\ v) \<^bold>\u \<^bold>\ v\<^bold>\" proof - show 1: "u \<^bold>\ v \ VHom (u \<^bold>\ v) \<^bold>\u \<^bold>\ v\<^bold>\" using assms Can_red2 Can_implies_Arr by simp show "u \<^bold>\ v \ HHom (Src v) (Trg u)" using assms 1 Src_Dom [of "u \<^bold>\ v"] Trg_Dom [of "u \<^bold>\ v"] Can_red2 Can_implies_Arr by simp qed lemma red2_simps [simp]: assumes "Ide u" and "Nml u" and "Ide v" and "Nml v" and "Src u = Trg v" shows "Src (u \<^bold>\ v) = Src v" and "Trg (u \<^bold>\ v) = Trg u" and "Dom (u \<^bold>\ v) = u \<^bold>\ v" and "Cod (u \<^bold>\ v) = \<^bold>\u \<^bold>\ v\<^bold>\" using assms red2_in_Hom by auto lemma Can_red: assumes "Ide u" shows "Can (u\<^bold>\)" and "u\<^bold>\ \ VHom u \<^bold>\u\<^bold>\" proof - have 0: "Ide u \ Can (u\<^bold>\) \ u\<^bold>\ \ VHom u \<^bold>\u\<^bold>\" proof (induct u, simp_all add: Dom_Ide Cod_Ide) fix v w assume v: "Can (v\<^bold>\) \ Arr (v\<^bold>\) \ Dom (v\<^bold>\) = v \ Cod (v\<^bold>\) = \<^bold>\v\<^bold>\" assume w: "Can (w\<^bold>\) \ Arr (w\<^bold>\) \ Dom (w\<^bold>\) = w \ Cod (w\<^bold>\) = \<^bold>\w\<^bold>\" assume vw: "Ide v \ Ide w \ Src v = Trg w" show "(Nml (v \<^bold>\ w) \ Can v \ Can w \ v \<^bold>\ w = \<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\) \ (\ Nml (v \<^bold>\ w) \ Can (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) \ Src (v\<^bold>\) = Trg (w\<^bold>\) \ Dom (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\ \ Arr (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) \ Src (v\<^bold>\) = Trg (w\<^bold>\) \ Dom (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\ \ Cod (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\)" proof show "Nml (v \<^bold>\ w) \ Can v \ Can w \ v \<^bold>\ w = \<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\" using vw Nml_HcompD Ide_implies_Can Dom_Inv VcompNml_Ide_Nml Inv_Ide Nmlize.simps(3) Nmlize_Nml by metis show "\ Nml (v \<^bold>\ w) \ Can (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) \ Src (v\<^bold>\) = Trg (w\<^bold>\) \ Dom (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\ \ Arr (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) \ Src (v\<^bold>\) = Trg (w\<^bold>\) \ Dom (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\ \ Cod (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\" proof assume 1: "\ Nml (v \<^bold>\ w)" have "Can (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\)" using v w vw Can_red2 Nml_Nmlize Ide_Nmlize_Ide Nml_HcompNml Ide_HcompNml by simp moreover have "Src (v\<^bold>\) = Trg (w\<^bold>\)" using v w vw Src_Dom Trg_Dom by metis moreover have "Dom (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\ \ Cod (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\" using v w vw Can_red2 Nml_Nmlize Ide_Nmlize_Ide by simp ultimately show "Can (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) \ Src (v\<^bold>\) = Trg (w\<^bold>\) \ Dom (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\ \ Arr (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) \ Src (v\<^bold>\) = Trg (w\<^bold>\) \ Dom (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\ \ Cod (\<^bold>\v\<^bold>\ \<^bold>\ \<^bold>\w\<^bold>\) = \<^bold>\v\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\w\<^bold>\" using Can_implies_Arr by blast qed qed qed show "Can (u\<^bold>\)" using assms 0 by blast show "u\<^bold>\ \ VHom u \<^bold>\u\<^bold>\" using assms 0 by blast qed lemma red_in_Hom [intro]: assumes "Ide t" shows "t\<^bold>\ \ HHom (Src t) (Trg t)" and "t\<^bold>\ \ VHom t \<^bold>\t\<^bold>\" proof - show 1: "t\<^bold>\ \ VHom t \<^bold>\t\<^bold>\" using assms Can_red Can_implies_Arr by simp show "t\<^bold>\ \ HHom (Src t) (Trg t)" using assms 1 Src_Dom [of "t\<^bold>\"] Trg_Dom [of "t\<^bold>\"] Can_red Can_implies_Arr by simp qed lemma red_simps [simp]: assumes "Ide t" shows "Src (t\<^bold>\) = Src t" and "Trg (t\<^bold>\) = Trg t" and "Dom (t\<^bold>\) = t" and "Cod (t\<^bold>\) = \<^bold>\t\<^bold>\" using assms red_in_Hom by auto lemma red_Src: assumes "Ide t" shows "Src t\<^bold>\ = Src t" using assms is_Prim0_Src [of t] by (cases "Src t", simp_all) lemma red_Trg: assumes "Ide t" shows "Trg t\<^bold>\ = Trg t" using assms is_Prim0_Trg [of t] by (cases "Trg t", simp_all) lemma Nmlize_red [simp]: assumes "Ide t" shows "\<^bold>\t\<^bold>\\<^bold>\ = \<^bold>\t\<^bold>\" using assms Can_red Ide_Nmlize_Can Nmlize_in_Hom Ide_in_Hom by fastforce lemma Nmlize_red2 [simp]: assumes "Ide t" and "Ide u" and "Nml t" and "Nml u" and "Src t = Trg u" shows "\<^bold>\t \<^bold>\ u\<^bold>\ = \<^bold>\t \<^bold>\ u\<^bold>\" using assms Can_red2 Ide_Nmlize_Can Nmlize_in_Hom [of "t \<^bold>\ u"] red2_in_Hom Ide_in_Hom by simp end subsection "Evaluation" text \ The following locale is concerned with the evaluation of terms of the bicategorical language determined by \C\, \src\<^sub>C\, and \trg\<^sub>C\ in a bicategory \(V, H, \, \, src, trg)\, given a source and target-preserving functor from \C\ to \V\. \ locale evaluation_map = C: horizontal_homs C src\<^sub>C trg\<^sub>C + bicategorical_language C src\<^sub>C trg\<^sub>C + bicategory V H \ \ src trg + E: "functor" C V E for C :: "'c comp" (infixr "\\<^sub>C" 55) and src\<^sub>C :: "'c \ 'c" and trg\<^sub>C :: "'c \ 'c" and V :: "'b comp" (infixr "\" 55) and H :: "'b comp" (infixr "\" 53) and \ :: "'b \ 'b \ 'b \ 'b" ("\[_, _, _]") and \ :: "'b \ 'b" ("\[_]") and src :: "'b \ 'b" and trg :: "'b \ 'b" and E :: "'c \ 'b" + assumes preserves_src: "E (src\<^sub>C x) = src (E x)" and preserves_trg: "E (trg\<^sub>C x) = trg (E x)" begin (* TODO: Figure out why this notation has to be reinstated. *) notation Nmlize ("\<^bold>\_\<^bold>\") notation HcompNml (infixr "\<^bold>\\<^bold>\\<^bold>\" 53) notation VcompNml (infixr "\<^bold>\\<^bold>\\<^bold>\" 55) notation red ("_\<^bold>\" [56] 56) notation red2 (infixr "\<^bold>\" 53) primrec eval :: "'c term \ 'b" ("\_\") where "\\<^bold>\f\<^bold>\\<^sub>0\ = E f" | "\\<^bold>\f\<^bold>\\ = E f" | "\t \<^bold>\ u\ = \t\ \ \u\" | "\t \<^bold>\ u\ = \t\ \ \u\" | "\\<^bold>\\<^bold>[t\<^bold>]\ = \ \t\" | "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \'.map \t\" | "\\<^bold>\\<^bold>[t\<^bold>]\ = \ \t\" | "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \'.map \t\" | "\\<^bold>\\<^bold>[t, u, v\<^bold>]\ = \ (\t\, \u\, \v\)" | "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ = \'.map (\t\, \u\, \v\)" lemma preserves_obj: assumes "C.obj a" shows "obj (E a)" proof (unfold obj_def) show "arr (E a) \ src (E a) = E a" proof show "arr (E a)" using assms C.obj_simps by simp have "src (E a) = E (src\<^sub>C a)" using assms preserves_src by metis also have "... = E a" using assms C.obj_simps by simp finally show "src (E a) = E a" by simp qed qed lemma eval_in_hom': shows "Arr t \ \\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\" proof (induct t) show "\x. Arr \<^bold>\x\<^bold>\\<^sub>0 \ \\\<^bold>\x\<^bold>\\<^sub>0\ : \Src \<^bold>\x\<^bold>\\<^sub>0\ \ \Trg \<^bold>\x\<^bold>\\<^sub>0\\ \ \\\<^bold>\x\<^bold>\\<^sub>0\ : \Dom \<^bold>\x\<^bold>\\<^sub>0\ \ \Cod \<^bold>\x\<^bold>\\<^sub>0\\" apply (simp add: preserves_src preserves_trg) using preserves_src preserves_trg C.objE by (metis (full_types) C.obj_def' E.preserves_arr E.preserves_ide in_hhom_def ide_in_hom(2)) show "\x. Arr \<^bold>\x\<^bold>\ \ \\\<^bold>\x\<^bold>\\ : \Src \<^bold>\x\<^bold>\\ \ \Trg \<^bold>\x\<^bold>\\\ \ \\\<^bold>\x\<^bold>\\ : \Dom \<^bold>\x\<^bold>\\ \ \Cod \<^bold>\x\<^bold>\\\" by (auto simp add: preserves_src preserves_trg) show "\t1 t2. (Arr t1 \ \\t1\ : \Src t1\ \ \Trg t1\\ \ \\t1\ : \Dom t1\ \ \Cod t1\\) \ (Arr t2 \ \\t2\ : \Src t2\ \ \Trg t2\\ \ \\t2\ : \Dom t2\ \ \Cod t2\\) \ Arr (t1 \<^bold>\ t2) \ \\t1 \<^bold>\ t2\ : \Src (t1 \<^bold>\ t2)\ \ \Trg (t1 \<^bold>\ t2)\\ \ \\t1 \<^bold>\ t2\ : \Dom (t1 \<^bold>\ t2)\ \ \Cod (t1 \<^bold>\ t2)\\" using hcomp_in_hhom in_hhom_def vconn_implies_hpar(1) vconn_implies_hpar(2) by auto show "\t1 t2. (Arr t1 \ \\t1\ : \Src t1\ \ \Trg t1\\ \ \\t1\ : \Dom t1\ \ \Cod t1\\) \ (Arr t2 \ \\t2\ : \Src t2\ \ \Trg t2\\ \ \\t2\ : \Dom t2\ \ \Cod t2\\) \ Arr (t1 \<^bold>\ t2) \ \\t1 \<^bold>\ t2\ : \Src (t1 \<^bold>\ t2)\ \ \Trg (t1 \<^bold>\ t2)\\ \ \\t1 \<^bold>\ t2\ : \Dom (t1 \<^bold>\ t2)\ \ \Cod (t1 \<^bold>\ t2)\\" using VSeq_implies_HPar seqI' by auto show "\t. (Arr t \ \\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\) \ Arr \<^bold>\\<^bold>[t\<^bold>] \ \\\<^bold>\\<^bold>[t\<^bold>]\ : \Src \<^bold>\\<^bold>[t\<^bold>]\ \ \Trg \<^bold>\\<^bold>[t\<^bold>]\\ \ \\\<^bold>\\<^bold>[t\<^bold>]\ : \Dom \<^bold>\\<^bold>[t\<^bold>]\ \ \Cod \<^bold>\\<^bold>[t\<^bold>]\\" proof (simp add: preserves_src preserves_trg) fix t assume t: "\\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\" assume 1: "Arr t" show "\\ \t\ : \Src t\ \ \Trg t\\ \ \\ \t\ : \Trg t\ \ \Dom t\ \ \Cod t\\" proof - have "src (\ \t\) = \Src t\" using t 1 by (metis (no_types, lifting) \.preserves_cod arr_cod in_hhomE map_simp src_cod) moreover have "trg (\ \t\) = \Trg t\" using t 1 by (metis (no_types, lifting) \.preserves_cod arr_cod in_hhomE map_simp trg_cod) moreover have "\\ \t\ : \Trg t\ \ \Dom t\ \ \Cod t\\" using t 1 apply (elim conjE in_hhomE) by (intro in_homI, auto) ultimately show ?thesis by auto qed qed show "\t. (Arr t \ \\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\) \ Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] \ \\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ : \Src \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ \ \Trg \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\\ \ \\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ : \Dom \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ \ \Cod \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\\" proof (simp add: preserves_src preserves_trg) fix t assume t: "\\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\" assume 1: "Arr t" show "\\'.map \t\ : \Src t\ \ \Trg t\\ \ \\'.map \t\ : \Dom t\ \ \Trg t\ \ \Cod t\\" proof - have "src (\'.map \t\) = \Src t\" using t 1 \'.preserves_dom arr_dom map_simp \'.preserves_reflects_arr src_dom by (metis (no_types, lifting) in_hhomE) moreover have "trg (\'.map \t\) = \Trg t\" using t 1 \'.preserves_dom arr_dom map_simp \'.preserves_reflects_arr trg_dom by (metis (no_types, lifting) in_hhomE) moreover have "\\'.map \t\ : \Dom t\ \ \Trg t\ \ \Cod t\\" using t 1 \'.preserves_hom apply (intro in_homI) apply auto[1] apply fastforce by fastforce ultimately show ?thesis by blast qed qed show "\t. (Arr t \ \\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\) \ Arr \<^bold>\\<^bold>[t\<^bold>] \ \\\<^bold>\\<^bold>[t\<^bold>]\ : \Src \<^bold>\\<^bold>[t\<^bold>]\ \ \Trg \<^bold>\\<^bold>[t\<^bold>]\\ \ \\\<^bold>\\<^bold>[t\<^bold>]\ : \Dom \<^bold>\\<^bold>[t\<^bold>]\ \ \Cod \<^bold>\\<^bold>[t\<^bold>]\\" proof (simp add: preserves_src preserves_trg) fix t assume t: "\\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\" assume 1: "Arr t" show "\\ \t\ : \Src t\ \ \Trg t\\ \ \\ \t\ : \Dom t\ \ \Src t\ \ \Cod t\\" proof - have "src (\ \t\) = \Src t\" using t 1 \.preserves_cod arr_cod map_simp \.preserves_reflects_arr src_cod by (metis (no_types, lifting) in_hhomE) moreover have "trg (\ \t\) = \Trg t\" using t 1 \.preserves_cod arr_cod map_simp \.preserves_reflects_arr trg_cod by (metis (no_types, lifting) in_hhomE) moreover have "\\ \t\ : \Dom t\ \ \Src t\ \ \Cod t\\" using t 1 by force ultimately show ?thesis by blast qed qed show "\t. (Arr t \ \\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\) \ Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] \ \\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ : \Src \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ \ \Trg \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\\ \ \\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ : \Dom \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ \ \Cod \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\\" proof (simp add: preserves_src preserves_trg) fix t assume t: "\\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\" assume 1: "Arr t" show "\\'.map \t\ : \Src t\ \ \Trg t\\ \ \\'.map \t\ : \Dom t\ \ \Cod t\ \ \Src t\\" proof - have "src (\'.map \t\) = \Src t\" using t 1 \'.preserves_dom arr_dom map_simp \'.preserves_reflects_arr src_dom by (metis (no_types, lifting) in_hhomE) moreover have "trg (\'.map \t\) = \Trg t\" using t 1 \'.preserves_dom arr_dom map_simp \'.preserves_reflects_arr trg_dom by (metis (no_types, lifting) in_hhomE) moreover have "\\'.map \t\ : \Dom t\ \ \Cod t\ \ \Src t\\" using t 1 src_cod arr_cod \'.preserves_hom [of "\t\" "\Dom t\" "\Cod t\"] apply (elim conjE in_hhomE) by (intro in_homI, auto) ultimately show ?thesis by blast qed qed show "\t u v. (Arr t \ \\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\) \ (Arr u \ \\u\ : \Src u\ \ \Trg u\\ \ \\u\ : \Dom u\ \ \Cod u\\) \ (Arr v \ \\v\ : \Src v\ \ \Trg v\\ \ \\v\ : \Dom v\ \ \Cod v\\) \ Arr \<^bold>\\<^bold>[t, u, v\<^bold>] \ \\\<^bold>\\<^bold>[t, u, v\<^bold>]\ : \Src \<^bold>\\<^bold>[t, u, v\<^bold>]\ \ \Trg \<^bold>\\<^bold>[t, u, v\<^bold>]\\ \ \\\<^bold>\\<^bold>[t, u, v\<^bold>]\ : \Dom \<^bold>\\<^bold>[t, u, v\<^bold>]\ \ \Cod \<^bold>\\<^bold>[t, u, v\<^bold>]\\" proof (simp add: preserves_src preserves_trg) fix t u v assume t: "\\t\ : \Trg u\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\" assume u: "\\u\ : \Trg v\ \ \Trg u\\ \ \\u\ : \Dom u\ \ \Cod u\\" assume v: "\\v\ : \Src v\ \ \Trg v\\ \ \\v\ : \Dom v\ \ \Cod v\\" assume tuv: "Arr t \ Arr u \ Arr v \ Src t = Trg u \ Src u = Trg v" show "\\ (\t\, \u\, \v\) : \Src v\ \ \Trg t\\ \ \\ (\t\, \u\, \v\) : (\Dom t\ \ \Dom u\) \ \Dom v\ \ \Cod t\ \ \Cod u\ \ \Cod v\\" proof - have 1: "VVV.in_hom (\t\, \u\, \v\) (\Dom t\, \Dom u\, \Dom v\) (\Cod t\, \Cod u\, \Cod v\)" proof - have "(\t\, \u\, \v\) \ VxVxV.hom (\Dom t\, \Dom u\, \Dom v\) (\Cod t\, \Cod u\, \Cod v\)" using t u v tuv by simp moreover have "(\t\, \u\, \v\) \ {\\\. arr (fst \\\) \ VV.arr (snd \\\) \ src (fst \\\) = trg (fst (snd \\\))}" using t u v tuv by fastforce ultimately show ?thesis using VVV.hom_char [of "(\Dom t\, \Dom u\, \Dom v\)" "(\Cod t\, \Cod u\, \Cod v\)"] by blast qed have 4: "VVV.arr (\Dom t\, \Dom u\, \Dom v\)" using 1 VVV.ide_dom VVV.dom_simp by (elim VVV.in_homE) force have 5: "VVV.arr (\Cod t\, \Cod u\, \Cod v\)" - using 1 VVV.ide_cod VVV.cod_simp by (elim VVV.in_homE) force + using 1 VVV.ide_cod VVV.cod_simp VVV.in_hom_char by blast have 2: "\\ (\t\, \u\, \v\) : (\Dom t\ \ \Dom u\) \ \Dom v\ \ \Cod t\ \ \Cod u\ \ \Cod v\\" using 1 4 5 HoHV_def HoVH_def \_def \.preserves_hom [of "(\t\, \u\, \v\)" "(\Dom t\, \Dom u\, \Dom v\)" "(\Cod t\, \Cod u\, \Cod v\)"] by simp have 3: "\\ (\t\, \u\, \v\) : \Src v\ \ \Trg t\\" proof show "arr (\ (\t\, \u\, \v\))" using 2 by auto show "src (\ (\t\, \u\, \v\)) = \Src v\" proof - have "src (\ (\t\, \u\, \v\)) = src ((\Dom t\ \ \Dom u\) \ \Dom v\)" using 2 src_dom [of "\ (\t\, \u\, \v\)"] by fastforce also have "... = src \Dom v\" using 4 VVV.arr_char VV.arr_char by simp also have "... = src (dom \v\)" using v by fastforce also have "... = \Src v\" using v by auto finally show ?thesis by auto qed show "trg (\ (\t\, \u\, \v\)) = \Trg t\" proof - have "trg (\ (\t\, \u\, \v\)) = trg ((\Dom t\ \ \Dom u\) \ \Dom v\)" using 2 trg_dom [of "\ (\t\, \u\, \v\)"] by fastforce also have "... = trg \Dom t\" using 4 VVV.arr_char VV.arr_char by simp also have "... = trg (dom \t\)" using t by fastforce also have "... = \Trg t\" using t by auto finally show ?thesis by auto qed qed show ?thesis using 2 3 by simp qed qed show "\t u v. (Arr t \ \\t\ : \Src t\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\) \ (Arr u \ \\u\ : \Src u\ \ \Trg u\\ \ \\u\ : \Dom u\ \ \Cod u\\) \ (Arr v \ \\v\ : \Src v\ \ \Trg v\\ \ \\v\ : \Dom v\ \ \Cod v\\) \ Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] \ \\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ : \Src \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ \ \Trg \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\\ \ \\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ : \Dom \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ \ \Cod \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\\" proof (simp add: preserves_src preserves_trg) fix t u v assume t: "\\t\ : \Trg u\ \ \Trg t\\ \ \\t\ : \Dom t\ \ \Cod t\\" assume u: "\\u\ : \Trg v\ \ \Trg u\\ \ \\u\ : \Dom u\ \ \Cod u\\" assume v: "\\v\ : \Src v\ \ \Trg v\\ \ \\v\ : \Dom v\ \ \Cod v\\" assume tuv: "Arr t \ Arr u \ Arr v \ Src t = Trg u \ Src u = Trg v" show "\\'.map (\t\, \u\, \v\) : \Src v\ \ \Trg t\\ \ \\'.map (\t\, \u\, \v\) : \Dom t\ \ \Dom u\ \ \Dom v\ \ (\Cod t\ \ \Cod u\) \ \Cod v\\" proof - have 1: "VVV.in_hom (\t\, \u\, \v\) (\Dom t\, \Dom u\, \Dom v\) (\Cod t\, \Cod u\, \Cod v\)" using t u v tuv VVV.hom_char VVV.arr_char VV.arr_char VVV.dom_char VVV.cod_char apply (elim conjE in_hhomE in_homE) apply (intro VVV.in_homI) by simp_all have 4: "VVV.arr (\Dom t\, \Dom u\, \Dom v\)" using "1" VVV.in_hom_char by blast have 5: "VVV.arr (\Cod t\, \Cod u\, \Cod v\)" using "1" VVV.in_hom_char by blast have 2: "\\'.map (\t\, \u\, \v\) : \Dom t\ \ \Dom u\ \ \Dom v\ \ (\Cod t\ \ \Cod u\) \ \Cod v\\" using 1 4 5 HoHV_def HoVH_def \'.map_def \'.preserves_hom [of "(\t\, \u\, \v\)" "(\Dom t\, \Dom u\, \Dom v\)" "(\Cod t\, \Cod u\, \Cod v\)"] by simp have 3: "\\'.map (\t\, \u\, \v\) : \Src v\ \ \Trg t\\" proof show "arr (\'.map (\t\, \u\, \v\))" using 2 by auto show "src (\'.map (\t\, \u\, \v\)) = \Src v\" proof - have "src (\'.map (\t\, \u\, \v\)) = src (\Dom t\ \ \Dom u\ \ \Dom v\)" using 2 src_dom [of "\'.map (\t\, \u\, \v\)"] by fastforce also have "... = src \Dom v\" using 4 VVV.arr_char VV.arr_char by simp also have "... = src (dom \v\)" using v by fastforce also have "... = \Src v\" using v by auto finally show ?thesis by auto qed show "trg (\'.map (\t\, \u\, \v\)) = \Trg t\" proof - have "trg (\'.map (\t\, \u\, \v\)) = trg (\Dom t\ \ \Dom u\ \ \Dom v\)" using 2 trg_dom [of "\'.map (\t\, \u\, \v\)"] by fastforce also have "... = trg \Dom t\" using 4 VVV.arr_char VV.arr_char hseqI' by simp also have "... = trg (dom \t\)" using t by fastforce also have "... = \Trg t\" using t by auto finally show ?thesis by auto qed qed show ?thesis using 2 3 by simp qed qed qed lemma eval_in_hom [intro]: assumes "Arr t" shows "\\t\ : \Src t\ \ \Trg t\\" and "\\t\ : \Dom t\ \ \Cod t\\" using assms eval_in_hom' by simp_all (* * TODO: It seems to me that the natural useful orientation of these facts is syntax * to semantics. However, having this as the default makes it impossible to do various * proofs by simp alone. This has to be sorted out. For right now, I am going to include * both versions, which will have to be explicitly invoked where needed. *) lemma eval_simps: assumes "Arr f" shows "arr \f\" and "\Src f\ = src \f\" and "\Trg f\ = trg \f\" and "\Dom f\ = dom \f\" and "\Cod f\ = cod \f\" using assms eval_in_hom [of f] by auto lemma eval_simps': assumes "Arr f" shows "arr \f\" and "src \f\ = \Src f\" and "trg \f\ = \Trg f\" and "dom \f\ = \Dom f\" and "cod \f\ = \Cod f\" using assms eval_in_hom by auto lemma obj_eval_Obj: shows "Obj t \ obj \t\" using preserves_obj by (induct t) auto lemma ide_eval_Ide: shows "Ide t \ ide \t\" by (induct t, auto simp add: eval_simps') lemma arr_eval_Arr [simp]: assumes "Arr t" shows "arr \t\" using assms by (simp add: eval_simps') (* * TODO: The next few results want eval_simps oriented from syntax to semantics. *) lemma eval_Lunit [simp]: assumes "Arr t" shows "\\<^bold>\\<^bold>[t\<^bold>]\ = \[\Cod t\] \ (trg \t\ \ \t\)" using assms \.is_natural_2 \_ide_simp by (simp add: eval_simps) lemma eval_Lunit' [simp]: assumes "Arr t" shows "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \\<^sup>-\<^sup>1[\Cod t\] \ \t\" using assms \'.is_natural_2 \_ide_simp by (simp add: eval_simps) lemma eval_Runit [simp]: assumes "Arr t" shows "\\<^bold>\\<^bold>[t\<^bold>]\ = \[\Cod t\] \ (\t\ \ src \t\)" using assms \.is_natural_2 \_ide_simp by (simp add: eval_simps) lemma eval_Runit' [simp]: assumes "Arr t" shows "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \\<^sup>-\<^sup>1[\Cod t\] \ \t\" using assms \'.is_natural_2 \_ide_simp by (simp add: eval_simps) lemma eval_Assoc [simp]: assumes "Arr t" and "Arr u" and "Arr v" and "Src t = Trg u" and "Src u = Trg v" shows "\\<^bold>\\<^bold>[t, u, v\<^bold>]\ = \ (cod \t\, cod \u\, cod \v\) \ ((\t\ \ \u\) \ \v\)" proof - have "\\<^bold>\\<^bold>[t, u, v\<^bold>]\ = \ (\t\, \u\, \v\)" by simp also have "... = \ (VVV.cod (\t\, \u\, \v\)) \ HoHV (\t\, \u\, \v\)" using assms \.is_natural_2 [of "(\t\, \u\, \v\)"] VVV.arr_char VVV.cod_char \.is_extensional \_def by auto also have "... = \ (cod \t\, cod \u\, cod \v\) \ ((\t\ \ \u\) \ \v\)" unfolding HoHV_def \_def using assms VVV.arr_char VV.arr_char VVV.cod_char \.is_extensional by auto finally show ?thesis by simp qed lemma eval_Assoc' [simp]: assumes "Arr t" and "Arr u" and "Arr v" and "Src t = Trg u" and "Src u = Trg v" shows "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ = \\<^sup>-\<^sup>1[cod \t\, cod \u\, cod \v\] \ (\t\ \ \u\ \ \v\)" proof - have "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ = \'.map (\t\, \u\, \v\)" by simp also have "... = \'.map (VVV.cod (\t\, \u\, \v\)) \ HoVH (\t\, \u\, \v\)" using assms \'.is_natural_2 [of "(\t\, \u\, \v\)"] VVV.arr_char VVV.cod_char \'.is_extensional by simp also have "... = \'.map (cod \t\, cod \u\, cod \v\) \ (\t\ \ \u\ \ \v\)" unfolding HoVH_def using assms VVV.arr_char VV.arr_char VVV.cod_char \'.is_extensional apply simp using eval_simps'(2) eval_simps'(3) by presburger finally show ?thesis using \'_def by simp qed lemma eval_Lunit_Ide [simp]: assumes "Ide t" shows "\\<^bold>\\<^bold>[t\<^bold>]\ = \[\t\]" using assms \_ide_simp ide_eval_Ide by simp lemma eval_Lunit'_Ide [simp]: assumes "Ide t" shows "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \\<^sup>-\<^sup>1[\t\]" using assms \_ide_simp ide_eval_Ide by simp lemma eval_Runit_Ide [simp]: assumes "Ide t" shows "\\<^bold>\\<^bold>[t\<^bold>]\ = \[\t\]" using assms \_ide_simp ide_eval_Ide by simp lemma eval_Runit'_Ide [simp]: assumes "Ide t" shows "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \\<^sup>-\<^sup>1[\t\]" using assms \_ide_simp ide_eval_Ide by simp lemma eval_Assoc_Ide [simp]: assumes "Ide t" and "Ide u" and "Ide v" and "Src t = Trg u" and "Src u = Trg v" shows "\\<^bold>\\<^bold>[t, u, v\<^bold>]\ = \ (\t\, \u\, \v\)" using assms by simp lemma eval_Assoc'_Ide [simp]: assumes "Ide t" and "Ide u" and "Ide v" and "Src t = Trg u" and "Src u = Trg v" shows "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ = \\<^sup>-\<^sup>1[\t\, \u\, \v\]" using assms \'_def by simp lemma iso_eval_Can: shows "Can t \ iso \t\" proof (induct t; simp add: fsts.intros snds.intros) show "\x. C.obj x \ iso (E x)" by auto show "\t1 t2. \ iso \t1\; iso \t2\; Can t1 \ Can t2 \ Src t1 = Trg t2 \ \ iso (\t1\ \ \t2\)" using Can_implies_Arr by (simp add: eval_simps') show "\t1 t2. \ iso \t1\; iso \t2\; Can t1 \ Can t2 \ Dom t1 = Cod t2 \ \ iso (\t1\ \ \t2\)" using Can_implies_Arr isos_compose by (simp add: eval_simps') show "\t. \ iso \t\; Can t \ \ iso (\ \t\)" using \.preserves_iso by auto show "\t. \ iso \t\; Can t \ \ iso (\'.map \t\)" using \'.preserves_iso by simp show "\t. \ iso \t\; Can t \ \ iso (\ \t\)" using \.preserves_iso by auto show "\t. \ iso \t\; Can t \ \ iso (\'.map \t\)" using \'.preserves_iso by simp fix t1 t2 t3 assume t1: "iso \t1\" and t2: "iso \t2\" and t3: "iso \t3\" assume 1: "Can t1 \ Can t2 \ Can t3 \ Src t1 = Trg t2 \ Src t2 = Trg t3" have 2: "VVV.iso (\t1\, \t2\, \t3\)" proof - have 3: "VxVxV.iso (\t1\, \t2\, \t3\)" using t1 t2 t3 Can_implies_Arr VxVxV.iso_char VxV.iso_char by simp moreover have "VVV.arr (VxVxV.inv (\t1\, \t2\, \t3\))" proof - have "VxVxV.inv (\t1\, \t2\, \t3\) = (inv \t1\, inv \t2\, inv \t3\)" using t1 t2 t3 3 by simp thus ?thesis using t1 t2 t3 1 Can_implies_Arr VVV.arr_char VV.arr_char by (simp add: eval_simps') qed ultimately show ?thesis using t1 t2 t3 1 Can_implies_Arr VVV.iso_char VVV.arr_char by (auto simp add: eval_simps') qed show "iso (\ (\t1\, \t2\, \t3\))" using 2 \_def \.preserves_iso by auto show "iso (\'.map (\t1\, \t2\, \t3\))" using 2 \'.preserves_iso by simp qed lemma eval_Inv_Can: shows "Can t \ \Inv t\ = inv \t\" proof (induct t) show "\x. Can \<^bold>\x\<^bold>\\<^sub>0 \ \Inv \<^bold>\x\<^bold>\\<^sub>0\ = inv \\<^bold>\x\<^bold>\\<^sub>0\" by auto show "\x. Can \<^bold>\x\<^bold>\ \ \Inv \<^bold>\x\<^bold>\\ = inv \\<^bold>\x\<^bold>\\" by simp show "\t1 t2. (Can t1 \ \Inv t1\ = inv \t1\) \ (Can t2 \ \Inv t2\ = inv \t2\) \ Can (t1 \<^bold>\ t2) \ \Inv (t1 \<^bold>\ t2)\ = inv \t1 \<^bold>\ t2\" using iso_eval_Can Can_implies_Arr by (simp add: eval_simps') show "\t1 t2. (Can t1 \ \Inv t1\ = inv \t1\) \ (Can t2 \ \Inv t2\ = inv \t2\) \ Can (t1 \<^bold>\ t2) \ \Inv (t1 \<^bold>\ t2)\ = inv \t1 \<^bold>\ t2\" using iso_eval_Can inv_comp Can_implies_Arr by (simp add: eval_simps') fix t assume I: "Can t \ \Inv t\ = inv \t\" show "Can \<^bold>\\<^bold>[t\<^bold>] \ \Inv \<^bold>\\<^bold>[t\<^bold>]\ = inv \\<^bold>\\<^bold>[t\<^bold>]\" proof - assume t: "Can \<^bold>\\<^bold>[t\<^bold>]" have "\Inv \<^bold>\\<^bold>[t\<^bold>]\ = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[Inv t\<^bold>]\" by simp also have "... = \'.map (inv \t\)" using t I by simp also have "... = \'.map (cod (inv \t\)) \ inv \t\" using t \'.is_natural_2 iso_inv_iso iso_eval_Can iso_is_arr by (metis (no_types, lifting) Can.simps(5) map_simp) also have "... = inv (\t\ \ \ (dom \t\))" proof - have 1: "iso \t\" using t iso_eval_Can by simp moreover have "iso (\ (dom \t\))" using t 1 \.components_are_iso ide_dom by blast moreover have "seq \t\ (\ (dom \t\))" using t 1 iso_is_arr by auto ultimately show ?thesis using t 1 inv_comp by auto qed also have "... = inv \\<^bold>\\<^bold>[t\<^bold>]\" using t iso_eval_Can \_ide_simp lunit_naturality Can_implies_Arr eval_Lunit by (auto simp add: eval_simps) finally show ?thesis by blast qed show "Can \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] \ \Inv \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = inv \\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\" proof - assume t: "Can (Lunit' t)" have "\Inv (Lunit' t)\ = \Lunit (Inv t)\" by simp also have "... = \ (inv \t\)" using t I by simp also have "... = inv \t\ \ \ (dom (inv \t\))" using t \.is_natural_1 iso_inv_iso iso_eval_Can iso_is_arr by (metis (no_types, lifting) Can.simps(6) map_simp) also have "... = inv (\'.map (cod \t\) \ \t\)" proof - have 1: "iso \t\" using t iso_eval_Can by simp moreover have "iso (\'.map (cod \t\))" using t 1 \'.components_are_iso ide_cod by blast moreover have "seq (\'.map (cod \t\)) \t\" using t 1 iso_is_arr by auto ultimately show ?thesis using t 1 inv_comp by auto qed also have "... = inv \\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\" using t \'.is_natural_2 iso_eval_Can iso_is_arr by force finally show ?thesis by auto qed show "Can \<^bold>\\<^bold>[t\<^bold>] \ \Inv \<^bold>\\<^bold>[t\<^bold>]\ = inv \\<^bold>\\<^bold>[t\<^bold>]\" proof - assume t: "Can \<^bold>\\<^bold>[t\<^bold>]" have "\Inv \<^bold>\\<^bold>[t\<^bold>]\ = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[Inv t\<^bold>]\" by simp also have "... = \'.map (inv \t\)" using t I by simp also have "... = \'.map (cod (inv \t\)) \ inv \t\" using t \'.is_natural_2 map_simp iso_inv_iso iso_eval_Can iso_is_arr by (metis (no_types, lifting) Can.simps(7)) also have "... = inv (\t\ \ \ (dom \t\))" proof - have 1: "iso \t\" using t iso_eval_Can by simp moreover have "iso (\ (dom \t\))" using t 1 \.components_are_iso ide_dom by blast moreover have "seq \t\ (\ (dom \t\))" using t 1 iso_is_arr by simp ultimately show ?thesis using t 1 inv_comp by auto qed also have "... = inv \\<^bold>\\<^bold>[t\<^bold>]\" using t \_ide_simp iso_eval_Can runit_naturality Can_implies_Arr eval_Runit by (auto simp add: eval_simps) finally show ?thesis by blast qed show "Can \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] \ \Inv \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = inv \\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\" proof - assume t: "Can \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]" have "\Inv \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \\<^bold>\\<^bold>[Inv t\<^bold>]\" by simp also have "... = \ (inv \t\)" using t I by simp also have "... = inv \t\ \ \ (dom (inv \t\))" using t \.is_natural_1 map_simp iso_inv_iso iso_eval_Can iso_is_arr by (metis (no_types, lifting) Can.simps(8)) also have "... = inv (\'.map (cod \t\) \ \t\)" proof - have 1: "iso \t\" using t iso_eval_Can by simp moreover have "iso (\'.map (cod \t\))" using t 1 \'.components_are_iso ide_cod by blast moreover have "seq (\'.map (cod \t\)) \t\" using t 1 iso_is_arr by auto ultimately show ?thesis using t 1 inv_comp by auto qed also have "... = inv \\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\" using t \'.is_natural_2 iso_eval_Can iso_is_arr by auto finally show ?thesis by auto qed next fix t u v assume I1: "Can t \ \Inv t\ = inv \t\" assume I2: "Can u \ \Inv u\ = inv \u\" assume I3: "Can v \ \Inv v\ = inv \v\" show "Can \<^bold>\\<^bold>[t, u, v\<^bold>] \ \Inv \<^bold>\\<^bold>[t, u, v\<^bold>]\ = inv \\<^bold>\\<^bold>[t, u, v\<^bold>]\" proof - assume "Can \<^bold>\\<^bold>[t, u, v\<^bold>]" hence tuv: "Can t \ Can u \ Can v \ Src t = Trg u \ Src u = Trg v" by simp have "\Inv \<^bold>\\<^bold>[t, u, v\<^bold>]\ = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[Inv t, Inv u, Inv v\<^bold>]\" by simp also have "... = \\<^sup>-\<^sup>1[dom \t\, dom \u\, dom \v\] \ (inv \t\ \ inv \u\ \ inv \v\)" using tuv I1 I2 I3 eval_in_hom \'.map_ide_simp inv_in_hom iso_eval_Can assoc'_naturality Can_implies_Arr Src_Inv Trg_Inv eval_Assoc' Dom_Inv Can_Inv cod_inv by presburger also have "... = inv ((\t\ \ \u\ \ \v\) \ \ (dom \t\, dom \u\, dom \v\))" using tuv iso_eval_Can Can_implies_Arr eval_simps'(2) eval_simps'(3) \_def by (simp add: inv_comp) also have "... = inv (\ (\t\, \u\, \v\))" using tuv Can_implies_Arr \_def by (metis assoc_is_natural_1 arr_eval_Arr eval_simps'(2) eval_simps'(3) fst_conv snd_conv) also have "... = inv \\<^bold>\\<^bold>[t, u, v\<^bold>]\" by simp finally show ?thesis by blast qed show "Can \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] \ \Inv \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ = inv \\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\" proof - assume tuv: "Can \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]" have t: "Can t" using tuv by simp have u: "Can u" using tuv by simp have v: "Can v" using tuv by simp have "\Inv \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ = \\<^bold>\\<^bold>[Inv t, Inv u, Inv v\<^bold>]\" by simp also have "... = (inv \t\ \ inv \u\ \ inv \v\) \ \ (cod \t\, cod \u\, cod \v\)" using \_def tuv I1 I2 I3 iso_eval_Can Can_implies_Arr eval_simps'(2) eval_simps'(3) apply simp using assoc_is_natural_1 arr_inv dom_inv src_inv trg_inv by presburger also have "... = inv (\\<^sup>-\<^sup>1[cod \t\, cod \u\, cod \v\] \ (\t\ \ \u\ \ \v\))" using tuv inv_comp [of "\t\ \ \u\ \ \v\" "\\<^sup>-\<^sup>1[cod \t\, cod \u\, cod \v\]"] Can_implies_Arr iso_assoc \_def by (simp add: eval_simps'(2) eval_simps'(3) iso_eval_Can) also have 1: "... = inv (((\t\ \ \u\) \ \v\) \ \\<^sup>-\<^sup>1[dom \t\, dom \u\, dom \v\])" using tuv assoc'_naturality [of "\t\" "\u\" "\v\"] Can_implies_Arr eval_simps'(2) eval_simps'(3) by simp also have "... = inv \\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\" using tuv 1 Can_implies_Arr eval_Assoc' by auto finally show ?thesis by blast qed qed lemma eval_VcompNml: assumes "Nml t" and "Nml u" and "VSeq t u" shows "\t \<^bold>\\<^bold>\\<^bold>\ u\ = \t\ \ \u\" proof - have "\u. \ Nml t; Nml u; VSeq t u \ \ \t \<^bold>\\<^bold>\\<^bold>\ u\ = \t\ \ \u\" proof (induct t, simp_all add: eval_simps) fix u a assume u: "Nml u" assume 1: "Arr u \ \<^bold>\a\<^bold>\\<^sub>0 = Cod u" show "\u\ = cod \u\ \ \u\" using 1 comp_cod_arr by simp next fix u f assume u: "Nml u" assume f: "C.arr f" assume 1: "Arr u \ \<^bold>\C.dom f\<^bold>\ = Cod u" show "\\<^bold>\f\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ u\ = E f \ \u\" using f u 1 as_nat_trans.preserves_comp_2 by (cases u; simp) next fix u v w assume I1: "\u. \ Nml v; Nml u; Arr u \ Dom v = Cod u \ \ \v \<^bold>\\<^bold>\\<^bold>\ u\ = \v\ \ \u\" assume I2: "\u. \ Nml w; Nml u; Arr u \ Dom w = Cod u \ \ \w \<^bold>\\<^bold>\\<^bold>\ u\ = \w\ \ \u\" assume vw: "Nml (v \<^bold>\ w)" have v: "Nml v \ v = Prim (un_Prim v)" using vw by (simp add: Nml_HcompD) have w: "Nml w" using vw by (simp add: Nml_HcompD) assume u: "Nml u" assume 1: "Arr v \ Arr w \ Src v = Trg w \ Arr u \ Dom v \<^bold>\ Dom w = Cod u" show "\(v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u\ = (\v\ \ \w\) \ \u\" using u 1 HcompNml_in_Hom apply (cases u, simp_all) proof - fix x y assume 3: "u = x \<^bold>\ y" have x: "Nml x" - using u 1 3 Nml_HcompD by simp + using u 1 3 Nml_HcompD by blast have y: "Nml y" - using u x 1 3 Nml_HcompD by simp + using u x 1 3 Nml_HcompD by blast assume 4: "Arr v \ Arr w \ Src v = Trg w \ Dom v = Cod x \ Dom w = Cod y" have "\v \<^bold>\\<^bold>\\<^bold>\ x\ \ \w \<^bold>\\<^bold>\\<^bold>\ y\ = \v \<^bold>\\<^bold>\\<^bold>\ x \<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ y\" using v w x y 4 HcompNml_in_Hom by simp moreover have "... = \v \<^bold>\\<^bold>\\<^bold>\ x\ \ \w \<^bold>\\<^bold>\\<^bold>\ y\" by simp moreover have "... = \v\ \ \x\ \ \w\ \ \y\" using v w x y 4 I1 [of x] I2 [of y] Nml_implies_Arr by simp moreover have "... = (\v\ \ \w\) \ (\x\ \ \y\)" using v w x y 4 Nml_implies_Arr interchange [of "\v\" "\x\" "\w\" "\y\"] by (simp add: eval_simps') ultimately have "\v \<^bold>\\<^bold>\\<^bold>\ x\ \ \w \<^bold>\\<^bold>\\<^bold>\ y\ = (\v\ \ \w\) \ (\x\ \ \y\)" by presburger moreover have "arr \v \<^bold>\\<^bold>\\<^bold>\ x\ \ arr \w \<^bold>\\<^bold>\\<^bold>\ y\" using v w x y 4 VcompNml_in_Hom by simp ultimately show "\v \<^bold>\\<^bold>\\<^bold>\ x\ \ \w \<^bold>\\<^bold>\\<^bold>\ y\ = (\v\ \ \w\) \ (\x\ \ \y\)" by simp qed qed thus ?thesis using assms by blast qed lemma eval_red_Hcomp: assumes "Ide a" and "Ide b" shows "\(a \<^bold>\ b)\<^bold>\\ = \\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\b\<^bold>\\ \ (\a\<^bold>\\ \ \b\<^bold>\\)" proof - have "Nml (a \<^bold>\ b) \ ?thesis" proof - assume 1: "Nml (a \<^bold>\ b)" hence 2: "Nml a \ Nml b \ Src a = Trg b" using Nml_HcompD(3-4,7) by simp have "\(a \<^bold>\ b)\<^bold>\\ = \a\ \ \b\" - using 1 Nml_HcompD by simp + using 1 Nml_HcompD + by (metis eval.simps(3) red_Nml) also have "... = \\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\b\<^bold>\\ \ (\a\<^bold>\\ \ \b\<^bold>\\)" using assms 1 2 ide_eval_Ide Nmlize_in_Hom red2_Nml Nmlize_Nml by (simp add: eval_simps') finally show ?thesis by simp qed moreover have "\ Nml (a \<^bold>\ b) \ ?thesis" using assms Can_red2 by (simp add: Can_red(1) iso_eval_Can) ultimately show ?thesis by blast qed (* TODO: Would the following still be useful if \<^bold>\a\<^bold>\\<^sub>0 is replaced by Src t? *) lemma eval_red2_Nml_Prim\<^sub>0: assumes "Ide t" and "Nml t" and "Src t = \<^bold>\a\<^bold>\\<^sub>0" shows "\t \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0\ = \[\t\]" using assms \_ide_simp apply (cases t) apply simp_all proof - show "C.obj a \ t = \<^bold>\a\<^bold>\\<^sub>0 \ \ (E a) = \[E a]" using unitor_coincidence obj_eval_Obj [of t] \_ide_simp by auto show "\b c. Ide b \ Ide c \ Src b = Trg c \ \ (\b\ \ \c\) = \[\b\ \ \c\]" using \_ide_simp by (simp add: eval_simps' ide_eval_Ide) qed end text \ Most of the time when we interpret the @{locale evaluation_map} locale, we are evaluating terms formed from the arrows in a bicategory as arrows of the bicategory itself. The following locale streamlines that use case. \ locale self_evaluation_map = bicategory begin sublocale bicategorical_language V src trg .. sublocale evaluation_map V src trg V H \ \ src trg \\\. if arr \ then \ else null\ using src.is_extensional trg.is_extensional by (unfold_locales, auto) notation eval ("\_\") notation Nmlize ("\<^bold>\_\<^bold>\") end subsection "Coherence" text \ We define an individual term to be \emph{coherent} if it commutes, up to evaluation, with the reductions of its domain and codomain. We then formulate the coherence theorem as the statement ``every formal arrow is coherent''. Because reductions evaluate to isomorphisms, this implies the standard version of coherence, which says that ``parallel canonical terms have equal evaluations''. \ context evaluation_map begin abbreviation coherent where "coherent t \ \Cod t\<^bold>\\ \ \t\ = \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\" lemma Nml_implies_coherent: assumes "Nml t" shows "coherent t" using assms Nml_implies_Arr Ide_Dom Ide_Cod Nml_Dom Nml_Cod Nmlize_Nml red_Nml by (metis Dom_Cod VcompNml_Cod_Nml arr_eval_Arr comp_arr_dom eval_VcompNml eval_simps(4)) lemma canonical_factorization: assumes "Arr t" shows "coherent t \ \t\ = inv \Cod t\<^bold>\\ \ \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\" proof assume 1: "coherent t" have "inv \Cod t\<^bold>\\ \ \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\ = inv \Cod t\<^bold>\\ \ \Cod t\<^bold>\\ \ \t\" using 1 by simp also have "... = (inv \Cod t\<^bold>\\ \ \Cod t\<^bold>\\) \ \t\" using comp_assoc by simp also have "... = \t\" using assms red_in_Hom Ide_Cod Can_red iso_eval_Can comp_cod_arr by (simp add: comp_inv_arr' eval_simps'(4) eval_simps'(5)) finally show "\t\ = inv \Cod t\<^bold>\\ \ \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\" by presburger next assume 1: "\t\ = inv \Cod t\<^bold>\\ \ \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\" hence "\Cod t\<^bold>\\ \ \t\ = \Cod t\<^bold>\\ \ inv \Cod t\<^bold>\\ \ \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\" by simp also have "... = (\Cod t\<^bold>\\ \ inv \Cod t\<^bold>\\) \ \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\" using comp_assoc by simp also have "... = \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\" proof - have "\Cod t\<^bold>\\ \ inv \Cod t\<^bold>\\ = cod \\<^bold>\t\<^bold>\\" using assms red_in_Hom Ide_Cod Can_red iso_eval_Can inv_is_inverse Nmlize_in_Hom comp_arr_inv by (simp add: eval_simps') thus ?thesis using assms red_in_Hom Ide_Cod Can_red iso_eval_Can Ide_Dom Nmlize_in_Hom comp_cod_arr by (auto simp add: eval_simps') qed finally show "coherent t" by blast qed lemma coherent_iff_coherent_Inv: assumes "Can t" shows "coherent t \ coherent (Inv t)" proof have 1: "\t. Can t \ coherent t \ coherent (Inv t)" proof - fix t assume "Can t" hence t: "Can t \ Arr t \ Ide (Dom t) \ Ide (Cod t) \ arr \t\ \ iso \t\ \ inverse_arrows \t\ (inv \t\) \ Can \<^bold>\t\<^bold>\ \ Arr \<^bold>\t\<^bold>\ \ arr \\<^bold>\t\<^bold>\\ \ iso \\<^bold>\t\<^bold>\\ \ \<^bold>\t\<^bold>\ \ VHom \<^bold>\Dom t\<^bold>\ \<^bold>\Cod t\<^bold>\ \ inverse_arrows \\<^bold>\t\<^bold>\\ (inv \\<^bold>\t\<^bold>\\) \ Inv t \ VHom (Cod t) (Dom t)" using assms Can_implies_Arr Ide_Dom Ide_Cod iso_eval_Can inv_is_inverse Nmlize_in_Hom Can_Nmlize_Can Inv_in_Hom by simp assume coh: "coherent t" have "\Cod (Inv t)\<^bold>\\ \ \Inv t\ = (inv \\<^bold>\t\<^bold>\\ \ \\<^bold>\t\<^bold>\\) \ \Cod (Inv t)\<^bold>\\ \ \Inv t\" using t comp_inv_arr red_in_Hom comp_cod_arr [of "\Cod (Inv t)\<^bold>\\ \ \Inv t\" "inv \\<^bold>\t\<^bold>\\ \ \\<^bold>\t\<^bold>\\"] by (auto simp add: eval_simps') also have "... = inv \\<^bold>\t\<^bold>\\ \ \\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\ \ inv \t\" using t eval_Inv_Can comp_assoc by auto also have "... = inv \\<^bold>\t\<^bold>\\ \ (\\<^bold>\t\<^bold>\\ \ \Dom t\<^bold>\\) \ inv \t\" using comp_assoc by simp also have "... = inv \\<^bold>\t\<^bold>\\ \ (\Cod t\<^bold>\\ \ \t\) \ inv \t\" using t coh by simp also have "... = inv \\<^bold>\t\<^bold>\\ \ \Cod t\<^bold>\\ \ \t\ \ inv \t\" using comp_assoc by simp also have "... = \\<^bold>\Inv t\<^bold>\\ \ \Dom (Inv t)\<^bold>\\" proof - have "\Cod t\<^bold>\\ \ \t\ \ inv \t\ = \Dom (Inv t)\<^bold>\\" using t eval_Inv_Can red_in_Hom comp_arr_inv comp_arr_dom by (simp add: eval_simps') thus ?thesis using t Nmlize_Inv eval_Inv_Can by simp qed finally show "coherent (Inv t)" by blast qed show "coherent t \ coherent (Inv t)" using assms 1 by simp show "coherent (Inv t) \ coherent t" proof - assume "coherent (Inv t)" hence "coherent (Inv (Inv t))" using assms 1 Can_Inv by blast thus ?thesis using assms by simp qed qed text \ The next two facts are trivially proved by the simplifier, so formal named facts are not really necessary, but we include them for logical completeness of the following development, which proves coherence by structural induction. \ lemma coherent_Prim\<^sub>0: assumes "C.obj a" shows "coherent \<^bold>\a\<^bold>\\<^sub>0" by simp lemma coherent_Prim: assumes "Arr \<^bold>\f\<^bold>\" shows "coherent \<^bold>\f\<^bold>\" using assms by simp lemma coherent_Lunit_Ide: assumes "Ide t" shows "coherent \<^bold>\\<^bold>[t\<^bold>]" proof - have t: "Ide t \ Arr t \ Dom t = t \ Cod t = t \ ide \t\ \ ide \\<^bold>\t\<^bold>\\ \ \t\<^bold>\\ \ hom \t\ \\<^bold>\t\<^bold>\\" using assms Ide_in_Hom Ide_Nmlize_Ide red_in_Hom eval_in_hom ide_eval_Ide by force have 1: "Obj (Trg t)" using t by auto have "\Cod \<^bold>\\<^bold>[t\<^bold>]\<^bold>\\ \ \\<^bold>\\<^bold>[t\<^bold>]\ = \[\\<^bold>\t\<^bold>\\] \ (\Trg t\ \ \t\<^bold>\\)" using t \_ide_simp lunit_naturality [of "\t\<^bold>\\"] red_in_Hom by (simp add: eval_simps') also have "... = \\<^bold>\t\<^bold>\\ \ \[\\<^bold>\t\<^bold>\\] \ (\Trg t\ \ \t\<^bold>\\)" using t 1 lunit_in_hom Nmlize_in_Hom ide_eval_Ide red_in_Hom comp_cod_arr Obj_implies_Ide by (auto simp add: eval_simps') also have "... = \\<^bold>\\<^bold>\\<^bold>[t\<^bold>]\<^bold>\\ \ \Dom \<^bold>\\<^bold>[t\<^bold>]\<^bold>\\" using 1 t Nml_Trg \_ide_simp by (cases "Trg t"; simp) finally show ?thesis by simp qed text \ Unlike many of the other results, the next one was not quite so straightforward to adapt from @{session \MonoidalCategory\}. \ lemma coherent_Runit_Ide: assumes "Ide t" shows "coherent \<^bold>\\<^bold>[t\<^bold>]" proof - have t: "Ide t \ Arr t \ Dom t = t \ Cod t = t \ ide \t\ \ ide \\<^bold>\t\<^bold>\\ \ \t\<^bold>\\ \ hom \t\ \\<^bold>\t\<^bold>\\" using assms Ide_in_Hom Ide_Nmlize_Ide red_in_Hom eval_in_hom ide_eval_Ide by force have "\Cod \<^bold>\\<^bold>[t\<^bold>]\<^bold>\\ \ \\<^bold>\\<^bold>[t\<^bold>]\ = \[\\<^bold>\t\<^bold>\\] \ (\t\<^bold>\\ \ \Src t\)" using t \_ide_simp red_in_Hom runit_naturality [of "\t\<^bold>\\"] by (simp add: eval_simps') also have "... = \\<^bold>\\<^bold>\\<^bold>[t\<^bold>]\<^bold>\\ \ \Dom \<^bold>\\<^bold>[t\<^bold>]\<^bold>\\" proof - have "\\<^bold>\\<^bold>\\<^bold>[t\<^bold>]\<^bold>\\ \ \Dom \<^bold>\\<^bold>[t\<^bold>]\<^bold>\\ = \\<^bold>\t\<^bold>\\ \ \\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\Src t\<^bold>\\ \ (\t\<^bold>\\ \ \Src t\<^bold>\\)" using t by (cases t; simp; cases "Src t"; simp) also have "... = (\\<^bold>\t\<^bold>\\ \ \\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\Src t\<^bold>\\) \ (\t\<^bold>\\ \ \Src t\<^bold>\\)" proof - have "\\<^bold>\t\<^bold>\\ \ hom \\<^bold>\t\<^bold>\\ \\<^bold>\t\<^bold>\\" using t Nmlize_in_Hom by auto moreover have "\\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\Src t\<^bold>\\ \ hom (\\<^bold>\t\<^bold>\\ \ \Src t\) \\<^bold>\t\<^bold>\\" proof - have "\\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\Src t\<^bold>\\ \ hom \\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\Src t\<^bold>\\ \\<^bold>\t\<^bold>\\" proof - have "Src \<^bold>\t\<^bold>\ = Trg \<^bold>\Src t\<^bold>\ \ \<^bold>\\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\Src t\<^bold>\\<^bold>\ = \<^bold>\t\<^bold>\" using t Nmlize_Src Nml_Nmlize HcompNml_Nml_Src [of "\<^bold>\t\<^bold>\"] by simp thus ?thesis using t Ide_Nmlize_Ide Nml_Nmlize Obj_Src red2_in_Hom(2) Obj_implies_Ide by (auto simp add: eval_simps') qed thus ?thesis using t Nmlize_in_Hom Nmlize_Src by simp qed moreover have "\t\<^bold>\\ \ \Src t\<^bold>\\ \ hom (\t\ \ \Src t\) (\\<^bold>\t\<^bold>\\ \ \Src t\)" using t red_in_Hom red_Src Obj_Src eval_simps' Obj_implies_Ide by auto ultimately show ?thesis using comp_assoc by fastforce qed also have "... = \[\\<^bold>\t\<^bold>\\] \ (\t\<^bold>\\ \ \Src t\<^bold>\\)" proof - have "\\<^bold>\t\<^bold>\ \<^bold>\ \<^bold>\Src t\<^bold>\\ = \[\\<^bold>\t\<^bold>\\]" proof - have "Nml \<^bold>\t\<^bold>\" using t Nml_Nmlize by blast moreover have "is_Prim\<^sub>0 \<^bold>\Src t\<^bold>\" using t is_Prim0_Src Nmlize_Src by presburger ultimately show ?thesis apply (cases "\<^bold>\t\<^bold>\"; simp; cases "\<^bold>\Src t\<^bold>\"; simp) using t unitor_coincidence \_ide_simp \_ide_simp Nmlize_in_Hom apply simp_all using t is_Prim0_Src apply (cases "\<^bold>\t\<^bold>\"; simp) using t Nmlize_Src unitor_coincidence preserves_obj by simp qed moreover have "\[\\<^bold>\t\<^bold>\\] \ hom (\\<^bold>\t\<^bold>\\ \ \Src t\) \\<^bold>\t\<^bold>\\" using t Nmlize_in_Hom by (auto simp add: eval_simps'(2)) ultimately show ?thesis using comp_cod_arr [of "\[\\<^bold>\t\<^bold>\\]"] by fastforce qed also have "... = \[\\<^bold>\t\<^bold>\\] \ (\t\<^bold>\\ \ \Src t\)" using t red_Src by auto finally show ?thesis by argo qed finally show ?thesis by blast qed lemma coherent_Lunit'_Ide: assumes "Ide a" shows "coherent \<^bold>\\<^sup>-\<^sup>1\<^bold>[a\<^bold>]" using assms Ide_implies_Can coherent_Lunit_Ide coherent_iff_coherent_Inv [of "Lunit a"] by simp lemma coherent_Runit'_Ide: assumes "Ide a" shows "coherent \<^bold>\\<^sup>-\<^sup>1\<^bold>[a\<^bold>]" using assms Ide_implies_Can coherent_Runit_Ide coherent_iff_coherent_Inv [of "Runit a"] by simp lemma red2_Nml_Src: assumes "Ide t" and "Nml t" shows "\t \<^bold>\ Src t\ = \[\t\]" using assms eval_red2_Nml_Prim\<^sub>0 is_Prim0_Src [of t] by (cases "Src t"; simp) lemma red2_Trg_Nml: assumes "Ide t" and "Nml t" shows "\Trg t \<^bold>\ t\ = \[\t\]" using assms is_Prim0_Trg [of t] \_ide_simp ide_eval_Ide by (cases "Trg t"; simp) lemma coherence_key_fact: assumes "Ide a \ Nml a" and "Ide b \ Nml b" and "Ide c \ Nml c" and "Src a = Trg b" and "Src b = Trg c" shows "\(a \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\ \ (\a \<^bold>\ b\ \ \c\) = (\a \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ (\a\ \ \b \<^bold>\ c\)) \ \[\a\, \b\, \c\]" proof - have "is_Prim\<^sub>0 b \ ?thesis" proof - assume b: "is_Prim\<^sub>0 b" have "\a \<^bold>\ c\ \ (\[\a\] \ \c\) = (\a \<^bold>\ c\ \ (\a\ \ \[\c\])) \ \[\a\, \Trg c\, \c\]" proof - have "Src b = Trg b" using b by (cases b; simp) thus ?thesis using assms triangle [of "\c\" "\a\"] ide_eval_Ide comp_assoc by (simp add: eval_simps') qed thus ?thesis using assms b HcompNml_Nml_Src [of a] HcompNml_Trg_Nml red2_Nml_Src [of a] red2_Trg_Nml by (cases b, simp_all) qed moreover have "\ \ is_Prim\<^sub>0 b; is_Prim\<^sub>0 c \ \ ?thesis" proof - assume b: "\ is_Prim\<^sub>0 b" assume c: "is_Prim\<^sub>0 c" have "\(a \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\ \ (\a \<^bold>\ b\ \ \c\) = \(a \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ Src b\ \ (\a \<^bold>\ b\ \ src \b\)" using assms b c by (cases c, simp_all add: eval_simps') also have "... = \[\a \<^bold>\\<^bold>\\<^bold>\ b\] \ (\a \<^bold>\ b\ \ src \b\)" using assms red2_Nml_Src [of "a \<^bold>\\<^bold>\\<^bold>\ b"] Nml_HcompNml(1) Src_HcompNml Ide_HcompNml by simp also have "... = \a \<^bold>\ b\ \ \[\a\ \ \b\]" proof - have "\\a \<^bold>\ b\ : \a\ \ \b\ \ \a \<^bold>\\<^bold>\\<^bold>\ b\\" using assms red2_in_Hom eval_in_hom [of "a \<^bold>\ b"] by simp thus ?thesis using assms runit_naturality [of "\a \<^bold>\ b\"] arr_dom in_homE src_dom src_hcomp hcomp_simps(1) by (elim in_homE, metis) qed also have "... = (\a \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ (\a\ \ \b \<^bold>\ c\)) \ \[\a\, \b\, \c\]" proof - have "(\a \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ (\a\ \ \b \<^bold>\ c\)) \ \[\a\, \b\, \c\] = (\a \<^bold>\ b\ \ (\a\ \ \[\b\])) \ \[\a\, \b\, src \b\]" using assms c red2_Nml_Src [of b] by (cases c, simp_all add: eval_simps') thus ?thesis using assms runit_hcomp ide_eval_Ide comp_assoc by (simp add: eval_simps') qed finally show ?thesis by blast qed moreover have "\ \ is_Prim\<^sub>0 b; \ is_Prim\<^sub>0 c \ \ ?thesis" proof - assume b': "\ is_Prim\<^sub>0 b" hence b: "Ide b \ Nml b \ Arr b \ \ is_Prim\<^sub>0 b \ ide \b\ \ arr \b\ \ \<^bold>\b\<^bold>\ = b \ b\<^bold>\ = b \ Dom b = b \ Cod b = b" using assms Ide_Nmlize_Ide Ide_in_Hom ide_eval_Ide by simp assume c': "\ is_Prim\<^sub>0 c" hence c: "Ide c \ Nml c \ Arr c \ \ is_Prim\<^sub>0 c \ ide \c\ \ arr \c\ \ \<^bold>\c\<^bold>\ = c \ c\<^bold>\ = c \ Dom c = c \ Cod c = c" using assms Ide_Nmlize_Ide Ide_in_Hom ide_eval_Ide by simp have "\a. Ide a \ Nml a \ Src a = Trg b \ \(a \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\ \ (\a \<^bold>\ b\ \ \c\) = (\a \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ (\a\ \ \b \<^bold>\ c\)) \ \[\a\, \b\, \c\]" proof - fix a :: "'c term" show "Ide a \ Nml a \ Src a = Trg b \ \(a \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\ \ (\a \<^bold>\ b\ \ \c\) = (\a \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ (\a\ \ \b \<^bold>\ c\)) \ \[\a\, \b\, \c\]" apply (induct a) using b c HcompNml_in_Hom apply (simp_all add: HcompNml_Nml_Src HcompNml_Trg_Nml) proof - fix f assume f: "C.ide f \ C.arr f \ \<^bold>\src\<^sub>C f\<^bold>\\<^sub>0 = Trg b" show "\(\<^bold>\f\<^bold>\ \<^bold>\ b) \<^bold>\ c\ \ (\\<^bold>\f\<^bold>\ \<^bold>\ b\ \ \c\) = (\\<^bold>\f\<^bold>\ \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\ \ (E f \ \b \<^bold>\ c\)) \ \[E f, \b\, \c\]" proof - have "\(\<^bold>\f\<^bold>\ \<^bold>\ b) \<^bold>\ c\ \ (\\<^bold>\f\<^bold>\ \<^bold>\ b\ \ \c\) = ((E f \ \b \<^bold>\\<^bold>\\<^bold>\ c\) \ (E f \ \b \<^bold>\ c\) \ \[E f, \b\, \c\]) \ ((E f \ \b\) \ \c\)" proof - have "((E f \ \b \<^bold>\\<^bold>\\<^bold>\ c\) \ (E f \ \b \<^bold>\ c\) \ \[E f, \b\, \c\]) \ ((E f \ \b\) \ \c\) = ((E f \ \b \<^bold>\\<^bold>\\<^bold>\ c\) \ (E f \ \b \<^bold>\ c\) \ \[E f, \b\, \c\]) \ (\\<^bold>\f\<^bold>\ \<^bold>\ b\ \ \c\)" using f b red2_Nml by simp also have "... = (\\<^bold>\f\<^bold>\ \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\ \ (E f \ \b \<^bold>\ c\) \ \[E f, \b\, \c\]) \ (\\<^bold>\f\<^bold>\ \<^bold>\ b\ \ \c\)" proof - have "\\<^bold>\f\<^bold>\ \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\ = E f \ \b \<^bold>\\<^bold>\\<^bold>\ c\" using assms(5) b c is_Hcomp_HcompNml red2_Nml Nml_HcompNml(1) is_Hcomp_def by (metis eval.simps(2) eval.simps(3) red2.simps(4)) thus ?thesis by argo qed also have "... = \(\<^bold>\f\<^bold>\ \<^bold>\ b) \<^bold>\ c\ \ (\\<^bold>\f\<^bold>\ \<^bold>\ b\ \ \c\)" using b c \_def by (cases c, simp_all) finally show ?thesis by argo qed also have "... = ((E f \ \b \<^bold>\\<^bold>\\<^bold>\ c\) \ (E f \ \b \<^bold>\ c\)) \ \[E f, \b\, \c\]" proof - have "src (E f) = trg \b\" using b f preserves_src by (cases "Trg b", auto simp add: eval_simps') thus ?thesis using assms b c f comp_arr_dom comp_assoc by (auto simp add: eval_simps') qed also have "... = (\\<^bold>\f\<^bold>\ \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ (E f \ \b \<^bold>\ c\)) \ \[E f, \b\, \c\]" using assms f b c Ide_HcompNml Nml_HcompNml is_Hcomp_HcompNml [of b c] \_def by (cases "b \<^bold>\\<^bold>\\<^bold>\ c") simp_all finally show ?thesis by blast qed next fix x assume x: "C.obj x \ \<^bold>\x\<^bold>\\<^sub>0 = Trg b" show "\b \<^bold>\ c\ \ (\Trg b \<^bold>\ b\ \ \c\) = (\Trg b \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\ \ (\Trg b\ \ \b \<^bold>\ c\)) \ \[\Trg b\, \b\, \c\]" proof - have 1: "Trg (b \<^bold>\\<^bold>\\<^bold>\ c) = Trg b" using assms b c Trg_HcompNml by blast have 2: "\Trg b \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\ = \[\b \<^bold>\\<^bold>\\<^bold>\ c\]" using assms b c 1 Nml_HcompNml red2_Trg_Nml [of "b \<^bold>\\<^bold>\\<^bold>\ c"] Ide_HcompNml by simp have "\b \<^bold>\ c\ \ (\Trg b \<^bold>\ b\ \ \c\) = \b \<^bold>\ c\ \ (\[\b\] \ \c\)" using b c 1 2 HcompNml_Trg_Nml red2_Trg_Nml Trg_HcompNml by simp also have "... = \b \<^bold>\ c\ \ \[\b\ \ \c\] \ \[\Trg b\, \b\, \c\]" using assms b c lunit_hcomp [of "\b\" "\c\"] by (metis (no_types, lifting) eval_simps'(3) eval_simps(2)) also have "... = (\b \<^bold>\ c\ \ \[\b\ \ \c\]) \ \[\Trg b\, \b\, \c\]" using comp_assoc by simp also have "... = (\[\b \<^bold>\\<^bold>\\<^bold>\ c\] \ (\Trg b\ \ \b \<^bold>\ c\)) \ \[\Trg b\, \b\, \c\]" using assms b c lunit_naturality [of "\b \<^bold>\ c\"] red2_in_Hom by (simp add: eval_simps') also have "... = (\Trg b \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\ \ (\Trg b\ \ \b \<^bold>\ c\)) \ \[\Trg b\, \b\, \c\]" using b c 1 2 HcompNml_Trg_Nml red2_Trg_Nml Trg_HcompNml comp_assoc by simp finally show ?thesis by blast qed next fix d e assume I: "Nml e \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\ \ (\e \<^bold>\ b\ \ \c\) = (\e \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\ \ (\e\ \ \b \<^bold>\ c\)) \ \[\e\, \b\, \c\]" assume de: "Ide d \ Ide e \ Src d = Trg e \ Nml (d \<^bold>\ e) \ Src e = Trg b" show "\((d \<^bold>\ e) \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\ \ (\(d \<^bold>\ e) \<^bold>\ b\ \ \c\) = (\(d \<^bold>\ e) \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ ((\d\ \ \e\) \ \b \<^bold>\ c\)) \ \[\d\ \ \e\, \b\, \c\]" proof - let ?f = "un_Prim d" have "is_Prim d" using de Nml_HcompD by (metis term.disc(12)) hence "d = \<^bold>\?f\<^bold>\ \ C.ide ?f" using de by (cases d; simp) hence d: "Ide d \ Arr d \ Dom d = d \ Cod d = d \ Nml d \ d = \<^bold>\?f\<^bold>\ \ C.ide ?f \ ide \d\ \ arr \d\" using de ide_eval_Ide Nml_Nmlize(1) Ide_in_Hom Nml_HcompD [of d e] by simp have "Nml e \ \ is_Prim\<^sub>0 e" using de Nml_HcompD by metis hence e: "Ide e \ Arr e \ Dom e = e \ Cod e = e \ Nml e \ \ is_Prim\<^sub>0 e \ ide \e\ \ arr \e\" using de Ide_in_Hom ide_eval_Ide by simp have 1: "is_Hcomp (e \<^bold>\\<^bold>\\<^bold>\ b) \ is_Hcomp (b \<^bold>\\<^bold>\\<^bold>\ c) \ is_Hcomp (e \<^bold>\\<^bold>\\<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c)" using assms b c e de is_Hcomp_HcompNml [of e b] Nml_HcompNml is_Hcomp_HcompNml [of b c] is_Hcomp_HcompNml [of e "b \<^bold>\\<^bold>\\<^bold>\ c"] by auto have eb: "Src e = Trg b" using assms b c e de by argo have bc: "Src b = Trg c" using assms b c by simp have 4: "is_Hcomp ((e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c)" using assms b c e eb de 1 is_Hcomp_HcompNml [of e b] is_Hcomp_HcompNml [of "e \<^bold>\\<^bold>\\<^bold>\ b" c] is_Hcomp_HcompNml [of e b] Nml_HcompNml(1) [of e b] Src_HcompNml by auto have "\((d \<^bold>\ e) \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\ \ (\(d \<^bold>\ e) \<^bold>\ b\ \ \c\) = ((\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c\) \ (\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\) \ \[\d\, \e \<^bold>\\<^bold>\\<^bold>\ b\, \c\]) \ ((\d\ \ \e \<^bold>\\<^bold>\\<^bold>\ b\) \ (\d\ \ \e \<^bold>\ b\) \ \[\d\, \e\, \b\] \ \c\)" proof - have "\((d \<^bold>\ e) \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\ = (\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c\) \ (\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\) \ \[\d\, \e \<^bold>\\<^bold>\\<^bold>\ b\, \c\]" proof - have "((d \<^bold>\ e) \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c = (d \<^bold>\ (e \<^bold>\\<^bold>\\<^bold>\ b)) \<^bold>\ c" using b c d e de 1 HcompNml_Nml Nml_HcompNml HcompNml_assoc HcompNml_Prim by (metis term.distinct_disc(4)) also have "... = (d \<^bold>\ ((e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c)) \<^bold>\ (d \<^bold>\ ((e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c)) \<^bold>\ \<^bold>\\<^bold>[d, e \<^bold>\\<^bold>\\<^bold>\ b, c\<^bold>]" using b c d e de 1 Nml_HcompNml Nmlize_Nml by (cases c) simp_all also have "... = (d \<^bold>\ ((e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c)) \<^bold>\ (d \<^bold>\ ((e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c)) \<^bold>\ \<^bold>\\<^bold>[d, e \<^bold>\\<^bold>\\<^bold>\ b, c\<^bold>]" using d 4 apply (cases d, simp_all) by (cases "(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c") simp_all finally show ?thesis using b c d e HcompNml_in_Hom red2_in_Hom Nml_HcompNml Ide_HcompNml \_def by simp qed moreover have "\(d \<^bold>\ e) \<^bold>\ b\ = (\d\ \ \e \<^bold>\\<^bold>\\<^bold>\ b\) \ (\d\ \ \e \<^bold>\ b\) \ \[\d\, \e\, \b\]" proof - have "(d \<^bold>\ e) \<^bold>\ b = (d \<^bold>\ (e \<^bold>\\<^bold>\\<^bold>\ b)) \<^bold>\ (d \<^bold>\ (e \<^bold>\ b)) \<^bold>\ \<^bold>\\<^bold>[d, e, b\<^bold>]" using b c d e de 1 HcompNml_Prim Nmlize_Nml by (cases b, simp_all) also have "... = (d \<^bold>\ (e \<^bold>\\<^bold>\\<^bold>\ b)) \<^bold>\ (d \<^bold>\ (e \<^bold>\ b)) \<^bold>\ \<^bold>\\<^bold>[d, e, b\<^bold>]" using b c d e de 1 HcompNml_Nml Nml_HcompNml apply (cases d, simp_all) by (cases "e \<^bold>\\<^bold>\\<^bold>\ b", simp_all) finally show ?thesis using b d e HcompNml_in_Hom red2_in_Hom \_def by simp qed ultimately show ?thesis by argo qed also have "... = ((\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\) \ \[\d\, \e \<^bold>\\<^bold>\\<^bold>\ b\, \c\]) \ ((\d\ \ \e \<^bold>\ b\) \ \c\) \ (\[\d\, \e\, \b\] \ \c\)" proof - have "(\d\ \ \e \<^bold>\\<^bold>\\<^bold>\ b\) \ (\d\ \ \e \<^bold>\ b\) \ \[\d\, \e\, \b\] \ \c\ = ((\d\ \ \e \<^bold>\ b\) \ \c\) \ (\[\d\, \e\, \b\] \ \c\)" using assms b c d e de eb HcompNml_in_Hom red2_in_Hom comp_cod_arr Ide_HcompNml Nml_HcompNml comp_assoc interchange [of "\d\ \ \e \<^bold>\ b\" "\[\d\, \e\, \b\]" "\c\" "\c\"] by (auto simp add: eval_simps') moreover have "(\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c\) \ (\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\) \ \[\d\, \e \<^bold>\\<^bold>\\<^bold>\ b\, \c\] = (\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\) \ \[\d\, \e \<^bold>\\<^bold>\\<^bold>\ b\, \c\]" proof - have "(\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c\) \ (\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\) \ \[\d\, \e \<^bold>\\<^bold>\\<^bold>\ b\, \c\] = ((\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\\<^bold>\\<^bold>\ c\) \ (\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\)) \ \[\d\, \e \<^bold>\\<^bold>\\<^bold>\ b\, \c\]" using comp_assoc by simp thus ?thesis using assms b c d e de eb HcompNml_in_Hom red2_in_Hom Ide_HcompNml Nml_HcompNml comp_cod_arr by (simp add: eval_simps') qed ultimately show ?thesis by argo qed also have "... = (\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\) \ (\d\ \ (\e \<^bold>\ b\ \ \c\)) \ \[\d\, \e\ \ \b\, \c\] \ (\[\d\, \e\, \b\] \ \c\)" using assms b c d e de HcompNml_in_Hom red2_in_Hom Ide_HcompNml Nml_HcompNml ide_eval_Ide assoc_naturality [of "\d\" "\e \<^bold>\ b\" "\c\"] comp_permute [of "\[\d\, \e \<^bold>\\<^bold>\\<^bold>\ b\, \c\]" "(\d\ \ \e \<^bold>\ b\) \ \c\" "\d\ \ (\e \<^bold>\ b\ \ \c\)" "\[\d\, \e\ \ \b\, \c\]"] comp_assoc by (simp add: eval_simps') also have "... = ((\d\ \ \(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\) \ (\d\ \ (\e \<^bold>\ b\ \ \c\))) \ \[\d\, \e\ \ \b\, \c\] \ (\[\d\, \e\, \b\] \ \c\)" using comp_assoc by simp also have "... = (((\d\ \ \e \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\) \ (\d\ \ \e\ \ \b \<^bold>\ c\)) \ (\d\ \ \[\e\, \b\, \c\])) \ \[\d\, \e\ \ \b\, \c\] \ (\[\d\, \e\, \b\] \ \c\)" using assms b c d e de eb I HcompNml_in_Hom red2_in_Hom Ide_HcompNml Nml_HcompNml whisker_left [of "\d\"] interchange [of "\d\" "\d\" "\(e \<^bold>\\<^bold>\\<^bold>\ b) \<^bold>\ c\" "\e \<^bold>\ b\ \ \c\"] by (auto simp add: eval_simps') also have "... = ((\d\ \ \e \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\) \ (\d\ \ \e\ \ \b \<^bold>\ c\)) \ ((\d\ \ \[\e\, \b\, \c\]) \ \[\d\, \e\ \ \b\, \c\] \ (\[\d\, \e\, \b\] \ \c\))" using comp_assoc by simp also have "... = ((\d\ \ \e \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\) \ (\d\ \ (\e\ \ \b \<^bold>\ c\))) \ \[\d\, \e\, \b\ \ \c\] \ \[\d\ \ \e\, \b\, \c\]" using assms b c d e de pentagon by (simp add: eval_simps') also have "... = (\d\ \ \e \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\) \ ((\d\ \ (\e\ \ \b \<^bold>\ c\)) \ \[\d\, \e\, \b\ \ \c\]) \ \[\d\ \ \e\, \b\, \c\]" using comp_assoc by simp also have "... = ((\d\ \ \e \<^bold>\\<^bold>\\<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\) \ (\d\ \ \e \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\)) \ (\[\d\, \e\, \b \<^bold>\\<^bold>\\<^bold>\ c\] \ ((\d\ \ \e\) \ \b \<^bold>\ c\)) \ \[\d\ \ \e\, \b\, \c\]" using assms d e de HcompNml_in_Hom red2_in_Hom Ide_HcompNml Nml_HcompNml assoc_naturality [of "\d\" "\e\" "\b \<^bold>\ c\"] comp_cod_arr [of "\d\ \ \e \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\"] by (simp add: eval_simps') also have "... = ((\d\ \ \e \<^bold>\\<^bold>\\<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\) \ (\d\ \ \e \<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c\) \ \[\d\, \e\, \b \<^bold>\\<^bold>\\<^bold>\ c\]) \ ((\d\ \ \e\) \ \b \<^bold>\ c\) \ \[\d\ \ \e\, \b\, \c\]" using comp_assoc by simp also have "... = \(d \<^bold>\ e) \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ ((\d\ \ \e\) \ \b \<^bold>\ c\) \ \[\d\ \ \e\, \b\, \c\]" proof - have "\(d \<^bold>\ e) \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ = (\d\ \ \e \<^bold>\\<^bold>\\<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\) \ (\d\ \ \e \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\) \ \[\d\, \e\, \b \<^bold>\\<^bold>\\<^bold>\ c\]" proof - have "(d \<^bold>\ e) \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c) = (d \<^bold>\ (e \<^bold>\\<^bold>\\<^bold>\ \<^bold>\b \<^bold>\\<^bold>\\<^bold>\ c\<^bold>\)) \<^bold>\ (d \<^bold>\ (e \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c))) \<^bold>\ \<^bold>\\<^bold>[d, e, b \<^bold>\\<^bold>\\<^bold>\ c\<^bold>]" using e 1 by (cases "b \<^bold>\\<^bold>\\<^bold>\ c") auto also have "... = (d \<^bold>\ (e \<^bold>\\<^bold>\\<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c))) \<^bold>\ (d \<^bold>\ (e \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c))) \<^bold>\ \<^bold>\\<^bold>[d, e, b \<^bold>\\<^bold>\\<^bold>\ c\<^bold>]" using assms Nml_HcompNml Nmlize_Nml by simp also have "... = (d \<^bold>\ (e \<^bold>\\<^bold>\\<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c))) \<^bold>\ (d \<^bold>\ (e \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c))) \<^bold>\ \<^bold>\\<^bold>[d, e, b \<^bold>\\<^bold>\\<^bold>\ c\<^bold>]" using d 1 apply (cases "e \<^bold>\\<^bold>\\<^bold>\ b \<^bold>\\<^bold>\\<^bold>\ c", simp_all) by (cases d, simp_all) finally show ?thesis using \_def by simp qed thus ?thesis by simp qed also have "... = (\(d \<^bold>\ e) \<^bold>\ (b \<^bold>\\<^bold>\\<^bold>\ c)\ \ ((\d\ \ \e\) \ \b \<^bold>\ c\)) \ \[\d\ \ \e\, \b\, \c\]" using comp_assoc by simp finally show ?thesis by auto qed qed qed thus ?thesis using assms(1,4) by blast qed ultimately show ?thesis by blast qed lemma coherent_Assoc_Ide: assumes "Ide a" and "Ide b" and "Ide c" and "Src a = Trg b" and "Src b = Trg c" shows "coherent \<^bold>\\<^bold>[a, b, c\<^bold>]" proof - have a: "Ide a \ Arr a \ Dom a = a \ Cod a = a \ ide \a\ \ ide \\<^bold>\a\<^bold>\\ \ \a\<^bold>\\ \ hom \a\ \\<^bold>\a\<^bold>\\" using assms Ide_in_Hom Ide_Nmlize_Ide ide_eval_Ide red_in_Hom eval_in_hom(2) by force have b: "Ide b \ Arr b \ Dom b = b \ Cod b = b \ ide \b\ \ ide \\<^bold>\b\<^bold>\\ \ \b\<^bold>\\ \ hom \b\ \\<^bold>\b\<^bold>\\" using assms Ide_in_Hom Ide_Nmlize_Ide ide_eval_Ide red_in_Hom(2) eval_in_hom(2) [of "b\<^bold>\"] by auto have c: "Ide c \ Arr c \ Dom c = c \ Cod c = c \ ide \c\ \ ide \\<^bold>\c\<^bold>\\ \ \c\<^bold>\\ \ hom \c\ \\<^bold>\c\<^bold>\\" using assms Ide_in_Hom Ide_Nmlize_Ide red_in_Hom eval_in_hom(2) [of "c\<^bold>\"] ide_eval_Ide by auto have "\Cod \<^bold>\\<^bold>[a, b, c\<^bold>]\<^bold>\\ \ \\<^bold>\\<^bold>[a, b, c\<^bold>]\ = (\\<^bold>\a\<^bold>\ \<^bold>\ (\<^bold>\b\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\c\<^bold>\)\ \ (\\<^bold>\a\<^bold>\\ \ \\<^bold>\b\<^bold>\ \<^bold>\ \<^bold>\c\<^bold>\\) \ (\a\<^bold>\\ \ \b\<^bold>\\ \ \c\<^bold>\\)) \ \[\a\, \b\, \c\]" using assms a b c red_in_Hom red2_in_Hom Nml_Nmlize Ide_Nmlize_Ide \_def eval_red_Hcomp interchange [of "\\<^bold>\a\<^bold>\\" "\a\<^bold>\\"] comp_cod_arr [of "\a\<^bold>\\"] by (simp add: eval_simps') also have "... = ((\\<^bold>\a\<^bold>\ \<^bold>\ (\<^bold>\b\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\c\<^bold>\)\ \ (\\<^bold>\a\<^bold>\\ \ \\<^bold>\b\<^bold>\ \<^bold>\ \<^bold>\c\<^bold>\\)) \ \[\\<^bold>\a\<^bold>\\, \\<^bold>\b\<^bold>\\, \\<^bold>\c\<^bold>\\]) \ ((\a\<^bold>\\ \ \b\<^bold>\\) \ \c\<^bold>\\)" using assms red_in_Hom Ide_HcompNml assoc_naturality [of "\a\<^bold>\\" "\b\<^bold>\\" "\c\<^bold>\\"] comp_assoc by (simp add: eval_simps') also have "... = (\(\<^bold>\a\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\b\<^bold>\) \<^bold>\ \<^bold>\c\<^bold>\\ \ (\\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\b\<^bold>\\ \ \\<^bold>\c\<^bold>\\)) \ ((\a\<^bold>\\ \ \b\<^bold>\\) \ \c\<^bold>\\)" using assms Nml_Nmlize Ide_Nmlize_Ide coherence_key_fact by simp also have "... = \\<^bold>\\<^bold>\\<^bold>[a, b, c\<^bold>]\<^bold>\\ \ \Dom \<^bold>\\<^bold>[a, b, c\<^bold>]\<^bold>\\" using assms a b c red_in_Hom red2_in_Hom Ide_Nmlize_Ide Nml_Nmlize eval_red_Hcomp HcompNml_assoc interchange [of "\\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\b\<^bold>\\" "\a\<^bold>\\ \ \b\<^bold>\\" "\\<^bold>\c\<^bold>\\" "\c\<^bold>\\"] comp_cod_arr [of "\c\<^bold>\\" "\\<^bold>\c\<^bold>\\"] apply (simp add: eval_simps') proof - have "seq \(\<^bold>\a\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\b\<^bold>\) \<^bold>\ \<^bold>\c\<^bold>\\ ((\\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\b\<^bold>\\ \ \\<^bold>\c\<^bold>\\) \ ((\a\<^bold>\\ \ \b\<^bold>\\) \ \c\<^bold>\\))" using assms c red_in_Hom red2_in_Hom Nml_HcompNml Ide_Nmlize_Ide Ide_HcompNml Nml_Nmlize by (simp_all add: eval_simps') moreover have "cod (\(\<^bold>\a\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\b\<^bold>\) \<^bold>\ \<^bold>\c\<^bold>\\ \ (\\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\b\<^bold>\\ \ \\<^bold>\c\<^bold>\\) \ ((\a\<^bold>\\ \ \b\<^bold>\\) \ \c\<^bold>\\)) = \\<^bold>\a\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\b\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\c\<^bold>\\" using assms c red_in_Hom red2_in_Hom Nml_HcompNml Ide_Nmlize_Ide Ide_HcompNml Nml_Nmlize HcompNml_assoc by (simp add: eval_simps') ultimately show "(\(\<^bold>\a\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\b\<^bold>\) \<^bold>\ \<^bold>\c\<^bold>\\ \ (\\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\b\<^bold>\\ \ \\<^bold>\c\<^bold>\\)) \ ((\a\<^bold>\\ \ \b\<^bold>\\) \ \c\<^bold>\\) = \\<^bold>\a\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\b\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\c\<^bold>\\ \ \(\<^bold>\a\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\b\<^bold>\) \<^bold>\ \<^bold>\c\<^bold>\\ \ (\\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\b\<^bold>\\ \ \\<^bold>\c\<^bold>\\) \ ((\a\<^bold>\\ \ \b\<^bold>\\) \ \c\<^bold>\\)" using comp_cod_arr comp_assoc by simp qed finally show ?thesis by blast qed lemma coherent_Assoc'_Ide: assumes "Ide a" and "Ide b" and "Ide c" and "Src a = Trg b" and "Src b = Trg c" shows "coherent \<^bold>\\<^sup>-\<^sup>1\<^bold>[a, b, c\<^bold>]" using assms Ide_implies_Can coherent_Assoc_Ide Inv_Ide coherent_iff_coherent_Inv Can.simps(10) Inv.simps(10) by presburger lemma eval_red2_naturality: assumes "Nml t" and "Nml u" and "Src t = Trg u" shows "\Cod t \<^bold>\ Cod u\ \ (\t\ \ \u\) = \t \<^bold>\\<^bold>\\<^bold>\ u\ \ \Dom t \<^bold>\ Dom u\" proof - have *: "\t u. Nml (t \<^bold>\ u) \ arr \t\ \ arr \u\" - using Nml_implies_Arr Nml_HcompD by simp + using Nml_implies_Arr Nml_HcompD + by (metis eval_simps'(1)) have "is_Prim\<^sub>0 t \ ?thesis" using assms Nml_implies_Arr is_Prim0_Trg \.naturality [of "\u\"] by (cases t) (simp_all add: eval_simps', cases "Trg t", simp_all) moreover have "\ is_Prim\<^sub>0 t \ is_Prim\<^sub>0 u \ ?thesis" using assms Nml_implies_Arr eval_red2_Nml_Prim\<^sub>0 runit_naturality [of "\t\"] by (cases u) (simp_all add: eval_simps') moreover have "\ is_Prim\<^sub>0 t \ \ is_Prim\<^sub>0 u \ ?thesis" using assms * Nml_implies_Arr apply (induct t, simp_all) proof - fix f assume f: "C.arr f" assume "\ is_Prim\<^sub>0 u" hence u: "\ is_Prim\<^sub>0 u \ Nml u \ Nml (Dom u) \ Nml (Cod u) \ Ide (Dom u) \ Ide (Cod u) \ arr \u\ \ arr \Dom u\ \ arr \Cod u\ \ ide \Dom u\ \ ide \Cod u\" using assms(2) Nml_implies_Arr ide_eval_Ide by simp hence 1: "\ is_Prim\<^sub>0 (Dom u) \ \ is_Prim\<^sub>0 (Cod u)" using u by (cases u) simp_all assume "\<^bold>\src\<^sub>C f\<^bold>\\<^sub>0 = Trg u" hence "\\<^bold>\src\<^sub>C f\<^bold>\\<^sub>0\ = \Trg u\" by simp hence fu: "src (E f) = trg \u\" using f u preserves_src Nml_implies_Arr by (simp add: eval_simps') show "\\<^bold>\C.cod f\<^bold>\ \<^bold>\ Cod u\ \ (E f \ \u\) = (E f \ \u\) \ \\<^bold>\C.dom f\<^bold>\ \<^bold>\ Dom u\" proof - have "\\<^bold>\C.cod f\<^bold>\ \<^bold>\ Cod u\ = E (C.cod f) \ cod \u\" using f u 1 Nml_implies_Arr by (cases "Cod u", simp_all add: eval_simps') moreover have "\\<^bold>\C.dom f\<^bold>\ \<^bold>\ Dom u\ = E (C.dom f) \ dom \u\" using f u 1 Nml_implies_Arr by (cases "Dom u", simp_all add: eval_simps') moreover have "\E f \ \u\ : E (C.dom f) \ \Dom u\ \ E (C.cod f) \ \Cod u\\" using f u fu Nml_implies_Arr apply (intro hcomp_in_vhom) apply auto by (metis C.src_dom eval_simps(4) preserves_src trg_dom u) ultimately show ?thesis using f u comp_arr_dom comp_cod_arr by (simp add: fu) qed next fix v w assume I2: "\ \ is_Prim\<^sub>0 w; Nml w \ \ \Cod w \<^bold>\ Cod u\ \ (\w\ \ \u\) = \w \<^bold>\\<^bold>\\<^bold>\ u\ \ \Dom w \<^bold>\ Dom u\" assume "\ is_Prim\<^sub>0 u" hence u: "\ is_Prim\<^sub>0 u \ Arr u \ Arr (Dom u) \ Arr (Cod u) \ Nml u \ Nml (Dom u) \ Nml (Cod u) \ Ide (Dom u) \ Ide (Cod u) \ arr \u\ \ arr \Dom u\ \ arr \Cod u\ \ ide \Dom u\ \ ide \Cod u\" using assms(2) Nml_implies_Arr ide_eval_Ide by simp assume vw: "Nml (v \<^bold>\ w)" assume wu: "Src w = Trg u" let ?f = "un_Prim v" have "v = \<^bold>\?f\<^bold>\ \ C.arr ?f" using vw by (metis Nml_HcompD(1) Nml_HcompD(2)) hence "Arr v \ v = \<^bold>\un_Prim v\<^bold>\ \ C.arr ?f \ Nml v" by (cases v; simp) hence v: "v = \<^bold>\?f\<^bold>\ \ C.arr ?f \ Arr v \ Arr (Dom v) \ Arr (Cod v) \ Nml v \ Nml (Dom v) \ Nml (Cod v) \ arr \v\ \ arr \Dom v\ \ arr \Cod v\ \ ide \Dom v\ \ ide \Cod v\" using vw * by (cases v, simp_all) have "Nml w \ \ is_Prim\<^sub>0 w" using vw v by (metis Nml.simps(3)) hence w: "\ is_Prim\<^sub>0 w \ Arr w \ Arr (Dom w) \ Arr (Cod w) \ Nml w \ Nml (Dom w) \ Nml (Cod w) \ Ide (Dom w) \ Ide (Cod w) \ arr \w\ \ arr \Dom w\ \ arr \Cod w\ \ ide \Dom w\ \ ide \Cod w\" using vw * Nml_implies_Arr ide_eval_Ide by simp have u': "\ is_Prim\<^sub>0 (Dom u) \ \ is_Prim\<^sub>0 (Cod u)" using u by (cases u, simp_all) have w': "\ is_Prim\<^sub>0 (Dom w) \ \ is_Prim\<^sub>0 (Cod w)" using w by (cases w, simp_all) have vw': "Src v = Trg w" using vw Nml_HcompD(7) by simp have X: "Nml (Dom v \<^bold>\ (Dom w \<^bold>\\<^bold>\\<^bold>\ Dom u))" using u u' v w w' wu vw is_Hcomp_HcompNml Nml_HcompNml Nml_Dom by (metis Dom.simps(3) Nml.simps(3) term.distinct_disc(3)) have Y: "Nml (Cod v \<^bold>\ (Cod w \<^bold>\\<^bold>\\<^bold>\ Cod u))" using u u' w w' wu vw is_Hcomp_HcompNml Nml_HcompNml Src_Cod Trg_Cod by (metis Cod.simps(3) Nml.simps(3) Nml_Cod term.distinct_disc(3) v) show "\(Cod v \<^bold>\ Cod w) \<^bold>\ Cod u\ \ ((\v\ \ \w\) \ \u\) = \(v \<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u\ \ \(Dom v \<^bold>\ Dom w) \<^bold>\ Dom u\" proof - have "\(Cod v \<^bold>\ Cod w) \<^bold>\ Cod u\ \ ((\v\ \ \w\) \ \u\) = (\Cod v \<^bold>\ (Cod w \<^bold>\\<^bold>\\<^bold>\ Cod u)\ \ (\Cod v\ \ \Cod w \<^bold>\ Cod u\) \ \[\Cod v\, \Cod w\, \Cod u\]) \ ((\v\ \ \w\) \ \u\)" proof - have "(Cod v \<^bold>\ Cod w) \<^bold>\ Cod u = (Cod v \<^bold>\ (Cod w \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Cod u\<^bold>\)) \<^bold>\ (Cod v \<^bold>\ Cod w \<^bold>\ Cod u) \<^bold>\ \<^bold>\\<^bold>[Cod v, Cod w, Cod u\<^bold>]" using u v w by (cases u) simp_all hence "\(Cod v \<^bold>\ Cod w) \<^bold>\ Cod u\ = \Cod v \<^bold>\ (Cod w \<^bold>\\<^bold>\\<^bold>\ Cod u)\ \ (\Cod v\ \ \Cod w \<^bold>\ Cod u\) \ \[\Cod v\, \Cod w\, \Cod u\]" using u v w \_def by simp thus ?thesis by presburger qed also have "... = ((\Cod v\ \ \Cod w \<^bold>\\<^bold>\\<^bold>\ Cod u\) \ (\Cod v\ \ \Cod w \<^bold>\ Cod u\) \ \[\Cod v\, \Cod w\, \Cod u\]) \ ((\v\ \ \w\) \ \u\)" using u v w Y red2_Nml by simp also have "... = ((\Cod v\ \ \Cod w \<^bold>\ Cod u\) \ \[\Cod v\, \Cod w\, \Cod u\]) \ ((\v\ \ \w\) \ \u\)" using u v w vw' wu comp_cod_arr red2_in_Hom HcompNml_in_Hom comp_reduce by (simp add: eval_simps') also have "... = (\Cod v\ \ \Cod w \<^bold>\ Cod u\) \ \[\Cod v\, \Cod w\, \Cod u\] \ ((\v\ \ \w\) \ \u\)" using comp_assoc by simp also have "... = (\Cod v\ \ \Cod w \<^bold>\ Cod u\) \ (\v\ \ \w\ \ \u\) \ \[\Dom v\, \Dom w\, \Dom u\]" using u v w vw' wu assoc_naturality [of "\v\" "\w\" "\u\"] by (simp add: eval_simps') also have "... = ((\Cod v\ \ \Cod w \<^bold>\ Cod u\) \ (\v\ \ \w\ \ \u\)) \ \[\Dom v\, \Dom w\, \Dom u\]" using comp_assoc by simp also have "... = (\v\ \ \w \<^bold>\\<^bold>\\<^bold>\ u\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" using v w u vw' wu I2 red2_in_Hom HcompNml_in_Hom comp_cod_arr interchange [of "\Cod v\" "\v\" "\Cod w \<^bold>\ Cod u\" "\w\ \ \u\"] by (simp add: eval_simps') also have "... = ((\v\ \ \w \<^bold>\\<^bold>\\<^bold>\ u\) \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\)) \ \[\Dom v\, \Dom w\, \Dom u\]" using v w u vw' wu red2_in_Hom HcompNml_in_Hom comp_arr_dom interchange [of "\v\" "\Dom v\" "\w \<^bold>\\<^bold>\\<^bold>\ u\" "\Dom w \<^bold>\ Dom u\"] by (simp add: eval_simps') also have "... = (\v\ \ \w \<^bold>\\<^bold>\\<^bold>\ u\) \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" using comp_assoc by simp also have "... = \v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u\ \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" using u u' v w vw' wu is_Hcomp_HcompNml HcompNml_Prim [of "w \<^bold>\\<^bold>\\<^bold>\ u" ?f] by force also have "... = \v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u\ \ \Dom v \<^bold>\\<^bold>\\<^bold>\ Dom w \<^bold>\\<^bold>\\<^bold>\ Dom u\ \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" proof - have "\v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u\ \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\] = (\v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u\ \ \Dom v \<^bold>\\<^bold>\\<^bold>\ Dom w \<^bold>\\<^bold>\\<^bold>\ Dom u\) \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" using u v w vw' wu comp_arr_dom Nml_HcompNml HcompNml_in_Hom by (simp add: eval_simps') also have "... = \v \<^bold>\\<^bold>\\<^bold>\ w \<^bold>\\<^bold>\\<^bold>\ u\ \ \Dom v \<^bold>\\<^bold>\\<^bold>\ Dom w \<^bold>\\<^bold>\\<^bold>\ Dom u\ \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" using comp_assoc by simp finally show ?thesis by blast qed also have "... = \(v \<^bold>\\<^bold>\\<^bold>\ w) \<^bold>\\<^bold>\\<^bold>\ u\ \ \(Dom v \<^bold>\ Dom w) \<^bold>\ Dom u\" proof - have "(Dom v \<^bold>\ Dom w) \<^bold>\ Dom u = (Dom v \<^bold>\ (Dom w \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom u\<^bold>\)) \<^bold>\ (Dom v \<^bold>\ (Dom w \<^bold>\ Dom u)) \<^bold>\ \<^bold>\\<^bold>[Dom v, Dom w, Dom u\<^bold>]" using u u' v w vw' wu by (cases u, simp_all) hence "\(Dom v \<^bold>\ Dom w) \<^bold>\ Dom u\ = \Dom v \<^bold>\ (Dom w \<^bold>\\<^bold>\\<^bold>\ Dom u)\ \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" using u v w \_def by simp also have "... = \Dom v \<^bold>\\<^bold>\\<^bold>\ Dom w \<^bold>\\<^bold>\\<^bold>\ Dom u\ \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" using X HcompNml_Nml red2_Nml by presburger finally have "\(Dom v \<^bold>\ Dom w) \<^bold>\ Dom u\ = \Dom v \<^bold>\\<^bold>\\<^bold>\ Dom w \<^bold>\\<^bold>\\<^bold>\ Dom u\ \ (\Dom v\ \ \Dom w \<^bold>\ Dom u\) \ \[\Dom v\, \Dom w\, \Dom u\]" by blast thus ?thesis using assms v w vw' wu HcompNml_assoc by presburger qed finally show ?thesis using vw HcompNml_Nml by simp qed qed ultimately show ?thesis by blast qed lemma coherent_Hcomp: assumes "Arr t" and "Arr u" and "Src t = Trg u" and "coherent t" and "coherent u" shows "coherent (t \<^bold>\ u)" proof - have t: "Arr t \ Ide (Dom t) \ Ide (Cod t) \ Ide \<^bold>\Dom t\<^bold>\ \ Ide \<^bold>\Cod t\<^bold>\ \ arr \t\ \ arr \Dom t\ \ ide \Dom t\ \ arr \Cod t\ \ ide \Cod t\" using assms Ide_Nmlize_Ide ide_eval_Ide by auto have u: "Arr u \ Ide (Dom u) \ Ide (Cod u) \ Ide \<^bold>\Dom u\<^bold>\ \ Ide \<^bold>\Cod u\<^bold>\ \ arr \u\ \ arr \Dom u\ \ ide \Dom u\ \ arr \Cod u\ \ ide \Cod u\" using assms Ide_Nmlize_Ide ide_eval_Ide by auto have "\Cod (t \<^bold>\ u)\<^bold>\\ \ (\t\ \ \u\) = (\\<^bold>\Cod t\<^bold>\ \<^bold>\ \<^bold>\Cod u\<^bold>\\ \ (\Cod t\<^bold>\\ \ \Cod u\<^bold>\\)) \ (\t\ \ \u\)" using t u eval_red_Hcomp by simp also have "... = \\<^bold>\Cod t\<^bold>\ \<^bold>\ \<^bold>\Cod u\<^bold>\\ \ (\Cod t\<^bold>\\ \ \Cod u\<^bold>\\) \ (\t\ \ \u\)" using comp_assoc by simp also have "... = \\<^bold>\Cod t\<^bold>\ \<^bold>\ \<^bold>\Cod u\<^bold>\\ \ (\\<^bold>\t\<^bold>\\ \ \\<^bold>\u\<^bold>\\) \ (\Dom t\<^bold>\\ \ \Dom u\<^bold>\\)" using assms t u Nmlize_in_Hom red_in_Hom interchange [of "\Cod t\<^bold>\\" "\t\" "\Cod u\<^bold>\\" "\u\"] interchange [of "\\<^bold>\t\<^bold>\\" "\Dom t\<^bold>\\" "\\<^bold>\u\<^bold>\\" "\Dom u\<^bold>\\"] by (simp add: eval_simps') also have "... = (\\<^bold>\Cod t\<^bold>\ \<^bold>\ \<^bold>\Cod u\<^bold>\\ \ (\\<^bold>\t\<^bold>\\ \ \\<^bold>\u\<^bold>\\)) \ (\Dom t\<^bold>\\ \ \Dom u\<^bold>\\)" using comp_assoc by simp also have "... = (\\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\\ \ \\<^bold>\Dom t\<^bold>\ \<^bold>\ \<^bold>\Dom u\<^bold>\\) \ (\Dom t\<^bold>\\ \ \Dom u\<^bold>\\)" using assms t u Nml_Nmlize Nmlize_in_Hom eval_red2_naturality [of "Nmlize t" "Nmlize u"] by simp also have "... = \\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\\ \ \\<^bold>\Dom t\<^bold>\ \<^bold>\ \<^bold>\Dom u\<^bold>\\ \ (\Dom t\<^bold>\\ \ \Dom u\<^bold>\\)" using comp_assoc by simp also have "... = \\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\\ \ \(Dom t \<^bold>\ Dom u)\<^bold>\\" using t u eval_red_Hcomp by simp finally have "\Cod (t \<^bold>\ u)\<^bold>\\ \ (\t\ \ \u\) = \\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\\ \ \(Dom t \<^bold>\ Dom u)\<^bold>\\" by blast thus ?thesis using t u by simp qed lemma coherent_Vcomp: assumes "Arr t" and "Arr u" and "Dom t = Cod u" and "coherent t" and "coherent u" shows "coherent (t \<^bold>\ u)" proof - have t: "Arr t \ Ide (Dom t) \ Ide (Cod t) \ Ide \<^bold>\Dom t\<^bold>\ \ Ide \<^bold>\Cod t\<^bold>\ \ arr \t\ \ arr \Dom t\ \ ide \Dom t\ \ arr \Cod t\ \ ide \Cod t\" using assms Ide_Nmlize_Ide ide_eval_Ide by auto have u: "Arr u \ Ide (Dom u) \ Ide (Cod u) \ Ide \<^bold>\Dom u\<^bold>\ \ Ide \<^bold>\Cod u\<^bold>\ \ arr \u\ \ arr \Dom u\ \ ide \Dom u\ \ arr \Cod u\ \ ide \Cod u\" using assms Ide_Nmlize_Ide ide_eval_Ide by auto have "\Cod (t \<^bold>\ u)\<^bold>\\ \ \t \<^bold>\ u\ = \Cod t\<^bold>\\ \ \t\ \ \u\" using t u by simp also have "... = (\Cod t\<^bold>\\ \ \t\) \ \u\" proof - have "seq \Cod t\<^bold>\\ \t\" using assms t red_in_Hom by (intro seqI, auto simp add: eval_simps') moreover have "seq \t\ \u\" using assms t u by (auto simp add: eval_simps') ultimately show ?thesis using comp_assoc by auto qed also have "... = \\<^bold>\t \<^bold>\ u\<^bold>\\ \ \Dom (t \<^bold>\ u)\<^bold>\\" using t u assms red_in_Hom Nml_Nmlize comp_assoc by (simp add: eval_simps' Nml_implies_Arr eval_VcompNml) finally show "coherent (t \<^bold>\ u)" by blast qed text \ The main result: ``Every formal arrow is coherent.'' \ theorem coherence: assumes "Arr t" shows "coherent t" proof - have "Arr t \ coherent t" proof (induct t) show "\a. Arr \<^bold>\a\<^bold>\\<^sub>0 \ coherent \<^bold>\a\<^bold>\\<^sub>0" by simp show "\\. Arr \<^bold>\\\<^bold>\ \ coherent \<^bold>\\\<^bold>\" by simp fix u v show "\ Arr u \ coherent u; Arr v \ coherent v \ \ Arr (u \<^bold>\ v) \ coherent (u \<^bold>\ v)" using coherent_Hcomp by simp show "\ Arr u \ coherent u; Arr v \ coherent v \ \ Arr (u \<^bold>\ v) \ coherent (u \<^bold>\ v)" using coherent_Vcomp by simp next fix t assume I: "Arr t \ coherent t" show Lunit: "Arr \<^bold>\\<^bold>[t\<^bold>] \ coherent \<^bold>\\<^bold>[t\<^bold>]" using I Ide_Dom coherent_Lunit_Ide Ide_in_Hom coherent_Vcomp [of t "\<^bold>\\<^bold>[Dom t\<^bold>]"] Nmlize_Vcomp_Arr_Dom eval_in_hom \.is_natural_1 [of "\t\"] by force show Runit: "Arr \<^bold>\\<^bold>[t\<^bold>] \ coherent \<^bold>\\<^bold>[t\<^bold>]" using I Ide_Dom coherent_Runit_Ide Ide_in_Hom ide_eval_Ide coherent_Vcomp [of t "\<^bold>\\<^bold>[Dom t\<^bold>]"] Nmlize_Vcomp_Arr_Dom \_ide_simp eval_in_hom \.is_natural_1 [of "\t\"] by force show "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] \ coherent \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]" proof - assume "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]" hence t: "Arr t" by simp have "coherent (\<^bold>\\<^sup>-\<^sup>1\<^bold>[Cod t\<^bold>] \<^bold>\ t)" using t I Ide_Cod coherent_Lunit'_Ide Ide_in_Hom coherent_Vcomp [of "\<^bold>\\<^sup>-\<^sup>1\<^bold>[Cod t\<^bold>]" t] Arr.simps(6) Dom.simps(6) Dom_Cod Ide_implies_Arr by presburger moreover have "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[Cod t\<^bold>] \<^bold>\ t\" using t \'.is_natural_2 [of "\t\"] by (simp add: eval_simps(5)) ultimately show ?thesis using t Nmlize_Vcomp_Cod_Arr by simp qed show "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>] \ coherent \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]" proof - assume "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]" hence t: "Arr t" by simp have "coherent (\<^bold>\\<^sup>-\<^sup>1\<^bold>[Cod t\<^bold>] \<^bold>\ t)" using t I Ide_Cod coherent_Runit'_Ide Ide_in_Hom coherent_Vcomp [of "\<^bold>\\<^sup>-\<^sup>1\<^bold>[Cod t\<^bold>]" t] Arr.simps(8) Dom.simps(8) Dom_Cod Ide_implies_Arr by presburger moreover have "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t\<^bold>]\ = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[Cod t\<^bold>] \<^bold>\ t\" using t \'.is_natural_2 [of "\t\"] by (simp add: eval_simps(5)) ultimately show ?thesis using t Nmlize_Vcomp_Cod_Arr by simp qed next fix t u v assume I1: "Arr t \ coherent t" assume I2: "Arr u \ coherent u" assume I3: "Arr v \ coherent v" show "Arr \<^bold>\\<^bold>[t, u, v\<^bold>] \ coherent \<^bold>\\<^bold>[t, u, v\<^bold>]" proof - assume tuv: "Arr \<^bold>\\<^bold>[t, u, v\<^bold>]" have t: "Arr t" using tuv by simp have u: "Arr u" using tuv by simp have v: "Arr v" using tuv by simp have tu: "Src t = Trg u" using tuv by simp have uv: "Src u = Trg v" using tuv by simp have "coherent ((t \<^bold>\ u \<^bold>\ v) \<^bold>\ \<^bold>\\<^bold>[Dom t, Dom u, Dom v\<^bold>])" proof - have "Arr (t \<^bold>\ u \<^bold>\ v) \ coherent (t \<^bold>\ u \<^bold>\ v)" using t u v tu uv tuv I1 I2 I3 coherent_Hcomp Arr.simps(3) Trg.simps(3) by presburger moreover have "Arr \<^bold>\\<^bold>[Dom t, Dom u, Dom v\<^bold>]" using t u v tu uv Ide_Dom by simp moreover have "coherent \<^bold>\\<^bold>[Dom t, Dom u, Dom v\<^bold>]" using t u v tu uv Src_Dom Trg_Dom Ide_Dom coherent_Assoc_Ide by metis moreover have "Dom (t \<^bold>\ u \<^bold>\ v) = Cod \<^bold>\\<^bold>[Dom t, Dom u, Dom v\<^bold>]" using t u v by simp ultimately show ?thesis using t u v coherent_Vcomp by blast qed moreover have "VPar \<^bold>\\<^bold>[t, u, v\<^bold>] ((t \<^bold>\ u \<^bold>\ v) \<^bold>\ \<^bold>\\<^bold>[Dom t, Dom u, Dom v\<^bold>])" using t u v tu uv Ide_Dom by simp moreover have "\<^bold>\\<^bold>\\<^bold>[t, u, v\<^bold>]\<^bold>\ = \<^bold>\(t \<^bold>\ u \<^bold>\ v) \<^bold>\ \<^bold>\\<^bold>[Dom t, Dom u, Dom v\<^bold>]\<^bold>\" proof - have "(\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\ = (\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ ((\<^bold>\Dom t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom u\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom v\<^bold>\)" proof - have 1: "Nml \<^bold>\t\<^bold>\ \ Nml \<^bold>\u\<^bold>\ \ Nml \<^bold>\v\<^bold>\ \ Dom \<^bold>\t\<^bold>\ = \<^bold>\Dom t\<^bold>\ \ Dom \<^bold>\u\<^bold>\ = \<^bold>\Dom u\<^bold>\ \ Dom \<^bold>\v\<^bold>\ = \<^bold>\Dom v\<^bold>\" using t u v Nml_Nmlize by blast moreover have "Nml (\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\)" using 1 t u tu Nmlize_Src Nmlize_Trg Nml_HcompNml(1) by presburger moreover have "\t. Arr t \ \<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Dom t\<^bold>\ = \<^bold>\t\<^bold>\" using t Nmlize_Vcomp_Arr_Dom by simp moreover have "Dom \<^bold>\\<^bold>\\<^bold>[t, u, v\<^bold>]\<^bold>\ = \<^bold>\Dom \<^bold>\\<^bold>[t, u, v\<^bold>]\<^bold>\" using Nml_Nmlize tuv by blast ultimately show ?thesis using t u v tu uv tuv 1 HcompNml_assoc Nml_HcompNml Nml_Nmlize VcompNml_Nml_Dom [of "(\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\"] by auto qed thus ?thesis using t u v Nmlize_Vcomp_Arr_Dom VcompNml_HcompNml Nml_Nmlize by simp qed moreover have "\\<^bold>\\<^bold>[t, u, v\<^bold>]\ = \(t \<^bold>\ u \<^bold>\ v) \<^bold>\ \<^bold>\\<^bold>[Dom t, Dom u, Dom v\<^bold>]\" using t u v tu uv Ide_Dom comp_cod_arr ide_eval_Ide \_def apply (simp add: eval_simps') using assoc_is_natural_1 arr_eval_Arr eval_simps'(2-4) by presburger ultimately show "coherent \<^bold>\\<^bold>[t, u, v\<^bold>]" by argo qed show "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] \ coherent \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]" proof - assume tuv: "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]" have t: "Arr t" using tuv by simp have u: "Arr u" using tuv by simp have v: "Arr v" using tuv by simp have tu: "Src t = Trg u" using tuv by simp have uv: "Src u = Trg v" using tuv by simp have "coherent (((t \<^bold>\ u) \<^bold>\ v) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[Dom t, Dom u, Dom v\<^bold>])" proof - have "Arr ((t \<^bold>\ u) \<^bold>\ v) \ coherent ((t \<^bold>\ u) \<^bold>\ v)" using t u v tu uv tuv I1 I2 I3 coherent_Hcomp Arr.simps(3) Src.simps(3) by presburger moreover have "Arr \<^bold>\\<^sup>-\<^sup>1\<^bold>[Dom t, Dom u, Dom v\<^bold>]" using t u v tu uv Ide_Dom by simp moreover have "coherent \<^bold>\\<^sup>-\<^sup>1\<^bold>[Dom t, Dom u, Dom v\<^bold>]" using t u v tu uv Src_Dom Trg_Dom Ide_Dom coherent_Assoc'_Ide by metis moreover have "Dom ((t \<^bold>\ u) \<^bold>\ v) = Cod \<^bold>\\<^sup>-\<^sup>1\<^bold>[Dom t, Dom u, Dom v\<^bold>]" using t u v by simp ultimately show ?thesis using t u v coherent_Vcomp by metis qed moreover have "VPar \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>] (((t \<^bold>\ u) \<^bold>\ v) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[Dom t, Dom u, Dom v\<^bold>])" using t u v tu uv Ide_Dom by simp moreover have "\<^bold>\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\<^bold>\ = \<^bold>\((t \<^bold>\ u) \<^bold>\ v) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[Dom t, Dom u, Dom v\<^bold>]\<^bold>\" using t u v tu uv Nmlize_Vcomp_Arr_Dom VcompNml_HcompNml Nml_Nmlize HcompNml_assoc Nml_HcompNml HcompNml_in_Hom VcompNml_Nml_Dom [of "(\<^bold>\t\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\u\<^bold>\) \<^bold>\\<^bold>\\<^bold>\ \<^bold>\v\<^bold>\"] - by simp + using Nmlize.simps(3-4,10) by presburger moreover have "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ = \((t \<^bold>\ u) \<^bold>\ v) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[Dom t, Dom u, Dom v\<^bold>]\" proof - have 1: "VVV.arr (\t\, \u\, \v\)" using tuv \'.preserves_reflects_arr arr_eval_Arr eval.simps(10) by (metis (no_types, lifting)) have "\\<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]\ = ((\t\ \ \u\) \ \v\) \ \\<^sup>-\<^sup>1[dom \t\, dom \u\, dom \v\]" proof - have "VVV.arr (\t\, \u\, \v\)" using tuv \'.preserves_reflects_arr arr_eval_Arr eval.simps(10) by (metis (no_types, lifting)) thus ?thesis using t u v \'.is_natural_1 [of "(\t\, \u\, \v\)"] HoHV_def \'_def VVV.dom_simp by simp qed also have "... = \((t \<^bold>\ u) \<^bold>\ v) \<^bold>\ \<^bold>\\<^sup>-\<^sup>1\<^bold>[Dom t, Dom u, Dom v\<^bold>]\" by (simp add: eval_simps'(4) t u v \'_def) finally show ?thesis by blast qed ultimately show "coherent \<^bold>\\<^sup>-\<^sup>1\<^bold>[t, u, v\<^bold>]" by argo qed qed thus ?thesis using assms by blast qed corollary eval_eqI: assumes "VPar t u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" shows "\t\ = \u\" using assms coherence canonical_factorization by simp text \ The following allows us to prove that two 1-cells in a bicategory are isomorphic simply by expressing them as the evaluations of terms having the same normalization. The benefits are: (1) we do not have to explicitly exhibit the isomorphism, which is canonical and is obtained by evaluating the reductions of the terms to their normalizations, and (2) the normalizations can be computed automatically by the simplifier. \ lemma canonically_isomorphicI: assumes "f = \t\" and "g = \u\" and "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" shows "f \ g" proof - have "f \ \t\" using assms isomorphic_reflexive ide_eval_Ide by blast also have "... \ \\<^bold>\t\<^bold>\\" proof - have "\\t\<^bold>\\ : \t\ \ \\<^bold>\t\<^bold>\\\ \ iso \t\<^bold>\\" using assms(1,3) Can_red iso_eval_Can red_in_Hom(2) eval_in_hom(2) by fastforce thus ?thesis using isomorphic_def by blast qed also have "... \ \\<^bold>\u\<^bold>\\" using assms isomorphic_reflexive by (simp add: Ide_Nmlize_Ide ide_eval_Ide) also have "... \ \u\" proof - have "\\u\<^bold>\\ : \u\ \ \\<^bold>\u\<^bold>\\\ \ iso \u\<^bold>\\" using assms(2,4) Can_red iso_eval_Can red_in_Hom(2) eval_in_hom(2) by fastforce thus ?thesis using isomorphic_def isomorphic_symmetric by blast qed also have "... \ g" using assms isomorphic_reflexive ide_eval_Ide by blast finally show ?thesis by simp qed end end diff --git a/thys/Bicategory/Prebicategory.thy b/thys/Bicategory/Prebicategory.thy --- a/thys/Bicategory/Prebicategory.thy +++ b/thys/Bicategory/Prebicategory.thy @@ -1,2960 +1,2959 @@ (* Title: PreBicategory Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) text \ The objective of this section is to construct a formalization of bicategories that is compatible with our previous formulation of categories \cite{Category3-AFP} and that permits us to carry over unchanged as much of the work done on categories as possible. For these reasons, we conceive of a bicategory in what might be regarded as a somewhat unusual fashion. Rather than a traditional development, which would typically define a bicategory to be essentially ``a `category' whose homs themselves have the structure of categories,'' here we regard a bicategory as ``a (vertical) category that has been equipped with a suitable (horizontal) weak composition.'' Stated another way, we think of a bicategory as a generalization of a monoidal category in which the tensor product is a partial operation, rather than a total one. Our definition of bicategory can thus be summarized as follows: a bicategory is a (vertical) category that has been equipped with idempotent endofunctors \src\ and \trg\ that assign to each arrow its ``source'' and ``target'' subject to certain commutativity constraints, a partial binary operation \\\ of horizontal composition that is suitably functorial on the ``hom-categories'' determined by the assignment of sources and targets, ``associativity'' isomorphisms \\\[f, g, h] : (f \ g) \ h \ f \ (g \ h)\\ for each horizontally composable triple of vertical identities \f\, \g\, \h\, subject to the usual naturality and coherence conditions, and for each ``object'' \a\ (defined to be an arrow that is its own source and target) a ``unit isomorphism'' \\\[a] : a \ a \ a\\. As is the case for monoidal categories, the unit isomorphisms and associator isomorphisms together enable a canonical definition of left and right ``unit'' isomorphisms \\\[f] : a \ f \ f\\ and \\\[f] : f \ a \ f\\ when \f\ is a vertical identity horizontally composable on the left or right by \a\, and it can be shown that these are the components of natural transformations. The definition of bicategory just sketched shares with a more traditional version the requirement that assignments of source and target are given as basic data, and these assignments determine horizontal composability in the sense that arrows \\\ and \\\ are composable if the chosen source of \\\ coincides with the chosen target of \\\. Thus it appears, at least on its face, that composability of arrows depends on an assignment of sources and targets. We are interested in establishing whether this is essential or whether bicategories can be formalized in a completely ``object-free'' fashion. It turns out that we can obtain such an object-free formalization through a rather direct generalization of the approach we used in the formalization of categories. Specifically, we define a \emph{weak composition} to be a partial binary operation \\\ on the arrow type of a ``vertical'' category \V\, such that the domain of definition of this operation is itself a category (of ``horizontally composable pairs of arrows''), the operation is functorial, and it is subject to certain matching conditions which include those satisfied by a category. From the axioms for a weak composition we can prove the existence of ``hom-categories'', which are subcategories of \V\ consisting of arrows horizontally composable on the left or right by a specified vertical identity. A \emph{weak unit} is defined to be a vertical identity \a\ such that \a \ a \ a\ and is such that the mappings \a \ \\ and \\ \ a\ are fully faithful endofunctors of the subcategories of \V\ consisting of the arrows for which they are defined. We define the \emph{sources} of an arrow \\\ to be the weak units that are horizontally composable with \\\ on the right, and the \emph{targets} of \\\ to be the weak units that are horizontally composable with \\\ on the left. An \emph{associative weak composition} is defined to be a weak composition that is equipped with ``associator'' isomorphisms \\\[f, g, h] : (f \ g) \ h \ f \ (g \ h)\\ for horizontally composable vertical identities \f\, \g\, \h\, subject to the usual naturality and coherence conditions. A \emph{prebicategory} is defined to be an associative weak composition for which every arrow has a source and a target. We show that the sets of sources and targets of each arrow in a prebicategory is an isomorphism class of weak units, and that horizontal composability of arrows \\\ and \\\ is characterized by the set of sources of \\\ being equal to the set of targets of \\\. We show that prebicategories are essentially ``bicategories without objects''. Given a prebicategory, we may choose an arbitrary representative of each isomorphism class of weak units and declare these to be ``objects'' (this is analogous to choosing a particular unit object in a monoidal category). For each object we may choose a particular \emph{unit isomorphism} \\\[a] : a \ a \ a\\. This choice, together with the associator isomorphisms, enables a canonical definition of left and right unit isomorphisms \\\[f] : a \ f \ f\\ and \\\[f] : f \ a \ f\\ when \f\ is a vertical identity horizontally composable on the left or right by \a\, and it can be shown that these are the components of natural isomorphisms. We may then define ``the source'' of an arrow to be the chosen representative of the set of its sources and ``the target'' to be the chosen representative of the set of its targets. We show that the resulting structure is a bicategory, in which horizontal composability as given by the weak composition coincides with the ``syntactic'' version determined by the chosen sources and targets. Conversely, a bicategory determines a prebicategory, essentially by forgetting the sources, targets and unit isomorphisms. These results make it clear that the assignment of sources and targets to arrows in a bicategory is basically a convenience and that horizontal composability of arrows is not dependent on a particular choice. \ theory Prebicategory imports Category3.EquivalenceOfCategories Category3.Subcategory IsomorphismClass begin section "Weak Composition" text \ In this section we define a locale \weak_composition\, which formalizes a functorial operation of ``horizontal'' composition defined on an underlying ``vertical'' category. The definition is expressed without the presumption of the existence of any sort of ``objects'' that determine horizontal composability. Rather, just as we did in showing that the @{locale partial_magma} locale supported the definition of ``identity arrow'' as a kind of unit for vertical composition which ultimately served as a basis for the definition of ``domain'' and ``codomain'' of an arrow, here we show that the \weak_composition\ locale supports a definition of \emph{weak unit} for horizontal composition which can ultimately be used to define the \emph{sources} and \emph{targets} of an arrow with respect to horizontal composition. In particular, the definition of weak composition involves axioms that relate horizontal and vertical composability. As a consequence of these axioms, for any fixed arrow \\\, the sets of arrows horizontally composable on the left and on the right with \\\ form subcategories with respect to vertical composition. We define the sources of \\\ to be the weak units that are composable with \\\ on the right, and the targets of \\\ to be the weak units that are composable with \\\ on the left. Weak units are then characterized as arrows that are members of the set of their own sources (or, equivalently, of their own targets). \ subsection "Definition" locale weak_composition = category V + VxV: product_category V V + VoV: subcategory VxV.comp \\\\. fst \\ \ snd \\ \ null\ + "functor" VoV.comp V \\\\. fst \\ \ snd \\\ for V :: "'a comp" (infixr "\" 55) and H :: "'a comp" (infixr "\" 53) + assumes left_connected: "seq \ \' \ \ \ \ \ null \ \' \ \ \ null" and right_connected: "seq \ \' \ \ \ \ \ null \ \ \ \' \ null" and match_1: "\ \ \ \ \ null; (\ \ \) \ \ \ null \ \ \ \ \ \ null" and match_2: "\ \ \ (\ \ \) \ null; \ \ \ \ null \ \ \ \ \ \ null" and match_3: "\ \ \ \ \ null; \ \ \ \ null \ \ (\ \ \) \ \ \ null" and match_4: "\ \ \ \ \ null; \ \ \ \ null \ \ \ \ (\ \ \) \ null" begin text \ We think of the arrows of the vertical category as ``2-cells'' and the vertical identities as ``1-cells''. In the formal development, the predicate @{term arr} (``arrow'') will have its normal meaning with respect to the vertical composition, hence @{term "arr \"} will mean, essentially, ``\\\ is a 2-cell''. This is somewhat unfortunate, as it is traditional when discussing bicategories to use the term ``arrow'' to refer to the 1-cells. However, we are trying to carry over all the formalism that we have already developed for categories and apply it to bicategories with as little change and redundancy as possible. It becomes too confusing to try to repurpose the name @{term arr} to mean @{term ide} and to introduce a replacement for the name @{term arr}, so we will simply tolerate the situation. In informal text, we will prefer the terms ``2-cell'' and ``1-cell'' over (vertical) ``arrow'' and ``identity'' when there is a chance for confusion. We do, however, make the following adjustments in notation for @{term in_hom} so that it is distinguished from the notion @{term in_hhom} (``in horizontal hom'') to be introduced subsequently. \ no_notation in_hom ("\_ : _ \ _\") notation in_hom ("\_ : _ \ _\") lemma is_partial_magma: shows "partial_magma H" proof show "\!n. \f. n \ f = n \ f \ n = n" proof show 1: "\f. null \ f = null \ f \ null = null" using is_extensional VoV.inclusion VoV.arr_char by force show "\n. \f. n \ f = n \ f \ n = n \ n = null" using 1 VoV.arr_char is_extensional not_arr_null by metis qed qed interpretation H: partial_magma H using is_partial_magma by auto text \ Either \match_1\ or \match_2\ seems essential for the next result, which states that the nulls for the horizontal and vertical compositions coincide. \ lemma null_agreement [simp]: shows "H.null = null" by (metis VoV.inclusion VxV.not_arr_null match_1 H.comp_null(1)) lemma composable_implies_arr: assumes "\ \ \ \ null" shows "arr \" and "arr \" using assms is_extensional VoV.arr_char VoV.inclusion by auto lemma hcomp_null [simp]: shows "null \ \ = null" and "\ \ null = null" using H.comp_null by auto lemma hcomp_simps\<^sub>W\<^sub>C [simp]: assumes "\ \ \ \ null" shows "arr (\ \ \)" and "dom (\ \ \) = dom \ \ dom \" and "cod (\ \ \) = cod \ \ cod \" using assms preserves_arr preserves_dom preserves_cod VoV.arr_char VoV.inclusion VoV.dom_simp VoV.cod_simp by force+ lemma ide_hcomp\<^sub>W\<^sub>C: assumes "ide f" and "ide g" and "g \ f \ null" shows "ide (g \ f)" using assms preserves_ide VoV.ide_char by force lemma hcomp_in_hom\<^sub>W\<^sub>C [intro]: assumes "\ \ \ \ null" shows "\\ \ \ : dom \ \ dom \ \ cod \ \ cod \\" using assms by auto text \ Horizontal composability of arrows is determined by horizontal composability of their domains and codomains (defined with respect to vertical composition). \ lemma hom_connected: shows "\ \ \ \ null \ dom \ \ \ \ null" and "\ \ \ \ null \ \ \ dom \ \ null" and "\ \ \ \ null \ cod \ \ \ \ null" and "\ \ \ \ null \ \ \ cod \ \ null" proof - show "\ \ \ \ null \ dom \ \ \ \ null" using left_connected [of \ "dom \" \] composable_implies_arr arr_dom_iff_arr by force show "\ \ \ \ null \ cod \ \ \ \ null" using left_connected [of "cod \" \ \] composable_implies_arr arr_cod_iff_arr by force show "\ \ \ \ null \ \ \ dom \ \ null" using right_connected [of \ "dom \" \] composable_implies_arr arr_dom_iff_arr by force show "\ \ \ \ null \ \ \ cod \ \ null" using right_connected [of "cod \" \ \] composable_implies_arr arr_cod_iff_arr by force qed lemma isomorphic_implies_equicomposable: assumes "f \ g" shows "\ \ f \ null \ \ \ g \ null" and "f \ \ \ null \ g \ \ \ null" using assms isomorphic_def hom_connected by auto lemma interchange: assumes "seq \ \" and "seq \ \" shows "(\ \ \) \ (\ \ \) = (\ \ \) \ (\ \ \)" proof - have "\ \ \ = null \ ?thesis" by (metis assms comp_null(2) dom_comp hom_connected(1-2)) moreover have "\ \ \ \ null \ ?thesis" proof - assume \\: "\ \ \ \ null" have 1: "VoV.arr (\, \)" using \\ VoV.arr_char by auto have \\: "(\, \) \ VoV.hom (VoV.cod (\, \)) (VoV.cod (\, \))" proof - have "VoV.arr (\, \)" using assms 1 hom_connected VoV.arr_char by (elim seqE, auto, metis) thus ?thesis using assms \\ VoV.dom_char VoV.cod_char by fastforce qed show ?thesis proof - have "VoV.seq (\, \) (\, \)" using assms 1 \\ \\ VoV.seqI by blast thus ?thesis using assms 1 \\ \\ VoV.comp_char preserves_comp [of "(\, \)" "(\, \)"] VoV.seqI by fastforce qed qed ultimately show ?thesis by blast qed lemma paste_1: shows "\ \ \ = (cod \ \ \) \ (\ \ dom \)" using interchange composable_implies_arr comp_arr_dom comp_cod_arr hom_connected(2-3) by (metis comp_null(2)) lemma paste_2: shows "\ \ \ = (\ \ cod \) \ (dom \ \ \)" using interchange composable_implies_arr comp_arr_dom comp_cod_arr hom_connected(1,4) by (metis comp_null(2)) lemma whisker_left: assumes "seq \ \" and "ide f" shows "f \ (\ \ \) = (f \ \) \ (f \ \)" using assms interchange [of f f \ \] hom_connected by auto lemma whisker_right: assumes "seq \ \" and "ide f" shows "(\ \ \) \ f = (\ \ f) \ (\ \ f)" using assms interchange [of \ \ f f] hom_connected by auto subsection "Hom-Subcategories" definition left where "left \ \ \\. \ \ \ \ null" definition right where "right \ \ \\. \ \ \ \ null" lemma right_iff_left: shows "right \ \ \ left \ \" using right_def left_def by simp lemma left_respects_isomorphic: assumes "f \ g" shows "left f = left g" using assms isomorphic_implies_equicomposable left_def by auto lemma right_respects_isomorphic: assumes "f \ g" shows "right f = right g" using assms isomorphic_implies_equicomposable right_def by auto lemma left_iff_left_inv: assumes "iso \" shows "left \ \ \ left \ (inv \)" using assms left_def inv_in_hom hom_connected(2) hom_connected(4) [of \ "inv \"] by auto lemma right_iff_right_inv: assumes "iso \" shows "right \ \ \ right \ (inv \)" using assms right_def inv_in_hom hom_connected(1) hom_connected(3) [of "inv \" \] by auto lemma left_hom_is_subcategory: assumes "arr \" shows "subcategory V (left \)" using composable_implies_arr hom_connected(2,4) apply (unfold left_def, unfold_locales) apply auto by (metis cod_comp seqI) lemma right_hom_is_subcategory: assumes "arr \" shows "subcategory V (right \)" using composable_implies_arr hom_connected(1,3) apply (unfold right_def, unfold_locales) apply auto by (metis cod_comp seqI) abbreviation Left where "Left a \ subcategory.comp V (left a)" abbreviation Right where "Right a \ subcategory.comp V (right a)" text \ We define operations of composition on the left or right with a fixed 1-cell, and show that such operations are functorial in case that 1-cell is horizontally self-composable. \ definition H\<^sub>L where "H\<^sub>L g \ \\. g \ \" definition H\<^sub>R where "H\<^sub>R f \ \\. \ \ f" (* TODO: Why do the following fail when I use @{thm ...} *) text \ Note that \match_3\ and \match_4\ are required for the next results. \ lemma endofunctor_H\<^sub>L: assumes "ide g" and "g \ g \ null" shows "endofunctor (Left g) (H\<^sub>L g)" proof - interpret L: subcategory V \left g\ using assms left_hom_is_subcategory by simp have *: "\\. L.arr \ \ H\<^sub>L g \ = g \ \" using assms H\<^sub>L_def by simp have preserves_arr: "\\. L.arr \ \ L.arr (H\<^sub>L g \)" using assms * L.arr_char left_def match_4 by force show "endofunctor L.comp (H\<^sub>L g)" using assms * apply unfold_locales using H\<^sub>L_def L.arr_char L.null_char left_def apply force using preserves_arr apply blast apply (metis L.dom_simp L.not_arr_null L.null_char hcomp_simps\<^sub>W\<^sub>C(2) ide_char preserves_arr H\<^sub>L_def) apply (metis H\<^sub>L_def L.arrE L.cod_simp hcomp_simps\<^sub>W\<^sub>C(3) ide_char left_def preserves_arr) by (metis L.comp_def L.comp_simp L.seq_char hcomp_simps\<^sub>W\<^sub>C(1) whisker_left preserves_arr) qed lemma endofunctor_H\<^sub>R: assumes "ide f" and "f \ f \ null" shows "endofunctor (Right f) (H\<^sub>R f)" proof - interpret R: subcategory V \right f\ using assms right_hom_is_subcategory by simp have *: "\\. R.arr \ \ H\<^sub>R f \ = \ \ f" using assms H\<^sub>R_def by simp have preserves_arr: "\\. R.arr \ \ R.arr (H\<^sub>R f \)" using assms * R.arr_char right_def match_3 by force show "endofunctor R.comp (H\<^sub>R f)" using assms * apply unfold_locales using H\<^sub>R_def R.arr_char R.null_char right_def apply force using preserves_arr apply blast apply (metis R.dom_simp R.not_arr_null R.null_char hcomp_simps\<^sub>W\<^sub>C(2) ide_char preserves_arr H\<^sub>R_def) apply (metis H\<^sub>R_def R.arrE R.cod_simp hcomp_simps\<^sub>W\<^sub>C(3) ide_char right_def preserves_arr) by (metis R.comp_def R.comp_simp R.seq_char hcomp_simps\<^sub>W\<^sub>C(1) whisker_right preserves_arr) qed end locale left_hom = weak_composition V H + S: subcategory V \left \\ for V :: "'a comp" (infixr "\" 55) and H :: "'a comp" (infixr "\" 53) and \ :: 'a + assumes arr_\: "arr \" begin no_notation in_hom ("\_ : _ \ _\") notation in_hom ("\_ : _ \ _\") notation S.comp (infixr "\\<^sub>S" 55) notation S.in_hom ("\_ : _ \\<^sub>S _\") lemma right_hcomp_closed: assumes "\\ : x \\<^sub>S y\" and "\\ : c \ d\" and "\ \ \ \ null" shows "\\ \ \ : x \ c \\<^sub>S y \ d\" using assms arr_\ S.arr_char S.dom_simp S.cod_simp left_def match_4 by (elim S.in_homE, intro S.in_homI) auto lemma interchange: assumes "S.seq \ \" and "S.seq \ \" and "\ \ \ \ null" shows "(\ \\<^sub>S \) \ (\ \\<^sub>S \) = (\ \ \) \\<^sub>S (\ \ \)" proof - have 1: "\ \ \ \ null" using assms hom_connected(1) [of \ \] hom_connected(2) [of \ \] hom_connected(3-4) S.dom_simp S.cod_simp by force have "(\ \\<^sub>S \) \ (\ \\<^sub>S \) = (\ \ \) \ (\ \ \)" using assms S.comp_char S.seq_char by metis also have "... = (\ \ \) \ (\ \ \)" using assms interchange S.seq_char S.arr_char by simp also have "... = (\ \ \) \\<^sub>S (\ \ \)" using assms 1 by (metis S.arr_char S.comp_char S.seq_char ext match_4 left_def) finally show ?thesis by blast qed lemma inv_char: assumes "S.arr \" and "iso \" shows "S.inverse_arrows \ (inv \)" and "S.inv \ = inv \" proof - have 1: "S.arr (inv \)" using assms S.arr_char left_iff_left_inv by (intro S.arrI) meson show "S.inv \ = inv \" using assms 1 S.inv_char S.iso_char by blast thus "S.inverse_arrows \ (inv \)" using assms 1 S.iso_char S.inv_is_inverse by metis qed lemma iso_char: assumes "S.arr \" shows "S.iso \ \ iso \" using assms S.iso_char inv_char by auto end locale right_hom = weak_composition V H + S: subcategory V \right \\ for V :: "'a comp" (infixr "\" 55) and H :: "'a comp" (infixr "\" 53) and \ :: 'a + assumes arr_\: "arr \" begin no_notation in_hom ("\_ : _ \ _\") notation in_hom ("\_ : _ \ _\") notation S.comp (infixr "\\<^sub>S" 55) notation S.in_hom ("\_ : _ \\<^sub>S _\") lemma left_hcomp_closed: assumes "\\ : x \\<^sub>S y\" and "\\ : c \ d\" and "\ \ \ \ null" shows "\\ \ \ : c \ x \\<^sub>S d \ y\" using assms arr_\ S.arr_char S.dom_simp S.cod_simp right_def match_3 by (elim S.in_homE, intro S.in_homI) auto lemma interchange: assumes "S.seq \ \" and "S.seq \ \" and "\ \ \ \ null" shows "(\ \\<^sub>S \) \ (\ \\<^sub>S \) = (\ \ \) \\<^sub>S (\ \ \)" proof - have 1: "\ \ \ \ null" using assms hom_connected(1) [of \ \] hom_connected(2) [of \ \] hom_connected(3-4) S.dom_simp S.cod_simp by fastforce have "(\ \\<^sub>S \) \ (\ \\<^sub>S \) = (\ \ \) \ (\ \ \)" using assms S.comp_char S.seq_char by metis also have "... = (\ \ \) \ (\ \ \)" using assms interchange S.seq_char S.arr_char by simp also have "... = (\ \ \) \\<^sub>S (\ \ \)" using assms 1 by (metis S.arr_char S.comp_char S.seq_char ext match_3 right_def) finally show ?thesis by blast qed lemma inv_char: assumes "S.arr \" and "iso \" shows "S.inverse_arrows \ (inv \)" and "S.inv \ = inv \" proof - have 1: "S.arr (inv \)" using assms S.arr_char right_iff_right_inv by (intro S.arrI) meson show "S.inv \ = inv \" using assms 1 S.inv_char S.iso_char by blast thus "S.inverse_arrows \ (inv \)" using assms 1 S.iso_char S.inv_is_inverse by metis qed lemma iso_char: assumes "S.arr \" shows "S.iso \ \ iso \" using assms S.iso_char inv_char by auto end subsection "Weak Units" text \ We now define a \emph{weak unit} to be an arrow \a\ such that: \begin{enumerate} \item \a \ a\ is isomorphic to \a\ (and hence \a\ is a horizontally self-composable 1-cell). \item Horizontal composition on the left with \a\ is a fully faithful endofunctor of the subcategory of arrows that are composable on the left with \a\. \item Horizontal composition on the right with \a\ is fully faithful endofunctor of the subcategory of arrows that are composable on the right with \a\. \end{enumerate} \ context weak_composition begin definition weak_unit :: "'a \ bool" where "weak_unit a \ a \ a \ a \ fully_faithful_functor (Left a) (Left a) (H\<^sub>L a) \ fully_faithful_functor (Right a) (Right a) (H\<^sub>R a)" lemma weak_unit_self_composable: assumes "weak_unit a" shows "ide a" and "ide (a \ a)" and "a \ a \ null" proof - obtain \ where \: "\\ : a \ a \ a\ \ iso \" using assms weak_unit_def isomorphic_def by blast have 1: "arr \" using \ by blast show "ide a" using \ ide_cod by blast thus "ide (a \ a)" using \ ide_dom by force thus "a \ a \ null" using not_arr_null ideD(1) by metis qed lemma weak_unit_self_right: assumes "weak_unit a" shows "right a a" using assms weak_unit_self_composable right_def by simp lemma weak_unit_self_left: assumes "weak_unit a" shows "left a a" using assms weak_unit_self_composable left_def by simp lemma weak_unit_in_vhom: assumes "weak_unit a" shows "\a : a \ a\" using assms weak_unit_self_composable left_def by auto text \ If \a\ is a weak unit, then there exists a ``unit isomorphism'' \\\ : a \ a \ a\\. It need not be unique, but we may choose one arbitrarily. \ definition some_unit where "some_unit a \ SOME \. iso \ \ \\ : a \ a \ a\" lemma iso_some_unit: assumes "weak_unit a" shows "iso (some_unit a)" and "\some_unit a : a \ a \ a\" proof - let ?P = "\\. iso \ \ \\ : a \ a \ a\" have "\\. ?P \" using assms weak_unit_def by auto hence 1: "?P (some_unit a)" using someI_ex [of ?P] some_unit_def by simp show "iso (some_unit a)" using 1 by blast show "\some_unit a : a \ a \ a\" using 1 by blast qed text \ The \emph{sources} of an arbitrary arrow \\\ are the weak units that are composable with \\\ on the right. Similarly, the \emph{targets} of \\\ are the weak units that are composable with \\\ on the left. \ definition sources where "sources \ \ {a. weak_unit a \ \ \ a \ null}" lemma sourcesI [intro]: assumes "weak_unit a" and "\ \ a \ null" shows "a \ sources \" using assms sources_def by blast lemma sourcesD [dest]: assumes "a \ sources \" shows "ide a" and "weak_unit a" and "\ \ a \ null" using assms sources_def weak_unit_self_composable by auto definition targets where "targets \ \ {b. weak_unit b \ b \ \ \ null}" lemma targetsI [intro]: assumes "weak_unit b" and "b \ \ \ null" shows "b \ targets \" using assms targets_def by blast lemma targetsD [dest]: assumes "b \ targets \" shows "ide b" and "weak_unit b" and "b \ \ \ null" using assms targets_def weak_unit_self_composable by auto lemma sources_dom [simp]: assumes "arr \" shows "sources (dom \) = sources \" using assms hom_connected(1) by blast lemma sources_cod [simp]: assumes "arr \" shows "sources (cod \) = sources \" using assms hom_connected(3) by blast lemma targets_dom [simp]: assumes "arr \" shows "targets (dom \) = targets \" using assms hom_connected(2) by blast lemma targets_cod [simp]: assumes "arr \" shows "targets (cod \) = targets \" using assms hom_connected(4) by blast lemma weak_unit_iff_self_source: shows "weak_unit a \ a \ sources a" using weak_unit_self_composable by auto lemma weak_unit_iff_self_target: shows "weak_unit b \ b \ targets b" using weak_unit_self_composable by auto abbreviation (input) in_hhom\<^sub>W\<^sub>C ("\_ : _ \\<^sub>W\<^sub>C _\") where "in_hhom\<^sub>W\<^sub>C \ f g \ arr \ \ f \ sources \ \ g \ targets \" lemma sources_hcomp: assumes "\ \ \ \ null" shows "sources (\ \ \) = sources \" using assms match_1 match_3 null_agreement by blast lemma targets_hcomp: assumes "\ \ \ \ null" shows "targets (\ \ \) = targets \" using assms match_2 match_4 null_agreement by blast lemma H\<^sub>R_preserved_along_iso: assumes "weak_unit a" and "a \ a'" shows "endofunctor (Right a) (H\<^sub>R a')" proof - have a: "ide a \ weak_unit a" using assms isomorphic_def by auto have a': "ide a'" using assms isomorphic_def by auto (* TODO: The following interpretation re-introduces unwanted notation for "in_hom" *) interpret R: subcategory V \right a\ using a right_hom_is_subcategory by simp have *: "\\. R.arr \ \ H\<^sub>R a' \ = \ \ a'" using assms H\<^sub>R_def by simp have preserves_arr: "\\. R.arr \ \ R.arr (H\<^sub>R a' \)" using assms a' * R.arr_char right_def weak_unit_def weak_unit_self_composable isomorphic_implies_equicomposable R.ide_char match_3 hcomp_simps\<^sub>W\<^sub>C(1) null_agreement by metis show "endofunctor R.comp (H\<^sub>R a')" proof show "\\. \ R.arr \ \ H\<^sub>R a' \ = R.null" using assms R.arr_char R.null_char right_def H\<^sub>R_def null_agreement right_respects_isomorphic by metis fix \ assume "R.arr \" hence \: "R.arr \ \ arr \ \ right a \ \ right a' \ \ \ \ a \ null \ \ \ a' \ null" using assms R.arr_char right_respects_isomorphic composable_implies_arr null_agreement right_def by metis show "R.arr (H\<^sub>R a' \)" using \ preserves_arr by blast show "R.dom (H\<^sub>R a' \) = H\<^sub>R a' (R.dom \)" using a' \ * R.arr_char R.dom_char preserves_arr hom_connected(1) right_def by simp show "R.cod (H\<^sub>R a' \) = H\<^sub>R a' (R.cod \)" using a' \ * R.arr_char R.cod_char preserves_arr hom_connected(3) right_def by simp next fix \ \ assume \\: "R.seq \ \" have \: "R.arr \ \ arr \ \ right a \ \ right a' \ \ \ \ a \ null \ \ \ a' \ null" using assms \\ R.arr_char right_respects_isomorphic composable_implies_arr null_agreement right_def by (elim R.seqE) metis have \: "\\ : R.cod \ \ R.cod \\ \ arr \ \ right a \ \ H \ a \ null \ right a' \ \ H \ a' \ null" by (metis "*" R.cod_simp R.comp_def R.inclusion R.not_arr_null R.null_char R.seqE \\ in_homI preserves_arr right_def) show "H\<^sub>R a' (R.comp \ \) = R.comp (H\<^sub>R a' \) (H\<^sub>R a' \)" proof - have 1: "R.arr (H\<^sub>R a' \)" using \ preserves_arr by blast have 2: "seq (\ \ a') (\ \ a')" using a' \ \ R.arr_char R.inclusion R.dom_char R.cod_char isomorphic_implies_equicomposable by auto show ?thesis using a' \ \ \\ 1 2 preserves_arr H\<^sub>R_def R.dom_simp R.cod_simp R.comp_char R.seq_char R.inclusion whisker_right by metis qed qed qed lemma H\<^sub>L_preserved_along_iso: assumes "weak_unit a" and "a \ a'" shows "endofunctor (Left a) (H\<^sub>L a')" proof - have a: "ide a \ weak_unit a" using assms isomorphic_def by auto have a': "ide a'" using assms isomorphic_def by auto (* TODO: The following interpretation re-introduces unwanted notation for "in_hom" *) interpret L: subcategory V \left a\ using a left_hom_is_subcategory by simp have *: "\\. L.arr \ \ H\<^sub>L a' \ = a' \ \" using assms H\<^sub>L_def by simp have preserves_arr: "\\. L.arr \ \ L.arr (H\<^sub>L a' \)" using assms a' * L.arr_char left_def weak_unit_def weak_unit_self_composable isomorphic_implies_equicomposable L.ide_char match_4 hcomp_simps\<^sub>W\<^sub>C(1) null_agreement by metis show "endofunctor L.comp (H\<^sub>L a')" proof show "\\. \ L.arr \ \ H\<^sub>L a' \ = L.null" using assms L.arr_char L.null_char left_def H\<^sub>L_def null_agreement left_respects_isomorphic by metis fix \ assume "L.arr \" hence \: "L.arr \ \ arr \ \ left a \ \ left a' \ \ a \ \ \ null \ a' \ \ \ null" using assms L.arr_char left_respects_isomorphic composable_implies_arr null_agreement left_def by metis show "L.arr (H\<^sub>L a' \)" using \ preserves_arr by blast show "L.dom (H\<^sub>L a' \) = H\<^sub>L a' (L.dom \)" using a' \ * L.arr_char L.dom_char preserves_arr hom_connected(2) left_def by simp show "L.cod (H\<^sub>L a' \) = H\<^sub>L a' (L.cod \)" using a' \ * L.arr_char L.cod_char preserves_arr hom_connected(4) left_def by simp next fix \ \ assume \\: "L.seq \ \" have "L.arr \" using \\ by (elim L.seqE, auto) hence \: "L.arr \ \ arr \ \ left a \ \ left a' \ \ a \ \ \ null \ a' \ \ \ null" using assms L.arr_char left_respects_isomorphic composable_implies_arr null_agreement left_def by metis have \: "\\ : L.cod \ \ L.cod \\ \ arr \ \ left a \ \ a \ \ \ null \ left a' \ \ a' \ \ \ null" by (metis (mono_tags, opaque_lifting) L.arrE L.cod_simp L.seq_char \\ assms(2) in_homI seqE left_def left_respects_isomorphic) show "H\<^sub>L a' (L.comp \ \) = L.comp (H\<^sub>L a' \) (H\<^sub>L a' \)" proof - have 1: "L.arr (H\<^sub>L a' \)" using \ preserves_arr by blast have 2: "seq (a' \ \) (a' \ \)" using a' \ \ L.arr_char L.inclusion L.dom_char L.cod_char isomorphic_implies_equicomposable by auto show ?thesis using a' \ \ \\ 1 2 preserves_arr H\<^sub>L_def L.dom_simp L.cod_simp L.comp_char L.seq_char L.inclusion whisker_left by metis qed qed qed end subsection "Regularity" text \ We call a weak composition \emph{regular} if \f \ a \ f\ whenever \a\ is a source of 1-cell \f\, and \b \ f \ f\ whenever \b\ is a target of \f\. A consequence of regularity is that horizontal composability of 2-cells is fully determined by their sets of sources and targets. \ locale regular_weak_composition = weak_composition + assumes comp_ide_source: "\ a \ sources f; ide f \ \ f \ a \ f" and comp_target_ide: "\ b \ targets f; ide f \ \ b \ f \ f" begin lemma sources_determine_composability: assumes "a \ sources \" shows "\ \ \ \ null \ a \ \ \ null" proof - have *: "\\. ide \ \ a \ sources \ \ \ \ \ \ null \ a \ \ \ null" using assms comp_ide_source isomorphic_implies_equicomposable match_1 match_3 by (meson sourcesD(3)) show ?thesis proof - have "arr \" using assms composable_implies_arr by auto thus ?thesis using assms * [of "dom \"] hom_connected(1) by auto qed qed lemma targets_determine_composability: assumes "b \ targets \" shows "\ \ \ \ null \ \ \ b \ null" proof - have *: "\\. ide \ \ b \ targets \ \ \ \ \ \ null \ \ \ b \ null" using assms comp_target_ide isomorphic_implies_equicomposable match_2 match_4 by (meson targetsD(3)) show ?thesis proof - have "arr \" using assms composable_implies_arr by auto thus ?thesis using assms * [of "dom \"] hom_connected(2) by auto qed qed lemma composable_if_connected: assumes "sources \ \ targets \ \ {}" shows "\ \ \ \ null" using assms targets_determine_composability by blast lemma connected_if_composable: assumes "\ \ \ \ null" shows "sources \ = targets \" using assms sources_determine_composability targets_determine_composability by blast lemma iso_hcomp\<^sub>R\<^sub>W\<^sub>C: assumes "iso \" and "iso \" and "sources \ \ targets \ \ {}" shows "iso (\ \ \)" and "inverse_arrows (\ \ \) (inv \ \ inv \)" proof - have \: "arr \ \ \\ : dom \ \ cod \\ \ iso \ \ \inv \ : cod \ \ dom \\" using assms inv_in_hom arr_iff_in_hom iso_is_arr by auto have \: "arr \ \ \\ : dom \ \ cod \\ \ iso \ \ \inv \ : cod \ \ dom \\" using assms inv_in_hom by blast have 1: "sources (inv \) \ targets (inv \) \ {}" using assms \ \ sources_dom sources_cod targets_dom targets_cod arr_inv cod_inv by metis show "inverse_arrows (\ \ \) (inv \ \ inv \)" using assms 1 \ \ inv_in_hom inv_is_inverse comp_inv_arr interchange [of "inv \" \ "inv \" \] composable_if_connected ide_hcomp\<^sub>W\<^sub>C sources_dom targets_dom interchange [of \ "inv \" \ "inv \"] ide_hcomp\<^sub>W\<^sub>C sources_cod targets_cod ide_compE ide_dom comp_arr_inv' inverse_arrowsE seqI' inverse_arrowsI by metis thus "iso (\ \ \)" by auto qed lemma inv_hcomp\<^sub>R\<^sub>W\<^sub>C: assumes "iso \" and "iso \" and "sources \ \ targets \ \ {}" shows "inv (\ \ \) = inv \ \ inv \" using assms iso_hcomp\<^sub>R\<^sub>W\<^sub>C(2) [of \ \] inverse_arrow_unique [of "H \ \"] inv_is_inverse by auto end subsection "Associativity" text \ An \emph{associative weak composition} consists of a weak composition that has been equipped with an \emph{associator} isomorphism: \\\[f, g, h] : (f \ g) \ h \ f \ g \ h\\ for each composable triple \(f, g, h)\ of 1-cells, subject to naturality and coherence conditions. \ locale associative_weak_composition = weak_composition + fixes \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") assumes assoc_in_vhom\<^sub>A\<^sub>W\<^sub>C: "\ ide f; ide g; ide h; f \ g \ null; g \ h \ null \ \ \\[f, g, h] : (f \ g) \ h \ f \ g \ h\" and assoc_naturality\<^sub>A\<^sub>W\<^sub>C: "\ \ \ \ \ null; \ \ \ \ null \ \ \[cod \, cod \, cod \] \ ((\ \ \) \ \) = (\ \ \ \ \) \ \[dom \, dom \, dom \]" and iso_assoc\<^sub>A\<^sub>W\<^sub>C: "\ ide f; ide g; ide h; f \ g \ null; g \ h \ null \ \ iso \[f, g, h]" and pentagon\<^sub>A\<^sub>W\<^sub>C: "\ ide f; ide g; ide h; ide k; sources f \ targets g \ {}; sources g \ targets h \ {}; sources h \ targets k \ {} \ \ (f \ \[g, h, k]) \ \[f, g \ h, k] \ (\[f, g, h] \ k) = \[f, g, h \ k] \ \[f \ g, h, k]" begin lemma assoc_in_hom\<^sub>A\<^sub>W\<^sub>C: assumes "ide f" and "ide g" and "ide h" and "f \ g \ null" and "g \ h \ null" shows "sources \[f, g, h] = sources h" and "targets \[f, g, h] = targets f" and "\\[f, g, h] : (f \ g) \ h \ f \ g \ h\" proof - show 1: "\\[f, g, h] : (f \ g) \ h \ f \ g \ h\" using assms assoc_in_vhom\<^sub>A\<^sub>W\<^sub>C by simp show "sources \[f, g, h] = sources h" using assms 1 sources_dom [of "\[f, g, h]"] sources_hcomp match_3 by (elim in_homE, auto) show "targets \[f, g, h] = targets f" using assms 1 targets_cod [of "\[f, g, h]"] targets_hcomp match_4 by (elim in_homE, auto) qed lemma assoc_simps\<^sub>A\<^sub>W\<^sub>C [simp]: assumes "ide f" and "ide g" and "ide h" and "f \ g \ null" and "g \ h \ null" shows "arr \[f, g, h]" and "dom \[f, g, h] = (f \ g) \ h" and "cod \[f, g, h] = f \ g \ h" proof - have 1: "\\[f, g, h] : (f \ g) \ h \ f \ g \ h\" using assms assoc_in_hom\<^sub>A\<^sub>W\<^sub>C by auto show "arr \[f, g, h]" using 1 by auto show "dom \[f, g, h] = (f \ g) \ h" using 1 by auto show "cod \[f, g, h] = f \ g \ h" using 1 by auto qed lemma assoc'_in_hom\<^sub>A\<^sub>W\<^sub>C: assumes "ide f" and "ide g" and "ide h" and "f \ g \ null" and "g \ h \ null" shows "sources (inv \[f, g, h]) = sources h" and "targets (inv \[f, g, h]) = targets f" and "\inv \[f, g, h] : f \ g \ h \ (f \ g) \ h\" proof - show 1: "\inv \[f, g, h] : f \ g \ h \ (f \ g) \ h\" using assms assoc_in_hom\<^sub>A\<^sub>W\<^sub>C iso_assoc\<^sub>A\<^sub>W\<^sub>C inv_in_hom by auto show "sources (inv \[f, g, h]) = sources h" using assms 1 sources_hcomp [of "f \ g" h] sources_cod match_3 null_agreement by (elim in_homE, metis) show "targets (inv \[f, g, h]) = targets f" using assms 1 targets_hcomp [of f "g \ h"] targets_dom match_4 null_agreement by (elim in_homE, metis) qed lemma assoc'_simps\<^sub>A\<^sub>W\<^sub>C [simp]: assumes "ide f" and "ide g" and "ide h" and "f \ g \ null" and "g \ h \ null" shows "arr (inv \[f, g, h])" and "dom (inv \[f, g, h]) = f \ g \ h" and "cod (inv \[f, g, h]) = (f \ g) \ h" proof - have 1: "\inv \[f, g, h] : f \ g \ h \ (f \ g) \ h\" using assms assoc'_in_hom\<^sub>A\<^sub>W\<^sub>C by auto show "arr (inv \[f, g, h])" using 1 by auto show "dom (inv \[f, g, h]) = f \ g \ h" using 1 by auto show "cod (inv \[f, g, h]) = (f \ g) \ h" using 1 by auto qed lemma assoc'_naturality\<^sub>A\<^sub>W\<^sub>C: assumes "\ \ \ \ null" and "\ \ \ \ null" shows "inv \[cod \, cod \, cod \] \ (\ \ \ \ \) = ((\ \ \) \ \) \ inv \[dom \, dom \, dom \]" proof - have \\\: "arr \ \ arr \ \ arr \" using assms composable_implies_arr by simp have 0: "dom \ \ dom \ \ null \ dom \ \ dom \ \ null \ cod \ \ cod \ \ null \ cod \ \ cod \ \ null" using assms \\\ hom_connected by simp have 1: "\\ \ \ \ \ : dom \ \ dom \ \ dom \ \ cod \ \ cod \ \ cod \\" using assms match_4 by auto have 2: "\(\ \ \) \ \ : (dom \ \ dom \) \ dom \ \ (cod \ \ cod \) \ cod \\" using assms match_3 by auto have "(inv \[cod \, cod \, cod \] \ (\ \ \ \ \)) \ \[dom \, dom \, dom \] = (\ \ \) \ \" proof - have "(\ \ \) \ \ = (inv \[cod \, cod \, cod \] \ \[cod \, cod \, cod \]) \ ((\ \ \) \ \)" using 0 2 \\\ assoc_in_hom\<^sub>A\<^sub>W\<^sub>C iso_assoc\<^sub>A\<^sub>W\<^sub>C comp_inv_arr inv_is_inverse comp_cod_arr by auto thus ?thesis using assms \\\ 0 2 assoc_naturality\<^sub>A\<^sub>W\<^sub>C comp_assoc by metis qed thus ?thesis using 0 1 2 \\\ iso_assoc\<^sub>A\<^sub>W\<^sub>C assoc'_in_hom\<^sub>A\<^sub>W\<^sub>C inv_in_hom invert_side_of_triangle(2) by auto qed end subsection "Unitors" text \ For an associative weak composition with a chosen unit isomorphism \\ : a \ a \ a\, where \a\ is a weak unit, horizontal composition on the right by \a\ is a fully faithful endofunctor \R\ of the subcategory of arrows composable on the right with \a\, and is consequently an endo-equivalence of that subcategory. This equivalence, together with the associator isomorphisms and unit isomorphism \\\, canonically associate, with each identity arrow \f\ composable on the right with \a\, a \emph{right unit} isomorphism \\\[f] : f \ a \ f\\. These isomorphisms are the components of a natural isomorphism from \R\ to the identity functor. \ locale right_hom_with_unit = associative_weak_composition V H \ + right_hom V H a for V :: "'a comp" (infixr "\" 55) and H :: "'a comp" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: 'a and a :: 'a + assumes weak_unit_a: "weak_unit a" and \_in_hom: "\\ : a \ a \ a\" and iso_\: "iso \" begin abbreviation R where "R \ H\<^sub>R a" interpretation R: endofunctor S.comp R using weak_unit_a weak_unit_self_composable endofunctor_H\<^sub>R by simp interpretation R: fully_faithful_functor S.comp S.comp R using weak_unit_a weak_unit_def by simp lemma fully_faithful_functor_R: shows "fully_faithful_functor S.comp S.comp R" .. definition runit ("\[_]") where "runit f \ THE \. \\ : R f \\<^sub>S f\ \ R \ = (f \ \) \\<^sub>S \[f, a, a]" lemma iso_unit: shows "S.iso \" and "\\ : a \ a \\<^sub>S a\" proof - show "\\ : a \ a \\<^sub>S a\" using weak_unit_a S.ide_char S.arr_char right_def weak_unit_self_composable S.ideD(1) R.preserves_arr H\<^sub>R_def S.in_hom_char S.arr_char right_def \_in_hom S.ideD(1) hom_connected(3) in_homE by metis thus "S.iso \" using iso_\ iso_char by blast qed lemma characteristic_iso: assumes "S.ide f" shows "\\[f, a, a] : (f \ a) \ a \\<^sub>S f \ a \ a\" and "\f \ \ : f \ a \ a \\<^sub>S f \ a\" and "\(f \ \) \\<^sub>S \[f, a, a] : R (R f) \\<^sub>S R f\" and "S.iso ((f \ \) \\<^sub>S \[f, a, a])" proof - have f: "S.ide f \ ide f" using assms S.ide_char by simp have a: "weak_unit a \ ide a \ S.ide a" using weak_unit_a S.ide_char weak_unit_def S.arr_char right_def weak_unit_self_composable by metis have fa: "f \ a \ null \ (f \ a) \ a \ null \ ((f \ a) \ a) \ a \ null" using assms S.ideD(1) R.preserves_arr H\<^sub>R_def S.not_arr_null S.null_char by metis have aa: "a \ a \ null" using a S.ideD(1) R.preserves_arr H\<^sub>R_def S.not_arr_null weak_unit_self_composable by auto have f_ia: "f \ \ \ null" using assms S.ide_char right_def S.arr_char hom_connected(4) \_in_hom by auto show assoc_in_hom: "\\[f, a, a] : (f \ a) \ a \\<^sub>S f \ a \ a\" using a f fa hom_connected(1) [of "\[f, a, a]" a] S.arr_char right_def match_3 match_4 S.in_hom_char weak_unit_self_composable by auto show 1: "\f \ \ : f \ a \ a \\<^sub>S f \ a\" using a f fa iso_unit left_hcomp_closed by (simp add: f_ia ide_in_hom) have unit_part: "\f \ \ : f \ a \ a \\<^sub>S f \ a\ \ S.iso (f \ \)" proof - have "S.iso (f \ \)" using a f fa f_ia 1 VoV.arr_char VxV.inv_simp inv_in_hom hom_connected(2) [of f "inv \"] VoV.arr_char VoV.iso_char preserves_iso iso_char iso_\ S.dom_simp S.cod_simp by auto thus ?thesis using 1 by blast qed show "S.iso ((f \ \) \\<^sub>S \[f, a, a])" using assms a f fa aa hom_connected(1) [of "\[f, a, a]" a] right_def iso_assoc\<^sub>A\<^sub>W\<^sub>C iso_char S.arr_char unit_part assoc_in_hom isos_compose S.isos_compose S.seqI' by auto show "\(f \ \) \\<^sub>S \[f, a, a] : R (R f) \\<^sub>S R f\" unfolding H\<^sub>R_def using unit_part assoc_in_hom by blast qed lemma runit_char: assumes "S.ide f" shows "\\[f] : R f \\<^sub>S f\" and "R \[f] = (f \ \) \\<^sub>S \[f, a, a]" and "\!\. \\ : R f \\<^sub>S f\ \ R \ = (f \ \) \\<^sub>S \[f, a, a]" proof - let ?P = "\\. \\ : R f \\<^sub>S f\ \ R \ = (f \ \) \\<^sub>S \[f, a, a]" show "\!\. ?P \" proof - have "\\. ?P \" using assms S.ide_char S.arr_char R.preserves_ide characteristic_iso(3) R.is_full by auto moreover have "\\ \'. ?P \ \ ?P \' \ \ = \'" using R.is_faithful S.in_homE by metis ultimately show ?thesis by blast qed hence "?P (THE \. ?P \)" using theI' [of ?P] by fastforce hence 1: "?P \[f]" unfolding runit_def by blast show "\\[f] : R f \\<^sub>S f\" using 1 by fast show "R \[f] = (f \ \) \\<^sub>S \[f, a, a]" using 1 by fast qed lemma iso_runit: assumes "S.ide f" shows "S.iso \[f]" using assms characteristic_iso(4) runit_char R.reflects_iso by metis lemma runit_eqI: assumes "\f : a \\<^sub>S b\" and "\\ : R f \\<^sub>S f\" and "R \ = ((f \ \) \\<^sub>S \[f, a, a])" shows "\ = \[f]" using assms S.ide_cod runit_char [of f] by blast lemma runit_naturality: assumes "S.arr \" shows "\[S.cod \] \\<^sub>S R \ = \ \\<^sub>S \[S.dom \]" proof - have 1: "\\[S.cod \] \\<^sub>S R \ : R (S.dom \) \\<^sub>S S.cod \\" using assms runit_char(1) S.ide_cod by blast have 2: "S.par (\[S.cod \] \\<^sub>S R \) (\ \\<^sub>S \[S.dom \])" using assms 1 S.ide_dom runit_char(1) by (metis S.comp_in_homI' S.in_homE) moreover have "R (\[S.cod \] \\<^sub>S R \) = R (\ \\<^sub>S \[S.dom \])" proof - have 3: "\\ \ a \ a : S.dom \ \ a \ a \\<^sub>S S.cod \ \ a \ a\" using assms weak_unit_a R.preserves_hom H\<^sub>R_def S.arr_iff_in_hom S.arr_char by (metis match_4 weak_unit_in_vhom weak_unit_self_right S.in_hom_char left_hcomp_closed S.not_arr_null S.null_char) have 4: "R (\[S.cod \] \\<^sub>S R \) = R \[S.cod \] \\<^sub>S R (R \)" using assms 1 R.as_nat_trans.preserves_comp_2 by blast also have 5: "... = ((S.cod \ \ \) \\<^sub>S \[S.cod \, a, a]) \\<^sub>S ((\ \ a) \ a)" using assms R.preserves_arr runit_char S.ide_cod H\<^sub>R_def by auto also have 6: "... = (S.cod \ \ \) \\<^sub>S \[S.cod \, a, a] \\<^sub>S ((\ \ a) \ a)" using assms S.comp_assoc by simp also have "... = (S.cod \ \ \) \\<^sub>S (\ \ a \ a) \\<^sub>S \[S.dom \, a, a]" proof - have "(\ \ a \ a) \\<^sub>S \[S.dom \, a, a] = \[S.cod \, a, a] \\<^sub>S ((\ \ a) \ a)" proof - have "(\ \ a \ a) \\<^sub>S \[S.dom \, a, a] = (\ \ a \ a) \ \[S.dom \, a, a]" using assms 3 S.ide_dom characteristic_iso(1) S.in_hom_char S.comp_char S.dom_simp by fastforce also have "... = \[S.cod \, a, a] \ ((\ \ a) \ a)" using assms weak_unit_a assoc_naturality\<^sub>A\<^sub>W\<^sub>C [of \ a a] S.dom_simp S.cod_simp weak_unit_self_composable S.arr_char right_def by simp also have "... = \[S.cod \, a, a] \\<^sub>S ((\ \ a) \ a)" using S.in_hom_char S.comp_char by (metis 2 4 5 6 R.preserves_arr S.seq_char) finally show ?thesis by blast qed thus ?thesis by argo qed also have "... = ((S.cod \ \ \) \\<^sub>S (\ \ a \ a)) \\<^sub>S \[S.dom \, a, a]" using S.comp_assoc by auto also have "... = ((\ \ a) \\<^sub>S (S.dom \ \ \)) \\<^sub>S \[S.dom \, a, a]" proof - have "\ \ a \ a \ null" using 3 S.not_arr_null by auto moreover have "S.dom \ \ \ \ null" using assms S.not_arr_null by (metis S.dom_char \_in_hom calculation hom_connected(1-2) in_homE) ultimately have "(S.cod \ \ \) \\<^sub>S (\ \ a \ a) = (\ \ a) \\<^sub>S (S.dom \ \ \)" using assms weak_unit_a iso_unit S.comp_arr_dom S.comp_cod_arr interchange [of "S.cod \" \ \ "a \ a"] interchange [of \ "S.dom \" a \] by auto thus ?thesis by argo qed also have "... = (\ \ a) \\<^sub>S (S.dom \ \ \) \\<^sub>S \[S.dom \, a, a]" using S.comp_assoc by auto also have "... = R \ \\<^sub>S R \[S.dom \]" using assms runit_char(2) S.ide_dom H\<^sub>R_def by auto also have "... = R (\ \\<^sub>S \[S.dom \])" using assms S.arr_iff_in_hom [of \] runit_char(1) S.ide_dom by fastforce finally show ?thesis by blast qed ultimately show "\[S.cod \] \\<^sub>S (R \) = \ \\<^sub>S \[S.dom \]" using R.is_faithful by blast qed abbreviation \ where "\ \ \ if S.arr \ then \ \\<^sub>S \[S.dom \] else null" interpretation \: natural_transformation S.comp S.comp R S.map \ proof - interpret \: transformation_by_components S.comp S.comp R S.map runit using runit_char(1) runit_naturality by unfold_locales simp_all have "\.map = \" using \.is_extensional \.map_def \.naturality \.map_simp_ide S.ide_dom S.ide_cod S.map_def by auto thus "natural_transformation S.comp S.comp R S.map \" using \.natural_transformation_axioms by auto qed lemma natural_transformation_\: shows "natural_transformation S.comp S.comp R S.map \" .. interpretation \: natural_isomorphism S.comp S.comp R S.map \ using S.ide_is_iso iso_runit runit_char(1) S.isos_compose by unfold_locales force lemma natural_isomorphism_\: shows "natural_isomorphism S.comp S.comp R S.map \" .. interpretation R: equivalence_functor S.comp S.comp R using natural_isomorphism_\ R.isomorphic_to_identity_is_equivalence by blast lemma equivalence_functor_R: shows "equivalence_functor S.comp S.comp R" .. lemma runit_commutes_with_R: assumes "S.ide f" shows "\[R f] = R \[f]" using assms runit_char(1) R.preserves_hom [of "\[f]" "R f" f] runit_naturality iso_runit S.iso_is_section S.section_is_mono S.monoE by (metis S.in_homE S.seqI') end text \ Symmetric results hold for the subcategory of all arrows composable on the left with a specified weak unit \b\. This yields the \emph{left unitors}. \ locale left_hom_with_unit = associative_weak_composition V H \ + left_hom V H b for V :: "'a comp" (infixr "\" 55) and H :: "'a comp" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: 'a and b :: 'a + assumes weak_unit_b: "weak_unit b" and \_in_hom: "\\ : b \ b \ b\" and iso_\: "iso \" begin abbreviation L where "L \ H\<^sub>L b" interpretation L: endofunctor S.comp L using weak_unit_b weak_unit_self_composable endofunctor_H\<^sub>L by simp interpretation L: fully_faithful_functor S.comp S.comp L using weak_unit_b weak_unit_def by simp lemma fully_faithful_functor_L: shows "fully_faithful_functor S.comp S.comp L" .. definition lunit ("\[_]") where "lunit f \ THE \. \\ : L f \\<^sub>S f\ \ L \ = (\ \ f) \\<^sub>S (inv \[b, b, f])" lemma iso_unit: shows "S.iso \" and "\\ : b \ b \\<^sub>S b\" proof - show "\\ : b \ b \\<^sub>S b\" using weak_unit_b S.ide_char S.arr_char left_def weak_unit_self_composable S.ideD(1) L.preserves_arr H\<^sub>L_def S.in_hom_char S.arr_char left_def \_in_hom S.ideD(1) hom_connected(4) in_homE by metis thus "S.iso \" using iso_\ iso_char by blast qed lemma characteristic_iso: assumes "S.ide f" shows "\inv \[b, b, f] : b \ b \ f \\<^sub>S (b \ b) \ f\" and "\\ \ f : (b \ b) \ f \\<^sub>S b \ f\" and "\(\ \ f) \\<^sub>S inv \[b, b, f] : L (L f) \\<^sub>S L f\" and "S.iso ((\ \ f) \\<^sub>S inv \[b, b, f])" proof - have f: "S.ide f \ ide f" using assms S.ide_char by simp have b: "weak_unit b \ ide b \ S.ide b" using weak_unit_b S.ide_char weak_unit_def S.arr_char left_def weak_unit_self_composable by metis have bf: "b \ f \ null \ b \ b \ b \ f \ null" using assms S.ideD(1) L.preserves_arr H\<^sub>L_def S.not_arr_null S.null_char by metis have bb: "b \ b \ null" using b S.ideD(1) L.preserves_arr H\<^sub>L_def S.not_arr_null weak_unit_self_composable by auto have ib_f: "\ \ f \ null" using assms S.ide_char left_def S.arr_char hom_connected(3) \_in_hom by auto show assoc_in_hom: "\inv \[b, b, f] : b \ b \ f \\<^sub>S (b \ b) \ f\" using b f bf bb hom_connected(2) [of b "inv \[b, b, f]"] left_def by (metis S.arrI S.cod_closed S.in_hom_char assoc'_in_hom\<^sub>A\<^sub>W\<^sub>C(3) assoc'_simps\<^sub>A\<^sub>W\<^sub>C(2-3)) show 1: "\\ \ f : (b \ b) \ f \\<^sub>S b \ f\" using b f bf right_hcomp_closed by (simp add: ib_f ide_in_hom iso_unit(2)) have unit_part: "\\ \ f : (b \ b) \ f \\<^sub>S b \ f\ \ S.iso (\ \ f)" proof - have "S.iso (\ \ f)" using b f bf ib_f 1 VoV.arr_char VxV.inv_simp inv_in_hom hom_connected(1) [of "inv \" f] VoV.arr_char VoV.iso_char preserves_iso iso_char iso_\ S.dom_simp S.cod_simp by auto thus ?thesis using 1 by blast qed show "S.iso ((\ \ f) \\<^sub>S inv \[b, b, f])" using assms b f bf bb hom_connected(2) [of b "inv \[b, b, f]"] left_def iso_assoc\<^sub>A\<^sub>W\<^sub>C iso_char S.arr_char unit_part assoc_in_hom isos_compose S.isos_compose S.seqI' by auto show "\(\ \ f) \\<^sub>S inv \[b, b, f] : L (L f) \\<^sub>S L f\" unfolding H\<^sub>L_def using unit_part assoc_in_hom by blast qed lemma lunit_char: assumes "S.ide f" shows "\\[f] : L f \\<^sub>S f\" and "L \[f] = (\ \ f) \\<^sub>S inv \[b, b, f]" and "\!\. \\ : L f \\<^sub>S f\ \ L \ = (\ \ f) \\<^sub>S inv \[b, b, f]" proof - let ?P = "\\. \\ : L f \\<^sub>S f\ \ L \ = (\ \ f) \\<^sub>S inv \[b, b, f]" show "\!\. ?P \" proof - have "\\. ?P \" proof - have 1: "S.ide f" using assms S.ide_char S.arr_char by simp moreover have "S.ide (L f)" using 1 L.preserves_ide by simp ultimately show ?thesis using assms characteristic_iso(3) L.is_full by blast qed moreover have "\\ \'. ?P \ \ ?P \' \ \ = \'" using L.is_faithful S.in_homE by metis ultimately show ?thesis by blast qed hence "?P (THE \. ?P \)" using theI' [of ?P] by fastforce hence 1: "?P \[f]" unfolding lunit_def by blast show "\\[f] : L f \\<^sub>S f\" using 1 by fast show "L \[f] = (\ \ f) \\<^sub>S inv \[b, b, f]" using 1 by fast qed lemma iso_lunit: assumes "S.ide f" shows "S.iso \[f]" using assms characteristic_iso(4) lunit_char L.reflects_iso by metis lemma lunit_eqI: assumes "\f : a \\<^sub>S b\" and "\\ : L f \\<^sub>S f\" and "L \ = ((\ \ f) \\<^sub>S inv \[b, b, f])" shows "\ = \[f]" using assms S.ide_cod lunit_char [of f] by blast lemma lunit_naturality: assumes "S.arr \" shows "\[S.cod \] \\<^sub>S L \ = \ \\<^sub>S \[S.dom \]" proof - have 1: "\\[S.cod \] \\<^sub>S L \ : L (S.dom \) \\<^sub>S S.cod \\" using assms lunit_char(1) [of "S.cod \"] S.ide_cod by blast have "S.par (\[S.cod \] \\<^sub>S L \) (\ \\<^sub>S \[S.dom \])" using assms 1 S.ide_dom lunit_char(1) by (metis S.comp_in_homI' S.in_homE) moreover have "L (\[S.cod \] \\<^sub>S L \) = L (\ \\<^sub>S \[S.dom \])" proof - have 2: "\b \ b \ \ : b \ b \ S.dom \ \\<^sub>S b \ b \ S.cod \\" using assms weak_unit_b L.preserves_hom H\<^sub>L_def S.arr_iff_in_hom [of \] S.arr_char by simp have 3: "\(b \ b) \ \ : (b \ b) \ S.dom \ \\<^sub>S (b \ b) \ S.cod \\" using assms weak_unit_b L.preserves_hom H\<^sub>L_def S.arr_iff_in_hom S.arr_char by (metis match_3 weak_unit_in_vhom weak_unit_self_left S.in_hom_char S.not_arr_null S.null_char right_hcomp_closed) have "L (\[S.cod \] \\<^sub>S L \) = L \[S.cod \] \\<^sub>S L (L \)" using assms 1 L.as_nat_trans.preserves_comp_2 by blast also have "... = ((\ \ S.cod \) \\<^sub>S inv \[b, b, S.cod \]) \\<^sub>S (b \ b \ \)" using assms L.preserves_arr lunit_char S.ide_cod H\<^sub>L_def by auto also have "... = (\ \ S.cod \) \\<^sub>S inv \[b, b, S.cod \] \\<^sub>S (b \ b \ \)" using S.comp_assoc by auto also have "... = (\ \ S.cod \) \\<^sub>S ((b \ b) \ \) \\<^sub>S inv \[b, b, S.dom \]" proof - have "inv \[b, b, S.cod \] \\<^sub>S (b \ b \ \) = ((b \ b) \ \) \\<^sub>S inv \[b, b, S.dom \]" proof - have "((b \ b) \ \) \\<^sub>S inv \[b, b, S.dom \] = ((b \ b) \ \) \ inv \[b, b, S.dom \]" using assms 3 S.in_hom_char S.comp_char [of "(b \ b) \ \" "inv \[b, b, S.dom \]"] by (metis S.ide_dom characteristic_iso(1) ext) also have "... = inv \[b, b, S.cod \] \ (b \ b \ \)" using assms weak_unit_b assoc'_naturality\<^sub>A\<^sub>W\<^sub>C [of b b \] S.dom_simp S.cod_simp weak_unit_self_composable S.arr_char left_def by simp also have "... = inv \[b, b, S.cod \] \\<^sub>S (b \ b \ \)" using assms 2 S.in_hom_char S.comp_char by (metis S.comp_simp S.ide_cod S.seqI' characteristic_iso(1)) finally show ?thesis by argo qed thus ?thesis by argo qed also have "... = ((\ \ S.cod \) \\<^sub>S ((b \ b) \ \)) \\<^sub>S inv \[b, b, S.dom \]" using S.comp_assoc by auto also have "... = ((b \ \) \\<^sub>S (\ \ S.dom \)) \\<^sub>S inv \[b, b, S.dom \]" proof - have "(b \ b) \ \ \ null" using 3 S.not_arr_null by (elim S.in_homE, auto) moreover have "\ \ S.dom \ \ null" using assms S.not_arr_null by (metis S.dom_char \_in_hom calculation hom_connected(1-2) in_homE) ultimately have "(\ \ S.cod \) \\<^sub>S ((b \ b) \ \) = (b \ \) \\<^sub>S (\ \ S.dom \)" using assms weak_unit_b iso_unit S.comp_arr_dom S.comp_cod_arr interchange [of \ "b \ b" "S.cod \" \ ] interchange [of b \ \ "S.dom \"] by auto thus ?thesis by argo qed also have "... = (b \ \) \\<^sub>S (\ \ S.dom \) \\<^sub>S inv \[b, b, S.dom \]" using S.comp_assoc by auto also have "... = L \ \\<^sub>S L \[S.dom \]" using assms lunit_char(2) S.ide_dom H\<^sub>L_def by auto also have "... = L (\ \\<^sub>S \[S.dom \])" using assms S.arr_iff_in_hom [of \] lunit_char(1) S.ide_dom S.seqI by fastforce finally show ?thesis by blast qed ultimately show "\[S.cod \] \\<^sub>S L \ = \ \\<^sub>S \[S.dom \]" using L.is_faithful by blast qed abbreviation \ where "\ \ \ if S.arr \ then \ \\<^sub>S \[S.dom \] else null" interpretation \: natural_transformation S.comp S.comp L S.map \ proof - interpret \: transformation_by_components S.comp S.comp L S.map lunit using lunit_char(1) lunit_naturality by (unfold_locales, simp_all) have "\.map = \" using \.is_extensional \.map_def \.naturality \.map_simp_ide S.ide_dom S.ide_cod S.map_def by auto thus "natural_transformation S.comp S.comp L S.map \" using \.natural_transformation_axioms by auto qed lemma natural_transformation_\: shows "natural_transformation S.comp S.comp L S.map \" .. interpretation \: natural_isomorphism S.comp S.comp L S.map \ using S.ide_is_iso iso_lunit lunit_char(1) S.isos_compose by (unfold_locales, force) lemma natural_isomorphism_\: shows "natural_isomorphism S.comp S.comp L S.map \" .. interpretation L: equivalence_functor S.comp S.comp L using natural_isomorphism_\ L.isomorphic_to_identity_is_equivalence by blast lemma equivalence_functor_L: shows "equivalence_functor S.comp S.comp L" .. lemma lunit_commutes_with_L: assumes "S.ide f" shows "\[L f] = L \[f]" using assms lunit_char(1) L.preserves_hom [of "\[f]" "L f" f] lunit_naturality iso_lunit S.iso_is_section S.section_is_mono S.monoE by (metis S.in_homE S.seqI') end subsection "Prebicategories" text \ A \emph{prebicategory} is an associative weak composition satisfying the additional assumption that every arrow has a source and a target. \ locale prebicategory = associative_weak_composition + assumes arr_has_source: "arr \ \ sources \ \ {}" and arr_has_target: "arr \ \ targets \ \ {}" begin lemma arr_iff_has_src: shows "arr \ \ sources \ \ {}" using arr_has_source composable_implies_arr by auto lemma arr_iff_has_trg: shows "arr \ \ targets \ \ {}" using arr_has_target composable_implies_arr by auto end text \ The horizontal composition of a prebicategory is regular. \ sublocale prebicategory \ regular_weak_composition V H proof show "\a f. a \ sources f \ ide f \ f \ a \ f" proof - fix a f assume a: "a \ sources f" and f: "ide f" interpret Right_a: subcategory V \right a\ using a right_hom_is_subcategory weak_unit_self_composable by force interpret Right_a: right_hom_with_unit V H \ \some_unit a\ a using a iso_some_unit by (unfold_locales, auto) show "f \ a \ f" proof - have "Right_a.ide f" using a f Right_a.ide_char Right_a.arr_char right_def by auto hence "Right_a.iso (Right_a.runit f) \ (Right_a.runit f) \ Right_a.hom (f \ a) f" using Right_a.iso_runit Right_a.runit_char(1) H\<^sub>R_def by simp hence "iso (Right_a.runit f) \ (Right_a.runit f) \ hom (f \ a) f" using Right_a.iso_char Right_a.hom_char by auto thus ?thesis using f isomorphic_def by auto qed qed show "\b f. b \ targets f \ ide f \ b \ f \ f" proof - fix b f assume b: "b \ targets f" and f: "ide f" interpret Left_b: subcategory V \left b\ using b left_hom_is_subcategory weak_unit_self_composable by force interpret Left_b: left_hom_with_unit V H \ \some_unit b\ b using b iso_some_unit by (unfold_locales, auto) show "b \ f \ f" proof - have "Left_b.ide f" using b f Left_b.ide_char Left_b.arr_char left_def by auto hence "Left_b.iso (Left_b.lunit f) \ (Left_b.lunit f) \ Left_b.hom (b \ f) f" using b f Left_b.iso_lunit Left_b.lunit_char(1) H\<^sub>L_def by simp hence "iso (Left_b.lunit f) \ (Left_b.lunit f) \ hom (b \ f) f" using Left_b.iso_char Left_b.hom_char by auto thus ?thesis using isomorphic_def by auto qed qed qed text \ The regularity allows us to show that, in a prebicategory, all sources of a given arrow are isomorphic, and similarly for targets. \ context prebicategory begin lemma sources_are_isomorphic: assumes "a \ sources \" and "a' \ sources \" shows "a \ a'" proof - have \: "arr \" using assms composable_implies_arr by auto have "\f. \ ide f; a \ sources f; a' \ sources f \ \ a \ a'" using \ assms(1) comp_ide_source comp_target_ide [of a a'] weak_unit_self_composable(1) [of a] weak_unit_self_composable(1) [of a'] isomorphic_transitive isomorphic_symmetric sources_determine_composability sourcesD(2-3) by (metis (full_types) connected_if_composable) moreover have "ide (dom \) \ a \ sources (dom \) \ a' \ sources (dom \)" using assms \ sources_dom by auto ultimately show ?thesis by auto qed lemma targets_are_isomorphic: assumes "b \ targets \" and "b' \ targets \" shows "b \ b'" proof - have \: "arr \" using assms composable_implies_arr by auto have "\f. \ ide f; b \ targets f; b' \ targets f \ \ b \ b'" by (metis connected_if_composable sources_are_isomorphic targetsD(3)) moreover have "ide (dom \) \ b \ targets (dom \) \ b' \ targets (dom \)" using assms \ targets_dom [of \] by auto ultimately show ?thesis by auto qed text \ In fact, we now show that the sets of sources and targets of a 2-cell are isomorphism-closed, and hence are isomorphism classes. We first show that the notion ``weak unit'' is preserved under isomorphism. \ interpretation H: partial_magma H using is_partial_magma by auto lemma isomorphism_respects_weak_units: assumes "weak_unit a" and "a \ a'" shows "weak_unit a'" proof - obtain \ where \: "iso \ \ \\ : a \ a'\" using assms by auto interpret Left_a: subcategory V \left a\ using assms left_hom_is_subcategory by fastforce interpret Left_a: left_hom_with_unit V H \ \some_unit a\ a using assms iso_some_unit weak_unit_self_composable apply unfold_locales by auto interpret Right_a: subcategory V "right a" using assms right_hom_is_subcategory by fastforce interpret Right_a: right_hom_with_unit V H \ \some_unit a\ a using assms iso_some_unit weak_unit_self_composable apply unfold_locales by auto have a': "ide a' \ a \ a' \ null \ a' \ a \ null \ a' \ a' \ null \ \ \ a' \ null \ Left_a.ide a'" by (metis (no_types, lifting) Left_a.left_hom_axioms Right_a.weak_unit_a \ assms(2) ide_cod hom_connected(1) in_homE isomorphic_implies_equicomposable(1) left_def left_hom_def subcategory.ideI isomorphic_implies_equicomposable(2) weak_unit_self_composable(3)) have iso: "a' \ a' \ a'" proof - have 1: "Right a' = Right a" using assms right_respects_isomorphic by simp interpret Right_a': subcategory V \right a'\ using assms right_hom_is_subcategory by fastforce (* TODO: The previous interpretation brings in unwanted notation for in_hom. *) interpret Ra': endofunctor \Right a'\ \H\<^sub>R a'\ using assms a' endofunctor_H\<^sub>R by auto let ?\ = "Left_a.lunit a' \ inv (\ \ a')" have "iso ?\ \ \?\ : a' \ a' \ a'\" proof - have "iso (Left_a.lunit a') \ \Left_a.lunit a' : a \ a' \ a'\" using a' Left_a.lunit_char(1) Left_a.iso_lunit Left_a.iso_char Left_a.in_hom_char H\<^sub>L_def by auto moreover have "iso (\ \ a') \ \\ \ a' : a \ a' \ a' \ a'\" using a' \ 1 Right_a'.arr_char Right_a'.in_hom_char Right_a.iso_char right_def Ra'.preserves_iso Ra'.preserves_hom Right_a'.iso_char Ra'.preserves_dom Ra'.preserves_cod Right_a'.arr_iff_in_hom H\<^sub>R_def by metis ultimately show ?thesis using isos_compose by blast qed thus ?thesis using isomorphic_def by auto qed text \ We show that horizontal composition on the left and right by @{term a'} is naturally isomorphic to the identity functor. This follows from the fact that if @{term a} is isomorphic to @{term a'}, then horizontal composition with @{term a} is naturally isomorphic to horizontal composition with @{term a'}, hence the latter is naturally isomorphic to the identity if the former is. This is conceptually simple, but there are tedious composability details to handle. \ have 1: "Left a' = Left a \ Right a' = Right a" using assms left_respects_isomorphic right_respects_isomorphic by simp interpret L: fully_faithful_functor \Left a\ \Left a\ \H\<^sub>L a\ using assms weak_unit_def by simp interpret L': endofunctor \Left a\ \H\<^sub>L a'\ using a' 1 endofunctor_H\<^sub>L [of a'] by auto interpret \: natural_isomorphism \Left a\ \Left a\ \H\<^sub>L a\ \H\<^sub>L a'\ \H\<^sub>L \\ proof fix \ show "\ Left_a.arr \ \ H\<^sub>L \ \ = Left_a.null" using left_def \ H\<^sub>L_def hom_connected(1) Left_a.null_char null_agreement Left_a.arr_char by auto assume "Left_a.arr \" hence \: "Left_a.arr \ \ arr \ \ a \ \ \ null" using Left_a.arr_char left_def composable_implies_arr by simp have 2: "\ \ \ \ null" using assms \ \ Left_a.arr_char left_def hom_connected by auto show "Left_a.dom (H\<^sub>L \ \) = H\<^sub>L a (Left_a.dom \)" using assms 2 \ \ Left_a.arr_char left_def hom_connected(2) [of a \] weak_unit_self_composable match_4 Left_a.dom_char H\<^sub>L_def by auto show "Left_a.cod (H\<^sub>L \ \) = H\<^sub>L a' (Left_a.cod \)" using assms 2 \ \ Left_a.arr_char left_def hom_connected(2) [of a \] weak_unit_self_composable match_4 Left_a.cod_char H\<^sub>L_def by auto show "Left_a.comp (H\<^sub>L a' \) (H\<^sub>L \ (Left_a.dom \)) = H\<^sub>L \ \" proof - have "Left_a.comp (H\<^sub>L a' \) (H\<^sub>L \ (Left_a.dom \)) = Left_a.comp (a' \ \) (\ \ dom \)" using assms 1 2 \ \ Left_a.dom_char left_def H\<^sub>L_def by simp also have "... = (a' \ \) \ (\ \ dom \)" proof - have "Left_a.seq (a' \ \) (\ \ dom \)" proof (intro Left_a.seqI) show 3: "Left_a.arr (\ \ dom \)" using assms 2 \ \ Left_a.arr_char left_def by (metis H\<^sub>L_def L'.preserves_arr hcomp_simps\<^sub>W\<^sub>C(1) in_homE right_connected paste_1) show 4: "Left_a.arr (a' \ \)" using \ H\<^sub>L_def L'.preserves_arr by auto show "Left_a.dom (a' \ \) = Left_a.cod (\ \ dom \)" using a' \ \ 2 3 4 Left_a.dom_char Left_a.cod_char by (metis Left_a.seqE Left_a.seq_char hcomp_simps\<^sub>W\<^sub>C(1) in_homE paste_1) qed thus ?thesis using Left_a.comp_char Left_a.arr_char left_def by auto qed also have "... = a' \ \ \ \ \ dom \" using a' \ \ interchange hom_connected by auto also have "... = \ \ \" using \ \ comp_arr_dom comp_cod_arr by auto finally show ?thesis using H\<^sub>L_def by simp qed show "Left_a.comp (H\<^sub>L \ (Left_a.cod \)) (Left_a.L \) = H\<^sub>L \ \" proof - have "Left_a.comp (H\<^sub>L \ (Left_a.cod \)) (Left_a.L \) = Left_a.comp (\ \ cod \) (a \ \)" using assms 1 2 \ \ Left_a.cod_char left_def H\<^sub>L_def by simp also have "... = (\ \ cod \) \ (a \ \)" proof - have "Left_a.seq (\ \ cod \) (a \ \)" proof (intro Left_a.seqI) show 3: "Left_a.arr (\ \ cod \)" using \ \ 2 Left_a.arr_char left_def by (metis (no_types, lifting) H\<^sub>L_def L.preserves_arr hcomp_simps\<^sub>W\<^sub>C(1) in_homE right_connected paste_2) show 4: "Left_a.arr (a \ \)" using assms \ Left_a.arr_char left_def using H\<^sub>L_def L.preserves_arr by auto show "Left_a.dom (\ \ cod \) = Left_a.cod (a \ \)" using assms \ \ 2 3 4 Left_a.dom_char Left_a.cod_char by (metis Left_a.seqE Left_a.seq_char hcomp_simps\<^sub>W\<^sub>C(1) in_homE paste_2) qed thus ?thesis using Left_a.comp_char Left_a.arr_char left_def by auto qed also have "... = \ \ a \ cod \ \ \" using \ \ interchange hom_connected by auto also have "... = \ \ \" using \ \ comp_arr_dom comp_cod_arr by auto finally show ?thesis using H\<^sub>L_def by simp qed next fix \ assume \: "Left_a.ide \" have 1: "\ \ \ \ null" using assms \ \ Left_a.ide_char Left_a.arr_char left_def hom_connected by auto show "Left_a.iso (H\<^sub>L \ \)" proof - have "iso (\ \ \)" proof - have "a \ sources \ \ targets \" using assms \ \ 1 hom_connected weak_unit_self_composable Left_a.ide_char Left_a.arr_char left_def connected_if_composable by auto thus ?thesis using \ \ Left_a.ide_char ide_is_iso iso_hcomp\<^sub>R\<^sub>W\<^sub>C(1) by blast qed moreover have "left a (\ \ \)" using assms 1 \ weak_unit_self_composable hom_connected(2) [of a \] left_def match_4 null_agreement by auto ultimately show ?thesis using Left_a.iso_char Left_a.arr_char left_iff_left_inv Left_a.inv_char H\<^sub>L_def by metis qed qed interpret L': equivalence_functor \Left a'\ \Left a'\ \H\<^sub>L a'\ proof - have "naturally_isomorphic (Left a') (Left a') (H\<^sub>L a') (identity_functor.map (Left a'))" proof - have "naturally_isomorphic (Left a) (Left a) (H\<^sub>L a') (identity_functor.map (Left a))" by (meson Left_a.natural_isomorphism_\ \.natural_isomorphism_axioms naturally_isomorphic_def naturally_isomorphic_symmetric naturally_isomorphic_transitive) thus ?thesis using 1 by auto qed thus "equivalence_functor (Left a') (Left a') (H\<^sub>L a')" using 1 L'.isomorphic_to_identity_is_equivalence naturally_isomorphic_def by fastforce qed text \ Now we do the same for \R'\. \ interpret R: fully_faithful_functor \Right a\ \Right a\ \H\<^sub>R a\ using assms weak_unit_def by simp interpret R': endofunctor \Right a\ \H\<^sub>R a'\ using a' 1 endofunctor_H\<^sub>R [of a'] by auto interpret \: natural_isomorphism \Right a\ \Right a\ \H\<^sub>R a\ \H\<^sub>R a'\ \H\<^sub>R \\ proof fix \ show "\ Right_a.arr \ \ H\<^sub>R \ \ = Right_a.null" using right_def \ H\<^sub>R_def hom_connected Right_a.null_char Right_a.arr_char by auto assume "Right_a.arr \" hence \: "Right_a.arr \ \ arr \ \ \ \ a \ null" using Right_a.arr_char right_def composable_implies_arr by simp have 2: "\ \ \ \ null" using assms \ \ Right_a.arr_char right_def hom_connected by auto show "Right_a.dom (H\<^sub>R \ \) = H\<^sub>R a (Right_a.dom \)" - using assms 2 \ \ Right_a.arr_char right_def hom_connected(1) [of \ a] - weak_unit_self_composable match_3 Right_a.dom_char H\<^sub>R_def - by auto + by (metis "2" H\<^sub>R_def R'.is_extensional Right_a.dom_simp Right_a.null_char + \Right_a.arr \\ \ a' hcomp_simps\<^sub>W\<^sub>C(2) in_homE match_3) show "Right_a.cod (H\<^sub>R \ \) = H\<^sub>R a' (Right_a.cod \)" using assms 2 a' \ \ Right_a.arr_char right_def hom_connected(3) [of \ a] weak_unit_self_composable match_3 Right_a.cod_char H\<^sub>R_def by auto show "Right_a.comp (H\<^sub>R a' \) (H\<^sub>R \ (Right_a.dom \)) = H\<^sub>R \ \" proof - have "Right_a.comp (H\<^sub>R a' \) (H\<^sub>R \ (Right_a.dom \)) = Right_a.comp (\ \ a') (dom \ \ \)" using assms 1 2 \ \ Right_a.dom_char right_def H\<^sub>R_def by simp also have "... = (\ \ a') \ (dom \ \ \)" proof - have "Right_a.seq (\ \ a') (dom \ \ \)" proof (intro Right_a.seqI) show 3: "Right_a.arr (dom \ \ \)" using assms 2 \ \ Right_a.arr_char right_def by (metis H\<^sub>R_def R'.preserves_arr hcomp_simps\<^sub>W\<^sub>C(1) in_homE left_connected paste_2) show 4: "Right_a.arr (\ \ a')" using \ H\<^sub>R_def R'.preserves_arr by auto show "Right_a.dom (\ \ a') = Right_a.cod (dom \ \ \)" using a' \ \ 2 3 4 Right_a.dom_char Right_a.cod_char by (metis Right_a.seqE Right_a.seq_char hcomp_simps\<^sub>W\<^sub>C(1) in_homE paste_2) qed thus ?thesis using Right_a.comp_char Right_a.arr_char right_def by auto qed also have "... = \ \ dom \ \ a' \ \" using a' \ \ interchange hom_connected by auto also have "... = \ \ \" using \ \ comp_arr_dom comp_cod_arr by auto finally show ?thesis using H\<^sub>R_def by simp qed show "Right_a.comp (H\<^sub>R \ (Right_a.cod \)) (Right_a.R \) = H\<^sub>R \ \" proof - have "Right_a.comp (H\<^sub>R \ (Right_a.cod \)) (Right_a.R \) = Right_a.comp (cod \ \ \) (\ \ a)" using assms 1 2 \ \ Right_a.cod_char right_def H\<^sub>R_def by simp also have "... = (cod \ \ \) \ (\ \ a)" proof - have "Right_a.seq (cod \ \ \) (\ \ a)" proof (intro Right_a.seqI) show 3: "Right_a.arr (cod \ \ \)" using \ \ 2 Right_a.arr_char right_def by (metis (no_types, lifting) H\<^sub>R_def R.preserves_arr hcomp_simps\<^sub>W\<^sub>C(1) in_homE left_connected paste_1) show 4: "Right_a.arr (\ \ a)" using assms \ Right_a.arr_char right_def using H\<^sub>R_def R.preserves_arr by auto show "Right_a.dom (cod \ \ \) = Right_a.cod (\ \ a)" using assms \ \ 2 3 4 Right_a.dom_char Right_a.cod_char by (metis Right_a.seqE Right_a.seq_char hcomp_simps\<^sub>W\<^sub>C(1) in_homE paste_1) qed thus ?thesis using Right_a.comp_char Right_a.arr_char right_def by auto qed also have "... = cod \ \ \ \ \ \ a" using \ \ interchange hom_connected by auto also have "... = \ \ \" using \ \ comp_arr_dom comp_cod_arr by auto finally show ?thesis using H\<^sub>R_def by simp qed next fix \ assume \: "Right_a.ide \" have 1: "\ \ \ \ null" using assms \ \ Right_a.ide_char Right_a.arr_char right_def hom_connected by auto show "Right_a.iso (H\<^sub>R \ \)" proof - have "iso (\ \ \)" proof - have "a \ targets \ \ sources \" using assms \ \ 1 hom_connected weak_unit_self_composable Right_a.ide_char Right_a.arr_char right_def connected_if_composable by (metis (full_types) IntI targetsI) thus ?thesis using \ \ Right_a.ide_char ide_is_iso iso_hcomp\<^sub>R\<^sub>W\<^sub>C(1) by blast qed moreover have "right a (\ \ \)" using assms 1 \ weak_unit_self_composable hom_connected(1) [of \ a] right_def match_3 null_agreement by auto ultimately show ?thesis using Right_a.iso_char Right_a.arr_char right_iff_right_inv Right_a.inv_char H\<^sub>R_def by metis qed qed interpret R': equivalence_functor \Right a'\ \Right a'\ \H\<^sub>R a'\ proof - have "naturally_isomorphic (Right a') (Right a') (H\<^sub>R a') (identity_functor.map (Right a'))" proof - have "naturally_isomorphic (Right a) (Right a) (H\<^sub>R a') Right_a.map" by (meson Right_a.natural_isomorphism_\ \.natural_isomorphism_axioms naturally_isomorphic_def naturally_isomorphic_symmetric naturally_isomorphic_transitive) thus ?thesis using 1 by auto qed thus "equivalence_functor (Right a') (Right a') (H\<^sub>R a')" using 1 R'.isomorphic_to_identity_is_equivalence naturally_isomorphic_def by fastforce qed show "weak_unit a'" using weak_unit_def iso L'.fully_faithful_functor_axioms R'.fully_faithful_functor_axioms by blast qed lemma sources_iso_closed: assumes "a \ sources \" and "a \ a'" shows "a' \ sources \" using assms isomorphism_respects_weak_units isomorphic_implies_equicomposable by blast lemma targets_iso_closed: assumes "a \ targets \" and "a \ a'" shows "a' \ targets \" using assms isomorphism_respects_weak_units isomorphic_implies_equicomposable by blast lemma sources_eqI: assumes "sources \ \ sources \ \ {}" shows "sources \ = sources \" using assms sources_iso_closed sources_are_isomorphic by blast lemma targets_eqI: assumes "targets \ \ targets \ \ {}" shows "targets \ = targets \" using assms targets_iso_closed targets_are_isomorphic by blast text \ The sets of sources and targets of a weak unit are isomorphism classes. \ lemma sources_char: assumes "weak_unit a" shows "sources a = {x. x \ a}" using assms sources_iso_closed weak_unit_iff_self_source sources_are_isomorphic isomorphic_symmetric by blast lemma targets_char: assumes "weak_unit a" shows "targets a = {x. x \ a}" using assms targets_iso_closed weak_unit_iff_self_target targets_are_isomorphic isomorphic_symmetric by blast end section "Horizontal Homs" text \ Here we define a locale that axiomatizes a (vertical) category \V\ that has been punctuated into ``horizontal homs'' by the choice of idempotent endofunctors \src\ and \trg\ that assign a specific ``source'' and ``target'' 1-cell to each of its arrows. The functors \src\ and \trg\ are also subject to further conditions that constrain how they commute with each other. \ locale horizontal_homs = category V + src: endofunctor V src + trg: endofunctor V trg for V :: "'a comp" (infixr "\" 55) and src :: "'a \ 'a" and trg :: "'a \ 'a" + assumes ide_src [simp]: "arr \ \ ide (src \)" and ide_trg [simp]: "arr \ \ ide (trg \)" and src_src [simp]: "arr \ \ src (src \) = src \" and trg_trg [simp]: "arr \ \ trg (trg \) = trg \" and trg_src [simp]: "arr \ \ trg (src \) = src \" and src_trg [simp]: "arr \ \ src (trg \) = trg \" begin no_notation in_hom ("\_ : _ \ _\") notation in_hom ("\_ : _ \ _\") text \ We define an \emph{object} to be an arrow that is its own source (or equivalently, its own target). \ definition obj where "obj a \ arr a \ src a = a" lemma obj_def': shows "obj a \ arr a \ trg a = a" using trg_src src_trg obj_def by metis lemma objI_src: assumes "arr a" and "src a = a" shows "obj a" using assms obj_def by simp lemma objI_trg: assumes "arr a" and "trg a = a" shows "obj a" using assms obj_def' by simp lemma objE [elim]: assumes "obj a" and "\ ide a; src a = a; trg a = a \ \ T" shows T using assms obj_def obj_def' ide_src ide_trg by metis (* * I believe I have sorted out the looping issues that were making these less than * useful, but do not make them default simps because it slows things down too much * and they are not used all that often. *) lemma obj_simps (* [simp] *): assumes "obj a" shows "arr a" and "src a = a" and "trg a = a" and "dom a = a" and "cod a = a" using assms by auto lemma obj_src [intro, simp]: assumes "arr \" shows "obj (src \)" using assms objI_src by auto lemma obj_trg [intro, simp]: assumes "arr \" shows "obj (trg \)" using assms objI_trg by auto definition in_hhom ("\_ : _ \ _\") where "in_hhom \ a b \ arr \ \ src \ = a \ trg \ = b" abbreviation hhom where "hhom a b \ {\. \\ : a \ b\}" abbreviation (input) hseq\<^sub>H\<^sub>H where "hseq\<^sub>H\<^sub>H \ \\ \. arr \ \ arr \ \ src \ = trg \" lemma in_hhomI [intro, simp]: assumes "arr \" and "src \ = a" and "trg \ = b" shows "\\ : a \ b\" using assms in_hhom_def by auto lemma in_hhomE [elim]: assumes "\\ : a \ b\" and "\ arr \; obj a; obj b; src \ = a; trg \ = b \ \ T" shows "T" using assms in_hhom_def by auto (* * TODO: I tried removing the second assertion here, thinking that it should already * be covered by the category locale, but in fact it breaks some proofs in * SpanBicategory that ought to be trivial. So it seems that the presence of * this introduction rule adds something, and I should consider whether this rule * should be added to the category locale. *) lemma ide_in_hom [intro]: assumes "ide f" shows "\f : src f \ trg f\" and "\f : f \ f\" using assms by auto lemma src_dom [simp]: shows "src (dom \) = src \" by (metis arr_dom_iff_arr obj_simps(4) obj_src src.is_extensional src.preserves_dom) lemma src_cod [simp]: shows "src (cod \) = src \" by (metis arr_cod_iff_arr obj_simps(5) obj_src src.is_extensional src.preserves_cod) lemma trg_dom [simp]: shows "trg (dom \) = trg \" by (metis arr_dom_iff_arr ide_char ide_trg trg.is_extensional trg.preserves_dom) lemma trg_cod [simp]: shows "trg (cod \) = trg \" by (metis arr_cod_iff_arr ide_char ide_trg trg.is_extensional trg.preserves_cod) (* * TODO: In theory, the following simps should already be available from the fact * that src and trg are endofunctors. But they seem not to get used. *) lemma dom_src [simp]: shows "dom (src \) = src \" by (metis dom_null ideD(2) ide_src src.is_extensional) lemma cod_src [simp]: shows "cod (src \) = src \" by (metis cod_null ideD(3) ide_src src.is_extensional) lemma dom_trg [simp]: shows "dom (trg \) = trg \" by (metis dom_null ideD(2) ide_trg trg.is_extensional) lemma cod_trg [simp]: shows "cod (trg \) = trg \" by (metis cod_null ideD(3) ide_trg trg.is_extensional) lemma vcomp_in_hhom [intro, simp]: assumes "seq \ \" and "src \ = a" and "trg \ = b" shows "\\ \ \ : a \ b\" using assms src_cod [of "\ \ \"] trg_cod [of "\ \ \"] by auto lemma src_vcomp [simp]: assumes "seq \ \" shows "src (\ \ \) = src \" using assms src_cod [of "\ \ \"] by auto lemma trg_vcomp [simp]: assumes "seq \ \" shows "trg (\ \ \) = trg \" using assms trg_cod [of "\ \ \"] by auto lemma vseq_implies_hpar: assumes "seq \ \" shows "src \ = src \" and "trg \ = trg \" using assms src_dom [of "\ \ \"] trg_dom [of "\ \ \"] src_cod [of "\ \ \"] trg_cod [of "\ \ \"] by auto lemma vconn_implies_hpar: assumes "\\ : f \ g\" shows "src \ = src f" and "trg \ = trg f" and "src g = src f" and "trg g = trg f" using assms by auto lemma src_inv [simp]: assumes "iso \" shows "src (inv \) = src \" using assms inv_in_hom iso_is_arr src_dom src_cod iso_inv_iso dom_inv by metis lemma trg_inv [simp]: assumes "iso \" shows "trg (inv \) = trg \" using assms inv_in_hom iso_is_arr trg_dom trg_cod iso_inv_iso cod_inv by metis lemma inv_in_hhom [intro, simp]: assumes "iso \" and "src \ = a" and "trg \ = b" shows "\inv \ : a \ b\" using assms iso_is_arr by simp lemma hhom_is_subcategory: shows "subcategory V (\\. \\ : a \ b\)" using src_dom trg_dom src_cod trg_cod by (unfold_locales, auto) lemma isomorphic_objects_are_equal: assumes "obj a" and "obj b" and "a \ b" shows "a = b" using assms isomorphic_def by (metis dom_inv in_homE objE src_dom src_inv) text \ Having the functors \src\ and \trg\ allows us to form categories VV and VVV of formally horizontally composable pairs and triples of arrows. \ sublocale VxV: product_category V V .. sublocale VV: subcategory VxV.comp \\\\. hseq\<^sub>H\<^sub>H (fst \\) (snd \\)\ by (unfold_locales, auto) lemma subcategory_VV: shows "subcategory VxV.comp (\\\. hseq\<^sub>H\<^sub>H (fst \\) (snd \\))" .. sublocale VxVxV: product_category V VxV.comp .. sublocale VVV: subcategory VxVxV.comp \\\\\. arr (fst \\\) \ VV.arr (snd \\\) \ src (fst \\\) = trg (fst (snd \\\))\ using VV.arr_char by (unfold_locales, auto) lemma subcategory_VVV: shows "subcategory VxVxV.comp (\\\\. arr (fst \\\) \ VV.arr (snd \\\) \ src (fst \\\) = trg (fst (snd \\\)))" .. end subsection "Prebicategories with Homs" text \ A \emph{weak composition with homs} consists of a weak composition that is equipped with horizontal homs in such a way that the chosen source and target of each 2-cell \\\ in fact lie in the set of sources and targets, respectively, of \\\, such that horizontal composition respects the chosen sources and targets, and such that if 2-cells \\\ and \\\ are horizontally composable, then the chosen target of \\\ coincides with the chosen source of \\\. \ locale weak_composition_with_homs = weak_composition + horizontal_homs + assumes src_in_sources: "arr \ \ src \ \ sources \" and trg_in_targets: "arr \ \ trg \ \ targets \" and src_hcomp': "\ \ \ \ null \ src (\ \ \) = src \" and trg_hcomp': "\ \ \ \ null \ trg (\ \ \) = trg \" and seq_if_composable: "\ \ \ \ null \ src \ = trg \" locale prebicategory_with_homs = prebicategory + weak_composition_with_homs begin lemma composable_char\<^sub>P\<^sub>B\<^sub>H: shows "\ \ \ \ null \ arr \ \ arr \ \ src \ = trg \" using trg_in_targets src_in_sources composable_if_connected sourcesD(3) targets_determine_composability seq_if_composable composable_implies_arr by metis lemma hcomp_in_hom\<^sub>P\<^sub>B\<^sub>H: assumes "\\ : a \\<^sub>W\<^sub>C b\" and "\\ : b \\<^sub>W\<^sub>C c\" shows "\\ \ \ : a \\<^sub>W\<^sub>C c\" and "\\ \ \ : dom \ \ dom \ \ cod \ \ cod \\" proof - show "\\ \ \ : a \\<^sub>W\<^sub>C c\" using assms sources_determine_composability sources_hcomp targets_hcomp by auto thus "\\ \ \ : dom \ \ dom \ \ cod \ \ cod \\" using assms by auto qed text \ In a prebicategory with homs, if \a\ is an object (i.e. \src a = a\ and \trg a = a\), then \a\ is a weak unit. The converse need not hold: there can be weak units that the \src\ and \trg\ mappings send to other 1-cells in the same isomorphism class. \ lemma obj_is_weak_unit: assumes "obj a" shows "weak_unit a" proof - have "a \ sources a" using assms objE src_in_sources ideD(1) by metis thus ?thesis by auto qed end subsection "Choosing Homs" text \ Every prebicategory extends to a prebicategory with homs, by choosing an arbitrary representative of each isomorphism class of weak units to serve as an object. ``The source'' of a 2-cell is defined to be the chosen representative of the set of all its sources (which is an isomorphism class), and similarly for ``the target''. \ context prebicategory begin definition rep where "rep f \ SOME f'. f' \ { f'. f \ f' }" definition some_src where "some_src \ \ if arr \ then rep (SOME a. a \ sources \) else null" definition some_trg where "some_trg \ \ if arr \ then rep (SOME b. b \ targets \) else null" lemma isomorphic_ide_rep: assumes "ide f" shows "f \ rep f" proof - have "\f'. f' \ { f'. f \ f' }" using assms isomorphic_reflexive by blast thus ?thesis using rep_def someI_ex by simp qed lemma rep_rep: assumes "ide f" shows "rep (rep f) = rep f" proof - have "rep f \ { f'. f \ f' }" using assms isomorphic_ide_rep by simp have "{ f'. f \ f' } = { f'. rep f \ f' }" proof - have "\f'. f \ f' \ rep f \ f'" proof fix f' assume f': "f \ f'" show "rep f \ f'" proof - obtain \ where \: "\ \ hom f f' \ iso \" using f' by auto obtain \ where \: "\ \ hom f (rep f) \ iso \" using assms isomorphic_ide_rep by blast have "inv \ \ hom (rep f) f \ iso (inv \)" using \ by simp hence "iso (V \ (inv \)) \ V \ (inv \) \ hom (rep f) f'" using \ isos_compose by auto thus ?thesis using isomorphic_def by auto qed next fix f' assume f': "rep f \ f'" show "f \ f'" using assms f' isomorphic_ide_rep isos_compose isomorphic_def by (meson isomorphic_transitive) qed thus ?thesis by auto qed hence "rep (rep f) = (SOME f'. f' \ { f'. f \ f' })" using assms rep_def by fastforce also have "... = rep f" using assms rep_def by simp finally show ?thesis by simp qed lemma some_src_in_sources: assumes "arr \" shows "some_src \ \ sources \" proof - have 1: "(SOME a. a \ sources \) \ sources \" using assms arr_iff_has_src someI_ex [of "\a. a \ sources \"] by blast moreover have "ide (SOME a. a \ sources \)" using 1 weak_unit_self_composable by auto ultimately show ?thesis using assms 1 some_src_def sources_iso_closed isomorphic_ide_rep by metis qed lemma some_trg_in_targets: assumes "arr \" shows "some_trg \ \ targets \" proof - have 1: "(SOME a. a \ targets \) \ targets \" using assms arr_iff_has_trg someI_ex [of "\a. a \ targets \"] by blast moreover have "ide (SOME a. a \ targets \)" using 1 weak_unit_self_composable by auto ultimately show ?thesis using assms 1 some_trg_def targets_iso_closed isomorphic_ide_rep by metis qed lemma some_src_dom: assumes "arr \" shows "some_src (dom \) = some_src \" using assms some_src_def sources_dom by simp lemma some_src_cod: assumes "arr \" shows "some_src (cod \) = some_src \" using assms some_src_def sources_cod by simp lemma some_trg_dom: assumes "arr \" shows "some_trg (dom \) = some_trg \" using assms some_trg_def targets_dom by simp lemma some_trg_cod: assumes "arr \" shows "some_trg (cod \) = some_trg \" using assms some_trg_def targets_cod by simp lemma ide_some_src: assumes "arr \" shows "ide (some_src \)" using assms some_src_in_sources weak_unit_self_composable by blast lemma ide_some_trg: assumes "arr \" shows "ide (some_trg \)" using assms some_trg_in_targets weak_unit_self_composable by blast lemma some_src_composable: assumes "arr \" shows "\ \ \ \ null \ some_src \ \ \ \ null" using assms some_src_in_sources sources_determine_composability by blast lemma some_trg_composable: assumes "arr \" shows "\ \ \ \ null \ \ \ some_trg \ \ null" using assms some_trg_in_targets targets_determine_composability by blast lemma sources_some_src: assumes "arr \" shows "sources (some_src \) = sources \" using assms sources_determine_composability some_src_in_sources by blast lemma targets_some_trg: assumes "arr \" shows "targets (some_trg \) = targets \" using assms targets_determine_composability some_trg_in_targets by blast lemma src_some_src: assumes "arr \" shows "some_src (some_src \) = some_src \" using assms some_src_def ide_some_src sources_some_src by force lemma trg_some_trg: assumes "arr \" shows "some_trg (some_trg \) = some_trg \" using assms some_trg_def ide_some_trg targets_some_trg by force lemma sources_char': assumes "arr \" shows "a \ sources \ \ some_src \ \ a" using assms some_src_in_sources sources_iso_closed sources_are_isomorphic by meson lemma targets_char': assumes "arr \" shows "a \ targets \ \ some_trg \ \ a" using assms some_trg_in_targets targets_iso_closed targets_are_isomorphic by meson text \ An arbitrary choice of sources and targets in a prebicategory results in a notion of formal composability that coincides with the actual horizontal composability of the prebicategory. \ lemma composable_char\<^sub>P\<^sub>B: shows "\ \ \ \ null \ arr \ \ arr \ \ some_src \ = some_trg \" proof assume \\: "\ \ \ \ null" show "arr \ \ arr \ \ some_src \ = some_trg \" using \\ composable_implies_arr connected_if_composable some_src_def some_trg_def by force next assume \\: "arr \ \ arr \ \ some_src \ = some_trg \" show "\ \ \ \ null" using \\ some_src_in_sources some_trg_composable by force qed text \ A 1-cell is its own source if and only if it is its own target. \ lemma self_src_iff_self_trg: assumes "ide a" shows "a = some_src a \ a = some_trg a" proof assume a: "a = some_src a" have "weak_unit a \ a \ a \ null" using assms a some_src_in_sources [of a] by force thus "a = some_trg a" using a composable_char\<^sub>P\<^sub>B by simp next assume a: "a = some_trg a" have "weak_unit a \ a \ a \ null" using assms a some_trg_in_targets [of a] by force thus "a = some_src a" using a composable_char\<^sub>P\<^sub>B by simp qed lemma some_trg_some_src: assumes "arr \" shows "some_trg (some_src \) = some_src \" using assms ide_some_src some_src_def some_trg_def some_src_in_sources sources_char targets_char sources_some_src by force lemma src_some_trg: assumes "arr \" shows "some_src (some_trg \) = some_trg \" using assms ide_some_trg some_src_def some_trg_def some_trg_in_targets sources_char targets_char targets_some_trg by force lemma some_src_eqI: assumes "a \ sources \" and "some_src a = a" shows "some_src \ = a" using assms sources_char' some_src_def some_src_in_sources sources_are_isomorphic isomorphic_symmetric isomorphic_transitive by (metis composable_char\<^sub>P\<^sub>B sourcesD(3)) lemma some_trg_eqI: assumes "b \ targets \" and "some_trg b = b" shows "some_trg \ = b" using assms targets_char' some_trg_def some_trg_in_targets targets_are_isomorphic isomorphic_symmetric isomorphic_transitive by (metis composable_char\<^sub>P\<^sub>B targetsD(3)) lemma some_src_comp: assumes "\ \ \ \ null" shows "some_src (\ \ \) = some_src \" proof (intro some_src_eqI [of "some_src \" "\ \ \"]) show "some_src (some_src \) = some_src \" using assms src_some_src composable_implies_arr by simp show "some_src \ \ sources (H \ \)" using assms some_src_in_sources composable_char\<^sub>P\<^sub>B by (simp add: sources_hcomp) qed lemma some_trg_comp: assumes "\ \ \ \ null" shows "some_trg (\ \ \) = some_trg \" proof (intro some_trg_eqI [of "some_trg \" "\ \ \"]) show "some_trg (some_trg \) = some_trg \" using assms trg_some_trg composable_implies_arr by simp show "some_trg \ \ targets (H \ \)" using assms some_trg_in_targets composable_char\<^sub>P\<^sub>B by (simp add: targets_hcomp) qed text \ The mappings that take an arrow to its chosen source or target are endofunctors of the vertical category, which commute with each other in the manner required for horizontal homs. \ interpretation S: endofunctor V some_src using some_src_def ide_some_src some_src_dom some_src_cod apply unfold_locales apply auto[4] proof - fix \ \ assume \\: "seq \ \" show "some_src (\ \ \) = some_src \ \ some_src \" using \\ some_src_dom [of "\ \ \"] some_src_dom some_src_cod [of "\ \ \"] some_src_cod ide_some_src by auto qed interpretation T: endofunctor V some_trg using some_trg_def ide_some_trg some_trg_dom some_trg_cod apply unfold_locales apply auto[4] proof - fix \ \ assume \\: "seq \ \" show "some_trg (\ \ \) = some_trg \ \ some_trg \" using \\ some_trg_dom [of "\ \ \"] some_trg_dom some_trg_cod [of "\ \ \"] some_trg_cod ide_some_trg by auto qed interpretation weak_composition_with_homs V H some_src some_trg apply unfold_locales using some_src_in_sources some_trg_in_targets src_some_src trg_some_trg src_some_trg some_trg_some_src some_src_comp some_trg_comp composable_char\<^sub>P\<^sub>B ide_some_src ide_some_trg by simp_all proposition extends_to_weak_composition_with_homs: shows "weak_composition_with_homs V H some_src some_trg" .. proposition extends_to_prebicategory_with_homs: shows "prebicategory_with_homs V H \ some_src some_trg" .. end subsection "Choosing Units" text \ A \emph{prebicategory with units} is a prebicategory equipped with a choice, for each weak unit \a\, of a ``unit isomorphism'' \\\[a] : a \ a \ a\\. \ locale prebicategory_with_units = prebicategory V H \ + weak_composition V H for V :: "'a comp" (infixr "\" 55) and H :: "'a comp" (infixr "\" 53) and \ :: "'a \ 'a \ 'a \ 'a" ("\[_, _, _]") and \ :: "'a \ 'a" ("\[_]") + assumes unit_in_vhom\<^sub>P\<^sub>B\<^sub>U: "weak_unit a \ \\[a] : a \ a \ a\" and iso_unit\<^sub>P\<^sub>B\<^sub>U: "weak_unit a \ iso \[a]" begin lemma unit_in_hom\<^sub>P\<^sub>B\<^sub>U: assumes "weak_unit a" shows "\\[a] : a \\<^sub>W\<^sub>C a\" and "\\[a] : a \ a \ a\" proof - show 1: "\\[a] : a \ a \ a\" using assms unit_in_vhom\<^sub>P\<^sub>B\<^sub>U by auto show "\\[a] : a \\<^sub>W\<^sub>C a\" using assms 1 weak_unit_iff_self_source weak_unit_iff_self_target sources_cod [of "\[a]"] targets_cod [of "\[a]"] by (elim in_homE, auto) qed lemma unit_simps [simp]: assumes "weak_unit a" shows "arr \[a]" and "dom \[a] = a \ a" and "cod \[a] = a" using assms unit_in_vhom\<^sub>P\<^sub>B\<^sub>U by auto end text \ Every prebicategory extends to a prebicategory with units, simply by choosing the unit isomorphisms arbitrarily. \ context prebicategory begin proposition extends_to_prebicategory_with_units: shows "prebicategory_with_units V H \ some_unit" using iso_some_unit by (unfold_locales, auto) end subsection "Horizontal Composition" text \ The following locale axiomatizes a (vertical) category \V\ with horizontal homs, which in addition has been equipped with a functorial operation \H\ of horizontal composition from \VV\ to \V\, assumed to preserve source and target. \ locale horizontal_composition = horizontal_homs V src trg + H: "functor" VV.comp V \\\\. H (fst \\) (snd \\)\ for V :: "'a comp" (infixr "\" 55) and H :: "'a \ 'a \ 'a" (infixr "\" 53) and src :: "'a \ 'a" and trg :: "'a \ 'a" + assumes src_hcomp: "arr (\ \ \) \ src (\ \ \) = src \" and trg_hcomp: "arr (\ \ \) \ trg (\ \ \) = trg \" begin (* TODO: Why does this get re-introduced? *) no_notation in_hom ("\_ : _ \ _\") text \ \H\ is a partial magma, which shares its null with \V\. \ lemma is_partial_magma: shows "partial_magma H" and "partial_magma.null H = null" proof - have 1: "\f. null \ f = null \ f \ null = null" using H.is_extensional VV.arr_char not_arr_null by auto interpret H: partial_magma H using 1 VV.arr_char H.is_extensional not_arr_null by unfold_locales metis show "partial_magma H" .. show "H.null = null" using 1 H.null_def the1_equality [of "\n. \f. n \ f = n \ f \ n = n"] by metis qed text \ \textbf{Note:} The following is ``almost'' \H.seq\, but for that we would need \H.arr = V.arr\. This would be unreasonable to expect, in general, as the definition of \H.arr\ is based on ``strict'' units rather than weak units. Later we will show that we do have \H.arr = V.arr\ if the vertical category is discrete. \ abbreviation hseq where "hseq \ \ \ arr (\ \ \)" lemma hseq_char: shows "hseq \ \ \ arr \ \ arr \ \ src \ = trg \" proof - have "hseq \ \ \ VV.arr (\, \)" using H.is_extensional H.preserves_arr by force also have "... \ arr \ \ arr \ \ src \ = trg \" using VV.arr_char by force finally show ?thesis by blast qed lemma hseq_char': shows "hseq \ \ \ \ \ \ \ null" using VV.arr_char H.preserves_arr H.is_extensional hseq_char [of \ \] by auto lemma hseqI' [intro, simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "hseq \ \" using assms hseq_char by simp lemma hseqI: assumes "\\ : a \ b\" and "\\ : b \ c\" shows "hseq \ \" using assms hseq_char by auto lemma hseqE [elim]: assumes "hseq \ \" and "arr \ \ arr \ \ src \ = trg \ \ T" shows "T" using assms hseq_char by simp lemma hcomp_simps [simp]: assumes "hseq \ \" shows "src (\ \ \) = src \" and "trg (\ \ \) = trg \" and "dom (\ \ \) = dom \ \ dom \" and "cod (\ \ \) = cod \ \ cod \" using assms VV.arr_char src_hcomp apply blast using assms VV.arr_char trg_hcomp apply blast using assms VV.arr_char H.preserves_dom VV.dom_simp apply force using assms VV.arr_char H.preserves_cod VV.cod_simp by force lemma ide_hcomp [intro, simp]: assumes "ide \" and "ide \" and "src \ = trg \" shows "ide (\ \ \)" using assms VV.ide_char VV.arr_char H.preserves_ide [of "(\, \)"] by auto lemma hcomp_in_hhom [intro]: assumes "\\ : a \ b\" and "\\ : b \ c\" shows "\\ \ \ : a \ c\" using assms hseq_char by fastforce lemma hcomp_in_hhom' (* [simp] *): assumes "arr \" and "arr \" and "src \ = a" and "trg \ = c" and "src \ = trg \" shows "\\ \ \ : a \ c\" using assms hseq_char by fastforce lemma hcomp_in_hhomE [elim]: assumes "\\ \ \ : a \ c\" and "\ arr \; arr \; src \ = trg \; src \ = a; trg \ = c \ \ T" shows T using assms in_hhom_def by fastforce lemma hcomp_in_vhom [intro]: assumes "\\ : f \ g\" and "\\ : h \ k\" and "src h = trg f" shows "\\ \ \ : h \ f \ k \ g\" using assms by fastforce lemma hcomp_in_vhom' (* [simp] *): assumes "hseq \ \" and "dom \ = f" and "dom \ = h" and "cod \ = g" and "cod \ = k" assumes "\\ : f \ g\" and "\\ : h \ k\" and "src h = trg f" shows "\\ \ \ : h \ f \ k \ g\" using assms by fastforce lemma hcomp_in_vhomE [elim]: assumes "\\ \ \ : f \ g\" and "\ arr \; arr \; src \ = trg \; src \ = src f; src \ = src g; trg \ = trg f; trg \ = trg g \ \ T" shows T using assms in_hom_def by (metis in_homE hseqE src_cod src_dom src_hcomp trg_cod trg_dom trg_hcomp) text \ A horizontal composition yields a weak composition by simply forgetting the \src\ and \trg\ functors. \ lemma match_1: assumes "\ \ \ \ null" and "(\ \ \) \ \ \ null" shows "\ \ \ \ null" using assms H.is_extensional not_arr_null VV.arr_char hseq_char hseq_char' by auto lemma match_2: assumes "\ \ (\ \ \) \ null" and "\ \ \ \ null" shows "\ \ \ \ null" using assms H.is_extensional not_arr_null VV.arr_char hseq_char hseq_char' by auto lemma match_3: assumes "\ \ \ \ null" and "\ \ \ \ null" shows "(\ \ \) \ \ \ null" using assms H.is_extensional not_arr_null VV.arr_char hseq_char hseq_char' by auto lemma match_4: assumes "\ \ \ \ null" and "\ \ \ \ null" shows "\ \ (\ \ \) \ null" using assms H.is_extensional not_arr_null VV.arr_char hseq_char hseq_char' by auto lemma left_connected: assumes "seq \ \'" shows "\ \ \ \ null \ \' \ \ \ null" using assms H.is_extensional not_arr_null VV.arr_char hseq_char' by (metis hseq_char seqE vseq_implies_hpar(1)) lemma right_connected: assumes "seq \ \'" shows "H \ \ \ null \ H \ \' \ null" using assms H.is_extensional not_arr_null VV.arr_char hseq_char' by (metis hseq_char seqE vseq_implies_hpar(2)) proposition is_weak_composition: shows "weak_composition V H" proof - have 1: "(\\\. fst \\ \ snd \\ \ null) = (\\\. arr (fst \\) \ arr (snd \\) \ src (fst \\) = trg (snd \\))" using hseq_char' by auto interpret VoV: subcategory VxV.comp \\\\. fst \\ \ snd \\ \ null\ using 1 VV.subcategory_axioms by simp interpret H: "functor" VoV.comp V \\\\. fst \\ \ snd \\\ using H.functor_axioms 1 by simp show ?thesis using match_1 match_2 match_3 match_4 left_connected right_connected by (unfold_locales, metis) qed interpretation weak_composition V H using is_weak_composition by auto text \ It can be shown that \arr ((\ \ \) \ (\ \ \)) \ (\ \ \) \ (\ \ \) = (\ \ \) \ (\ \ \)\. However, we do not have \arr ((\ \ \) \ (\ \ \)) \ (\ \ \) \ (\ \ \) = (\ \ \) \ (\ \ \)\, because it does not follow from \arr ((\ \ \) \ (\ \ \))\ that \dom \ = cod \\ and \dom \ = cod \\, only that \dom \ \ dom \ = cod \ \ cod \\. So we don't get interchange unconditionally. \ lemma interchange: assumes "seq \ \" and "seq \ \" shows "(\ \ \) \ (\ \ \) = (\ \ \) \ (\ \ \)" using assms interchange by simp lemma whisker_right: assumes "ide f" and "seq \ \" shows "(\ \ \) \ f = (\ \ f) \ (\ \ f)" using assms whisker_right by simp lemma whisker_left: assumes "ide f" and "seq \ \" shows "f \ (\ \ \) = (f \ \) \ (f \ \)" using assms whisker_left by simp lemma inverse_arrows_hcomp: assumes "iso \" and "iso \" and "src \ = trg \" shows "inverse_arrows (\ \ \) (inv \ \ inv \)" proof - show "inverse_arrows (\ \ \) (inv \ \ inv \)" proof show "ide ((inv \ \ inv \) \ (\ \ \))" proof - have "(inv \ \ inv \) \ (\ \ \) = dom \ \ dom \" using assms interchange iso_is_arr comp_inv_arr' by (metis arr_dom) thus ?thesis using assms iso_is_arr by simp qed show "ide ((\ \ \) \ (inv \ \ inv \))" proof - have "(\ \ \) \ (inv \ \ inv \) = cod \ \ cod \" using assms interchange iso_is_arr comp_arr_inv' by (metis arr_cod) thus ?thesis using assms iso_is_arr by simp qed qed qed lemma iso_hcomp [intro, simp]: assumes "iso \" and "iso \" and "src \ = trg \" shows "iso (\ \ \)" using assms inverse_arrows_hcomp by auto (* * TODO: Maybe a good idea to change hcomp_in_vhom hypotheses to match this * and iso_hcomp. *) lemma hcomp_iso_in_hom [intro]: assumes "iso_in_hom \ f g" and "iso_in_hom \ h k" and "src \ = trg \" shows "iso_in_hom (\ \ \) (h \ f) (k \ g)" unfolding iso_in_hom_def using assms hcomp_in_vhom iso_hcomp iso_in_hom_def vconn_implies_hpar(1-2) by auto lemma isomorphic_implies_ide: assumes "f \ g" shows "ide f" and "ide g" using assms isomorphic_def by auto lemma hcomp_ide_isomorphic: assumes "ide f" and "g \ h" and "src f = trg g" shows "f \ g \ f \ h" proof - obtain \ where \: "iso \ \ \\ : g \ h\" using assms isomorphic_def by auto have "iso (f \ \) \ \f \ \ : f \ g \ f \ h\" using assms \ iso_hcomp by auto thus ?thesis using isomorphic_def by auto qed lemma hcomp_isomorphic_ide: assumes "f \ g" and "ide h" and "src f = trg h" shows "f \ h \ g \ h" proof - obtain \ where \: "iso \ \ \\ : f \ g\" using assms isomorphic_def by auto have "iso (\ \ h) \ \\ \ h : f \ h \ g \ h\" using assms \ iso_hcomp by auto thus ?thesis using isomorphic_def by auto qed lemma isomorphic_implies_hpar: assumes "f \ f'" shows "ide f" and "ide f'" and "src f = src f'" and "trg f = trg f'" using assms isomorphic_def by auto lemma inv_hcomp [simp]: assumes "iso \" and "iso \" and "src \ = trg \" shows "inv (\ \ \) = inv \ \ inv \" using assms inverse_arrow_unique [of "\ \ \"] inv_is_inverse inverse_arrows_hcomp by auto text \ The following define the two ways of using horizontal composition to compose three arrows. \ definition HoHV where "HoHV \ \ if VVV.arr \ then (fst \ \ fst (snd \)) \ snd (snd \) else null" definition HoVH where "HoVH \ \ if VVV.arr \ then fst \ \ fst (snd \) \ snd (snd \) else null" lemma functor_HoHV: shows "functor VVV.comp V HoHV" apply unfold_locales using VVV.arr_char VV.arr_char VVV.dom_char VVV.cod_char VVV.comp_char HoHV_def apply auto[4] proof - fix f g assume fg: "VVV.seq g f" show "HoHV (VVV.comp g f) = HoHV g \ HoHV f" proof - have "VxVxV.comp g f = (fst g \ fst f, fst (snd g) \ fst (snd f), snd (snd g) \ snd (snd f))" using fg VVV.seq_char VVV.arr_char VV.arr_char VxVxV.comp_char VxV.comp_char by (metis (no_types, lifting) VxV.seqE VxVxV.seqE) hence "HoHV (VVV.comp g f) = (fst g \ fst f \ fst (snd g) \ fst (snd f)) \ snd (snd g) \ snd (snd f)" using HoHV_def VVV.comp_simp fg by auto also have "... = ((fst g \ fst (snd g)) \ snd (snd g)) \ ((fst f \ fst (snd f)) \ snd (snd f))" using fg VVV.seq_char VVV.arr_char VV.arr_char interchange by (metis (no_types, lifting) VxV.seqE VxVxV.seqE hseqI' src_vcomp trg_vcomp) also have "... = HoHV g \ HoHV f" using HoHV_def fg by auto finally show ?thesis by simp qed qed sublocale HoHV: "functor" VVV.comp V HoHV using functor_HoHV by simp lemma functor_HoVH: shows "functor VVV.comp V HoVH" apply unfold_locales using VVV.arr_char VV.arr_char VVV.dom_char VVV.cod_char VVV.comp_char HoHV_def HoVH_def apply auto[4] proof - fix f g assume fg: "VVV.seq g f" show "HoVH (VVV.comp g f) = HoVH g \ HoVH f" proof - have "VxVxV.comp g f = (fst g \ fst f, fst (snd g) \ fst (snd f), snd (snd g) \ snd (snd f))" using fg VVV.seq_char VVV.arr_char VV.arr_char VxVxV.comp_char VxV.comp_char by (metis (no_types, lifting) VxV.seqE VxVxV.seqE) hence "HoVH (VVV.comp g f) = fst g \ fst f \ fst (snd g) \ fst (snd f) \ snd (snd g) \ snd (snd f)" using HoVH_def VVV.comp_simp fg by auto also have "... = (fst g \ fst (snd g) \ snd (snd g)) \ (fst f \ fst (snd f) \ snd (snd f))" using fg VVV.seq_char VVV.arr_char VV.arr_char interchange by (metis (no_types, lifting) VxV.seqE VxVxV.seqE hseqI' src_vcomp trg_vcomp) also have "... = HoVH g \ HoVH f" using fg VVV.seq_char VVV.arr_char HoVH_def VVV.comp_char VV.arr_char by (metis (no_types, lifting)) finally show ?thesis by simp qed qed sublocale HoVH: "functor" VVV.comp V HoVH using functor_HoVH by simp text \ The following define horizontal composition of an arrow on the left by its target and on the right by its source. \ abbreviation L where "L \ \\. if arr \ then trg \ \ \ else null" abbreviation R where "R \ \\. if arr \ then \ \ src \ else null" sublocale L: endofunctor V L using vseq_implies_hpar(2) whisker_left by (unfold_locales, auto) lemma endofunctor_L: shows "endofunctor V L" .. sublocale R: endofunctor V R using vseq_implies_hpar(1) whisker_right by (unfold_locales, auto) lemma endofunctor_R: shows "endofunctor V R" .. end end diff --git a/thys/Bicategory/Pseudofunctor.thy b/thys/Bicategory/Pseudofunctor.thy --- a/thys/Bicategory/Pseudofunctor.thy +++ b/thys/Bicategory/Pseudofunctor.thy @@ -1,2960 +1,2959 @@ (* Title: Pseudofunctor Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) section "Pseudofunctors" theory Pseudofunctor imports MonoidalCategory.MonoidalFunctor Bicategory Subbicategory InternalEquivalence Coherence begin text \ The traditional definition of a pseudofunctor \F : C \ D\ between bicategories \C\ and \D\ is in terms of two maps: an ``object map'' \F\<^sub>o\ that takes objects of \C\ to objects of \D\ and an ``arrow map'' \F\<^sub>a\ that assigns to each pair of objects \a\ and \b\ of \C\ a functor \F\<^sub>a a b\ from the hom-category \hom\<^sub>C a b\ to the hom-category \hom\<^sub>D (F\<^sub>o a) (F\<^sub>o b)\. In addition, there is assigned to each object \a\ of \C\ an invertible 2-cell \\\ a : F\<^sub>o a \\<^sub>D (F\<^sub>a a a) a\\, and to each pair \(f, g)\ of composable 1-cells of C there is assigned an invertible 2-cell \\\ (f, g) : F g \ F f \ F (g \ f)\\, all subject to naturality and coherence conditions. In keeping with the ``object-free'' style in which we have been working, we do not wish to adopt a definition of pseudofunctor that distinguishes between objects and other arrows. Instead, we would like to understand a pseudofunctor as an ordinary functor between (vertical) categories that weakly preserves horizontal composition in a suitable sense. So, we take as a starting point that a pseudofunctor \F : C \ D\ is a functor from \C\ to \D\, when these are regarded as ordinary categories with respect to vertical composition. Next, \F\ should preserve source and target, but only ``weakly'' (up to isomorphism, rather than ``on the nose''). Weak preservation of horizontal composition is expressed by specifying, for each horizontally composable pair of vertical identities \(f, g)\ of \C\, a ``compositor'' \\\ (f, g) : F g \ F f \ F (g \ f)\\ in \D\, such that the \\ (f, g)\ are the components of a natural isomorphism. Associators must also be weakly preserved by F; this is expressed by a coherence condition that relates an associator \\\<^sub>C[f, g, h]\ in \C\, its image \F \\<^sub>C[f, g, h]\, the associator \\\<^sub>D[F f, F g, F h]\ in \D\ and compositors involving \f\, \g\, and \h\. As regards the weak preservation of unitors, just as for monoidal functors, which are in fact pseudofunctors between one-object bicategories, it is only necessary to assume that \F \\<^sub>C[a]\ and \\\<^sub>D[F a]\ are isomorphic in \D\ for each object \a\ of \C\, for there is then a canonical way to obtain, for each \a\, an isomorphism \\\ a : src (F a) \ F a\\ that satisfies the usual coherence conditions relating the unitors and the associators. Note that the map \a \ src (F a)\ amounts to the traditional ``object map'' \F\<^sub>o\, so that this becomes a derived notion, rather than a primitive one. \ subsection "Weak Arrows of Homs" text \ We begin with a locale that defines a functor between ``horizontal homs'' that preserves source and target up to isomorphism. \ locale weak_arrow_of_homs = C: horizontal_homs C src\<^sub>C trg\<^sub>C + D: horizontal_homs D src\<^sub>D trg\<^sub>D + "functor" C D F for C :: "'c comp" (infixr "\\<^sub>C" 55) and src\<^sub>C :: "'c \ 'c" and trg\<^sub>C :: "'c \ 'c" and D :: "'d comp" (infixr "\\<^sub>D" 55) and src\<^sub>D :: "'d \ 'd" and trg\<^sub>D :: "'d \ 'd" and F :: "'c \ 'd" + assumes weakly_preserves_src: "\\. C.arr \ \ D.isomorphic (F (src\<^sub>C \)) (src\<^sub>D (F \))" and weakly_preserves_trg: "\\. C.arr \ \ D.isomorphic (F (trg\<^sub>C \)) (trg\<^sub>D (F \))" begin lemma isomorphic_src: assumes "C.obj a" shows "D.isomorphic (src\<^sub>D (F a)) (F a)" using assms weakly_preserves_src [of a] D.isomorphic_symmetric by auto lemma isomorphic_trg: assumes "C.obj a" shows "D.isomorphic (trg\<^sub>D (F a)) (F a)" using assms weakly_preserves_trg [of a] D.isomorphic_symmetric by auto abbreviation (input) hseq\<^sub>C where "hseq\<^sub>C \ \ \ C.arr \ \ C.arr \ \ src\<^sub>C \ = trg\<^sub>C \" abbreviation (input) hseq\<^sub>D where "hseq\<^sub>D \ \ \ D.arr \ \ D.arr \ \ src\<^sub>D \ = trg\<^sub>D \" lemma preserves_hseq: assumes "hseq\<^sub>C \ \" shows "hseq\<^sub>D (F \) (F \)" by (metis D.isomorphic_def D.src_src D.src_trg D.vconn_implies_hpar(3) assms preserves_reflects_arr weakly_preserves_src weakly_preserves_trg) text \ Though \F\ does not preserve objects ``on the nose'', we can recover from it the usual ``object map'', which does. It is slightly confusing at first to get used to the idea that applying the object map of a weak arrow of homs to an object does not give the same thing as applying the underlying functor, but rather only something isomorphic to it. The following defines the object map associated with \F\. \ definition map\<^sub>0 where "map\<^sub>0 a \ src\<^sub>D (F a)" lemma map\<^sub>0_simps [simp]: assumes "C.obj a" shows "D.obj (map\<^sub>0 a)" and "src\<^sub>D (map\<^sub>0 a) = map\<^sub>0 a" and "trg\<^sub>D (map\<^sub>0 a) = map\<^sub>0 a" and "D.dom (map\<^sub>0 a) = map\<^sub>0 a" and "D.cod (map\<^sub>0 a) = map\<^sub>0 a" using assms map\<^sub>0_def by auto lemma preserves_src [simp]: assumes "C.arr \" shows "src\<^sub>D (F \) = map\<^sub>0 (src\<^sub>C \)" using assms by (metis C.src.preserves_arr C.src_src C.trg_src map\<^sub>0_def preserves_hseq) lemma preserves_trg [simp]: assumes "C.arr \" shows "trg\<^sub>D (F \) = map\<^sub>0 (trg\<^sub>C \)" using assms map\<^sub>0_def preserves_hseq C.src_trg C.trg.preserves_arr by presburger lemma preserves_hhom [intro]: assumes "C.arr \" shows "D.in_hhom (F \) (map\<^sub>0 (src\<^sub>C \)) (map\<^sub>0 (trg\<^sub>C \))" using assms by simp text \ We define here the lifting of \F\ to a functor \FF: CC \ DD\. We need this to define the domains and codomains of the compositors. \ definition FF where "FF \ \\\. if C.VV.arr \\ then (F (fst \\), F (snd \\)) else D.VV.null" sublocale FF: "functor" C.VV.comp D.VV.comp FF proof - have 1: "\\\. C.VV.arr \\ \ D.VV.arr (FF \\)" unfolding FF_def using C.VV.arr_char D.VV.arr_char preserves_hseq by simp show "functor C.VV.comp D.VV.comp FF" proof fix \\ show "\ C.VV.arr \\ \ FF \\ = D.VV.null" using FF_def by simp show "C.VV.arr \\ \ D.VV.arr (FF \\)" using 1 by simp assume \\: "C.VV.arr \\" show "D.VV.dom (FF \\) = FF (C.VV.dom \\)" using \\ 1 FF_def C.VV.arr_char D.VV.arr_char C.VV.dom_simp D.VV.dom_simp by simp show "D.VV.cod (FF \\) = FF (C.VV.cod \\)" using \\ 1 FF_def C.VV.arr_char D.VV.arr_char C.VV.cod_simp D.VV.cod_simp by simp next fix \\ \\ assume 2: "C.VV.seq \\ \\" show "FF (C.VV.comp \\ \\) = D.VV.comp (FF \\) (FF \\)" proof - have "FF (C.VV.comp \\ \\) = (F (fst \\) \\<^sub>D F (fst \\), F (snd \\) \\<^sub>D F (snd \\))" using 1 2 FF_def C.VV.comp_char C.VxV.comp_char C.VV.arr_char by (metis (no_types, lifting) C.VV.seq_char C.VxV.seqE fst_conv as_nat_trans.preserves_comp_2 snd_conv) also have "... = D.VV.comp (FF \\) (FF \\)" using 1 2 FF_def D.VV.comp_char D.VxV.comp_char C.VV.arr_char D.VV.arr_char C.VV.seq_char C.VxV.seqE preserves_seq - by (simp, meson) + by simp meson finally show ?thesis by simp qed qed qed lemma functor_FF: shows "functor C.VV.comp D.VV.comp FF" .. end subsection "Definition of Pseudofunctors" text \ I don't much like the term "pseudofunctor", which is suggestive of something that is ``not really'' a functor. In the development here we can see that a pseudofunctor is really a \emph{bona fide} functor with respect to vertical composition, which happens to have in addition a weak preservation property with respect to horizontal composition. This weak preservation of horizontal composition is captured by extra structure, the ``compositors'', which are the components of a natural transformation. So ``pseudofunctor'' is really a misnomer; it's an actual functor that has been equipped with additional structure relating to horizontal composition. I would use the term ``bifunctor'' for such a thing, but it seems to not be generally accepted and also tends to conflict with the usage of that term to refer to an ordinary functor of two arguments; which I have called a ``binary functor''. Sadly, there seem to be no other plausible choices of terminology, other than simply ``functor'' (recommended on n-Lab @{url \https://ncatlab.org/nlab/show/pseudofunctor\}), but that is not workable here because we need a name that does not clash with that used for an ordinary functor between categories. \ locale pseudofunctor = C: bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C + D: bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D + weak_arrow_of_homs V\<^sub>C src\<^sub>C trg\<^sub>C V\<^sub>D src\<^sub>D trg\<^sub>D F + FoH\<^sub>C: composite_functor C.VV.comp V\<^sub>C V\<^sub>D \\\\. H\<^sub>C (fst \\) (snd \\)\ F + H\<^sub>DoFF: composite_functor C.VV.comp D.VV.comp V\<^sub>D FF \\\\. H\<^sub>D (fst \\) (snd \\)\ + \: natural_isomorphism C.VV.comp V\<^sub>D H\<^sub>DoFF.map FoH\<^sub>C.map \ for V\<^sub>C :: "'c comp" (infixr "\\<^sub>C" 55) and H\<^sub>C :: "'c comp" (infixr "\\<^sub>C" 53) and \\<^sub>C :: "'c \ 'c \ 'c \ 'c" ("\\<^sub>C[_, _, _]") and \\<^sub>C :: "'c \ 'c" ("\\<^sub>C[_]") and src\<^sub>C :: "'c \ 'c" and trg\<^sub>C :: "'c \ 'c" and V\<^sub>D :: "'d comp" (infixr "\\<^sub>D" 55) and H\<^sub>D :: "'d comp" (infixr "\\<^sub>D" 53) and \\<^sub>D :: "'d \ 'd \ 'd \ 'd" ("\\<^sub>D[_, _, _]") and \\<^sub>D :: "'d \ 'd" ("\\<^sub>D[_]") and src\<^sub>D :: "'d \ 'd" and trg\<^sub>D :: "'d \ 'd" and F :: "'c \ 'd" and \ :: "'c * 'c \ 'd" + assumes assoc_coherence: "\ C.ide f; C.ide g; C.ide h; src\<^sub>C f = trg\<^sub>C g; src\<^sub>C g = trg\<^sub>C h \ \ F \\<^sub>C[f, g, h] \\<^sub>D \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h) = \ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h]" begin no_notation C.in_hom ("\_ : _ \\<^sub>C _\") no_notation D.in_hom ("\_ : _ \\<^sub>D _\") notation C.in_hhom ("\_ : _ \\<^sub>C _\") notation C.in_hom ("\_ : _ \\<^sub>C _\") notation D.in_hhom ("\_ : _ \\<^sub>D _\") notation D.in_hom ("\_ : _ \\<^sub>D _\") notation C.lunit ("\\<^sub>C[_]") notation C.runit ("\\<^sub>C[_]") notation C.lunit' ("\\<^sub>C\<^sup>-\<^sup>1[_]") notation C.runit' ("\\<^sub>C\<^sup>-\<^sup>1[_]") notation C.\' ("\\<^sub>C\<^sup>-\<^sup>1[_, _, _]") notation D.lunit ("\\<^sub>D[_]") notation D.runit ("\\<^sub>D[_]") notation D.lunit' ("\\<^sub>D\<^sup>-\<^sup>1[_]") notation D.runit' ("\\<^sub>D\<^sup>-\<^sup>1[_]") notation D.\' ("\\<^sub>D\<^sup>-\<^sup>1[_, _, _]") lemma weakly_preserves_objects: assumes "C.obj a" shows "D.isomorphic (map\<^sub>0 a) (F a)" using assms weakly_preserves_src [of a] D.isomorphic_symmetric by auto lemma cmp_in_hom [intro]: assumes "C.ide a" and "C.ide b" and "src\<^sub>C a = trg\<^sub>C b" shows "\\ (a, b) : map\<^sub>0 (src\<^sub>C b) \\<^sub>D map\<^sub>0 (trg\<^sub>C a)\" and "\\ (a, b) : F a \\<^sub>D F b \\<^sub>D F (a \\<^sub>C b)\" proof - show "\\ (a, b) : F a \\<^sub>D F b \\<^sub>D F (a \\<^sub>C b)\" using assms C.VV.arr_char C.VV.dom_char C.VV.cod_char FF_def by auto thus "\\ (a, b) : map\<^sub>0 (src\<^sub>C b) \\<^sub>D map\<^sub>0 (trg\<^sub>C a)\" using assms D.vconn_implies_hpar by auto qed lemma cmp_simps [simp]: assumes "C.ide f" and "C.ide g" and "src\<^sub>C f = trg\<^sub>C g" shows "D.arr (\ (f, g))" and "src\<^sub>D (\ (f, g)) = src\<^sub>D (F g)" and "trg\<^sub>D (\ (f, g)) = trg\<^sub>D (F f)" and "D.dom (\ (f, g)) = F f \\<^sub>D F g" and "D.cod (\ (f, g)) = F (f \\<^sub>C g)" using assms cmp_in_hom by simp_all blast+ lemma cmp_in_hom': assumes "C.arr \" and "C.arr \" and "src\<^sub>C \ = trg\<^sub>C \" shows "\\ (\, \) : map\<^sub>0 (src\<^sub>C \) \\<^sub>D map\<^sub>0 (trg\<^sub>C \)\" and "\\ (\, \) : F (C.dom \) \\<^sub>D F (C.dom \) \\<^sub>D F (C.cod \ \\<^sub>C C.cod \)\" proof - show "\\ (\, \) : F (C.dom \) \\<^sub>D F (C.dom \) \\<^sub>D F (C.cod \ \\<^sub>C C.cod \)\" using assms C.VV.arr_char C.VV.dom_char C.VV.cod_char FF_def by auto thus "\\ (\, \) : map\<^sub>0 (src\<^sub>C \) \\<^sub>D map\<^sub>0 (trg\<^sub>C \)\" using assms D.vconn_implies_hpar by auto qed lemma cmp_simps': assumes "C.arr \" and "C.arr \" and "src\<^sub>C \ = trg\<^sub>C \" shows "D.arr (\ (\, \))" and "src\<^sub>D (\ (\, \)) = map\<^sub>0 (src\<^sub>C \)" and "trg\<^sub>D (\ (\, \)) = map\<^sub>0 (trg\<^sub>C \)" and "D.dom (\ (\, \)) = F (C.dom \) \\<^sub>D F (C.dom \)" and "D.cod (\ (\, \)) = F (C.cod \ \\<^sub>C C.cod \)" - using assms cmp_in_hom' by simp_all blast+ + using assms cmp_in_hom' by blast+ lemma cmp_components_are_iso [simp]: assumes "C.ide f" and "C.ide g" and "src\<^sub>C f = trg\<^sub>C g" shows "D.iso (\ (f, g))" using assms C.VV.ide_char C.VV.arr_char by simp lemma weakly_preserves_hcomp: assumes "C.ide f" and "C.ide g" and "src\<^sub>C f = trg\<^sub>C g" shows "D.isomorphic (F f \\<^sub>D F g) (F (f \\<^sub>C g))" using assms D.isomorphic_def by auto end context pseudofunctor begin text \ The following defines the image of the unit isomorphism \\\<^sub>C[a]\ under \F\. We will use \(F a, \[a])\ as an ``alternate unit'', to substitute for \(src\<^sub>D (F a), \\<^sub>D[src\<^sub>D (F a)])\. \ abbreviation (input) \ ("\[_]") where "\[a] \ F \\<^sub>C[a] \\<^sub>D \ (a, a)" lemma \_in_hom [intro]: assumes "C.obj a" shows "\F \\<^sub>C[a] \\<^sub>D \ (a, a) : map\<^sub>0 a \\<^sub>D map\<^sub>0 a\" and "\\[a] : F a \\<^sub>D F a \\<^sub>D F a\" proof (unfold map\<^sub>0_def) show "\F \\<^sub>C[a] \\<^sub>D \ (a, a) : F a \\<^sub>D F a \\<^sub>D F a\" using assms preserves_hom cmp_in_hom by (intro D.comp_in_homI, auto) show "\F \\<^sub>C[a] \\<^sub>D \ (a, a) : src\<^sub>D (F a) \\<^sub>D src\<^sub>D (F a)\" using assms C.VV.arr_char C.VV.dom_simp C.VV.cod_simp by (intro D.vcomp_in_hhom D.seqI, auto) qed lemma \_simps [simp]: assumes "C.obj a" shows "D.arr (\ a)" and "src\<^sub>D \[a] = map\<^sub>0 a" and "trg\<^sub>D \[a] = map\<^sub>0 a" and "D.dom \[a] = F a \\<^sub>D F a" and "D.cod \[a] = F a" using assms \_in_hom by auto lemma iso_\: assumes "C.obj a" shows "D.iso \[a]" using assms C.iso_unit C.obj_self_composable(1) C.seq_if_composable by (meson C.objE D.isos_compose \_simps(1) cmp_components_are_iso preserves_iso) text \ If \a\ is an object of \C\ and we have an isomorphism \\\ (a, a) : F a \\<^sub>D F a \\<^sub>D F (a \\<^sub>C a)\\, then there is a canonical way to define a compatible isomorphism \\\ a : map\<^sub>0 a \\<^sub>D F a\\. Specifically, we take \\ a\ to be the unique isomorphism \\\ : map\<^sub>0 a \\<^sub>D F a\\ such that \\ \\<^sub>D \\<^sub>D[map\<^sub>0 a] = \[a] \\<^sub>D (\ \\<^sub>D \)\. \ definition unit where "unit a \ THE \. \\ : map\<^sub>0 a \\<^sub>D F a\ \ D.iso \ \ \ \\<^sub>D \\<^sub>D[map\<^sub>0 a] = \[a] \\<^sub>D (\ \\<^sub>D \)" lemma unit_char: assumes "C.obj a" shows "\unit a : map\<^sub>0 a \\<^sub>D F a\" and "D.iso (unit a)" and "unit a \\<^sub>D \\<^sub>D[map\<^sub>0 a] = \[a] \\<^sub>D (unit a \\<^sub>D unit a)" and "\!\. \\ : map\<^sub>0 a \\<^sub>D F a\ \ D.iso \ \ \ \\<^sub>D \\<^sub>D[map\<^sub>0 a] = \[a] \\<^sub>D (\ \\<^sub>D \)" proof - let ?P = "\\. \\ : map\<^sub>0 a \\<^sub>D F a\ \ D.iso \ \ \ \\<^sub>D \\<^sub>D[map\<^sub>0 a] = \[a] \\<^sub>D (\ \\<^sub>D \)" show "\!\. ?P \" proof - have "D.obj (map\<^sub>0 a)" using assms by simp moreover have "D.isomorphic (map\<^sub>0 a) (F a)" unfolding map\<^sub>0_def using assms isomorphic_src by simp ultimately show ?thesis using assms D.unit_unique_upto_unique_iso \.preserves_hom \_in_hom iso_\ by simp qed hence 1: "?P (unit a)" using assms unit_def the1I2 [of ?P ?P] by simp show "\unit a : map\<^sub>0 a \\<^sub>D F a\" using 1 by simp show "D.iso (unit a)" using 1 by simp show "unit a \\<^sub>D \\<^sub>D[map\<^sub>0 a] = \[a] \\<^sub>D (unit a \\<^sub>D unit a)" using 1 by simp qed lemma unit_simps [simp]: assumes "C.obj a" shows "D.arr (unit a)" and "src\<^sub>D (unit a) = map\<^sub>0 a" and "trg\<^sub>D (unit a) = map\<^sub>0 a" and "D.dom (unit a) = map\<^sub>0 a" and "D.cod (unit a) = F a" using assms unit_char(1) apply auto apply (metis D.vconn_implies_hpar(1) map\<^sub>0_simps(2)) by (metis D.vconn_implies_hpar(2) map\<^sub>0_simps(3)) lemma unit_in_hom [intro]: assumes "C.obj a" shows "\unit a : map\<^sub>0 a \\<^sub>D map\<^sub>0 a\" and "\unit a : map\<^sub>0 a \\<^sub>D F a\" using assms by auto lemma unit_eqI: assumes "C.obj a" and "\\: map\<^sub>0 a \\<^sub>D F a\" and "D.iso \" and "\ \\<^sub>D \\<^sub>D[map\<^sub>0 a] = \ a \\<^sub>D (\ \\<^sub>D \)" shows "\ = unit a" using assms unit_def unit_char the1_equality [of "\\. \\ : map\<^sub>0 a \\<^sub>D F a\ \ D.iso \ \ \ \\<^sub>D \\<^sub>D[map\<^sub>0 a] = \[a] \\<^sub>D (\ \\<^sub>D \)" \] by simp text \ The following defines the unique isomorphism satisfying the characteristic conditions for the left unitor \\\<^sub>D[trg\<^sub>D (F f)]\, but using the ``alternate unit'' \\[trg\<^sub>C f]\ instead of \\\<^sub>D[trg\<^sub>D (F f)]\, which is used to define \\\<^sub>D[trg\<^sub>D (F f)]\. \ definition lF where "lF f \ THE \. \\ : F (trg\<^sub>C f) \\<^sub>D F f \\<^sub>D F f\ \ F (trg\<^sub>C f) \\<^sub>D \ =(\[trg\<^sub>C f] \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F (trg\<^sub>C f), F (trg\<^sub>C f), F f]" lemma lF_char: assumes "C.ide f" shows "\lF f : F (trg\<^sub>C f) \\<^sub>D F f \\<^sub>D F f\" and "F (trg\<^sub>C f) \\<^sub>D lF f = (\[trg\<^sub>C f] \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F (trg\<^sub>C f), F (trg\<^sub>C f), F f]" and "\!\. \\ : F (trg\<^sub>C f) \\<^sub>D F f \\<^sub>D F f\ \ F (trg\<^sub>C f) \\<^sub>D \ = (\[trg\<^sub>C f] \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F (trg\<^sub>C f), F (trg\<^sub>C f), F f]" proof - let ?P = "\\. \\ : F (trg\<^sub>C f) \\<^sub>D F f \\<^sub>D F f\ \ F (trg\<^sub>C f) \\<^sub>D \ = (\[trg\<^sub>C f] \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F (trg\<^sub>C f), F (trg\<^sub>C f), F f]" show "\!\. ?P \" proof - interpret Df: prebicategory \(\\<^sub>D)\ \(\\<^sub>D)\ \\<^sub>D using D.is_prebicategory by simp interpret S: subcategory \(\\<^sub>D)\ \Df.left (F (trg\<^sub>C f))\ using assms Df.left_hom_is_subcategory by simp interpret Df: left_hom \(\\<^sub>D)\ \(\\<^sub>D)\ \F (trg\<^sub>C f)\ using assms D.weak_unit_char by unfold_locales simp interpret Df: left_hom_with_unit \(\\<^sub>D)\ \(\\<^sub>D)\ \\<^sub>D \\[trg\<^sub>C f]\ \F (trg\<^sub>C f)\ using assms \_in_hom iso_\ D.weak_unit_char(1) assms weakly_preserves_trg by unfold_locales auto have "\!\. \\ : Df.L (F f) \\<^sub>S F f\ \ Df.L \ = (\[trg\<^sub>C f] \\<^sub>D F f) \\<^sub>S \\<^sub>D\<^sup>-\<^sup>1[F (trg\<^sub>C f), F (trg\<^sub>C f), F f]" proof - have "Df.left (F (trg\<^sub>C f)) (F f)" using assms weakly_preserves_src D.isomorphic_def D.hseq_char D.hseq_char' Df.left_def by fastforce thus ?thesis using assms Df.lunit_char(3) S.ide_char S.arr_char by simp qed moreover have "Df.L (F f) = F (trg\<^sub>C f) \\<^sub>D F f" using assms by (simp add: Df.H\<^sub>L_def) moreover have "\\. Df.L \ = F (trg\<^sub>C f) \\<^sub>D \" using Df.H\<^sub>L_def by simp moreover have "(\[trg\<^sub>C f] \\<^sub>D F f) \\<^sub>S \\<^sub>D\<^sup>-\<^sup>1[F (trg\<^sub>C f), F (trg\<^sub>C f), F f] = (\[trg\<^sub>C f] \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F (trg\<^sub>C f), F (trg\<^sub>C f), F f]" by (metis (no_types, lifting) D.arrI D.ext D.hseqI' D.hseq_char' D.seqE D.seq_if_composable D.vconn_implies_hpar(1) D.vconn_implies_hpar(2-3) D.vconn_implies_hpar(4) Df.\_in_hom Df.arr_\ S.comp_char S.in_hom_char calculation(1,3)) moreover have "\\. \\ : F (trg\<^sub>C f) \\<^sub>D F f \\<^sub>D F f\ \ \\ : F (trg\<^sub>C f) \\<^sub>D F f \\<^sub>S F f\" using assms S.in_hom_char S.arr_char by (metis D.in_homE Df.hom_connected(2) Df.left_def calculation(1-2)) ultimately show ?thesis by simp qed hence 1: "?P (lF f)" using lF_def the1I2 [of ?P ?P] by simp show "\lF f : F (trg\<^sub>C f) \\<^sub>D F f \\<^sub>D F f\" using 1 by simp show "F (trg\<^sub>C f) \\<^sub>D lF f = (\[trg\<^sub>C f] \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F (trg\<^sub>C f), F (trg\<^sub>C f), F f]" using 1 by simp qed lemma lF_simps [simp]: assumes "C.ide f" shows "D.arr (lF f)" and "src\<^sub>D (lF f) = map\<^sub>0 (src\<^sub>C f)" and "trg\<^sub>D (lF f) = map\<^sub>0 (trg\<^sub>C f)" and "D.dom (lF f) = F (trg\<^sub>C f) \\<^sub>D F f" and "D.cod (lF f) = F f" using assms lF_char(1) apply auto[5] unfolding map\<^sub>0_def using assms apply (metis C.ideD(1) D.vconn_implies_hpar(1,3) map\<^sub>0_def preserves_src) by (metis C.ideD(1) C.src_trg C.trg.preserves_arr D.in_homE D.trg_cod preserves_src preserves_trg) text \ \sloppypar The next two lemmas generalize the eponymous results from @{theory MonoidalCategory.MonoidalFunctor}. See the proofs of those results for diagrams. \ lemma lunit_coherence1: assumes "C.ide f" shows "\\<^sub>D[F f] \\<^sub>D D.inv (unit (trg\<^sub>C f) \\<^sub>D F f) = lF f" proof - let ?b = "trg\<^sub>C f" have 1: "trg\<^sub>D (F f) = map\<^sub>0 ?b" using assms by simp have "lF f \\<^sub>D (unit ?b \\<^sub>D F f) = \\<^sub>D[F f]" proof - have "D.par (lF f \\<^sub>D (unit ?b \\<^sub>D F f)) \\<^sub>D[F f]" using assms 1 D.lunit_in_hom unit_char(1-2) lF_char(1) D.ideD(1) by auto moreover have "map\<^sub>0 ?b \\<^sub>D (lF f \\<^sub>D (unit ?b \\<^sub>D F f)) = map\<^sub>0 ?b \\<^sub>D \\<^sub>D[F f]" proof - have "map\<^sub>0 ?b \\<^sub>D (lF f \\<^sub>D (unit ?b \\<^sub>D F f)) = (map\<^sub>0 ?b \\<^sub>D lF f) \\<^sub>D (map\<^sub>0 ?b \\<^sub>D unit ?b \\<^sub>D F f)" using assms D.objE [of "map\<^sub>0 (trg\<^sub>C f)"] D.whisker_left [of "map\<^sub>0 ?b" "lF f" "unit ?b \\<^sub>D F f"] by auto also have "... = (map\<^sub>0 ?b \\<^sub>D lF f) \\<^sub>D (D.inv (unit ?b) \\<^sub>D F ?b \\<^sub>D F f) \\<^sub>D (unit ?b \\<^sub>D unit ?b \\<^sub>D F f)" proof - have "(D.inv (unit ?b) \\<^sub>D F ?b \\<^sub>D F f) \\<^sub>D (unit ?b \\<^sub>D unit ?b \\<^sub>D F f) = D.inv (unit ?b) \\<^sub>D unit ?b \\<^sub>D F ?b \\<^sub>D unit ?b \\<^sub>D F f \\<^sub>D F f" using assms unit_char(1-2) D.interchange [of "F ?b" "unit ?b" "F f" "F f"] D.interchange [of "D.inv (unit ?b)" "unit ?b" "F ?b \\<^sub>D F f" "unit ?b \\<^sub>D F f"] by simp also have "... = map\<^sub>0 ?b \\<^sub>D unit ?b \\<^sub>D F f" using assms unit_char(1-2) [of ?b] D.comp_arr_dom D.comp_cod_arr D.comp_inv_arr by (simp add: D.inv_is_inverse) finally show ?thesis by simp qed also have "... = (D.inv (unit ?b) \\<^sub>D F f) \\<^sub>D (F ?b \\<^sub>D lF f) \\<^sub>D (unit ?b \\<^sub>D unit ?b \\<^sub>D F f)" proof - have "(map\<^sub>0 ?b \\<^sub>D lF f) \\<^sub>D (D.inv (unit ?b) \\<^sub>D F ?b \\<^sub>D F f) = (D.inv (unit ?b) \\<^sub>D F f) \\<^sub>D (F ?b \\<^sub>D lF f)" proof - have "(map\<^sub>0 ?b \\<^sub>D lF f) \\<^sub>D (D.inv (unit ?b) \\<^sub>D F ?b \\<^sub>D F f) = D.inv (unit ?b) \\<^sub>D lF f" using assms unit_char(1-2) lF_char(1) D.comp_arr_dom D.comp_cod_arr D.interchange [of "map\<^sub>0 ?b" "D.inv (unit ?b)" "lF f" "F ?b \\<^sub>D F f"] by simp also have "... = D.inv (unit ?b) \\<^sub>D F ?b \\<^sub>D F f \\<^sub>D lF f" using assms unit_char(1-2) lF_char(1) D.comp_arr_dom D.comp_cod_arr D.inv_in_hom by auto also have "... = (D.inv (unit ?b) \\<^sub>D F f) \\<^sub>D (F ?b \\<^sub>D lF f)" using assms unit_char(1-2) lF_char(1) D.inv_in_hom D.interchange [of "D.inv (unit ?b)" "F ?b" "F f" "lF f"] by simp finally show ?thesis by simp qed thus ?thesis using assms unit_char(1-2) D.inv_in_hom D.comp_assoc by metis qed also have "... = (D.inv (unit ?b) \\<^sub>D F f) \\<^sub>D (\ ?b \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F ?b, F ?b, F f] \\<^sub>D (unit ?b \\<^sub>D unit ?b \\<^sub>D F f)" using assms unit_char(1-2) lF_char(2) D.comp_assoc by auto also have "... = ((D.inv (unit ?b) \\<^sub>D F f) \\<^sub>D (\ ?b \\<^sub>D F f) \\<^sub>D ((unit ?b \\<^sub>D unit ?b) \\<^sub>D F f)) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[map\<^sub>0 ?b, map\<^sub>0 ?b, F f]" using assms unit_char(1-2) D.assoc'_naturality [of "unit ?b" "unit ?b" "F f"] D.comp_assoc by (simp add: \trg\<^sub>D (F f) = map\<^sub>0 (trg\<^sub>C f)\) also have "... = (\\<^sub>D[map\<^sub>0 ?b] \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[map\<^sub>0 ?b, map\<^sub>0 ?b, F f]" proof - have "((D.inv (unit ?b) \\<^sub>D F f) \\<^sub>D (\ ?b \\<^sub>D F f) \\<^sub>D ((unit ?b \\<^sub>D unit ?b) \\<^sub>D F f)) = \\<^sub>D[map\<^sub>0 ?b] \\<^sub>D F f" proof - have "((D.inv (unit ?b) \\<^sub>D F f) \\<^sub>D (\ ?b \\<^sub>D F f) \\<^sub>D ((unit ?b \\<^sub>D unit ?b) \\<^sub>D F f)) = D.inv (unit ?b) \\<^sub>D unit ?b \\<^sub>D \\<^sub>D[map\<^sub>0 ?b] \\<^sub>D F f" using assms 1 D.unit_in_hom D.whisker_right [of "F f"] unit_char(2-3) D.invert_side_of_triangle(1) by (metis C.ideD(1) C.obj_trg D.seqI' map\<^sub>0_simps(1) unit_in_hom(2) preserves_ide) also have "... = \\<^sub>D[map\<^sub>0 ?b] \\<^sub>D F f" proof - have "(D.inv (unit (trg\<^sub>C f)) \\<^sub>D unit (trg\<^sub>C f)) \\<^sub>D \\<^sub>D[map\<^sub>0 ?b] = \\<^sub>D[map\<^sub>0 ?b]" by (simp add: D.comp_cod_arr D.comp_inv_arr D.inv_is_inverse unit_char(2) assms) thus ?thesis by (simp add: D.comp_assoc) qed finally show ?thesis by blast qed thus ?thesis by simp qed also have "... = map\<^sub>0 ?b \\<^sub>D \\<^sub>D[F f]" using assms D.lunit_char [of "F f"] \trg\<^sub>D (F f) = map\<^sub>0 ?b\ by simp finally show ?thesis by blast qed ultimately show ?thesis using assms D.L.is_faithful by (metis D.trg_cod D.trg_vcomp D.vseq_implies_hpar(2) lF_simps(3)) qed thus ?thesis using assms 1 unit_char(1-2) C.ideD(1) C.obj_trg D.inverse_arrows_hcomp(1) D.invert_side_of_triangle(2) D.lunit_simps(1) unit_simps(2) preserves_ide D.iso_hcomp as_nat_iso.components_are_iso by metis qed lemma lunit_coherence2: assumes "C.ide f" shows "lF f = F \\<^sub>C[f] \\<^sub>D \ (trg\<^sub>C f, f)" proof - let ?b = "trg\<^sub>C f" have "D.par (F \\<^sub>C[f] \\<^sub>D \ (?b, f)) (lF f)" using assms cmp_simps'(1) cmp_simps(4-5) by force moreover have "F ?b \\<^sub>D F \\<^sub>C[f] \\<^sub>D \ (?b, f) = F ?b \\<^sub>D lF f" proof - have "F ?b \\<^sub>D F \\<^sub>C[f] \\<^sub>D \ (?b, f) = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D (F ?b \\<^sub>D \ (?b, f))" using assms cmp_in_hom D.whisker_left [of "F ?b" "F \\<^sub>C[f]" "\ (?b, f)"] by (simp add: calculation) also have "... = F ?b \\<^sub>D lF f" proof - have "(F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D (F ?b \\<^sub>D \ (?b, f)) = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D F \\<^sub>C[?b, ?b, f] \\<^sub>D \ (?b \\<^sub>C ?b, f) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F ?b, F ?b, F f]" proof - have 1: "D.seq (F \\<^sub>C[trg\<^sub>C f, trg\<^sub>C f, f]) (\ (trg\<^sub>C f \\<^sub>C trg\<^sub>C f, f) \\<^sub>D (\ (trg\<^sub>C f, trg\<^sub>C f) \\<^sub>D F f))" using assms by fastforce hence 2: "D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D F \\<^sub>C[?b, ?b, f] \\<^sub>D \ (?b \\<^sub>C ?b, f) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f) = (F ?b \\<^sub>D \ (?b, f)) \\<^sub>D \\<^sub>D[F ?b, F ?b, F f]" using assms cmp_in_hom assoc_coherence cmp_components_are_iso D.invert_side_of_triangle(1) [of "F \\<^sub>C[?b, ?b, f] \\<^sub>D \ (?b \\<^sub>C ?b, f) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f)" "\ (?b, ?b \\<^sub>C f)" "(F ?b \\<^sub>D \ (?b, f)) \\<^sub>D \\<^sub>D[F ?b, F ?b, F f]"] C.ideD(1) C.ide_hcomp C.trg_hcomp C.trg_trg C.src_trg C.trg.preserves_ide by metis hence "F ?b \\<^sub>D \ (?b, f) = (D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D F \\<^sub>C[?b, ?b, f] \\<^sub>D \ (?b \\<^sub>C ?b, f) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f)) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F ?b, F ?b, F f]" proof - have "D.seq (D.inv (\ (trg\<^sub>C f, trg\<^sub>C f \\<^sub>C f))) (F \\<^sub>C[trg\<^sub>C f, trg\<^sub>C f, f] \\<^sub>D \ (trg\<^sub>C f \\<^sub>C trg\<^sub>C f, f) \\<^sub>D (\ (trg\<^sub>C f, trg\<^sub>C f) \\<^sub>D F f))" using assms 1 D.hseq_char by auto moreover have "(F (trg\<^sub>C f) \\<^sub>D \ (trg\<^sub>C f, f)) \\<^sub>D \\<^sub>D[F (trg\<^sub>C f), F (trg\<^sub>C f), F f] = D.inv (\ (trg\<^sub>C f, trg\<^sub>C f \\<^sub>C f)) \\<^sub>D F \\<^sub>C[trg\<^sub>C f, trg\<^sub>C f, f] \\<^sub>D \ (trg\<^sub>C f \\<^sub>C trg\<^sub>C f, f) \\<^sub>D (\ (trg\<^sub>C f, trg\<^sub>C f) \\<^sub>D F f)" using assms 2 by simp ultimately show ?thesis using assms D.invert_side_of_triangle(2) [of "D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D F \\<^sub>C[?b, ?b, f] \\<^sub>D \ (?b \\<^sub>C ?b, f) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f)" "F ?b \\<^sub>D \ (?b, f)" "\\<^sub>D[F ?b, F ?b, F f]"] by fastforce qed thus ?thesis using D.comp_assoc by simp qed also have "... = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D (D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D F (\\<^sub>C[?b] \\<^sub>C f)) \\<^sub>D \ (?b \\<^sub>C ?b, f) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F ?b, F ?b, F f]" proof - have 1: "F (?b \\<^sub>C \\<^sub>C[f]) = F (\\<^sub>C[?b] \\<^sub>C f) \\<^sub>D D.inv (F \\<^sub>C[?b, ?b, f])" using assms C.lunit_char(1-2) C.unit_in_hom preserves_inv by auto have "F \\<^sub>C[?b, ?b, f] = D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D F (\\<^sub>C[?b] \\<^sub>C f)" proof - have "F \\<^sub>C[?b, ?b, f] \\<^sub>D D.inv (F (\\<^sub>C[?b] \\<^sub>C f)) = D.inv (F (\\<^sub>C[?b] \\<^sub>C f) \\<^sub>D D.inv (F \\<^sub>C[?b, ?b, f]))" using assms by (simp add: C.iso_unit D.inv_comp) thus ?thesis using assms 1 D.invert_side_of_triangle D.iso_inv_iso by (metis C.iso_hcomp C.ideD(1) C.ide_is_iso C.iso_lunit C.iso_unit C.lunit_simps(3) C.obj_trg C.src_trg C.trg.as_nat_iso.components_are_iso C.unit_simps(2) D.arr_inv D.inv_inv preserves_iso) qed thus ?thesis by argo qed also have "... = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D (F (\\<^sub>C[?b] \\<^sub>C f) \\<^sub>D \ (?b \\<^sub>C ?b, f)) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F ?b, F ?b, F f]" using D.comp_assoc by auto also have "... = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D (\ (?b, f) \\<^sub>D (F \\<^sub>C[?b] \\<^sub>D F f)) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F ?b, F ?b, F f]" using assms \.naturality [of "(\\<^sub>C[?b], f)"] FF_def C.VV.arr_char C.VV.cod_char C.VV.dom_char by simp also have "... = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D \ (?b, f) \\<^sub>D ((F \\<^sub>C[?b] \\<^sub>D F f)) \\<^sub>D (\ (?b, ?b) \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F ?b, F ?b, F f]" using D.comp_assoc by auto also have "... = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D \ (?b, f) \\<^sub>D (\ ?b \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F ?b, F ?b, F f]" using assms by (simp add: D.comp_assoc D.whisker_right) also have "... = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D (D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D \ (?b, f)) \\<^sub>D (F ?b \\<^sub>D lF f)" using D.comp_assoc assms lF_char(2) by presburger also have "... = (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D (F ?b \\<^sub>D lF f)" proof - have "D.inv (F ?b \\<^sub>D F \\<^sub>C[f]) = D.inv (((F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (\ (?b, ?b \\<^sub>C f))) \\<^sub>D \ (?b, ?b \\<^sub>C f))" using assms D.comp_inv_arr D.comp_inv_arr' cmp_simps(4) D.comp_arr_dom D.comp_assoc by simp also have "... = D.inv (D.inv (\ (?b, f)) \\<^sub>D F (?b \\<^sub>C \\<^sub>C[f]) \\<^sub>D \ (?b, ?b \\<^sub>C f))" proof - have 1: "\ (?b, f) \\<^sub>D (F ?b \\<^sub>D F \\<^sub>C[f]) = F (?b \\<^sub>C \\<^sub>C[f]) \\<^sub>D \ (?b, ?b \\<^sub>C f)" using assms \.naturality [of "(?b, \\<^sub>C[f])"] FF_def C.VV.arr_char C.VV.cod_char D.VV.null_char C.VV.dom_simp by simp have "(F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (\ (?b, ?b \\<^sub>C f)) = D.inv (\ (?b, f)) \\<^sub>D F (?b \\<^sub>C \\<^sub>C[f])" proof - have "D.seq (\ (?b, f)) (F ?b \\<^sub>D F \\<^sub>C[f])" using assms cmp_in_hom(2) [of ?b f] by auto moreover have "D.iso (\ (?b, f)) \ D.iso (\ (?b, ?b \\<^sub>C f))" using assms by simp ultimately show ?thesis using 1 D.invert_opposite_sides_of_square by simp qed thus ?thesis using D.comp_assoc by auto qed also have "... = D.inv (F (?b \\<^sub>C \\<^sub>C[f]) \\<^sub>D \ (?b, ?b \\<^sub>C f)) \\<^sub>D \ (?b, f)" proof - have "D.iso (F (?b \\<^sub>C \\<^sub>C[f]) \\<^sub>D \ (?b, ?b \\<^sub>C f))" using assms D.isos_compose C.VV.arr_char C.iso_lunit C.VV.dom_simp C.VV.cod_simp by simp moreover have "D.iso (D.inv (\ (?b, f)))" using assms by simp moreover have "D.seq (D.inv (\ (?b, f))) (F (?b \\<^sub>C \\<^sub>C[f]) \\<^sub>D \ (?b, ?b \\<^sub>C f))" using assms C.VV.arr_char C.VV.dom_simp C.VV.cod_simp by simp ultimately show ?thesis using assms D.inv_comp by simp qed also have "... = D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D \ (?b, f)" using D.comp_assoc D.inv_comp assms cmp_simps'(1) cmp_simps(5) by force finally have "D.inv (F ?b \\<^sub>D F \\<^sub>C[f]) = D.inv (\ (?b, ?b \\<^sub>C f)) \\<^sub>D D.inv (F (?b \\<^sub>C \\<^sub>C[f])) \\<^sub>D \ (?b, f)" by blast thus ?thesis by argo qed also have "... = ((F ?b \\<^sub>D F \\<^sub>C[f]) \\<^sub>D D.inv (F ?b \\<^sub>D F \\<^sub>C[f])) \\<^sub>D (F ?b \\<^sub>D lF f)" using D.comp_assoc by simp also have "... = F ?b \\<^sub>D lF f" using assms D.comp_arr_inv' [of "F ?b \\<^sub>D F \\<^sub>C[f]"] D.comp_cod_arr by simp finally show ?thesis by simp qed ultimately show ?thesis by simp qed ultimately show ?thesis using assms D.L.is_faithful by (metis D.in_homI lF_char(2-3) lF_simps(4-5)) qed lemma lunit_coherence: assumes "C.ide f" shows "\\<^sub>D[F f] = F \\<^sub>C[f] \\<^sub>D \ (trg\<^sub>C f, f) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f)" proof - have "\\<^sub>D[F f] = (F \\<^sub>C[f] \\<^sub>D \ (trg\<^sub>C f, f)) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f)" by (metis C.ideD(1) C.obj_trg D.inv_inv D.invert_side_of_triangle(2) D.iso_hcomp D.iso_inv_iso as_nat_iso.components_are_iso assms lF_simps(1) lunit_coherence1 lunit_coherence2 preserves_trg unit_char(2) unit_simps(2)) thus ?thesis using assms D.comp_assoc by simp qed text \ We postpone proving the dual version of this result until after we have developed the notion of the ``op bicategory'' in the next section. \ end subsection "Pseudofunctors and Opposite Bicategories" text \ There are three duals to a bicategory: \begin{enumerate} \item ``op'': sources and targets are exchanged; \item ``co'': domains and codomains are exchanged; \item ``co-op'': both sources and targets and domains and codomains are exchanged. \end{enumerate} Here we consider the "op" case. \ locale op_bicategory = B: bicategory V H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B for V :: "'a comp" (infixr "\" 55) and H\<^sub>B :: "'a comp" (infixr "\\<^sub>B" 53) and \\<^sub>B :: "'a \ 'a \ 'a \ 'a" ("\\<^sub>B[_, _, _]") and \\<^sub>B :: "'a \ 'a" ("\\<^sub>B[_]") and src\<^sub>B :: "'a \ 'a" and trg\<^sub>B :: "'a \ 'a" begin abbreviation H (infixr "\" 53) where "H f g \ H\<^sub>B g f" abbreviation \ ("\[_]") where "\ \ \\<^sub>B" abbreviation src where "src \ trg\<^sub>B" abbreviation trg where "trg \ src\<^sub>B" interpretation horizontal_homs V src trg by (unfold_locales, auto) interpretation H: "functor" VV.comp V \\\\. fst \\ \ snd \\\ using VV.arr_char VV.dom_simp VV.cod_simp apply unfold_locales apply (metis (no_types, lifting) B.hseqE B.hseq_char') apply auto[3] using VV.comp_char VV.seq_char VV.arr_char B.VxV.comp_char B.interchange by (metis (no_types, lifting) B.VxV.seqE fst_conv snd_conv) interpretation horizontal_composition V H src trg by (unfold_locales, auto) abbreviation UP where "UP \\\ \ if B.VVV.arr \\\ then (snd (snd \\\), fst (snd \\\), fst \\\) else VVV.null" abbreviation DN where "DN \\\ \ if VVV.arr \\\ then (snd (snd \\\), fst (snd \\\), fst \\\) else B.VVV.null" lemma VVV_arr_char: shows "VVV.arr \\\ \ B.VVV.arr (DN \\\)" using VVV.arr_char VV.arr_char B.VVV.arr_char B.VV.arr_char B.VVV.not_arr_null by auto lemma VVV_ide_char: shows "VVV.ide \\\ \ B.VVV.ide (DN \\\)" proof - have "VVV.ide \\\ \ VVV.arr \\\ \ B.VxVxV.ide \\\" using VVV.ide_char by simp also have "... \ B.VVV.arr (DN \\\) \ B.VxVxV.ide (DN \\\)" using VVV_arr_char B.VxVxV.ide_char by auto also have "... \ B.VVV.ide (DN \\\)" using B.VVV.ide_char [of "DN \\\"] by blast finally show ?thesis by fast qed lemma VVV_dom_char: shows "VVV.dom \\\ = UP (B.VVV.dom (DN \\\))" proof (cases "VVV.arr \\\") show "\ VVV.arr \\\ \ VVV.dom \\\ = UP (B.VVV.dom (DN \\\))" using VVV.dom_def VVV.has_domain_iff_arr VVV_arr_char B.VVV.dom_null by auto show "VVV.arr \\\ \ VVV.dom \\\ = UP (B.VVV.dom (DN \\\))" proof - assume \\\: "VVV.arr \\\" have "VVV.dom \\\ = (B.dom (fst \\\), B.dom (fst (snd \\\)), B.dom (snd (snd \\\)))" using \\\ VVV.dom_char VVV.arr_char VV.arr_char B.VVV.arr_char B.VV.arr_char by simp also have "... = UP (B.dom (snd (snd \\\)), B.dom (fst (snd \\\)), B.dom (fst \\\))" by (metis (no_types, lifting) B.VV.arrI B.VVV.arr_char B.arr_dom VV.arrE VVV.arrE \\\ fst_conv snd_conv src_dom trg_dom) also have "... = UP (B.VVV.dom (DN \\\))" using \\\ B.VVV.dom_char B.VVV.arr_char B.VV.arr_char VVV.arr_char VV.arr_char by simp finally show ?thesis by blast qed qed lemma VVV_cod_char: shows "VVV.cod \\\ = UP (B.VVV.cod (DN \\\))" proof (cases "VVV.arr \\\") show "\ VVV.arr \\\ \ VVV.cod \\\ = UP (B.VVV.cod (DN \\\))" using VVV.cod_def VVV.has_codomain_iff_arr VVV_arr_char B.VVV.cod_null by auto show "VVV.arr \\\ \ VVV.cod \\\ = UP (B.VVV.cod (DN \\\))" proof - assume \\\: "VVV.arr \\\" have "VVV.cod \\\ = (B.cod (fst \\\), B.cod (fst (snd \\\)), B.cod (snd (snd \\\)))" using \\\ VVV.cod_char VVV.arr_char VV.arr_char B.VVV.arr_char B.VV.arr_char by simp also have "... = UP (B.cod (snd (snd \\\)), B.cod (fst (snd \\\)), B.cod (fst \\\))" by (metis (no_types, lifting) B.VV.arrI B.VVV.arr_char B.arr_cod VV.arrE VVV.arrE \\\ fst_conv snd_conv src_cod trg_cod) also have "... = UP (B.VVV.cod (DN \\\))" using \\\ B.VVV.cod_char B.VVV.arr_char B.VV.arr_char VVV.arr_char VV.arr_char by simp finally show ?thesis by blast qed qed lemma HoHV_char: shows "HoHV \\\ = B.HoVH (DN \\\)" using HoHV_def B.HoVH_def VVV_arr_char by simp lemma HoVH_char: shows "HoVH \\\ = B.HoHV (DN \\\)" using HoVH_def B.HoHV_def VVV_arr_char by simp definition \ ("\[_, _, _]") where "\[\, \, \] \ B.\' (DN (\, \, \))" interpretation natural_isomorphism VVV.comp \(\)\ HoHV HoVH \\\\\. \[fst \\\, fst (snd \\\), snd (snd \\\)]\ proof fix \\\ show "\ VVV.arr \\\ \ \[fst \\\, fst (snd \\\), snd (snd \\\)] = B.null" using VVV.arr_char B.VVV.arr_char \_def B.\'.is_extensional by auto assume \\\: "VVV.arr \\\" show "B.dom \[fst \\\, fst (snd \\\), snd (snd \\\)] = HoHV (VVV.dom \\\)" using \\\ \_def HoHV_def B.\'.preserves_dom VVV.arr_char VVV.dom_char VV.arr_char B.HoVH_def B.VVV.arr_char B.VV.arr_char B.VVV.dom_char by auto show "B.cod \[fst \\\, fst (snd \\\), snd (snd \\\)] = HoVH (VVV.cod \\\)" using \\\ \_def HoVH_def B.\'.preserves_cod VVV.arr_char VVV.cod_char VV.arr_char B.HoHV_def B.VVV.arr_char B.VV.arr_char B.VVV.cod_char by auto show "HoVH \\\ \ \[fst (VVV.dom \\\), fst (snd (VVV.dom \\\)), snd (snd (VVV.dom \\\))] = \[fst \\\, fst (snd \\\), snd (snd \\\)]" proof - have "HoVH \\\ \ \[fst (VVV.dom \\\), fst (snd (VVV.dom \\\)), snd (snd (VVV.dom \\\))] = HoVH \\\ \ B.\' (B.VVV.dom (snd (snd \\\), fst (snd \\\), fst \\\))" unfolding \_def using \\\ VVV.arr_char VV.arr_char VVV.dom_char B.VVV.arr_char B.VVV.dom_char by auto also have "... = B.\' (snd (snd \\\), fst (snd \\\), fst \\\)" using B.\'.is_natural_1 VVV_arr_char \\\ HoVH_char by presburger also have "... = \[fst \\\, fst (snd \\\), snd (snd \\\)]" using \\\ \_def by simp finally show ?thesis by blast qed show "\[fst (VVV.cod \\\), fst (snd (VVV.cod \\\)), snd (snd (VVV.cod \\\))] \ HoHV \\\ = \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))" proof - have "\[fst (VVV.cod \\\), fst (snd (VVV.cod \\\)), snd (snd (VVV.cod \\\))] \ HoHV \\\ = B.\' (B.VVV.cod (snd (snd \\\), fst (snd \\\), fst \\\)) \ HoHV \\\" unfolding \_def using \\\ VVV.arr_char VV.arr_char VVV.cod_char B.VVV.arr_char B.VVV.cod_char by auto also have "... = B.\' (snd (snd \\\), fst (snd \\\), fst \\\)" using B.\'.is_natural_2 VVV_arr_char \\\ HoHV_char by presburger also have "... = \[fst \\\, fst (snd \\\), snd (snd \\\)]" using \\\ \_def by simp finally show ?thesis by blast qed next fix \\\ assume \\\: "VVV.ide \\\" show "B.iso \[fst \\\, fst (snd \\\), snd (snd \\\)]" proof - have "B.VVV.ide (DN \\\)" using \\\ VVV_ide_char by blast thus ?thesis using \\\ \_def B.\'.components_are_iso by force qed qed sublocale bicategory V H \ \ src trg proof show "\a. obj a \ \\ a : H a a \\<^sub>B a\" using obj_def objE B.obj_def B.objE B.unit_in_hom by meson show "\a. obj a \ B.iso (\ a)" using obj_def objE B.obj_def B.objE B.iso_unit by meson show "\f g h k. \ B.ide f; B.ide g; B.ide h; B.ide k; src f = trg g; src g = trg h; src h = trg k \ \ (f \ \[g, h, k]) \ \[f, g \ h, k] \ (\[f, g, h] \ k) = \[f, g, h \ k] \ \[f \ g, h, k]" unfolding \_def using B.\'_def B.comp_assoc B.pentagon' VVV.arr_char VV.arr_char by simp qed proposition is_bicategory: shows "bicategory V H \ \ src trg" .. lemma assoc_ide_simp: assumes "B.ide f" and "B.ide g" and "B.ide h" and "src f = trg g" and "src g = trg h" shows "\[f, g, h] = B.\' h g f" using assms \_def B.\'_def by fastforce lemma lunit_ide_simp: assumes "B.ide f" shows "lunit f = B.runit f" proof (intro B.runit_eqI) show "B.ide f" by fact show "\lunit f : H (trg f) f \\<^sub>B f\" using assms by simp show "trg f \ lunit f = (\[trg f] \ f) \ \\<^sub>B[f, trg f, trg f]" proof - have "trg f \ lunit f = (\[trg f] \ f) \ \' (trg f) (trg f) f" using assms lunit_char(1-2) [of f] by simp moreover have "\' (trg f) (trg f) f = \\<^sub>B[f, trg f, trg f]" proof (unfold \'_def) have 1: "VVV.ide (trg f, trg f, f)" using assms VVV.ide_char VVV.arr_char VV.arr_char by simp have "\' (trg f, trg f, f) = B.inv \[trg f, trg f, f]" using 1 B.\'.inverts_components by simp also have "... = B.inv (B.\' (f, trg f, trg f))" unfolding \_def using 1 by simp also have "... = \\<^sub>B[f, trg f, trg f]" using 1 B.VVV.ide_char B.VVV.arr_char B.VV.arr_char VVV.ide_char VVV.arr_char VV.arr_char B.\'.inverts_components B.\_def by force finally show "\' (trg f, trg f, f) = \\<^sub>B[f, trg f, trg f]" by blast qed ultimately show ?thesis by simp qed qed lemma runit_ide_simp: assumes "B.ide f" shows "runit f = B.lunit f" using assms runit_char(1-2) [of f] B.\'_def assoc_ide_simp by (intro B.lunit_eqI) auto end context pseudofunctor begin interpretation C': op_bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C .. interpretation D': op_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D .. notation C'.H (infixr "\\<^sub>C\<^sup>o\<^sup>p" 53) notation D'.H (infixr "\\<^sub>D\<^sup>o\<^sup>p" 53) interpretation F': weak_arrow_of_homs V\<^sub>C C'.src C'.trg V\<^sub>D D'.src D'.trg F apply unfold_locales using weakly_preserves_src weakly_preserves_trg by simp_all interpretation H\<^sub>D'oFF: composite_functor C'.VV.comp D'.VV.comp V\<^sub>D F'.FF \\\\. fst \\ \\<^sub>D\<^sup>o\<^sup>p snd \\\ .. interpretation FoH\<^sub>C': composite_functor C'.VV.comp V\<^sub>C V\<^sub>D \\\\. fst \\ \\<^sub>C\<^sup>o\<^sup>p snd \\\ F .. interpretation \': natural_isomorphism C'.VV.comp V\<^sub>D H\<^sub>D'oFF.map FoH\<^sub>C'.map \\f. \ (snd f, fst f)\ using C.VV.arr_char C'.VV.arr_char C'.VV.ide_char C.VV.ide_char FF_def F'.FF_def \.is_extensional \.is_natural_1 \.is_natural_2 C.VV.dom_simp C.VV.cod_simp C'.VV.dom_simp C'.VV.cod_simp by unfold_locales auto interpretation F': pseudofunctor V\<^sub>C C'.H C'.\ \\<^sub>C C'.src C'.trg V\<^sub>D D'.H D'.\ \\<^sub>D D'.src D'.trg F \\f. \ (snd f, fst f)\ proof fix f g h assume f: "C.ide f" and g: "C.ide g" and h: "C.ide h" and fg: "C'.src f = C'.trg g" and gh: "C'.src g = C'.trg h" show "F (C'.\ f g h) \\<^sub>D \ (snd (f \\<^sub>C\<^sup>o\<^sup>p g, h), fst (f \\<^sub>C\<^sup>o\<^sup>p g, h)) \\<^sub>D (\ (snd (f, g), fst (f, g)) \\<^sub>D\<^sup>o\<^sup>p F h) = \ (snd (f, g \\<^sub>C\<^sup>o\<^sup>p h), fst (f, g \\<^sub>C\<^sup>o\<^sup>p h)) \\<^sub>D (F f \\<^sub>D\<^sup>o\<^sup>p \ (snd (g, h), fst (g, h))) \\<^sub>D D'.\ (F f) (F g) (F h)" using f g h fg gh C.VV.in_hom_char FF_def C.VV.arr_char C.VV.dom_simp C.VV.cod_simp C'.assoc_ide_simp D'.assoc_ide_simp preserves_inv assoc_coherence D.invert_opposite_sides_of_square [of "F (\\<^sub>C h g f)" "\ (g \\<^sub>C\<^sup>o\<^sup>p h, f) \\<^sub>D (F f \\<^sub>D\<^sup>o\<^sup>p \ (h, g))" "\ (h, f \\<^sub>C\<^sup>o\<^sup>p g) \\<^sub>D (\ (g, f) \\<^sub>D\<^sup>o\<^sup>p F h)" "\\<^sub>D (F h) (F g) (F f)"] D.comp_assoc by auto qed lemma induces_pseudofunctor_between_opposites: shows "pseudofunctor (\\<^sub>C) (\\<^sub>C\<^sup>o\<^sup>p) C'.\ \\<^sub>C C'.src C'.trg (\\<^sub>D) (\\<^sub>D\<^sup>o\<^sup>p) D'.\ \\<^sub>D D'.src D'.trg F (\f. \ (snd f, fst f))" .. text \ It is now easy to dualize the coherence condition for \F\ with respect to left unitors to obtain the corresponding condition for right unitors. \ lemma runit_coherence: assumes "C.ide f" shows "\\<^sub>D[F f] = F \\<^sub>C[f] \\<^sub>D \ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D unit (src\<^sub>C f))" proof - have "C'.lunit f = \\<^sub>C[f]" using assms C'.lunit_ide_simp by simp moreover have "D'.lunit (F f) = \\<^sub>D[F f]" using assms D'.lunit_ide_simp by simp moreover have "F'.unit (src\<^sub>C f) = unit (src\<^sub>C f)" using assms F'.unit_char F'.preserves_trg by (intro unit_eqI) auto moreover have "D'.lunit (F f) = F (C'.lunit f) \\<^sub>D \ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D F'.unit (src\<^sub>C f))" using assms F'.lunit_coherence by simp ultimately show ?thesis by simp qed end subsection "Preservation Properties" text \ The objective of this section is to establish explicit formulas for the result of applying a pseudofunctor to expressions of various forms. \ context pseudofunctor begin lemma preserves_lunit: assumes "C.ide f" shows "F \\<^sub>C[f] = \\<^sub>D[F f] \\<^sub>D (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F f) \\<^sub>D D.inv (\ (trg\<^sub>C f, f))" and "F \\<^sub>C\<^sup>-\<^sup>1[f] = \ (trg\<^sub>C f, f) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f]" proof - show 1: "F \\<^sub>C[f] = \\<^sub>D[F f] \\<^sub>D (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F f) \\<^sub>D D.inv (\ (trg\<^sub>C f, f))" proof - have "\\<^sub>D[F f] \\<^sub>D D.inv (\ (trg\<^sub>C f, f) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f)) = F \\<^sub>C[f]" proof - have "D.arr \\<^sub>D[F f]" using assms by simp moreover have "\\<^sub>D[F f] = F \\<^sub>C[f] \\<^sub>D \ (trg\<^sub>C f, f) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f)" using assms lunit_coherence by simp moreover have "D.iso (\ (trg\<^sub>C f, f) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f))" using assms unit_char cmp_components_are_iso by (intro D.isos_compose D.seqI) auto ultimately show ?thesis using assms D.invert_side_of_triangle(2) by metis qed moreover have "D.inv (\ (trg\<^sub>C f, f) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f)) = (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F f) \\<^sub>D D.inv (\ (trg\<^sub>C f, f))" using assms C.VV.arr_char unit_char FF_def D.inv_comp C.VV.dom_simp by simp ultimately show ?thesis by simp qed show "F \\<^sub>C\<^sup>-\<^sup>1[f] = \ (trg\<^sub>C f, f) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f]" proof - have "F \\<^sub>C\<^sup>-\<^sup>1[f] = D.inv (\\<^sub>D[F f] \\<^sub>D (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F f) \\<^sub>D D.inv (\ (trg\<^sub>C f, f)))" using assms 1 preserves_inv by simp also have "... = \ (trg\<^sub>C f, f) \\<^sub>D (unit (trg\<^sub>C f) \\<^sub>D F f) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f]" using assms unit_char D.comp_assoc D.isos_compose by (auto simp add: D.inv_comp) finally show ?thesis by simp qed qed lemma preserves_runit: assumes "C.ide f" shows "F \\<^sub>C[f] = \\<^sub>D[F f] \\<^sub>D (F f \\<^sub>D D.inv (unit (src\<^sub>C f))) \\<^sub>D D.inv (\ (f, src\<^sub>C f))" and "F \\<^sub>C\<^sup>-\<^sup>1[f] = \ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D unit (src\<^sub>C f)) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f]" proof - show 1: "F \\<^sub>C[f] = \\<^sub>D[F f] \\<^sub>D (F f \\<^sub>D D.inv (unit (src\<^sub>C f))) \\<^sub>D D.inv (\ (f, src\<^sub>C f))" proof - have "F \\<^sub>C[f] = \\<^sub>D[F f] \\<^sub>D D.inv (\ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D unit (src\<^sub>C f)))" proof - have "\\<^sub>D[F f] = F \\<^sub>C[f] \\<^sub>D \ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D unit (src\<^sub>C f))" using assms runit_coherence by simp moreover have "D.iso (\ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D unit (src\<^sub>C f)))" using assms unit_char D.iso_hcomp FF_def apply (intro D.isos_compose D.seqI) by auto moreover have "D.arr \\<^sub>D[F f]" using assms by simp ultimately show ?thesis using assms D.invert_side_of_triangle(2) by metis qed moreover have "D.inv (\ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D unit (src\<^sub>C f))) = (F f \\<^sub>D D.inv (unit (src\<^sub>C f))) \\<^sub>D D.inv (\ (f, src\<^sub>C f))" using assms C.VV.arr_char unit_char D.iso_hcomp FF_def D.inv_comp C.VV.dom_simp by simp ultimately show ?thesis by simp qed show "F \\<^sub>C\<^sup>-\<^sup>1[f] = \ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D unit (src\<^sub>C f)) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f]" proof - have "F \\<^sub>C\<^sup>-\<^sup>1[f] = D.inv (\\<^sub>D[F f] \\<^sub>D (F f \\<^sub>D D.inv (unit (src\<^sub>C f))) \\<^sub>D D.inv (\ (f, src\<^sub>C f)))" using assms 1 preserves_inv C.iso_runit by simp also have "... = \ (f, src\<^sub>C f) \\<^sub>D (F f \\<^sub>D unit (src\<^sub>C f)) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f]" using assms unit_char D.comp_assoc D.isos_compose by (auto simp add: D.inv_comp) finally show ?thesis by simp qed qed lemma preserves_assoc: assumes "C.ide f" and "C.ide g" and "C.ide h" and "src\<^sub>C f = trg\<^sub>C g" and "src\<^sub>C g = trg\<^sub>C h" shows "F \\<^sub>C[f, g, h] = \ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h] \\<^sub>D (D.inv (\ (f, g)) \\<^sub>D F h) \\<^sub>D D.inv (\ (f \\<^sub>C g, h))" and "F \\<^sub>C\<^sup>-\<^sup>1[f, g, h] = \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f, F g, F h] \\<^sub>D (F f \\<^sub>D D.inv (\ (g, h))) \\<^sub>D D.inv (\ (f, g \\<^sub>C h))" proof - show 1: "F \\<^sub>C[f, g, h] = \ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h] \\<^sub>D (D.inv (\ (f, g)) \\<^sub>D F h) \\<^sub>D D.inv (\ (f \\<^sub>C g, h))" proof - have "F \\<^sub>C[f, g, h] \\<^sub>D \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h) = \ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h]" using assms assoc_coherence [of f g h] by simp moreover have "D.seq (\ (f, g \\<^sub>C h)) ((F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h])" using assms C.VV.arr_char FF_def C.VV.dom_simp C.VV.cod_simp by auto moreover have 2: "D.iso (\ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h))" using assms C.VV.arr_char FF_def C.VV.dom_simp C.VV.cod_simp by auto moreover have "D.inv (\ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h)) = (D.inv (\ (f, g)) \\<^sub>D F h) \\<^sub>D D.inv (\ (f \\<^sub>C g, h))" using assms 2 C.VV.arr_char FF_def D.inv_comp C.VV.dom_simp C.VV.cod_simp by simp ultimately show ?thesis using D.invert_side_of_triangle(2) [of "\ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h]" "F \\<^sub>C[f, g, h]" "\ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h)"] D.comp_assoc by simp qed show "F \\<^sub>C\<^sup>-\<^sup>1[f, g, h] = \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f, F g, F h] \\<^sub>D (F f \\<^sub>D D.inv (\ (g, h))) \\<^sub>D D.inv (\ (f, g \\<^sub>C h))" proof - have "F \\<^sub>C\<^sup>-\<^sup>1[f, g, h] = D.inv (\ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h] \\<^sub>D (D.inv (\ (f, g)) \\<^sub>D F h) \\<^sub>D D.inv (\ (f \\<^sub>C g, h)))" using assms 1 preserves_inv by simp also have "... = \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h) \\<^sub>D \\<^sub>D\<^sup>-\<^sup>1[F f, F g, F h] \\<^sub>D (F f \\<^sub>D D.inv (\ (g, h))) \\<^sub>D D.inv (\ (f, g \\<^sub>C h))" proof - have "\\ (f, g \\<^sub>C h) : F f \\<^sub>D F (g \\<^sub>C h) \\<^sub>D F (f \\<^sub>C g \\<^sub>C h)\ \ D.iso (\ (f, g \\<^sub>C h))" using assms by auto moreover have "\F f \\<^sub>D \ (g, h) : F f \\<^sub>D F g \\<^sub>D F h \\<^sub>D F f \\<^sub>D F (g \\<^sub>C h)\ \ D.iso (F f \\<^sub>D \ (g, h))" using assms by (intro conjI D.hcomp_in_vhom, auto) ultimately show ?thesis - using assms D.isos_compose D.comp_assoc - by (elim conjE D.in_homE) (auto simp add: D.inv_comp) + using assms D.isos_compose D.comp_assoc D.inv_comp + by (elim conjE D.in_homE) auto qed finally show ?thesis by simp qed qed lemma preserves_hcomp: assumes "C.hseq \ \" shows "F (\ \\<^sub>C \) = \ (C.cod \, C.cod \) \\<^sub>D (F \ \\<^sub>D F \) \\<^sub>D D.inv (\ (C.dom \, C.dom \))" proof - have "F (\ \\<^sub>C \) \\<^sub>D \ (C.dom \, C.dom \) = \ (C.cod \, C.cod \) \\<^sub>D (F \ \\<^sub>D F \)" using assms \.naturality C.VV.arr_char C.VV.cod_char FF_def C.VV.dom_simp by auto thus ?thesis by (metis (no_types) assms C.hcomp_simps(3) C.hseqE C.ide_dom C.src_dom C.trg_dom D.comp_arr_inv' D.comp_assoc cmp_components_are_iso cmp_simps(5) as_nat_trans.is_natural_1) qed lemma preserves_adjunction_data: assumes "adjunction_data_in_bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C f g \ \" shows "adjunction_data_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D (F f) (F g) (D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f)) (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g))" proof interpret adjunction_data_in_bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C f g \ \ using assms by auto show "D.ide (F f)" using preserves_ide by simp show "D.ide (F g)" using preserves_ide by simp show "\D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f) : src\<^sub>D (F f) \\<^sub>D F g \\<^sub>D F f\" using antipar C.VV.ide_char C.VV.arr_char cmp_in_hom(2) unit_in_hom FF_def by auto show "\D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g) : F f \\<^sub>D F g \\<^sub>D src\<^sub>D (F g)\" using antipar C.VV.ide_char C.VV.arr_char FF_def cmp_in_hom(2) unit_in_hom(2) unit_char(2) by auto qed lemma preserves_equivalence: assumes "equivalence_in_bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C f g \ \" shows "equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D (F f) (F g) (D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f)) (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g))" proof - interpret equivalence_in_bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C f g \ \ using assms by auto show "equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D (F f) (F g) (D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f)) (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g))" using antipar unit_is_iso preserves_iso unit_char(2) C.VV.ide_char C.VV.arr_char FF_def D.isos_compose by (unfold_locales) auto qed lemma preserves_equivalence_maps: assumes "C.equivalence_map f" shows "D.equivalence_map (F f)" proof - obtain g \ \ where E: "equivalence_in_bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C f g \ \" using assms C.equivalence_map_def by auto interpret E: equivalence_in_bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C f g \ \ using E by auto show ?thesis using E preserves_equivalence C.equivalence_map_def D.equivalence_map_def map\<^sub>0_simps by blast qed lemma preserves_equivalent_objects: assumes "C.equivalent_objects a b" shows "D.equivalent_objects (map\<^sub>0 a) (map\<^sub>0 b)" using assms D.equivalent_objects_def preserves_equivalence_maps unfolding C.equivalent_objects_def by fast lemma preserves_isomorphic: assumes "C.isomorphic f g" shows "D.isomorphic (F f) (F g)" using assms C.isomorphic_def D.isomorphic_def preserves_iso by auto lemma preserves_quasi_inverses: assumes "C.quasi_inverses f g" shows "D.quasi_inverses (F f) (F g)" using assms C.quasi_inverses_def D.quasi_inverses_def preserves_equivalence by blast lemma preserves_quasi_inverse: assumes "C.equivalence_map f" shows "D.isomorphic (F (C.some_quasi_inverse f)) (D.some_quasi_inverse (F f))" using assms preserves_quasi_inverses C.quasi_inverses_some_quasi_inverse D.quasi_inverse_unique D.quasi_inverses_some_quasi_inverse preserves_equivalence_maps by blast end subsection "Identity Pseudofunctors" locale identity_pseudofunctor = B: bicategory V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B for V\<^sub>B :: "'b comp" (infixr "\\<^sub>B" 55) and H\<^sub>B :: "'b comp" (infixr "\\<^sub>B" 53) and \\<^sub>B :: "'b \ 'b \ 'b \ 'b" ("\\<^sub>B[_, _, _]") and \\<^sub>B :: "'b \ 'b" ("\\<^sub>B[_]") and src\<^sub>B :: "'b \ 'b" and trg\<^sub>B :: "'b \ 'b" begin text\ The underlying vertical functor is just the identity functor on the vertical category, which is already available as \B.map\. \ abbreviation map where "map \ B.map" interpretation I: weak_arrow_of_homs V\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>B src\<^sub>B trg\<^sub>B map using B.isomorphic_reflexive by unfold_locales auto interpretation II: "functor" B.VV.comp B.VV.comp I.FF using I.functor_FF by simp interpretation H\<^sub>BoII: composite_functor B.VV.comp B.VV.comp V\<^sub>B I.FF \\\\. fst \\ \\<^sub>B snd \\\ .. interpretation IoH\<^sub>B: composite_functor B.VV.comp V\<^sub>B V\<^sub>B \\\\. fst \\ \\<^sub>B snd \\\ map .. text\ The horizontal composition provides the compositor. \ abbreviation cmp where "cmp \ \\\. fst \\ \\<^sub>B snd \\" interpretation cmp: natural_transformation B.VV.comp V\<^sub>B H\<^sub>BoII.map IoH\<^sub>B.map cmp using B.VV.arr_char B.VV.dom_simp B.VV.cod_simp B.H.as_nat_trans.is_natural_1 B.H.as_nat_trans.is_natural_2 I.FF_def apply unfold_locales apply auto by (meson B.hseqE B.hseq_char')+ interpretation cmp: natural_isomorphism B.VV.comp V\<^sub>B H\<^sub>BoII.map IoH\<^sub>B.map cmp by unfold_locales simp sublocale pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B map cmp apply unfold_locales by (metis B.assoc_is_natural_2 B.assoc_naturality B.assoc_simps(1) B.comp_ide_self B.hcomp_simps(1) B.ide_char B.ide_hcomp B.map_simp fst_conv snd_conv) lemma is_pseudofunctor: shows "pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B map cmp" .. lemma unit_char': assumes "B.obj a" shows "unit a = a" proof - have "src\<^sub>B a = a \ B.ide a" using assms by auto hence "a = unit a" using assms B.comp_arr_dom B.comp_cod_arr I.map\<^sub>0_def map_def B.ide_in_hom(2) B.objE [of a] B.ide_is_iso [of a] by (intro unit_eqI) auto thus ?thesis by simp qed end lemma (in identity_pseudofunctor) map\<^sub>0_simp [simp]: assumes "B.obj a" shows "map\<^sub>0 a = a" using assms map\<^sub>0_def by auto (* TODO: Does not recognize map\<^sub>0_def unless the context is closed, then re-opened. *) subsection "Embedding Pseudofunctors" text \ In this section, we construct the embedding pseudofunctor of a sub-bicategory into the ambient bicategory. \ locale embedding_pseudofunctor = B: bicategory V H \\<^sub>B \ src\<^sub>B trg\<^sub>B + S: subbicategory begin no_notation B.in_hom ("\_ : _ \\<^sub>B _\") notation B.in_hhom ("\_ : _ \\<^sub>B _\") definition map where "map \ = (if S.arr \ then \ else B.null)" lemma map_in_hom [intro]: assumes "S.arr \" shows "\map \ : src\<^sub>B (map (S.src \)) \\<^sub>B src\<^sub>B (map (S.trg \))\" and "\map \ : map (S.dom \) \\<^sub>B map (S.cod \)\" proof - show 1: "\map \ : map (S.dom \) \\<^sub>B map (S.cod \)\" using assms map_def S.in_hom_char by fastforce show "\map \ : src\<^sub>B (map (S.src \)) \\<^sub>B src\<^sub>B (map (S.trg \))\" using assms 1 map_def S.arr_char S.src_def S.trg_def S.obj_char S.obj_src S.obj_trg by auto qed lemma map_simps [simp]: assumes "S.arr \" shows "B.arr (map \)" and "src\<^sub>B (map \) = src\<^sub>B (map (S.src \))" and "trg\<^sub>B (map \) = src\<^sub>B (map (S.trg \))" and "B.dom (map \) = map (S.dom \)" and "B.cod (map \) = map (S.cod \)" using assms map_in_hom by blast+ interpretation "functor" S.comp V map apply unfold_locales apply auto using map_def S.comp_char S.seq_char S.arr_char apply auto[1] using map_def S.comp_simp by auto interpretation weak_arrow_of_homs S.comp S.src S.trg V src\<^sub>B trg\<^sub>B map using S.arr_char map_def S.src_def S.trg_def S.src_closed S.trg_closed B.isomorphic_reflexive preserves_ide S.ide_src S.ide_trg apply unfold_locales by presburger+ interpretation HoFF: composite_functor S.VV.comp B.VV.comp V FF \\\\. fst \\ \\<^sub>B snd \\\ .. interpretation FoH: composite_functor S.VV.comp S.comp V \\\\. fst \\ \ snd \\\ map .. no_notation B.in_hom ("\_ : _ \\<^sub>B _\") definition cmp where "cmp \\ = (if S.VV.arr \\ then fst \\ \\<^sub>B snd \\ else B.null)" lemma cmp_in_hom [intro]: assumes "S.VV.arr \\" shows "\cmp \\ : src\<^sub>B (snd \\) \\<^sub>B trg\<^sub>B (fst \\)\" and "\cmp \\ : map (S.dom (fst \\)) \\<^sub>B map (S.dom (snd \\)) \\<^sub>B map (S.cod (fst \\) \ S.cod (snd \\))\" proof - show "\cmp \\ : map (S.dom (fst \\)) \\<^sub>B map (S.dom (snd \\)) \\<^sub>B map (S.cod (fst \\) \ S.cod (snd \\))\" proof show 1: "B.arr (cmp \\)" unfolding cmp_def using assms S.arr_char S.VV.arr_char S.inclusion S.src_def S.trg_def by auto show "B.dom (cmp \\) = map (S.dom (fst \\)) \\<^sub>B map (S.dom (snd \\))" unfolding cmp_def map_def using assms 1 cmp_def S.dom_simp S.cod_simp S.VV.arr_char S.arr_char S.hcomp_def S.inclusion S.dom_closed by auto show "B.cod (cmp \\) = map (S.cod (fst \\) \ S.cod (snd \\))" unfolding cmp_def map_def using assms 1 S.H.preserves_arr S.cod_simp S.hcomp_eqI S.hcomp_simps(4) S.hseq_char' by auto qed thus "\cmp \\ : src\<^sub>B (snd \\) \\<^sub>B trg\<^sub>B (fst \\)\" using cmp_def by auto qed lemma cmp_simps [simp]: assumes "S.VV.arr \\" shows "B.arr (cmp \\)" and "src\<^sub>B (cmp \\) = S.src (snd \\)" and "trg\<^sub>B (cmp \\) = S.trg (fst \\)" and "B.dom (cmp \\) = map (S.dom (fst \\)) \\<^sub>B map (S.dom (snd \\))" and "B.cod (cmp \\) = map (S.cod (fst \\) \ S.cod (snd \\))" using assms cmp_in_hom S.src_def S.trg_def S.VV.arr_char by simp_all blast+ lemma iso_cmp: assumes "S.VV.ide \\" shows "B.iso (cmp \\)" using assms S.VV.ide_char S.VV.arr_char S.arr_char cmp_def S.ide_char S.src_def S.trg_def by auto interpretation \\<^sub>E: natural_isomorphism S.VV.comp V HoFF.map FoH.map cmp proof show "\\\. \ S.VV.arr \\ \ cmp \\ = B.null" using cmp_def by simp fix \\ assume \\: "S.VV.arr \\" have 1: "S.arr (fst \\) \ S.arr (snd \\) \ S.src (fst \\) = S.trg (snd \\)" using \\ S.VV.arr_char by simp show "B.dom (cmp \\) = HoFF.map (S.VV.dom \\)" using \\ FF_def S.VV.arr_char S.VV.dom_char S.arr_dom S.src_def S.trg_def S.dom_char S.src.preserves_dom S.trg.preserves_dom apply simp by (metis (no_types, lifting)) show "B.cod (cmp \\) = FoH.map (S.VV.cod \\)" using \\ 1 map_def S.hseq_char S.hcomp_def S.cod_char S.arr_cod S.VV.cod_simp by simp show "cmp (S.VV.cod \\) \\<^sub>B HoFF.map \\ = cmp \\" using \\ 1 cmp_def S.VV.arr_char S.VV.cod_char FF_def S.arr_cod S.cod_simp S.src_def S.trg_def map_def apply simp by (metis (no_types, lifting) B.comp_cod_arr B.hcomp_simps(4) cmp_simps(1) \\) show "FoH.map \\ \\<^sub>B cmp (S.VV.dom \\) = cmp \\" unfolding cmp_def map_def using \\ S.VV.arr_char B.VV.arr_char S.VV.dom_char S.VV.cod_char B.comp_arr_dom S.hcomp_def apply simp by (metis (no_types, lifting) B.hcomp_simps(3) cmp_def cmp_simps(1) S.arr_char S.dom_char S.hcomp_closed S.src_def S.trg_def) next show "\fg. S.VV.ide fg \ B.iso (cmp fg)" using iso_cmp by simp qed sublocale pseudofunctor S.comp S.hcomp S.\ \ S.src S.trg V H \\<^sub>B \ src\<^sub>B trg\<^sub>B map cmp proof fix f g h assume f: "S.ide f" and g: "S.ide g" and h: "S.ide h" and fg: "S.src f = S.trg g" and gh: "S.src g = S.trg h" have 1: "B.ide f \ B.ide g \ B.ide h \ src\<^sub>B f = trg\<^sub>B g \ src\<^sub>B g = trg\<^sub>B h" using f g h fg gh S.ide_char S.arr_char S.src_def S.trg_def by simp show "map (S.\ f g h) \\<^sub>B cmp (f \ g, h) \\<^sub>B cmp (f, g) \\<^sub>B map h = cmp (f, g \ h) \\<^sub>B (map f \\<^sub>B cmp (g, h)) \\<^sub>B \\<^sub>B[map f, map g, map h]" proof - have "map (S.\ f g h) \\<^sub>B cmp (f \ g, h) \\<^sub>B cmp (f, g) \\<^sub>B map h = \\<^sub>B[f, g, h] \\<^sub>B ((f \\<^sub>B g) \\<^sub>B h) \\<^sub>B ((f \\<^sub>B g) \\<^sub>B h)" unfolding map_def cmp_def using 1 f g h fg gh S.VVV.arr_char S.VV.arr_char B.VVV.arr_char B.VV.arr_char B.comp_arr_dom S.arr_char S.comp_char S.hcomp_closed S.hcomp_def S.ideD(1) S.src_def by (simp add: S.assoc_closed) also have "... = cmp (f, g \ h) \\<^sub>B (map f \\<^sub>B cmp (g, h)) \\<^sub>B \\<^sub>B[map f, map g, map h]" unfolding cmp_def map_def using 1 f g h fg gh S.VV.arr_char B.VVV.arr_char B.VV.arr_char B.comp_arr_dom B.comp_cod_arr S.hcomp_def S.comp_char S.arr_char S.assoc_closed S.hcomp_closed S.ideD(1) S.trg_def by auto finally show ?thesis by blast qed qed lemma is_pseudofunctor: shows "pseudofunctor S.comp S.hcomp S.\ \ S.src S.trg V H \\<^sub>B \ src\<^sub>B trg\<^sub>B map cmp" .. lemma map\<^sub>0_simp [simp]: assumes "S.obj a" shows "map\<^sub>0 a = a" using assms map\<^sub>0_def map_def S.obj_char by auto lemma unit_char': assumes "S.obj a" shows "unit a = a" proof - have a: "S.arr a" using assms by auto have 1: "B.ide a" using assms S.obj_char by auto have 2: "src\<^sub>B a = a" using assms S.obj_char by auto have "a = unit a" proof (intro unit_eqI) show "S.obj a" by fact show "\a : map\<^sub>0 a \\<^sub>B map a\" using assms a 2 map\<^sub>0_def map_def S.src_def S.dom_char S.cod_char S.obj_char by auto show "B.iso a" using assms 1 by simp show "a \\<^sub>B \[map\<^sub>0 a] = (map \[a] \\<^sub>B cmp (a, a)) \\<^sub>B (a \\<^sub>B a)" proof - have "a \\<^sub>B \[a] = \[a] \\<^sub>B cmp (a, a) \\<^sub>B (a \\<^sub>B a)" proof - have "a \\<^sub>B \[a] = \[a]" using assms 1 2 S.comp_cod_arr S.unitor_coincidence S.lunit_in_hom S.obj_char S.comp_simp by auto moreover have "(a \\<^sub>B a) \\<^sub>B (a \\<^sub>B a) = a \\<^sub>B a" using assms S.obj_char S.comp_ide_self by auto moreover have "B.dom \[a] = a \\<^sub>B a" using assms S.obj_char by simp moreover have "\[a] \\<^sub>B (a \\<^sub>B a) = \[a]" using assms S.obj_char B.comp_arr_dom by simp ultimately show ?thesis using assms cmp_def S.VV.arr_char by auto qed thus ?thesis using assms a 2 map\<^sub>0_def map_def S.src_def B.comp_assoc by simp qed qed thus ?thesis by simp qed end subsection "Composition of Pseudofunctors" text \ In this section, we show how pseudofunctors may be composed. The main work is to establish the coherence condition for associativity. \ locale composite_pseudofunctor = B: bicategory V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B + C: bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C + D: bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D + F: pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C F \\<^sub>F + G: pseudofunctor V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D G \\<^sub>G for V\<^sub>B :: "'b comp" (infixr "\\<^sub>B" 55) and H\<^sub>B :: "'b comp" (infixr "\\<^sub>B" 53) and \\<^sub>B :: "'b \ 'b \ 'b \ 'b" ("\\<^sub>B[_, _, _]") and \\<^sub>B :: "'b \ 'b" ("\\<^sub>B[_]") and src\<^sub>B :: "'b \ 'b" and trg\<^sub>B :: "'b \ 'b" and V\<^sub>C :: "'c comp" (infixr "\\<^sub>C" 55) and H\<^sub>C :: "'c comp" (infixr "\\<^sub>C" 53) and \\<^sub>C :: "'c \ 'c \ 'c \ 'c" ("\\<^sub>C[_, _, _]") and \\<^sub>C :: "'c \ 'c" ("\\<^sub>C[_]") and src\<^sub>C :: "'c \ 'c" and trg\<^sub>C :: "'c \ 'c" and V\<^sub>D :: "'d comp" (infixr "\\<^sub>D" 55) and H\<^sub>D :: "'d comp" (infixr "\\<^sub>D" 53) and \\<^sub>D :: "'d \ 'd \ 'd \ 'd" ("\\<^sub>D[_, _, _]") and \\<^sub>D :: "'d \ 'd" ("\\<^sub>D[_]") and src\<^sub>D :: "'d \ 'd" and trg\<^sub>D :: "'d \ 'd" and F :: "'b \ 'c" and \\<^sub>F :: "'b * 'b \ 'c" and G :: "'c \ 'd" and \\<^sub>G :: "'c * 'c \ 'd" begin sublocale composite_functor V\<^sub>B V\<^sub>C V\<^sub>D F G .. sublocale weak_arrow_of_homs V\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>D src\<^sub>D trg\<^sub>D \G o F\ proof show "\\. B.arr \ \ D.isomorphic ((G o F) (src\<^sub>B \)) (src\<^sub>D ((G o F) \))" proof - fix \ assume \: "B.arr \" show "D.isomorphic ((G o F) (src\<^sub>B \)) (src\<^sub>D ((G o F) \))" proof - have "(G o F) (src\<^sub>B \) = G (F (src\<^sub>B \))" using \ by simp also have "D.isomorphic ... (G (src\<^sub>C (F \)))" using \ F.weakly_preserves_src G.preserves_iso by (meson C.isomorphicE D.isomorphic_def G.preserves_hom) also have "D.isomorphic ... (src\<^sub>D (G (F \)))" using \ G.weakly_preserves_src by blast also have "... = src\<^sub>D ((G o F) \)" by simp finally show ?thesis by blast qed qed show "\\. B.arr \ \ D.isomorphic ((G o F) (trg\<^sub>B \)) (trg\<^sub>D ((G o F) \))" proof - fix \ assume \: "B.arr \" show "D.isomorphic ((G o F) (trg\<^sub>B \)) (trg\<^sub>D ((G o F) \))" proof - have "(G o F) (trg\<^sub>B \) = G (F (trg\<^sub>B \))" using \ by simp also have "D.isomorphic ... (G (trg\<^sub>C (F \)))" using \ F.weakly_preserves_trg G.preserves_iso by (meson C.isomorphicE D.isomorphic_def G.preserves_hom) also have "D.isomorphic ... (trg\<^sub>D (G (F \)))" using \ G.weakly_preserves_trg by blast also have "... = trg\<^sub>D ((G o F) \)" by simp finally show ?thesis by blast qed qed qed interpretation H\<^sub>DoGF_GF: composite_functor B.VV.comp D.VV.comp V\<^sub>D FF \\\\. fst \\ \\<^sub>D snd \\\ .. interpretation GFoH\<^sub>B: composite_functor B.VV.comp V\<^sub>B V\<^sub>D \\\\. fst \\ \\<^sub>B snd \\\ \G o F\ .. definition cmp where "cmp \\ = (if B.VV.arr \\ then G (F (H\<^sub>B (fst \\) (snd \\))) \\<^sub>D G (\\<^sub>F (B.VV.dom \\)) \\<^sub>D \\<^sub>G (F (B.dom (fst \\)), F (B.dom (snd \\))) else D.null)" lemma cmp_in_hom [intro]: assumes "B.VV.arr \\" shows "\cmp \\ : H\<^sub>DoGF_GF.map (B.VV.dom \\) \\<^sub>D GFoH\<^sub>B.map (B.VV.cod \\)\" proof - have "cmp \\ = G (F (H\<^sub>B (fst \\) (snd \\))) \\<^sub>D G (\\<^sub>F (B.VV.dom \\)) \\<^sub>D \\<^sub>G (F (B.dom (fst \\)), F (B.dom (snd \\)))" using assms cmp_def by simp - moreover have "\ ... : H\<^sub>DoGF_GF.map (B.VV.dom \\) - \\<^sub>D GFoH\<^sub>B.map (B.VV.cod \\)\" + moreover have "\ ... : H\<^sub>DoGF_GF.map (B.VV.dom \\) \\<^sub>D GFoH\<^sub>B.map (B.VV.cod \\)\" proof (intro D.comp_in_homI) show "\\\<^sub>G (F (B.dom (fst \\)), F (B.dom (snd \\))) : H\<^sub>DoGF_GF.map (B.VV.dom \\) \\<^sub>D G (F (B.dom (fst \\)) \\<^sub>C F (B.dom (snd \\)))\" using assms F.FF_def FF_def B.VV.arr_char B.VV.dom_simp by auto show "\G (\\<^sub>F (B.VV.dom \\)) : G (F (B.dom (fst \\)) \\<^sub>C F (B.dom (snd \\))) \\<^sub>D GFoH\<^sub>B.map (B.VV.dom \\)\" using assms B.VV.arr_char F.FF_def B.VV.dom_simp B.VV.cod_simp by auto show "\G (F (fst \\ \\<^sub>B snd \\)) : GFoH\<^sub>B.map (B.VV.dom \\) \\<^sub>D GFoH\<^sub>B.map (B.VV.cod \\)\" proof - have "B.VV.in_hom \\ (B.VV.dom \\) (B.VV.cod \\)" using assms by auto thus ?thesis by auto qed qed ultimately show ?thesis by argo qed lemma cmp_simps [simp]: assumes "B.VV.arr \\" shows "D.arr (cmp \\)" and "D.dom (cmp \\) = H\<^sub>DoGF_GF.map (B.VV.dom \\)" and "D.cod (cmp \\) = GFoH\<^sub>B.map (B.VV.cod \\)" using assms cmp_in_hom by blast+ interpretation \: natural_transformation B.VV.comp V\<^sub>D H\<^sub>DoGF_GF.map GFoH\<^sub>B.map cmp proof show "\\\. \ B.VV.arr \\ \ cmp \\ = D.null" unfolding cmp_def by simp fix \\ assume \\: "B.VV.arr \\" show "D.dom (cmp \\) = H\<^sub>DoGF_GF.map (B.VV.dom \\)" using \\ cmp_in_hom by blast show "D.cod (cmp \\) = GFoH\<^sub>B.map (B.VV.cod \\)" using \\ cmp_in_hom by blast show "GFoH\<^sub>B.map \\ \\<^sub>D cmp (B.VV.dom \\) = cmp \\" unfolding cmp_def using \\ B.VV.ide_char B.VV.arr_char D.comp_ide_arr B.VV.dom_char D.comp_assoc as_nat_trans.is_natural_1 apply simp by (metis (no_types, lifting) B.H.preserves_arr B.hcomp_simps(3)) show "cmp (B.VV.cod \\) \\<^sub>D H\<^sub>DoGF_GF.map \\ = cmp \\" proof - have "cmp (B.VV.cod \\) \\<^sub>D H\<^sub>DoGF_GF.map \\ = (G (F (B.cod (fst \\) \\<^sub>B B.cod (snd \\))) \\<^sub>D G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D \\<^sub>G (F (B.cod (fst \\)), F (B.cod (snd \\)))) \\<^sub>D (fst (FF \\) \\<^sub>D snd (FF \\))" unfolding cmp_def using \\ B.VV.arr_char B.VV.dom_simp B.VV.cod_simp by simp also have "... = (G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D \\<^sub>G (F (B.cod (fst \\)), F (B.cod (snd \\)))) \\<^sub>D (fst (FF \\) \\<^sub>D snd (FF \\))" proof - have "D.ide (G (F (B.cod (fst \\) \\<^sub>B B.cod (snd \\))))" using \\ B.VV.arr_char by simp moreover have "D.seq (G (F (B.cod (fst \\) \\<^sub>B B.cod (snd \\)))) (G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D \\<^sub>G (F (B.cod (fst \\)), F (B.cod (snd \\))))" using \\ B.VV.arr_char B.VV.dom_char B.VV.cod_char F.FF_def apply (intro D.seqI) apply auto proof - show "G (F (B.cod (fst \\) \\<^sub>B B.cod (snd \\))) = D.cod (G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D \\<^sub>G (F (B.cod (fst \\)), F (B.cod (snd \\))))" proof - have "D.seq (G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\)))) (\\<^sub>G (F (B.cod (fst \\)), F (B.cod (snd \\))))" using \\ B.VV.arr_char F.FF_def B.VV.arr_char B.VV.dom_char B.VV.cod_char by (intro D.seqI) auto thus ?thesis using \\ B.VV.arr_char B.VV.cod_simp by simp qed qed ultimately show ?thesis using \\ D.comp_ide_arr [of "G (F (B.cod (fst \\) \\<^sub>B B.cod (snd \\)))" "G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D \\<^sub>G (F (B.cod (fst \\)), F (B.cod (snd \\)))"] by simp qed also have "... = G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D (\\<^sub>G (F (B.cod (fst \\)), F (B.cod (snd \\))) \\<^sub>D (fst (FF \\) \\<^sub>D snd (FF \\)))" using D.comp_assoc by simp also have "... = G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D \\<^sub>G (C.VV.cod (F.FF \\)) \\<^sub>D G.H\<^sub>DoFF.map (F.FF \\)" using \\ B.VV.arr_char F.FF_def G.FF_def FF_def C.VV.cod_simp by auto also have "... = G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D G.FoH\<^sub>C.map (F.FF \\) \\<^sub>D \\<^sub>G (C.VV.dom (F.FF \\))" using \\ B.VV.arr_char G.\.naturality C.VV.dom_simp C.VV.cod_simp by simp also have "... = (G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D G.FoH\<^sub>C.map (F.FF \\)) \\<^sub>D \\<^sub>G (C.VV.dom (F.FF \\))" using D.comp_assoc by simp also have "... = (G (\\<^sub>F (B.VV.cod \\) \\<^sub>C F.H\<^sub>DoFF.map \\)) \\<^sub>D \\<^sub>G (C.VV.dom (F.FF \\))" proof - have "(B.cod (fst \\), B.cod (snd \\)) = B.VV.cod \\" using \\ B.VV.arr_char B.VV.cod_simp by simp moreover have "G.FoH\<^sub>C.map (F.FF \\) = G (F.H\<^sub>DoFF.map \\)" using \\ F.FF_def by simp moreover have "G (\\<^sub>F (B.cod (fst \\), B.cod (snd \\))) \\<^sub>D G (F.H\<^sub>DoFF.map \\) = G (\\<^sub>F (B.VV.cod \\) \\<^sub>C F.H\<^sub>DoFF.map \\)" using \\ B.VV.arr_char by (metis (no_types, lifting) F.\.is_natural_2 F.\.preserves_reflects_arr G.preserves_comp calculation(1)) ultimately show ?thesis by argo qed also have "... = G (F.FoH\<^sub>C.map \\ \\<^sub>C \\<^sub>F (B.VV.dom \\)) \\<^sub>D \\<^sub>G (C.VV.dom (F.FF \\))" using \\ F.\.naturality [of \\] F.FF_def by simp also have "... = G (F.FoH\<^sub>C.map \\) \\<^sub>D G (\\<^sub>F (B.VV.dom \\)) \\<^sub>D \\<^sub>G (C.VV.dom (F.FF \\))" proof - have "G (F.FoH\<^sub>C.map \\ \\<^sub>C \\<^sub>F (B.VV.dom \\)) = G (F.FoH\<^sub>C.map \\) \\<^sub>D G (\\<^sub>F (B.VV.dom \\))" using \\ by (metis (mono_tags, lifting) F.\.is_natural_1 F.\.preserves_reflects_arr G.preserves_comp) thus ?thesis using \\ D.comp_assoc by simp qed also have "... = cmp \\" using \\ B.VV.arr_char cmp_def F.FF_def F.FF.preserves_dom B.VV.dom_simp by auto finally show ?thesis by simp qed qed interpretation \: natural_isomorphism B.VV.comp V\<^sub>D H\<^sub>DoGF_GF.map GFoH\<^sub>B.map cmp proof show "\hk. B.VV.ide hk \ D.iso (cmp hk)" proof - fix hk assume hk: "B.VV.ide hk" have "D.iso (G (F (fst hk \\<^sub>B snd hk)) \\<^sub>D G (\\<^sub>F (B.VV.dom hk)) \\<^sub>D \\<^sub>G (F (B.dom (fst hk)), F (B.dom (snd hk))))" proof (intro D.isos_compose) show "D.iso (\\<^sub>G (F (B.dom (fst hk)), F (B.dom (snd hk))))" using hk G.\.components_are_iso [of "(F (B.dom (fst hk)), F (B.dom (snd hk)))"] C.VV.ide_char B.VV.arr_char B.VV.dom_char by (metis (no_types, lifting) B.VV.ideD(1) B.VV.ideD(2) B.VxV.dom_char F.FF_def F.FF.as_nat_iso.components_are_iso G.\.preserves_iso fst_conv snd_conv) show "D.iso (G (\\<^sub>F (B.VV.dom hk)))" using hk F.\.components_are_iso B.VV.arr_char B.VV.dom_char B.VV.ideD(2) by auto show "D.seq (G (\\<^sub>F (B.VV.dom hk))) (\\<^sub>G (F (B.dom (fst hk)), F (B.dom (snd hk))))" using hk B.VV.arr_char B.VV.ide_char B.VV.dom_char C.VV.arr_char F.FF_def C.VV.dom_simp C.VV.cod_simp by auto show "D.iso (G (F (fst hk \\<^sub>B snd hk)))" using hk F.\.components_are_iso B.VV.arr_char by simp show "D.seq (G (F (fst hk \\<^sub>B snd hk))) (G (\\<^sub>F (B.VV.dom hk)) \\<^sub>D \\<^sub>G (F (B.dom (fst hk)), F (B.dom (snd hk))))" using hk B.VV.arr_char B.VV.dom_char by (metis (no_types, lifting) B.VV.ideD(1) cmp_def cmp_simps(1)) qed thus "D.iso (cmp hk)" unfolding cmp_def using hk by simp qed qed sublocale pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D \G o F\ cmp proof fix f g h assume f: "B.ide f" and g: "B.ide g" and h: "B.ide h" assume fg: "src\<^sub>B f = trg\<^sub>B g" and gh: "src\<^sub>B g = trg\<^sub>B h" show "map \\<^sub>B[f, g, h] \\<^sub>D cmp (f \\<^sub>B g, h) \\<^sub>D (cmp (f, g) \\<^sub>D map h) = cmp (f, g \\<^sub>B h) \\<^sub>D (map f \\<^sub>D cmp (g, h)) \\<^sub>D \\<^sub>D[map f, map g, map h]" proof - have "map \\<^sub>B[f, g, h] \\<^sub>D cmp (f \\<^sub>B g, h) \\<^sub>D (cmp (f, g) \\<^sub>D map h) = G (F \\<^sub>B[f, g, h]) \\<^sub>D (G (F ((f \\<^sub>B g) \\<^sub>B h)) \\<^sub>D G (\\<^sub>F (f \\<^sub>B g, h)) \\<^sub>D \\<^sub>G (F (f \\<^sub>B g), F h)) \\<^sub>D (G (F (f \\<^sub>B g)) \\<^sub>D G (\\<^sub>F (f, g)) \\<^sub>D \\<^sub>G (F f, F g) \\<^sub>D G (F h))" unfolding cmp_def using f g h fg gh B.VV.arr_char B.VV.dom_simp by simp also have "... = G (F \\<^sub>B[f, g, h]) \\<^sub>D (G (\\<^sub>F (f \\<^sub>B g, h)) \\<^sub>D \\<^sub>G (F (f \\<^sub>B g), F h)) \\<^sub>D (G (F (f \\<^sub>B g)) \\<^sub>D G (\\<^sub>F (f, g)) \\<^sub>D \\<^sub>G (F f, F g) \\<^sub>D G (F h))" using f g h fg gh D.comp_ide_arr D.comp_assoc by (metis B.ideD(1) B.ide_hcomp B.src_hcomp F.cmp_simps(1) F.cmp_simps(5) G.as_nat_trans.is_natural_2) also have "... = G (F \\<^sub>B[f, g, h]) \\<^sub>D (G (\\<^sub>F (f \\<^sub>B g, h)) \\<^sub>D \\<^sub>G (F (f \\<^sub>B g), F h)) \\<^sub>D (G (\\<^sub>F (f, g)) \\<^sub>D \\<^sub>G (F f, F g) \\<^sub>D G (F h))" using f g fg by (metis (no_types) D.comp_assoc F.cmp_simps(1) F.cmp_simps(5) G.as_nat_trans.is_natural_2) also have "... = (G (F \\<^sub>B[f, g, h]) \\<^sub>D G (\\<^sub>F (f \\<^sub>B g, h))) \\<^sub>D \\<^sub>G (F (f \\<^sub>B g), F h) \\<^sub>D (G (\\<^sub>F (f, g)) \\<^sub>D \\<^sub>G (F f, F g) \\<^sub>D G (F h))" using D.comp_assoc by simp also have "... = G (F \\<^sub>B[f, g, h] \\<^sub>C \\<^sub>F (f \\<^sub>B g, h)) \\<^sub>D \\<^sub>G (F (f \\<^sub>B g), F h) \\<^sub>D (G (\\<^sub>F (f, g)) \\<^sub>D \\<^sub>G (F f, F g) \\<^sub>D G (F h))" using f g h fg gh B.VV.arr_char B.VV.cod_simp by simp also have "... = G (F \\<^sub>B[f, g, h] \\<^sub>C \\<^sub>F (f \\<^sub>B g, h)) \\<^sub>D \\<^sub>G (F (f \\<^sub>B g), F h) \\<^sub>D (G (\\<^sub>F (f, g)) \\<^sub>D G (F h)) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using f g h fg gh B.VV.arr_char C.VV.arr_char F.FF_def D.whisker_right B.VV.dom_simp C.VV.cod_simp by auto also have "... = G (F \\<^sub>B[f, g, h] \\<^sub>C \\<^sub>F (f \\<^sub>B g, h)) \\<^sub>D (\\<^sub>G (F (f \\<^sub>B g), F h) \\<^sub>D (G (\\<^sub>F (f, g)) \\<^sub>D G (F h))) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using D.comp_assoc by simp also have "... = G (F \\<^sub>B[f, g, h] \\<^sub>C \\<^sub>F (f \\<^sub>B g, h)) \\<^sub>D (G (\\<^sub>F (f, g) \\<^sub>C F h) \\<^sub>D \\<^sub>G (F f \\<^sub>C F g, F h)) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" proof - have "\\<^sub>G (F (f \\<^sub>B g), F h) = \\<^sub>G (C.VV.cod (\\<^sub>F (f, g), F h))" using f g h fg gh B.VV.arr_char C.VV.arr_char B.VV.cod_simp C.VV.cod_simp by simp moreover have "G (\\<^sub>F (f, g)) \\<^sub>D G (F h) = G.H\<^sub>DoFF.map (\\<^sub>F (f, g), F h)" using f g h fg gh B.VV.arr_char C.VV.arr_char G.FF_def by simp moreover have "G.FoH\<^sub>C.map (\\<^sub>F (f, g), F h) = G (\\<^sub>F (f, g) \\<^sub>C F h)" using f g h fg gh B.VV.arr_char by simp moreover have "\\<^sub>G (C.VV.dom (\\<^sub>F (f, g), F h)) = \\<^sub>G (F f \\<^sub>C F g, F h)" using f g h fg gh C.VV.arr_char F.cmp_in_hom [of f g] C.VV.dom_simp by auto ultimately show ?thesis using f g h fg gh B.VV.arr_char G.\.naturality by (metis (mono_tags, lifting) C.VV.arr_cod_iff_arr C.VV.arr_dom_iff_arr G.FoH\<^sub>C.is_extensional G.H\<^sub>DoFF.is_extensional G.\.is_extensional) qed also have "... = (G (F \\<^sub>B[f, g, h] \\<^sub>C \\<^sub>F (f \\<^sub>B g, h)) \\<^sub>D (G (\\<^sub>F (f, g) \\<^sub>C F h))) \\<^sub>D \\<^sub>G (F f \\<^sub>C F g, F h) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using D.comp_assoc by simp also have "... = G ((F \\<^sub>B[f, g, h] \\<^sub>C \\<^sub>F (f \\<^sub>B g, h)) \\<^sub>C (\\<^sub>F (f, g) \\<^sub>C F h)) \\<^sub>D \\<^sub>G (F f \\<^sub>C F g, F h) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using f g h fg gh B.VV.arr_char F.FF_def B.VV.dom_simp B.VV.cod_simp by auto also have "... = G (F \\<^sub>B[f, g, h] \\<^sub>C \\<^sub>F (f \\<^sub>B g, h) \\<^sub>C (\\<^sub>F (f, g) \\<^sub>C F h)) \\<^sub>D \\<^sub>G (F f \\<^sub>C F g, F h) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using C.comp_assoc by simp also have "... = G (\\<^sub>F (f, g \\<^sub>B h) \\<^sub>C (F f \\<^sub>C \\<^sub>F (g, h)) \\<^sub>C \\<^sub>C[F f, F g, F h]) \\<^sub>D \\<^sub>G (F f \\<^sub>C F g, F h) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using f g h fg gh F.assoc_coherence [of f g h] by simp also have "... = G ((\\<^sub>F (f, g \\<^sub>B h) \\<^sub>C (F f \\<^sub>C \\<^sub>F (g, h))) \\<^sub>C \\<^sub>C[F f, F g, F h]) \\<^sub>D \\<^sub>G (F f \\<^sub>C F g, F h) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using C.comp_assoc by simp also have "... = (G (\\<^sub>F (f, g \\<^sub>B h) \\<^sub>C (F f \\<^sub>C \\<^sub>F (g, h))) \\<^sub>D G \\<^sub>C[F f, F g, F h]) \\<^sub>D \\<^sub>G (F f \\<^sub>C F g, F h) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using f g h fg gh B.VV.arr_char F.FF_def B.VV.dom_simp B.VV.cod_simp by auto also have "... = G (\\<^sub>F (f, g \\<^sub>B h) \\<^sub>C (F f \\<^sub>C \\<^sub>F (g, h))) \\<^sub>D G \\<^sub>C[F f, F g, F h] \\<^sub>D \\<^sub>G (F f \\<^sub>C F g, F h) \\<^sub>D (\\<^sub>G (F f, F g) \\<^sub>D G (F h))" using D.comp_assoc by simp also have "... = G (\\<^sub>F (f, g \\<^sub>B h) \\<^sub>C (F f \\<^sub>C \\<^sub>F (g, h))) \\<^sub>D \\<^sub>G (F f, F g \\<^sub>C F h) \\<^sub>D (G (F f) \\<^sub>D \\<^sub>G (F g, F h)) \\<^sub>D \\<^sub>D[G (F f), G (F g), G (F h)]" using f g h fg gh G.assoc_coherence [of "F f" "F g" "F h"] by simp also have "... = (G (\\<^sub>F (f, g \\<^sub>B h) \\<^sub>C (F f \\<^sub>C \\<^sub>F (g, h))) \\<^sub>D \\<^sub>G (F f, F g \\<^sub>C F h) \\<^sub>D (G (F f) \\<^sub>D \\<^sub>G (F g, F h))) \\<^sub>D \\<^sub>D[G (F f), G (F g), G (F h)]" using D.comp_assoc by simp also have "... = (cmp (f, g \\<^sub>B h) \\<^sub>D (G (F f) \\<^sub>D cmp (g, h))) \\<^sub>D \\<^sub>D[G (F f), G (F g), G (F h)]" proof - have "G (\\<^sub>F (f, g \\<^sub>B h) \\<^sub>C (F f \\<^sub>C \\<^sub>F (g, h))) \\<^sub>D \\<^sub>G (F f, F g \\<^sub>C F h) \\<^sub>D (G (F f) \\<^sub>D \\<^sub>G (F g, F h)) = cmp (f, g \\<^sub>B h) \\<^sub>D (G (F f) \\<^sub>D cmp (g, h))" proof - have "cmp (f, g \\<^sub>B h) \\<^sub>D (G (F f) \\<^sub>D cmp (g, h)) = (G (F (f \\<^sub>B g \\<^sub>B h)) \\<^sub>D G (\\<^sub>F (f, g \\<^sub>B h)) \\<^sub>D \\<^sub>G (F f, F (g \\<^sub>B h))) \\<^sub>D (G (F f) \\<^sub>D G (F (g \\<^sub>B h)) \\<^sub>D G (\\<^sub>F (g, h)) \\<^sub>D \\<^sub>G (F g, F h))" unfolding cmp_def using f g h fg gh B.VV.arr_char B.VV.dom_simp B.VV.cod_simp by simp also have "... = (G (\\<^sub>F (f, g \\<^sub>B h)) \\<^sub>D \\<^sub>G (F f, F (g \\<^sub>B h))) \\<^sub>D (G (F f) \\<^sub>D G (F (g \\<^sub>B h)) \\<^sub>D G (\\<^sub>F (g, h)) \\<^sub>D \\<^sub>G (F g, F h))" proof - have "G (F (f \\<^sub>B g \\<^sub>B h)) \\<^sub>D G (\\<^sub>F (f, g \\<^sub>B h)) = G (\\<^sub>F (f, g \\<^sub>B h))" using f g h fg gh B.VV.arr_char D.comp_ide_arr B.VV.dom_simp B.VV.cod_simp by simp thus ?thesis using D.comp_assoc by metis qed also have "... = G (\\<^sub>F (f, g \\<^sub>B h)) \\<^sub>D \\<^sub>G (F f, F (g \\<^sub>B h)) \\<^sub>D (G (F f) \\<^sub>D G (F (g \\<^sub>B h)) \\<^sub>D G (\\<^sub>F (g, h)) \\<^sub>D \\<^sub>G (F g, F h))" using D.comp_assoc by simp also have "... = G (\\<^sub>F (f, g \\<^sub>B h)) \\<^sub>D \\<^sub>G (F f, F (g \\<^sub>B h)) \\<^sub>D (G (F f) \\<^sub>D G (\\<^sub>F (g, h)) \\<^sub>D \\<^sub>G (F g, F h))" proof - have "G (F (g \\<^sub>B h)) \\<^sub>D G (\\<^sub>F (g, h)) = G (\\<^sub>F (g, h))" using f g h fg gh B.VV.arr_char D.comp_ide_arr B.VV.dom_simp B.VV.cod_simp by simp thus ?thesis using D.comp_assoc by metis qed also have "... = G (\\<^sub>F (f, g \\<^sub>B h)) \\<^sub>D \\<^sub>G (F f, F (g \\<^sub>B h)) \\<^sub>D (G (F f) \\<^sub>D G (\\<^sub>F (g, h))) \\<^sub>D (G (F f) \\<^sub>D \\<^sub>G (F g, F h))" using f g h fg gh D.whisker_left [of "G (F f)" "G (\\<^sub>F (g, h))" "\\<^sub>G (F g, F h)"] by fastforce also have "... = G (\\<^sub>F (f, g \\<^sub>B h)) \\<^sub>D (\\<^sub>G (F f, F (g \\<^sub>B h)) \\<^sub>D (G (F f) \\<^sub>D G (\\<^sub>F (g, h)))) \\<^sub>D (G (F f) \\<^sub>D \\<^sub>G (F g, F h))" using D.comp_assoc by simp also have "... = G (\\<^sub>F (f, g \\<^sub>B h)) \\<^sub>D (G (F f \\<^sub>C \\<^sub>F (g, h)) \\<^sub>D \\<^sub>G (F f, F g \\<^sub>C F h)) \\<^sub>D (G (F f) \\<^sub>D \\<^sub>G (F g, F h))" proof - have "\\<^sub>G (C.VV.cod (F f, \\<^sub>F (g, h))) = \\<^sub>G (F f, F (g \\<^sub>B h))" using f g h fg gh B.VV.arr_char C.VV.cod_char B.VV.dom_simp B.VV.cod_simp by auto moreover have "G.H\<^sub>DoFF.map (F f, \\<^sub>F (g, h)) = G (F f) \\<^sub>D G (\\<^sub>F (g, h))" using f g h fg gh B.VV.arr_char G.FF_def by auto moreover have "G.FoH\<^sub>C.map (F f, \\<^sub>F (g, h)) = G (F f \\<^sub>C \\<^sub>F (g, h))" using f g h fg gh B.VV.arr_char C.VV.arr_char by simp moreover have "C.VV.dom (F f, \\<^sub>F (g, h)) = (F f, F g \\<^sub>C F h)" using f g h fg gh B.VV.arr_char C.VV.arr_char C.VV.dom_char F.cmp_in_hom [of g h] by auto ultimately show ?thesis using f g h fg gh B.VV.arr_char C.VV.arr_char G.\.naturality [of "(F f, \\<^sub>F (g, h))"] by simp qed also have "... = (G (\\<^sub>F (f, g \\<^sub>B h)) \\<^sub>D (G (F f \\<^sub>C \\<^sub>F (g, h)))) \\<^sub>D \\<^sub>G (F f, F g \\<^sub>C F h) \\<^sub>D (G (F f) \\<^sub>D \\<^sub>G (F g, F h))" using D.comp_assoc by simp also have "... = G (\\<^sub>F (f, g \\<^sub>B h) \\<^sub>C (F f \\<^sub>C \\<^sub>F (g, h))) \\<^sub>D \\<^sub>G (F f, F g \\<^sub>C F h) \\<^sub>D (G (F f) \\<^sub>D \\<^sub>G (F g, F h))" using f g h fg gh B.VV.arr_char by (metis (no_types, lifting) B.assoc_simps(1) C.comp_assoc C.seqE F.preserves_assoc(1) F.preserves_reflects_arr G.preserves_comp) finally show ?thesis by simp qed thus ?thesis by simp qed also have "... = cmp (f, g \\<^sub>B h) \\<^sub>D (G (F f) \\<^sub>D cmp (g, h)) \\<^sub>D \\<^sub>D[G (F f), G (F g), G (F h)]" using D.comp_assoc by simp finally show ?thesis by simp qed qed lemma is_pseudofunctor: shows "pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D (G o F) cmp" .. lemma map\<^sub>0_simp [simp]: assumes "B.obj a" shows "map\<^sub>0 a = G.map\<^sub>0 (F.map\<^sub>0 a)" using assms map\<^sub>0_def by auto lemma unit_char': assumes "B.obj a" shows "unit a = G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a)" proof - have "G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a) = unit a" proof (intro unit_eqI [of a "G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a)"]) show "B.obj a" by fact show "\G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a) : map\<^sub>0 a \\<^sub>D map a\" using assms by auto show "D.iso (G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a))" by (simp add: D.isos_compose F.unit_char(2) G.unit_char(2) assms) show "(G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a)) \\<^sub>D \\<^sub>D[map\<^sub>0 a] = (map \\<^sub>B[a] \\<^sub>D cmp (a, a)) \\<^sub>D (G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a) \\<^sub>D G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a))" proof - have 1: "cmp (a, a) = G (\\<^sub>F (a, a)) \\<^sub>D \\<^sub>G (F a, F a)" proof - have "cmp (a, a) = (G (F (a \\<^sub>B a)) \\<^sub>D G (\\<^sub>F (a, a))) \\<^sub>D \\<^sub>G (F a, F a)" using assms cmp_def B.VV.ide_char B.VV.arr_char B.VV.dom_char B.VV.cod_char B.VxV.dom_char B.objE D.comp_assoc B.obj_simps by simp also have "... = G (\\<^sub>F (a, a)) \\<^sub>D \\<^sub>G (F a, F a)" using assms D.comp_cod_arr B.VV.arr_char B.VV.ide_char by auto finally show ?thesis by blast qed have "(map \\<^sub>B[a] \\<^sub>D cmp (a, a)) \\<^sub>D (G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a) \\<^sub>D G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a)) = map \\<^sub>B[a] \\<^sub>D G (\\<^sub>F (a, a)) \\<^sub>D (\\<^sub>G (F a, F a) \\<^sub>D (G (F.unit a) \\<^sub>D G (F.unit a))) \\<^sub>D (G.unit (F.map\<^sub>0 a) \\<^sub>D G.unit (F.map\<^sub>0 a))" using assms 1 D.comp_assoc D.interchange by simp also have "... = (map \\<^sub>B[a] \\<^sub>D G (\\<^sub>F (a, a)) \\<^sub>D G (F.unit a \\<^sub>C F.unit a)) \\<^sub>D \\<^sub>G (F.map\<^sub>0 a, F.map\<^sub>0 a) \\<^sub>D (G.unit (F.map\<^sub>0 a) \\<^sub>D G.unit (F.map\<^sub>0 a))" using assms G.\.naturality [of "(F.unit a, F.unit a)"] C.VV.arr_char C.VV.dom_char C.VV.cod_char G.FF_def D.comp_assoc by simp also have "... = (G (F \\<^sub>B[a] \\<^sub>C \\<^sub>F (a, a) \\<^sub>C (F.unit a \\<^sub>C F.unit a))) \\<^sub>D \\<^sub>G (F.map\<^sub>0 a, F.map\<^sub>0 a) \\<^sub>D (G.unit (F.map\<^sub>0 a) \\<^sub>D G.unit (F.map\<^sub>0 a))" proof - have "C.arr (F \\<^sub>B[a] \\<^sub>C \\<^sub>F (a, a) \\<^sub>C (F.unit a \\<^sub>C F.unit a))" using assms B.VV.ide_char B.VV.arr_char F.cmp_in_hom(2) by (intro C.seqI' C.comp_in_homI) auto hence "map \\<^sub>B[a] \\<^sub>D G (\\<^sub>F (a, a)) \\<^sub>D G (F.unit a \\<^sub>C F.unit a) = G (F \\<^sub>B[a] \\<^sub>C \\<^sub>F (a, a) \\<^sub>C (F.unit a \\<^sub>C F.unit a))" by auto thus ?thesis by argo qed also have "... = G (F.unit a \\<^sub>C \\<^sub>C[F.map\<^sub>0 a]) \\<^sub>D \\<^sub>G (F.map\<^sub>0 a, F.map\<^sub>0 a) \\<^sub>D (G.unit (F.map\<^sub>0 a) \\<^sub>D G.unit (F.map\<^sub>0 a))" using assms F.unit_char C.comp_assoc by simp also have "... = G (F.unit a) \\<^sub>D (G \\<^sub>C[F.map\<^sub>0 a] \\<^sub>D \\<^sub>G (F.map\<^sub>0 a, F.map\<^sub>0 a)) \\<^sub>D (G.unit (F.map\<^sub>0 a) \\<^sub>D G.unit (F.map\<^sub>0 a))" using assms D.comp_assoc by simp also have "... = (G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a)) \\<^sub>D \\<^sub>D[G.map\<^sub>0 (F.map\<^sub>0 a)]" using assms G.unit_char D.comp_assoc by simp also have "... = (G (F.unit a) \\<^sub>D G.unit (F.map\<^sub>0 a)) \\<^sub>D \\<^sub>D[map\<^sub>0 a]" using assms map\<^sub>0_def by auto finally show ?thesis by simp qed qed thus ?thesis by simp qed end subsection "Restriction of Pseudofunctors" text \ In this section, we construct the restriction and corestriction of a pseudofunctor to a subbicategory of its domain and codomain, respectively. \ locale restricted_pseudofunctor = C: bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C + D: bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D + F: pseudofunctor V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D F \ + C': subbicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C Arr for V\<^sub>C :: "'c comp" (infixr "\\<^sub>C" 55) and H\<^sub>C :: "'c comp" (infixr "\\<^sub>C" 53) and \\<^sub>C :: "'c \ 'c \ 'c \ 'c" ("\\<^sub>C[_, _, _]") and \\<^sub>C :: "'c \ 'c" ("\\<^sub>C[_]") and src\<^sub>C :: "'c \ 'c" and trg\<^sub>C :: "'c \ 'c" and V\<^sub>D :: "'d comp" (infixr "\\<^sub>D" 55) and H\<^sub>D :: "'d comp" (infixr "\\<^sub>D" 53) and \\<^sub>D :: "'d \ 'd \ 'd \ 'd" ("\\<^sub>D[_, _, _]") and \\<^sub>D :: "'d \ 'd" ("\\<^sub>D[_]") and src\<^sub>D :: "'d \ 'd" and trg\<^sub>D :: "'d \ 'd" and F :: "'c \ 'd" and \ :: "'c * 'c \ 'd" and Arr :: "'c \ bool" begin abbreviation map where "map \ \\. if C'.arr \ then F \ else D.null" abbreviation cmp where "cmp \ \\\. if C'.VV.arr \\ then \ \\ else D.null" interpretation "functor" C'.comp V\<^sub>D map using C'.inclusion C'.arr_char C'.dom_char C'.cod_char C'.seq_char C'.comp_char C'.arr_dom C'.arr_cod apply (unfold_locales) apply auto by presburger interpretation weak_arrow_of_homs C'.comp C'.src C'.trg V\<^sub>D src\<^sub>D trg\<^sub>D map using C'.arrE C'.ide_src C'.ide_trg C'.inclusion C'.src_def C'.trg_def F.weakly_preserves_src F.weakly_preserves_trg by unfold_locales auto interpretation H\<^sub>D\<^sub>'oFF: composite_functor C'.VV.comp D.VV.comp V\<^sub>D FF \\\\. fst \\ \\<^sub>D snd \\\ .. interpretation FoH\<^sub>C\<^sub>': composite_functor C'.VV.comp C'.comp V\<^sub>D \\\\. C'.hcomp (fst \\) (snd \\)\ map .. interpretation \: natural_transformation C'.VV.comp V\<^sub>D H\<^sub>D\<^sub>'oFF.map FoH\<^sub>C\<^sub>'.map cmp using C'.arr_char C'.dom_char C'.cod_char C'.VV.arr_char C'.VV.dom_char C'.VV.cod_char FF_def C'.inclusion C'.dom_closed C'.cod_closed C'.src_def C'.trg_def C'.hcomp_def C'.hcomp_closed F.\.is_natural_1 F.\.is_natural_2 C.VV.arr_char C.VV.dom_char C.VV.cod_char F.FF_def by unfold_locales auto interpretation \: natural_isomorphism C'.VV.comp V\<^sub>D H\<^sub>D\<^sub>'oFF.map FoH\<^sub>C\<^sub>'.map cmp using C.VV.ide_char C.VV.arr_char C'.VV.ide_char C'.VV.arr_char C'.arr_char C'.src_def C'.trg_def C'.ide_char F.\.components_are_iso by unfold_locales auto sublocale pseudofunctor C'.comp C'.hcomp C'.\ \\<^sub>C C'.src C'.trg V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D map cmp using F.assoc_coherence C'.VVV.arr_char C'.VV.arr_char C'.arr_char C'.hcomp_def C'.src_def C'.trg_def C'.assoc_closed C'.hcomp_closed C'.ide_char - by unfold_locales (simp add: C'.ide_char C'.src_def C'.trg_def) + by unfold_locales auto lemma is_pseudofunctor: shows "pseudofunctor C'.comp C'.hcomp C'.\ \\<^sub>C C'.src C'.trg V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D map cmp" .. lemma map\<^sub>0_simp [simp]: assumes "C'.obj a" shows "map\<^sub>0 a = F.map\<^sub>0 a" using assms map\<^sub>0_def C'.obj_char by auto lemma unit_char': assumes "C'.obj a" shows "F.unit a = unit a" using assms map\<^sub>0_simp C'.obj_char F.unit_in_hom(2) [of a] F.unit_char(2-3) \_simps(1) apply (intro unit_eqI) apply auto by blast end text \ We define the corestriction construction only for the case of sub-bicategories determined by a set of objects of the ambient bicategory. There are undoubtedly more general constructions, but this one is adequate for our present needs. \ locale corestricted_pseudofunctor = C: bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C + D: bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D + F: pseudofunctor V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D F \ + D': subbicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D \\\. D.arr \ \ Obj (src\<^sub>D \) \ Obj (trg\<^sub>D \)\ for V\<^sub>C :: "'c comp" (infixr "\\<^sub>C" 55) and H\<^sub>C :: "'c comp" (infixr "\\<^sub>C" 53) and \\<^sub>C :: "'c \ 'c \ 'c \ 'c" ("\\<^sub>C[_, _, _]") and \\<^sub>C :: "'c \ 'c" ("\\<^sub>C[_]") and src\<^sub>C :: "'c \ 'c" and trg\<^sub>C :: "'c \ 'c" and V\<^sub>D :: "'d comp" (infixr "\\<^sub>D" 55) and H\<^sub>D :: "'d comp" (infixr "\\<^sub>D" 53) and \\<^sub>D :: "'d \ 'd \ 'd \ 'd" ("\\<^sub>D[_, _, _]") and \\<^sub>D :: "'d \ 'd" ("\\<^sub>D[_]") and src\<^sub>D :: "'d \ 'd" and trg\<^sub>D :: "'d \ 'd" and F :: "'c \ 'd" and \ :: "'c * 'c \ 'd" and Obj :: "'d \ bool" + assumes preserves_arr: "\\. C.arr \ \ D'.arr (F \)" begin abbreviation map where "map \ F" abbreviation cmp where "cmp \ \" interpretation "functor" V\<^sub>C D'.comp F using preserves_arr F.is_extensional D'.arr_char D'.dom_char D'.cod_char D'.comp_char by (unfold_locales) auto interpretation weak_arrow_of_homs V\<^sub>C src\<^sub>C trg\<^sub>C D'.comp D'.src D'.trg F proof fix \ assume \: "C.arr \" obtain \ where \: "\\ : F (src\<^sub>C \) \\<^sub>D src\<^sub>D (F \)\ \ D.iso \" using \ F.weakly_preserves_src by auto have 2: "D'.in_hom \ (F (src\<^sub>C \)) (D'.src (F \))" using \ \ D'.arr_char D'.dom_char D'.cod_char D'.src_def D.vconn_implies_hpar(1-2) preserves_arr by (metis (no_types, lifting) C.src.preserves_arr D'.in_hom_char D'.src.preserves_arr D.arrI) moreover have "D'.iso \" using 2 \ D'.iso_char D'.arr_char by fastforce ultimately show "D'.isomorphic (F (src\<^sub>C \)) (D'.src (F \))" using D'.isomorphic_def by auto obtain \ where \: "\\ : F (trg\<^sub>C \) \\<^sub>D trg\<^sub>D (F \)\ \ D.iso \" using \ F.weakly_preserves_trg by auto have 2: "D'.in_hom \ (F (trg\<^sub>C \)) (D'.trg (F \))" using \ \ D'.arr_char D'.dom_char D'.cod_char D'.trg_def D.vconn_implies_hpar(1-2) preserves_arr by (metis (no_types, lifting) C.trg.preserves_arr D'.in_hom_char D'.trg.preserves_arr D.arrI) moreover have "D'.iso \" using 2 \ D'.iso_char D'.arr_char by fastforce ultimately show "D'.isomorphic (F (trg\<^sub>C \)) (D'.trg (F \))" using D'.isomorphic_def by auto qed interpretation H\<^sub>D\<^sub>'oFF: composite_functor C.VV.comp D'.VV.comp D'.comp FF \\\\. D'.hcomp (fst \\) (snd \\)\ .. interpretation FoH\<^sub>C: composite_functor C.VV.comp V\<^sub>C D'.comp \\\\. fst \\ \\<^sub>C snd \\\ F .. interpretation natural_transformation C.VV.comp D'.comp H\<^sub>D\<^sub>'oFF.map FoH\<^sub>C.map \ proof show "\\\. \ C.VV.arr \\ \ \ \\ = D'.null" by (simp add: F.\.is_extensional) fix \\ assume \\: "C.VV.arr \\" have 1: "D'.arr (\ \\)" using \\ D'.arr_char F.\.is_natural_1 F.\.components_are_iso by (metis (no_types, lifting) D.src_vcomp D.trg_vcomp FoH\<^sub>C.preserves_arr F.\.preserves_reflects_arr) show "D'.dom (\ \\) = H\<^sub>D\<^sub>'oFF.map (C.VV.dom \\)" using 1 \\ D'.dom_char C.VV.arr_char C.VV.dom_char F.FF_def FF_def D'.hcomp_def by simp show "D'.cod (\ \\) = FoH\<^sub>C.map (C.VV.cod \\)" using 1 \\ D'.cod_char C.VV.arr_char F.FF_def FF_def D'.hcomp_def by simp show "D'.comp (FoH\<^sub>C.map \\) (\ (C.VV.dom \\)) = \ \\" using 1 \\ D'.arr_char D'.comp_char C.VV.dom_char F.\.is_natural_1 C.VV.arr_dom D.src_vcomp D.trg_vcomp FoH\<^sub>C.preserves_arr F.\.preserves_reflects_arr by (metis (mono_tags, lifting)) show "D'.comp (\ (C.VV.cod \\)) (H\<^sub>D\<^sub>'oFF.map \\) = \ \\" proof - have "Obj (F.map\<^sub>0 (trg\<^sub>C (fst \\))) \ Obj (F.map\<^sub>0 (trg\<^sub>C (snd \\)))" using \\ C.VV.arr_char by (metis (no_types, lifting) C.src_trg C.trg.preserves_reflects_arr D'.arr_char F.map\<^sub>0_def preserves_hseq) moreover have "Obj (F.map\<^sub>0 (src\<^sub>C (snd \\)))" using \\ C.VV.arr_char by (metis (no_types, lifting) C.src.preserves_reflects_arr C.trg_src D'.arr_char F.map\<^sub>0_def preserves_hseq) ultimately show ?thesis using \\ 1 D'.arr_char D'.comp_char D'.hseq_char C.VV.arr_char C.VV.cod_char C.VxV.cod_char FF_def F.FF_def D'.hcomp_char preserves_hseq apply simp using F.\.is_natural_2 by force qed qed interpretation natural_isomorphism C.VV.comp D'.comp H\<^sub>D\<^sub>'oFF.map FoH\<^sub>C.map \ apply unfold_locales using D'.iso_char D'.arr_char by fastforce sublocale pseudofunctor V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C D'.comp D'.hcomp D'.\ \\<^sub>D D'.src D'.trg F \ proof fix f g h assume f: "C.ide f" and g: "C.ide g" and h: "C.ide h" and fg: "src\<^sub>C f = trg\<^sub>C g" and gh: "src\<^sub>C g = trg\<^sub>C h" have "D'.comp (F \\<^sub>C[f, g, h]) (D'.comp (\ (f \\<^sub>C g, h)) (D'.hcomp (\ (f, g)) (F h))) = F \\<^sub>C[f, g, h] \\<^sub>D \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h)" proof - have 1: "D'.arr (cmp (f, g) \\<^sub>D map h)" by (metis (mono_tags, lifting) C.ideD(1) D'.arr_char D'.hcomp_closed F.\.preserves_reflects_arr F.cmp_simps(1-2) F.preserves_hseq f fg g gh h preserves_reflects_arr) moreover have 2: "D.seq (cmp (f \\<^sub>C g, h)) (cmp (f, g) \\<^sub>D map h)" using 1 f g h fg gh D'.arr_char C.VV.arr_char C.VV.dom_char C.VV.cod_char F.FF_def by (intro D.seqI) auto moreover have "D'.arr (cmp (f \\<^sub>C g, h) \\<^sub>D (cmp (f, g) \\<^sub>D map h))" using 1 2 D'.arr_char by (metis (no_types, lifting) D'.comp_char D'.seq_char D.seqE F.\.preserves_reflects_arr preserves_reflects_arr) ultimately show ?thesis using f g h fg gh D'.dom_char D'.cod_char D'.comp_char D'.hcomp_def C.VV.arr_char apply simp by force qed also have "... = \ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h]" using f g h fg gh F.assoc_coherence [of f g h] by blast also have "... = D'.comp (\ (f, g \\<^sub>C h)) (D'.comp (D'.hcomp (F f) (\ (g, h))) (D'.\ (F f) (F g) (F h)))" proof - have "D.seq (map f \\<^sub>D cmp (g, h)) \\<^sub>D[map f, map g, map h]" using f g h fg gh C.VV.arr_char C.VV.dom_char C.VV.cod_char F.FF_def by (intro D.seqI) auto moreover have "D'.arr \\<^sub>D[map f, map g, map h]" using f g h fg gh D'.arr_char preserves_arr by auto moreover have "D'.arr (map f \\<^sub>D cmp (g, h))" using f g h fg gh by (metis (no_types, lifting) D'.arr_char D.seqE D.vseq_implies_hpar(1) D.vseq_implies_hpar(2) calculation(1-2)) moreover have "D'.arr ((map f \\<^sub>D cmp (g, h)) \\<^sub>D \\<^sub>D[map f, map g, map h])" using f g h fg gh by (metis (no_types, lifting) D'.arr_char D'.comp_closed D.seqE calculation(1-3)) moreover have "D.seq (cmp (f, g \\<^sub>C h)) ((map f \\<^sub>D cmp (g, h)) \\<^sub>D \\<^sub>D[map f, map g, map h])" using f g h fg gh F.cmp_simps'(1) F.cmp_simps(4) F.cmp_simps(5) by auto ultimately show ?thesis using f g h fg gh C.VV.arr_char D'.VVV.arr_char D'.VV.arr_char D'.comp_char D'.hcomp_def by simp qed finally show "D'.comp (F \\<^sub>C[f, g, h]) (D'.comp (\ (f \\<^sub>C g, h)) (D'.hcomp (\ (f, g)) (F h))) = D'.comp (\ (f, g \\<^sub>C h)) (D'.comp (D'.hcomp (F f) (\ (g, h))) (D'.\ (F f) (F g) (F h)))" by blast qed lemma is_pseudofunctor: shows "pseudofunctor V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C D'.comp D'.hcomp D'.\ \\<^sub>D D'.src D'.trg F \" .. lemma map\<^sub>0_simp [simp]: assumes "C.obj a" shows "map\<^sub>0 a = F.map\<^sub>0 a" using assms map\<^sub>0_def D'.src_def by auto lemma unit_char': assumes "C.obj a" shows "F.unit a = unit a" proof (intro unit_eqI) show "C.obj a" by fact show 1: "D'.in_hom (F.unit a) (map\<^sub>0 a) (map a)" using D'.arr_char D'.in_hom_char assms unit_in_hom(2) by force show "D'.iso (F.unit a)" using assms D'.iso_char D'.arr_char F.unit_char(2) \D'.in_hom (F.unit a) (map\<^sub>0 a) (map a)\ by auto show "D'.comp (F.unit a) \\<^sub>D[map\<^sub>0 a] = D'.comp (D'.comp (map \\<^sub>C[a]) (cmp (a, a))) (D'.hcomp (F.unit a) (F.unit a))" proof - have "D'.comp (F.unit a) \\<^sub>D[map\<^sub>0 a] = F.unit a \\<^sub>D \\<^sub>D[src\<^sub>D (map a)]" using assms D'.comp_char D'.arr_char apply simp by (metis (no_types, lifting) C.obj_simps(1-2) F.preserves_src preserves_arr) also have "... = (map \\<^sub>C[a] \\<^sub>D cmp (a, a)) \\<^sub>D (F.unit a \\<^sub>D F.unit a)" using assms F.unit_char(3) [of a] by auto also have "... = D'.comp (D'.comp (map \\<^sub>C[a]) (cmp (a, a))) (D'.hcomp (F.unit a) (F.unit a))" proof - have "D'.arr (map \\<^sub>C[a] \\<^sub>D cmp (a, a))" using assms D'.comp_simp by auto moreover have "D.seq (map \\<^sub>C[a] \\<^sub>D cmp (a, a)) (F.unit a \\<^sub>D F.unit a)" using assms C.VV.arr_char F.cmp_simps(4-5) by (intro D.seqI) auto ultimately show ?thesis by (metis (no_types, lifting) "1" D'.comp_eqI' D'.hcomp_eqI' D'.hseqI' D'.iso_is_arr D'.seq_char D'.vconn_implies_hpar(1-2) \_simps(1) \D'.iso (F.unit a)\ assms map\<^sub>0_simps(2-3)) qed finally show ?thesis by blast qed qed end subsection "Equivalence Pseudofunctors" text \ In this section, we define ``equivalence pseudofunctors'', which are pseudofunctors that are locally fully faithful, locally essentially surjective, and biessentially surjective on objects. In a later section, we will show that a pseudofunctor is an equivalence pseudofunctor if and only if it can be extended to an equivalence of bicategories. The definition below requires that an equivalence pseudofunctor be (globally) faithful with respect to vertical composition. Traditional formulations do not consider a pseudofunctor as a single global functor, so we have to consider whether this condition is too strong. In fact, a pseudofunctor (as defined here) is locally faithful if and only if it is globally faithful. \ context pseudofunctor begin definition locally_faithful where "locally_faithful \ \f g \ \'. \\ : f \\<^sub>C g\ \ \\' : f \\<^sub>C g\ \ F \ = F \' \ \ = \'" lemma locally_faithful_iff_faithful: shows "locally_faithful \ faithful_functor V\<^sub>C V\<^sub>D F" proof show "faithful_functor V\<^sub>C V\<^sub>D F \ locally_faithful" by (metis category.in_homE faithful_functor.is_faithful functor_axioms functor_def locally_faithful_def) show "locally_faithful \ faithful_functor V\<^sub>C V\<^sub>D F" proof - assume 1: "locally_faithful" show "faithful_functor V\<^sub>C V\<^sub>D F" proof fix \ \' assume par: "C.par \ \'" and eq: "F \ = F \'" obtain f g where fg: "\\ : f \\<^sub>C g\ \ \\' : f \\<^sub>C g\" using par by auto show "\ = \'" using 1 fg locally_faithful_def eq by simp qed qed qed end text \ In contrast, it is not true that a pseudofunctor that is locally full is also globally full, because we can have \\\ : F h \\<^sub>D F k\\ even if \h\ and \k\ are not in the same hom-category. So it would be a mistake to require that an equivalence functor be globally full. \ locale equivalence_pseudofunctor = pseudofunctor + faithful_functor V\<^sub>C V\<^sub>D F + assumes biessentially_surjective_on_objects: "D.obj a' \ \a. C.obj a \ D.equivalent_objects (map\<^sub>0 a) a'" and locally_essentially_surjective: "\ C.obj a; C.obj b; \g : map\<^sub>0 a \\<^sub>D map\<^sub>0 b\; D.ide g \ \ \f. \f : a \\<^sub>C b\ \ C.ide f \ D.isomorphic (F f) g" and locally_full: "\ C.ide f; C.ide f'; src\<^sub>C f = src\<^sub>C f'; trg\<^sub>C f = trg\<^sub>C f'; \\ : F f \\<^sub>D F f'\ \ \ \\. \\ : f \\<^sub>C f'\ \ F \ = \" begin lemma reflects_ide: assumes "C.endo \" and "D.ide (F \)" shows "C.ide \" using assms is_faithful [of "C.dom \" \] C.ide_char' by (metis C.arr_dom C.cod_dom C.dom_dom C.seqE D.ide_char preserves_dom) lemma reflects_iso: assumes "C.arr \" and "D.iso (F \)" shows "C.iso \" proof - obtain \' where \': "\\' : C.cod \ \\<^sub>C C.dom \\ \ F \' = D.inv (F \)" using assms locally_full [of "C.cod \" "C.dom \" "D.inv (F \)"] D.inv_in_hom C.in_homE preserves_hom C.in_homI by auto have "C.inverse_arrows \ \'" using assms \' reflects_ide apply (intro C.inverse_arrowsI) apply (metis C.cod_comp C.dom_comp C.ide_dom C.in_homE C.seqI D.comp_inv_arr' faithful_functor_axioms faithful_functor_def functor.preserves_ide as_nat_trans.preserves_comp_2 preserves_dom) by (metis C.cod_comp C.dom_comp C.ide_cod C.in_homE C.seqI D.comp_arr_inv' faithful_functor_axioms faithful_functor_def functor.preserves_ide preserves_cod as_nat_trans.preserves_comp_2) thus ?thesis by auto qed lemma reflects_isomorphic: assumes "C.ide f" and "C.ide f'" and "src\<^sub>C f = src\<^sub>C f'" and "trg\<^sub>C f = trg\<^sub>C f'" and "D.isomorphic (F f) (F f')" shows "C.isomorphic f f'" using assms C.isomorphic_def D.isomorphic_def locally_full reflects_iso C.arrI by metis lemma reflects_equivalence: assumes "C.ide f" and "C.ide g" and "\\ : src\<^sub>C f \\<^sub>C g \\<^sub>C f\" and "\\ : f \\<^sub>C g \\<^sub>C src\<^sub>C g\" and "equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D (F f) (F g) (D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f)) (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g))" shows "equivalence_in_bicategory V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C f g \ \" proof - interpret E': equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D \F f\ \F g\ \D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f)\ \D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g)\ using assms by auto show ?thesis proof show "C.ide f" using assms(1) by simp show "C.ide g" using assms(2) by simp show "\\ : src\<^sub>C f \\<^sub>C g \\<^sub>C f\" using assms(3) by simp show "\\ : f \\<^sub>C g \\<^sub>C src\<^sub>C g\" using assms(4) by simp have 0: "src\<^sub>C f = trg\<^sub>C g \ src\<^sub>C g = trg\<^sub>C f" using \\\ : src\<^sub>C f \\<^sub>C g \\<^sub>C f\\ by (metis C.hseqE C.ideD(1) C.ide_cod C.ide_dom C.in_homE assms(4)) show "C.iso \" proof - have "D.iso (F \)" proof - have 1: "\D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f) : map\<^sub>0 (src\<^sub>C f) \\<^sub>D F g \\<^sub>D F f\" using \C.ide f\ \C.ide g\ \\\ : src\<^sub>C f \\<^sub>C g \\<^sub>C f\\ unit_char cmp_in_hom cmp_components_are_iso by (metis (mono_tags, lifting) C.ideD(1) E'.unit_in_vhom preserves_src) have 2: "D.iso (\ (g, f)) \ \\ (g, f) : F g \\<^sub>D F f \\<^sub>D F (g \\<^sub>C f)\" using 0 \C.ide f\ \C.ide g\ cmp_in_hom by simp have 3: "D.iso (D.inv (unit (src\<^sub>C f))) \ \D.inv (unit (src\<^sub>C f)) : F (src\<^sub>C f) \\<^sub>D map\<^sub>0 (src\<^sub>C f)\" using \C.ide f\ unit_char by simp have "D.iso (\ (g, f) \\<^sub>D (D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f)) \\<^sub>D D.inv (unit (src\<^sub>C f)))" using 1 2 3 E'.unit_is_iso D.isos_compose by blast moreover have "\ (g, f) \\<^sub>D (D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f)) \\<^sub>D D.inv (unit (src\<^sub>C f)) = F \" proof - have "\ (g, f) \\<^sub>D (D.inv (\ (g, f)) \\<^sub>D F \ \\<^sub>D unit (src\<^sub>C f)) \\<^sub>D D.inv (unit (src\<^sub>C f)) = (\ (g, f) \\<^sub>D (D.inv (\ (g, f))) \\<^sub>D F \ \\<^sub>D (unit (src\<^sub>C f)) \\<^sub>D D.inv (unit (src\<^sub>C f)))" using D.comp_assoc by simp also have "... = F (g \\<^sub>C f) \\<^sub>D F \ \\<^sub>D F (src\<^sub>C f)" using 2 3 D.comp_arr_inv D.comp_inv_arr D.inv_is_inverse by (metis C.ideD(1) C.obj_src D.comp_assoc D.dom_inv D.in_homE unit_char(2) assms(1)) also have "... = F \" using \\\ : src\<^sub>C f \\<^sub>C g \\<^sub>C f\\ D.comp_arr_dom D.comp_cod_arr by auto finally show ?thesis by simp qed ultimately show ?thesis by simp qed thus ?thesis using assms reflects_iso by auto qed show "C.iso \" proof - have "D.iso (F \)" proof - have 1: "\D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g) : F f \\<^sub>D F g \\<^sub>D map\<^sub>0 (src\<^sub>C g)\" using \C.ide f\ \C.ide g\ \\\ : f \\<^sub>C g \\<^sub>C src\<^sub>C g\\ unit_char cmp_in_hom cmp_components_are_iso by (metis (mono_tags, lifting) C.ideD(1) E'.counit_in_vhom preserves_src) have 2: "D.iso (D.inv (\ (f, g))) \ \D.inv (\ (f, g)) : F (f \\<^sub>C g) \\<^sub>D F f \\<^sub>D F g\" using 0 \C.ide f\ \C.ide g\ \\\ : f \\<^sub>C g \\<^sub>C src\<^sub>C g\\ cmp_in_hom(2) D.inv_in_hom by simp have 3: "D.iso (unit (trg\<^sub>C f)) \ \unit (trg\<^sub>C f) : map\<^sub>0 (trg\<^sub>C f) \\<^sub>D F (trg\<^sub>C f)\" using \C.ide f\ unit_char by simp have "D.iso (unit (trg\<^sub>C f) \\<^sub>D (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g)) \\<^sub>D D.inv (\ (f, g)))" using 0 1 2 3 E'.counit_is_iso D.isos_compose by (metis D.arrI D.cod_comp D.cod_inv D.seqI D.seqI') moreover have "unit (trg\<^sub>C f) \\<^sub>D (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g)) \\<^sub>D D.inv (\ (f, g)) = F \" proof - have "unit (trg\<^sub>C f) \\<^sub>D (D.inv (unit (trg\<^sub>C f)) \\<^sub>D F \ \\<^sub>D \ (f, g)) \\<^sub>D D.inv (\ (f, g)) = (unit (trg\<^sub>C f) \\<^sub>D D.inv (unit (trg\<^sub>C f))) \\<^sub>D F \ \\<^sub>D (\ (f, g) \\<^sub>D D.inv (\ (f, g)))" using D.comp_assoc by simp also have "... = F (trg\<^sub>C f) \\<^sub>D F \ \\<^sub>D F (f \\<^sub>C g)" using 0 3 D.comp_arr_inv' D.comp_inv_arr' by (simp add: C.VV.arr_char C.VV.ide_char assms(1-2)) also have "... = F \" using 0 \\\ : f \\<^sub>C g \\<^sub>C src\<^sub>C g\\ D.comp_arr_dom D.comp_cod_arr by auto finally show ?thesis by simp qed ultimately show ?thesis by simp qed thus ?thesis using assms reflects_iso by auto qed qed qed lemma reflects_equivalence_map: assumes "C.ide f" and "D.equivalence_map (F f)" shows "C.equivalence_map f" proof - obtain g' \ \ where E': "equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D (F f) g' \ \" using assms D.equivalence_map_def by auto interpret E': equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D \F f\ g' \ \ using E' by auto obtain g where g: "\g : trg\<^sub>C f \\<^sub>C src\<^sub>C f\ \ C.ide g \ D.isomorphic (F g) g'" using assms E'.antipar locally_essentially_surjective [of "trg\<^sub>C f" "src\<^sub>C f" g'] by auto obtain \ where \: "\\ : g' \\<^sub>D F g\ \ D.iso \" using g D.isomorphic_def D.isomorphic_symmetric by blast interpret E'': equivalence_in_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D \F f\ \F g\ \(F g \\<^sub>D F f) \\<^sub>D (\ \\<^sub>D F f) \\<^sub>D \\ \\ \\<^sub>D (D.inv (F f) \\<^sub>D g') \\<^sub>D (F f \\<^sub>D D.inv \)\ using assms \ E'.equivalence_in_bicategory_axioms D.ide_is_iso D.equivalence_respects_iso [of "F f" g' \ \ "F f" "F f" \ "F g"] by auto let ?\' = "\ (g, f) \\<^sub>D (F g \\<^sub>D F f) \\<^sub>D (\ \\<^sub>D F f) \\<^sub>D \ \\<^sub>D D.inv (unit (src\<^sub>C f))" have \': "\?\' : F (src\<^sub>C f) \\<^sub>D F (g \\<^sub>C f)\" using assms \ g unit_char E'.unit_in_hom(2) E'.antipar E''.antipar cmp_in_hom apply (intro D.comp_in_homI) apply auto using E'.antipar(2) by blast have iso_\': "D.iso ?\'" using assms g \ \' E'.antipar unit_char by (metis C.in_hhomE D.arrI D.inv_comp_left(2) D.inv_comp_right(2) D.iso_hcomp D.iso_inv_iso D.isos_compose D.seqE E''.antipar(2) E''.unit_is_iso E'.unit_is_iso as_nat_iso.components_are_iso cmp_components_are_iso) let ?\' = "unit (src\<^sub>C g) \\<^sub>D \ \\<^sub>D (D.inv (F f) \\<^sub>D g') \\<^sub>D (F f \\<^sub>D D.inv \) \\<^sub>D D.inv (\ (f, g))" have \': "\?\' : F (f \\<^sub>C g) \\<^sub>D F (trg\<^sub>C f)\" proof (intro D.comp_in_homI) show "\D.inv (\ (f, g)) : F (f \\<^sub>C g) \\<^sub>D F f \\<^sub>D F g\" using assms g cmp_in_hom C.VV.ide_char C.VV.arr_char by auto show "\F f \\<^sub>D D.inv \ : F f \\<^sub>D F g \\<^sub>D F f \\<^sub>D g'\" using assms g \ E''.antipar D.ide_in_hom(2) by auto show "\D.inv (F f) \\<^sub>D g' : F f \\<^sub>D g' \\<^sub>D F f \\<^sub>D g'\" using assms E'.antipar D.ide_is_iso by auto show "\\ : F f \\<^sub>D g' \\<^sub>D trg\<^sub>D (F f)\" using E'.counit_in_hom by simp show "\unit (src\<^sub>C g) : trg\<^sub>D (F f) \\<^sub>D F (trg\<^sub>C f)\" using assms g unit_char by auto qed have iso_\': "D.iso ?\'" proof - have "D.iso (\ (f, g))" using assms g C.VV.ide_char C.VV.arr_char by auto thus ?thesis by (metis C.in_hhomE D.arrI D.hseq_char' D.ide_is_iso D.inv_comp_left(2) D.inv_comp_right(2) D.iso_hcomp D.iso_inv_iso D.isos_compose D.seqE D.seq_if_composable E''.counit_is_iso E'.counit_is_iso E'.ide_left \' \ g unit_char(2)) qed obtain \ where \: "\\ : src\<^sub>C f \\<^sub>C g \\<^sub>C f\ \ F \ = ?\'" using assms g E'.antipar \' locally_full [of "src\<^sub>C f" "g \\<^sub>C f" ?\'] by (metis C.ide_hcomp C.ideD(1) C.in_hhomE C.src.preserves_ide C.hcomp_simps(1-2) C.src_trg C.trg_trg) have iso_\: "C.iso \" using \ \' iso_\' reflects_iso by auto have 1: "\\. \\ : f \\<^sub>C g \\<^sub>C src\<^sub>C g\ \ F \ = ?\'" using assms g \' locally_full [of "f \\<^sub>C g" "src\<^sub>C g" ?\'] by force obtain \ where \: "\\ : f \\<^sub>C g \\<^sub>C src\<^sub>C g\ \ F \ = ?\'" using 1 by blast have iso_\: "C.iso \" using \ \' iso_\' reflects_iso by auto have "equivalence_in_bicategory (\\<^sub>C) (\\<^sub>C) \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C f g \ \" using assms g \ \ iso_\ iso_\ by (unfold_locales, auto) thus ?thesis using C.equivalence_map_def by auto qed lemma reflects_equivalent_objects: assumes "C.obj a" and "C.obj b" and "D.equivalent_objects (map\<^sub>0 a) (map\<^sub>0 b)" shows "C.equivalent_objects a b" proof - obtain f' where f': "\f' : map\<^sub>0 a \\<^sub>D map\<^sub>0 b\ \ D.equivalence_map f'" using assms D.equivalent_objects_def D.equivalence_map_def by auto obtain f where f: "\f : a \\<^sub>C b\ \ C.ide f \ D.isomorphic (F f) f'" using assms f' locally_essentially_surjective [of a b f'] D.equivalence_map_is_ide by auto have "D.equivalence_map (F f)" using f f' D.equivalence_map_preserved_by_iso [of f' "F f"] D.isomorphic_symmetric by simp hence "C.equivalence_map f" using f f' reflects_equivalence_map [of f] by simp thus ?thesis using f C.equivalent_objects_def by auto qed end text\ For each pair of objects \a\, \b\ of \C\, an equivalence pseudofunctor restricts to an equivalence of categories between \C.hhom a b\ and \D.hhom (map\<^sub>0 a) (map\<^sub>0 b)\. \ (* TODO: Change the "perspective" of this locale to be the defined functor. *) locale equivalence_pseudofunctor_at_hom = equivalence_pseudofunctor + fixes a :: 'a and a' :: 'a assumes obj_a: "C.obj a" and obj_a': "C.obj a'" begin sublocale hhom\<^sub>C: subcategory V\<^sub>C \\\. \\ : a \\<^sub>C a'\\ using C.hhom_is_subcategory by simp sublocale hhom\<^sub>D: subcategory V\<^sub>D \\\. \\ : map\<^sub>0 a \\<^sub>D map\<^sub>0 a'\\ using D.hhom_is_subcategory by simp definition F\<^sub>1 where "F\<^sub>1 = (\\. if hhom\<^sub>C.arr \ then F \ else D.null)" interpretation F\<^sub>1: "functor" hhom\<^sub>C.comp hhom\<^sub>D.comp F\<^sub>1 unfolding F\<^sub>1_def using hhom\<^sub>C.arr_char hhom\<^sub>D.arr_char hhom\<^sub>C.dom_char hhom\<^sub>D.dom_char hhom\<^sub>C.cod_char hhom\<^sub>D.cod_char hhom\<^sub>C.seq_char hhom\<^sub>C.comp_char hhom\<^sub>D.comp_char by unfold_locales auto interpretation F\<^sub>1: fully_faithful_and_essentially_surjective_functor hhom\<^sub>C.comp hhom\<^sub>D.comp F\<^sub>1 proof show "\\ \'. \hhom\<^sub>C.par \ \'; F\<^sub>1 \ = F\<^sub>1 \'\ \ \ = \'" unfolding F\<^sub>1_def using is_faithful hhom\<^sub>C.dom_char hhom\<^sub>D.dom_char hhom\<^sub>C.cod_char hhom\<^sub>D.cod_char by (metis C.in_hhom_def hhom\<^sub>C.arrE) show "\f f' \. \hhom\<^sub>C.ide f; hhom\<^sub>C.ide f'; hhom\<^sub>D.in_hom \ (F\<^sub>1 f') (F\<^sub>1 f)\ \ \\. hhom\<^sub>C.in_hom \ f' f \ F\<^sub>1 \ = \" proof (unfold F\<^sub>1_def) fix f f' \ assume f: "hhom\<^sub>C.ide f" and f': "hhom\<^sub>C.ide f'" assume "hhom\<^sub>D.in_hom \ (if hhom\<^sub>C.arr f' then F f' else D.null) (if hhom\<^sub>C.arr f then F f else D.null)" hence \: "hhom\<^sub>D.in_hom \ (F f') (F f)" using f f' by simp have "\\. hhom\<^sub>C.in_hom \ f' f \ F \ = \" proof - have 1: "src\<^sub>C f' = src\<^sub>C f \ trg\<^sub>C f' = trg\<^sub>C f" using f f' hhom\<^sub>C.ide_char by (metis C.in_hhomE hhom\<^sub>C.arrE) hence ex: "\\. C.in_hom \ f' f \ F \ = \" by (meson \ f f' hhom\<^sub>D.in_hom_char horizontal_homs.hhom_is_subcategory locally_full subcategory.ide_char weak_arrow_of_homs_axioms weak_arrow_of_homs_def) obtain \ where \: "C.in_hom \ f' f \ F \ = \" using ex by blast have "hhom\<^sub>C.in_hom \ f' f" by (metis C.arrI C.in_hhom_def C.vconn_implies_hpar(1-2) \ f f' hhom\<^sub>C.arr_char hhom\<^sub>C.ide_char hhom\<^sub>C.in_hom_char) thus ?thesis using \ by auto qed thus "\\. hhom\<^sub>C.in_hom \ f' f \ (if hhom\<^sub>C.arr \ then F \ else D.null) = \" by auto qed show "\g. hhom\<^sub>D.ide g \ \f. hhom\<^sub>C.ide f \ hhom\<^sub>D.isomorphic (F\<^sub>1 f) g" proof (unfold F\<^sub>1_def) fix g assume g: "hhom\<^sub>D.ide g" show "\f. hhom\<^sub>C.ide f \ hhom\<^sub>D.isomorphic (if hhom\<^sub>C.arr f then F f else D.null) g" proof - have "C.obj a \ C.obj a'" using obj_a obj_a' by simp moreover have 1: "D.ide g \ \g : map\<^sub>0 a \\<^sub>D map\<^sub>0 a'\" using g obj_a obj_a' hhom\<^sub>D.ide_char by auto ultimately have 2: "\f. C.in_hhom f a a' \ C.ide f \ D.isomorphic (F f) g" using locally_essentially_surjective [of a a' g] by simp obtain f \ where f: "C.in_hhom f a a' \ C.ide f \ D.in_hom \ (F f) g \ D.iso \" using 2 by auto have "hhom\<^sub>C.ide f" using f hhom\<^sub>C.ide_char hhom\<^sub>C.arr_char by simp moreover have "hhom\<^sub>D.isomorphic (F f) g" proof - have "hhom\<^sub>D.arr \ \ hhom\<^sub>D.arr (D.inv \)" by (metis 1 D.arrI D.in_hhom_def D.vconn_implies_hpar(1-4) D.inv_in_homI f hhom\<^sub>D.arrI) hence "hhom\<^sub>D.in_hom \ (F f) g \ hhom\<^sub>D.iso \" by (metis D.in_homE f hhom\<^sub>D.cod_simp hhom\<^sub>D.dom_simp hhom\<^sub>D.in_homI hhom\<^sub>D.iso_char) thus ?thesis unfolding hhom\<^sub>D.isomorphic_def by blast qed ultimately show "\f. hhom\<^sub>C.ide f \ hhom\<^sub>D.isomorphic (if hhom\<^sub>C.arr f then F f else D.null) g" by force qed qed qed lemma equivalence_functor_F\<^sub>1: shows "fully_faithful_and_essentially_surjective_functor hhom\<^sub>C.comp hhom\<^sub>D.comp F\<^sub>1" and "equivalence_functor hhom\<^sub>C.comp hhom\<^sub>D.comp F\<^sub>1" .. definition G\<^sub>1 where "G\<^sub>1 = (SOME G. \\\. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G F\<^sub>1 (fst \\) (snd \\))" lemma G\<^sub>1_props: assumes "C.obj a" and "C.obj a'" shows "\\ \. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 \ \" proof - have "\G. \\\. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G F\<^sub>1 (fst \\) (snd \\)" using F\<^sub>1.extends_to_adjoint_equivalence by simp hence "\\\. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 (fst \\) (snd \\)" unfolding G\<^sub>1_def using someI_ex [of "\G. \\\. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G F\<^sub>1 (fst \\) (snd \\)"] by blast thus ?thesis by simp qed definition \ where "\ = (SOME \. \\. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 \ \)" definition \ where "\ = (SOME \. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 \ \)" lemma \\_props: shows "adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 \ \" using obj_a obj_a' \_def \_def G\<^sub>1_props someI_ex [of "\\. \\. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 \ \"] someI_ex [of "\\. adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 \ \"] by simp sublocale \\: adjoint_equivalence hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 \ \ using \\_props by simp sublocale \\: meta_adjunction hhom\<^sub>C.comp hhom\<^sub>D.comp G\<^sub>1 F\<^sub>1 \\.\ \\.\ using \\.induces_meta_adjunction by simp end context identity_pseudofunctor begin sublocale equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B map cmp using B.isomorphic_reflexive B.arrI apply unfold_locales by (auto simp add: B.equivalent_objects_reflexive map\<^sub>0_def B.obj_simps) lemma is_equivalence_pseudofunctor: shows "equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B map cmp" .. end locale composite_equivalence_pseudofunctor = composite_pseudofunctor + F: equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C F \\<^sub>F + G: equivalence_pseudofunctor V\<^sub>C H\<^sub>C \\<^sub>C \\<^sub>C src\<^sub>C trg\<^sub>C V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D G \\<^sub>G begin interpretation faithful_functor V\<^sub>B V\<^sub>D \G o F\ using F.faithful_functor_axioms G.faithful_functor_axioms faithful_functors_compose by blast interpretation equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D \G o F\ cmp proof show "\c. D.obj c \ \a. B.obj a \ D.equivalent_objects (map\<^sub>0 a) c" proof - fix c assume c: "D.obj c" obtain b where b: "C.obj b \ D.equivalent_objects (G.map\<^sub>0 b) c" using c G.biessentially_surjective_on_objects by auto obtain a where a: "B.obj a \ C.equivalent_objects (F.map\<^sub>0 a) b" using b F.biessentially_surjective_on_objects by auto have "D.equivalent_objects (map\<^sub>0 a) c" using a b map\<^sub>0_def G.preserves_equivalent_objects D.equivalent_objects_transitive by fastforce thus "\a. B.obj a \ D.equivalent_objects (map\<^sub>0 a) c" using a by auto qed show "\a a' h. \B.obj a; B.obj a'; \h : map\<^sub>0 a \\<^sub>D map\<^sub>0 a'\; D.ide h\ \ \f. B.in_hhom f a a' \ B.ide f \ D.isomorphic ((G \ F) f) h" proof - fix a a' h assume a: "B.obj a" and a': "B.obj a'" and h_in_hom: "\h : map\<^sub>0 a \\<^sub>D map\<^sub>0 a'\" and ide_h: "D.ide h" obtain g where g: "C.in_hhom g (F.map\<^sub>0 a) (F.map\<^sub>0 a') \ C.ide g \ D.isomorphic (G g) h" using a a' h_in_hom ide_h map\<^sub>0_def B.obj_simps G.locally_essentially_surjective [of "F.map\<^sub>0 a" "F.map\<^sub>0 a'" h] by auto obtain f where f: "B.in_hhom f a a' \ B.ide f \ C.isomorphic (F f) g" using a a' g F.locally_essentially_surjective by blast have "D.isomorphic ((G o F) f) h" by (metis D.isomorphic_transitive G.preserves_isomorphic comp_apply f g) thus "\f. B.in_hhom f a a' \ B.ide f \ D.isomorphic ((G \ F) f) h" using f by auto qed show "\f f' \. \B.ide f; B.ide f'; src\<^sub>B f = src\<^sub>B f'; trg\<^sub>B f = trg\<^sub>B f'; \\ : (G \ F) f \\<^sub>D (G \ F) f'\\ \ \\. \\ : f \\<^sub>B f'\ \ (G \ F) \ = \" proof - fix f f' \ assume f: "B.ide f" and f': "B.ide f'" and src: "src\<^sub>B f = src\<^sub>B f'" and trg: "trg\<^sub>B f = trg\<^sub>B f'" and \: "\\ : (G \ F) f \\<^sub>D (G \ F) f'\" have \: "\\ : G (F f) \\<^sub>D G (F f')\" using \ by simp have 1: "src\<^sub>C (F f) = src\<^sub>C (F f') \ trg\<^sub>C (F f) = trg\<^sub>C (F f')" using f f' src trg by simp have 2: "\\. \\ : F f \\<^sub>C F f'\ \ G \ = \" using f f' 1 \ G.locally_full F.preserves_ide by simp obtain \ where \: "\\ : F f \\<^sub>C F f'\ \ G \ = \" using 2 by auto obtain \ where \: "\\ : f \\<^sub>B f'\ \ F \ = \" using f f' src trg 2 \ F.locally_full by blast show "\\. \\ : f \\<^sub>B f'\ \ (G \ F) \ = \" using \ \ by auto qed qed sublocale equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D \G o F\ cmp .. lemma is_equivalence_pseudofunctor: shows "equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D (G o F) cmp" .. end end diff --git a/thys/Bicategory/SpanBicategory.thy b/thys/Bicategory/SpanBicategory.thy --- a/thys/Bicategory/SpanBicategory.thy +++ b/thys/Bicategory/SpanBicategory.thy @@ -1,5485 +1,4479 @@ (* Title: SpanBicategory Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) section "Span Bicategories" text \ In this section we construct the bicategory \Span(C)\, where \C\ is a category with pullbacks. The $0$-cells of \Span(C)\ are the objects of \C\, the $1$-cells of \Span(C)\ are pairs \(f\<^sub>0, f\<^sub>1)\ of arrows of \C\ having a common domain, and the $2$-cells of \Span(C)\ are ``arrows of spans''. An arrow of spans from \(f\<^sub>0, f\<^sub>1)\ to \(g\<^sub>0, g\<^sub>1)\ is an arrow \\u: dom f\<^sub>0 \ dom g\<^sub>0\\ of \C\, such that \g\<^sub>0 \ u = f\<^sub>0\ and \g\<^sub>1 \ u = f\<^sub>1\. In the present development, a \emph{span} is formalized as a structure \\Leg0 = f\<^sub>0, Leg1 = f\<^sub>1\\, where \f\<^sub>0\ and \f\<^sub>1\ are arrows of \C\ with a common domain, which we call the \emph{apex} of the span. An \emph{arrow of spans} is formalized as a structure \\Chn = u, Dom = S, Cod = T\\, where \S\ and \T\ are spans, and \\u : S.apex \ T.apex\\ satisfies \Leg0 T \ u = Leg0 S\ and \Leg1 T \ u = Leg1 S\. We refer to the arrow \u\ as the \emph{chine} of the arrow of spans. Arrows of spans inherit a composition from that of \C\; this is ``vertical composition''. Spans may be composed via pullback in \C\; this ``horizontal composition'' extends to arrows of spans, so that it is functorial with respect to vertical composition. These two compositions determine a bicategory, as we shall show. \ theory SpanBicategory imports Bicategory InternalAdjunction Category3.FreeCategory Category3.CategoryWithPullbacks begin subsection "Spans" record 'a span_data = Leg0 :: 'a Leg1 :: 'a locale span_in_category = C: category + fixes S :: "'a span_data" (structure) assumes is_span: "C.span (Leg0 S) (Leg1 S)" begin abbreviation leg0 where "leg0 \ Leg0 S" abbreviation leg1 where "leg1 \ Leg1 S" abbreviation src where "src \ C.cod leg0" abbreviation trg where "trg \ C.cod leg1" definition apex where "apex \ C.dom leg0" lemma ide_apex [simp]: shows "C.ide apex" using is_span apex_def by simp lemma leg_in_hom [intro]: shows "\leg0 : apex \ src\" and "\leg1 : apex \ trg\" using is_span apex_def by auto lemma leg_simps [simp]: shows "C.arr leg0" and "C.dom leg0 = apex" and "C.arr leg1" and "C.dom leg1 = apex" using leg_in_hom by auto end record 'a arrow_of_spans_data = Chn :: 'a Dom :: "'a span_data" Cod :: "'a span_data" locale arrow_of_spans = C: category C + dom: span_in_category C \Dom \\ + cod: span_in_category C \Cod \\ for C :: "'a comp" (infixr "\" 55) and \ :: "'a arrow_of_spans_data" (structure) + assumes chine_in_hom [intro]: "\Chn \ : dom.apex \ cod.apex\" and leg0_commutes [simp]: "cod.leg0 \ Chn \ = dom.leg0" and leg1_commutes [simp]: "cod.leg1 \ (Chn \) = dom.leg1" begin abbreviation chine where "chine \ Chn \" lemma chine_simps [simp]: shows "C.arr chine" and "C.dom chine = dom.apex" and "C.cod chine = cod.apex" using chine_in_hom by auto lemma cod_src_eq_dom_src [simp]: shows "cod.src = dom.src" using dom.is_span cod.is_span by (metis C.cod_comp leg0_commutes) lemma cod_trg_eq_dom_trg [simp]: shows "cod.trg = dom.trg" using dom.is_span cod.is_span by (metis C.cod_comp leg1_commutes) abbreviation dsrc where "dsrc \ dom.src" abbreviation dtrg where "dtrg \ dom.trg" end locale identity_arrow_of_spans = arrow_of_spans + assumes chine_is_identity [simp]: "C.ide (Chn \)" begin abbreviation apex where "apex \ dom.apex" abbreviation leg0 where "leg0 \ dom.leg0" abbreviation leg1 where "leg1 \ dom.leg1" lemma chine_eq_apex [simp]: shows "chine = apex" using chine_is_identity C.ideD(2) chine_simps(2) by presburger lemma cod_simps [simp]: shows "cod.apex = apex" and "cod.leg0 = leg0" and "cod.leg1 = leg1" using chine_is_identity chine_simps(3) C.comp_arr_ide leg0_commutes leg1_commutes by force+ end subsection "The Vertical Category of Spans" text \ The following locale constructs the category of spans and arrows of spans in an underlying category C, which is not yet assumed to have pullbacks. The composition is vertical composition of arrows of spans, to which we will later add horizontal composition to obtain a bicategory. \ locale span_vertical_category = C: category begin abbreviation Null where "Null \ \Chn = C.null, Dom = \Leg0 = C.null, Leg1 = C.null\, Cod = \Leg0 = C.null, Leg1 = C.null\\" lemma not_arr_Null: shows "\ arrow_of_spans C Null" unfolding arrow_of_spans_def arrow_of_spans_axioms_def by auto text \ Arrows of spans are composed simply by composing their chines. \ definition vcomp where "vcomp \ \ \ if arrow_of_spans C \ \ arrow_of_spans C \ \ Dom \ = Cod \ then \Chn = Chn \ \ Chn \, Dom = Dom \, Cod = Cod \\ else Null" notation vcomp (infixr "\" 55) (* * TODO: The reason why the this and the subsequent category interpretation are declared * as V: is that subsequently proved facts with the same names as the partial_magma and * category locales silently override the latter, resulting in problems proving things. * The presence of the extra "V" is only an issue up until a later sublocale declaration * inherits everything from horizontal_homs. I wish I could say that I completely * understood the inheritance and overriding rules for locales. *) interpretation V: partial_magma vcomp using not_arr_Null vcomp_def apply unfold_locales by (metis (no_types, opaque_lifting)) lemma is_partial_magma: shows "partial_magma vcomp" .. lemma null_char: shows "V.null = Null" using V.null_def vcomp_def not_arr_Null by (metis (no_types, lifting) V.comp_null(2)) text \ Identities are arrows of spans whose chines are identities of C. \ lemma ide_char: shows "V.ide \ \ arrow_of_spans C \ \ C.ide (Chn \)" proof show "V.ide \ \ arrow_of_spans C \ \ C.ide (Chn \)" proof assume 0: "V.ide \" have 1: "vcomp \ \ \ Null \ (\\. (\ \ \ \ Null \ \ \ \ = \) \ (\ \ \ \ Null \ \ \ \ = \))" using 0 V.ide_def null_char by simp show \: "arrow_of_spans C \" using 1 vcomp_def by metis interpret \: arrow_of_spans C \ using \ by auto show "C.ide (Chn \)" proof - have "\.chine \ \.chine \ C.null" using 1 vcomp_def by (metis C.in_homE C.not_arr_null C.seqI \.chine_in_hom) moreover have "\f. f \ Chn \ \ C.null \ f \ Chn \ = f" proof - fix f assume "f \ \.chine \ C.null" hence f: "\f : \.cod.apex \ C.cod f\" using C.ext C.in_homI by force let ?cod_\ = "\Chn = C.cod \.chine, Dom = Cod \, Cod = Cod \\" interpret cod_\: arrow_of_spans C ?cod_\ using C.ide_in_hom \.cod.ide_apex \.chine_in_hom C.comp_arr_dom by (unfold_locales, auto) have "?cod_\ \ \ = ?cod_\" - proof - - have "?cod_\ \ \ \ Null" - unfolding vcomp_def - using \ cod_\.arrow_of_spans_axioms \.cod.is_span C.comp_cod_arr - apply simp - using \.chine_simps(1) by force - thus ?thesis - using 1 by simp - qed + by (metis (no_types, opaque_lifting) "1" C.not_arr_null + \.cod.span_in_category_axioms arrow_of_spans_data.select_convs(2) + cod_\.arrow_of_spans_axioms span_data.select_convs(1) + span_in_category.leg_simps(1) vcomp_def) thus "f \ \.chine = f" - unfolding vcomp_def - using f C.comp_arr_ide C.comp_cod_arr \.arrow_of_spans_axioms - cod_\.arrow_of_spans_axioms + using C.comp_arr_ide C.comp_cod_arr \ cod_\.arrow_of_spans_axioms f vcomp_def by auto qed moreover have "\f. \.chine \ f \ C.null \ \.chine \ f = f" - proof - - fix f - assume "\.chine \ f \ C.null" - hence f: "\f : C.dom f \ \.dom.apex\" - using C.ext C.in_homI by force - let ?dom_\ = "\Chn = C.cod f, Dom = Dom \, Cod = Dom \\" - interpret dom_\: arrow_of_spans C ?dom_\ - using f C.ide_in_hom \.dom.ide_apex \.chine_in_hom C.comp_arr_dom - by (unfold_locales, auto) - have "\ \ ?dom_\ = ?dom_\" - proof - - have "\ \ ?dom_\ \ Null" - unfolding vcomp_def - using \ dom_\.arrow_of_spans_axioms \.cod.is_span by (simp, force) - thus ?thesis - using 1 by simp - qed - hence "\.chine \ C.cod f = C.cod f" - unfolding vcomp_def - using \ dom_\.arrow_of_spans_axioms f 0 C.comp_ide_arr C.comp_arr_ide - by simp - thus "\.chine \ f = f" - unfolding vcomp_def - using f C.comp_ide_arr C.comp_arr_dom \.arrow_of_spans_axioms - dom_\.arrow_of_spans_axioms - by auto - qed + by (metis C.comp_cod_arr C.comp_ide_arr C.ext C.ide_char' calculation(1-2)) ultimately show "C.ide \.chine" unfolding C.ide_def by simp qed qed show "arrow_of_spans C \ \ C.ide (Chn \) \ V.ide \" proof - assume \: "arrow_of_spans C \ \ C.ide (Chn \)" interpret \: arrow_of_spans C \ using \ by auto have 1: "Dom \ = Cod \" - proof - - have "\.dom.leg0 = \.cod.leg0 \ \.dom.leg1 = \.cod.leg1" - using \ C.comp_arr_ide \.cod.is_span by force - thus ?thesis by simp - qed + using \ identity_arrow_of_spans.cod_simps(2) identity_arrow_of_spans.cod_simps(3) + identity_arrow_of_spans.intro identity_arrow_of_spans_axioms.intro + by fastforce show "V.ide \" proof - have "\ \ \ \ V.null" using \ 1 vcomp_def by (simp add: C.ide_def null_char) moreover have "\\. vcomp \ \ \ V.null \ vcomp \ \ = \" proof - fix \ :: "'a arrow_of_spans_data" assume \: "\ \ \ \ V.null" have 2: "arrow_of_spans C \ \ Dom \ = Cod \" using \ 1 vcomp_def by (metis V.comp_null(2)) interpret \: arrow_of_spans C \ using 2 by auto show "\ \ \ = \" unfolding vcomp_def using \ 1 2 C.comp_arr_ide by simp qed moreover have "\\. \ \ \ \ V.null \ \ \ \ = \" proof - fix \ :: "'a arrow_of_spans_data" assume \: "\ \ \ \ V.null" have 2: "arrow_of_spans C \ \ Dom \ = Cod \" using \ 1 vcomp_def by (metis V.comp_null(1)) interpret \: arrow_of_spans C \ using 2 by auto show "\ \ \ = \" unfolding vcomp_def using \ 1 2 C.comp_ide_arr by simp qed ultimately show ?thesis unfolding V.ide_def by blast qed qed qed lemma has_domain_char: shows "V.domains \ \ {} \ arrow_of_spans C \" proof show "V.domains \ \ {} \ arrow_of_spans C \" using V.domains_def null_char vcomp_def by fastforce show "arrow_of_spans C \ \ V.domains \ \ {}" proof - assume \: "arrow_of_spans C \" interpret \: arrow_of_spans C \ using \ by auto let ?dom_\ = "\Chn = \.dom.apex, Dom = Dom \, Cod = Dom \\" interpret dom_\: arrow_of_spans C ?dom_\ using C.comp_arr_dom by (unfold_locales, auto) have "?dom_\ \ V.domains \" proof - have "V.ide ?dom_\" using ide_char dom_\.arrow_of_spans_axioms by simp moreover have "\ \ ?dom_\ \ V.null" using \ vcomp_def \.cod.span_in_category_axioms dom_\.arrow_of_spans_axioms null_char span_in_category.leg_simps(1) by fastforce ultimately show ?thesis unfolding V.domains_def by blast qed thus "V.domains \ \ {}" by blast qed qed lemma has_codomain_char: shows "V.codomains \ \ {} \ arrow_of_spans C \" proof show "V.codomains \ \ {} \ arrow_of_spans C \" using V.codomains_def null_char vcomp_def by fastforce show "arrow_of_spans C \ \ V.codomains \ \ {}" proof - assume \: "arrow_of_spans C \" interpret \: arrow_of_spans C \ using \ by auto let ?cod_f = "\Chn = \.cod.apex, Dom = Cod \, Cod = Cod \\" interpret cod_f: arrow_of_spans C ?cod_f using C.comp_arr_dom by (unfold_locales, auto) have "?cod_f \ V.codomains \" proof - have "V.ide ?cod_f" using ide_char cod_f.arrow_of_spans_axioms by simp moreover have "?cod_f \ \ \ V.null" using \ vcomp_def \.cod.span_in_category_axioms cod_f.arrow_of_spans_axioms null_char span_in_category.leg_simps(1) by fastforce ultimately show ?thesis unfolding V.codomains_def by blast qed thus "V.codomains \ \ {}" by blast qed qed lemma arr_char: shows "V.arr \ \ arrow_of_spans C \" unfolding V.arr_def using has_domain_char has_codomain_char by simp lemma seq_char: shows "V.seq \ \ \ arrow_of_spans C \ \ arrow_of_spans C \ \ Dom \ = Cod \" proof show "V.seq \ \ \ arrow_of_spans C \ \ arrow_of_spans C \ \ Dom \ = Cod \" using vcomp_def by (metis V.not_arr_null null_char) show "arrow_of_spans C \ \ arrow_of_spans C \ \ Dom \ = Cod \ \ V.seq \ \" proof - assume 1: "arrow_of_spans C \ \ arrow_of_spans C \ \ Dom \ = Cod \" interpret \: arrow_of_spans C \ using 1 by auto interpret \: arrow_of_spans C \ using 1 by auto show "V.seq \ \" proof - let ?\\ = "\Chn = Chn \ \ Chn \, Dom = Dom \, Cod = Cod \\" have "\ \ \ = ?\\" using 1 vcomp_def by metis moreover have "V.arr ?\\" proof - interpret Dom: span_in_category C \Dom ?\\\ by (simp add: \.dom.span_in_category_axioms) interpret Cod: span_in_category C \Cod ?\\\ by (simp add: \.cod.span_in_category_axioms) have "arrow_of_spans C ?\\" using 1 \.chine_in_hom \.chine_in_hom C.comp_reduce by (unfold_locales, cases ?\\, auto) thus ?thesis using arr_char by blast qed ultimately show ?thesis by simp qed qed qed interpretation V: category vcomp proof show "\\. (V.domains \ \ {}) = (V.codomains \ \ {})" using has_domain_char has_codomain_char by simp show "\\ \. \ \ \ \ V.null \ V.seq \ \" using seq_char vcomp_def null_char by metis show "\\ \ \. V.seq \ \ \ V.seq (\ \ \) \ \ V.seq \ \" using seq_char vcomp_def by (metis arrow_of_spans_data.select_convs(2)) show "\\ \ \. V.seq \ (\ \ \) \ V.seq \ \ \ V.seq \ \" using seq_char vcomp_def by (metis arrow_of_spans_data.select_convs(3)) show "\\ \ \. V.seq \ \ \ V.seq \ \ \ V.seq (\ \ \) \" using seq_char vcomp_def by (metis arr_char arrow_of_spans_data.select_convs(2)) show "\\ \ \. V.seq \ \ \ V.seq \ \ \ (\ \ \) \ \ = \ \ \ \ \" proof - fix \ \ \ assume \\: "V.seq \ \" and \\: "V.seq \ \" interpret \: arrow_of_spans C \ using \\ seq_char by auto interpret \: arrow_of_spans C \ using \\ seq_char by auto interpret \: arrow_of_spans C \ using \\ seq_char by auto show "(\ \ \) \ \ = \ \ \ \ \" unfolding vcomp_def using \\ \\ seq_char \.chine_in_hom \.chine_in_hom \.chine_in_hom by (simp add: C.comp_assoc, metis arr_char vcomp_def) qed qed lemma is_category: shows "category vcomp" .. lemma dom_char: shows "V.dom = (\\. if V.arr \ then \Chn = span_in_category.apex C (Dom \), Dom = Dom \, Cod = Dom \\ else V.null)" proof fix \ have "\ V.arr \ \ V.dom \ = V.null" by (simp add: V.arr_def V.dom_def) moreover have "V.arr \ \ V.dom \ = \Chn = span_in_category.apex C (Dom \), Dom = Dom \, Cod = Dom \\" - proof (intro V.dom_eqI) - assume \: "V.arr \" - interpret \: arrow_of_spans C \ - using \ arr_char by auto - let ?dom_\ = "\Chn = \.dom.apex, Dom = Dom \, Cod = Dom \\" - interpret dom_\: arrow_of_spans C ?dom_\ - using C.comp_arr_dom by (unfold_locales, auto) - show "V.ide ?dom_\" - using ide_char dom_\.arrow_of_spans_axioms by simp - thus "V.seq \ ?dom_\" - using seq_char ide_char \.arrow_of_spans_axioms by simp - qed + by (metis V.comp_arr_dom V.comp_ide_self V.ideD(1) V.ide_dom arrow_of_spans_data.cases + arrow_of_spans_data.select_convs(1-3) ide_char identity_arrow_of_spans.chine_eq_apex + identity_arrow_of_spans_axioms.intro identity_arrow_of_spans_def seq_char) ultimately show "V.dom \ = (if V.arr \ then \Chn = span_in_category.apex C (Dom \), Dom = Dom \, Cod = Dom \\ else V.null)" by argo qed lemma cod_char: shows "V.cod = (\\. if V.arr \ then \Chn = span_in_category.apex C (Cod \), Dom = Cod \, Cod = Cod \\ else V.null)" proof fix \ have "\ V.arr \ \ V.cod \ = V.null" by (simp add: V.arr_def V.cod_def) moreover have "V.arr \ \ V.cod \ = \Chn = span_in_category.apex C (Cod \), Dom = Cod \, Cod = Cod \\" - proof (intro V.cod_eqI) - assume \: "V.arr \" - interpret \: arrow_of_spans C \ - using \ arr_char by auto - let ?cod_\ = "\Chn = \.cod.apex, Dom = Cod \, Cod = Cod \\" - interpret cod_\: arrow_of_spans C ?cod_\ - using C.comp_arr_dom by (unfold_locales, auto) - show "V.ide ?cod_\" - using ide_char cod_\.arrow_of_spans_axioms by simp - thus "V.seq ?cod_\ \" - using seq_char ide_char \.arrow_of_spans_axioms by simp - qed + by (metis V.arr_cod V.comp_cod_arr V.dom_cod dom_char span_vertical_category.seq_char + span_vertical_category_axioms) ultimately show "V.cod \ = (if V.arr \ then \Chn = span_in_category.apex C (Cod \), Dom = Cod \, Cod = Cod \\ else V.null)" by argo qed lemma vcomp_char: shows "vcomp = (\\ \. if V.seq \ \ then \Chn = Chn \ \ Chn \, Dom = Dom \, Cod = Cod \\ else V.null)" - proof - - have "\\ \. \ \ \ = (if V.seq \ \ then - \Chn = Chn \ \ Chn \, Dom = Dom \, Cod = Cod \\ - else V.null)" - using vcomp_def seq_char null_char by simp - thus ?thesis by auto - qed + by (meson V.ext seq_char vcomp_def) lemma vcomp_eq: assumes "V.seq \ \" shows "\ \ \ = \Chn = Chn \ \ Chn \, Dom = Dom \, Cod = Cod \\" using assms vcomp_char by meson lemma Chn_vcomp: assumes "V.seq \ \" shows "Chn (\ \ \) = Chn \ \ Chn \" using assms vcomp_eq [of \ \] by simp lemma ide_char': shows "V.ide \ \ identity_arrow_of_spans C \" using arr_char ide_char identity_arrow_of_spans_axioms_def identity_arrow_of_spans_def identity_arrow_of_spans.axioms(1) identity_arrow_of_spans.chine_is_identity by metis lemma Chn_in_hom: assumes "V.in_hom \ f g" shows "C.in_hom (Chn \) (Chn f) (Chn g)" - using assms ide_char arr_char dom_char cod_char - by (metis (no_types, lifting) C.ide_char arrow_of_spans.chine_in_hom - arrow_of_spans.chine_simps(3) arrow_of_spans_data.simps(3) V.ide_cod - V.ide_dom V.in_homE) + by (metis arr_char arrow_of_spans.chine_in_hom arrow_of_spans_data.select_convs(1) + assms category.in_homE is_category span_vertical_category.cod_char + span_vertical_category.dom_char span_vertical_category_axioms) abbreviation mkIde where "mkIde f0 f1 \ \Chn = C.dom f0, Dom = \Leg0 = f0, Leg1 = f1\, Cod = \Leg0 = f0, Leg1 = f1\\" lemma ide_mkIde: assumes "C.span f0 f1" shows "V.ide (mkIde f0 f1)" proof - interpret f: span_in_category C \\Leg0 = f0, Leg1 = f1\\ using assms by (unfold_locales, auto) interpret ff: arrow_of_spans C \mkIde f0 f1\ using assms f.apex_def C.comp_arr_dom by (unfold_locales, auto) show ?thesis using assms ff.arrow_of_spans_axioms ide_char by simp qed abbreviation mkObj where "mkObj a \ mkIde a a" lemma ide_mkObj: assumes "C.ide a" shows "V.ide (mkObj a)" using assms ide_mkIde [of a a] by auto lemma inverse_arrows: assumes "V.arr \" and "C.iso (Chn \)" shows "V.inverse_arrows \ \Chn = C.inv (Chn \), Dom = Cod \, Cod = Dom \\" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto let ?\ = "\Chn = C.inv (Chn \), Dom = Cod \, Cod = Dom \\" interpret \: arrow_of_spans C ?\ using assms C.invert_side_of_triangle(2) [of \.dom.leg0 \.cod.leg0 \.chine] C.invert_side_of_triangle(2) [of \.dom.leg1 \.cod.leg1 \.chine] by (unfold_locales, auto) show "V.inverse_arrows \ ?\" proof show "V.ide (?\ \ \)" - proof - - have 1: "V.seq ?\ \" - using arr_char ide_char dom_char cod_char vcomp_def \.arrow_of_spans_axioms - \.arrow_of_spans_axioms - by (intro V.seqI', auto) - have 2: "?\ \ \ = \Chn = C.inv (Chn \) \ Chn \, Dom = Dom \, Cod = Dom \\" - using 1 arr_char ide_char dom_char cod_char vcomp_def \.arrow_of_spans_axioms - \.arrow_of_spans_axioms - by simp - moreover have - "V.ide \Chn = C.inv (Chn \) \ Chn \, Dom = Dom \, Cod = Dom \\" - using assms 1 2 arr_char ide_char by (simp add: C.comp_inv_arr') - ultimately show ?thesis by simp - qed - show "V.ide (\ \ ?\)" - proof - - have 1: "V.seq \ ?\" - using arr_char ide_char dom_char cod_char vcomp_def \.arrow_of_spans_axioms - \.arrow_of_spans_axioms - by (intro V.seqI', auto) - have 2: "\ \ ?\ = \Chn = Chn \ \ C.inv (Chn \), Dom = Cod \, Cod = Cod \\" - using 1 arr_char ide_char dom_char cod_char vcomp_def \.arrow_of_spans_axioms - \.arrow_of_spans_axioms - by simp - moreover have "V.ide \Chn = Chn \ \ C.inv (Chn \), Dom = Cod \, Cod = Cod \\" - using assms 1 2 arr_char ide_char by (simp add: C.comp_arr_inv') - ultimately show ?thesis by simp - qed + by (metis C.invert_side_of_triangle(1) Chn_vcomp \.arrow_of_spans_axioms + \.chine_simps(1) \.chine_simps(2) \.dom.ide_apex \.arrow_of_spans_axioms + arr_char select_convs(1-2) assms(2) C.comp_arr_dom ide_char seq_char) + thus "V.ide (\ \ ?\)" + by (metis C.comp_inv_arr' C.inv_inv C.iso_inv_iso V.ide_compE \.cod.ide_apex + \.chine_simps(2) arr_char select_convs(1-2) assms(2) ide_char + Chn_vcomp) qed qed lemma iso_char: shows "V.iso \ \ V.arr \ \ C.iso (Chn \)" proof show "V.iso \ \ V.arr \ \ C.iso (Chn \)" using vcomp_eq ide_char by (metis C.iso_iff_section_and_retraction C.retractionI C.sectionI Chn_vcomp V.arr_cod V.arr_dom V.comp_arr_inv' V.comp_inv_arr' V.ide_cod V.ide_dom V.iso_is_arr) show "V.arr \ \ C.iso (Chn \) \ V.iso \" using inverse_arrows by auto qed lemma inv_eq: assumes "V.iso \" shows "V.inv \ = \Chn = C.inv (Chn \), Dom = Cod \, Cod = Dom \\" using assms inverse_arrows iso_char by (simp add: V.inverse_unique) end subsection "Putting Spans in Homs" context span_vertical_category begin interpretation V: category vcomp using is_category by simp definition src where "src \ \ if V.arr \ then mkObj (C.cod (Leg0 (Dom \))) else V.null" lemma ide_src [simp]: assumes "V.arr \" shows "V.ide (src \)" using assms src_def arr_char ide_mkObj C.ide_cod by (simp add: arrow_of_spans_def span_in_category.leg_simps(1)) interpretation src: endofunctor vcomp src proof show "\\. \ V.arr \ \ src \ = V.null" using arr_char by (simp add: src_def null_char) show 1: "\\. V.arr \ \ V.arr (src \)" using ide_src by simp show 2: "\\. V.arr \ \ V.dom (src \) = src (V.dom \)" using 1 arr_char src_def dom_char ide_src V.arr_dom V.ideD(2) by force show 3: "\\. V.arr \ \ V.cod (src \) = src (V.cod \)" using 1 arr_char src_def cod_char ide_src V.arr_cod V.ideD(3) arrow_of_spans.cod_src_eq_dom_src by force show "\\ \. V.seq \ \ \ src (\ \ \) = src \ \ src \" - proof - - fix \ \ - assume \\: "V.seq \ \" - show "src (\ \ \) = src \ \ src \" - proof - - have "src (\ \ \) = mkObj (C.cod (Leg0 (Dom \)))" - using \\ src_def vcomp_def - apply simp - using V.not_arr_null null_char by auto - also have - "... = \Chn = C.dom (C.cod (Leg0 (Dom \))) \ C.dom (C.cod (Leg0 (Dom \))), - Dom = \Leg0 = C.cod (Leg0 (Dom \)), Leg1 = C.cod (Leg0 (Dom \))\, - Cod = \Leg0 = C.cod (Leg0 (Dom \)), Leg1 = C.cod (Leg0 (Dom \))\\" - using \\ 1 - by (simp add: arrow_of_spans_def seq_char span_in_category.leg_simps(1)) - also have "... = src \ \ src \" - using \\ 1 src_def vcomp_def - apply (elim V.seqE, simp) - by (metis \\ arrow_of_spans.cod_src_eq_dom_src ide_char seq_char ide_src) - finally show ?thesis by blast - qed - qed + by (metis (no_types, lifting) "1" "2" "3" V.comp_ide_self V.dom_comp V.ideD(2) + V.seqE span_vertical_category.ide_src span_vertical_category_axioms) qed lemma src_is_endofunctor: shows "endofunctor vcomp src" .. lemma src_vcomp: assumes "V.seq \ \" shows "src (\ \ \) = src \ \ src \" using assms src.preserves_comp by simp definition trg where "trg \ \ if V.arr \ then mkObj (C.cod (Leg1 (Dom \))) else V.null" lemma ide_trg [simp]: assumes "V.arr \" shows "V.ide (trg \)" using assms trg_def arr_char ide_mkObj C.ide_cod by (simp add: arrow_of_spans_def span_in_category.leg_simps(3)) interpretation trg: endofunctor vcomp trg proof show "\\. \ V.arr \ \ trg \ = V.null" using arr_char by (simp add: trg_def null_char) show 1: "\\. V.arr \ \ V.arr (trg \)" using ide_trg by simp show 2: "\\. V.arr \ \ V.dom (trg \) = trg (V.dom \)" using 1 arr_char trg_def dom_char ide_trg V.arr_dom V.ideD(2) by force show 3: "\\. V.arr \ \ V.cod (trg \) = trg (V.cod \)" using 1 arr_char trg_def cod_char ide_trg V.arr_cod V.ideD(3) arrow_of_spans.cod_trg_eq_dom_trg by force show "\\ \. V.seq \ \ \ trg (\ \ \) = trg \ \ trg \" - proof - - fix \ \ - assume \\: "V.seq \ \" - show "trg (\ \ \) = trg \ \ trg \" - proof - - have "trg (\ \ \) = mkObj (C.cod (Leg1 (Dom \)))" - using \\ trg_def vcomp_def - apply simp - using V.not_arr_null null_char by auto - also have "... = \Chn = Chn (trg \) \ Chn (trg \), - Dom = Dom (trg \), Cod = Cod (trg \)\" - using \\ 1 trg_def vcomp_def - apply (elim V.seqE, simp) - by (metis C.ide_def \\ arrow_of_spans.cod_trg_eq_dom_trg select_convs(1) ide_char - ide_trg seq_char) - also have "... = trg \ \ trg \" - using \\ 1 src_def vcomp_def - apply (elim V.seqE, simp) - by (metis "2" "3" V.ideD(2) V.ideD(3) select_convs(2) select_convs(3) ide_char - ide_trg trg_def) - finally show ?thesis by blast - qed - qed + by (metis "2" "3" V.comp_ide_self V.dom_comp V.ide_char V.seqE ide_trg) qed lemma trg_is_endofunctor: shows "endofunctor vcomp trg" .. lemma trg_vcomp: assumes "V.seq \ \" shows "trg (\ \ \) = trg \ \ trg \" using assms trg.preserves_comp by simp lemma src_trg_simps [simp]: assumes "V.arr \" shows "src (src \) = src \" and "src (trg \) = trg \" and "trg (src \) = src \" and "trg (trg \) = trg \" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto have 1: "V.arr \Chn = \.dsrc, Dom = \Leg0 = \.dsrc, Leg1 = \.dsrc\, Cod = \Leg0 = \.dsrc, Leg1 = \.dsrc\\" using ide_mkObj by auto have 2: "V.arr \Chn = \.dtrg, Dom = \Leg0 = \.dtrg, Leg1 = \.dtrg\, Cod = \Leg0 = \.dtrg, Leg1 = \.dtrg\\" using ide_mkObj by auto show "src (src \) = src \" using assms 1 src_def by simp show "trg (src \) = src \" using assms 1 src_def trg_def by simp show "src (trg \) = trg \" using assms 2 src_def trg_def by simp show "trg (trg \) = trg \" using assms 2 trg_def by simp qed sublocale horizontal_homs vcomp src trg by (unfold_locales, simp_all) lemma has_horizontal_homs: shows "horizontal_homs vcomp src trg" .. lemma obj_char: shows "obj a \ V.ide a \ a = mkObj (Chn a)" - proof - show "obj a \ V.ide a \ a = mkObj (Chn a)" - proof - assume a: "obj a" - show 1: "V.ide a" - using a by auto - show "a = mkObj (Chn a)" - using a 1 obj_def src_def ide_char - apply simp - by (metis arrow_of_spans_data.select_convs(1) arrow_of_spans_def category.dom_cod) - qed - show "V.ide a \ a = mkObj (Chn a) \ obj a" - proof - - assume a: "V.ide a \ a = mkObj (Chn a)" - show "obj a" - unfolding obj_def src_def - using a - apply simp - by (metis C.ide_char arrow_of_spans_data.select_convs(2) ide_char - span_data.select_convs(1)) - qed - qed + by (metis C.dom_cod V.comp_ide_self V.ide_char arrow_of_spans.chine_simps(3) + arrow_of_spans_data.select_convs(1,3) objE objI_trg span_data.select_convs(2) + cod_char seq_char trg_def) end subsection "Horizontal Composite of Spans" text \ We now define the horizontal composite \S \ T\ of spans \S\ and \T\, assuming that \C\ is a category with chosen pullbacks. We think of Leg0 as an input and Leg1 as an output. The following then defines the composite span \S \ T\, with \T\ on the ``input side'' of \S\. The notation is such that the \\

\<^sub>0\ projections of \C\ are used for legs on the input (\emph{i.e.} the ``0'') side and the \\

\<^sub>1\ projections are used for legs on the output (\emph{i.e.} the ``1'') side. \ locale composite_span = C: elementary_category_with_pullbacks + S: span_in_category C S + T: span_in_category C T for S (structure) and T (structure) + assumes composable: "C.cod (Leg0 S) = C.cod (Leg1 T)" begin abbreviation this where "this \ \Leg0 = T.leg0 \ \

\<^sub>0[S.leg0, T.leg1], Leg1 = S.leg1 \ \

\<^sub>1[S.leg0, T.leg1]\" lemma leg0_prj_in_hom: shows "\T.leg0 \ \

\<^sub>0[S.leg0, T.leg1] : S.leg0 \\ T.leg1 \ C.cod (Leg0 T)\" using S.is_span T.is_span C.prj0_in_hom [of "Leg0 S" "Leg1 T"] composable by auto lemma leg1_prj_in_hom: shows "\S.leg1 \ \

\<^sub>1[S.leg0, T.leg1] : S.leg0 \\ T.leg1 \ C.cod (Leg1 S)\" using S.is_span T.is_span C.prj1_in_hom [of "Leg0 S" "Leg1 T"] composable by auto lemma is_span [simp]: shows "span_in_category C this" using leg0_prj_in_hom leg1_prj_in_hom by (unfold_locales, fastforce) sublocale span_in_category C this using is_span by auto end locale span_bicategory = C: elementary_category_with_pullbacks + span_vertical_category begin definition chine_hcomp where "chine_hcomp \ \ \ \Chn \ \ \

\<^sub>1[Leg0 (Dom \), Leg1 (Dom \)] \Leg0 (Cod \), Leg1 (Cod \)\ Chn \ \ \

\<^sub>0[Leg0 (Dom \), Leg1 (Dom \)]\" text \ $$\xymatrix{ & & \scriptstyle{{\rm src}({\rm Dom}~\nu)} \;=\; {{\rm trg}({\rm Dom}~\mu)} & &\\ & \ar[ddl] _{{\rm Leg1}({\rm Dom}~\nu)} \ar [ur] ^<>(0.4){{\rm Leg0}({\rm Dom}~\nu)\hspace{20pt}} \ar[dddd] ^{{\rm Chn}~\nu} & & \ar[ul] _<>(0.4){\hspace{20pt}{\rm Leg1}({\rm Dom}~\mu)} \ar[ddr] ^{{\rm Leg0}({\rm Dom}~\mu)} \ar[dddd] _{{\rm Chn}~\mu} \\ & & \ar[ul] ^{p_1} \ar[ur] _{p_0} \ar@ {.>}[dd]^<>(0.3){{\rm chn\_hcomp~\mu~\nu}} \\ \scriptstyle{{\rm trg}~\nu} & & & & \scriptstyle{{\rm src}~\mu} \\ & & \ar[dl] _{p_1} \ar[dr] ^{p_0} & & \\ & \ar[uul] ^{{\rm Leg1}({\rm Cod}~\nu)} \ar[dr] _<>(0.4){{\rm Leg1}({\rm Cod}~\nu)\hspace{20pt}} & & \ar[dl] ^<>(0.4){\hspace{20pt}{\rm Leg1}({\rm Cod}~\mu)} \ar[uur] _{{\rm Leg0}({\rm Cod}~\mu)} \\ & & \scriptstyle{{\rm src}({\rm Cod}~\nu)} \;=\; {{\rm trg}({\rm Cod}~\mu)} & & }$$ \ definition hcomp where "hcomp \ \ \ if arr \ \ arr \ \ src \ = trg \ then \Chn = chine_hcomp \ \, Dom = composite_span.this C prj0 prj1 (Dom \) (Dom \), Cod = composite_span.this C prj0 prj1 (Cod \) (Cod \)\ else null" notation hcomp (infixr "\" 53) lemma chine_hcomp_props: assumes "arr \" and "arr \" and "src \ = trg \" shows "\chine_hcomp \ \ : Leg0 (Dom \) \\ Leg1 (Dom \) \\<^sub>C Leg0 (Cod \) \\ Leg1 (Cod \)\" and "C.commutative_square (Leg0 (Cod \)) (Leg1 (Cod \)) (Chn \ \ \

\<^sub>1[Leg0 (Dom \), Leg1 (Dom \)]) (Chn \ \ \

\<^sub>0[Leg0 (Dom \), Leg1 (Dom \)])" and "C.commutative_square \

\<^sub>1[Leg0 (Cod \), Leg1 (Cod \)] (Chn \) (chine_hcomp \ \) \

\<^sub>1[Leg0 (Dom \), Leg1 (Dom \)]" and "C.commutative_square \

\<^sub>0[Leg0 (Cod \), Leg1 (Cod \)] (Chn \) (chine_hcomp \ \) \

\<^sub>0[Leg0 (Dom \), Leg1 (Dom \)]" and "\

\<^sub>0[Leg0 (Cod \), Leg1 (Cod \)] \ chine_hcomp \ \ = Chn \ \ \

\<^sub>0[Leg0 (Dom \), Leg1 (Dom \)]" and "\

\<^sub>1[Leg0 (Cod \), Leg1 (Cod \)] \ chine_hcomp \ \ = Chn \ \ \

\<^sub>1[Leg0 (Dom \), Leg1 (Dom \)]" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \: arrow_of_spans C \ using assms arr_char by auto show 0: "C.commutative_square \.cod.leg0 \.cod.leg1 (\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]) (\.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1])" using assms src_def trg_def C.pullback_commutes C.comp_reduce C.commutative_square_def by auto show 1: "\

\<^sub>1[\.cod.leg0, \.cod.leg1] \ chine_hcomp \ \ = \.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" unfolding chine_hcomp_def using 0 by simp show 2: "\

\<^sub>0[\.cod.leg0, \.cod.leg1] \ chine_hcomp \ \ = \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]" unfolding chine_hcomp_def using 0 by simp show 3: "\chine_hcomp \ \ : \.dom.leg0 \\ \.dom.leg1 \\<^sub>C \.cod.leg0 \\ \.cod.leg1\" unfolding chine_hcomp_def using assms 0 src_def trg_def C.tuple_in_hom by auto show "C.commutative_square \

\<^sub>1[\.cod.leg0, \.cod.leg1] \.chine (chine_hcomp \ \) \

\<^sub>1[\.dom.leg0, \.dom.leg1]" using assms src_def trg_def 1 3 by auto show "C.commutative_square \

\<^sub>0[\.cod.leg0, \.cod.leg1] \.chine (chine_hcomp \ \) \

\<^sub>0[\.dom.leg0, \.dom.leg1]" using assms src_def trg_def 2 3 by auto qed lemma chine_hcomp_in_hom [intro]: assumes "arr \" and "arr \" and "src \ = trg \" shows "\chine_hcomp \ \ : Leg0 (Dom \) \\ Leg1 (Dom \) \\<^sub>C Leg0 (Cod \) \\ Leg1 (Cod \)\" using assms chine_hcomp_props(1) by simp lemma arrow_of_spans_hcomp: assumes "arr \" and "arr \" and "src \ = trg \" shows "arrow_of_spans C (\ \ \)" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \: arrow_of_spans C \ using assms arr_char by auto show ?thesis proof show span_Dom: "C.span (Leg0 (Dom (\ \ \))) (Leg1 (Dom (\ \ \)))" using assms src_def trg_def hcomp_def C.seqI' by auto interpret Dom: span_in_category C \Dom (\ \ \)\ using span_Dom by (unfold_locales, auto) show span_Cod: "C.span (Leg0 (Cod (\ \ \))) (Leg1 (Cod (\ \ \)))" using assms hcomp_def src_def trg_def by auto interpret Cod: span_in_category C \Cod (\ \ \)\ using span_Cod by (unfold_locales, auto) show map: "\Chn (\ \ \) : Dom.apex \\<^sub>C Cod.apex\" using assms src_def trg_def chine_hcomp_props hcomp_def Cod.apex_def Dom.apex_def by auto show "Cod.leg0 \ Chn (\ \ \) = Dom.leg0" - proof - - have "(\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1]) \ chine_hcomp \ \ = - \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]" - proof - - have "(\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1]) \ chine_hcomp \ \ = - \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1] \ chine_hcomp \ \" - using assms - by (metis (full_types) C.category_axioms C.comp_reduce C.dom_comp C.match_2 - C.seqE C.seqI category.ext) - also have "... = \.cod.leg0 \ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]" - using assms src_def trg_def - by (simp add: chine_hcomp_def chine_hcomp_props(2)) - also have "... = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]" - using assms \.leg0_commutes C.comp_reduce - by (metis (mono_tags, lifting) C.commutative_squareE \.dom.leg_simps(1) - chine_hcomp_props(2)) - finally show ?thesis by simp - qed - thus ?thesis - using assms src_def trg_def hcomp_def chine_hcomp_props \.chine_in_hom C.comp_reduce - by auto - qed + by (metis C.comp_assoc \.leg0_commutes arrow_of_spans_data.select_convs(1-3) + assms(1-3) chine_hcomp_props(5) hcomp_def span_data.select_convs(1)) show "Cod.leg1 \ Chn (\ \ \) = Dom.leg1" proof - have "(\.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]) \ chine_hcomp \ \ = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" - proof - - have "(\.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]) \ chine_hcomp \ \ = - \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1] \ chine_hcomp \ \" - using assms - by (metis (full_types) C.category_axioms C.comp_reduce C.dom_comp C.match_2 - C.seqE C.seqI category.ext) - also have "... = \.cod.leg1 \ \.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" - using assms src_def trg_def - by (simp add: chine_hcomp_def chine_hcomp_props(2)) - also have "... = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" - using assms \.leg1_commutes C.comp_reduce - by (metis (mono_tags, lifting) C.commutative_squareE \.dom.leg_simps(3) - chine_hcomp_props(2)) - finally show ?thesis by blast - qed + by (metis C.comp_assoc \.leg1_commutes assms(1-3) chine_hcomp_props(6)) thus ?thesis using assms src_def trg_def hcomp_def chine_hcomp_props \.chine_in_hom C.comp_reduce by auto qed qed qed lemma chine_hcomp_ide_arr: assumes "ide f" and "arr \" and "src f = trg \" shows "chine_hcomp f \ = \\

\<^sub>1[Leg0 (Dom f), Leg1 (Dom \)] \Leg0 (Cod f), Leg1 (Cod \)\ Chn \ \ \

\<^sub>0[Leg0 (Dom f), Leg1 (Dom \)]\" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret f: arrow_of_spans C f using assms ide_char by auto have 1: "C.cospan f.dom.leg0 \.dom.leg1" using assms src_def trg_def by auto have "chine_hcomp f \ = \f.chine \ \

\<^sub>1[f.dom.leg0, \.dom.leg1] \f.cod.leg0, \.cod.leg1\ \.chine \ \

\<^sub>0[f.dom.leg0, \.dom.leg1]\" unfolding chine_hcomp_def using assms ide_char by simp moreover have "f.chine \ \

\<^sub>1[f.dom.leg0, \.dom.leg1] = \

\<^sub>1[f.dom.leg0, \.dom.leg1]" using assms 1 C.comp_ide_arr ide_char by auto ultimately show ?thesis by argo qed lemma chine_hcomp_arr_ide: assumes "arr \" and "ide f" and "src \ = trg f" shows "chine_hcomp \ f = \Chn \ \ \

\<^sub>1[Leg0 (Dom \), Leg1 (Dom f)] \Leg0 (Cod \), Leg1 (Cod f)\ \

\<^sub>0[Leg0 (Dom \), Leg1 (Dom f)]\" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret f: arrow_of_spans C f using assms ide_char by auto have 1: "C.cospan \.dom.leg0 f.dom.leg1" using assms src_def trg_def by auto have "chine_hcomp \ f = \\.chine \ \

\<^sub>1[\.dom.leg0, f.dom.leg1] \\.cod.leg0, f.cod.leg1\ f.chine \ \

\<^sub>0[\.dom.leg0, f.dom.leg1]\" unfolding chine_hcomp_def using assms ide_char by simp moreover have "f.chine \ \

\<^sub>0[\.dom.leg0, f.dom.leg1] = \

\<^sub>0[\.dom.leg0, f.dom.leg1]" using assms 1 C.comp_ide_arr ide_char by auto ultimately show ?thesis by argo qed lemma chine_hcomp_ide_ide: assumes "ide g" and "ide f" and "src g = trg f" shows "chine_hcomp g f = Leg0 (Dom g) \\ Leg1 (Dom f)" proof - interpret g: identity_arrow_of_spans C g using assms ide_char' by auto interpret f: identity_arrow_of_spans C f using assms ide_char' by auto have 1: "C.cospan g.dom.leg0 f.dom.leg1" using assms src_def trg_def by auto have "chine_hcomp g f = \g.chine \ \

\<^sub>1[g.dom.leg0, f.dom.leg1] \g.cod.leg0, f.cod.leg1\ \

\<^sub>0[g.dom.leg0, f.dom.leg1]\" using assms chine_hcomp_arr_ide by simp moreover have "g.chine \ \

\<^sub>1[g.dom.leg0, f.dom.leg1] = \

\<^sub>1[g.dom.leg0, f.dom.leg1]" using assms 1 C.comp_ide_arr ide_char by auto ultimately have "chine_hcomp g f = \\

\<^sub>1[g.dom.leg0, f.dom.leg1] \g.cod.leg0, f.cod.leg1\ \

\<^sub>0[g.dom.leg0, f.dom.leg1]\" by simp also have "... = \\

\<^sub>1[g.dom.leg0, f.dom.leg1] \ (g.dom.leg0 \\ f.dom.leg1) \g.cod.leg0, f.cod.leg1\ \

\<^sub>0[g.dom.leg0, f.dom.leg1] \ (g.dom.leg0 \\ f.dom.leg1)\" using assms 1 C.comp_arr_dom by simp also have "... = g.dom.leg0 \\ f.dom.leg1" using 1 C.pullback_commutes C.tuple_prj by simp finally show ?thesis by simp qed lemma chine_hcomp_trg_arr: assumes "arr \" shows "chine_hcomp (trg \) \ = \\

\<^sub>1[C.cod (Leg1 (Dom \)), Leg1 (Dom \)] \C.cod (Leg1 (Dom \)), Leg1 (Cod \)\ Chn \ \ \

\<^sub>0[C.cod (Leg1 (Dom \)), Leg1 (Dom \)]\" - proof - - interpret \: arrow_of_spans C \ - using assms arr_char by auto - interpret trg_\: arrow_of_spans C \trg \\ - using assms ide_trg ide_char by simp - have "trg_\.dom.leg0 = C.cod \.dom.leg1 \ trg_\.cod.leg0 = C.cod \.dom.leg1 \ - trg_\.dom.leg0 = C.cod \.dom.leg1" - using assms ide_char src_def trg_def by simp - thus ?thesis - using assms chine_hcomp_ide_arr [of "trg \" \] by auto - qed + using assms chine_hcomp_ide_arr ide_trg src_trg trg_def by force lemma chine_hcomp_trg_ide: assumes "ide f" shows "chine_hcomp (trg f) f = C.cod (Leg1 (Dom f)) \\ Leg1 (Dom f)" - proof - - interpret f: arrow_of_spans C f - using assms arr_char by auto - interpret trg_f: arrow_of_spans C \trg f\ - using assms ide_trg ide_char by simp - have "trg_f.dom.leg0 = C.cod f.dom.leg1" - using assms trg_def by simp - thus ?thesis - using assms chine_hcomp_ide_ide [of "trg f" f] by auto - qed + using assms chine_hcomp_ide_ide ide_trg src_trg trg_def by force lemma chine_hcomp_arr_src: assumes "arr \" shows "chine_hcomp \ (src \) = \Chn \ \ \

\<^sub>1[Leg0 (Dom \), C.cod (Leg0 (Dom \))] \Leg0 (Cod \), C.cod (Leg0 (Dom \))\ \

\<^sub>0[Leg0 (Dom \), C.cod (Leg0 (Dom \))]\" - proof - - interpret \: arrow_of_spans C \ - using assms arr_char by auto - interpret src_\: arrow_of_spans C \src \\ - using assms ide_src ide_char by simp - have "src_\.dom.leg1 = \.dsrc \ src_\.cod.leg1 = \.dsrc" - using assms ide_char src_def trg_def by simp - thus ?thesis - using assms chine_hcomp_arr_ide by auto - qed + using assms chine_hcomp_arr_ide ide_src src_def trg_src by force lemma chine_hcomp_ide_src: assumes "ide f" shows "chine_hcomp f (src f) = Leg0 (Dom f) \\ C.cod (Leg0 (Dom f))" - proof - - interpret f: arrow_of_spans C f - using assms arr_char by auto - interpret src_f: arrow_of_spans C \src f\ - using assms ide_src ide_char by simp - have "C.cod f.dom.leg0 = src_f.dom.leg1" - using assms src_def by simp - thus ?thesis - using assms chine_hcomp_ide_ide by auto - qed + using assms chine_hcomp_ide_ide src.preserves_ide src_def trg_src by force lemma src_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "src (\ \ \) = src \" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \: arrow_of_spans C \ using assms arr_char by auto have "C.cod (\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]) = C.cod \.dom.leg0" using assms C.commutative_squareE chine_hcomp_props(2) by (metis (mono_tags, lifting) C.cod_comp C.match_3 \.leg0_commutes \.dom.is_span) thus ?thesis using assms arr_char hcomp_def src_def C.comp_cod_arr C.comp_arr_dom arrow_of_spans_hcomp by simp qed lemma trg_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "trg (\ \ \) = trg \" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \: arrow_of_spans C \ using assms arr_char by auto have "C.cod (\.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]) = \.dtrg" using assms C.commutative_squareE chine_hcomp_props(2) by (metis (mono_tags, lifting) C.cod_comp C.match_3 \.leg1_commutes \.dom.is_span) thus ?thesis using assms arr_char hcomp_def trg_def C.comp_cod_arr C.comp_arr_dom arrow_of_spans_hcomp by simp qed lemma dom_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "dom (\ \ \) = dom \ \ dom \" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \\: arrow_of_spans C \hcomp \ \\ using assms arr_char arrow_of_spans_hcomp by simp have 1: "C.cospan \.dom.leg1 \.dom.leg0" using assms \.dom.is_span \.dom.is_span src_def trg_def by auto have "dom (\ \ \) = \Chn = \.dom.leg0 \\ \.dom.leg1, Dom = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\, Cod = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\\" using assms \\.arrow_of_spans_axioms \\.dom.leg_simps(2) \\.dom.is_span arr_char dom_char hcomp_def by auto also have "... = \Chn = chine_hcomp (dom \) (dom \), Dom = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\, Cod = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\\" using assms src_dom trg_dom ide_dom dom_char chine_hcomp_ide_ide apply auto by (metis (no_types, lifting) arrow_of_spans_data.select_convs(2)) also have "... = dom \ \ dom \" using assms src_dom trg_dom arr_dom dom_char hcomp_def apply auto by (metis (no_types, lifting)) finally show ?thesis by blast qed lemma cod_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "cod (\ \ \) = cod \ \ cod \" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \\: arrow_of_spans C \hcomp \ \\ using assms arr_char arrow_of_spans_hcomp by simp have 1: "C.cospan \.cod.leg1 \.cod.leg0" using assms \.cod.is_span \.cod.is_span src_def trg_def by simp have 2: "cod (\ \ \) = \Chn = \.cod.leg0 \\ \.cod.leg1, Dom = \Leg0 = \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], Leg1 = \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\, Cod = \Leg0 = \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], Leg1 = \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\\" using assms \\.arrow_of_spans_axioms \\.cod.leg_simps(2) \\.cod.is_span arr_char cod_char hcomp_def by auto also have "... = \Chn = chine_hcomp (cod \) (cod \), Dom = \Leg0 = \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], Leg1 = \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\, Cod = \Leg0 = \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], Leg1 = \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\\" using assms src_cod trg_cod ide_cod cod_char chine_hcomp_ide_ide apply auto by (metis (no_types, lifting) arrow_of_spans_data.select_convs(2)) also have "... = cod \ \ cod \" using assms src_cod trg_cod arr_cod cod_char hcomp_def apply auto by (metis (no_types, lifting)) finally show ?thesis by simp qed lemma hcomp_vcomp: assumes "arr \" and "arr \" and "src \ = trg \" and "arr \'" and "arr \'" and "src \' = trg \'" and "seq \' \" and "seq \' \" shows "(\' \ \) \ (\' \ \) = (\' \ \') \ (\ \ \)" proof - interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \: arrow_of_spans C \ using assms arr_char by auto interpret \': arrow_of_spans C \' using assms arr_char by auto interpret \': arrow_of_spans C \' using assms arr_char by auto interpret \\: arrow_of_spans C \hcomp \ \\ using assms arr_char arrow_of_spans_hcomp by auto interpret \'\': arrow_of_spans C \hcomp \' \'\ using assms arr_char arrow_of_spans_hcomp by auto have 1: "Dom \' = Cod \ \ Dom \' = Cod \" using assms src_def trg_def seq_char by blast have 2: "Dom (\' \ \) = Dom \ \ Dom (\' \ \) = Dom \ \ Cod (\' \ \) = Cod \' \ Cod (\' \ \) = Cod \'" using assms seq_char arr_char vcomp_def by (metis arrow_of_spans_data.select_convs(2) arrow_of_spans_data.select_convs(3)) have 3: "chine_hcomp (\' \ \) (\' \ \) = \Chn (\' \ \) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\'.cod.leg0, \'.cod.leg1\ Chn (\' \ \) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\" unfolding chine_hcomp_def using 2 by simp have C1: "C.commutative_square \'.cod.leg0 \'.cod.leg1 (Chn \' \ \

\<^sub>1[\'.dom.leg0, \'.dom.leg1]) (Chn \' \ \

\<^sub>0[\'.dom.leg0, \'.dom.leg1])" using assms 1 vcomp_def seq_char arr_char chine_hcomp_props(2) by blast have C2: "C.commutative_square \'.cod.leg0 \'.cod.leg1 (Chn (\' \ \) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]) (Chn (\' \ \) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1])" - (* using assms 1 2 vcomp_def seq_char arr_char chine_hcomp_props(1-2) src_vcomp trg_vcomp - by smt *) - proof - show 3: "C.cospan \'.cod.leg0 \'.cod.leg1" - using assms 1 2 vcomp_def seq_char arr_char chine_hcomp_props(1-2) - src_vcomp trg_vcomp - by (meson C.commutative_squareE) - show 4: "C.span (Chn (\' \ \) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]) - (Chn (\' \ \) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1])" - using assms 1 2 3 vcomp_def seq_char arr_char chine_hcomp_props(1-2) - src_vcomp trg_vcomp - by simp - show "C.dom \'.cod.leg0 = C.cod (Chn (\' \ \) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1])" - using assms 1 2 4 vcomp_def seq_char arr_char chine_hcomp_props(1-2) - src_vcomp trg_vcomp - by simp - show "\'.cod.leg0 \ Chn (\' \ \) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] = - \'.cod.leg1 \ Chn (\' \ \) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]" - using assms 1 2 vcomp_def seq_char arr_char chine_hcomp_props(1-2) - src_vcomp trg_vcomp - by (metis (mono_tags, lifting) C.comp_assoc C.pullback_commutes' Chn_vcomp - \'.cod_trg_eq_dom_trg \'.leg1_commutes \.cod_trg_eq_dom_trg \.dom.leg_simps(3) - \.leg1_commutes \'.cod_src_eq_dom_src \'.leg0_commutes \.cod_src_eq_dom_src - \.dom.leg_simps(1) \.leg0_commutes \C.cospan \'.cod.leg0 \'.cod.leg1\) - qed + by (metis "2" assms(3,6-8) chine_hcomp_props(2) src.as_nat_trans.preserves_comp_2 + trg.as_nat_trans.preserves_comp_2 vseq_implies_hpar(2)) have "(\' \ \) \ (\' \ \) = \Chn = chine_hcomp (\' \ \) (\' \ \), Dom = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\, Cod = \Leg0 = \'.cod.leg0 \ \

\<^sub>0[\'.cod.leg0, \'.cod.leg1], Leg1 = \'.cod.leg1 \ \

\<^sub>1[\'.cod.leg0, \'.cod.leg1]\\" - proof - - have "\' \ \ \ \' \ \ = - \Chn = chine_hcomp (\' \ \) (\' \ \), - Dom = - \Leg0 = Leg0 (Dom (\' \ \)) \ \

\<^sub>0[Leg0 (Dom (\' \ \)), Leg1 (Dom (\' \ \))], - Leg1 = Leg1 (Dom (\' \ \)) \ \

\<^sub>1[Leg0 (Dom (\' \ \)), Leg1 (Dom (\' \ \))]\, - Cod = \Leg0 = Leg0 (Cod (\' \ \)) \ \

\<^sub>0[Leg0 (Cod (\' \ \)), Leg1 (Cod (\' \ \))], - Leg1 = Leg1 (Cod (\' \ \)) \ \

\<^sub>1[Leg0 (Cod (\' \ \)), Leg1 (Cod (\' \ \))]\\" - by (simp add: assms(3) assms(6-8) hcomp_def) - then show ?thesis - by (metis "2") - qed - moreover - have "(\' \ \') \ (\ \ \) = - \Chn = chine_hcomp \' \' \ chine_hcomp \ \, - Dom = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], - Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\, - Cod = \Leg0 = \'.cod.leg0 \ \

\<^sub>0[\'.cod.leg0, \'.cod.leg1], - Leg1 = \'.cod.leg1 \ \

\<^sub>1[\'.cod.leg0, \'.cod.leg1]\\" - proof - - have "arr (\' \ \') \ arr (\ \ \)" - using assms arrow_of_spans_hcomp arr_char by simp - moreover have "Dom (\' \ \') = Cod (\ \ \)" - using assms src_def trg_def seq_char hcomp_def src_hcomp trg_hcomp by simp - ultimately show ?thesis - using assms seq_char arr_char vcomp_eq hcomp_def by auto - qed + using "2" assms(3,6-8) hcomp_def src_vcomp trg_vcomp by presburger + moreover have "(\' \ \') \ (\ \ \) = + \Chn = chine_hcomp \' \' \ chine_hcomp \ \, + Dom = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], + Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\, + Cod = \Leg0 = \'.cod.leg0 \ \

\<^sub>0[\'.cod.leg0, \'.cod.leg1], + Leg1 = \'.cod.leg1 \ \

\<^sub>1[\'.cod.leg0, \'.cod.leg1]\\" + using "1" \'\'.arrow_of_spans_axioms \\.arrow_of_spans_axioms assms(1-6) + hcomp_def span_vertical_category.seq_char span_vertical_category_axioms vcomp_eq + by fastforce moreover have "chine_hcomp (\' \ \) (\' \ \) = chine_hcomp \' \' \ chine_hcomp \ \" proof - have "C.cospan \'.cod.leg0 \'.cod.leg1" using assms src_def trg_def by simp moreover have "C.seq \

\<^sub>1[\'.cod.leg0, \'.cod.leg1] (chine_hcomp (\' \ \) (\' \ \))" using assms 2 C2 chine_hcomp_props [of "\' \ \" "\' \ \"] by auto moreover have "C.seq \

\<^sub>1[\'.cod.leg0, \'.cod.leg1] (chine_hcomp \' \' \ chine_hcomp \ \)" using assms 1 chine_hcomp_props [of \ \] chine_hcomp_props [of \' \'] by auto moreover have "\

\<^sub>0[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp (\' \ \) (\' \ \) = \

\<^sub>0[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp \' \' \ chine_hcomp \ \" - proof - - have "\

\<^sub>0[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp (\' \ \) (\' \ \) = - Chn (\' \ \) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]" - using C2 3 by simp - also have "... = (\'.chine \ \.chine) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]" - using assms vcomp_def seq_char arr_char - by (metis arrow_of_spans_data.select_convs(1)) - also have "... = \'.chine \ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]" - using C.comp_assoc by simp - also have "... = (\'.chine \ \

\<^sub>0[\.cod.leg0, \.cod.leg1]) \ chine_hcomp \ \" - using assms 1 - C.prj_tuple(1) - [of "\.cod.leg0" "\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" - "\.cod.leg1" "\.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]"] - by (metis (mono_tags, lifting) C.commutative_squareE C.comp_assoc chine_hcomp_props(4)) - also have "... = (\

\<^sub>0[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp \' \') \ chine_hcomp \ \" - using assms 1 - by (metis (mono_tags, lifting) C.commutative_squareE chine_hcomp_props(4)) - also have "... = \

\<^sub>0[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp \' \' \ chine_hcomp \ \" - using C.comp_assoc by simp - finally show ?thesis by blast - qed + by (metis (no_types, lifting) "1" "2" C.comp_assoc Chn_vcomp assms(1-8) + chine_hcomp_props(5) src_vcomp trg_vcomp) moreover have "\

\<^sub>1[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp (\' \ \) (\' \ \) = \

\<^sub>1[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp \' \' \ chine_hcomp \ \" - proof - - have "\

\<^sub>1[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp (\' \ \) (\' \ \) = - \

\<^sub>1[\'.cod.leg0, \'.cod.leg1] \ - \Chn (\' \ \) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] - \Leg0 (Cod \'), Leg1 (Cod \')\ - Chn (\' \ \) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\" - using 3 by simp - also have "... = Chn (\' \ \) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" - using C2 C.prj_tuple(2) [of "Leg0 (Cod \')" - "Chn (\' \ \) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" - "Leg1 (Cod \')" - "Chn (\' \ \) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]"] - by simp - also have "... = (\'.chine \ \.chine) \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" - using assms vcomp_def seq_char arr_char - by (metis (no_types, lifting) arrow_of_spans_data.select_convs(1)) - also have "... = \'.chine \ \.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]" - using C.comp_assoc by simp - also have "... = (\'.chine \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]) \ chine_hcomp \ \" - proof - - have "C.commutative_square \.cod.leg0 \.cod.leg1 - (\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]) - (\.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1])" - using assms 1 vcomp_def seq_char arr_char chine_hcomp_props(2) by auto - thus ?thesis - using assms 1 \'.leg0_commutes C.prj_tuple(2) apply (simp add: C.comp_assoc) - by (metis (mono_tags, lifting) C.commutative_squareE chine_hcomp_props(3)) - qed - also have "... = (\

\<^sub>1[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp \' \') \ chine_hcomp \ \" - unfolding chine_hcomp_def using C1 1 C.prj_tuple(2) by simp - also have "... = \

\<^sub>1[\'.cod.leg0, \'.cod.leg1] \ chine_hcomp \' \' \ chine_hcomp \ \" - using C.comp_assoc by simp - finally show ?thesis by blast - qed + by (metis (no_types, lifting) "1" "3" C.comp_assoc C.prj_tuple(2) C1 C2 Chn_vcomp + assms(1-3,8) chine_hcomp_def chine_hcomp_props(6)) ultimately show ?thesis using C.prj_joint_monic [of "\'.cod.leg0" "\'.cod.leg1" "chine_hcomp (\' \ \) (\' \ \)" "chine_hcomp \' \' \ chine_hcomp \ \"] by simp qed ultimately show ?thesis by auto qed interpretation H: "functor" VV.comp vcomp \\\\. fst \\ \ snd \\\ proof show "\\\. \ VV.arr \\ \ fst \\ \ snd \\ = null" using hcomp_def VV.arr_char null_char by auto show "\\\. VV.arr \\ \ arr (fst \\ \ snd \\)" using arr_char arrow_of_spans_hcomp VV.arr_char by simp show "\\\. VV.arr \\ \ dom (fst \\ \ snd \\) = fst (VV.dom \\) \ snd (VV.dom \\)" using VV.arr_char VV.dom_char dom_hcomp by auto show "\\\. VV.arr \\ \ cod (fst \\ \ snd \\) = fst (VV.cod \\) \ snd (VV.cod \\)" using VV.arr_char VV.cod_char cod_hcomp by auto show "\\\' \\. VV.seq \\' \\ \ fst (VV.comp \\' \\) \ snd (VV.comp \\' \\) = (fst \\' \ snd \\') \ (fst \\ \ snd \\)" proof - fix \\' \\ assume 1: "VV.seq \\' \\" have "VV.comp \\' \\ = (fst \\' \ fst \\, snd \\' \ snd \\)" - using 1 VV.comp_char VV.seq_char VxV.comp_char by auto + by (metis (no_types, lifting) "1" VV.comp_simp VV.seq_char VxV.comp_char VxV.seqE) thus "fst (VV.comp \\' \\) \ snd (VV.comp \\' \\) = (fst \\' \ snd \\') \ (fst \\ \ snd \\)" using 1 hcomp_vcomp VV.seq_char VV.arr_char VV.comp_char by (metis (no_types, lifting) fst_conv snd_conv) qed qed lemma hcomp_is_functor: shows "functor VV.comp vcomp (\\\. fst \\ \ snd \\)" .. lemma ide_hcomp: assumes "ide f" and "ide g" and "src f = trg g" shows "ide (f \ g)" using assms VV.ide_char VV.arr_char H.preserves_ide [of "(f, g)"] by auto sublocale horizontal_composition vcomp hcomp src trg using src_hcomp trg_hcomp VV.arr_char not_arr_null hcomp_def null_char by (unfold_locales, auto) lemma has_horizontal_composition: shows "horizontal_composition vcomp hcomp src trg" .. end subsection "The Bicategory Span(C)" context span_bicategory begin lemma arr_eqI: assumes "par \ \'" and "Chn \ = Chn \'" shows "\ = \'" using assms dom_char cod_char by auto abbreviation \ where "\ f \ \Chn = \

\<^sub>0[C.cod (Leg1 (Dom f)), Leg1 (Dom f)], Dom = Dom (L f), Cod = Cod f\" interpretation \: transformation_by_components vcomp vcomp L map \ proof have *: "\f. ide f \ arrow_of_spans C (\ f)" proof - fix f assume f: "ide f" interpret f: identity_arrow_of_spans C f using f ide_char' by auto interpret \f: arrow_of_spans C \\ f\ proof show Dom: "C.span (Leg0 (Dom (\ f))) (Leg1 (Dom (\ f)))" using f by (simp add: arrow_of_spans_hcomp arrow_of_spans.axioms(2) span_in_category.is_span) interpret Dom: span_in_category C \Dom (\ f)\ using Dom by (unfold_locales, auto) show Cod: "C.span (Leg0 (Cod (\ f))) (Leg1 (Cod (\ f)))" using f hcomp_def trg_def src_def ide_mkObj C.pullback_commutes by force interpret Cod: span_in_category C \Cod (\ f)\ using Cod by (unfold_locales, auto) show "\Chn (\ f) : Dom.apex \\<^sub>C Cod.apex\" proof - have "C.dom Dom.leg0 = C.cod f.dom.leg1 \\ f.dom.leg1" proof - have "arr (trg f)" using f by simp hence "Dom (\ f) = \Leg0 = f.dom.leg0 \ \

\<^sub>0[C.cod f.dom.leg1, f.dom.leg1], Leg1 = C.cod f.dom.leg1 \ \

\<^sub>1[C.cod f.dom.leg1, f.dom.leg1]\" using f src_def trg_def hcomp_def by simp thus ?thesis using f Dom hcomp_def by auto qed thus ?thesis using f ide_char Dom.apex_def Cod.apex_def by simp qed show "Cod.leg0 \ Chn (\ f) = Dom.leg0" using f ide_char hcomp_def src_def trg_def C.comp_arr_ide ide_mkObj by simp show "Cod.leg1 \ Chn (\ f) = Dom.leg1" using f ide_char hcomp_def src_def trg_def C.pullback_commutes ide_mkObj C.comp_arr_ide by (simp add: C.commutative_square_def) qed show "arrow_of_spans C (\ f)" .. qed show 0: "\f. ide f \ \\ f : L f \ map f\" proof - fix f assume f: "ide f" interpret f: identity_arrow_of_spans C f using f ide_char' by auto interpret \f: arrow_of_spans C \\ f\ using f * by blast show "\\ f : L f \ map f\" proof show 1: "arr (\ f)" using f * arr_char by blast show "dom (\ f) = L f" using f 1 dom_char ideD(2) by auto show "cod (\ f) = map f" using f 1 cod_char ideD(3) by auto qed qed show "\\. arr \ \ \ (cod \) \ L \ = map \ \ \ (dom \)" proof - fix \ assume \: "arr \" interpret \: arrow_of_spans C \ using \ arr_char by auto interpret \_dom_\: arrow_of_spans C \\ (dom \)\ using \ * [of "dom \"] by fastforce interpret \_cod_\: arrow_of_spans C \\ (cod \)\ using \ * [of "cod \"] by fastforce interpret L\: arrow_of_spans C \L \\ using \ arr_char by blast show "\ (cod \) \ L \ = map \ \ \ (dom \)" proof (intro arr_eqI) show par: "par (\ (cod \) \ L \) (map \ \ \ (dom \))" using \ 0 [of "dom \"] 0 [of "cod \"] by fastforce show "Chn (\ (cod \) \ L \) = Chn (map \ \ \ (dom \))" proof - have "Chn (\ (cod \) \ L \) = \

\<^sub>0[\.dtrg, \.cod.leg1] \ \\

\<^sub>1[\.dtrg, \.dom.leg1] \\.dtrg, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dtrg, \.dom.leg1]\" proof - have "Chn (\ (cod \) \ L \) = \

\<^sub>0[\.dtrg, \.cod.leg1] \ Chn (trg \ \ \)" - proof - - have "Dom (trg \ \ cod \) = Cod (trg \ \ \)" - using \ seq_char by fastforce - moreover have "\

\<^sub>0[C.cod (Leg1 (Dom (cod \))), Leg1 (Dom (cod \))] \ - Chn (trg \ \ \) = - \

\<^sub>0[\.dtrg, \.cod.leg1] \ Chn (trg \ \ \)" - by (simp add: \ cod_char) - moreover have "arrow_of_spans (\) - \Chn = \

\<^sub>0[C.cod (Leg1 (Dom (cod \))), Leg1 (Dom (cod \))], - Dom = Cod (trg \ \ \), Cod = Cod (cod \)\" - using \ par seq_char by auto - ultimately show ?thesis - using \ vcomp_def L\.arrow_of_spans_axioms by auto - qed + using Chn_vcomp \ cod_char par by force moreover have "Chn (trg \ \ \) = \\

\<^sub>1[\.dtrg, \.dom.leg1] \\.dtrg, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dtrg, \.dom.leg1]\" using \ hcomp_def chine_hcomp_trg_arr by simp ultimately show ?thesis using \ by (auto simp add: cod_char) qed also have "... = \.chine \ \

\<^sub>0[C.cod \.dom.leg1, \.dom.leg1]" using \ C.in_homE C.pullback_commutes [of "C.cod \.dom.leg1" "\.dom.leg1"] C.comp_reduce ide_char C.prj_tuple(1) by auto also have "... = Chn (map \ \ \ (dom \))" using \ par seq_char dom_char vcomp_eq map_simp by simp finally show ?thesis by blast qed qed qed qed interpretation \: natural_isomorphism vcomp vcomp L map \.map proof fix f assume f: "ide f" show "iso (\.map f)" proof - interpret f: identity_arrow_of_spans C f using f ide_char' by auto have 1: "\.map f = \Chn = \

\<^sub>0[f.dtrg, f.leg1], Dom = Dom (trg f \ f), Cod = Dom f\" using f ide_char cod_char by simp interpret \f: arrow_of_spans C \\.map f\ using f arr_char \.preserves_reflects_arr by fastforce let ?\f' = "\Chn = \f.leg1 \f.dtrg, f.leg1\ C.dom f.leg1\, Dom = Dom f, Cod = Dom (trg f \ f)\" have 2: "C.inverse_arrows \f.chine (Chn ?\f')" using 1 C.pullback_arr_cod(2) [of "f.leg1"] by simp interpret \f': arrow_of_spans C ?\f' proof show Dom: "C.span (Leg0 (Dom ?\f')) (Leg1 (Dom ?\f'))" using f 1 by auto interpret Dom: span_in_category C \Dom ?\f'\ using Dom by (unfold_locales, auto) show Cod: "C.span (Leg0 (Cod ?\f')) (Leg1 (Cod ?\f'))" using f 1 \f.dom.is_span by auto interpret Cod: span_in_category C \Cod ?\f'\ using Cod by (unfold_locales, auto) show "\Chn ?\f' : Dom.apex \\<^sub>C Cod.apex\" using f src_def trg_def hcomp_def ide_mkObj Cod.apex_def Dom.apex_def C.comp_arr_dom C.comp_cod_arr by auto show "Cod.leg0 \ Chn ?\f' = Dom.leg0" using 2 \f.leg0_commutes C.invert_side_of_triangle by (metis (no_types, lifting) "1" C.inverse_unique C.isoI \f.dom.is_span arrow_of_spans_data.select_convs(2) arrow_of_spans_data.select_convs(3)) show "Cod.leg1 \ Chn ?\f' = Dom.leg1" using 2 \f.leg1_commutes C.invert_side_of_triangle by (metis (no_types, lifting) "1" C.inverse_unique C.isoI \f.dom.is_span arrow_of_spans_data.select_convs(2) arrow_of_spans_data.select_convs(3)) qed have "inverse_arrows (\.map f) ?\f'" proof show "ide (?\f' \ \.map f)" proof - have "?\f' \ \.map f = dom (\.map f)" proof - have "?\f' \ \.map f = \Chn = f.dtrg \\ f.leg1, Dom = Dom (\.map f), Cod = Dom (\.map f)\" using f 1 2 f.arrow_of_spans_axioms \f.arrow_of_spans_axioms \f'.arrow_of_spans_axioms vcomp_def ide_char arr_char by (simp add: vcomp_def C.comp_inv_arr) also have "... = dom (\.map f)" - proof - - have "C.cod f.dom.leg1 \\ f.dom.leg1 = C.dom (Leg1 (Dom (hcomp (trg f) f)))" - using f f.arrow_of_spans_axioms hcomp_def src_def trg_def ide_mkObj - by auto - thus ?thesis - using 1 f.arrow_of_spans_axioms arr_char dom_char \f.dom.is_span - \f.arrow_of_spans_axioms \f'.cod.apex_def - by auto - qed + by (metis (no_types, lifting) "1" C.pbdom_def \f.chine_simps(2) + \.preserves_reflects_arr arrow_of_spans_data.select_convs(1) + dom_char f ideD(1)) finally show ?thesis by blast qed thus ?thesis using \f.arrow_of_spans_axioms arr_char by simp qed show "ide (\.map f \ ?\f')" proof - have "\.map f \ ?\f' = dom ?\f'" proof - have "\.map f \ ?\f' = \Chn = Chn f, Dom = Dom ?\f', Cod = Dom ?\f'\" using f 1 2 f.arrow_of_spans_axioms \f.arrow_of_spans_axioms \f'.arrow_of_spans_axioms vcomp_def ide_char arr_char by fastforce also have "... = dom ?\f'" using 1 \f'.arrow_of_spans_axioms arr_char dom_char by simp finally show ?thesis by blast qed thus ?thesis using \f'.arrow_of_spans_axioms arr_char by simp qed qed thus ?thesis by auto qed qed lemma \_is_natural_isomorphism: shows "natural_isomorphism vcomp vcomp L map \.map" .. sublocale L: equivalence_functor vcomp vcomp L using L.isomorphic_to_identity_is_equivalence \.natural_isomorphism_axioms by simp lemma equivalence_functor_L: shows "equivalence_functor vcomp vcomp L" .. abbreviation \ where "\ f \ \Chn = \

\<^sub>1[Leg0 (Dom f), C.cod (Leg0 (Dom f))], Dom = Dom (R f), Cod = Cod f\" interpretation \: transformation_by_components vcomp vcomp R map \ proof have *: "\f. ide f \ arrow_of_spans C (\ f)" proof - fix f assume f: "ide f" interpret f: identity_arrow_of_spans C f using f ide_char' by auto interpret \f: arrow_of_spans C \\ f\ proof show Dom: "C.span (Leg0 (Dom (\ f))) (Leg1 (Dom (\ f)))" using f by (simp add: arrow_of_spans_hcomp arrow_of_spans.axioms(2) span_in_category.is_span) interpret Dom: span_in_category C \Dom (\ f)\ using Dom by (unfold_locales, auto) show Cod: "C.span (Leg0 (Cod (\ f))) (Leg1 (Cod (\ f)))" using f hcomp_def trg_def src_def ide_mkObj C.pullback_commutes by force interpret Cod: span_in_category C \Cod (\ f)\ using Cod by (unfold_locales, auto) show "\Chn (\ f) : Dom.apex \\<^sub>C Cod.apex\" proof - have "C.dom Dom.leg0 = f.dom.leg0 \\ C.cod f.dom.leg0" proof - have "arr (src f)" using f by simp hence "Dom (\ f) = \Leg0 = C.cod f.dom.leg0 \ \

\<^sub>0[f.dom.leg0, C.cod f.dom.leg0], Leg1 = f.dom.leg1 \ \

\<^sub>1[f.dom.leg0, C.cod f.dom.leg0]\" using f src_def trg_def by (simp add: hcomp_def) thus ?thesis using f ide_char Dom.apex_def Cod.apex_def by simp qed thus ?thesis using f ide_char Dom.apex_def Cod.apex_def by simp qed show "Cod.leg0 \ Chn (\ f) = Dom.leg0" using f ide_char hcomp_def src_def trg_def C.pullback_commutes ide_mkObj C.comp_arr_ide by (simp add: C.commutative_square_def) show "Cod.leg1 \ Chn (\ f) = Dom.leg1" using f ide_char hcomp_def src_def trg_def ide_mkObj C.comp_arr_ide by (simp add: C.commutative_square_def) qed show "arrow_of_spans C (\ f)" .. qed show 0: "\f. ide f \ \\ f : R f \ map f\" proof - fix f assume f: "ide f" interpret f: identity_arrow_of_spans C f using f ide_char' by auto interpret \f: arrow_of_spans C \\ f\ using f * by blast show "\\ f : R f \ map f\" proof show 1: "arr (\ f)" using f * arr_char by blast show "dom (\ f) = R f" using f 1 dom_char ideD(2) by auto show "cod (\ f) = map f" using f 1 cod_char ideD(3) by auto qed qed show "\\. arr \ \ \ (cod \) \ R \ = map \ \ \ (dom \)" proof - fix \ assume \: "arr \" interpret \: arrow_of_spans C \ using \ arr_char by auto interpret \_dom_\: arrow_of_spans C \\ (dom \)\ using \ * [of "dom \"] by fastforce interpret \_cod_\: arrow_of_spans C \\ (cod \)\ using \ * [of "cod \"] by fastforce interpret R\: arrow_of_spans C \R \\ using \ arr_char by blast show "\ (cod \) \ R \ = map \ \ \ (dom \)" proof (intro arr_eqI) show par: "par (\ (cod \) \ R \) (map \ \ \ (dom \))" using \ 0 [of "dom \"] 0 [of "cod \"] by force show "Chn (\ (cod \) \ R \) = Chn (map \ \ \ (dom \))" proof - have "Chn (\ (cod \) \ R \) = \

\<^sub>1[\.cod.leg0, \.cod.src] \ \\.chine \ \

\<^sub>1[\.dom.leg0, \.dsrc] \\.cod.leg0, \.cod.src\ \

\<^sub>0[\.dom.leg0, \.dsrc]\" proof - have "Chn (\ (cod \) \ R \) = \

\<^sub>1[\.cod.leg0, \.cod.src] \ Chn (\ \ src \)" - proof - - have "Dom (cod \ \ src \) = Cod (\ \ src \)" - using \ seq_char by fastforce - moreover have "\

\<^sub>1[Leg0 (Dom (cod \)), C.cod (Leg0 (Dom (cod \)))] \ - Chn (\ \ src \) = - \

\<^sub>1[\.cod.leg0, \.dsrc] \ Chn (\ \ src \)" - by (simp add: \ cod_char) - moreover have "arrow_of_spans (\) - \Chn = \

\<^sub>1[Leg0 (Dom (cod \)), C.cod (Leg0 (Dom (cod \)))], - Dom = Cod (\ \ src \), Cod = Cod (cod \)\" - using \ par seq_char by auto - ultimately show ?thesis - using \ vcomp_def R\.arrow_of_spans_axioms by auto - qed + using Chn_vcomp \ cod_char par by force moreover have "Chn (\ \ src \) = \\.chine \ \

\<^sub>1[\.dom.leg0, \.dsrc] \\.cod.leg0, \.dsrc\ \

\<^sub>0[\.dom.leg0, \.dsrc]\" using \ hcomp_def chine_hcomp_arr_src by simp ultimately show ?thesis using \ by (auto simp add: cod_char) qed also have "... = \.chine \ \

\<^sub>1[\.dom.leg0, C.cod \.dom.leg0]" using \ ide_char C.prj_tuple(2) C.in_homE C.pullback_commutes [of "\.dom.leg0" "C.cod \.dom.leg0"] C.comp_reduce by auto also have "... = Chn (map \ \ \ (dom \))" using \ par seq_char dom_char vcomp_eq map_simp by simp finally show ?thesis by blast qed qed qed qed interpretation \: natural_isomorphism vcomp vcomp R map \.map proof fix f assume f: "ide f" show "iso (\.map f)" proof - interpret f: identity_arrow_of_spans C f using f ide_char' by auto have 1: "\.map f = \Chn = \

\<^sub>1[f.leg0, f.dsrc], Dom = Dom (f \ src f), Cod = Dom f\" using f ide_char by auto interpret \f: arrow_of_spans C \\.map f\ using f arr_char \.preserves_reflects_arr by fastforce let ?\f' = "\Chn = \C.dom f.leg0 \f.leg0, f.dsrc\ f.leg0\, Dom = Dom f, Cod = Dom (f \ src f)\" have 2: "C.inverse_arrows (Chn (\.map f)) (Chn ?\f')" using 1 C.pullback_arr_cod(1) [of "f.dom.leg0"] by simp interpret \f': arrow_of_spans C ?\f' proof show Dom: "C.span (Leg0 (Dom ?\f')) (Leg1 (Dom ?\f'))" using f 1 by auto interpret Dom: span_in_category C \Dom ?\f'\ using Dom by (unfold_locales, auto) show Cod: "C.span (Leg0 (Cod ?\f')) (Leg1 (Cod ?\f'))" using f 1 \f.dom.is_span by auto interpret Cod: span_in_category C \Cod ?\f'\ using Cod by (unfold_locales, auto) show "\Chn ?\f' : Dom.apex \\<^sub>C Cod.apex\" using f src_def trg_def hcomp_def ide_mkObj Cod.apex_def Dom.apex_def C.comp_arr_dom C.comp_cod_arr by auto show "Cod.leg0 \ Chn ?\f' = Dom.leg0" using 2 \f.leg0_commutes C.invert_side_of_triangle by (metis (no_types, lifting) "1" C.inverse_unique C.isoI \f.dom.is_span arrow_of_spans_data.select_convs(2) arrow_of_spans_data.select_convs(3)) show "Cod.leg1 \ Chn ?\f' = Dom.leg1" using 2 \f.leg1_commutes C.invert_side_of_triangle by (metis (no_types, lifting) "1" C.inverse_unique C.isoI \f.dom.is_span arrow_of_spans_data.select_convs(2) arrow_of_spans_data.select_convs(3)) qed have "inverse_arrows (\.map f) ?\f'" proof show "ide (?\f' \ \.map f)" - proof - - have "?\f' \ \.map f = dom (\.map f)" - proof - - have "?\f' \ \.map f = - \Chn = f.leg0 \\ f.dsrc, Dom = Dom (\.map f), Cod = Dom (\.map f)\" - using f 1 2 f.arrow_of_spans_axioms - \f.arrow_of_spans_axioms \f'.arrow_of_spans_axioms - vcomp_def ide_char arr_char C.comp_inv_arr - by (simp add: vcomp_def) - also have "... = dom (\.map f)" - proof - - have "C.dom (Leg0 (Dom (f \ src f))) = C.dom (Leg1 (Dom (f \ src f)))" - using f f.arrow_of_spans_axioms hcomp_def src_def trg_def ide_mkObj - by auto - thus ?thesis - using 1 f.arrow_of_spans_axioms arr_char dom_char \f.dom.is_span - \f.arrow_of_spans_axioms \f'.cod.apex_def \f.chine_simps(2) - by auto - qed - finally show ?thesis by blast - qed - thus ?thesis - using \f.arrow_of_spans_axioms arr_char by simp - qed + using "2" C.comp_inv_arr \f'.arrow_of_spans_axioms \f.arrow_of_spans_axioms + \f.chine_simps(2) dom_char f ideD(2) vcomp_def + by force show "ide (\.map f \ ?\f')" proof - have "\.map f \ ?\f' = dom ?\f'" proof - have "\.map f \ ?\f' = \Chn = Chn f, Dom = Dom ?\f', Cod = Dom ?\f'\" using f 1 2 f.arrow_of_spans_axioms \f.arrow_of_spans_axioms \f'.arrow_of_spans_axioms vcomp_def ide_char arr_char by fastforce also have "... = dom ?\f'" using 1 \f'.arrow_of_spans_axioms arr_char dom_char by simp finally show ?thesis by blast qed thus ?thesis using \f'.arrow_of_spans_axioms arr_char by simp qed qed thus ?thesis by auto qed qed lemma \_is_natural_isomorphism: shows "natural_isomorphism vcomp vcomp R map \.map" .. sublocale R: equivalence_functor vcomp vcomp R using R.isomorphic_to_identity_is_equivalence \.natural_isomorphism_axioms by simp lemma equivalence_functor_R: shows "equivalence_functor vcomp vcomp R" .. definition unit ("\[_]") where "\[a] \ \Chn = \

\<^sub>0[Chn a, Chn a], Dom = Dom (a \ a), Cod = Cod a\" lemma unit_in_hom [intro]: assumes "obj a" shows "in_hhom \[a] a a" and "\\[a] : a \ a \ a\" proof - show "\\[a] : a \ a \ a\" proof (intro in_homI) interpret a: identity_arrow_of_spans C a using assms obj_char ide_char' by auto have 0: "src a = trg a" using assms arr_char obj_char src_def trg_def by (elim objE, auto) interpret aa: arrow_of_spans C \a \ a\ using assms 0 a.arrow_of_spans_axioms arrow_of_spans_hcomp by auto interpret aa: identity_arrow_of_spans C \a \ a\ proof have "ide (a \ a)" using assms 0 obj_char H.preserves_ide by simp thus "C.ide aa.chine" using ide_char by auto qed have 1: "\\

\<^sub>0[a.chine, a.chine] : a.chine \\ a.chine \\<^sub>C a.chine\ \ \\

\<^sub>1[a.chine, a.chine] : a.chine \\ a.chine \\<^sub>C a.chine\" by auto have 2: "a.dom.leg0 = a.chine \ a.dom.leg1 = a.chine \ a.cod.leg0 = a.chine \ a.cod.leg1 = a.chine" using assms obj_char by (cases a, simp_all) have 3: "a \ a = \Chn = a.chine \\ a.chine, Dom = \Leg0 = \

\<^sub>0[a.chine, a.chine], Leg1 = \

\<^sub>1[a.chine, a.chine]\, Cod = \Leg0 = \

\<^sub>0[a.chine, a.chine], Leg1 = \

\<^sub>1[a.chine, a.chine]\\" using assms 0 1 2 chine_hcomp_ide_ide hcomp_def C.comp_cod_arr a.identity_arrow_of_spans_axioms ide_char' by auto have "aa.apex = a.chine \\ a.chine" using 3 aa.chine_eq_apex by auto interpret \a: arrow_of_spans C \\[a]\ proof have 4: "Dom \[a] = Dom (a \ a)" using assms hcomp_def unit_def by simp have 5: "Cod \[a] = Cod a" using assms unit_def by simp show Dom: "C.span (Leg0 (Dom \[a])) (Leg1 (Dom \[a]))" using 4 by simp interpret Dom: span_in_category C \Dom \[a]\ using Dom by (unfold_locales, auto) show Cod: "C.span (Leg0 (Cod \[a])) (Leg1 (Cod \[a]))" using 5 by simp interpret Cod: span_in_category C \Cod \[a]\ using Cod by (unfold_locales, auto) show "\Chn \[a] : Dom.apex \\<^sub>C Cod.apex\" - proof - - have "\Chn \[a] : a.chine \\ a.chine \\<^sub>C C.dom a.chine\" - using assms obj_char ide_char unit_def by simp - moreover have "C.dom (Leg0 (Dom \[a])) = Chn a \\ Chn a" - using assms 3 unit_def obj_char ide_char by simp - moreover have "C.dom a.chine = C.dom Cod.leg0" - using unit_def by auto - ultimately show ?thesis by simp - qed + by (simp add: \aa.apex = a.chine \\ a.chine\ unit_def) show "Cod.leg0 \ Chn \[a] = Dom.leg0" unfolding unit_def using 1 2 3 C.comp_cod_arr by auto show "Cod.leg1 \ Chn \[a] = Dom.leg1" unfolding unit_def using 1 2 3 C.comp_cod_arr C.pullback_ide_self by auto qed show "arr \[a]" using \a.arrow_of_spans_axioms arr_char by simp show "dom \[a] = hcomp a a" using 3 unit_def \a.arrow_of_spans_axioms arr_char dom_char \a.dom.apex_def by auto show "cod \[a] = a" using assms 3 obj_char arr_char dom_char cod_char unit_def \a.arrow_of_spans_axioms by auto qed thus "in_hhom \[a] a a" using assms by (metis arrI in_hhom_def objE vconn_implies_hpar(1) vconn_implies_hpar(2-4)) qed lemma unit_simps [simp]: assumes "obj a" shows "src \[a] = a" and "trg \[a] = a" and "dom \[a] = hcomp a a" and "cod \[a] = a" using assms unit_in_hom by auto lemma iso_unit: assumes "obj a" shows "iso \[a]" proof - have "Chn \[a] = \

\<^sub>0[Chn a, Chn a]" unfolding unit_def by simp moreover have "C.iso \

\<^sub>0[Chn a, Chn a]" using assms C.ide_is_iso C.iso_is_arr C.iso_pullback_ide ide_char by blast ultimately show ?thesis using assms unit_in_hom iso_char by auto qed end locale two_composable_arrows_of_spans = span_bicategory + \: arrow_of_spans C \ + \: arrow_of_spans C \ for \ (structure) and \ (structure) + assumes composable: "src \ = trg \" begin lemma are_arrows [simp]: shows "arr \" and "arr \" using arr_char \.arrow_of_spans_axioms \.arrow_of_spans_axioms by auto lemma legs_form_cospan: shows "C.cospan \.dom.leg0 \.dom.leg1" and "C.cospan \.cod.leg0 \.cod.leg1" using composable src_def trg_def by auto interpretation \\: arrow_of_spans C \\ \ \\ using arrow_of_spans_hcomp composable by auto lemma composite_is_arrow [simp]: shows "arr (\ \ \)" using \\.arrow_of_spans_axioms arr_char by auto lemma composite_in_hom [intro]: shows "\\ \ \ : dom \ \ dom \ \ cod \ \ cod \\" using composable by auto lemma composite_simps [simp]: shows "src (\ \ \) = src \" and "trg (\ \ \) = trg \" and "dom (\ \ \) = dom \ \ dom \" and "cod (\ \ \) = cod \ \ cod \" by (simp_all add: composable) lemma chine_composite: shows "Chn (\ \ \) = \\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\.cod.leg0, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\" unfolding hcomp_def chine_hcomp_def using composable by simp lemma chine_composite_in_hom [intro]: shows "\Chn (\ \ \) : \.dom.leg0 \\ \.dom.leg1 \\<^sub>C \.cod.leg0 \\ \.cod.leg1\" using hcomp_def chine_hcomp_props(1) composable by auto end sublocale two_composable_arrows_of_spans \ arrow_of_spans C \\ \ \\ proof - interpret Dom\_Dom\: composite_span C prj0 prj1 \Dom \\ \Dom \\ using legs_form_cospan(1) by (unfold_locales, auto) interpret Cod\_Cod\: composite_span C prj0 prj1 \Cod \\ \Cod \\ using legs_form_cospan(1) by (unfold_locales, auto) interpret Dom_\\: span_in_category C \Dom (\ \ \)\ apply unfold_locales apply (unfold hcomp_def) using Dom\_Dom\.apex_def Dom\_Dom\.leg_simps(1) are_arrows(1) composable by auto interpret Cod_\\: span_in_category C \Cod (\ \ \)\ apply unfold_locales apply (unfold hcomp_def) using Cod\_Cod\.apex_def Cod\_Cod\.leg_simps(1) are_arrows(1) composable by auto show "arrow_of_spans C (\ \ \)" proof show "\Chn (hcomp \ \) : Dom_\\.apex \\<^sub>C Cod_\\.apex\" unfolding hcomp_def using are_arrows(1) are_arrows(2) arrow_of_spans_hcomp composable hcomp_def arrow_of_spans.chine_in_hom Cod\_Cod\.leg_simps(4) Dom\_Dom\.leg_simps(3) Dom\_Dom\.leg_simps(4) chine_composite_in_hom by auto show "Cod_\\.leg0 \ Chn (hcomp \ \) = Dom_\\.leg0" proof (unfold hcomp_def) have "arrow_of_spans C \Chn = chine_hcomp \ \, Dom = Dom\_Dom\.this, Cod = Cod\_Cod\.this\" using arrow_of_spans_hcomp composable hcomp_def by auto thus "Leg0 (Cod (if arr \ \ arr \ \ src \ = trg \ then \Chn = chine_hcomp \ \, Dom = Dom\_Dom\.this, Cod = Cod\_Cod\.this\ else null)) \ Chn (if arr \ \ arr \ \ src \ = trg \ then \Chn = chine_hcomp \ \, Dom = Dom\_Dom\.this, Cod = Cod\_Cod\.this\ else null) = Leg0 (Dom (if arr \ \ arr \ \ src \ = trg \ then \Chn = chine_hcomp \ \, Dom = Dom\_Dom\.this, Cod = Cod\_Cod\.this\ else null))" using arrow_of_spans.leg0_commutes composable by fastforce qed show "Cod_\\.leg1 \ Chn (hcomp \ \) = Dom_\\.leg1" proof (unfold hcomp_def) have "arrow_of_spans C \Chn = chine_hcomp \ \, Dom = Dom\_Dom\.this, Cod = Cod\_Cod\.this\" using arrow_of_spans_hcomp composable hcomp_def by force thus "Leg1 (Cod (if arr \ \ arr \ \ src \ = trg \ then \Chn = chine_hcomp \ \, Dom = Dom\_Dom\.this, Cod = Cod\_Cod\.this\ else null)) \ Chn (if arr \ \ arr \ \ src \ = trg \ then \Chn = chine_hcomp \ \, Dom = Dom\_Dom\.this, Cod = Cod\_Cod\.this\ else null) = Leg1 (Dom (if arr \ \ arr \ \ src \ = trg \ then \Chn = chine_hcomp \ \, Dom = Dom\_Dom\.this, Cod = Cod\_Cod\.this\ else null))" using arrow_of_spans.leg1_commutes composable by force qed qed qed locale two_composable_identity_arrows_of_spans = two_composable_arrows_of_spans + \: identity_arrow_of_spans C \ + \: identity_arrow_of_spans C \ begin lemma are_identities [simp]: shows "ide \" and "ide \" using ide_char \.arrow_of_spans_axioms \.arrow_of_spans_axioms by auto interpretation H: "functor" VV.comp vcomp \\\\. fst \\ \ snd \\\ using hcomp_is_functor by auto interpretation \\: identity_arrow_of_spans C \\ \ \\ - proof - have "VV.ide (\, \)" - using VV.ide_char composable by auto - hence "ide (hcomp \ \)" - using H.preserves_ide [of "(\, \)"] by simp - thus "C.ide chine" - using ide_char by simp - qed + using are_identities(1-2) composable ide_char' by blast lemma ide_composite [simp]: shows "ide (\ \ \)" using \\.identity_arrow_of_spans_axioms arrow_of_spans_axioms ide_char by auto lemma apex_composite: shows "\\.apex = \.leg0 \\ \.leg1" using dom.apex_def hcomp_def chine_hcomp_ide_ide composable legs_form_cospan by simp lemma leg0_composite: shows "\\.leg0 = \.leg0 \ \

\<^sub>0[\.leg0, \.leg1]" using dom.apex_def hcomp_def composable legs_form_cospan by simp lemma leg1_composite: shows "\\.leg1 = \.leg1 \ \

\<^sub>1[\.leg0, \.leg1]" using dom.apex_def hcomp_def composable legs_form_cospan by simp lemma chine_composite: shows "Chn (\ \ \) = \.leg0 \\ \.leg1" unfolding hcomp_def using chine_hcomp_ide_ide composable by simp abbreviation prj\<^sub>0 where "prj\<^sub>0 \ \

\<^sub>0[\.leg0, \.leg1]" abbreviation prj\<^sub>1 where "prj\<^sub>1 \ \

\<^sub>1[\.leg0, \.leg1]" lemma prj_in_hom [intro]: shows "\prj\<^sub>1 : \.leg0 \\ \.leg1 \\<^sub>C \.apex\" and "\prj\<^sub>0 : \.leg0 \\ \.leg1 \\<^sub>C \.apex\" using legs_form_cospan by auto lemma prj_simps [simp]: shows "C.arr prj\<^sub>1" and "C.dom prj\<^sub>1 = \.leg0 \\ \.leg1" and "C.cod prj\<^sub>1 = \.apex" and "C.arr prj\<^sub>0" and "C.dom prj\<^sub>0 = \.leg0 \\ \.leg1" and "C.cod prj\<^sub>0 = \.apex" using prj_in_hom by auto sublocale identity_arrow_of_spans C \\ \ \\ using apex_composite dom.ide_apex chine_composite by (unfold_locales, auto) end locale three_composable_arrows_of_spans = span_bicategory + \: arrow_of_spans C \ + \: arrow_of_spans C \ + \: arrow_of_spans C \ + \\: two_composable_arrows_of_spans C prj0 prj1 \ \ + \\: two_composable_arrows_of_spans C prj0 prj1 \ \ for \ (structure) and \ (structure) and \ (structure) begin interpretation \\\: arrow_of_spans C \\ \ \ \ \\ using \.arrow_of_spans_axioms \\.arrow_of_spans_axioms arrow_of_spans_hcomp arr_char \\.composable \\.composable by force interpretation \\_\: arrow_of_spans C \(\ \ \) \ \\ using \\.arrow_of_spans_axioms \.arrow_of_spans_axioms arrow_of_spans_hcomp arr_char \\.composable \\.composable by force lemma composites_are_arrows [simp]: shows "arr (\ \ \ \ \)" and "arr ((\ \ \) \ \)" using \\\.arrow_of_spans_axioms \\_\.arrow_of_spans_axioms arr_char by auto lemma composite_in_hom [intro]: shows "\\ \ \ \ \ : dom \ \ dom \ \ dom \ \ cod \ \ cod \ \ cod \\" and "\(\ \ \) \ \ : (dom \ \ dom \) \ dom \ \ (cod \ \ cod \) \ cod \\" using \\.composable \\.composable by auto lemma composite_simps [simp]: shows "src (\ \ \ \ \) = src \" and "src ((\ \ \) \ \) = src \" and "trg (\ \ \ \ \) = trg \" and "trg ((\ \ \) \ \) = trg \" and "dom (\ \ \ \ \) = dom \ \ dom \ \ dom \" and "dom ((\ \ \) \ \) = (dom \ \ dom \) \ dom \" and "cod (\ \ \ \ \) = cod \ \ cod \ \ cod \" and "cod ((\ \ \) \ \) = (cod \ \ cod \) \ cod \" by (auto simp add: \\.composable \\.composable) lemma chine_composite: shows "\\\.chine = \\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]] \\.cod.leg0, \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\ \\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\.cod.leg0, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\ \ \

\<^sub>0[\.dom.leg0, \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]]\" and "\\_\.chine = \\\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\.cod.leg0, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\ \ \

\<^sub>1[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1] \\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1]\" proof - show "\\\.chine = \\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]] \\.cod.leg0, \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\ \\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\.cod.leg0, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\ \ \

\<^sub>0[\.dom.leg0, \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]]\" unfolding hcomp_def chine_hcomp_def \\.composable \\.composable using trg_def \\.are_arrows(1-2) \\.composable \\.composite_is_arrow \\.composite_simps(2) hcomp_def by (simp add: chine_hcomp_def) show "\\_\.chine = \\\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\.cod.leg0, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\ \ \

\<^sub>1[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1] \\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1]\" unfolding hcomp_def chine_hcomp_def \\.composable \\.composable using src_def \\.are_arrows(1-2) \\.composable \\.composite_is_arrow \\.composite_simps(1) hcomp_def \\.composable by (simp add: chine_hcomp_def) qed end locale three_composable_identity_arrows_of_spans = three_composable_arrows_of_spans + \: identity_arrow_of_spans C \ + \: identity_arrow_of_spans C \ + \: identity_arrow_of_spans C \ + \\: two_composable_identity_arrows_of_spans C prj0 prj1 \ \ + \\: two_composable_identity_arrows_of_spans C prj0 prj1 \ \ begin lemma composites_are_identities [simp]: shows "ide (\ \ \ \ \)" and "ide ((\ \ \) \ \)" - proof - - interpret \_H\\: two_composable_identity_arrows_of_spans C prj0 prj1 \ \\ \ \\ - using \\.composable \\.composable - by (unfold_locales, simp) - show "ide (\ \ \ \ \)" - by auto - interpret H\\_\: two_composable_identity_arrows_of_spans C prj0 prj1 \\ \ \\ \ - using \\.composable \\.composable - by (unfold_locales, simp) - show "ide ((\ \ \) \ \)" - by auto - qed + by (auto simp add: \\.composable \\.composable) interpretation \\\: identity_arrow_of_spans C \\ \ \ \ \\ using composites_are_identities ide_char' by auto interpretation \\_\: identity_arrow_of_spans C \(\ \ \) \ \\ using composites_are_identities ide_char' by auto abbreviation Prj\<^sub>1\<^sub>1 where "Prj\<^sub>1\<^sub>1 \ \

\<^sub>1[\.leg0, \.leg1] \ \

\<^sub>1[\.leg0 \ \

\<^sub>0[\.leg0, \.leg1], \.leg1]" abbreviation Prj\<^sub>0\<^sub>1 where "Prj\<^sub>0\<^sub>1 \ \

\<^sub>0[\.leg0, \.leg1] \ \

\<^sub>1[\.leg0 \ \

\<^sub>0[\.leg0, \.leg1], \.leg1]" abbreviation Prj\<^sub>0 where "Prj\<^sub>0 \ \

\<^sub>0[\.leg0 \ \

\<^sub>0[\.leg0, \.leg1], \.leg1]" abbreviation Prj\<^sub>1 where "Prj\<^sub>1 \ \

\<^sub>1[\.leg0, \.leg1 \ \

\<^sub>1[\.leg0, \.leg1]]" abbreviation Prj\<^sub>1\<^sub>0 where "Prj\<^sub>1\<^sub>0 \ \

\<^sub>1[\.leg0, \.leg1] \ \

\<^sub>0[\.leg0, \.leg1 \ \

\<^sub>1[\.leg0, \.leg1]]" abbreviation Prj\<^sub>0\<^sub>0 where "Prj\<^sub>0\<^sub>0 \ \

\<^sub>0[\.leg0, \.leg1] \ \

\<^sub>0[\.leg0, \.leg1 \ \

\<^sub>1[\.leg0, \.leg1]]" lemma leg0_composite: shows "\\\.leg0 = \.leg0 \ Prj\<^sub>0\<^sub>0" and "\\_\.leg0 = \.leg0 \ Prj\<^sub>0" proof - show "\\\.leg0 = \.leg0 \ Prj\<^sub>0\<^sub>0" using hcomp_def \\.composable \\.composite_is_arrow \\.composite_simps(2) C.comp_assoc by auto show "\\_\.leg0 = \.leg0 \ Prj\<^sub>0" using hcomp_def \\.composite_is_arrow \\.composite_simps(1) \\.composable by auto qed lemma leg1_composite: shows "\\\.leg1 = \.leg1 \ Prj\<^sub>1" and "\\_\.leg1 = \.leg1 \ Prj\<^sub>1\<^sub>1" proof - show "\\\.leg1 = \.leg1 \ Prj\<^sub>1" using hcomp_def \\.composable \\.composite_is_arrow \\.composite_simps(2) by auto show "\\_\.leg1 = \.leg1 \ Prj\<^sub>1\<^sub>1" using hcomp_def \\.composite_is_arrow \\.composite_simps(1) \\.composable C.comp_assoc by auto qed definition chine_assoc where "chine_assoc \ \Prj\<^sub>1\<^sub>1 \\.leg0, \.leg1 \ \

\<^sub>1[\.leg0, \.leg1]\ \Prj\<^sub>0\<^sub>1 \\.leg0, \.leg1\ Prj\<^sub>0\\" definition chine_assoc' where "chine_assoc' \ \\Prj\<^sub>1 \\.leg0, \.leg1\ Prj\<^sub>1\<^sub>0\ \\.leg0 \ \

\<^sub>0[\.leg0, \.leg1], \.leg1\ Prj\<^sub>0\<^sub>0\" (* * Don't be fooled by how short the following proofs look -- there's a heck of a lot * going on behind the scenes here! *) lemma chine_composite: shows "\\_\.chine = \.leg0 \ \\.prj\<^sub>0 \\ \.leg1" and "\\\.chine = \.leg0 \\ \.leg1 \ \\.prj\<^sub>1" proof - show "\\_\.chine = \.leg0 \ \\.prj\<^sub>0 \\ \.leg1" using hcomp_def chine_hcomp_arr_ide [of "hcomp \ \" \] chine_hcomp_ide_ide src_def trg_def \\.composable \\.composable \\.ide_composite \\.are_identities \\.are_identities(2) by simp show "\\\.chine = \.leg0 \\ \.leg1 \ \\.prj\<^sub>1" using hcomp_def chine_hcomp_ide_arr [of \ "hcomp \ \"] chine_hcomp_ide_ide src_def trg_def \\.composable \\.composable \\.ide_composite \\.are_identities \\.are_identities(2) by simp qed lemma prj_in_hom [intro]: shows "\Prj\<^sub>1\<^sub>1 : \\_\.chine \\<^sub>C \.apex\" and "\Prj\<^sub>0\<^sub>1 : \\_\.chine \\<^sub>C \.apex\" and "\Prj\<^sub>0 : \\_\.chine \\<^sub>C \.apex\" and "\Prj\<^sub>1 : \\\.chine \\<^sub>C \.apex\" and "\Prj\<^sub>1\<^sub>0 : \\\.chine \\<^sub>C \.apex\" and "\Prj\<^sub>0\<^sub>0 : \\\.chine \\<^sub>C \.apex\" using \\.composable \\.composable src_def trg_def chine_composite by auto lemma prj_simps [simp]: shows "C.arr Prj\<^sub>1\<^sub>1" and "C.arr Prj\<^sub>0\<^sub>1" and "C.arr Prj\<^sub>0" and "C.dom Prj\<^sub>1\<^sub>1 = \\_\.chine" and "C.dom Prj\<^sub>0\<^sub>1 = \\_\.chine" and "C.dom Prj\<^sub>0 = \\_\.chine" and "C.cod Prj\<^sub>1\<^sub>1 = \.apex" and "C.cod Prj\<^sub>0\<^sub>1 = \.apex" and "C.cod Prj\<^sub>0 = \.apex" and "C.arr Prj\<^sub>1" and "C.arr Prj\<^sub>1\<^sub>0" and "C.arr Prj\<^sub>0\<^sub>0" and "C.dom Prj\<^sub>1 = \\\.chine" and "C.dom Prj\<^sub>1\<^sub>0 = \\\.chine" and "C.dom Prj\<^sub>0\<^sub>0 = \\\.chine" and "C.cod Prj\<^sub>1 = \.apex" and "C.cod Prj\<^sub>1\<^sub>0 = \.apex" and "C.cod Prj\<^sub>0\<^sub>0 = \.apex" using prj_in_hom by auto lemma chine_assoc_props: shows "\chine_assoc : \\_\.chine \\<^sub>C \\\.chine\" and "Prj\<^sub>1 \ chine_assoc = Prj\<^sub>1\<^sub>1" and "Prj\<^sub>1\<^sub>0 \ chine_assoc = Prj\<^sub>0\<^sub>1" and "Prj\<^sub>0\<^sub>0 \ chine_assoc = Prj\<^sub>0" proof - have 1: "\.leg0 \ Prj\<^sub>0\<^sub>1 = \.leg1 \ Prj\<^sub>0" using \\.are_identities \\.are_identities \\.composable \\.composable src_def trg_def C.pullback_commutes [of "\.leg0 \ \

\<^sub>0[\.leg0, \.leg1]" \.leg1] C.comp_assoc by auto have 2: "\.leg0 \ Prj\<^sub>1\<^sub>1 = \.leg1 \ Prj\<^sub>0\<^sub>1" - proof - - have "\.leg0 \ Prj\<^sub>1\<^sub>1 = (\.leg0 \ \\.prj\<^sub>1) \ \

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1]" - using C.comp_assoc by auto - also have "... = \.leg1 \ Prj\<^sub>0\<^sub>1" - using \\.are_identities \\.are_identities \\.composable \\.composable src_def trg_def - C.pullback_commutes - by (auto simp add: C.commutative_square_def C.comp_assoc) - finally show ?thesis by simp - qed + by (metis C.comp_assoc C.pullback_commutes' \\.legs_form_cospan(1)) show "\chine_assoc : \\_\.chine \\<^sub>C \\\.chine\" unfolding chine_assoc_def using \\.are_identities \\.are_identities \\.composable \\.composable 1 2 src_def trg_def chine_composite C.comp_assoc by auto show "Prj\<^sub>1 \ chine_assoc = Prj\<^sub>1\<^sub>1" unfolding chine_assoc_def using \\.are_identities \\.are_identities \\.composable \\.composable 1 2 src_def trg_def C.comp_assoc by auto show "Prj\<^sub>1\<^sub>0 \ chine_assoc = Prj\<^sub>0\<^sub>1" unfolding chine_assoc_def using \\.are_identities \\.are_identities \\.composable \\.composable 1 2 src_def trg_def C.comp_assoc by auto show "Prj\<^sub>0\<^sub>0 \ chine_assoc = Prj\<^sub>0" unfolding chine_assoc_def using \\.are_identities \\.are_identities \\.composable \\.composable 1 2 src_def trg_def C.comp_assoc by auto qed lemma chine_assoc_in_hom [intro]: shows "\chine_assoc : \\_\.chine \\<^sub>C \\\.chine\" using chine_assoc_props(1) by simp lemma prj_chine_assoc [simp]: shows "Prj\<^sub>1 \ chine_assoc = Prj\<^sub>1\<^sub>1" and "Prj\<^sub>1\<^sub>0 \ chine_assoc = Prj\<^sub>0\<^sub>1" and "Prj\<^sub>0\<^sub>0 \ chine_assoc = Prj\<^sub>0" using chine_assoc_props(2-4) by auto lemma chine_assoc'_props: shows "\chine_assoc' : \\\.chine \\<^sub>C \\_\.chine\" and "Prj\<^sub>1\<^sub>1 \ chine_assoc' = Prj\<^sub>1" and "Prj\<^sub>0\<^sub>1 \ chine_assoc' = Prj\<^sub>1\<^sub>0" and "Prj\<^sub>0 \ chine_assoc' = Prj\<^sub>0\<^sub>0" proof - have 1: "\.leg0 \ Prj\<^sub>1 = \.leg1 \ Prj\<^sub>1\<^sub>0" using \\.are_identities \\.are_identities \\.composable \\.composable src_def trg_def C.pullback_commutes [of \.leg0 "\.leg1 \ \

\<^sub>1[\.leg0, \.leg1]"] C.comp_assoc by auto have 2: "\.leg0 \ Prj\<^sub>1\<^sub>0 = \.leg1 \ Prj\<^sub>0\<^sub>0" - proof - - have "\.leg0 \ Prj\<^sub>1\<^sub>0 = (\.leg0 \ \\.prj\<^sub>1) \ \

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1]" - using C.comp_assoc by simp - also have "... = \.leg1 \ Prj\<^sub>0\<^sub>0" - using \\.are_identities \\.are_identities \\.composable \\.composable src_def trg_def - C.pullback_commutes - by (auto simp add: C.commutative_square_def C.comp_assoc) - finally show ?thesis by auto - qed + by (metis C.comp_assoc C.pullback_commutes' \\.legs_form_cospan(1)) show "\chine_assoc' : \\\.chine \\<^sub>C \\_\.chine\" unfolding chine_assoc'_def using \\.are_identities \\.are_identities \\.composable \\.composable 1 2 src_def trg_def chine_composite C.comp_assoc by auto show "Prj\<^sub>1\<^sub>1 \ chine_assoc' = Prj\<^sub>1" unfolding chine_assoc'_def using \\.are_identities \\.are_identities \\.composable \\.composable 1 2 src_def trg_def C.comp_assoc by auto show "Prj\<^sub>0\<^sub>1 \ chine_assoc' = Prj\<^sub>1\<^sub>0" unfolding chine_assoc'_def using \\.are_identities \\.are_identities \\.composable \\.composable 1 2 src_def trg_def C.comp_assoc by auto show "Prj\<^sub>0 \ chine_assoc' = Prj\<^sub>0\<^sub>0" unfolding chine_assoc'_def using \\.are_identities \\.are_identities \\.composable \\.composable 1 2 src_def trg_def C.comp_assoc by auto qed lemma chine_assoc'_in_hom [intro]: shows "\chine_assoc' : \\\.chine \\<^sub>C \\_\.chine\" using chine_assoc'_props(1) by simp lemma prj_chine_assoc' [simp]: shows "Prj\<^sub>1\<^sub>1 \ chine_assoc' = Prj\<^sub>1" and "Prj\<^sub>0\<^sub>1 \ chine_assoc' = Prj\<^sub>1\<^sub>0" and "Prj\<^sub>0 \ chine_assoc' = Prj\<^sub>0\<^sub>0" using chine_assoc'_props(2-4) by auto lemma prj_joint_monic: assumes "\h: a \\<^sub>C \\_\.chine\" and "\h': a \\<^sub>C \\_\.chine\" and "Prj\<^sub>1\<^sub>1 \ h = Prj\<^sub>1\<^sub>1 \ h'" and "Prj\<^sub>0\<^sub>1 \ h = Prj\<^sub>0\<^sub>1 \ h'" and "Prj\<^sub>0 \ h = Prj\<^sub>0 \ h'" shows "h = h'" proof - have "\

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1] \ h = \

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1] \ h'" proof - have "\\.prj\<^sub>0 \ \

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1] \ h = \\.prj\<^sub>0 \ \

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1] \ h'" using assms \\.composable \\.composable src_def trg_def chine_composite(1) C.comp_assoc by force moreover have "\\.prj\<^sub>1 \ \

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1] \ h = \\.prj\<^sub>1 \ \

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1] \ h'" using assms \\.composable \\.composable src_def trg_def chine_composite(1) C.comp_assoc by force ultimately show ?thesis using assms \\.composable \\.composable src_def trg_def chine_composite(1) cod_char C.prj_joint_monic [of \.leg0 \.leg1 "\

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1] \ h" "\

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \.leg1] \ h'"] by auto qed moreover have "Prj\<^sub>0 \ h = Prj\<^sub>0 \ h'" using assms cod_char by simp ultimately show ?thesis using assms \\.composable \\.composable src_def trg_def chine_composite(1) cod_char C.prj_joint_monic [of "\.leg0 \ \\.prj\<^sub>0" \.leg1 h h'] by auto qed lemma prj'_joint_monic: assumes "\h: a \\<^sub>C \\\.chine\" and "\h': a \\<^sub>C \\\.chine\" and "Prj\<^sub>1 \ h = Prj\<^sub>1 \ h'" and "Prj\<^sub>1\<^sub>0 \ h = Prj\<^sub>1\<^sub>0 \ h'" and "Prj\<^sub>0\<^sub>0 \ h = Prj\<^sub>0\<^sub>0 \ h'" shows "h = h'" proof - have "\

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1] \ h = \

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1] \ h'" proof - have "\\.prj\<^sub>0 \ \

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1] \ h = \\.prj\<^sub>0 \ \

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1] \ h'" using assms \\.composable \\.composable src_def trg_def chine_composite(2) C.comp_assoc by force moreover have "\\.prj\<^sub>1 \ \

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1] \ h = \\.prj\<^sub>1 \ \

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1] \ h'" using assms \\.composable \\.composable src_def trg_def chine_composite(2) C.comp_assoc by force ultimately show ?thesis using assms \\.composable \\.composable src_def trg_def chine_composite(2) cod_char C.prj_joint_monic [of \.leg0 \.leg1 "\

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1] \ h" "\

\<^sub>0[\.leg0, \.leg1 \ \\.prj\<^sub>1] \ h'"] by auto qed moreover have "Prj\<^sub>1 \ h = Prj\<^sub>1 \ h'" using assms cod_char by simp ultimately show ?thesis using assms \\.composable \\.composable src_def trg_def chine_composite(2) C.prj_joint_monic [of \.leg0 "\.leg1 \ \\.prj\<^sub>1" h h'] by auto qed lemma chine_assoc_inverse: shows "C.inverse_arrows chine_assoc chine_assoc'" proof show "C.ide (chine_assoc' \ chine_assoc)" proof - have 1: "C.ide \\_\.chine" using chine_assoc_props(1) C.ide_dom by fastforce have "chine_assoc' \ chine_assoc = \\_\.chine" proof - have 2: "C.seq chine_assoc' chine_assoc" using chine_assoc_props(1) chine_assoc'_props(1) by auto have 3: "C.seq Prj\<^sub>1\<^sub>1 chine_assoc' \ C.seq Prj\<^sub>0\<^sub>1 chine_assoc' \ C.seq Prj\<^sub>0 chine_assoc'" using prj_in_hom chine_assoc'_props(1) by auto have "Prj\<^sub>1\<^sub>1 \ chine_assoc' \ chine_assoc = Prj\<^sub>1\<^sub>1 \ \\_\.chine" proof - have "Prj\<^sub>1\<^sub>1 \ chine_assoc' \ chine_assoc = (Prj\<^sub>1\<^sub>1 \ chine_assoc') \ chine_assoc" using C.comp_assoc by metis thus ?thesis using 1 C.comp_arr_dom by simp qed moreover have "Prj\<^sub>0\<^sub>1 \ chine_assoc' \ chine_assoc = Prj\<^sub>0\<^sub>1 \ \\_\.chine" proof - have "Prj\<^sub>0\<^sub>1 \ chine_assoc' \ chine_assoc = (Prj\<^sub>0\<^sub>1 \ chine_assoc') \ chine_assoc" using C.comp_assoc by metis thus ?thesis using 1 C.comp_arr_dom by simp qed moreover have "Prj\<^sub>0 \ chine_assoc' \ chine_assoc = Prj\<^sub>0 \ \\_\.chine" proof - have "Prj\<^sub>0 \ chine_assoc' \ chine_assoc = (Prj\<^sub>0 \ chine_assoc') \ chine_assoc" using C.comp_assoc by metis thus ?thesis using 1 C.comp_arr_dom C.comp_arr_ide prj_in_hom(3) by auto qed moreover have "\\\_\.chine : \\_\.chine \\<^sub>C \\_\.chine\" using chine_assoc_props(1) C.ide_dom [of chine_assoc] by (elim C.in_homE, auto) ultimately show ?thesis using chine_assoc_props(1) chine_assoc'_props(1) prj_joint_monic [of "chine_assoc' \ chine_assoc" "\\_\.chine" "\\_\.chine"] by auto qed thus ?thesis using 1 by simp qed show "C.ide (chine_assoc \ chine_assoc')" proof - have 1: "C.ide \\\.chine" using chine_assoc_props(1) C.ide_cod by fastforce have "chine_assoc \ chine_assoc' = \\\.chine" proof - have 2: "C.seq chine_assoc chine_assoc'" using chine_assoc_props(1) chine_assoc'_props(1) by auto have 3: "C.seq Prj\<^sub>1 chine_assoc \ C.seq Prj\<^sub>1\<^sub>0 chine_assoc \ C.seq Prj\<^sub>0\<^sub>0 chine_assoc" using prj_in_hom chine_assoc_props(1) by auto have "Prj\<^sub>1 \ chine_assoc \ chine_assoc' = Prj\<^sub>1 \ \\\.chine" proof - have "Prj\<^sub>1 \ chine_assoc \ chine_assoc' = (Prj\<^sub>1 \ chine_assoc) \ chine_assoc'" using C.comp_assoc by metis thus ?thesis using 1 C.comp_arr_dom prj_in_hom(4) by auto qed moreover have "Prj\<^sub>1\<^sub>0 \ chine_assoc \ chine_assoc' = Prj\<^sub>1\<^sub>0 \ \\\.chine" proof - have "Prj\<^sub>1\<^sub>0 \ chine_assoc \ chine_assoc' = (Prj\<^sub>1\<^sub>0 \ chine_assoc) \ chine_assoc'" using C.comp_assoc by metis thus ?thesis using 1 C.comp_arr_dom by simp qed moreover have "Prj\<^sub>0\<^sub>0 \ chine_assoc \ chine_assoc' = Prj\<^sub>0\<^sub>0 \ \\\.chine" proof - have "Prj\<^sub>0\<^sub>0 \ chine_assoc \ chine_assoc' = (Prj\<^sub>0\<^sub>0 \ chine_assoc) \ chine_assoc'" using C.comp_assoc by metis thus ?thesis using 1 C.comp_arr_dom by simp qed moreover have "\\\\.chine : \\\.chine \\<^sub>C \\\.chine\" using chine_assoc'_props(1) C.ide_dom [of chine_assoc'] by (elim C.in_homE, auto) ultimately show ?thesis using chine_assoc_props(1) chine_assoc'_props(1) prj'_joint_monic [of "chine_assoc \ chine_assoc'" "\\\.chine" "\\\.chine"] by auto qed thus ?thesis using 1 by simp qed qed end context three_composable_arrows_of_spans begin interpretation V: category vcomp using is_category by auto interpretation H: horizontal_homs vcomp src trg using has_horizontal_homs by auto interpretation dom_\: arrow_of_spans C \dom \\ using \.arrow_of_spans_axioms arr_char [of "dom \"] by auto interpretation dom_\: arrow_of_spans C \dom \\ using \.arrow_of_spans_axioms arr_char [of "dom \"] by auto interpretation dom_\: arrow_of_spans C \dom \\ using \.arrow_of_spans_axioms arr_char [of "dom \"] by auto interpretation doms: three_composable_identity_arrows_of_spans C prj0 prj1 \dom \\ \dom \\ \dom \\ using \\.composable \\.composable ide_char [of "dom \"] ide_char [of "dom \"] ide_char [of "dom \"] by (unfold_locales, auto) interpretation cod_\: arrow_of_spans C \cod \\ using \.arrow_of_spans_axioms arr_char [of "cod \"] by auto interpretation cod_\: arrow_of_spans C \cod \\ using \.arrow_of_spans_axioms arr_char [of "cod \"] by auto interpretation cod_\: arrow_of_spans C \cod \\ using \.arrow_of_spans_axioms arr_char [of "cod \"] by auto interpretation cods: three_composable_identity_arrows_of_spans C prj0 prj1 \cod \\ \cod \\ \cod \\ using \\.composable \\.composable ide_char [of "cod \"] ide_char [of "cod \"] ide_char [of "cod \"] by (unfold_locales, auto) interpretation \\\: arrow_of_spans C \\ \ \ \ \\ using \.arrow_of_spans_axioms \\.arrow_of_spans_axioms arrow_of_spans_hcomp arr_char \\.composable \\.composable by force interpretation \\_\: arrow_of_spans C \(\ \ \) \ \\ using \\.arrow_of_spans_axioms \.arrow_of_spans_axioms arrow_of_spans_hcomp arr_char \\.composable \\.composable by force lemma chine_composite': shows "\\\.chine = \\.chine \ doms.Prj\<^sub>1 \\.cod.leg0, \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\ \\.chine \ doms.Prj\<^sub>1\<^sub>0 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>0\\" and "\\_\.chine = \\\.chine \ doms.Prj\<^sub>1\<^sub>1 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>1\ \\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\" proof - show "\\_\.chine = \\\.chine \ doms.Prj\<^sub>1\<^sub>1 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>1\ \\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\" proof - have "arr (\ \ \)" by simp thus ?thesis unfolding hcomp_def chine_hcomp_def dom_char using \\.composable \\.composable src_def trg_def dom_char chine_hcomp_props C.comp_tuple_arr C.pullback_commutes C.comp_assoc by auto qed show "\\\.chine = \\.chine \ doms.Prj\<^sub>1 \\.cod.leg0, \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\ \\.chine \ doms.Prj\<^sub>1\<^sub>0 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>0\\" proof - have "arr (\ \ \)" by simp thus ?thesis unfolding hcomp_def chine_hcomp_def dom_char using \\.composable \\.composable src_def trg_def dom_char chine_hcomp_props C.comp_tuple_arr C.pullback_commutes C.comp_assoc by auto qed qed lemma chine_composite_in_hom [intro]: shows "\\\_\.chine : Chn ((dom \ \ dom \) \ dom \) \\<^sub>C Chn ((cod \ \ cod \) \ cod \)\" and "\\\\.chine : Chn (dom \ \ dom \ \ dom \) \\<^sub>C Chn (cod \ \ cod \ \ cod \)\" - proof - - interpret \\: arrow_of_spans C \\ \ \\ - using arrow_of_spans_hcomp \\.composable by auto - interpret \\: arrow_of_spans C \\ \ \\ - using arrow_of_spans_hcomp \\.composable by auto - show "\\\_\.chine : Chn ((dom \ \ dom \) \ dom \) \\<^sub>C Chn ((cod \ \ cod \) \ cod \)\" - proof - - have "\\\_\.chine : \\.dom.leg0 \\ \.dom.leg1 \\<^sub>C \\.cod.leg0 \\ \.cod.leg1\" - proof - - have "src (\ \ \) = trg \" - using \\.composable \\.composable by simp - moreover have "arr (\ \ \)" - using \\.arrow_of_spans_axioms by auto - ultimately show ?thesis - using hcomp_def chine_hcomp_props(1) [of \ "\ \ \"] by auto - qed - hence "\\\_\.chine : \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1] \\ \.dom.leg1 \\<^sub>C - \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1] \\ \.cod.leg1\" - unfolding hcomp_def using \\.composable \\.composable by simp - thus ?thesis - using doms.chine_composite(1) cods.chine_composite(1) dom_char cod_char - by auto - qed - show "\\\\.chine : Chn (dom \ \ dom \ \ dom \) \\<^sub>C Chn (cod \ \ cod \ \ cod \)\" - proof - - have "\\\\.chine : \.dom.leg0 \\ \\.dom.leg1 \\<^sub>C \.cod.leg0 \\ \\.cod.leg1\" - proof - - have "src \ = trg (\ \ \)" - using trg_hcomp \\.composable \\.composable by simp - moreover have "arr (\ \ \)" - using \\.arrow_of_spans_axioms by auto - ultimately show ?thesis - using hcomp_def chine_hcomp_props(1) [of "\ \ \" \] by auto - qed - hence "\\\\.chine : \.dom.leg0 \\ \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\<^sub>C - \.cod.leg0 \\ \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\" - unfolding hcomp_def \\.composable \\.composable by simp - thus ?thesis - using doms.chine_composite(2) cods.chine_composite(2) dom_char cod_char - by auto - qed - qed + using Chn_in_hom by auto lemma cospan_\\: shows "C.cospan \.dom.leg0 \.dom.leg1" using \\.legs_form_cospan by simp lemma cospan_\\: shows "C.cospan \.dom.leg0 \.dom.leg1" using \\.legs_form_cospan by simp lemma commutativities: shows "\.cod.leg0 \ \.chine \ doms.Prj\<^sub>1\<^sub>1 = \.cod.leg1 \ \.chine \ doms.Prj\<^sub>0\<^sub>1" and "\.cod.leg1 \ \.chine \ doms.Prj\<^sub>0 = (\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1]) \ \\.chine \ doms.Prj\<^sub>1\<^sub>1 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>1\" proof - have AB: "\.dom.leg0 \ doms.Prj\<^sub>1\<^sub>1 = \.dom.leg1 \ doms.Prj\<^sub>0\<^sub>1" proof - have "\.dom.leg0 \ doms.Prj\<^sub>1\<^sub>1 = (\.dom.leg0 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]) \ \

\<^sub>1[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1]" using \\.composable \\.composable src_def trg_def dom_char C.comp_assoc by simp also have "... = (\.dom.leg1 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]) \ \

\<^sub>1[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1]" using C.pullback_commutes' \\.legs_form_cospan by auto also have "... = \.dom.leg1 \ doms.Prj\<^sub>0\<^sub>1" using \\.composable \\.composable src_def trg_def dom_char C.comp_assoc by simp finally show ?thesis by auto qed have BC: "\.dom.leg0 \ doms.Prj\<^sub>0\<^sub>1 = \.dom.leg1 \ doms.Prj\<^sub>0" proof - have "\.dom.leg0 \ doms.Prj\<^sub>0\<^sub>1 = (\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]) \ \

\<^sub>1[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1]" using \\.composable \\.composable src_def trg_def dom_char C.comp_assoc by simp also have "... = \.dom.leg1 \ doms.Prj\<^sub>0" using C.pullback_commutes' dom_char cod_char \\.legs_form_cospan \\.legs_form_cospan by auto finally show ?thesis by simp qed show 1: "\.cod.leg0 \ \.chine \ doms.Prj\<^sub>1\<^sub>1 = \.cod.leg1 \ \.chine \ doms.Prj\<^sub>0\<^sub>1" using AB C.comp_assoc [of \.cod.leg0 \.chine] C.comp_assoc [of \.cod.leg1 \.chine doms.Prj\<^sub>0\<^sub>1] by simp show "\.cod.leg1 \ \.chine \ doms.Prj\<^sub>0 = (\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1]) \ \\.chine \ doms.Prj\<^sub>1\<^sub>1 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>1\" proof - have "(\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1]) \ \\.chine \ doms.Prj\<^sub>1\<^sub>1 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>1\ = \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1] \ \\.chine \ doms.Prj\<^sub>1\<^sub>1 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>1\" using 1 \\.composable \\.composable src_def trg_def dom_char C.comp_assoc by simp also have "... = \.cod.leg0 \ \.chine \ doms.Prj\<^sub>0\<^sub>1" using 1 dom_char \\.composable \\.composable src_def trg_def by simp also have "... = (\.cod.leg0 \ \.chine) \ doms.Prj\<^sub>0\<^sub>1" using C.comp_assoc [of \.cod.leg0 \.chine doms.Prj\<^sub>0\<^sub>1] by simp also have "... = (\.cod.leg1 \ \.chine) \ doms.Prj\<^sub>0" using BC by simp also have "... = \.cod.leg1 \ \.chine \ doms.Prj\<^sub>0" using C.comp_assoc by blast finally show ?thesis by simp qed qed lemma prj_chine_composite: shows "cods.Prj\<^sub>1\<^sub>1 \ \\_\.chine = \.chine \ doms.Prj\<^sub>1\<^sub>1" and "cods.Prj\<^sub>0\<^sub>1 \ \\_\.chine = \.chine \ doms.Prj\<^sub>0\<^sub>1" and "cods.Prj\<^sub>0 \ \\_\.chine = \.chine \ doms.Prj\<^sub>0" using \\.composable \\.composable src_def trg_def dom_char cod_char commutativities chine_composite' C.comp_assoc by auto lemma commutativities': shows "\.cod.leg0 \ \.chine \ doms.Prj\<^sub>1\<^sub>0 = \.cod.leg1 \ \.chine \ doms.Prj\<^sub>0\<^sub>0" and "\.cod.leg0 \ \.chine \ doms.Prj\<^sub>1 = (\.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]) \ \\.chine \ doms.Prj\<^sub>1\<^sub>0 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>0\" proof - have AB: "\.dom.leg0 \ doms.Prj\<^sub>1 = \.dom.leg1 \ doms.Prj\<^sub>1\<^sub>0" using C.pullback_commutes' dom_char cod_char \\.legs_form_cospan \\.legs_form_cospan C.comp_assoc by auto have BC: "\.dom.leg0 \ doms.Prj\<^sub>1\<^sub>0 = \.dom.leg1 \ doms.Prj\<^sub>0\<^sub>0" proof - have "\.dom.leg0 \ doms.Prj\<^sub>1\<^sub>0 = (\.dom.leg0 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]) \ \

\<^sub>0[\.dom.leg0, \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]]" using dom_char \\.legs_form_cospan \\.legs_form_cospan C.comp_assoc by simp also have "... = \.dom.leg1 \ doms.Prj\<^sub>0\<^sub>0" using C.pullback_commutes' dom_char \\.legs_form_cospan \\.legs_form_cospan C.comp_assoc by simp finally show ?thesis by auto qed show 1: "\.cod.leg0 \ \.chine \ doms.Prj\<^sub>1\<^sub>0 = \.cod.leg1 \ \.chine \ doms.Prj\<^sub>0\<^sub>0" using BC C.comp_assoc [of \.cod.leg0 \.chine doms.Prj\<^sub>1\<^sub>0] C.comp_assoc [of \.cod.leg1 \.chine doms.Prj\<^sub>0\<^sub>0] doms.prj_in_hom(5-6) dom_char by force show "\.cod.leg0 \ \.chine \ doms.Prj\<^sub>1 = (\.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]) \ \\.chine \ doms.Prj\<^sub>1\<^sub>0 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>0\" proof - have "(\.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]) \ \\.chine \ doms.Prj\<^sub>1\<^sub>0 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>0\ = \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1] \ \\.chine \ doms.Prj\<^sub>1\<^sub>0 \\.cod.leg0, \.cod.leg1\ \.chine \ doms.Prj\<^sub>0\<^sub>0\" using 1 \\.composable \\.composable src_def trg_def dom_char C.comp_assoc by simp also have "... = \.cod.leg1 \ \.chine \ doms.Prj\<^sub>1\<^sub>0" using 1 dom_char \\.composable \\.composable src_def trg_def by simp also have "... = (\.cod.leg1 \ \.chine) \ doms.Prj\<^sub>1\<^sub>0" using C.comp_assoc [of \.cod.leg1 \.chine doms.Prj\<^sub>1\<^sub>0] by auto also have "... = (\.cod.leg0 \ \.chine) \ doms.Prj\<^sub>1" using AB by simp also have "... = \.cod.leg0 \ \.chine \ doms.Prj\<^sub>1" using C.comp_assoc [of \.cod.leg0 \.chine doms.Prj\<^sub>1] doms.prj_in_hom(4) dom_char by auto finally show ?thesis by simp qed qed lemma prj'_chine_composite: shows "cods.Prj\<^sub>1 \ \\\.chine = \.chine \ doms.Prj\<^sub>1" and "cods.Prj\<^sub>1\<^sub>0 \ \\\.chine = \.chine \ doms.Prj\<^sub>1\<^sub>0" and "cods.Prj\<^sub>0\<^sub>0 \ \\\.chine = \.chine \ doms.Prj\<^sub>0\<^sub>0" using \\.composable \\.composable src_def trg_def dom_char cod_char commutativities' chine_composite' C.comp_assoc by auto lemma chine_assoc_naturality: shows "cods.chine_assoc \ \\_\.chine = \\\.chine \ doms.chine_assoc" proof - have "\cods.chine_assoc \ \\_\.chine : Chn ((dom \ \ dom \) \ dom \) \\<^sub>C Chn (cod \ \ cod \ \ cod \)\" using cods.chine_assoc_props(1) chine_composite_in_hom(1) by blast moreover have "\\\\.chine \ doms.chine_assoc : Chn ((dom \ \ dom \) \ dom \) \\<^sub>C Chn (cod \ \ cod \ \ cod \)\" using doms.chine_assoc_props(1) chine_composite_in_hom(2) by blast moreover have "cods.Prj\<^sub>1 \ cods.chine_assoc \ \\_\.chine = cods.Prj\<^sub>1 \ \\\.chine \ doms.chine_assoc" using C.comp_assoc doms.chine_assoc_props(2) cods.chine_assoc_props(2) prj_chine_composite prj'_chine_composite by metis moreover have "cods.Prj\<^sub>1\<^sub>0 \ cods.chine_assoc \ \\_\.chine = cods.Prj\<^sub>1\<^sub>0 \ \\\.chine \ doms.chine_assoc" using C.comp_assoc doms.chine_assoc_props(3) cods.chine_assoc_props(3) prj_chine_composite prj'_chine_composite by metis moreover have "cods.Prj\<^sub>0\<^sub>0 \ cods.chine_assoc \ \\_\.chine = cods.Prj\<^sub>0\<^sub>0 \ \\\.chine \ doms.chine_assoc" using C.comp_assoc doms.chine_assoc_props(4) cods.chine_assoc_props(4) prj_chine_composite prj'_chine_composite by metis ultimately show ?thesis using cods.prj'_joint_monic by auto qed end context span_bicategory begin abbreviation (input) assoc\<^sub>S\<^sub>B where "assoc\<^sub>S\<^sub>B f g h \ \Chn = three_composable_identity_arrows_of_spans.chine_assoc C prj0 prj1 f g h, Dom = Dom ((f \ g) \ h), Cod = Cod (f \ g \ h)\" abbreviation (input) assoc'\<^sub>S\<^sub>B where "assoc'\<^sub>S\<^sub>B f g h \ \Chn = three_composable_identity_arrows_of_spans.chine_assoc' C prj0 prj1 f g h, Dom = Cod (f \ g \ h), Cod = Dom ((f \ g) \ h)\" lemma assoc_props: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "src (assoc\<^sub>S\<^sub>B f g h) = src h" and "trg (assoc\<^sub>S\<^sub>B f g h) = trg f" and "\assoc\<^sub>S\<^sub>B f g h : (f \ g) \ h \ f \ g \ h\" and "src (assoc'\<^sub>S\<^sub>B f g h) = src h" and "trg (assoc'\<^sub>S\<^sub>B f g h) = trg f" and "\assoc'\<^sub>S\<^sub>B f g h : f \ g \ h \ (f \ g) \ h\" proof - have fgh: "VVV.ide (f, g, h)" using assms VVV.ide_char VV.ide_char VVV.arr_char VV.arr_char by simp interpret f: arrow_of_spans C f using assms arr_char by fastforce interpret g: arrow_of_spans C g using assms arr_char by fastforce interpret h: arrow_of_spans C h using assms arr_char by fastforce interpret fgh: three_composable_arrows_of_spans C prj0 prj1 f g h using assms arr_char by (unfold_locales, auto) interpret fgh: three_composable_identity_arrows_of_spans C prj0 prj1 f g h using assms ide_char by (unfold_locales, auto) interpret HHfgh: arrow_of_spans C \(f \ g) \ h\ using assms fgh.composites_are_arrows arrow_of_spans_hcomp by simp interpret HfHgh: arrow_of_spans C \f \ g \ h\ using assms fgh.composites_are_arrows arrow_of_spans_hcomp by simp interpret assoc_fgh: arrow_of_spans C \assoc\<^sub>S\<^sub>B f g h\ apply unfold_locales apply simp_all apply (metis C.ideD(2) C.ideD(3) HHfgh.chine_simps(2) HfHgh.chine_simps(3) fgh.composites_are_identities(1) fgh.composites_are_identities(2) fgh.chine_assoc_in_hom ide_char) - proof - - have 1: "arr (f \ g)" using fgh.\\.composite_is_arrow by simp - have 2: "arr (g \ h)" using fgh.\\.composite_is_arrow by simp - show "HfHgh.cod.leg0 \ fgh.chine_assoc = HHfgh.dom.leg0" - using 1 2 hcomp_def src_def trg_def fgh.\\.composable fgh.\\.composable - fgh.chine_assoc_props(4) C.comp_assoc - by simp - show "HfHgh.cod.leg1 \ fgh.chine_assoc = HHfgh.dom.leg1" - using 1 2 hcomp_def src_def trg_def fgh.\\.composable fgh.\\.composable - fgh.chine_assoc_props(2) C.comp_assoc - by simp - qed + apply (metis C.comp_assoc fgh.composites_are_identities(1) fgh.leg0_composite(1-2) + fgh.prj_chine_assoc(3) ide_char' identity_arrow_of_spans.cod_simps(2)) + by (metis C.comp_assoc fgh.composites_are_identities(1) fgh.leg1_composite(1-2) + fgh.prj_chine_assoc(1) ide_char' identity_arrow_of_spans.cod_simps(3)) interpret assoc'_fgh: arrow_of_spans C \assoc'\<^sub>S\<^sub>B f g h\ apply unfold_locales apply simp_all apply (metis C.ideD(2) C.ideD(3) HHfgh.chine_simps(2) HfHgh.chine_simps(3) fgh.composites_are_identities(1) fgh.composites_are_identities(2) fgh.chine_assoc'_in_hom ide_char) - proof - - have 1: "arr (f \ g)" using fgh.\\.composite_is_arrow by simp - have 2: "arr (g \ h)" using fgh.\\.composite_is_arrow by simp - show "HHfgh.dom.leg0 \ fgh.chine_assoc' = HfHgh.cod.leg0" - using 1 2 hcomp_def src_def trg_def fgh.\\.composable fgh.\\.composable - C.comp_assoc fgh.chine_assoc'_props(4) - by simp - show "HHfgh.dom.leg1 \ fgh.chine_assoc' = HfHgh.cod.leg1" - using 1 2 hcomp_def src_def trg_def fgh.\\.composable fgh.\\.composable - C.comp_assoc fgh.chine_assoc'_props(2) - by auto - qed + using C.comp_assoc fgh.composites_are_identities(1) fgh.leg0_composite(1-2) + ide_char' identity_arrow_of_spans.cod_simps(2) + apply force + using C.comp_assoc fgh.composites_are_identities(1) fgh.leg1_composite(1-2) + fgh.prj_chine_assoc'(1) ide_char' identity_arrow_of_spans.cod_simps(3) + by force show 1: "\assoc\<^sub>S\<^sub>B f g h : (f \ g) \ h \ f \ g \ h\" proof show 1: "arr (assoc\<^sub>S\<^sub>B f g h)" using assoc_fgh.arrow_of_spans_axioms arr_char by blast show "dom (assoc\<^sub>S\<^sub>B f g h) = (f \ g) \ h" using fgh 1 dom_char fgh.\\.composable fgh.\\.composable ideD(2) by auto show "cod (assoc\<^sub>S\<^sub>B f g h) = f \ g \ h" using fgh 1 HoVH_def cod_char fgh.\\.composable fgh.\\.composable ideD(3) by auto qed show 2: "\assoc'\<^sub>S\<^sub>B f g h : f \ g \ h \ (f \ g) \ h\" proof show 1: "arr (assoc'\<^sub>S\<^sub>B f g h)" using assoc'_fgh.arrow_of_spans_axioms arr_char by blast show "dom (assoc'\<^sub>S\<^sub>B f g h) = f \ g \ h" using fgh 1 dom_char cod_char ideD(3) by auto show "cod (assoc'\<^sub>S\<^sub>B f g h) = (f \ g) \ h" using fgh 1 cod_char dom_char ideD(2) by auto qed show 3: "src (assoc\<^sub>S\<^sub>B f g h) = src h" proof - have 4: "src (assoc\<^sub>S\<^sub>B f g h) = \Chn = assoc_fgh.dsrc, Dom = \Leg0 = assoc_fgh.dsrc, Leg1 = assoc_fgh.dsrc\, Cod = \Leg0 = assoc_fgh.dsrc, Leg1 = assoc_fgh.dsrc\\" unfolding src_def using 1 by auto also have "... = src h" using fgh.composite_simps(2) src_def by auto finally show ?thesis by blast qed show "src (assoc'\<^sub>S\<^sub>B f g h) = src h" proof - have "src (assoc'\<^sub>S\<^sub>B f g h) = \Chn = assoc'_fgh.dsrc, Dom = \Leg0 = assoc'_fgh.dsrc, Leg1 = assoc'_fgh.dsrc\, Cod = \Leg0 = assoc'_fgh.dsrc, Leg1 = assoc'_fgh.dsrc\\" unfolding src_def using 2 by auto also have "... = src h" using 1 3 assoc_fgh.cod_src_eq_dom_src arrI src_def by auto finally show ?thesis by blast qed show 4: "trg (assoc\<^sub>S\<^sub>B f g h) = trg f" proof - have 5: "trg (assoc\<^sub>S\<^sub>B f g h) = \Chn = assoc_fgh.dtrg, Dom = \Leg0 = assoc_fgh.dtrg, Leg1 = assoc_fgh.dtrg\, Cod = \Leg0 = assoc_fgh.dtrg, Leg1 = assoc_fgh.dtrg\\" unfolding trg_def using 1 by auto also have "... = trg f" using fgh.composite_simps(4) trg_def by auto finally show ?thesis by blast qed show "trg (assoc'\<^sub>S\<^sub>B f g h) = trg f" proof - have 5: "trg (assoc'\<^sub>S\<^sub>B f g h) = \Chn = assoc'_fgh.dtrg, Dom = \Leg0 = assoc'_fgh.dtrg, Leg1 = assoc'_fgh.dtrg\, Cod = \Leg0 = assoc'_fgh.dtrg, Leg1 = assoc'_fgh.dtrg\\" unfolding trg_def using 2 by auto also have "... = trg f" using 1 4 assoc_fgh.cod_trg_eq_dom_trg arrI trg_def by auto finally show ?thesis by blast qed qed lemma assoc_in_hom [intro]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\assoc\<^sub>S\<^sub>B f g h : (f \ g) \ h \ f \ g \ h\ " using assms assoc_props by auto lemma assoc'_in_hom [intro]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\assoc'\<^sub>S\<^sub>B f g h : f \ g \ h \ (f \ g) \ h\ " using assms assoc_props by auto lemma assoc_simps [simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "arr (assoc\<^sub>S\<^sub>B f g h)" and "dom (assoc\<^sub>S\<^sub>B f g h) = (f \ g) \ h" and "cod (assoc\<^sub>S\<^sub>B f g h) = f \ g \ h" and "src (assoc\<^sub>S\<^sub>B f g h) = src h" and "trg (assoc\<^sub>S\<^sub>B f g h) = trg f" using assms assoc_props(1-3) by (fast, fast, fast, auto) lemma assoc'_simps [simp]: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "arr (assoc'\<^sub>S\<^sub>B f g h)" and "dom (assoc'\<^sub>S\<^sub>B f g h) = f \ g \ h" and "cod (assoc'\<^sub>S\<^sub>B f g h) = (f \ g) \ h" and "src (assoc'\<^sub>S\<^sub>B f g h) = src h" and "trg (assoc'\<^sub>S\<^sub>B f g h) = trg f" using assms assoc_props(4-6) by (fast, fast, fast, auto) lemma inverse_assoc_assoc': assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "inverse_arrows (assoc\<^sub>S\<^sub>B f g h) (assoc'\<^sub>S\<^sub>B f g h)" proof - interpret f: arrow_of_spans C f using assms arr_char ideD(1) by simp interpret g: arrow_of_spans C g using assms arr_char ideD(1) by simp interpret h: arrow_of_spans C h using assms arr_char ideD(1) by simp interpret fgh: three_composable_arrows_of_spans C prj0 prj1 f g h using assms arr_char by (unfold_locales, auto) interpret fgh: three_composable_identity_arrows_of_spans C prj0 prj1 f g h using assms ide_char - apply unfold_locales - apply blast - apply blast - by blast + by unfold_locales blast+ interpret afgh: arrow_of_spans C \assoc\<^sub>S\<^sub>B f g h\ using assms assoc_props(3) arr_char by blast interpret a'fgh: arrow_of_spans C \assoc'\<^sub>S\<^sub>B f g h\ using assms assoc_props(6) arr_char by blast show ?thesis proof - have "inverse_arrows (assoc\<^sub>S\<^sub>B f g h) \Chn = C.inv (Chn (assoc\<^sub>S\<^sub>B f g h)), Dom = Cod (assoc\<^sub>S\<^sub>B f g h), Cod = Dom (assoc\<^sub>S\<^sub>B f g h)\" using inverse_arrows [of "assoc\<^sub>S\<^sub>B f g h"] afgh.arrow_of_spans_axioms arr_char fgh.chine_assoc_inverse by auto moreover have "C.inv (Chn (assoc\<^sub>S\<^sub>B f g h)) = fgh.chine_assoc'" using fgh.chine_assoc_inverse C.inv_is_inverse C.inverse_arrow_unique by auto ultimately show ?thesis by simp qed qed interpretation \: transformation_by_components VVV.comp vcomp HoHV HoVH \\fgh. assoc\<^sub>S\<^sub>B (fst fgh) (fst (snd fgh)) (snd (snd fgh))\ proof show *: "\fgh. VVV.ide fgh \ \assoc\<^sub>S\<^sub>B (fst fgh) (fst (snd fgh)) (snd (snd fgh)) : HoHV fgh \ HoVH fgh\" proof - fix fgh assume fgh: "VVV.ide fgh" show "\assoc\<^sub>S\<^sub>B (fst fgh) (fst (snd fgh)) (snd (snd fgh)) : HoHV fgh \ HoVH fgh\" unfolding HoHV_def HoVH_def using fgh assoc_in_hom [of "fst fgh" "fst (snd fgh)" "snd (snd fgh)"] VVV.arr_char VVV.ide_char VV.arr_char by simp qed show "\\\\. VVV.arr \\\ \ assoc\<^sub>S\<^sub>B (fst (VVV.cod \\\)) (fst (snd (VVV.cod \\\))) (snd (snd (VVV.cod \\\))) \ HoHV \\\ = HoVH \\\ \ assoc\<^sub>S\<^sub>B (fst (VVV.dom \\\)) (fst (snd (VVV.dom \\\))) (snd (snd (VVV.dom \\\)))" proof - fix \\\ assume \\\: "VVV.arr \\\" interpret \: arrow_of_spans C \fst \\\\ using \\\ VVV.ide_char VVV.arr_char arr_char by auto interpret \: arrow_of_spans C \fst (snd \\\)\ using \\\ VVV.ide_char VVV.arr_char VV.arr_char arr_char by auto interpret \: arrow_of_spans C \snd (snd \\\)\ using \\\ VVV.ide_char VVV.arr_char VV.arr_char arr_char by auto interpret \\\: three_composable_arrows_of_spans C prj0 prj1 \fst \\\\ \fst (snd \\\)\ \snd (snd \\\)\ using \\\ VVV.ide_char VVV.arr_char VV.arr_char arr_char by (unfold_locales, auto) interpret HoHV_\\\: arrow_of_spans C \(fst \\\ \ fst (snd \\\)) \ snd (snd \\\)\ proof - have "arr (HoHV \\\)" using \\\ by simp thus "arrow_of_spans C ((fst \\\ \ fst (snd \\\)) \ snd (snd \\\))" using \\\ HoHV_def arr_char by auto qed interpret HoVH_\\\: arrow_of_spans C \fst \\\ \ fst (snd \\\) \ snd (snd \\\)\ proof - have "arr (HoVH \\\)" using \\\ by simp thus "arrow_of_spans C (fst \\\ \ fst (snd \\\) \ snd (snd \\\))" using \\\ HoVH_def arr_char by auto qed have dom_\\\: "VVV.ide (VVV.dom \\\)" using \\\ VVV.ide_dom by blast interpret dom_\: identity_arrow_of_spans C \fst (VVV.dom \\\)\ using dom_\\\ VVV.ide_char VV.ide_char ide_char' by blast interpret dom_\: identity_arrow_of_spans C \fst (snd (VVV.dom \\\))\ using dom_\\\ VVV.ide_char VV.ide_char ide_char' by blast interpret dom_\: identity_arrow_of_spans C \snd (snd (VVV.dom \\\))\ using dom_\\\ VVV.ide_char VV.ide_char ide_char' by blast interpret dom_\\\: three_composable_identity_arrows_of_spans C prj0 prj1 \fst (VVV.dom \\\)\ \fst (snd (VVV.dom \\\))\ \snd (snd (VVV.dom \\\))\ using dom_\\\ VVV.ide_char VVV.arr_char VV.arr_char by (unfold_locales, auto) interpret assoc_dom_\\\: arrow_of_spans C \assoc\<^sub>S\<^sub>B (fst (VVV.dom \\\)) (fst (snd (VVV.dom \\\))) (snd (snd (VVV.dom \\\)))\ using \\\ VVV.ide_dom * arr_char by fast have cod_\\\: "VVV.ide (VVV.cod \\\)" using \\\ VVV.ide_cod by blast interpret cod_\: identity_arrow_of_spans C \fst (VVV.cod \\\)\ using cod_\\\ VVV.ide_char VV.ide_char ide_char' by blast interpret cod_\: identity_arrow_of_spans C \fst (snd (VVV.cod \\\))\ using cod_\\\ VVV.ide_char VV.ide_char ide_char' by blast interpret cod_\: identity_arrow_of_spans C \snd (snd (VVV.cod \\\))\ using cod_\\\ VVV.ide_char VV.ide_char ide_char' by blast interpret cod_\\\: three_composable_identity_arrows_of_spans C prj0 prj1 \fst (VVV.cod \\\)\ \fst (snd (VVV.cod \\\))\ \snd (snd (VVV.cod \\\))\ using cod_\\\ VVV.ide_char VVV.arr_char VV.arr_char by (unfold_locales, auto) interpret assoc_cod_\\\: arrow_of_spans C \assoc\<^sub>S\<^sub>B (fst (VVV.cod \\\)) (fst (snd (VVV.cod \\\))) (snd (snd (VVV.cod \\\)))\ using \\\ VVV.ide_cod * arr_char by fast have dom_legs: "dom_\.leg0 = \.dom.leg0 \ dom_\.leg0 = \.dom.leg0 \ dom_\.leg0 = \.dom.leg0 \ dom_\.leg1 = \.dom.leg1 \ dom_\.leg1 = \.dom.leg1 \ dom_\.leg1 = \.dom.leg1" using VVV.arr_char VVV.dom_char dom_char \\\.\\.composable \\\.\\.composable by auto have cod_legs: "cod_\.leg0 = \.cod.leg0 \ cod_\.leg0 = \.cod.leg0 \ cod_\.leg0 = \.cod.leg0 \ cod_\.leg1 = \.cod.leg1 \ cod_\.leg1 = \.cod.leg1 \ cod_\.leg1 = \.cod.leg1" using \\\ VVV.cod_char cod_char by auto have Prj\<^sub>1\<^sub>1_dom: "dom_\\\.Prj\<^sub>1\<^sub>1 = \

\<^sub>1[\.dom.leg0, \.dom.leg1] \ \

\<^sub>1[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1]" using dom_legs by argo have Prj\<^sub>1\<^sub>1_cod: "cod_\\\.Prj\<^sub>1\<^sub>1 = \

\<^sub>1[\.cod.leg0, \.cod.leg1] \ \

\<^sub>1[\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], \.cod.leg1]" using cod_legs by argo have Prj\<^sub>0_dom: "dom_\\\.Prj\<^sub>0 = \

\<^sub>0[\.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], \.dom.leg1]" using dom_legs by argo have Prj\<^sub>0_cod: "cod_\\\.Prj\<^sub>0 = \

\<^sub>0[\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], \.cod.leg1]" using cod_legs by argo have Dom: "Dom ((fst (VVV.dom \\\) \ fst (snd (VVV.dom \\\))) \ snd (snd (VVV.dom \\\))) = \Leg0 = \.dom.leg0 \ dom_\\\.Prj\<^sub>0, Leg1 = \.dom.leg1 \ dom_\\\.Prj\<^sub>1\<^sub>1\" - proof - - have "arr (dom (fst \\\) \ dom (fst (snd \\\)))" - using \\\.\\.composable \\\.\\.composable by simp - thus ?thesis - using \\\ hcomp_def dom_legs ide_dom dom_char - apply simp - using \\\.\\.composable \\\.\\.composable src_def trg_def dom_char C.comp_assoc - VVV.dom_simp VV.dom_simp - by auto - qed + using dom_\\\.leg0_composite(2) dom_\\\.leg1_composite(2) dom_legs by auto have Cod: "Cod (fst (VVV.dom \\\) \ fst (snd (VVV.dom \\\)) \ snd (snd (VVV.dom \\\))) = \Leg0 = \.dom.leg0 \ dom_\\\.Prj\<^sub>0\<^sub>0, Leg1 = \.dom.leg1 \ dom_\\\.Prj\<^sub>1\" proof - have "arr (dom (fst (snd \\\)) \ dom (snd (snd \\\)))" using \\\.\\.composable \\\.\\.composable by simp thus ?thesis using \\\ hcomp_def dom_legs ide_dom dom_char apply simp using \\\.\\.composable \\\.\\.composable src_def trg_def dom_char C.comp_assoc VVV.dom_simp VV.dom_simp by auto qed have Dom': "Dom ((fst (VVV.cod \\\) \ fst (snd (VVV.cod \\\))) \ snd (snd (VVV.cod \\\))) = \Leg0 = \.cod.leg0 \ cod_\\\.Prj\<^sub>0, Leg1 = \.cod.leg1 \ cod_\\\.Prj\<^sub>1\<^sub>1\" - proof - - have "arr (cod (fst \\\) \ cod (fst (snd \\\)))" - using \\\.\\.composable \\\.\\.composable by simp - moreover have "\.dsrc = \.dtrg" - using \\\.\\.composable src_def trg_def cod_char by simp - moreover have "\.dsrc = \.dtrg" - using \\\.\\.composable src_def trg_def cod_char by simp - ultimately show ?thesis - using \\\ hcomp_def cod_legs ide_cod cod_char VVV.cod_simp VV.cod_simp - apply simp - using \\\.\\.composable \\\.\\.composable src_def trg_def cod_char C.comp_assoc - by simp - qed + by (simp add: cod_\\\.leg0_composite(2) cod_\\\.leg1_composite(2) cod_legs) have Cod': "Cod (fst (VVV.cod \\\) \ fst (snd (VVV.cod \\\)) \ snd (snd (VVV.cod \\\))) = \Leg0 = \.cod.leg0 \ cod_\\\.Prj\<^sub>0\<^sub>0, Leg1 = \.cod.leg1 \ cod_\\\.Prj\<^sub>1\" proof - have "arr (cod (fst (snd \\\)) \ cod (snd (snd \\\)))" using \\\.\\.composable \\\.\\.composable by simp moreover have "\.dsrc = \.dtrg" using \\\.\\.composable src_def trg_def cod_char by simp ultimately show ?thesis using \\\ hcomp_def cod_legs ide_cod cod_char VVV.cod_simp VV.cod_simp apply simp using \\\.\\.composable \\\.\\.composable src_def trg_def cod_char C.comp_assoc by auto qed have assoc_dom: "assoc\<^sub>S\<^sub>B (fst (VVV.dom \\\)) (fst (snd (VVV.dom \\\))) (snd (snd (VVV.dom \\\))) = \Chn = dom_\\\.chine_assoc, Dom = \Leg0 = \.dom.leg0 \ dom_\\\.Prj\<^sub>0, Leg1 = \.dom.leg1 \ dom_\\\.Prj\<^sub>1\<^sub>1\, Cod = \Leg0 = \.dom.leg0 \ dom_\\\.Prj\<^sub>0\<^sub>0, Leg1 = \.dom.leg1 \ dom_\\\.Prj\<^sub>1\\" using Dom Cod by simp have assoc_cod: "assoc\<^sub>S\<^sub>B (fst (VVV.cod \\\)) (fst (snd (VVV.cod \\\))) (snd (snd (VVV.cod \\\))) = \Chn = cod_\\\.chine_assoc, Dom = \Leg0 = \.cod.leg0 \ cod_\\\.Prj\<^sub>0, Leg1 = \.cod.leg1 \ cod_\\\.Prj\<^sub>1\<^sub>1\, Cod = \Leg0 = \.cod.leg0 \ cod_\\\.Prj\<^sub>0\<^sub>0, Leg1 = \.cod.leg1 \ cod_\\\.Prj\<^sub>1\\" using Dom' Cod' by simp have HoHV_\\\: "HoHV \\\ = \Chn = HoHV_\\\.chine, Dom = \Leg0 = \.dom.leg0 \ dom_\\\.Prj\<^sub>0, Leg1 = \.dom.leg1 \ dom_\\\.Prj\<^sub>1\<^sub>1\, Cod = \Leg0 = \.cod.leg0 \ cod_\\\.Prj\<^sub>0, Leg1 = \.cod.leg1 \ cod_\\\.Prj\<^sub>1\<^sub>1\\" proof - have "arr \Chn = \\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\.cod.leg0, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\, Dom = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\, Cod = \Leg0 = \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], Leg1 = \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\\" unfolding hcomp_def chine_hcomp_def using \\\ hcomp_def dom_legs cod_legs ide_dom ide_cod dom_char cod_char \\\.\\.composable by (metis (no_types, lifting) hseq_char(1) \\\.\\.composite_is_arrow chine_hcomp_def) moreover have "(\.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]) \ \

\<^sub>1[\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], \.cod.leg1] = \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1] \ \

\<^sub>1[\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], \.cod.leg1]" using C.comp_assoc by simp ultimately show ?thesis unfolding HoHV_def hcomp_def chine_hcomp_def using \\\ \\\.\\.composable \\\.\\.composable src_def trg_def dom_legs cod_legs C.comp_assoc by simp qed have HoVH_\\\: "HoVH \\\ = \Chn = HoVH_\\\.chine, Dom = \Leg0 = \.dom.leg0 \ dom_\\\.Prj\<^sub>0\<^sub>0, Leg1 = \.dom.leg1 \ dom_\\\.Prj\<^sub>1\, Cod = \Leg0 = \.cod.leg0 \ cod_\\\.Prj\<^sub>0\<^sub>0, Leg1 = \.cod.leg1 \ cod_\\\.Prj\<^sub>1\\" proof - have "arr \Chn = \\.chine \ \

\<^sub>1[\.dom.leg0, \.dom.leg1] \\.cod.leg0, \.cod.leg1\ \.chine \ \

\<^sub>0[\.dom.leg0, \.dom.leg1]\, Dom = \Leg0 = \.dom.leg0 \ \

\<^sub>0[\.dom.leg0, \.dom.leg1], Leg1 = \.dom.leg1 \ \

\<^sub>1[\.dom.leg0, \.dom.leg1]\, Cod = \Leg0 = \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1], Leg1 = \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]\\" unfolding hcomp_def chine_hcomp_def using \\\ hcomp_def dom_legs cod_legs ide_dom ide_cod dom_char cod_char \\\.\\.composable by (metis (no_types, lifting) hseq_char \\\.\\.composite_is_arrow chine_hcomp_def) moreover have "(\.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1]) \ \

\<^sub>0[\.cod.leg0, \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]] = \.cod.leg0 \ \

\<^sub>0[\.cod.leg0, \.cod.leg1] \ \

\<^sub>0[\.cod.leg0, \.cod.leg1 \ \

\<^sub>1[\.cod.leg0, \.cod.leg1]]" using C.comp_assoc by simp ultimately show ?thesis unfolding HoVH_def hcomp_def chine_hcomp_def using \\\ \\\.\\.composable \\\.\\.composable src_def trg_def dom_legs cod_legs C.comp_assoc by simp qed have "assoc\<^sub>S\<^sub>B (fst (VVV.cod \\\)) (fst (snd (VVV.cod \\\))) (snd (snd (VVV.cod \\\))) \ HoHV \\\ = \Chn = cod_\\\.chine_assoc \ HoHV_\\\.chine, Dom = \Leg0 = \.dom.leg0 \ dom_\\\.Prj\<^sub>0, Leg1 = \.dom.leg1 \ dom_\\\.Prj\<^sub>1\<^sub>1\, Cod = \Leg0 = \.cod.leg0 \ cod_\\\.Prj\<^sub>0\<^sub>0, Leg1 = \.cod.leg1 \ cod_\\\.Prj\<^sub>1\\" proof - have "arr (HoHV \\\)" using \\\ by simp thus ?thesis using vcomp_def HoHV_\\\ HoHV_\\\.arrow_of_spans_axioms assoc_cod_\\\.arrow_of_spans_axioms assoc_cod dom_legs cod_legs arr_char by simp qed moreover have "HoVH \\\ \ assoc\<^sub>S\<^sub>B (fst (VVV.dom \\\)) (fst (snd (VVV.dom \\\))) (snd (snd (VVV.dom \\\))) = \Chn = HoVH_\\\.chine \ dom_\\\.chine_assoc, Dom = \Leg0 = \.dom.leg0 \ dom_\\\.Prj\<^sub>0, Leg1 = \.dom.leg1 \ dom_\\\.Prj\<^sub>1\<^sub>1\, Cod = \Leg0 = \.cod.leg0 \ cod_\\\.Prj\<^sub>0\<^sub>0, Leg1 = \.cod.leg1 \ cod_\\\.Prj\<^sub>1\\" proof - have "arr (HoVH \\\)" using \\\ by simp thus ?thesis using vcomp_def HoVH_\\\ HoVH_\\\.arrow_of_spans_axioms assoc_dom_\\\.arrow_of_spans_axioms assoc_dom dom_legs cod_legs arr_char by simp qed moreover have "cod_\\\.chine_assoc \ HoHV_\\\.chine = HoVH_\\\.chine \ dom_\\\.chine_assoc" using \\\ HoHV_def HoVH_def \\\.chine_assoc_naturality VVV.dom_simp VV.dom_simp VVV.cod_simp VV.cod_simp by simp ultimately show "assoc\<^sub>S\<^sub>B (fst (VVV.cod \\\)) (fst (snd (VVV.cod \\\))) (snd (snd (VVV.cod \\\))) \ HoHV \\\ = HoVH \\\ \ assoc\<^sub>S\<^sub>B (fst (VVV.dom \\\)) (fst (snd (VVV.dom \\\))) (snd (snd (VVV.dom \\\)))" by argo qed qed definition assoc ("\[_, _, _]") where "assoc \ \\ \ \. \.map (\, \, \)" abbreviation (input) \\<^sub>S\<^sub>B where "\\<^sub>S\<^sub>B \ \\\\. assoc (fst \\\) (fst (snd \\\)) (snd (snd \\\))" lemma \_ide: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\\<^sub>S\<^sub>B (f, g, h) = assoc\<^sub>S\<^sub>B f g h" using assms assoc_def \.map_simp_ide VVV.ide_char VVV.arr_char VV.ide_char VV.arr_char by simp lemma natural_transformation_\: shows "natural_transformation VVV.comp vcomp HoHV HoVH \\<^sub>S\<^sub>B" using assoc_def \.natural_transformation_axioms by auto interpretation \: natural_transformation VVV.comp vcomp HoHV HoVH \\<^sub>S\<^sub>B using natural_transformation_\ by simp sublocale \: natural_isomorphism VVV.comp vcomp HoHV HoVH \\<^sub>S\<^sub>B proof show "\fgh. VVV.ide fgh \ iso (\\<^sub>S\<^sub>B fgh)" proof - fix fgh assume fgh: "VVV.ide fgh" interpret f: arrow_of_spans C \fst fgh\ using fgh VVV.ide_char VVV.arr_char arr_char by auto interpret g: arrow_of_spans C \fst (snd fgh)\ using fgh VVV.ide_char VVV.arr_char VV.arr_char arr_char by auto interpret h: arrow_of_spans C \snd (snd fgh)\ using fgh VVV.ide_char VVV.arr_char VV.arr_char arr_char by auto interpret fgh: three_composable_arrows_of_spans C prj0 prj1 \fst fgh\ \fst (snd fgh)\ \snd (snd fgh)\ using fgh VVV.ide_char VVV.arr_char VV.arr_char arr_char by (unfold_locales, auto) interpret fgh: three_composable_identity_arrows_of_spans C prj0 prj1 \fst fgh\ \fst (snd fgh)\ \snd (snd fgh)\ using fgh VVV.ide_char VV.ide_char ide_char - apply unfold_locales - apply blast - apply blast - by blast + by unfold_locales blast+ have 1: "arr (\\<^sub>S\<^sub>B fgh)" using fgh \.preserves_reflects_arr VVV.ideD(1) by blast have 2: "\\<^sub>S\<^sub>B fgh = assoc\<^sub>S\<^sub>B (fst fgh) (fst (snd fgh)) (snd (snd fgh))" using fgh assoc_def \_ide [of "fst fgh" "fst (snd fgh)" "snd (snd fgh)"] VVV.ide_char VV.ide_char VVV.arr_char VV.arr_char by simp moreover have "iso ..." using 1 2 iso_char [of "assoc\<^sub>S\<^sub>B (fst fgh) (fst (snd fgh)) (snd (snd fgh))"] fgh.chine_assoc_inverse by auto ultimately show "iso (\\<^sub>S\<^sub>B fgh)" by argo qed qed lemma natural_isomorphism_\: shows "natural_isomorphism VVV.comp vcomp HoHV HoVH \\<^sub>S\<^sub>B" .. end locale four_composable_arrows_of_spans = span_bicategory + \: arrow_of_spans C \ + \: arrow_of_spans C \ + \: arrow_of_spans C \ + \: arrow_of_spans C \ + \\: two_composable_arrows_of_spans C prj0 prj1 \ \ + \\: two_composable_arrows_of_spans C prj0 prj1 \ \ + \\: two_composable_arrows_of_spans C prj0 prj1 \ \ + \\\: three_composable_arrows_of_spans C prj0 prj1 \ \ \ + \\\: three_composable_arrows_of_spans C prj0 prj1 \ \ \ for \ (structure) and \ (structure) and \ (structure) and \ (structure) locale four_composable_identity_arrows_of_spans = four_composable_arrows_of_spans + \: identity_arrow_of_spans C \ + \: identity_arrow_of_spans C \ + \: identity_arrow_of_spans C \ + \: identity_arrow_of_spans C \ + \\: two_composable_identity_arrows_of_spans C prj0 prj1 \ \ + \\: two_composable_identity_arrows_of_spans C prj0 prj1 \ \ + \\: two_composable_identity_arrows_of_spans C prj0 prj1 \ \ + \\\: three_composable_identity_arrows_of_spans C prj0 prj1 \ \ \ + \\\: three_composable_identity_arrows_of_spans C prj0 prj1 \ \ \ begin interpretation H: horizontal_composition vcomp hcomp src trg using has_horizontal_composition by auto text \ The following interpretations provide us with some systematic names for a lot of things. \ interpretation H\H\\: identity_arrow_of_spans C \\ \ \ \ \\ using \\\.composites_are_identities ide_char' by auto interpretation HH\\\: identity_arrow_of_spans C \(\ \ \) \ \\ using \\\.composites_are_identities ide_char' by auto interpretation H\H\\: identity_arrow_of_spans C \\ \ \ \ \\ using \\\.composites_are_identities ide_char' by auto interpretation HH\\\: identity_arrow_of_spans C \(\ \ \) \ \\ using \\\.composites_are_identities ide_char' by auto interpretation H\H\H\\: arrow_of_spans C \\ \ \ \ \ \ \\ using arrow_of_spans_hcomp \\.composable \\\.composites_are_arrows(1) by auto interpretation H\HH\\\: arrow_of_spans C \\ \ (\ \ \) \ \\ using arrow_of_spans_hcomp \\.composable \\\.composites_are_arrows(1) by auto interpretation HH\\H\\: arrow_of_spans C \(\ \ \) \ \ \ \\ using hseq_char' match_4 \\\.composites_are_arrows(2) \\.composite_is_arrow arr_char by auto interpretation HH\H\\\: arrow_of_spans C \(\ \ \ \ \) \ \\ using arrow_of_spans_hcomp \\.composable \\\.composites_are_arrows(1) by auto interpretation HHH\\\\: arrow_of_spans C \((\ \ \) \ \) \ \\ using arrow_of_spans_hcomp \\.composable \\\.composites_are_arrows(2) by auto interpretation assoc\\\: arrow_of_spans C \assoc\<^sub>S\<^sub>B \ \ \\ using arr_char \\.composable \\.composable assoc_simps(1) by auto interpretation assoc\\\: arrow_of_spans C \assoc\<^sub>S\<^sub>B \ \ \\ using arr_char \\.composable \\.composable assoc_simps(1) by auto interpretation \_\\: two_composable_identity_arrows_of_spans C prj0 prj1 \ \\ \ \\ using \\.composable \\.composable by (unfold_locales, auto) interpretation \\_\: two_composable_identity_arrows_of_spans C prj0 prj1 \\ \ \\ \ using \\.composable \\.composable by (unfold_locales, auto) interpretation \_\\: two_composable_identity_arrows_of_spans C prj0 prj1 \ \\ \ \\ using \\.composable \\.composable by (unfold_locales, auto) interpretation \\_\: two_composable_identity_arrows_of_spans C prj0 prj1 \\ \ \\ \ using \\.composable \\.composable by (unfold_locales, auto) (* The two other cases, \\\ and \\\, are part of the locale assumptions. *) interpretation \_\\_\: three_composable_identity_arrows_of_spans C prj0 prj1 \ \\ \ \\ \ .. interpretation \_\_\\: three_composable_identity_arrows_of_spans C prj0 prj1 \ \ \\ \ \\ .. interpretation \\_\_\: three_composable_identity_arrows_of_spans C prj0 prj1 \\ \ \\ \ \ .. lemma chines_eq: shows "H\HH\\\.chine = \.leg0 \\ HH\\\.leg1" and "HH\H\\\.chine = assoc\\\.cod.leg0 \\ \.leg1" and "H\H\H\\.chine = \.leg0 \\ H\H\\.leg1" proof - show "H\HH\\\.chine = \.leg0 \\ HH\\\.leg1" using hcomp_def [of \ "hcomp (hcomp \ \) \"] chine_hcomp_ide_ide \\.composable by simp show "HH\H\\\.chine = assoc\\\.cod.leg0 \\ \.leg1" - proof - - have "hseq \ \ \ arr \ \ src \ = trg (hcomp \ \)" - using \_\\.are_arrows(1) \_\\.composable \\.composite_is_arrow by blast - then have "assoc\\\.cod.leg0 = \\.leg0 \ \_\\.prj\<^sub>0" - using \\.composable by (simp add: hcomp_def) - then show ?thesis - by (simp add: \_\\_\.chine_composite(1)) - qed + by (simp add: \_\\.leg0_composite \_\\_\.chine_composite(1)) show "H\H\H\\.chine = \.leg0 \\ H\H\\.leg1" using hcomp_def [of \ "hcomp \ (hcomp \ \)"] chine_hcomp_ide_ide \\.composable by simp qed lemma cospan_\0_H\H\\1: shows "C.cospan \.leg0 H\H\\.leg1" - proof - - have "H\H\\.leg1 = \.leg1 \ \\\.Prj\<^sub>1" - using hcomp_def [of \ "hcomp \ \"] \\.composable \\.composable - apply auto - by (auto simp add: hcomp_def) - thus ?thesis - using \\.legs_form_cospan \\.legs_form_cospan \\.legs_form_cospan by simp - qed + by (metis C.cod_comp H\H\\.dom.leg_simps(3) \_\_\\.cospan_\\ \\\.leg1_composite(1)) (* TODO: Better name for this. *) lemma assoc_in_homs: shows "\\ \ (assoc\<^sub>S\<^sub>B \ \ \) : \ \ (\ \ \) \ \ \ \ \ \ \ \ \ \\" and "\assoc\<^sub>S\<^sub>B \ (\ \ \) \ : (\ \ \ \ \) \ \ \ \ \ (\ \ \) \ \\" and "\assoc\<^sub>S\<^sub>B \ \ \ \ \ : ((\ \ \) \ \) \ \ \ (\ \ \ \ \) \ \\" and "\assoc\<^sub>S\<^sub>B \ \ (\ \ \) : (\ \ \) \ \ \ \ \ \ \ \ \ \ \ \\" and "\assoc\<^sub>S\<^sub>B (\ \ \) \ \ : ((\ \ \) \ \) \ \ \ (\ \ \) \ \ \ \\" proof - show "\\ \ (assoc\<^sub>S\<^sub>B \ \ \) : \ \ (\ \ \) \ \ \ \ \ \ \ \ \ \\" using \\.composable \\.composable \\.composable by auto show "\assoc\<^sub>S\<^sub>B \ (\ \ \) \ : (\ \ \ \ \) \ \ \ \ \ (\ \ \) \ \\" using assoc_in_hom \\.composable \\.composable \\.composable by simp show "\assoc\<^sub>S\<^sub>B \ \ \ \ \ : ((\ \ \) \ \) \ \ \ (\ \ \ \ \) \ \\" using \\.composable \\.composable \\.composable by auto show "\assoc\<^sub>S\<^sub>B \ \ (\ \ \) : (\ \ \) \ \ \ \ \ \ \ \ \ \ \ \\" using \\.composable \\.composable \\.composable by auto show "\assoc\<^sub>S\<^sub>B (\ \ \) \ \ : ((\ \ \) \ \) \ \ \ (\ \ \) \ \ \ \\" using \\.composable \\.composable \\.composable by auto qed lemma chine_composites: shows "Chn (\ \ assoc\<^sub>S\<^sub>B \ \ \) = chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)" and "Chn (assoc\<^sub>S\<^sub>B \ (\ \ \) \) = \_\\_\.chine_assoc" and "Chn (assoc\<^sub>S\<^sub>B \ \ \ \ \) = chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" and "Chn (assoc\<^sub>S\<^sub>B \ \ (\ \ \)) = \_\_\\.chine_assoc" and "Chn (assoc\<^sub>S\<^sub>B (\ \ \) \ \) = \\_\_\.chine_assoc" proof - show "Chn (\ \ assoc\<^sub>S\<^sub>B \ \ \) = chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)" using hcomp_def [of \ "assoc\<^sub>S\<^sub>B \ \ \"] chine_hcomp_def [of \ "assoc\<^sub>S\<^sub>B \ \ \"] \\.composable \\.composable \\.composable by auto show "Chn (assoc\<^sub>S\<^sub>B \ \ \ \ \) = chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using assoc_in_homs(2-3) hcomp_def by (metis arrI arrow_of_spans_data.select_convs(1) hseqE) show "Chn (assoc\<^sub>S\<^sub>B \ (\ \ \) \) = \_\\_\.chine_assoc" using hcomp_def by (meson arrow_of_spans_data.select_convs(1)) show "Chn (assoc\<^sub>S\<^sub>B \ \ (\ \ \)) = \_\_\\.chine_assoc" using hcomp_def by (meson arrow_of_spans_data.select_convs(1)) show "Chn (assoc\<^sub>S\<^sub>B (\ \ \) \ \) = \\_\_\.chine_assoc" using hcomp_def by (meson arrow_of_spans_data.select_convs(1)) qed lemma prj_in_homs [intro, simp]: shows "\\

\<^sub>0[\.leg0, HH\\\.leg1] : H\HH\\\.chine \\<^sub>C HH\\\.chine\" and "\\

\<^sub>1[\.leg0, H\H\\.leg1] : H\H\H\\.chine \\<^sub>C \.apex\" and "\\

\<^sub>1[assoc\\\.cod.leg0, \.cod.leg1] : HH\H\\\.chine \\<^sub>C H\H\\.chine\" and "\\

\<^sub>0[HH\\\.leg0, \.leg1] : HHH\\\\.chine \\<^sub>C \.chine\" and "\\

\<^sub>1[HH\\\.leg0, \.leg1] : HHH\\\\.chine \\<^sub>C HH\\\.chine\" and "\\

\<^sub>1[\\.leg0 \ \_\\.prj\<^sub>0, \.leg1] : HH\H\\\.chine \\<^sub>C H\H\\.chine\" and "\\

\<^sub>1[assoc\\\.dom.leg0, \.leg1] : HHH\\\\.chine \\<^sub>C HH\\\.chine\" and "\\_\\.prj\<^sub>0 : H\H\\.chine \\<^sub>C \\.apex\" proof - show "\\

\<^sub>0[\.leg0, HH\\\.leg1] : H\HH\\\.chine \\<^sub>C HH\\\.chine\" - proof - show "C.cospan \.leg0 HH\\\.leg1" - using hcomp_def [of "hcomp \ \" \] \_\\_\.cospan_\\ \\.composable \\_\.legs_form_cospan - by auto - show "H\HH\\\.chine = \.leg0 \\ HH\\\.leg1" - using hcomp_def [of \ "hcomp (hcomp \ \) \"] chine_hcomp_ide_ide \\.composable - by simp - show "HH\\\.chine = C.dom HH\\\.leg1" - by simp - qed + by (metis C.dom_comp C.prj0_in_hom' C.prj1_simps_arr HH\\\.chine_eq_apex + HH\\\.cod.apex_def HH\\\.cod.is_span HH\\\.cod_simps(1) HH\\\.cod_simps(3) + \_\\_\.prj_simps(10) \_\\_\.prj_simps(11) \_\\_\.prj_simps(14) \\_\.leg1_composite) show "\\

\<^sub>1[assoc\\\.cod.leg0, \.cod.leg1] : HH\H\\\.chine \\<^sub>C H\H\\.chine\" - proof - show "C.cospan assoc\\\.cod.leg0 \.cod.leg1" - using hcomp_def [of \ "hcomp \ \"] hcomp_def [of \ \] - by (metis C.cod_comp H\H\\.cod.leg_simps(1) \\.cod_simps(2) \_\\.are_arrows(1) - \_\\.composable \_\\_\.cospan_\\ \\.composite_is_arrow \.cod_simps(3) - arrow_of_spans_data.select_convs(3) span_data.select_convs(1)) - show "HH\H\\\.chine = assoc\\\.cod.leg0 \\ \.cod.leg1" - using chines_eq(2) by simp - show "H\H\\.chine = C.dom assoc\\\.cod.leg0" - by auto - qed + using \\\.leg0_composite(1) \\_\_\.prj_simps(3) \_\\.leg0_composite + \_\\_\.prj_simps(6) + by auto show "\\

\<^sub>0[HH\\\.leg0, \.leg1] : HHH\\\\.chine \\<^sub>C \.chine\" - proof - show "C.cospan HH\\\.leg0 \.leg1" - using hcomp_def [of "hcomp \ \" \] \\.composable \\_\_\.cospan_\\ \\\.cospan_\\ - by simp - show "HHH\\\\.chine = HH\\\.leg0 \\ \.leg1" - using chine_hcomp_ide_ide hcomp_def [of "hcomp (hcomp \ \) \" \] \\.composable - by simp - show "\.chine = C.dom \.leg1 " by simp - qed + by (simp add: \\_\.leg0_composite \\_\_\.prj_in_hom(3)) show "\\

\<^sub>1[HH\\\.leg0, \.leg1] : HHH\\\\.chine \\<^sub>C HH\\\.chine\" - proof - show "C.cospan HH\\\.leg0 \.leg1" - using hcomp_def [of "hcomp \ \" \] \\.composable \\_\_\.cospan_\\ \\\.cospan_\\ - by simp - show "HHH\\\\.chine = HH\\\.leg0 \\ \.leg1" - using chine_hcomp_ide_ide hcomp_def [of "hcomp (hcomp \ \) \" \] \\.composable - by simp - show "HH\\\.chine = C.dom HH\\\.leg0" by simp - qed + using \\.leg0_composite \\_\.leg0_composite \\_\_\.prj_in_hom(2) by fastforce show "\\

\<^sub>1[\\.leg0 \ \_\\.prj\<^sub>0, \.leg1] : HH\H\\\.chine \\<^sub>C H\H\\.chine\" - proof - show "C.cospan (\\.leg0 \ \_\\.prj\<^sub>0) \.leg1" - using \_\\.prj_in_hom(2) C.seqI' \_\\_\.cospan_\\ by auto - show "HH\H\\\.chine = \\.leg0 \ \_\\.prj\<^sub>0 \\ \.leg1" - using chines_eq(2) hcomp_def [of \ "hcomp \ \"] \\.composable by simp - show "H\H\\.chine = C.dom (\\.leg0 \ \_\\.prj\<^sub>0)" - using \_\\.prj_in_hom(2) hcomp_def [of \ "hcomp \ \"] chine_hcomp_ide_ide \\.composable - by auto - qed + using \\\.leg0_composite(1) \_\\.leg0_composite \_\\_\.prj_simps(3) + \_\\_\.prj_simps(6) + by force show "\\

\<^sub>1[assoc\\\.dom.leg0, \.leg1] : HHH\\\\.chine \\<^sub>C HH\\\.chine\" - proof - show "C.cospan assoc\\\.dom.leg0 \.leg1" - using hcomp_def [of "hcomp \ \" \] \\.composable \\_\_\.cospan_\\ \\\.cospan_\\ - by simp - show "HHH\\\\.chine = assoc\\\.dom.leg0 \\ \.leg1" - using hcomp_def [of "hcomp (hcomp \ \) \" \] chine_hcomp_ide_ide \\.composable - by simp - show "HH\\\.chine = C.dom assoc\\\.dom.leg0" - using assoc\\\.dom.apex_def assoc\\\.chine_in_hom by fastforce - qed + using \\\

\<^sub>1[HH\\\.leg0, \.leg1] : HHH\\\\.chine \\<^sub>C HH\\\.chine\\ by fastforce show "\\

\<^sub>1[\.leg0, H\H\\.leg1] : H\H\H\\.chine \\<^sub>C \.apex\" - using cospan_\0_H\H\\1 chine_hcomp_ide_ide hcomp_def [of \ "hcomp \ (hcomp \ \)"] - \\.composable - by auto + by (simp add: \_\_\\.prj_in_hom(4) \_\\.leg1_composite) show "\\_\\.prj\<^sub>0 : H\H\\.chine \\<^sub>C \\.apex\" - using \_\\.prj_in_hom(2) chine_hcomp_ide_ide hcomp_def [of \ "hcomp \ \"] \\.composable - by simp + using \_\\.chine_composite \_\\.prj_in_hom(2) by presburger qed lemma chine_in_homs [intro, simp]: shows "\assoc\\\.chine : HH\\\.chine \\<^sub>C H\H\\.chine\" and "\assoc\\\.chine : HH\\\.chine \\<^sub>C H\H\\.chine\" and "\chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \) : H\HH\\\.chine \\<^sub>C H\H\H\\.chine\" and "\chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ : HHH\\\\.chine \\<^sub>C HH\H\\\.chine\" proof - show 1: "\assoc\\\.chine : HH\\\.chine \\<^sub>C H\H\\.chine\" using \\\.chine_assoc_in_hom by simp show "\assoc\\\.chine : HH\\\.chine \\<^sub>C H\H\\.chine\" using \\\.chine_assoc_in_hom by simp show "\chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \) : H\HH\\\.chine \\<^sub>C H\H\H\\.chine\" using Chn_in_hom by (metis assoc_in_homs(1) chine_composites(1)) show "\chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ : HHH\\\\.chine \\<^sub>C HH\H\\\.chine\" using Chn_in_hom by (metis assoc_in_homs(3) chine_composites(3)) qed lemma commutative_squares [intro, simp]: shows "C.commutative_square \\.leg0 \.leg1 \_\\_\.Prj\<^sub>0\<^sub>1 \_\\_\.Prj\<^sub>0" and "C.commutative_square \.leg0 \\.leg1 \_\_\\.Prj\<^sub>0\<^sub>1 \_\_\\.Prj\<^sub>0" and "C.commutative_square \

\<^sub>0[\.cod.leg0, assoc\\\.cod.leg1] assoc\\\.chine (chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)) \

\<^sub>0[\.leg0, assoc\\\.dom.leg1]" and "C.commutative_square \

\<^sub>1[\.cod.leg0, assoc\\\.cod.leg1] \.chine (chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)) \

\<^sub>1[\.leg0, assoc\\\.dom.leg1]" and "C.commutative_square assoc\\\.cod.leg0 \.cod.leg1 (assoc\\\.chine \ \

\<^sub>1[assoc\\\.dom.leg0, \.leg1]) (\.chine \ \

\<^sub>0[assoc\\\.dom.leg0, \.leg1])" and "C.commutative_square \.leg0 (\\.leg1 \ \\_\.prj\<^sub>1) \_\\_\.Prj\<^sub>1\<^sub>1 \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\" and "C.commutative_square \.leg0 (\.leg1 \ \_\\.prj\<^sub>1) \_\_\\.Prj\<^sub>1\<^sub>1 \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" proof - show 1: "C.commutative_square \\.leg0 \.leg1 \_\\_\.Prj\<^sub>0\<^sub>1 \_\\_\.Prj\<^sub>0" proof - have 1: "C.arr \_\\_\.Prj\<^sub>0 \ C.dom \_\\_\.Prj\<^sub>0 = HH\H\\\.chine \ C.cod \_\\_\.Prj\<^sub>0 = \.apex" by (meson C.in_homE \_\\_\.prj_in_hom(3)) hence "(\\.leg0 \ \_\\.prj\<^sub>0) \ \

\<^sub>1[\\.leg0 \ \_\\.prj\<^sub>0, \.leg1] = \.leg1 \ \_\\_\.Prj\<^sub>0" by (meson C.prj0_simps_arr C.pullback_commutes') thus ?thesis using 1 C.comp_assoc \\_\.legs_form_cospan(1) by simp qed show 2: "C.commutative_square \.leg0 \\.leg1 \_\_\\.Prj\<^sub>0\<^sub>1 \_\_\\.Prj\<^sub>0" proof - have "\.leg0 \ \\.prj\<^sub>0 \ \

\<^sub>1[\.leg0 \ \\.prj\<^sub>0, \\.leg1] = \\.leg1 \ \

\<^sub>0[\.leg0 \ \\.prj\<^sub>0, \\.leg1]" by (metis (no_types) C.category_axioms C.prj0_simps_arr C.pullback_commutes' category.comp_reduce \_\_\\.prj_simps(2) \_\_\\.prj_simps(3)) thus ?thesis using C.commutative_square_def \_\_\\.cospan_\\ \_\_\\.prj_simps(2) \_\_\\.prj_simps(3) \_\_\\.prj_simps(5) \_\_\\.prj_simps(6) \_\_\\.prj_simps(8) \.dom.apex_def by presburger qed show "C.commutative_square \

\<^sub>0[\.cod.leg0, assoc\\\.cod.leg1] assoc\\\.chine (chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)) \

\<^sub>0[\.leg0, assoc\\\.dom.leg1]" using assoc_in_homs(1) chine_hcomp_props(4) [of "assoc\<^sub>S\<^sub>B \ \ \" \] hseq_char by blast show "C.commutative_square \

\<^sub>1[\.cod.leg0, assoc\\\.cod.leg1] \.chine (chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)) \

\<^sub>1[\.leg0, assoc\\\.dom.leg1]" using chine_hcomp_props(3) [of "assoc\<^sub>S\<^sub>B \ \ \" \] hseq_char \\.composable \\.composable \\.composable by auto show "C.commutative_square assoc\\\.cod.leg0 \.cod.leg1 (assoc\\\.chine \ \

\<^sub>1[assoc\\\.dom.leg0, \.leg1]) (\.chine \ \

\<^sub>0[assoc\\\.dom.leg0, \.leg1])" using assoc_in_homs(3) hseq_char chine_hcomp_props(2) by blast show "C.commutative_square \.leg0 (\\.leg1 \ \\_\.prj\<^sub>1) \_\\_\.Prj\<^sub>1\<^sub>1 \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\" proof show "C.cospan \.leg0 (\\.leg1 \ \\_\.prj\<^sub>1)" using HH\\\.dom.leg_simps(1) \_\\_\.cospan_\\ C.arrI by fastforce show "C.span \_\\_\.Prj\<^sub>1\<^sub>1 \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\" using 1 \_\\_\.prj_in_hom(1) by auto show "C.dom \.leg0 = C.cod \_\\_\.Prj\<^sub>1\<^sub>1" by simp show "\.leg0 \ \_\\_\.Prj\<^sub>1\<^sub>1 = (\\.leg1 \ \\_\.prj\<^sub>1) \ \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\" - proof - - have "(\\.leg1 \ \\_\.prj\<^sub>1) \ \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ = - \\.leg1 \ \_\\_\.Prj\<^sub>0\<^sub>1" - using 1 C.comp_assoc by auto - also have "... = \.leg0 \ \_\\_\.Prj\<^sub>1\<^sub>1" - using hcomp_def [of \ \] - by (metis (no_types, lifting) C.comp_assoc C.prj1_simps_arr C.pullback_commutes' - \C.span \_\\_\.Prj\<^sub>1\<^sub>1 \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\\ C.seqE) - finally show ?thesis by auto - qed + by (metis (no_types, lifting) "1" C.comp_assoc C.prj_tuple(2) C.pullback_commutes' + \_\\_\.cospan_\\) qed show "C.commutative_square \.leg0 (\.leg1 \ \_\\.prj\<^sub>1) \_\_\\.Prj\<^sub>1\<^sub>1 \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" proof show "C.cospan \.leg0 (\.leg1 \ \_\\.prj\<^sub>1)" using C.arrI \_\_\\.prj_in_hom(4) by auto show "C.span \_\_\\.Prj\<^sub>1\<^sub>1 \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" using 2 by fastforce thus "C.dom \.leg0 = C.cod \_\_\\.Prj\<^sub>1\<^sub>1" using \_\_\\.cospan_\\ by simp show "\.leg0 \ \_\_\\.Prj\<^sub>1\<^sub>1 = (\.leg1 \ \_\\.prj\<^sub>1) \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" - proof - - have "(\.leg1 \ \_\\.prj\<^sub>1) \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ = - \.leg1 \ \_\\.prj\<^sub>1 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" - using C.comp_assoc by auto - also have "... = \.leg1 \ \_\_\\.Prj\<^sub>0\<^sub>1" - using 2 by simp - also have "... = \.leg0 \ \_\_\\.Prj\<^sub>1\<^sub>1" - using C.pullback_commutes [of \.leg0 \.leg1] - by (metis C.comp_assoc C.pullback_commutes' \_\_\\.cospan_\\) - finally show ?thesis by simp - qed + by (metis (no_types, lifting) "2" C.comp_assoc C.prj_tuple(2) C.pullback_commutes' + \_\_\\.cospan_\\) qed - qed lemma chine_pentagon: shows "Chn ((\ \ assoc\<^sub>S\<^sub>B \ \ \) \ assoc\<^sub>S\<^sub>B \ (\ \ \) \ \ (assoc\<^sub>S\<^sub>B \ \ \ \ \)) = Chn (assoc\<^sub>S\<^sub>B \ \ (\ \ \) \ assoc\<^sub>S\<^sub>B (\ \ \) \ \)" proof - let ?LHS = "(\ \ assoc\<^sub>S\<^sub>B \ \ \) \ assoc\<^sub>S\<^sub>B \ (\ \ \) \ \ (assoc\<^sub>S\<^sub>B \ \ \ \ \)" let ?RHS = "assoc\<^sub>S\<^sub>B \ \ (\ \ \) \ assoc\<^sub>S\<^sub>B (\ \ \) \ \" have LHS_in_hom: "\?LHS : ((\ \ \) \ \) \ \ \ \ \ \ \ \ \ \\" using \\.composable \\.composable \\.composable by auto have RHS_in_hom: "\?RHS : ((\ \ \) \ \) \ \ \ \ \ \ \ \ \ \\" using \\.composable \\.composable \\.composable by auto - have "arrow_of_spans (\) ?LHS" + have 1: "arrow_of_spans (\) ?LHS" using arr_char assoc_in_homs(1-3) by blast have L: "Chn ?LHS = chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \) \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" - proof - - have "seq (\ \ \Chn = \\\.chine_assoc, Dom = Dom ((\ \ \) \ \), - Cod = Cod (\ \ \ \ \)\) - (\Chn = \_\\_\.chine_assoc, - Dom = Dom ((\ \ \ \ \) \ \), Cod = Cod (\ \ (\ \ \) \ \)\ \ - (\Chn = \\\.chine_assoc, - Dom = Dom ((\ \ \) \ \), Cod = Cod (\ \ \ \ \)\ \ \))" - by (meson LHS_in_hom arrI) - moreover have "seq \Chn = \_\\_\.chine_assoc, - Dom = Dom ((\ \ \ \ \) \ \), Cod = Cod (\ \ (\ \ \) \ \)\ - (\Chn = \\\.chine_assoc, - Dom = Dom ((\ \ \) \ \), Cod = Cod (\ \ \ \ \)\ \ \)" - using assoc_in_homs(2) assoc_in_homs(3) by blast - ultimately show ?thesis - using Chn_vcomp chine_composites(1) chine_composites(2) chine_composites(3) - by presburger - qed + using Chn_vcomp 1 arr_char chine_composites(1) chine_composites(3) seq_char + by fastforce have R: "Chn ?RHS = \_\_\\.chine_assoc \ \\_\_\.chine_assoc" using Chn_vcomp assoc_in_homs(4) assoc_in_homs(5) seqI' by auto text \ The outline of the proof is to show that the compositions of \?LHS\ and \?RHS\ with the two projections \\

\<^sub>0[\.leg0, H\H\\.leg1]\ and \\

\<^sub>1[\.leg0, H\H\\.leg1]\ are equal, and then apply \\\\.prj'_joint_monic\. \ text \ The case for projection \\

\<^sub>1[\.leg0, H\H\\.leg1]\ does not have subcases, so we'll dispatch that one first. \ have "\

\<^sub>1[\.leg0, H\H\\.leg1] \ Chn ?LHS = \

\<^sub>1[\.leg0, H\H\\.leg1] \ Chn ?RHS" proof - have "\

\<^sub>1[\.leg0, H\H\\.leg1] \ Chn ?LHS = \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1\<^sub>1" proof - have "\

\<^sub>1[\.leg0, H\H\\.leg1] \ Chn ?LHS = \

\<^sub>1[\.leg0, H\H\\.leg1] \ chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \) \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using L by simp also have "... = \.chine \ \

\<^sub>1[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" proof - have "\

\<^sub>1[\.leg0, H\H\\.leg1] \ chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \) = \.chine \ \

\<^sub>1[\.leg0, HH\\\.leg1]" proof - have "C.commutative_square \

\<^sub>1[\.cod.leg0, assoc\\\.cod.leg1] \.chine (chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)) \

\<^sub>1[\.leg0, assoc\\\.dom.leg1]" by blast thus ?thesis by auto qed thus ?thesis using C.comp_permute [of "\

\<^sub>1[\.leg0, H\H\\.leg1]" "chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)" \.chine "\

\<^sub>1[\.leg0, HH\\\.leg1]" "\_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \"] by blast qed also have "... = \.chine \ \_\\_\.Prj\<^sub>1\<^sub>1 \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using C.comp_reduce [of "\

\<^sub>1[\.leg0, HH\\\.leg1]" \_\\_\.chine_assoc] \\_\.leg1_composite by fastforce also have "... = \.chine \ \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1\<^sub>1" proof - have "\.chine \ \_\\_\.Prj\<^sub>1\<^sub>1 \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \.chine \ \_\\.prj\<^sub>1 \ \

\<^sub>1[\\.leg0 \ \_\\.prj\<^sub>0, \.leg1] \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using C.comp_assoc by simp also have "... = \.chine \ (\_\\.prj\<^sub>1 \ assoc\\\.chine) \ \

\<^sub>1[assoc\\\.dom.leg0, \.leg1]" proof - have "\

\<^sub>1[\\.leg0 \ \_\\.prj\<^sub>0, \.leg1] \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = assoc\\\.chine \ \

\<^sub>1[assoc\\\.dom.leg0, \.leg1]" using chine_hcomp_props(6) [of \ "assoc\<^sub>S\<^sub>B \ \ \"] hcomp_def [of \ "hcomp \ \"] \\.composable \\.composable \\.composable hseq_char assoc_in_homs(3) by auto thus ?thesis using C.comp_assoc by auto qed also have "... = \.chine \ \\\.Prj\<^sub>1\<^sub>1 \ \

\<^sub>1[assoc\\\.dom.leg0, \.leg1]" using \\\.prj_chine_assoc(1) hcomp_def \\.composable by auto also have "... = \.chine \ \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1\<^sub>1" proof - have "\\\.Prj\<^sub>1\<^sub>1 \ \

\<^sub>1[assoc\\\.dom.leg0, \.leg1] = \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1\<^sub>1" - proof - - have "\\\.Prj\<^sub>1\<^sub>1 \ \

\<^sub>1[assoc\\\.dom.leg0, \.leg1] = - (\

\<^sub>1[\.leg0, \.leg1] \ \

\<^sub>1[\\.leg0, \.leg1]) \ \

\<^sub>1[\.leg0 \ \\_\.prj\<^sub>0, \.leg1]" - proof - - have "\\.leg0 = \.leg0 \ \\.prj\<^sub>0" - using hcomp_def \\.composable by simp - moreover have "assoc\\\.dom.leg0 = \.leg0 \ \\_\.prj\<^sub>0" - using hcomp_def [of "hcomp \ \" \] \\.composable by auto - ultimately show ?thesis by simp - qed - also have "... = \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1\<^sub>1" - using \\_\_\.prj_in_hom(1) C.comp_assoc by simp - finally show ?thesis by blast - qed + by (simp add: C.comp_assoc \\.leg0_composite \\_\.leg0_composite) thus ?thesis by simp qed finally show ?thesis by blast qed also have "... = \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1\<^sub>1" using \\_\_\.prj_in_hom(1) hcomp_def [of \ \] chine_hcomp_ide_ide \\.cod.apex_def \\.composable \_\_\\.cospan_\\ C.comp_ide_arr by auto finally show ?thesis by blast qed also have "... = \

\<^sub>1[\.leg0, H\H\\.leg1] \ Chn ?RHS" - proof - - have "\

\<^sub>1[\.leg0, H\H\\.leg1] \ Chn ?RHS = - \

\<^sub>1[\.leg0, H\H\\.leg1] \ \_\_\\.chine_assoc \ \\_\_\.chine_assoc" - using R by simp - also have "... = \_\_\\.Prj\<^sub>1\<^sub>1 \ \\_\_\.chine_assoc" - using C.comp_reduce [of "\

\<^sub>1[\.leg0, H\H\\.leg1]" \_\_\\.chine_assoc] - hcomp_def [of \ "hcomp \ \"] \_\_\\.chine_assoc_def \\.composable - by fastforce - also have "... = \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1\<^sub>1" - proof - - have "\_\_\\.Prj\<^sub>1\<^sub>1 \ \\_\_\.chine_assoc = (\\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1) \ \\_\_\.chine_assoc" - using hcomp_def [of \ \] hcomp_def [of \ \] \\.composable \\.composable - by simp - also have "... = \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1 \ \\_\_\.chine_assoc" - using \\.dom.apex_def \\.dom.leg_simps(1) hcomp_def \\.composable - \\.prj_in_hom(1) \\_\_\.prj_in_hom(4) C.comp_assoc - by auto - also have "... = \\.prj\<^sub>1 \ \\_\_\.Prj\<^sub>1\<^sub>1" - by simp - finally show ?thesis by simp - qed - finally show ?thesis by simp - qed + by (metis C.comp_assoc R \\.leg0_composite \\_\_\.prj_chine_assoc(1) + \_\_\\.prj_chine_assoc(1) \_\\.leg1_composite \\.leg1_composite) finally show ?thesis by blast qed text \ Now for the case of \\

\<^sub>0[\.leg0, H\H\\.leg1]\. We have to consider three sub-cases, involving the compositions with the projections \\\\.Prj\<^sub>1\, \\\\.Prj\<^sub>1\<^sub>0\, and \\\\.Prj\<^sub>0\<^sub>0\. \ moreover have "\

\<^sub>0[\.leg0, H\H\\.leg1] \ Chn ?LHS = \

\<^sub>0[\.leg0, H\H\\.leg1] \ Chn ?RHS" proof - (* Facts common to the three sub-cases. *) have A: "\

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc = \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\" using \_\\_\.chine_assoc_def \\_\.leg1_composite by auto have B: "\_\\_\.Prj\<^sub>0\<^sub>1 \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \_\\.prj\<^sub>0 \ \\\.chine_assoc \ \

\<^sub>1[HH\\\.leg0, \.leg1]" proof - have "\_\\_\.Prj\<^sub>0\<^sub>1 \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = (\_\\.prj\<^sub>0 \ \

\<^sub>1[assoc\\\.cod.leg0, \.cod.leg1]) \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using \_\\.composable \\.composite_is_arrow hcomp_def by auto also have "... = \_\\.prj\<^sub>0 \ \

\<^sub>1[assoc\\\.cod.leg0, \.cod.leg1] \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using C.comp_assoc by simp also have "... = \_\\.prj\<^sub>0 \ \\\.chine_assoc \ \

\<^sub>1[HH\\\.leg0, \.leg1]" proof - have "HH\\\.leg0 = assoc\\\.dom.leg0" using hcomp_def [of "hcomp \ \" \] by simp moreover have "C.commutative_square assoc\\\.cod.leg0 \.cod.leg1 (assoc\\\.chine \ \

\<^sub>1[assoc\\\.dom.leg0, \.leg1]) (\.chine \ \

\<^sub>0[assoc\\\.dom.leg0, \.leg1])" by blast ultimately show ?thesis using chine_hcomp_def [of "assoc\<^sub>S\<^sub>B \ \ \" \] by simp qed finally show ?thesis by blast qed have *: "assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" proof - text \Subcase \\\\.Prj\<^sub>1\:\ have "\\\.Prj\<^sub>1 \ assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \\\.Prj\<^sub>1 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" proof - have "\\\.Prj\<^sub>1 \ assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \\\.Prj\<^sub>1\<^sub>1 \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using \\\.chine_assoc_props(1) C.prj0_in_hom [of \.leg0 HH\\\.leg1] cospan_\0_H\H\\1 C.comp_reduce [of \\\.Prj\<^sub>1 assoc\\\.chine \\\.Prj\<^sub>1\<^sub>1 "\

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \"] by auto also have "... = \\\.Prj\<^sub>1\<^sub>1 \ \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using A C.comp_reduce [of "\

\<^sub>0[\.leg0, HH\\\.leg1]" \_\\_\.chine_assoc] by fastforce also have "... = \\.prj\<^sub>1 \ \_\\_\.Prj\<^sub>0\<^sub>1 \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" - proof - - have "\\\.Prj\<^sub>1\<^sub>1 \ \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ = \\.prj\<^sub>1 \ \_\\_\.Prj\<^sub>0\<^sub>1" - proof - - have "\\.leg0 = \.leg0 \ \\.prj\<^sub>0" - using hcomp_def \\.composable by simp - thus ?thesis - using commutative_squares(1) C.arrI \_\\_\.prj_in_hom(2) \\\.prj_in_hom(1) - by (simp add: C.comp_assoc) - qed - moreover have "C.seq \\\.Prj\<^sub>1\<^sub>1 \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\" - using chine_hcomp_ide_ide [of "hcomp \ \" \] hcomp_def [of "hcomp \ \" \] - \\.composable \\\.prj_in_hom(1) - by auto - moreover have "C.seq \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ - (chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \)" - by fastforce - ultimately show ?thesis - using C.comp_permute by blast - qed + by (metis A C.comp_assoc \_\\_\.prj_chine_assoc(2) \\.leg0_composite + \\_\.leg1_composite) also have "... = \\.prj\<^sub>1 \ \_\\.prj\<^sub>0 \ \\\.chine_assoc \ \

\<^sub>1[HH\\\.leg0, \.leg1]" using B by simp also have "... = \\\.Prj\<^sub>0\<^sub>1 \ \

\<^sub>1[HH\\\.leg0, \.leg1]" using hcomp_def [of \ \] \\.composable C.comp_assoc C.comp_reduce [of \\\.Prj\<^sub>1\<^sub>0 \\\.chine_assoc \\\.Prj\<^sub>0\<^sub>1 "\

\<^sub>1[HH\\\.leg0, \.leg1]"] \\\.prj_in_hom(5) \\\.prj_chine_assoc(2) by auto also have "... = \\\.Prj\<^sub>1 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" - proof - - have 1: "C.commutative_square \.leg0 \\.leg1 \_\_\\.Prj\<^sub>0\<^sub>1 \_\_\\.Prj\<^sub>0" - by blast - hence 2: "\\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ : - HH\\H\\.chine \\<^sub>C H\H\\.chine\" - using hcomp_def [of \ "hcomp \ \"] chine_hcomp_ide_ide \\.composable by auto - have "\\\.Prj\<^sub>1 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc = - \_\_\\.Prj\<^sub>0\<^sub>1 \ \\_\_\.chine_assoc" - using 1 2 \\.composable hcomp_def [of \ \] - C.comp_reduce [of \\\.Prj\<^sub>1 "\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" - \_\_\\.Prj\<^sub>0\<^sub>1 \\_\_\.chine_assoc] - by fastforce - also have "... = \\.prj\<^sub>0 \ \\_\_\.Prj\<^sub>1\<^sub>1" - proof - - have "\_\_\\.Prj\<^sub>0\<^sub>1 = \\.prj\<^sub>0 \ \\_\_\.Prj\<^sub>1" - using hcomp_def \\.composable \\.composable by simp - thus ?thesis - using C.comp_reduce C.comp_assoc by auto - qed - also have "... = \\.prj\<^sub>0 \ \\_\.prj\<^sub>1 \ \

\<^sub>1[HH\\\.leg0, \.leg1]" - using hcomp_def [of "hcomp \ \" \] \\.composable by simp - also have "... = \\\.Prj\<^sub>0\<^sub>1 \ \

\<^sub>1[HH\\\.leg0, \.leg1]" - proof - - have 1: "\\.prj\<^sub>0 \ \\_\.prj\<^sub>1 = \\\.Prj\<^sub>0\<^sub>1" - using hcomp_def \\.composable by simp - moreover have 2: "C.seq \\.prj\<^sub>0 \\_\.prj\<^sub>1" - using 1 by fastforce - moreover have "C.seq \\_\.prj\<^sub>1 \

\<^sub>1[HH\\\.leg0, \.leg1]" - by (metis 1 2 C.match_1 C.seqI' \\\.prj_in_hom(2) prj_in_homs(5)) - ultimately show ?thesis - using C.comp_reduce by simp - qed - finally show ?thesis by simp - qed + by (metis (no_types, lifting) C.comp_assoc C.prj_tuple(2) \\.leg0_composite + \\\.leg0_composite(2) \\_\_\.prj_chine_assoc(1) \\.leg1_composite + commutative_squares(2)) finally show ?thesis by simp qed moreover text \Subcase \\\\.Prj\<^sub>1\<^sub>0\:\ have "\\\.Prj\<^sub>1\<^sub>0 \ assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \\\.Prj\<^sub>1\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" proof - have "\\\.Prj\<^sub>1\<^sub>0 \ assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \\\.Prj\<^sub>0\<^sub>1 \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using C.comp_reduce [of \\\.Prj\<^sub>1\<^sub>0 "assoc\\\.chine" \\\.Prj\<^sub>0\<^sub>1 "\

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \"] by auto also have "... = \\\.Prj\<^sub>0\<^sub>1 \ \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using A C.comp_reduce [of "\

\<^sub>0[\.leg0, HH\\\.leg1]" \_\\_\.chine_assoc] by fastforce also have "... = \\.prj\<^sub>0 \ \_\\_\.Prj\<^sub>0\<^sub>1 \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" - proof - - have "\\\.Prj\<^sub>0\<^sub>1 \ \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ = - \\.prj\<^sub>0 \ \_\\_\.Prj\<^sub>0\<^sub>1" - using commutative_squares(1) C.arrI \_\\_\.prj_in_hom(2) \\\.prj_in_hom(2) - C.comp_assoc \\.leg0_composite - by auto - moreover have "C.seq \\\.Prj\<^sub>0\<^sub>1 \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\" - using chine_hcomp_ide_ide [of "hcomp \ \" \] hcomp_def [of "hcomp \ \" \] - \\.composable \\\.prj_in_hom(2) - by auto - moreover have "C.seq \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ - (chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \)" - by fastforce - ultimately show ?thesis - using C.comp_permute by blast - qed + by (metis A C.comp_assoc \_\\_\.prj_chine_assoc(2) \\.leg0_composite + \\_\.leg1_composite) also have "... = \\.prj\<^sub>0 \ \_\\.prj\<^sub>0 \ \\\.chine_assoc \ \

\<^sub>1[HH\\\.leg0, \.leg1]" using B by simp also have "... = \\\.Prj\<^sub>0 \ \

\<^sub>1[HH\\\.leg0, \.leg1]" using hcomp_def [of \ \] \\.composable \\\.prj_in_hom(6) C.comp_reduce [of \\.prj\<^sub>0 \_\\.prj\<^sub>0 \\\.Prj\<^sub>0\<^sub>0 "\\\.chine_assoc \ \

\<^sub>1[HH\\\.leg0, \.leg1]"] C.comp_reduce [of \\\.Prj\<^sub>0\<^sub>0 \\\.chine_assoc \\\.Prj\<^sub>0 "\

\<^sub>1[HH\\\.leg0, \.leg1]"] by fastforce also have "... = \\\.Prj\<^sub>1\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" - proof - - have 1: "C.commutative_square \.leg0 \\.leg1 \_\_\\.Prj\<^sub>0\<^sub>1 \_\_\\.Prj\<^sub>0" - by blast - hence 2: "\\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ : - HH\\H\\.chine \\<^sub>C H\H\\.chine\" - using hcomp_def [of \ "hcomp \ \"] chine_hcomp_ide_ide \\.composable by auto - have "\\\.Prj\<^sub>1\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ = \\.prj\<^sub>1 \ \_\_\\.Prj\<^sub>0" - proof - - have "\\\.Prj\<^sub>1\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ = - \\.prj\<^sub>1 \ \_\\.prj\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" - proof - - have "\\.prj\<^sub>1 \ \_\\.prj\<^sub>0 = \\\.Prj\<^sub>1\<^sub>0" - using hcomp_def [of \ \] \\.composable by simp - moreover have "C.seq \\.prj\<^sub>1 - (\_\\.prj\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\)" - using 2 hcomp_def [of \ \] \\\.chine_composite(2) \\\.prj_in_hom(5) - \\.composable - by auto - ultimately show ?thesis - using 2 C.comp_reduce [of \\.prj\<^sub>1 \_\\.prj\<^sub>0 \\\.Prj\<^sub>1\<^sub>0 - "\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\"] - by auto - qed - also have "... = \\.prj\<^sub>1 \ \_\_\\.Prj\<^sub>0" - using 1 by simp - finally show ?thesis by blast - qed - hence "\\\.Prj\<^sub>1\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ - \\_\_\.chine_assoc = - \\.prj\<^sub>1 \ \_\_\\.Prj\<^sub>0 \ \\_\_\.chine_assoc" - using 2 C.comp_permute by blast - also have "... = \\_\_\.Prj\<^sub>1\<^sub>0 \ \\_\_\.chine_assoc" - proof - - have "\\.prj\<^sub>1 \ \_\_\\.Prj\<^sub>0 = \\_\_\.Prj\<^sub>1\<^sub>0" - using hcomp_def \\.composable \\.composable by simp - thus ?thesis - using 2 C.comp_reduce [of \\.prj\<^sub>1 \_\_\\.Prj\<^sub>0 \\_\_\.Prj\<^sub>1\<^sub>0 \\_\_\.chine_assoc] - by auto - qed - also have "... = \\_\_\.Prj\<^sub>0\<^sub>1" - by simp - also have "... = \\\.Prj\<^sub>0 \ \

\<^sub>1[HH\\\.leg0, \.leg1]" - using hcomp_def [of "hcomp \ \" \] hcomp_def [of \ \] \\.composite_is_arrow - \\_\.composable - by auto - finally show ?thesis by simp - qed + by (metis C.comp_assoc C.tuple_prj \\.leg0_composite \\_\.leg0_composite + \\_\_\.prj_chine_assoc(2) \_\_\\.cospan_\\ \_\_\\.prj_chine_assoc(2) + \_\_\\.prj_chine_assoc(3) \_\_\\.prj_simps(2) \\.leg1_composite) finally show ?thesis by blast qed moreover text \Subcase \\\\.Prj\<^sub>0\<^sub>0\:\ have "\\\.Prj\<^sub>0\<^sub>0 \ assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \\\.Prj\<^sub>0\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" proof - have "\\\.Prj\<^sub>0\<^sub>0 \ assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ = \\\.Prj\<^sub>0 \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using C.comp_reduce [of \\\.Prj\<^sub>0\<^sub>0 assoc\\\.chine \\\.Prj\<^sub>0 "\

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \"] by fastforce also have "... = \\\.Prj\<^sub>0 \ \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using A C.comp_reduce [of "\

\<^sub>0[\.leg0, HH\\\.leg1]" \_\\_\.chine_assoc] by fastforce also have "... = \_\\_\.Prj\<^sub>0 \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" - proof - - have "\\\.Prj\<^sub>0 \ \\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\ = \_\\_\.Prj\<^sub>0" - proof - - have "\\\.Prj\<^sub>0 = \\_\.prj\<^sub>0" - using hcomp_def [of \ \] \\.composable by simp - thus ?thesis by simp - qed - thus ?thesis - using chine_hcomp_ide_ide [of "hcomp \ \" \] hcomp_def [of "hcomp \ \" \] - \\.composable \_\\_\.prj_in_hom(3) calculation - C.comp_reduce [of \\\.Prj\<^sub>0 "\\_\\_\.Prj\<^sub>0\<^sub>1 \\\.leg0, \.leg1\ \_\\_\.Prj\<^sub>0\" - \_\\_\.Prj\<^sub>0 "chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \"] - by fastforce - qed + by (metis A C.comp_assoc \_\\_\.prj_chine_assoc(3) \\.leg0_composite + \\_\.leg1_composite) also have "... = \.chine \ \

\<^sub>0[assoc\\\.dom.leg0, \.leg1]" proof - have "\_\\_\.Prj\<^sub>0 = \

\<^sub>0[assoc\\\.cod.leg0, \.cod.leg1]" using \_\\.composable \\.composite_is_arrow hcomp_def by auto thus ?thesis using chine_hcomp_props(5) [of \ "assoc\<^sub>S\<^sub>B \ \ \"] \\.composable \\.composable \\.composable by simp qed also have "... = \

\<^sub>0[HH\\\.leg0, \.leg1]" - proof - - have "C.cospan HH\\\.leg0 \.leg1" - using hcomp_def [of "hcomp \ \" \] \\.composable prj_in_homs(5) by blast - hence "\.chine = C.cod \

\<^sub>0[HH\\\.leg0, \.leg1]" - using C.prj0_simps [of HH\\\.leg0 \.leg1] by simp - thus ?thesis - using C.comp_cod_arr hcomp_def [of "hcomp \ \" \] \\.composable - HH\\\.dom.leg_simps(1) \\\.cospan_\\ - by simp - qed + by (metis C.comp_cod_arr C.in_homE arrow_of_spans_data.select_convs(2) + prj_in_homs(4)) also have "... = \\\.Prj\<^sub>0\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" - proof - - have 1: "C.commutative_square \.leg0 \\.leg1 \_\_\\.Prj\<^sub>0\<^sub>1 \_\_\\.Prj\<^sub>0" - by blast - hence 2: "\\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ : - HH\\H\\.chine \\<^sub>C H\H\\.chine\" - using hcomp_def [of \ "hcomp \ \"] chine_hcomp_ide_ide \\.composable by auto - have - "\\\.Prj\<^sub>0\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc = - \\.prj\<^sub>0 \ \_\_\\.Prj\<^sub>0 \ \\_\_\.chine_assoc" - proof - - have "\\\.Prj\<^sub>0\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ = - \\.prj\<^sub>0 \ \_\_\\.Prj\<^sub>0" - proof - - have - "\\\.Prj\<^sub>0\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ = - \\.prj\<^sub>0 \ \_\\.prj\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" - proof - - have 3: "\\.prj\<^sub>0 \ \_\\.prj\<^sub>0 = \\\.Prj\<^sub>0\<^sub>0" - using hcomp_def [of \ \] \\.composable by simp - moreover have "C.seq \\.prj\<^sub>0 - (\_\\.prj\<^sub>0 \ \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\)" - using 1 2 3 hcomp_def [of \ \] \\\.chine_composite(2) - \\.composable - by (metis C.arrI C.match_4 C.prj_tuple(1) \_\_\\.prj_in_hom(3) - \\\.prj_in_hom(6)) - ultimately show ?thesis - using 2 C.comp_reduce [of \\.prj\<^sub>0 \_\\.prj\<^sub>0 \\\.Prj\<^sub>0\<^sub>0 - "\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\"] - by auto - qed - also have "... = \\.prj\<^sub>0 \ \_\_\\.Prj\<^sub>0" - using 1 by simp - finally show ?thesis by blast - qed - thus ?thesis - using 2 C.comp_permute [of \\\.Prj\<^sub>0\<^sub>0 "\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" - \\.prj\<^sub>0 \_\_\\.Prj\<^sub>0 \\_\_\.chine_assoc] - by blast - qed - also have "... = \\_\_\.Prj\<^sub>0\<^sub>0 \ \\_\_\.chine_assoc" - using hcomp_def \\.composable \\.composable C.comp_assoc \\\.cospan_\\ - C.comp_reduce [of \\.prj\<^sub>0 \_\_\\.Prj\<^sub>0 \\_\_\.Prj\<^sub>0\<^sub>0 \\_\_\.chine_assoc] - by auto - also have "... = \\_\_\.Prj\<^sub>0" - by simp - also have "... = \

\<^sub>0[HH\\\.leg0, \.leg1]" - using hcomp_def [of "hcomp \ \" \] hcomp_def [of \ \] - \\.composite_is_arrow \\_\.composable - by auto - finally show ?thesis by simp - qed + by (metis C.comp_assoc C.tuple_prj \\.leg0_composite \\_\.leg0_composite + \\_\_\.prj_chine_assoc(3) \_\_\\.cospan_\\ \_\_\\.prj_chine_assoc(2) + \_\_\\.prj_chine_assoc(3) \_\_\\.prj_simps(2) \\.leg1_composite) finally show ?thesis by blast qed moreover have "\assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \ : HHH\\\\.chine \\<^sub>C H\H\\.chine\" using \\\.chine_assoc_props(1) by fast moreover have "\\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc : HHH\\\\.chine \\<^sub>C H\H\\.chine\" proof - have "\\\_\_\.chine_assoc : HHH\\\\.chine \\<^sub>C HH\\H\\.chine\" using \\_\_\.chine_assoc_props(1) by blast moreover have "\\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ : HH\\H\\.chine \\<^sub>C H\H\\.chine\" using chine_hcomp_ide_ide hcomp_def [of \ "hcomp \ \"] \\.composable by auto ultimately show ?thesis by blast qed ultimately show ?thesis using \\\.prj'_joint_monic [of "assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" HHH\\\\.chine "\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc"] by simp qed text \ Now use fact \*\ to finish off the \\

\<^sub>0[\.leg0, H\H\\.leg1]\ case. \ have "\

\<^sub>0[\.leg0, H\H\\.leg1] \ Chn ?LHS = assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" proof - have "\

\<^sub>0[\.leg0, H\H\\.leg1] \ Chn ?LHS = \

\<^sub>0[\.leg0, H\H\\.leg1] \ chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \) \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" using L by simp also have "... = assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1] \ \_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \" proof - have "\

\<^sub>0[\.leg0, H\H\\.leg1] \ chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \) = assoc\\\.chine \ \

\<^sub>0[\.leg0, HH\\\.leg1]" proof - have "C.commutative_square \

\<^sub>0[\.cod.leg0, assoc\\\.cod.leg1] assoc\\\.chine (chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)) \

\<^sub>0[\.leg0, assoc\\\.dom.leg1]" by blast thus ?thesis using \\\.chine_assoc_props(1) by auto qed moreover have "C.seq \

\<^sub>0[\.leg0, H\H\\.leg1] (chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \))" using cospan_\0_H\H\\1 prj_in_homs(2) by fastforce moreover have "C.seq (chine_hcomp \ (assoc\<^sub>S\<^sub>B \ \ \)) (\_\\_\.chine_assoc \ chine_hcomp (assoc\<^sub>S\<^sub>B \ \ \) \)" by blast ultimately show ?thesis using chine_hcomp_props(4) C.comp_permute by auto qed finally show ?thesis by blast qed also have "... = \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" using * by simp also have "... = \

\<^sub>0[\.leg0, H\H\\.leg1] \ Chn ?RHS" - proof - - have "\

\<^sub>0[\.leg0, H\H\\.leg1] \ Chn ?RHS = - \

\<^sub>0[\.leg0, H\H\\.leg1] \ \_\_\\.chine_assoc \ \\_\_\.chine_assoc" - using R by simp - also have "... = \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\ \ \\_\_\.chine_assoc" - proof - - have "\

\<^sub>0[\.leg0, H\H\\.leg1] \ \_\_\\.chine_assoc = - \\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" - using hcomp_def [of \ "hcomp \ \"] \\.composable \_\_\\.chine_assoc_def by auto - thus ?thesis - using C.comp_reduce [of "\

\<^sub>0[\.leg0, H\H\\.leg1]" \_\_\\.chine_assoc - "\\_\_\\.Prj\<^sub>0\<^sub>1 \\.leg0, \\.leg1\ \_\_\\.Prj\<^sub>0\" - \\_\_\.chine_assoc] - by fastforce - qed - finally show ?thesis by simp - qed + by (metis C.comp_assoc C.tuple_prj R \_\_\\.cospan_\\ \_\_\\.prj_chine_assoc(2) + \_\_\\.prj_chine_assoc(3) \_\_\\.prj_simps(2) \_\\.leg1_composite) finally show ?thesis by blast qed moreover have "C.seq \

\<^sub>1[\.leg0, H\H\\.leg1] (Chn ?LHS)" using LHS_in_hom Chn_in_hom by blast moreover have "C.seq \

\<^sub>1[\.leg0, H\H\\.leg1] (Chn ?RHS)" using RHS_in_hom Chn_in_hom by blast ultimately show "Chn ?LHS = Chn ?RHS" using cospan_\0_H\H\\1 C.prj_joint_monic by blast qed end context span_bicategory begin lemma pentagon: assumes "ide f" and "ide g" and "ide h" and "ide k" and "src f = trg g" and "src g = trg h" and "src h = trg k" shows "(f \ \\<^sub>S\<^sub>B (g, h, k)) \ \\<^sub>S\<^sub>B (f, g \ h, k) \ (\\<^sub>S\<^sub>B (f, g, h) \ k) = \\<^sub>S\<^sub>B (f, g, h \ k) \ \\<^sub>S\<^sub>B (f \ g, h, k)" proof - interpret f: identity_arrow_of_spans C f using assms ide_char' by auto interpret g: identity_arrow_of_spans C g using assms ide_char' by auto interpret h: identity_arrow_of_spans C h using assms ide_char' by auto interpret k: identity_arrow_of_spans C k using assms ide_char' by auto interpret fghk: four_composable_identity_arrows_of_spans C prj0 prj1 f g h k using assms by (unfold_locales, auto) let ?LHS = "(f \ assoc\<^sub>S\<^sub>B g h k) \ (assoc\<^sub>S\<^sub>B f (g \ h) k) \ (assoc\<^sub>S\<^sub>B f g h \ k)" let ?RHS = "assoc\<^sub>S\<^sub>B f g (h \ k) \ assoc\<^sub>S\<^sub>B (f \ g) h k" have "(f \ \\<^sub>S\<^sub>B (g, h, k)) \ \\<^sub>S\<^sub>B (f, g \ h, k) \ (\\<^sub>S\<^sub>B (f, g, h) \ k) = ?LHS" using assms \_ide ide_hcomp src_hcomp trg_hcomp by simp also have "... = ?RHS" using fghk.\\.composable fghk.\\.composable fghk.\\.composable fghk.chine_pentagon by (intro arr_eqI, auto) also have "... = \\<^sub>S\<^sub>B (f, g, h \ k) \ \\<^sub>S\<^sub>B (f \ g, h, k)" using assms \_ide ide_hcomp src_hcomp trg_hcomp by simp finally show ?thesis by blast qed lemma extends_to_bicategory: shows "bicategory vcomp hcomp assoc unit src trg" using unit_in_hom obj_char iso_unit assoc_def pentagon apply unfold_locales by auto sublocale bicategory vcomp hcomp assoc unit src trg using extends_to_bicategory by auto - end - subsection "Miscellaneous Formulas" - context span_bicategory - begin - no_notation in_hom ("\_ : _ \ _\") notation in_hom ("\_ : _ \ _\") notation lunit ("\[_]") notation runit ("\[_]") notation lunit' ("\\<^sup>-\<^sup>1[_]") notation runit' ("\\<^sup>-\<^sup>1[_]") notation assoc ("\[_, _, _]") notation \' ("\\<^sup>-\<^sup>1[_, _, _]") lemma \'_ide: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\' (f, g, h) = assoc'\<^sub>S\<^sub>B f g h" proof - have fgh: "VVV.ide (f, g, h)" using assms VVV.ide_char VVV.arr_char VV.arr_char by simp interpret f: arrow_of_spans C f using assms arr_char [of f] by auto interpret g: arrow_of_spans C g using assms arr_char [of g] by auto interpret h: arrow_of_spans C h using assms arr_char [of h] by auto interpret fgh: three_composable_arrows_of_spans C prj0 prj1 f g h using assms by (unfold_locales, auto) interpret fgh: three_composable_identity_arrows_of_spans C prj0 prj1 f g h using assms ide_char by (unfold_locales, auto) have "\' (f, g, h) = inv (\ (f, g, h))" using fgh \'.inverts_components by (simp add: \_def) moreover have "inv (\ (f, g, h)) = \Chn = C.inv (Chn (\ (f, g, h))), Dom = Cod (\ (f, g, h)), Cod = Dom (\ (f, g, h))\" using fgh \.components_are_iso inv_eq by (simp add: \_def fgh.\\.composable fgh.\\.composable) moreover have "... = assoc'\<^sub>S\<^sub>B f g h" using assms fgh \_ide [of f g h] fgh.chine_assoc_inverse C.inverse_unique by (simp add: \_def) ultimately show ?thesis by simp qed text \ The following give explicit expressions for the unitors, derived from their characterizing properties and the definition of the associators. \ lemma runit_ide_eq: assumes "ide f" shows "\[f] = \Chn = \

\<^sub>1[Leg0 (Dom f), C.cod (Leg0 (Dom f))], Dom = \Leg0 = \

\<^sub>0[Leg0 (Dom f), C.cod (Leg0 (Dom f))], Leg1 = Leg1 (Dom f) \ \

\<^sub>1[Leg0 (Dom f), C.cod (Leg0 (Dom f))]\, Cod = Cod f\" proof - interpret f: identity_arrow_of_spans C f using assms ide_char' by auto interpret src: identity_arrow_of_spans C \src f\ using assms ide_char' ide_src by auto interpret f_src: two_composable_identity_arrows_of_spans C prj0 prj1 f \src f\ using assms by (unfold_locales, simp) interpret src_src: two_composable_identity_arrows_of_spans C prj0 prj1 \src f\ \src f\ by (unfold_locales, simp) interpret f_src_src: three_composable_identity_arrows_of_spans C prj0 prj1 f \src f\ \src f\ .. let ?rf = "\Chn = \

\<^sub>1[f.leg0, f.dsrc], Dom = \Leg0 = \

\<^sub>0[f.leg0, f.dsrc], Leg1 = f.leg1 \ \

\<^sub>1[f.leg0, f.dsrc]\, Cod = Cod f\" have "?rf = \[f]" proof (intro runit_eqI) show "ide f" by fact interpret rf: arrow_of_spans C ?rf proof - interpret dom_rf: span_in_category C \\Leg0 = \

\<^sub>0[f.leg0, f.dsrc], Leg1 = f.leg1 \ \

\<^sub>1[f.leg0, f.dsrc]\\ by (unfold_locales, simp_all) show "arrow_of_spans C ?rf" using dom_rf.apex_def C.comp_cod_arr C.pullback_commutes [of f.leg0 f.dsrc] apply unfold_locales by auto qed show rf_in_hom: "\?rf : f \ src f \ f\" proof show "arr ?rf" using rf.arrow_of_spans_axioms arr_char by simp show "cod ?rf = f" using cod_char rf.arrow_of_spans_axioms arr_char by simp show "dom ?rf = f \ src f" using dom_char rf.arrow_of_spans_axioms src.arrow_of_spans_axioms arr_char hcomp_def f.arrow_of_spans_axioms f_src.composable chine_hcomp_ide_ide src_def ide_char C.comp_cod_arr rf.dom.apex_def by simp qed show "?rf \ src f = (f \ \[src f]) \ \[f, src f, src f]" proof (intro arr_eqI) show par: "par (?rf \ src f) ((f \ \[src f]) \ \[f, src f, src f])" proof - have "\?rf \ src f : (f \ src f) \ src f \ f \ src f\" - proof - - have "?rf \ src f = R ?rf" - using assms rf_in_hom src_def trg_def arr_char rf.arrow_of_spans_axioms - f.arrow_of_spans_axioms - by simp - moreover have "\R ?rf : (f \ src f) \ src f \ f \ src f\" - using rf_in_hom R.preserves_hom [of ?rf "f \ src f" f] by simp - ultimately show ?thesis by auto - qed + using f_src_src.composites_are_arrows(2) rf_in_hom src_src.are_identities(1) + by blast thus ?thesis by auto qed show "Chn (?rf \ src f) = Chn ((f \ \[src f]) \ \[f, src f, src f])" proof - have "Chn (?rf \ src f) = \f_src_src.Prj\<^sub>1\<^sub>1 \f.leg0, src.leg1\ f_src_src.Prj\<^sub>0\<^sub>1\" proof - have "Chn (?rf \ src f) = \f_src_src.Prj\<^sub>1\<^sub>1 \f.leg0, src.leg1\ \

\<^sub>0[f_src.prj\<^sub>0, src.leg1]\" using assms src_def trg_def hcomp_def arr_char ide_char rf.arrow_of_spans_axioms src.identity_arrow_of_spans_axioms chine_hcomp_arr_ide C.comp_cod_arr by (simp add: f.arrow_of_spans_axioms identity_arrow_of_spans_def) moreover have "\

\<^sub>0[f_src.prj\<^sub>0, src.leg1] = f_src_src.Prj\<^sub>0\<^sub>1" proof - have "src f = \Chn = f.dsrc, Dom = \Leg0 = f.dsrc, Leg1 = f.dsrc\, Cod = \Leg0 = f.dsrc, Leg1 = f.dsrc\\" using assms src_def by simp thus ?thesis by (simp add: C.comp_cod_arr C.pullback_commutes') qed ultimately show ?thesis by auto qed also have "... = Chn ((f \ \[src f]) \ \[f, src f, src f])" proof - have "Chn ((f \ \[src f]) \ \[f, src f, src f]) = \f_src_src.Prj\<^sub>1 \f.leg0, src.leg1\ f_src_src.Prj\<^sub>1\<^sub>0\ \ f_src_src.chine_assoc" proof - have "Chn ((f \ \[src f]) \ \[f, src f, src f]) = Chn (f \ \[src f]) \ Chn \[f, src f, src f]" using par vcomp_eq [of "f \ \[src f]" "\[f, src f, src f]"] by simp moreover have "Chn (f \ \[src f]) = \f_src_src.Prj\<^sub>1 \f.leg0, src.leg1\ f_src_src.Prj\<^sub>1\<^sub>0\" proof - have "\[src f] = \Chn = \

\<^sub>1[f.dsrc, f.dsrc], Dom = \Leg0 = \

\<^sub>1[f.dsrc, f.dsrc], Leg1 = \

\<^sub>1[f.dsrc, f.dsrc]\, Cod = \Leg0 = f.dsrc, Leg1 = f.dsrc\\" using unit_def src_def trg_def hcomp_def src.arrow_of_spans_axioms arr_char f.arrow_of_spans_axioms C.comp_cod_arr by simp moreover have "arrow_of_spans C \[src f]" using assms arr_char [of "\[src f]"] by simp ultimately show ?thesis using assms unit_def hcomp_def chine_hcomp_ide_arr rf.arrow_of_spans_axioms src.arrow_of_spans_axioms f.arrow_of_spans_axioms arr_char C.comp_cod_arr src_def trg_def by simp qed ultimately show ?thesis using \_ide by simp qed also have "... = \f_src_src.Prj\<^sub>1 \ f_src_src.chine_assoc \f.leg0, src.leg1\ f_src_src.Prj\<^sub>1\<^sub>0 \ f_src_src.chine_assoc\" - proof - - have "C.commutative_square f.leg0 src.leg1 f_src_src.Prj\<^sub>1 f_src_src.Prj\<^sub>1\<^sub>0" - proof - show "C.cospan f.leg0 src.leg1" - using f_src.legs_form_cospan(1) by auto - show "C.span f_src_src.Prj\<^sub>1 f_src_src.Prj\<^sub>1\<^sub>0" - using f_src_src.prj_in_hom(5) by auto - show "C.dom f.leg0 = C.cod f_src_src.Prj\<^sub>1" - by simp - show "f.leg0 \ f_src_src.Prj\<^sub>1 = src.leg1 \ f_src_src.Prj\<^sub>1\<^sub>0" - using C.pullback_commutes' \C.span f_src_src.Prj\<^sub>1 f_src_src.Prj\<^sub>1\<^sub>0\ - C.comp_assoc - by auto - qed - moreover have "C.seq f_src_src.Prj\<^sub>1 f_src_src.chine_assoc" - by blast - ultimately show ?thesis - using C.comp_tuple_arr by auto - qed + using C.comp_assoc C.comp_tuple_arr C.pullback_commutes' + f_src_src.cospan_\\ f_src_src.cospan_\\ + by simp also have "... = \f_src_src.Prj\<^sub>1\<^sub>1 \f.leg0, src.leg1\ f_src_src.Prj\<^sub>0\<^sub>1\" by simp finally show ?thesis by simp qed finally show ?thesis by simp qed qed qed thus ?thesis by simp qed lemma lunit_ide_eq: assumes "ide f" shows "\[f] = \Chn = \

\<^sub>0[C.cod (Leg1 (Dom f)), Leg1 (Dom f)], Dom = \Leg0 = Leg0 (Dom f) \ \

\<^sub>0[C.cod (Leg1 (Dom f)), Leg1 (Dom f)], Leg1 = \

\<^sub>1[C.cod (Leg1 (Dom f)), Leg1 (Dom f)]\, Cod = Cod f\" proof - interpret f: identity_arrow_of_spans C f using assms ide_char' by auto interpret trg: identity_arrow_of_spans C \trg f\ using assms ide_char' ide_trg by auto interpret trg_f: two_composable_identity_arrows_of_spans C prj0 prj1 \trg f\ f using assms by (unfold_locales, simp) interpret trg_trg: two_composable_identity_arrows_of_spans C prj0 prj1 \trg f\ \trg f\ by (unfold_locales, simp) interpret trg_trg_f: three_composable_identity_arrows_of_spans C prj0 prj1 \trg f\ \trg f\ f .. let ?lf = "\Chn = \

\<^sub>0[f.dtrg, f.leg1], Dom = \Leg0 = f.leg0 \ \

\<^sub>0[f.dtrg, f.leg1], Leg1 = \

\<^sub>1[f.dtrg, f.leg1]\, Cod = Cod f\" have "?lf = \[f]" proof (intro lunit_eqI) show "ide f" by fact interpret lf: arrow_of_spans C ?lf proof - interpret dom_lf: span_in_category C \\Leg0 = f.leg0 \ \

\<^sub>0[f.dtrg, f.leg1], Leg1 = \

\<^sub>1[f.dtrg, f.leg1]\\ by (unfold_locales, simp_all) show "arrow_of_spans C ?lf" using dom_lf.apex_def C.comp_cod_arr C.pullback_commutes [of f.dtrg f.leg1] apply unfold_locales by auto qed show lf_in_hom: "\?lf : trg f \ f \ f\" proof show "arr ?lf" using lf.arrow_of_spans_axioms arr_char by simp show "cod ?lf = f" using cod_char lf.arrow_of_spans_axioms arr_char by simp show "dom ?lf = trg f \ f" using dom_char lf.arrow_of_spans_axioms trg.arrow_of_spans_axioms arr_char hcomp_def f.arrow_of_spans_axioms trg_f.composable chine_hcomp_ide_ide trg_def ide_char C.comp_cod_arr lf.dom.apex_def by simp qed show "trg f \ ?lf = (\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]" proof (intro arr_eqI) show par: "par (trg f \ ?lf) ((\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f])" proof - have "\trg f \ ?lf : trg f \ (trg f \ f) \ trg f \ f\" proof - have "trg f \ ?lf = L ?lf" using assms lf_in_hom src_def trg_def arr_char lf.arrow_of_spans_axioms f.arrow_of_spans_axioms by simp moreover have "\L ?lf : trg f \ (trg f \ f) \ trg f \ f\" using lf_in_hom L.preserves_hom [of ?lf "trg f \ f" f] by simp ultimately show ?thesis by auto qed thus ?thesis by auto qed show "Chn (trg f \ ?lf) = Chn ((\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f])" proof - have "Chn (trg f \ ?lf) = \trg_trg_f.Prj\<^sub>1\<^sub>0 \trg.leg0, f.leg1\ trg_trg_f.Prj\<^sub>0\<^sub>0\" proof - have "Chn (trg f \ ?lf) = \\

\<^sub>1[trg.leg0, trg_f.prj\<^sub>1] \trg.leg0, f.leg1\ trg_trg_f.Prj\<^sub>0\<^sub>0\" using assms src_def trg_def hcomp_def arr_char ide_char lf.arrow_of_spans_axioms trg.identity_arrow_of_spans_axioms chine_hcomp_ide_arr C.comp_cod_arr by (simp add: f.arrow_of_spans_axioms identity_arrow_of_spans_def) moreover have "\

\<^sub>1[trg.leg0, trg_f.prj\<^sub>1] = trg_trg_f.Prj\<^sub>1\<^sub>0" proof - have "trg f = \Chn = f.dtrg, Dom = \Leg0 = f.dtrg, Leg1 = f.dtrg\, Cod = \Leg0 = f.dtrg, Leg1 = f.dtrg\\" using assms trg_def by simp thus ?thesis apply (simp add: C.comp_cod_arr C.pullback_commutes') by (metis C.comp_cod_arr C.pullback_commutes' select_convs(1) select_convs(2) select_convs(3) f.cod_simps(3) lf.cod_trg_eq_dom_trg lf.dom.leg_simps(3) span_data.select_convs(1) span_data.select_convs(2) trg.chine_eq_apex trg_trg_f.cospan_\\ trg_trg_f.prj_simps(10) trg_trg_f.prj_simps(16)) qed ultimately show ?thesis by auto qed also have "... = Chn ((\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f])" proof - have "Chn ((\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]) = \trg_trg_f.Prj\<^sub>0\<^sub>1 \trg.leg0, f.leg1\ trg_trg_f.Prj\<^sub>0\ \ trg_trg_f.chine_assoc'" proof - have "Chn ((\[trg f] \ f) \ \\<^sup>-\<^sup>1[trg f, trg f, f]) = Chn (\[trg f] \ f) \ Chn \\<^sup>-\<^sup>1[trg f, trg f, f]" using par vcomp_eq [of "\[trg f] \ f" "\\<^sup>-\<^sup>1[trg f, trg f, f]"] by simp moreover have "Chn (\[trg f] \ f) = \trg_trg_f.Prj\<^sub>0\<^sub>1 \trg.leg0, f.leg1\ trg_trg_f.Prj\<^sub>0\" proof - have "\[trg f] = \Chn = \

\<^sub>1[f.dtrg, f.dtrg], Dom = \Leg0 = \

\<^sub>1[f.dtrg, f.dtrg], Leg1 = \

\<^sub>1[f.dtrg, f.dtrg]\, Cod = \Leg0 = f.dtrg, Leg1 = f.dtrg\\" using unit_def src_def trg_def hcomp_def trg.arrow_of_spans_axioms arr_char f.arrow_of_spans_axioms C.comp_cod_arr by simp moreover have "arrow_of_spans C \[trg f]" using assms arr_char [of "\[trg f]"] by simp ultimately show ?thesis using assms unit_def hcomp_def chine_hcomp_arr_ide lf.arrow_of_spans_axioms trg.arrow_of_spans_axioms f.arrow_of_spans_axioms arr_char C.comp_cod_arr src_def trg_def by simp qed moreover have "Chn \\<^sup>-\<^sup>1[trg f, trg f, f] = trg_trg_f.chine_assoc'" proof - have "iso (\ (trg f, trg f, f))" - proof - - have "VVV.ide (trg f, trg f, f)" - using assms VVV.ide_char VVV.arr_char VV.ide_char VV.arr_char - by auto - thus ?thesis - using \_def \.components_are_iso [of "(trg f, trg f, f)"] by simp - qed + by (simp add: \_def) moreover have "C.inv trg_trg_f.chine_assoc = trg_trg_f.chine_assoc'" using trg_trg_f.chine_assoc_inverse C.inv_is_inverse C.inverse_arrow_unique by auto ultimately show ?thesis using assms by (simp add: \'_def \'_ide) qed ultimately show ?thesis by simp qed also have "... = \trg_trg_f.Prj\<^sub>0\<^sub>1 \ trg_trg_f.chine_assoc' \trg.leg0, f.leg1\ trg_trg_f.Prj\<^sub>0 \ trg_trg_f.chine_assoc'\" proof - have "C.commutative_square trg.leg0 f.leg1 trg_trg_f.Prj\<^sub>0\<^sub>1 trg_trg_f.Prj\<^sub>0" proof show "C.cospan trg.leg0 f.leg1" using trg_f.legs_form_cospan(1) by auto show "C.span trg_trg_f.Prj\<^sub>0\<^sub>1 trg_trg_f.Prj\<^sub>0" using trg_trg_f.prj_in_hom by auto show "C.dom trg.leg0 = C.cod trg_trg_f.Prj\<^sub>0\<^sub>1" by simp show "trg.leg0 \ trg_trg_f.Prj\<^sub>0\<^sub>1 = f.leg1 \ trg_trg_f.Prj\<^sub>0" by (metis C.comp_assoc C.prj0_simps_arr C.pullback_commutes' \C.span trg_trg_f.Prj\<^sub>0\<^sub>1 trg_trg_f.Prj\<^sub>0\) qed moreover have "C.seq trg_trg_f.Prj\<^sub>0\<^sub>1 trg_trg_f.chine_assoc'" by blast ultimately show ?thesis using C.comp_tuple_arr [of trg.leg0 f.leg1 trg_trg_f.Prj\<^sub>0\<^sub>1 trg_trg_f.Prj\<^sub>0 trg_trg_f.chine_assoc'] by auto qed also have "... = \trg_trg_f.Prj\<^sub>1\<^sub>0 \trg.leg0, f.leg1\ trg_trg_f.Prj\<^sub>0\<^sub>0\" by simp finally show ?thesis by simp qed finally show ?thesis by blast qed qed qed thus ?thesis by simp qed lemma runit'_ide_eq: assumes "ide f" shows "\\<^sup>-\<^sup>1[f] = \Chn = \Chn f \Leg0 (Dom f), C.cod (Leg0 (Dom f))\ Leg0 (Dom f)\, Dom = Cod f, Cod = \Leg0 = \

\<^sub>0[Leg0 (Dom f), C.cod (Leg0 (Dom f))], Leg1 = Leg1 (Dom f) \ \

\<^sub>1[Leg0 (Dom f), C.cod (Leg0 (Dom f))]\\" proof - interpret f: identity_arrow_of_spans C f using assms ide_char' by auto show "\\<^sup>-\<^sup>1[f] = \Chn = \f.chine \f.leg0, f.dsrc\ f.leg0\, Dom = Cod f, Cod = \Leg0 = \

\<^sub>0[f.leg0, f.dsrc], Leg1 = f.leg1 \ \

\<^sub>1[f.leg0, f.dsrc]\\" proof - have "C.inverse_arrows \

\<^sub>1[f.leg0, f.dsrc] \f.chine \f.leg0, f.dsrc\ f.leg0\" - proof - show "C.ide (\f.chine \f.leg0, f.dsrc\ f.leg0\ \ \

\<^sub>1[f.leg0, f.dsrc])" - proof - - have "\f.chine \f.leg0, f.dsrc\ f.leg0\ \ \

\<^sub>1[f.leg0, f.dsrc] = - \f.chine \ \

\<^sub>1[f.leg0, f.dsrc] \f.leg0, f.dsrc\ f.leg0 \ \

\<^sub>1[f.leg0, f.dsrc]\" - using assms C.comp_tuple_arr [of f.leg0 f.dsrc f.chine f.leg0 "\

\<^sub>1[f.leg0, f.dsrc]"] - C.comp_arr_dom C.comp_cod_arr - by simp - also have "... = \\

\<^sub>1[f.leg0, f.dsrc] \f.leg0, f.dsrc\ \

\<^sub>0[f.leg0, f.dsrc]\" - using C.pullback_commutes [of f.leg0 f.dsrc] C.comp_cod_arr by auto - also have "... = f.leg0 \\ f.dsrc" - by simp - finally have "\f.chine \f.leg0, f.dsrc\ f.leg0\ \ \

\<^sub>1[f.leg0, f.dsrc] = f.leg0 \\ f.dsrc" - by blast - thus ?thesis by simp - qed - show "C.ide (\

\<^sub>1[f.leg0, f.dsrc] \ \f.chine \f.leg0, f.dsrc\ f.leg0\)" - using assms C.comp_arr_dom C.comp_cod_arr by auto - qed + using C.pullback_arr_cod(1) f.chine_eq_apex f.dom.apex_def f.dom.leg_simps(1) + by presburger hence "C.inv \

\<^sub>1[f.leg0, f.dsrc] = \f.chine \f.leg0, f.dsrc\ f.leg0\" using C.inv_is_inverse C.inverse_arrow_unique by auto hence "\\<^sup>-\<^sup>1[f] = \Chn = \f.chine \f.leg0, f.dsrc\ f.leg0\, Dom = Cod \[f], Cod = Dom \[f]\" using assms runit_ide_eq inv_eq [of "\[f]"] iso_runit by simp thus ?thesis using assms runit_ide_eq by simp qed qed lemma lunit'_ide_eq: assumes "ide f" shows "\\<^sup>-\<^sup>1[f] = \Chn = \Leg1 (Dom f) \C.cod (Leg1 (Dom f)), Leg1 (Dom f)\ Chn f\, Dom = Cod f, Cod = \Leg0 = Leg0 (Dom f) \ \

\<^sub>0[C.cod (Leg1 (Dom f)), Leg1 (Dom f)], Leg1 = \

\<^sub>1[C.cod (Leg1 (Dom f)), Leg1 (Dom f)]\\" proof - interpret f: identity_arrow_of_spans C f using assms ide_char' by auto show "\\<^sup>-\<^sup>1[f] = \Chn = \f.leg1 \f.dtrg, f.leg1\ f.chine\, Dom = Cod f, Cod = \Leg0 = f.leg0 \ \

\<^sub>0[f.dtrg, f.leg1], Leg1 = \

\<^sub>1[f.dtrg, f.leg1]\\" proof - have "C.inverse_arrows \

\<^sub>0[f.dtrg, f.leg1] \f.leg1 \f.dtrg, f.leg1\ f.chine\" - proof - show "C.ide (\f.leg1 \f.dtrg, f.leg1\ f.chine\ \ \

\<^sub>0[f.dtrg, f.leg1])" - proof - - have "\f.leg1 \f.dtrg, f.leg1\ f.chine\ \ \

\<^sub>0[f.dtrg, f.leg1] = - \f.leg1 \ \

\<^sub>0[f.dtrg, f.leg1] \f.dtrg, f.leg1\ f.chine \ \

\<^sub>0[f.dtrg, f.leg1]\" - using assms C.comp_tuple_arr C.comp_arr_dom C.comp_cod_arr - by simp - also have "... = \\

\<^sub>1[f.dtrg, f.leg1] \f.dtrg, f.leg1\ \

\<^sub>0[f.dtrg, f.leg1]\" - proof - - have "f.leg1 \ \

\<^sub>0[f.dtrg, f.leg1] = \

\<^sub>1[f.dtrg, f.leg1]" - using C.pullback_commutes [of f.dtrg f.leg1] C.comp_cod_arr by auto - thus ?thesis - using C.comp_cod_arr by simp - qed - also have "... = f.dtrg \\ f.leg1" - by simp - finally have "\f.leg1 \f.dtrg, f.leg1\ f.chine\ \ \

\<^sub>0[f.dtrg, f.leg1] = f.dtrg \\ f.leg1" - by blast - thus ?thesis by simp - qed - show "C.ide (\

\<^sub>0[f.dtrg, f.leg1] \ \f.leg1 \f.dtrg, f.leg1\ f.chine\)" - using assms C.comp_arr_dom C.comp_cod_arr by auto - qed + using C.pullback_arr_cod(2) f.chine_eq_apex f.dom.apex_def f.dom.is_span + by presburger hence "C.inv \

\<^sub>0[f.dtrg, f.leg1] = \f.leg1 \f.dtrg, f.leg1\ f.chine\" using C.inv_is_inverse C.inverse_arrow_unique by auto hence "\\<^sup>-\<^sup>1[f] = \Chn = \f.leg1 \f.dtrg, f.leg1\ f.chine\, Dom = Cod \[f], Cod = Dom \[f]\" using assms lunit_ide_eq inv_eq [of "\[f]"] iso_lunit by simp thus ?thesis using assms lunit_ide_eq by simp qed qed end locale adjunction_data_in_span_bicategory = span_bicategory C prj0 prj1 + adjunction_data_in_bicategory vcomp hcomp assoc unit src trg f g \ \ for C :: "'a \ 'a \ 'a" (infixr "\" 55) and prj0 :: "'a \ 'a \ 'a" ("\

\<^sub>0[_, _]") and prj1 :: "'a \ 'a \ 'a" ("\

\<^sub>1[_, _]") and f :: "'a arrow_of_spans_data" and g :: "'a arrow_of_spans_data" and \ :: "'a arrow_of_spans_data" and \ :: "'a arrow_of_spans_data" begin interpretation f: identity_arrow_of_spans C f using ide_char' [of f] by auto interpretation g: identity_arrow_of_spans C g using ide_char' [of g] by auto interpretation gf: two_composable_identity_arrows_of_spans C prj0 prj1 g f using antipar by (unfold_locales, auto) interpretation fg: two_composable_identity_arrows_of_spans C prj0 prj1 f g using antipar by (unfold_locales, auto) interpretation fgf: three_composable_identity_arrows_of_spans C prj0 prj1 f g f .. interpretation gfg: three_composable_identity_arrows_of_spans C prj0 prj1 g f g .. interpretation \: arrow_of_spans C \ using arr_char unit_in_hom by auto interpretation \: arrow_of_spans C \ using arr_char counit_in_hom by auto lemma chine_unit_in_hom: shows "\\.chine : f.dsrc \\<^sub>C g.leg0 \\ f.leg1\" proof - have "\\.chine : \.dom.apex \\<^sub>C \.cod.apex\" using \.chine_in_hom by simp moreover have "\.dom.apex = f.dsrc" using \.dom.apex_def dom_char unit_simps src_def by auto moreover have "\.cod.apex = g.leg0 \\ f.leg1" - proof - - have "\.cod.apex = C.dom \.cod.leg0" by simp - also have "... = C.dom (f.leg0 \ \

\<^sub>0[g.leg0, f.leg1])" - using cod_char unit_simps hcomp_def gf.composable by simp - also have "... = g.leg0 \\ f.leg1" - using fgf.cospan_\\ by simp - finally show ?thesis by blast - qed + by (metis arrow_of_spans_data.select_convs(1) cod_char gf.chine_composite + unit_simps(1,3)) ultimately show ?thesis by simp qed lemma chine_counit_in_hom: shows "\\.chine : f.leg0 \\ g.leg1 \\<^sub>C f.dtrg\" proof - have "\\.chine : \.dom.apex \\<^sub>C \.cod.apex\" using \.chine_in_hom by simp moreover have "\.cod.apex = f.dtrg" using \.cod.apex_def cod_char counit_simps trg_def gf.composable by auto moreover have "\.dom.apex = f.leg0 \\ g.leg1" - proof - - have "\.dom.apex = C.dom \.dom.leg0" by simp - also have "... = C.dom (g.leg0 \ fg.prj\<^sub>0)" - using dom_char counit_simps hcomp_def fg.composable by simp - also have "... = f.leg0 \\ g.leg1" - using fg.prj_in_hom(2) by auto - finally show ?thesis by blast - qed + by (metis Chn_in_hom \.chine_simps(2) category.in_homE counit_in_hom(2) + fg.chine_composite span_vertical_category_axioms span_vertical_category_def) ultimately show ?thesis by simp qed lemma \_leg_simps: shows "\.dom.leg0 = f.dsrc" and "\.dom.leg1 = f.dsrc" and "\.cod.leg0 = gf.leg0" and "\.cod.leg1 = gf.leg1" proof - show "\.dom.leg0 = f.dsrc" using dom_char unit_simps(2) src_def by auto show "\.dom.leg1 = f.dsrc" using dom_char unit_simps(2) src_def by auto show "\.cod.leg0 = gf.leg0" using cod_char unit_simps(1,3) by (metis (no_types, lifting) arrow_of_spans_data.select_convs(2)) show "\.cod.leg1 = gf.leg1" using cod_char unit_simps(1,3) by (metis (no_types, lifting) arrow_of_spans_data.select_convs(2)) qed lemma \_leg_simps: shows "\.cod.leg0 = f.dtrg" and "\.cod.leg1 = f.dtrg" and "\.dom.leg0 = fg.leg0" and "\.dom.leg1 = fg.leg1" proof - show "\.cod.leg0 = f.dtrg" using cod_char counit_simps(3) trg_def gf.composable by auto show "\.cod.leg1 = f.dtrg" using cod_char counit_simps(3) trg_def gf.composable by auto show "\.dom.leg0 = fg.leg0" using dom_char counit_simps hcomp_def fg.composable by simp show "\.dom.leg1 = fg.leg1" using dom_char counit_simps hcomp_def fg.composable by simp qed lemma Chn_triangle_eq: shows "Chn (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]) = gf.prj\<^sub>0 \ \.chine \ f.leg0" and "Chn (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) = gf.prj\<^sub>1 \ \.chine \ g.leg1" proof - - have "Chn (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]) = - \

\<^sub>0[f.dtrg, f.leg1] \ chine_hcomp \ f \ fgf.chine_assoc' \ chine_hcomp f \ \ - \f.chine \f.leg0, f.dsrc\ f.leg0\" + have 1: "Chn (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]) = + \

\<^sub>0[f.dtrg, f.leg1] \ chine_hcomp \ f \ fgf.chine_assoc' \ chine_hcomp f \ \ + \f.chine \f.leg0, f.dsrc\ f.leg0\" proof - have "Chn (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]) = Chn \[f] \ Chn (\ \ f) \ Chn \\<^sup>-\<^sup>1[f, g, f] \ Chn (f \ \) \ Chn \\<^sup>-\<^sup>1[f]" using antipar Chn_vcomp by auto also have "... = \

\<^sub>0[f.dtrg, f.leg1] \ chine_hcomp \ f \ fgf.chine_assoc' \ chine_hcomp f \ \ \f.chine \f.leg0, f.dsrc\ f.leg0\" using \_ide fg.composable gf.composable fgf.chine_assoc_inverse C.inverse_unique inv_eq iso_assoc lunit_ide_eq hcomp_def [of \ f] gf.composable hcomp_def [of f \] fg.composable runit'_ide_eq by simp finally show ?thesis by blast qed moreover have "C.arr (Chn (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]))" - proof - - have "\\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f] : f \ f\" - using ide_left ide_right antipar triangle_in_hom(1) by blast - thus ?thesis - using Chn_in_hom by blast - qed - ultimately have *: "C.arr (\

\<^sub>0[f.dtrg, f.leg1] \ chine_hcomp \ f \ fgf.chine_assoc' \ + by (meson arrI arrow_of_spans.chine_simps(1) arr_char triangle_in_hom(3)) + ultimately have 2: "C.arr (\

\<^sub>0[f.dtrg, f.leg1] \ chine_hcomp \ f \ fgf.chine_assoc' \ chine_hcomp f \ \ \f.chine \f.leg0, f.dsrc\ f.leg0\)" by simp have "Chn (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]) = \

\<^sub>0[f.dtrg, f.leg1] \ chine_hcomp \ f \ fgf.chine_assoc' \ chine_hcomp f \ \ \f.chine \f.leg0, f.dsrc\ f.leg0\" - by fact + using 1 by simp also have - 1: "... = fgf.Prj\<^sub>0 \ fgf.chine_assoc' \ chine_hcomp f \ \ \f.chine \f.leg0, f.dsrc\ f.leg0\" - proof - - have "\

\<^sub>0[f.dtrg, f.leg1] \ chine_hcomp \ f = \

\<^sub>0[\.dom.leg0, f.leg1]" - proof - - have "chine_hcomp \ f = \\.chine \ \

\<^sub>1[\.dom.leg0, f.leg1] - \\.cod.leg0, f.leg1\ - \

\<^sub>0[\.dom.leg0, f.leg1]\" - using chine_hcomp_arr_ide gf.composable by simp - moreover have 1: "f.dtrg = \.cod.leg0" - using cod_char trg_def counit_simps gf.composable by simp - moreover have "C.commutative_square f.dtrg f.leg1 - (\.chine \ \

\<^sub>1[\.dom.leg0, f.leg1]) \

\<^sub>0[\.dom.leg0, f.leg1]" - proof - show "C.cospan f.dtrg f.leg1" by simp - show 2: "C.span (\.chine \ \

\<^sub>1[\.dom.leg0, f.leg1]) \

\<^sub>0[\.dom.leg0, f.leg1]" - using 1 \C.cospan f.dtrg f.leg1\ chine_counit_in_hom by simp - show 3: "C.dom f.dtrg = C.cod (\.chine \ \

\<^sub>1[\.dom.leg0, f.leg1])" - using 1 2 dom_char counit_simps by simp - show "f.dtrg \ \.chine \ \

\<^sub>1[\.dom.leg0, f.leg1] = f.leg1 \ \

\<^sub>0[\.dom.leg0, f.leg1]" - using 1 2 3 C.comp_cod_arr dom_char counit_simps C.pullback_commutes' - by (metis (no_types, lifting) C.prj1_simps_arr C.seqE \.leg0_commutes) - qed - ultimately show ?thesis by simp - qed - also have "... = fgf.Prj\<^sub>0" - using dom_char counit_simps hcomp_def fg.composable by simp - finally have "\

\<^sub>0[f.dtrg, f.leg1] \ chine_hcomp \ f = fgf.Prj\<^sub>0" - by simp - moreover have "C.seq \

\<^sub>0[f.dtrg, f.leg1] (chine_hcomp \ f)" - using chine_hcomp_props(1) fg.composable calculation(1) fgf.prj_in_hom(3) - by auto - moreover have "C.seq (chine_hcomp \ f) - (fgf.chine_assoc' \ chine_hcomp f \ \ - \f.chine \f.leg0, f.dsrc\ f.leg0\)" - using chine_hcomp_props(1) fg.composable by (metis "*" C.seqE) - ultimately show ?thesis - using C.comp_reduce by simp - qed - also have 3: "... = fgf.Prj\<^sub>0\<^sub>0 \ chine_hcomp f \ \ \f.chine \f.leg0, f.dsrc\ f.leg0\" + 3: "... = fgf.Prj\<^sub>0 \ fgf.chine_assoc' \ chine_hcomp f \ \ \f.chine \f.leg0, f.dsrc\ f.leg0\" + by (metis (no_types, lifting) C.comp_assoc C.comp_cod_arr \_leg_simps(1,3) + chine_hcomp_props(5) counit_simps(1,4) f.chine_eq_apex f.cod_simps(3) + fg.composite_is_arrow fg.leg0_composite fgf.prj_simps(3,9) hseqE) + also have 4: "... = fgf.Prj\<^sub>0\<^sub>0 \ chine_hcomp f \ \ \f.chine \f.leg0, f.dsrc\ f.leg0\" using C.comp_reduce [of fgf.Prj\<^sub>0 fgf.chine_assoc' fgf.Prj\<^sub>0\<^sub>0 "chine_hcomp f \ \ \f.chine \f.leg0, f.dsrc\ f.leg0\"] - * fgf.prj_chine_assoc'(3) + 2 fgf.prj_chine_assoc'(3) by blast - also have 4: "... = (gf.prj\<^sub>0 \ \.chine \ \

\<^sub>0[f.leg0, f.dsrc]) \ \f.chine \f.leg0, f.dsrc\ f.leg0\" + also have "... = (gf.prj\<^sub>0 \ \.chine \ \

\<^sub>0[f.leg0, f.dsrc]) \ \f.chine \f.leg0, f.dsrc\ f.leg0\" proof - have "fgf.Prj\<^sub>0\<^sub>0 \ chine_hcomp f \ = gf.prj\<^sub>0 \ \.chine \ \

\<^sub>0[f.leg0, f.dsrc]" proof - have "fgf.Prj\<^sub>0\<^sub>0 \ chine_hcomp f \ = (gf.prj\<^sub>0 \ \

\<^sub>0[f.leg0, gf.leg1]) \ \\

\<^sub>1[f.leg0, f.dsrc] \f.leg0, gf.leg1\ \.chine \ \

\<^sub>0[f.leg0, f.dsrc]\" using hcomp_def fg.composable gf.composable chine_hcomp_ide_arr \_leg_simps by auto also have "... = gf.prj\<^sub>0 \ \

\<^sub>0[f.leg0, gf.leg1] \ \\

\<^sub>1[f.leg0, f.dsrc] \f.leg0, gf.leg1\ \.chine \ \

\<^sub>0[f.leg0, f.dsrc]\" using C.comp_assoc by simp also have "... = gf.prj\<^sub>0 \ \.chine \ \

\<^sub>0[f.leg0, f.dsrc]" proof - have "C.commutative_square f.leg0 gf.leg1 \

\<^sub>1[f.leg0, f.dsrc] (\.chine \ \

\<^sub>0[f.leg0, f.dsrc])" proof show "C.cospan f.leg0 gf.leg1" using hcomp_def gf.composable fgf.prj_in_hom(5) by auto show "C.span \

\<^sub>1[f.leg0, f.dsrc] (\.chine \ \

\<^sub>0[f.leg0, f.dsrc])" using chine_unit_in_hom by auto show "C.dom f.leg0 = C.cod \

\<^sub>1[f.leg0, f.dsrc]" by simp show "f.leg0 \ \

\<^sub>1[f.leg0, f.dsrc] = gf.leg1 \ \.chine \ \

\<^sub>0[f.leg0, f.dsrc]" - proof - - have "f.leg0 \ \

\<^sub>1[f.leg0, f.dsrc] = \

\<^sub>0[f.leg0, f.dsrc]" - using C.comp_cod_arr C.pullback_commutes [of f.leg0 f.dsrc] by auto - also have "... = gf.leg1 \ \.chine \ \

\<^sub>0[f.leg0, f.dsrc]" - using unit_simps cod_char hcomp_def gf.composable \.leg1_commutes \_leg_simps - C.comp_cod_arr chine_unit_in_hom C.comp_reduce - by auto - finally show ?thesis by blast - qed + by (metis C.comp_assoc C.pullback_commutes' \.cod_trg_eq_dom_trg + \.dom.leg_simps(1) \.leg1_commutes \_leg_simps(1-2,4) + \C.cospan f.leg0 gf.leg1\) qed thus ?thesis by simp qed finally show ?thesis by simp qed moreover have "C.seq fgf.Prj\<^sub>0\<^sub>0 (chine_hcomp f \)" - using chine_hcomp_props(1) by (metis "*" 1 3 C.match_2 C.seqE) + using chine_hcomp_props(1) by (metis 2 3 4 C.match_2 C.seqE) moreover have "C.seq (chine_hcomp f \) \f.chine \f.leg0, f.dsrc\ f.leg0\" - using chine_hcomp_props(1) by (metis "*" C.seqE) + using chine_hcomp_props(1) by (metis 2 C.seqE) ultimately show ?thesis using C.comp_reduce by simp qed also have "... = gf.prj\<^sub>0 \ \.chine \ \

\<^sub>0[f.leg0, f.dsrc] \ \f.chine \f.leg0, f.dsrc\ f.leg0\" using C.comp_assoc by simp also have "... = gf.prj\<^sub>0 \ \.chine \ f.leg0" using C.comp_cod_arr f.leg0_commutes by simp finally show "Chn (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]) = gf.prj\<^sub>0 \ \.chine \ f.leg0" by simp - have "Chn (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) = - \

\<^sub>1[g.leg0, g.dsrc] \ chine_hcomp g \ \ gfg.chine_assoc \ chine_hcomp \ g \ - \g.leg1 \g.dtrg, g.leg1\ g.chine\" + have 1: "Chn (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) = + \

\<^sub>1[g.leg0, g.dsrc] \ chine_hcomp g \ \ gfg.chine_assoc \ chine_hcomp \ g \ + \g.leg1 \g.dtrg, g.leg1\ g.chine\" proof - have "Chn (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) = Chn \[g] \ Chn (g \ \) \ Chn \[g, f, g] \ Chn (\ \ g) \ Chn \\<^sup>-\<^sup>1[g]" using antipar Chn_vcomp by auto also have "... = \

\<^sub>1[g.leg0, g.dsrc] \ chine_hcomp g \ \ gfg.chine_assoc \ chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" using \_ide gf.composable fg.composable runit_ide_eq hcomp_def [of g \] fg.composable hcomp_def [of \ g] gf.composable lunit'_ide_eq by simp finally show ?thesis by blast qed - moreover have "C.arr (Chn (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]))" - proof - - have "\\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g] : g \ g\" - using ide_left ide_right antipar triangle_in_hom(2) by blast - thus ?thesis - using Chn_in_hom by blast - qed - ultimately have *: "C.arr (\

\<^sub>1[g.leg0, g.dsrc] \ chine_hcomp g \ \ gfg.chine_assoc \ chine_hcomp \ g \ - \g.leg1 \g.dtrg, g.leg1\ g.chine\)" - by simp + hence 2: "C.arr (\

\<^sub>1[g.leg0, g.dsrc] \ chine_hcomp g \ \ gfg.chine_assoc \ + chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\)" + by (metis arrI arr_char arrow_of_spans.chine_simps(1) triangle_in_hom(4)) have "Chn (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) = \

\<^sub>1[g.leg0, g.dsrc] \ chine_hcomp g \ \ gfg.chine_assoc \ chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" - by fact + using 1 by simp also have - 1: "... = gfg.Prj\<^sub>1 \ gfg.chine_assoc \ chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" + "... = gfg.Prj\<^sub>1 \ gfg.chine_assoc \ chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" proof - have "\

\<^sub>1[g.leg0, g.dsrc] \ chine_hcomp g \ = \

\<^sub>1[g.leg0, \.dom.leg1]" - proof - - have "chine_hcomp g \ = \\

\<^sub>1[g.leg0, \.dom.leg1] - \g.leg0, \.cod.leg1\ - \.chine \ \

\<^sub>0[g.leg0, \.dom.leg1]\" - using chine_hcomp_ide_arr gf.composable by simp - moreover have 1: "g.dsrc = \.cod.leg1" - using gfg.cospan_\\ by (simp add: \_leg_simps(2)) - moreover have "C.commutative_square g.leg0 g.dsrc \

\<^sub>1[g.leg0, \.dom.leg1] - (\.chine \ \

\<^sub>0[g.leg0, \.dom.leg1])" - proof - show "C.cospan g.leg0 g.dsrc" by simp - show 2: "C.span \

\<^sub>1[g.leg0, \.dom.leg1] (\.chine \ \

\<^sub>0[g.leg0, \.dom.leg1])" - using 1 \C.cospan g.leg0 g.dsrc\ chine_counit_in_hom by simp - show 3: "C.dom g.leg0 = C.cod \

\<^sub>1[g.leg0, \.dom.leg1]" - using 1 2 dom_char counit_simps by simp - show "g.leg0 \ \

\<^sub>1[g.leg0, \.dom.leg1] = g.dsrc \ \.chine \ \

\<^sub>0[g.leg0, \.dom.leg1]" - using 1 2 3 C.comp_cod_arr dom_char counit_simps C.pullback_commutes' - by (metis (no_types, lifting) C.cod_comp C.prj0_simps_arr C.seqE \.leg1_commutes) - qed - ultimately show ?thesis by simp - qed + by (metis C.comp_cod_arr \_leg_simps(2) \_leg_simps(4) arrI chine_hcomp_props(6) + fg.leg1_composite g.cod_simps(2) g.identity_arrow_of_spans_axioms + gfg.cospan_\\ gfg.prj_simps(10) gfg.prj_simps(16) hseqE + identity_arrow_of_spans.chine_eq_apex seqE triangle_in_hom(4)) also have "... = gfg.Prj\<^sub>1" using dom_char counit_simps hcomp_def fg.composable by simp finally have "\

\<^sub>1[g.leg0, g.dsrc] \ chine_hcomp g \ = gfg.Prj\<^sub>1" by simp moreover have "C.seq \

\<^sub>1[g.leg0, g.dsrc] (chine_hcomp g \)" using chine_hcomp_props(1) [of g \] gf.composable calculation gfg.prj_in_hom(4) by auto moreover have "C.seq (chine_hcomp g \) (gfg.chine_assoc \ chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\)" - using chine_hcomp_props(1) gf.composable * by (metis C.seqE) + using chine_hcomp_props(1) gf.composable 2 by (metis C.seqE) ultimately show ?thesis using C.comp_reduce by simp qed - also have 3: "... = gfg.Prj\<^sub>1\<^sub>1 \ chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" + also have "... = gfg.Prj\<^sub>1\<^sub>1 \ chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" using C.comp_reduce [of gfg.Prj\<^sub>1 gfg.chine_assoc gfg.Prj\<^sub>1\<^sub>1 "chine_hcomp \ g \ \g.leg1 \g.dtrg, g.leg1\ g.chine\"] - * gfg.prj_chine_assoc(1) + 2 gfg.prj_chine_assoc(1) by blast - also have 4: "... = (gf.prj\<^sub>1 \ \.chine \ \

\<^sub>1[g.dtrg, g.leg1]) \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" - proof - - have "gfg.Prj\<^sub>1\<^sub>1 \ chine_hcomp \ g = gf.prj\<^sub>1 \ \.chine \ \

\<^sub>1[g.dtrg, g.leg1]" - proof - - have "gfg.Prj\<^sub>1\<^sub>1 \ chine_hcomp \ g = - (gf.prj\<^sub>1 \ \

\<^sub>1[gf.leg0, g.leg1]) \ - \\.chine \ \

\<^sub>1[g.dtrg, g.leg1] \gf.leg0, g.leg1\ \

\<^sub>0[g.dtrg, g.leg1]\" - using hcomp_def fg.composable gf.composable chine_hcomp_arr_ide trg_def unit_simps(5) - \_leg_simps - by auto - also have "... = gf.prj\<^sub>1 \ \

\<^sub>1[gf.leg0, g.leg1] \ - \\.chine \ \

\<^sub>1[g.dtrg, g.leg1] \gf.leg0, g.leg1\ \

\<^sub>0[g.dtrg, g.leg1]\" - using C.comp_assoc by simp - also have "... = gf.prj\<^sub>1 \ \.chine \ \

\<^sub>1[g.dtrg, g.leg1]" - proof - - have "C.commutative_square gf.leg0 g.leg1 (\.chine \ \

\<^sub>1[g.dtrg, g.leg1]) \

\<^sub>0[g.dtrg, g.leg1]" - proof - show "C.cospan gf.leg0 g.leg1" - using hcomp_def [of g f] gf.composable gfg.prj_in_hom(3) by auto - show "C.span (\.chine \ \

\<^sub>1[g.dtrg, g.leg1]) \

\<^sub>0[g.dtrg, g.leg1]" - using chine_unit_in_hom fg.composable src_def trg_def by auto - show "C.dom gf.leg0 = C.cod (\.chine \ \

\<^sub>1[g.dtrg, g.leg1])" - using chine_unit_in_hom \_leg_simps - by (simp add: \.cod.apex_def - \C.span (\.chine \ \

\<^sub>1[g.dtrg, g.leg1]) \

\<^sub>0[g.dtrg, g.leg1]\) - show "gf.leg0 \ \.chine \ \

\<^sub>1[g.dtrg, g.leg1] = g.leg1 \ \

\<^sub>0[g.dtrg, g.leg1]" - proof - - have "g.leg1 \ \

\<^sub>0[g.dtrg, g.leg1] = \

\<^sub>1[g.dtrg, g.leg1]" - using C.comp_cod_arr C.pullback_commutes [of g.dtrg g.leg1] by auto - also have "... = gf.leg0 \ \.chine \ \

\<^sub>1[g.dtrg, g.leg1]" - proof - - have "gf.leg0 \ \.chine = g.dtrg" - using unit_simps cod_char hcomp_def gf.composable \.leg0_commutes - dom_char trg_def fg.composable - by simp - moreover have "C.seq \.chine \

\<^sub>1[g.dtrg, g.leg1]" - using chine_unit_in_hom fg.composable src_def trg_def by auto - ultimately show ?thesis - using C.comp_cod_arr C.comp_reduce by auto - qed - finally show ?thesis by simp - qed - qed - thus ?thesis by simp - qed - finally show ?thesis by simp - qed - moreover have "C.seq gfg.Prj\<^sub>1\<^sub>1 (chine_hcomp \ g)" - using chine_hcomp_props(1) [of \ g] by (metis "*" 1 "3" C.match_2 C.seqE) - moreover have "C.seq (chine_hcomp \ g) \g.leg1 \g.dtrg, g.leg1\ g.chine\" - using chine_hcomp_props(1) by (metis "*" C.seqE) - ultimately show ?thesis - using C.comp_reduce by simp - qed + also have "... = (gf.prj\<^sub>1 \ \.chine \ \

\<^sub>1[g.dtrg, g.leg1]) \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" + by (metis C.comp_assoc \_leg_simps(1) \_leg_simps(3) arrI chine_hcomp_props(6) + g.cod_simps(3) gf.leg0_composite gfg.cospan_\\ hseqE seqE triangle_in_hom(4)) also have "... = gf.prj\<^sub>1 \ \.chine \ \

\<^sub>1[g.dtrg, g.leg1] \ \g.leg1 \g.dtrg, g.leg1\ g.chine\" using C.comp_assoc by simp also have "... = gf.prj\<^sub>1 \ \.chine \ g.leg1" using C.comp_cod_arr g.leg1_commutes by simp finally show "Chn (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) = gf.prj\<^sub>1 \ \.chine \ g.leg1" by simp qed end subsection "Maps in Span(C)" text \ In this section, we chararacterize the maps (\emph{i.e}~the left adjoints) in a span bicategory. This is Proposition 2 of \cite{carboni-et-al}. \ context span_bicategory begin abbreviation adjoint_of_map where "adjoint_of_map f \ \Chn = Chn f, Dom = \Leg0 = Leg1 (Dom f), Leg1 = Leg0 (Dom f)\, Cod = \Leg0 = Leg1 (Dom f), Leg1 = Leg0 (Dom f)\\" abbreviation unit_for_map where "unit_for_map f \ \Chn = \C.inv (Leg0 (Dom f)) \Leg1 (Dom f), Leg1 (Dom f)\ C.inv (Leg0 (Dom f))\, Dom = Dom (src f), Cod = Dom (hcomp (adjoint_of_map f) f)\" abbreviation counit_for_map where "counit_for_map f \ \Chn = Leg1 (Dom f) \ \

\<^sub>0[Leg0 (Dom f), Leg0 (Dom f)], Dom = Dom (hcomp f (adjoint_of_map f)), Cod = Dom (trg f)\" lemma is_left_adjoint_char: shows "is_left_adjoint f \ ide f \ C.iso (Leg0 (Dom f))" and "is_left_adjoint f \ adjunction_in_bicategory vcomp hcomp assoc unit src trg f (adjoint_of_map f) (unit_for_map f) (counit_for_map f)" proof show 1: "is_left_adjoint f \ ide f \ C.iso (Leg0 (Dom f))" proof assume f: "is_left_adjoint f" obtain g \ \ where adj: "adjunction_in_bicategory vcomp hcomp assoc unit src trg f g \ \" using f adjoint_pair_def by blast interpret adjunction_in_bicategory vcomp hcomp assoc unit src trg f g \ \ using adj by auto show "ide f" by simp interpret f: identity_arrow_of_spans C f using ide_char' [of f] by auto interpret g: identity_arrow_of_spans C g using ide_char' [of g] by auto interpret gf: two_composable_identity_arrows_of_spans C prj0 prj1 g f using antipar by (unfold_locales, auto) interpret fg: two_composable_identity_arrows_of_spans C prj0 prj1 f g using antipar by (unfold_locales, auto) interpret fgf: three_composable_identity_arrows_of_spans C prj0 prj1 f g f .. interpret src_f: arrow_of_spans C \src f\ using arr_char gf.are_arrows(2) by blast interpret src_f: identity_arrow_of_spans C \src f\ using ide_char ide_src src_def by (unfold_locales, simp) interpret \: arrow_of_spans C \ using arr_char unit_in_hom by auto interpret \: arrow_of_spans C \ using arr_char counit_in_hom by auto interpret adjunction_data_in_span_bicategory C prj0 prj1 f g \ \ .. show "C.iso f.leg0" proof - have "C.section f.leg0" proof - have "f.chine = (gf.prj\<^sub>0 \ \.chine) \ f.leg0" using triangle_left' Chn_triangle_eq(1) C.comp_assoc by simp thus ?thesis using f.chine_is_identity by auto qed moreover have "C.retraction f.leg0" using C.retractionI [of f.leg0 "gf.prj\<^sub>0 \ \.chine"] hcomp_def C.comp_assoc \.leg0_commutes gf.leg0_composite \_leg_simps by auto ultimately show ?thesis by (simp add: C.iso_iff_section_and_retraction) qed qed have 2: "ide f \ C.iso (Leg0 (Dom f)) \ adjunction_in_bicategory vcomp hcomp assoc unit src trg f (adjoint_of_map f) (unit_for_map f) (counit_for_map f)" text \ The right adjoint \g\ is obtained by exchanging the legs of \f\. The unit is obtained by tupling \C.inv f.leg0\ with itself, via the pullback of \f.leg1\ with itself. The counit is given by the legs of \f \ g\, which are equal, because the two legs of a pullback of the isomorphism \f.leg0\ with itself must be equal. It then remains to verify the triangle identities. \ proof - assume f: "ide f \ C.iso (Leg0 (Dom f))" interpret f: identity_arrow_of_spans C f using f ide_char' by auto interpret Dom_src: span_in_category C \\Leg0 = f.dsrc, Leg1 = f.dsrc\\ using f by (unfold_locales, auto) interpret Dom_trg: span_in_category C \\Leg0 = f.dtrg, Leg1 = f.dtrg\\ using f by (unfold_locales, auto) define g where "g = adjoint_of_map f" interpret Dom_g: span_in_category C \\Leg0 = f.leg1, Leg1 = f.leg0\\ by (unfold_locales, simp) interpret g: arrow_of_spans C g unfolding g_def using Dom_g.apex_def f.leg0_commutes f.leg1_commutes by (unfold_locales, auto) interpret g: identity_arrow_of_spans C g using g_def by (unfold_locales, auto) have ide_g: "ide g" using f ide_char g.arrow_of_spans_axioms by simp interpret fg: two_composable_arrows_of_spans C prj0 prj1 f g apply unfold_locales using g_def src_def trg_def arr_char f.arrow_of_spans_axioms g.arrow_of_spans_axioms by auto interpret fg: two_composable_identity_arrows_of_spans C prj0 prj1 f g .. interpret gf: two_composable_arrows_of_spans C prj0 prj1 g f apply unfold_locales using g_def src_def trg_def arr_char f.arrow_of_spans_axioms g.arrow_of_spans_axioms by auto interpret gf: two_composable_identity_arrows_of_spans C prj0 prj1 g f .. have hcomp_fg_eq: "hcomp f g = \Chn = f.leg0 \\ f.leg0, Dom = \Leg0 = f.leg1 \ \

\<^sub>1[f.leg0, f.leg0], Leg1 = f.leg1 \ \

\<^sub>1[f.leg0, f.leg0]\, Cod = \Leg0 = f.leg1 \ \

\<^sub>1[f.leg0, f.leg0], Leg1 = f.leg1 \ \

\<^sub>1[f.leg0, f.leg0]\\" using f g_def hcomp_def fg.composable src_def trg_def arr_char f.arrow_of_spans_axioms g.arrow_of_spans_axioms chine_hcomp_def gf.are_identities(1) chine_hcomp_ide_ide C.pullback_iso_self by auto have hcomp_gf_eq: "hcomp g f = \Chn = f.leg1 \\ f.leg1, Dom = \Leg0 = f.leg0 \ \

\<^sub>0[f.leg1, f.leg1], Leg1 = f.leg0 \ \

\<^sub>1[f.leg1, f.leg1]\, Cod = \Leg0 = f.leg0 \ \

\<^sub>0[f.leg1, f.leg1], Leg1 = f.leg0 \ \

\<^sub>1[f.leg1, f.leg1]\\" using g_def hcomp_def gf.composable src_def trg_def chine_hcomp_ide_ide arr_char f.arrow_of_spans_axioms g.arrow_of_spans_axioms ide_char by simp define \ where "\ = unit_for_map f" interpret Dom_gf: span_in_category C \\Leg0 = f.leg0 \ \

\<^sub>0[f.leg1, f.leg1], Leg1 = f.leg0 \ \

\<^sub>1[f.leg1, f.leg1]\\ by (unfold_locales, simp_all) interpret \: arrow_of_spans C \ using f g_def \_def hcomp_def src_def trg_def f.arrow_of_spans_axioms g.arrow_of_spans_axioms arr_char C.comp_arr_inv' C.tuple_in_hom [of f.leg1 f.leg1 "C.inv f.leg0" "C.inv f.leg0"] Dom_src.apex_def Dom_gf.apex_def apply unfold_locales by (simp_all add: C.comp_assoc) have unit_in_hom: "\\ : src f \ hcomp g f\" proof show 1: "arr \" using arr_char \.arrow_of_spans_axioms by simp show "dom \ = src f" using 1 \_def dom_char src_def Dom_src.apex_def by simp show "cod \ = hcomp g f" using 1 \_def g_def cod_char hcomp_gf_eq Dom_gf.apex_def by simp qed define \ where "\ = counit_for_map f" interpret Dom_fg: span_in_category C \\Leg0 = f.leg1 \ \

\<^sub>1[f.leg0, f.leg0], Leg1 = f.leg1 \ \

\<^sub>1[f.leg0, f.leg0]\\ by (unfold_locales, simp_all) interpret \: arrow_of_spans C \ using f g_def \_def hcomp_def src_def trg_def f.arrow_of_spans_axioms g.arrow_of_spans_axioms arr_char C.comp_cod_arr C.pullback_iso_self Dom_trg.apex_def Dom_fg.apex_def apply unfold_locales by auto have counit_in_hom: "\\ : hcomp f g \ trg f\" proof show 1: "arr \" using arr_char \.arrow_of_spans_axioms by simp show "cod \ = trg f" using 1 \_def cod_char trg_def Dom_trg.apex_def by simp show "dom \ = hcomp f g" using 1 g_def \_def dom_char hcomp_fg_eq Dom_fg.apex_def by simp qed interpret adj: adjunction_data_in_bicategory vcomp hcomp assoc unit src trg f g \ \ using f ide_g unit_in_hom counit_in_hom gf.composable by (unfold_locales, simp_all) interpret adjunction_data_in_span_bicategory C prj0 prj1 f g \ \ .. have triangle_left: "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f]" proof - have "\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f] = f" proof (intro arr_eqI) show "par (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]) f" using f ide_in_hom [of f] adj.triangle_in_hom(3) by (metis (no_types, lifting) in_homE) show "Chn (\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f]) = f.chine" using f g_def \_def Chn_triangle_eq(1) C.comp_tuple_arr C.comp_inv_arr' by simp qed thus ?thesis using adj.triangle_equiv_form by simp qed have triangle_right: "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" proof - have "\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g] = g" proof (intro arr_eqI) show "par (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) g" using adj.ide_right ide_in_hom [of g] adj.triangle_in_hom(4) by (metis (no_types, lifting) in_homE) show "Chn (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) = g.chine" using f g_def \_def Chn_triangle_eq(2) C.comp_tuple_arr C.comp_inv_arr' by simp qed thus ?thesis using adj.triangle_equiv_form by simp qed interpret adj: adjunction_in_bicategory vcomp hcomp assoc unit src trg f g \ \ using triangle_left triangle_right by (unfold_locales, simp_all) show "adjunction_in_bicategory vcomp hcomp assoc unit src trg f g \ \" .. qed show "ide f \ C.iso (Leg0 (Dom f)) \ is_left_adjoint f" using 2 adjoint_pair_def by blast show "is_left_adjoint f \ adjunction_in_bicategory vcomp hcomp assoc unit src trg f (adjoint_of_map f) (unit_for_map f) (counit_for_map f)" using 1 2 by blast qed end end diff --git a/thys/Bicategory/Subbicategory.thy b/thys/Bicategory/Subbicategory.thy --- a/thys/Bicategory/Subbicategory.thy +++ b/thys/Bicategory/Subbicategory.thy @@ -1,1492 +1,1490 @@ (* Title: Subbicategory Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) section "Sub-Bicategories" text \ In this section we give a construction of a sub-bicategory in terms of a predicate on the arrows of an ambient bicategory that has certain closure properties with respect to that bicategory. While the construction given here is likely to be of general use, it is not the most general sub-bicategory construction that one could imagine, because it requires that the sub-bicategory actually contain the unit and associativity isomorphisms of the ambient bicategory. Our main motivation for including this construction here is to apply it to exploit the fact that the sub-bicategory of endo-arrows of a fixed object is a monoidal category, which will enable us to transfer to bicategories a result about unit isomorphisms in monoidal categories. \ theory Subbicategory imports Bicategory begin subsection "Construction" locale subbicategory = B: bicategory V H \\<^sub>B \ src\<^sub>B trg\<^sub>B + subcategory V Arr for V :: "'a comp" (infixr "\\<^sub>B" 55) and H :: "'a comp" (infixr "\\<^sub>B" 55) and \\<^sub>B :: "'a \ 'a \ 'a \ 'a" ("\\<^sub>B[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src\<^sub>B :: "'a \ 'a" and trg\<^sub>B :: "'a \ 'a" and Arr :: "'a \ bool" + assumes src_closed: "Arr f \ Arr (src\<^sub>B f)" and trg_closed: "Arr f \ Arr (trg\<^sub>B f)" and hcomp_closed: "\ Arr f; Arr g; trg\<^sub>B f = src\<^sub>B g \ \ Arr (g \\<^sub>B f)" and assoc_closed: "\ Arr f \ B.ide f; Arr g \ B.ide g; Arr h \ B.ide h; src\<^sub>B f = trg\<^sub>B g; src\<^sub>B g = trg\<^sub>B h \ \ Arr (\\<^sub>B f g h)" and assoc'_closed: "\ Arr f \ B.ide f; Arr g \ B.ide g; Arr h \ B.ide h; src\<^sub>B f = trg\<^sub>B g; src\<^sub>B g = trg\<^sub>B h \ \ Arr (B.inv (\\<^sub>B f g h))" and lunit_closed: "\ Arr f; B.ide f \ \ Arr (B.\ f)" and lunit'_closed: "\ Arr f; B.ide f \ \ Arr (B.inv (B.\ f))" and runit_closed: "\ Arr f; B.ide f \ \ Arr (B.\ f)" and runit'_closed: "\ Arr f; B.ide f \ \ Arr (B.inv (B.\ f))" begin notation B.in_hom ("\_ : _ \\<^sub>B _\") notation comp (infixr "\" 55) definition hcomp (infixr "\" 53) where "g \ f = (if arr f \ arr g \ trg\<^sub>B f = src\<^sub>B g then g \\<^sub>B f else null)" definition src where "src \ = (if arr \ then src\<^sub>B \ else null)" definition trg where "trg \ = (if arr \ then trg\<^sub>B \ else null)" interpretation src: endofunctor \(\)\ src using src_def null_char inclusion arr_char src_closed trg_closed dom_closed cod_closed dom_simp cod_simp apply unfold_locales apply auto[4] by (metis B.src.as_nat_trans.preserves_comp_2 comp_char seq_char) interpretation trg: endofunctor \(\)\ trg using trg_def null_char inclusion arr_char src_closed trg_closed dom_closed cod_closed dom_simp cod_simp apply unfold_locales apply auto[4] by (metis B.trg.as_nat_trans.preserves_comp_2 comp_char seq_char) interpretation horizontal_homs \(\)\ src trg using src_def trg_def src.preserves_arr trg.preserves_arr null_char ide_char arr_char inclusion by (unfold_locales, simp_all) interpretation "functor" VV.comp \(\)\ \\\\. fst \\ \ snd \\\ using hcomp_def VV.arr_char src_def trg_def arr_char hcomp_closed dom_char cod_char VV.dom_char VV.cod_char apply unfold_locales apply auto[2] proof - fix f assume f: "VV.arr f" show "dom (fst f \ snd f) = fst (VV.dom f) \ snd (VV.dom f)" proof - have "dom (fst f \ snd f) = B.dom (fst f) \\<^sub>B B.dom (snd f)" proof - have "dom (fst f \ snd f) = B.dom (fst f \ snd f)" using f dom_char by (simp add: arr_char hcomp_closed hcomp_def) also have "... = B.dom (fst f) \\<^sub>B B.dom (snd f)" using f by (metis (no_types, lifting) B.hcomp_simps(3) B.hseqI' VV.arrE arrE hcomp_def inclusion src_def trg_def) finally show ?thesis by blast qed also have "... = fst (VV.dom f) \ snd (VV.dom f)" using f VV.arr_char VV.dom_char arr_char hcomp_def B.seq_if_composable dom_closed apply simp by (metis (no_types, lifting) dom_char) finally show ?thesis by simp qed show "cod (fst f \ snd f) = fst (VV.cod f) \ snd (VV.cod f)" proof - have "cod (fst f \ snd f) = B.cod (fst f) \\<^sub>B B.cod (snd f)" using f VV.arr_char arr_char cod_char hcomp_def src_def trg_def src_closed trg_closed hcomp_closed inclusion B.hseq_char arrE by auto also have "... = fst (VV.cod f) \ snd (VV.cod f)" using f VV.arr_char VV.cod_char arr_char hcomp_def B.seq_if_composable cod_closed apply simp by (metis (no_types, lifting) cod_char) finally show ?thesis by simp qed next fix f g assume fg: "VV.seq g f" show "fst (VV.comp g f) \ snd (VV.comp g f) = (fst g \ snd g) \ (fst f \ snd f)" proof - have "fst (VV.comp g f) \ snd (VV.comp g f) = fst g \ fst f \ snd g \ snd f" using fg VV.seq_char VV.comp_char VxV.comp_char VxV.not_Arr_Null by (metis (no_types, lifting) VxV.seqE prod.sel(1) prod.sel(2)) also have "... = (fst g \\<^sub>B fst f) \\<^sub>B (snd g \\<^sub>B snd f)" using fg comp_char hcomp_def VV.seq_char inclusion arr_char seq_char B.hseq_char by (metis (no_types, lifting) B.hseq_char' VxV.seq_char null_char) also have 1: "... = (fst g \\<^sub>B snd g) \\<^sub>B (fst f \\<^sub>B snd f)" proof - have "src\<^sub>B (fst g) = trg\<^sub>B (snd g)" by (metis (no_types, lifting) VV.arrE VV.seq_char fg src_def trg_def) thus ?thesis using fg VV.seq_char VV.arr_char arr_char seq_char inclusion B.interchange by (meson VxV.seqE) qed also have "... = (fst g \ snd g) \ (fst f \ snd f)" using fg comp_char hcomp_def VV.seq_char VV.arr_char arr_char seq_char inclusion B.hseq_char' hcomp_closed src_def trg_def by (metis (no_types, lifting) 1) finally show ?thesis by auto qed qed interpretation horizontal_composition \(\)\ \(\)\ src trg using arr_char src_def trg_def src_closed trg_closed apply (unfold_locales) using hcomp_def inclusion not_arr_null by auto abbreviation \ where "\ \ \ \ \ if VVV.arr (\, \, \) then \\<^sub>B \ \ \ else null" abbreviation (input) \\<^sub>S\<^sub>B where "\\<^sub>S\<^sub>B \\\ \ \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))" lemma assoc_closed': assumes "VVV.arr \\\" shows "Arr (\\<^sub>S\<^sub>B \\\)" proof - have 1: "B.VVV.arr \\\" using assms VVV.arr_char VV.arr_char B.VVV.arr_char B.VV.arr_char arr_char src_def trg_def inclusion by auto show "Arr (\\<^sub>S\<^sub>B \\\)" proof - have "Arr (\\<^sub>S\<^sub>B \\\) = Arr ((fst \\\ \\<^sub>B fst (snd \\\) \\<^sub>B snd (snd \\\)) \\<^sub>B \\<^sub>S\<^sub>B (B.VVV.dom \\\))" using assms 1 B.\_def B.assoc_is_natural_1 [of "fst \\\" "fst (snd \\\)" "snd (snd \\\)"] VV.arr_char VVV.arr_char B.VVV.arr_char B.VV.arr_char B.VVV.dom_char B.VV.dom_char apply simp by (metis (no_types, lifting) arr_char dom_char dom_closed src.preserves_dom trg.preserves_dom) also have "..." proof (intro comp_closed) show "Arr (fst \\\ \\<^sub>B fst (snd \\\) \\<^sub>B snd (snd \\\))" using assms 1 B.VVV.arr_char B.VV.arr_char hcomp_closed by (metis (no_types, lifting) B.H.preserves_reflects_arr B.trg_hcomp VV.arr_char VVV.arrE arr_char) show "B.cod (\ (fst (B.VVV.dom \\\)) (fst (snd (B.VVV.dom \\\))) (snd (snd (B.VVV.dom \\\)))) = B.dom (fst \\\ \\<^sub>B fst (snd \\\) \\<^sub>B snd (snd \\\))" using assms 1 VVV.arr_char VV.arr_char B.VxVxV.dom_char B.VVV.dom_simp B.VVV.cod_simp apply simp by (metis (no_types, lifting) B.VV.arr_char B.VVV.arrE B.\.preserves_reflects_arr B.assoc_is_natural_1 B.seqE arr_dom dom_char src_dom trg_dom) show "Arr (\ (fst (B.VVV.dom \\\)) (fst (snd (B.VVV.dom \\\))) (snd (snd (B.VVV.dom \\\))))" proof - have "VVV.arr (B.VVV.dom \\\)" using 1 B.VVV.dom_char B.VVV.arr_char B.VV.arr_char VVV.arr_char VV.arr_char apply simp by (metis (no_types, lifting) VVV.arrE arr_dom assms dom_simp src_dom trg_dom) moreover have "Arr (\\<^sub>B (B.dom (fst \\\)) (B.dom (fst (snd \\\))) (B.dom (snd (snd \\\))))" proof - have "B.VVV.ide (B.VVV.dom \\\)" using 1 B.VVV.ide_dom by blast thus ?thesis using assms B.\_def B.VVV.arr_char B.VV.arr_char B.VVV.ide_char B.VV.ide_char dom_closed assoc_closed by (metis (no_types, lifting) "1" B.ide_dom B.src_dom B.trg_dom VV.arr_char VVV.arrE arr_char) qed ultimately show ?thesis using 1 B.VVV.ide_dom assoc_closed B.VVV.dom_char apply simp by (metis (no_types, lifting) B.VV.arr_char B.VVV.arrE B.VVV.inclusion B.VxV.dom_char B.VxVxV.arrE B.VxVxV.dom_char prod.sel(1) prod.sel(2)) qed qed finally show ?thesis by blast qed qed lemma lunit_closed': assumes "Arr f" shows "Arr (B.\ f)" proof - have 1: "arr f \ arr (B.\ (B.dom f))" using assms arr_char lunit_closed dom_closed B.ide_dom inclusion by simp moreover have "B.dom f = B.cod (B.\ (B.dom f))" using 1 arr_char B.\.preserves_cod inclusion by simp moreover have "B.\ f = f \ B.\ (B.dom f)" using assms 1 B.\.is_natural_1 inclusion comp_char arr_char by simp ultimately show ?thesis using arr_char comp_closed cod_char seqI dom_simp by auto qed lemma runit_closed': assumes "Arr f" shows "Arr (B.\ f)" proof - have 1: "arr f \ arr (B.\ (B.dom f))" using assms arr_char runit_closed dom_closed B.ide_dom inclusion by simp moreover have "B.dom f = B.cod (B.\ (B.dom f))" using 1 arr_char B.\.preserves_cod inclusion by simp moreover have "B.\ f = f \ B.\ (B.dom f)" using assms 1 B.\.is_natural_1 inclusion comp_char arr_char by simp ultimately show ?thesis using arr_char comp_closed cod_char seqI dom_simp by auto qed interpretation natural_isomorphism VVV.comp \(\)\ HoHV HoVH \\<^sub>S\<^sub>B proof fix \\\ show "\ VVV.arr \\\ \ \\<^sub>S\<^sub>B \\\ = null" by simp assume \\\: "VVV.arr \\\" have 1: "B.VVV.arr \\\" using \\\ VVV.arr_char VV.arr_char B.VVV.arr_char B.VV.arr_char arr_char src_def trg_def inclusion by auto show "dom (\\<^sub>S\<^sub>B \\\) = HoHV (VVV.dom \\\)" proof - have "dom (\\<^sub>S\<^sub>B \\\) = B.HoHV (B.VVV.dom \\\)" using \\\ 1 arr_char VVV.arr_char VV.arr_char B.VVV.arr_char B.VV.arr_char B.\_def assoc_closed' dom_simp by simp also have "... = HoHV (VVV.dom \\\)" proof - have "HoHV (VVV.dom \\\) = HoHV (VxVxV.dom \\\)" using \\\ VVV.dom_char VV.arr_char src_def trg_def VVV.arr_char by auto also have "... = B.HoHV (B.VVV.dom \\\)" using \\\ VVV.dom_char VVV.arr_char VV.arr_char src_def trg_def HoHV_def B.HoHV_def arr_char B.VVV.arr_char B.VVV.dom_char B.VV.arr_char dom_closed hcomp_closed hcomp_def inclusion dom_simp by auto finally show ?thesis by simp qed finally show ?thesis by simp qed show "cod (\\<^sub>S\<^sub>B \\\) = HoVH (VVV.cod \\\)" proof - have "cod (\\<^sub>S\<^sub>B \\\) = B.HoVH (B.VVV.cod \\\)" using \\\ 1 arr_char VVV.arr_char VV.arr_char B.VVV.arr_char B.VV.arr_char B.\_def assoc_closed' cod_simp by simp also have "... = HoVH (VVV.cod \\\)" proof - have "HoVH (VVV.cod \\\) = HoVH (VxVxV.cod \\\)" using \\\ VVV.cod_char VV.arr_char src_def trg_def VVV.arr_char by auto also have "... = B.HoVH (B.VVV.cod \\\)" using \\\ VVV.cod_char VV.arr_char src_def trg_def VVV.arr_char HoVH_def B.HoVH_def arr_char B.VVV.arr_char B.VVV.cod_char B.VV.arr_char cod_closed hcomp_closed hcomp_def inclusion cod_simp by simp finally show ?thesis by simp qed finally show ?thesis by simp qed have 3: "Arr (fst \\\) \ Arr (fst (snd \\\)) \ Arr (snd (snd \\\)) \ src\<^sub>B (fst \\\) = trg\<^sub>B (fst (snd \\\)) \ src\<^sub>B (fst (snd \\\)) = trg\<^sub>B (snd (snd \\\))" using \\\ VVV.arr_char VV.arr_char src_def trg_def arr_char by auto show "HoVH \\\ \ \\<^sub>S\<^sub>B (VVV.dom \\\) = \\<^sub>S\<^sub>B \\\" proof - have "\\<^sub>S\<^sub>B \\\ = (fst \\\ \\<^sub>B fst (snd \\\) \\<^sub>B snd (snd \\\)) \\<^sub>B \\<^sub>B (B.dom (fst \\\)) (B.dom (fst (snd \\\))) (B.dom (snd (snd \\\)))" using 3 inclusion B.assoc_is_natural_1 [of "fst \\\" "fst (snd \\\)" "snd (snd \\\)"] by (simp add: \\\) also have "... = (fst \\\ \ fst (snd \\\) \ snd (snd \\\)) \ \\<^sub>B (dom (fst \\\)) (dom (fst (snd \\\))) (dom (snd (snd \\\)))" using 1 3 \\\ hcomp_closed assoc_closed dom_closed hcomp_def comp_def inclusion comp_char dom_char VVV.arr_char VV.arr_char apply simp using B.hcomp_simps(2-3) arr_char by presburger also have "... = HoVH \\\ \ \\<^sub>S\<^sub>B (VVV.dom \\\)" using \\\ B.\_def HoVH_def VVV.dom_char VV.dom_char VxVxV.dom_char apply simp by (metis (no_types, lifting) VV.arr_char VVV.arrE VVV.arr_dom VxV.dom_char dom_simp) finally show ?thesis by argo qed show "\\<^sub>S\<^sub>B (VVV.cod \\\) \ HoHV \\\ = \\<^sub>S\<^sub>B \\\" proof - have "\\<^sub>S\<^sub>B \\\ = \\<^sub>B (B.cod (fst \\\)) (B.cod (fst (snd \\\))) (B.cod (snd (snd \\\))) \\<^sub>B (fst \\\ \\<^sub>B fst (snd \\\)) \\<^sub>B snd (snd \\\)" using 3 inclusion B.assoc_is_natural_2 [of "fst \\\" "fst (snd \\\)" "snd (snd \\\)"] by (simp add: \\\) also have "... = \\<^sub>B (cod (fst \\\)) (cod (fst (snd \\\))) (cod (snd (snd \\\))) \ ((fst \\\ \ fst (snd \\\)) \ snd (snd \\\))" - using 1 3 \\\ hcomp_closed assoc_closed cod_closed hcomp_def comp_def inclusion - comp_char cod_char VVV.arr_char VV.arr_char - by auto + by (simp add: "3" arrI assoc_closed cod_char cod_closed hcomp_closed hcomp_def + inclusion comp_def) also have "... = \\<^sub>S\<^sub>B (VVV.cod \\\) \ HoHV \\\" using \\\ B.\_def HoHV_def VVV.cod_char VV.cod_char VxVxV.cod_char VVV.arr_char VV.arr_char arr_cod src_cod trg_cod by simp finally show ?thesis by argo qed next fix fgh assume fgh: "VVV.ide fgh" show "iso (\\<^sub>S\<^sub>B fgh)" proof - have 1: "B.arr (fst (snd fgh)) \ B.arr (snd (snd fgh)) \ src\<^sub>B (fst (snd fgh)) = trg\<^sub>B (snd (snd fgh)) \ src\<^sub>B (fst fgh) = trg\<^sub>B (fst (snd fgh))" using fgh VVV.ide_char VVV.arr_char VV.arr_char src_def trg_def arr_char inclusion by auto have 2: "B.ide (fst fgh) \ B.ide (fst (snd fgh)) \ B.ide (snd (snd fgh))" using fgh VVV.ide_char ide_char by blast have "\\<^sub>S\<^sub>B fgh = \\<^sub>B (fst fgh) (fst (snd fgh)) (snd (snd fgh))" using fgh B.\_def by simp moreover have "B.VVV.ide fgh" using fgh 1 2 VVV.ide_char B.VVV.ide_char VVV.arr_char B.VVV.arr_char src_def trg_def inclusion arr_char B.VV.arr_char by simp moreover have "Arr (\\<^sub>B (fst fgh) (fst (snd fgh)) (snd (snd fgh)))" using fgh 1 VVV.ide_char VVV.arr_char VV.arr_char src_def trg_def arr_char assoc_closed' B.\_def by simp moreover have "Arr (B.inv (\\<^sub>B (fst fgh) (fst (snd fgh)) (snd (snd fgh))))" using fgh 1 VVV.ide_char VVV.arr_char VV.arr_char src_def trg_def arr_char assoc'_closed by (simp add: VVV.arr_char "2" B.VVV.ide_char calculation(2)) ultimately show ?thesis using fgh iso_char B.\.components_are_iso by auto qed qed interpretation L: endofunctor \(\)\ L using endofunctor_L by auto interpretation R: endofunctor \(\)\ R using endofunctor_R by auto interpretation L: faithful_functor \(\)\ \(\)\ L proof fix f f' assume par: "par f f'" assume eq: "L f = L f'" have "B.par f f'" using par inclusion arr_char dom_simp cod_simp by fastforce moreover have "B.L f = B.L f'" proof - have "\a. Arr a \ B.arr a" by (simp add: inclusion) moreover have 1: "\a. arr a \ (if arr a then hseq (trg a) a else arr null)" using L.preserves_arr by presburger moreover have "Arr f \ Arr (trg f) \ trg\<^sub>B f = src\<^sub>B (trg f)" by (simp add: \B.par f f'\ arrE par trg_closed trg_def) ultimately show ?thesis by (metis \B.par f f'\ eq hcomp_def hseq_char' par trg_def) qed ultimately show "f = f'" using B.L.is_faithful by blast qed interpretation L: full_functor \(\)\ \(\)\ L proof fix f f' \ assume f: "ide f" and f': "ide f'" and \: "\\ : L f \ L f'\" have 1: "L f = trg\<^sub>B f \\<^sub>B f \ L f' = trg\<^sub>B f' \\<^sub>B f'" using f f' hcomp_def trg_def arr_char ide_char trg_closed by simp have 2: "\\ : trg\<^sub>B f \\<^sub>B f \\<^sub>B trg\<^sub>B f' \\<^sub>B f'\" using 1 f f' \ hcomp_def trg_def src_def inclusion dom_char cod_char hseq_char' arr_char ide_char trg_closed null_char by (simp add: arr_char in_hom_char) show "\\. \\ : f \ f'\ \ L \ = \" proof - let ?\ = "B.\ f' \\<^sub>B \ \\<^sub>B B.inv (B.\ f)" have \: "\?\ : f \ f'\ \ \?\ : f \\<^sub>B f'\" proof - have "\?\ : f \\<^sub>B f'\" using f f' \ 2 B.\_ide_simp lunit'_closed lunit_closed' ide_char by auto thus ?thesis using f f' \ in_hom_char arr_char comp_closed ide_char lunit'_closed lunit_closed by (metis (no_types, lifting) B.arrI B.seqE in_homE) qed have \_eq: "?\ = B.\ f' \ \ \ B.inv (B.\ f)" proof - have "?\ = B.\ f' \ \ \\<^sub>B B.inv (B.\ f)" - using f f' \ \ arr_char inclusion comp_char comp_closed ide_char - lunit'_closed lunit_closed - by (metis (no_types, lifting) B.seqE in_homE) + by (metis (no_types, lifting) B.arrI B.seqE \ \ arrE comp_closed f f' + ide_char in_hom_char local.comp_def lunit'_closed lunit_closed) also have "... = B.\ f' \ \ \ B.inv (B.\ f)" using f f' \ \ arr_char inclusion comp_char comp_closed ide_char lunit'_closed lunit_closed by (metis (no_types, lifting) B.seqE in_homE) finally show ?thesis by simp qed have "L ?\ = \" proof - have "L ?\ = trg\<^sub>B ?\ \\<^sub>B ?\" using \ \_eq hcomp_def trg_def inclusion arr_char trg_closed by auto also have "... = (trg\<^sub>B ?\ \\<^sub>B ?\) \\<^sub>B (B.inv (B.\ f) \\<^sub>B B.\ f)" proof - have "B.inv (B.\ f) \\<^sub>B B.\ f = trg\<^sub>B f \\<^sub>B f" using f ide_char B.comp_inv_arr B.inv_is_inverse by auto moreover have "B.dom (trg\<^sub>B ?\ \\<^sub>B ?\) = trg\<^sub>B f \\<^sub>B f" proof - have "B.dom (trg\<^sub>B ?\) = trg\<^sub>B f" using f \ B.vconn_implies_hpar(2) by force moreover have "B.dom ?\ = f" using \ by blast ultimately show ?thesis using B.hcomp_simps [of "trg\<^sub>B ?\" ?\] by (metis (no_types, lifting) B.hseqI' B.ideD(1) B.src_trg B.trg.preserves_reflects_arr B.trg_dom f ide_char) qed ultimately show ?thesis using \ \_eq B.comp_arr_dom in_hom_char by auto qed also have "... = ((trg\<^sub>B ?\ \\<^sub>B ?\) \\<^sub>B B.inv (B.\ f)) \\<^sub>B B.\ f" using B.comp_assoc by simp also have "... = (B.inv (B.\ f') \\<^sub>B ?\) \\<^sub>B B.\ f" using \ \_eq B.\'.naturality [of ?\] by auto also have "... = (B.inv (B.\ f') \\<^sub>B B.\ f') \\<^sub>B \ \\<^sub>B (B.inv (B.\ f) \\<^sub>B B.\ f)" using \ \_eq arr_char arrI comp_simp B.comp_assoc by metis also have "... = \" using f f' \ 2 B.comp_arr_dom B.comp_cod_arr ide_char B.\.components_are_iso B.\_ide_simp B.comp_inv_arr' by auto finally show ?thesis by blast qed thus ?thesis using \ by auto qed qed interpretation R: faithful_functor \(\)\ \(\)\ R proof fix f f' assume par: "par f f'" assume eq: "R f = R f'" have "B.par f f'" using par inclusion arr_char dom_simp cod_simp by fastforce moreover have "B.R f = B.R f'" proof - have "\a. Arr a \ B.arr a" by (simp add: inclusion) moreover have 1: "\a. arr a \ (if arr a then hseq a (src a) else arr null)" using R.preserves_arr by presburger moreover have "arr f \ arr (src f) \ trg\<^sub>B (src f) = src\<^sub>B f" by (meson 1 hcomp_def hseq_char' par) ultimately show ?thesis by (metis \B.par f f'\ eq hcomp_def hseq_char' src_def) qed ultimately show "f = f'" using B.R.is_faithful by blast qed interpretation R: full_functor \(\)\ \(\)\ R proof fix f f' \ assume f: "ide f" and f': "ide f'" and \: "\\ : R f \ R f'\" have 1: "R f = f \\<^sub>B src\<^sub>B f \ R f' = f' \\<^sub>B src\<^sub>B f'" using f f' hcomp_def src_def arr_char ide_char src_closed by simp have 2: "\\ : f \\<^sub>B src\<^sub>B f \\<^sub>B f' \\<^sub>B src\<^sub>B f'\" using 1 f f' \ hcomp_def trg_def src_def inclusion dom_char cod_char hseq_char' arr_char ide_char trg_closed null_char by (simp add: arr_char in_hom_char) show "\\. \\ : f \ f'\ \ R \ = \" proof - let ?\ = "B.\ f' \\<^sub>B \ \\<^sub>B B.inv (B.\ f)" have \: "\?\ : f \ f'\ \ \?\ : f \\<^sub>B f'\" proof - have "\?\ : f \\<^sub>B f'\" using f f' \ 2 B.\_ide_simp runit'_closed runit_closed' ide_char by auto thus ?thesis by (metis (no_types, lifting) B.arrI B.seqE \ arrE arrI comp_closed f f' ide_char in_hom_char runit'_closed runit_closed') qed have \_eq: "?\ = B.\ f' \ \ \ B.inv (B.\ f)" proof - have "?\ = B.\ f' \ \ \\<^sub>B B.inv (B.\ f)" using f f' \ \ arr_char inclusion comp_char comp_closed ide_char runit'_closed runit_closed by (metis (no_types, lifting) B.seqE in_homE) also have "... = B.\ f' \ \ \ B.inv (B.\ f)" using f f' \ \ arr_char inclusion comp_char comp_closed ide_char runit'_closed runit_closed by (metis (no_types, lifting) B.arrI B.comp_in_homE in_hom_char) finally show ?thesis by simp qed have "R ?\ = \" proof - have "R ?\ = ?\ \\<^sub>B src\<^sub>B ?\" using \ \_eq hcomp_def src_def inclusion arr_char src_closed by auto also have "... = (?\ \\<^sub>B src\<^sub>B ?\) \\<^sub>B (B.inv (B.\ f) \\<^sub>B B.\ f)" proof - have "B.inv (B.\ f) \\<^sub>B B.\ f = f \\<^sub>B src\<^sub>B f" using f ide_char B.comp_inv_arr B.inv_is_inverse by auto moreover have "B.dom (?\ \\<^sub>B src\<^sub>B ?\) = f \\<^sub>B src\<^sub>B f" using f \ \_eq ide_char arr_char B.src_dom [of ?\] by (metis (no_types, lifting) B.R.as_nat_trans.preserves_comp_2 B.R.preserves_seq B.dom_src B.hcomp_simps(3) B.in_homE) ultimately show ?thesis using \ \_eq B.comp_arr_dom in_hom_char by auto qed also have "... = ((?\ \\<^sub>B src\<^sub>B ?\) \\<^sub>B B.inv (B.\ f)) \\<^sub>B B.\ f" using B.comp_assoc by simp also have "... = (B.inv (B.\ f') \\<^sub>B ?\) \\<^sub>B B.\ f" using \ \_eq B.\'.naturality [of ?\] by auto also have "... = (B.inv (B.\ f') \\<^sub>B B.\ f') \\<^sub>B \ \\<^sub>B (B.inv (B.\ f) \\<^sub>B B.\ f)" using \ \_eq arr_char arrI comp_simp B.comp_assoc by metis also have "... = \" using f f' \ 2 B.comp_arr_dom B.comp_cod_arr ide_char B.\.components_are_iso B.\_ide_simp B.comp_inv_arr' by auto finally show ?thesis by blast qed thus ?thesis using \ by blast qed qed interpretation bicategory \(\)\ \(\)\ \ \ src trg proof show "\a. obj a \ \\[a] : a \ a \ a\" proof (intro in_homI) fix a assume a: "obj a" have 1: "Arr (\ a)" using a obj_def src_def trg_def in_hom_char B.unit_in_hom arr_char hcomp_def B.obj_def ide_char objE hcomp_closed by (metis (no_types, lifting) B.\_ide_simp B.unitor_coincidence(1) inclusion lunit_closed) show 2: "arr \[a]" using 1 arr_char by simp show "dom \[a] = a \ a" using a 2 dom_char by (metis (full_types) B.objI_trg B.unit_simps(4) R.preserves_reflects_arr hcomp_def hseq_char' inclusion objE obj_simps(1) subcategory.arrE subcategory_axioms trg_def) show "cod \[a] = a" using a 2 cod_char by (metis B.obj_def' B.unit_simps(5) inclusion objE obj_simps(1) subcategory.arrE subcategory_axioms trg_def) qed show "\a. obj a \ iso (\ a)" proof - fix a assume a: "obj a" have 1: "trg\<^sub>B a = src\<^sub>B a" using a obj_def src_def trg_def B.obj_def arr_char by (metis horizontal_homs.objE horizontal_homs_axioms) have 2: "Arr (\ a)" using a 1 obj_def src_def trg_def in_hom_char B.unit_in_hom arr_char hcomp_def B.obj_def ide_char objE hcomp_closed by (metis (no_types, lifting) B.\_ide_simp B.unitor_coincidence(1) inclusion lunit_closed) have "iso (B.\ a)" using a 2 obj_def B.iso_unit iso_char arr_char lunit_closed lunit'_closed B.iso_lunit apply simp by (metis (no_types, lifting) B.\.components_are_iso B.ide_src inclusion src_def) thus "iso (\ a)" using a 2 obj_def B.iso_unit iso_char arr_char B.unitor_coincidence apply simp by (metis (no_types, lifting) B.\_ide_simp B.ide_src B.obj_src inclusion src_def) qed show "\f g h k. \ ide f; ide g; ide h; ide k; src f = trg g; src g = trg h; src h = trg k \ \ (f \ \ g h k) \ \ f (g \ h) k \ (\ f g h \ k) = \ f g (h \ k) \ \ (f \ g) h k" using B.pentagon VVV.arr_char VV.arr_char hcomp_def assoc_closed arr_char comp_char hcomp_closed comp_closed ide_char inclusion src_def trg_def by simp qed proposition is_bicategory: shows "bicategory (\) (\) \ \ src trg" .. lemma obj_char: shows "obj a \ arr a \ B.obj a" proof assume a: "obj a" show "arr a \ B.obj a" using a obj_def B.obj_def src_def arr_char inclusion by metis next assume a: "arr a \ B.obj a" have "src a = a" using a src_def by auto thus "obj a" using a obj_def by simp qed lemma hcomp_char: shows "hcomp = (\f g. if arr f \ arr g \ src f = trg g then f \\<^sub>B g else null)" using hcomp_def src_def trg_def by metis lemma assoc_simp: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\ f g h = \\<^sub>B f g h" using assms VVV.arr_char VV.arr_char by auto lemma assoc'_simp: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\' f g h = B.\' f g h" proof - have "\' f g h = B.inv (\\<^sub>B f g h)" using assms inv_char by fastforce also have "... = B.\' f g h" using assms ide_char src_def trg_def B.VVV.ide_char B.VVV.arr_char B.VV.arr_char by force finally show ?thesis by blast qed lemma lunit_simp: assumes "ide f" shows "lunit f = B.lunit f" proof - have "B.lunit f = lunit f" proof (intro lunit_eqI) show "ide f" by fact show 1: "\B.lunit f : trg f \ f \ f\" proof show 2: "arr (B.lunit f)" using assms arr_char lunit_closed by (simp add: arr_char B.\_ide_simp ide_char) show "dom (B.lunit f) = trg f \ f" using assms 2 dom_char hcomp_char ide_char src_trg trg.preserves_arr trg_def by auto show "cod (B.lunit f) = f" using assms 2 in_hom_char by (simp add: cod_simp ide_char) qed show "trg f \ B.lunit f = (\[trg f] \ f) \ \' (trg f) (trg f) f" proof - have "trg f \ B.lunit f = trg\<^sub>B f \\<^sub>B B.lunit f" using assms 1 arr_char hcomp_char by (metis (no_types, lifting) ideD(1) src_trg trg.preserves_reflects_arr trg_def vconn_implies_hpar(2,4)) also have "... = (\[trg f] \\<^sub>B f) \\<^sub>B B.\' (trg f) (trg f) f" using assms ide_char B.lunit_char(2) trg_def by simp also have "... = (\[trg f] \\<^sub>B f) \\<^sub>B \' (trg f) (trg f) f" using assms assoc'_simp [of "trg f" "trg f" f] by simp also have "... = (\[trg f] \ f) \\<^sub>B \' (trg f) (trg f) f" using assms hcomp_char by simp also have "... = (\[trg f] \ f) \ \' (trg f) (trg f) f" using assms seq_char [of "\[trg f] \ f" "\' (trg f) (trg f) f"] comp_char [of "\[trg f] \ f" "\' (trg f) (trg f) f"] by simp finally show ?thesis by blast qed qed thus ?thesis by simp qed lemma lunit'_simp: assumes "ide f" shows "lunit' f = B.lunit' f" using assms inv_char [of "lunit f"] lunit_simp by fastforce lemma runit_simp: assumes "ide f" shows "runit f = B.runit f" proof - have "B.runit f = runit f" proof (intro runit_eqI) show "ide f" by fact show 1: "\B.runit f : f \ src f \ f\" proof show 2: "arr (B.runit f)" using assms arr_char runit_closed by (simp add: arr_char B.\_ide_simp ide_char) show "dom (B.runit f) = f \ src f" using assms 2 dom_char hcomp_char by (metis (no_types, lifting) B.runit_simps(4) ide_char src.preserves_reflects_arr src_def trg_src) show "cod (B.runit f) = f" using assms 2 in_hom_char by (simp add: cod_simp ide_char) qed show "B.runit f \ src f = (f \ \[src f]) \ \ f (src f) (src f)" proof - have "B.runit f \ src f = B.runit f \\<^sub>B src\<^sub>B f" using assms 1 arr_char hcomp_char by (metis (no_types, lifting) ideD(1) src.preserves_reflects_arr src_def trg_src vconn_implies_hpar(1,3)) also have "... = (f \\<^sub>B \[src f]) \\<^sub>B \\<^sub>B f (src f) (src f)" using assms ide_char B.runit_char(2) src_def by simp also have "... = (f \\<^sub>B \[src f]) \\<^sub>B \ f (src f) (src f)" using assms assoc_simp by simp also have "... = (f \ \[src f]) \\<^sub>B \ f (src f) (src f)" using assms 1 hcomp_char by simp also have "... = (f \ \[src f]) \ \ f (src f) (src f)" proof - have "B.seq (f \ \[src f]) (\ f (src f) (src f))" using assms seq_char [of "f \ \[src f]" "\ f (src f) (src f)"] by simp thus ?thesis using assms comp_char [of "f \ \[src f]" "\ f (src f) (src f)"] by simp qed finally show ?thesis by blast qed qed thus ?thesis by simp qed lemma runit'_simp: assumes "ide f" shows "runit' f = B.runit' f" using assms inv_char [of "runit f"] runit_simp by fastforce lemma comp_eqI [intro]: assumes "seq f g" and "f = f'" and "g = g'" shows "f \ g = f' \\<^sub>B g'" using assms comp_char ext ext not_arr_null by auto lemma comp_eqI' [intro]: assumes "seq f g" and "f = f'" and "g = g'" shows "f \\<^sub>B g = f' \ g'" using assms comp_char ext ext not_arr_null by auto lemma hcomp_eqI [intro]: assumes "hseq f g" and "f = f'" and "g = g'" shows "f \ g = f' \\<^sub>B g'" using assms hcomp_char not_arr_null by auto lemma hcomp_eqI' [intro]: assumes "hseq f g" and "f = f'" and "g = g'" shows "f \\<^sub>B g = f' \ g'" using assms hcomp_char not_arr_null by auto lemma arr_compI: assumes "seq f g" shows "arr (f \\<^sub>B g)" using assms seq_char dom_char cod_char by (metis (no_types, lifting) comp_simp) lemma arr_hcompI: assumes "hseq f g" shows "arr (f \\<^sub>B g)" using assms hseq_char src_def trg_def hcomp_eqI' by auto end sublocale subbicategory \ bicategory \(\)\ \(\)\ \ \ src trg using is_bicategory by auto subsection "The Sub-bicategory of Endo-arrows of an Object" text \ We now consider the sub-bicategory consisting of all arrows having the same object \a\ both as their source and their target and we show that the resulting structure is a monoidal category. We actually prove a slightly more general result, in which the unit of the monoidal category is taken to be an arbitrary isomorphism \\\ : w \\<^sub>B w \ w\\ with \w\ isomorphic to \a\, rather than the particular choice \\\[a] : a \\<^sub>B a \ a\\ made by the ambient bicategory. \ locale subbicategory_at_object = B: bicategory V H \\<^sub>B \ src\<^sub>B trg\<^sub>B + subbicategory V H \\<^sub>B \ src\<^sub>B trg\<^sub>B \\\. B.arr \ \ src\<^sub>B \ = a \ trg\<^sub>B \ = a\ for V :: "'a comp" (infixr "\\<^sub>B" 55) and H :: "'a comp" (infixr "\\<^sub>B" 55) and \\<^sub>B :: "'a \ 'a \ 'a \ 'a" ("\\<^sub>B[_, _, _]") and \ :: "'a \ 'a" ("\[_]") and src\<^sub>B :: "'a \ 'a" and trg\<^sub>B :: "'a \ 'a" and a :: "'a" and w :: "'a" and \ :: "'a" + assumes obj_a: "B.obj a" and isomorphic_a_w: "B.isomorphic a w" and \_in_vhom: "\\ : w \\<^sub>B w \ w\" and \_is_iso: "B.iso \" begin notation hcomp (infixr "\" 53) lemma arr_simps: assumes "arr \" shows "src \ = a" and "trg \ = a" apply (metis (no_types, lifting) arrE assms src_def) by (metis (no_types, lifting) arrE assms trg_def) lemma \_simps [simp]: shows "arr \" and "src \ = a" and "trg \ = a" and "dom \ = w \\<^sub>B w" and "cod \ = w" using isomorphic_a_w \_in_vhom in_hom_char arr_simps by auto lemma ide_w: shows "B.ide w" using isomorphic_a_w B.isomorphic_def by auto lemma w_simps [simp]: shows "ide w" and "B.ide w" and "src w = a" and "trg w = a" and "src\<^sub>B w = a" and "trg\<^sub>B w = a" and "dom w = w" and "cod w = w" proof - show w: "ide w" using \_in_vhom ide_cod by blast show "B.ide w" using w ide_char by simp obtain \ where \: "\\ : a \\<^sub>B w\ \ B.iso \" using isomorphic_a_w B.isomorphic_def by auto show "src\<^sub>B w = a" using obj_a w \ B.src_cod by force show "trg\<^sub>B w = a" using obj_a w \ B.src_cod by force show "src w = a" using \src\<^sub>B w = a\ w ide_w src_def by simp show "trg w = a" using \src\<^sub>B w = a\ w ide_w trg_def by (simp add: \trg\<^sub>B w = a\) show "dom w = w" using w by simp show "cod w = w" using w by simp qed lemma VxV_arr_eq_VV_arr: shows "VxV.arr f \ VV.arr f" using inclusion VxV.arr_char VV.arr_char arr_char src_def trg_def by auto lemma VxV_comp_eq_VV_comp: shows "VxV.comp = VV.comp" proof - have "\f g. VxV.comp f g = VV.comp f g" proof - fix f g show "VxV.comp f g = VV.comp f g" unfolding VV.comp_def using VxV.comp_char arr_simps(1) arr_simps(2) apply (cases "seq (fst f) (fst g)", cases "seq (snd f) (snd g)") by (elim seqE) auto qed thus ?thesis by blast qed lemma VxVxV_arr_eq_VVV_arr: shows "VxVxV.arr f \ VVV.arr f" using VVV.arr_char VV.arr_char src_def trg_def inclusion arr_char by auto lemma VxVxV_comp_eq_VVV_comp: shows "VxVxV.comp = VVV.comp" proof - have "\f g. VxVxV.comp f g = VVV.comp f g" proof - fix f g show "VxVxV.comp f g = VVV.comp f g" proof (cases "VxVxV.seq f g") assume 1: "\ VxVxV.seq f g" have "VxVxV.comp f g = VxVxV.null" using 1 VxVxV.ext by blast also have "... = (null, null, null)" using VxVxV.null_char VxV.null_char by simp also have "... = VVV.null" using VVV.null_char VV.null_char by simp also have "... = VVV.comp f g" proof - have "\ VVV.seq f g" using 1 VVV.seq_char by blast thus ?thesis by (metis (no_types, lifting) VVV.ext) qed finally show ?thesis by simp next assume 1: "VxVxV.seq f g" have 2: "B.arr (fst f) \ B.arr (fst (snd f)) \ B.arr (snd (snd f)) \ src\<^sub>B (fst f) = a \ src\<^sub>B (fst (snd f)) = a \ src\<^sub>B (snd (snd f)) = a \ trg\<^sub>B (fst f) = a \ trg\<^sub>B (fst (snd f)) = a \ trg\<^sub>B (snd (snd f)) = a" using 1 VxVxV.seq_char VxV.seq_char arr_char by blast have 3: "B.arr (fst g) \ B.arr (fst (snd g)) \ B.arr (snd (snd g)) \ src\<^sub>B (fst g) = a \ src\<^sub>B (fst (snd g)) = a \ src\<^sub>B (snd (snd g)) = a \ trg\<^sub>B (fst g) = a \ trg\<^sub>B (fst (snd g)) = a \ trg\<^sub>B (snd (snd g)) = a" using 1 VxVxV.seq_char VxV.seq_char arr_char by blast have 4: "B.seq (fst f) (fst g) \ B.seq (fst (snd f)) (fst (snd g)) \ B.seq (snd (snd f)) (snd (snd g))" using 1 VxVxV.seq_char VxV.seq_char seq_char by blast have 5: "VxVxV.comp f g = (fst f \ fst g, fst (snd f) \ fst (snd g), snd (snd f) \ snd (snd g))" using 1 2 3 4 VxVxV.seqE VxVxV.comp_char VxV.comp_char seq_char arr_char by (metis (no_types, lifting)) also have "... = VVV.comp f g" using 1 VVV.comp_char VVV.arr_char VV.arr_char apply simp using 2 3 5 arrI arr_simps(1) arr_simps(2) by presburger finally show ?thesis by blast qed qed thus ?thesis by blast qed interpretation H: "functor" VxV.comp \(\)\ \\\\. fst \\ \ snd \\\ using H.functor_axioms hcomp_def VxV_comp_eq_VV_comp by simp interpretation H: binary_endofunctor \(\)\ \\\\. fst \\ \ snd \\\ .. lemma HoHV_eq_ToTC: shows "HoHV = H.ToTC" using HoHV_def H.ToTC_def VVV.arr_char VV.arr_char src_def trg_def inclusion arr_char by auto lemma HoVH_eq_ToCT: shows "HoVH = H.ToCT" using HoVH_def H.ToCT_def VVV.arr_char VV.arr_char src_def trg_def inclusion arr_char by auto interpretation ToTC: "functor" VxVxV.comp \(\)\ H.ToTC using HoHV_eq_ToTC VxVxV_comp_eq_VVV_comp HoHV.functor_axioms by simp interpretation ToCT: "functor" VxVxV.comp \(\)\ H.ToCT using HoVH_eq_ToCT VxVxV_comp_eq_VVV_comp HoVH.functor_axioms by simp interpretation \: natural_isomorphism VxVxV.comp \(\)\ H.ToTC H.ToCT \ unfolding \_def using \.natural_isomorphism_axioms HoHV_eq_ToTC HoVH_eq_ToCT \_def VxVxV_comp_eq_VVV_comp by simp interpretation L: endofunctor \(\)\ \\f. fst (w, f) \ snd (w, f)\ proof fix f show "\ arr f \ fst (w, f) \ snd (w, f) = null" using arr_char hcomp_def by auto assume f: "arr f" show "hseq (fst (w, f)) (snd (w, f))" using f hseq_char arr_char src_def trg_def \_in_vhom cod_char by simp show "dom (fst (w, f) \ snd (w, f)) = fst (w, dom f) \ snd (w, dom f)" using f arr_char hcomp_def dom_simp by simp show "cod (fst (w, f) \ snd (w, f)) = fst (w, cod f) \ snd (w, cod f)" using f arr_char hcomp_def cod_simp by simp next fix f g assume fg: "seq g f" show "fst (w, g \ f) \ snd (w, g \ f) = (fst (w, g) \ snd (w, g)) \ (fst (w, f) \ snd (w, f))" by (simp add: fg whisker_left) qed interpretation L': equivalence_functor \(\)\ \(\)\ \\f. fst (w, f) \ snd (w, f)\ proof - obtain \ where \: "\\ : w \\<^sub>B a\ \ B.iso \" using isomorphic_a_w B.isomorphic_symmetric by force have "\\ : w \ a\" using \ in_hom_char by (metis (no_types, lifting) B.in_homE B.src_cod B.src_src B.trg_cod B.trg_trg \_in_vhom arr_char arr_cod cod_simp) hence \: "\\ : w \\<^sub>B a\ \ B.iso \ \ \\ : w \ a\ \ iso \" using \ iso_char arr_char by auto interpret \: natural_isomorphism \(\)\ \(\)\ \\f. fst (w, f) \ snd (w, f)\ map \\f. \ f \ (\ \ dom f)\ proof fix \ show "\ arr \ \ \ \ \ (\ \ dom \) = null" using \ arr_char dom_char ext apply simp using comp_null(2) hcomp_def by fastforce assume \: "arr \" have 0: "in_hhom (dom \) a a" using \ arr_char src_dom trg_dom src_def trg_def dom_simp by simp have 1: "in_hhom \ a a" using \ arr_char src_dom trg_dom src_def trg_def by auto have 2: "hseq \ (B.dom \)" using \ 0 1 dom_simp by (intro hseqI) auto have 3: "seq (\ \) (\ \ dom \)" proof (intro seqI') show "\\ \ dom \ : w \ dom \ \ a \ dom \\" by (metis (no_types, lifting) 0 \ \ hcomp_in_vhom ide_dom ide_in_hom(2) in_hhom_def w_simps(3)) show "\\ \ : a \ dom \ \ cod \\" using \ 2 \.preserves_hom [of \ "dom \" "cod \"] arr_simps(2) arr_cod by fastforce qed show "dom (\ \ \ (\ \ dom \)) = fst (w, dom \) \ snd (w, dom \)" proof - have "dom (\ \ \ (\ \ dom \)) = dom \ \ dom \" using \ 3 hcomp_simps(3) dom_comp dom_dom apply (elim seqE) by auto also have "... = fst (w, dom \) \ snd (w, dom \)" using \_in_vhom \ by (metis (no_types, lifting) in_homE prod.sel(1) prod.sel(2)) finally show ?thesis by simp qed show "cod (\ \ \ (\ \ dom \)) = map (cod \)" proof - have "seq (\ \) (\ \ dom \)" using 3 by simp hence "cod (\ \ \ (\ \ dom \)) = cod (\ \)" using cod_comp by blast also have "... = map (cod \)" using \ by blast finally show ?thesis by blast qed show "map \ \ \ (dom \) \ (\ \ dom (dom \)) = \ \ \ (\ \ dom \)" proof - have "map \ \ \ (dom \) \ (\ \ dom (dom \)) = (map \ \ \ (dom \)) \ (\ \ dom \)" using \ comp_assoc by simp also have "... = \ \ \ (\ \ dom \)" using \ \ \.is_natural_1 by auto finally show ?thesis by blast qed show "(\ (cod \) \ (\ \ dom (cod \))) \ (fst (w, \) \ snd (w, \)) = \ \ \ (\ \ dom \)" proof - have "(\ (cod \) \ (\ \ dom (cod \))) \ (fst (w, \) \ snd (w, \)) = (\ (cod \) \ (\ \ B.cod \)) \ (w \ \)" using \ \ dom_char arr_char \_in_vhom cod_simp by simp also have "... = \ (cod \) \ (\ \ w \ B.cod \ \ \)" proof - have "seq \ w" using \ \_in_vhom w_simps(1) by blast moreover have 2: "seq (B.cod \) \" using \ seq_char cod_simp by (simp add: comp_cod_arr) moreover have "src \ = trg (B.cod \)" using \ \ 2 by (metis (no_types, lifting) arr_simps(2) seqE vconn_implies_hpar(1) w_simps(3)) ultimately show ?thesis using interchange comp_assoc by simp qed also have "... = \ (cod \) \ (\ \ \)" using \ \ \_in_vhom comp_arr_dom comp_cod_arr cod_simp apply (elim conjE in_homE) by auto also have "... = (\ (cod \) \ (cod \ \ \)) \ (\ \ dom \)" proof - have 1: "seq (cod \) \" using \ arr_cod_iff_arr dom_cod iso_is_arr seqI by presburger moreover have 2: "seq \ (dom \)" using \ by (simp add: comp_arr_dom) moreover have "src (cod \) = trg \" using \ \ arr_cod arr_simps(1-2) iso_is_arr by auto ultimately show ?thesis using 1 2 interchange [of "cod \" \ \ "dom \"] comp_arr_dom comp_cod_arr comp_assoc by fastforce qed also have "... = \ \ \ (\ \ dom \)" proof - have "L \ = cod \ \ \" using \ \ arr_simps(2) in_homE by auto hence "\ (cod \) \ (cod \ \ \) = \ \" using \ \.is_natural_2 [of \] by simp thus ?thesis by simp qed finally show ?thesis by simp qed next show "\f. ide f \ iso (\ f \ (\ \ dom f))" proof - fix f assume f: "ide f" have "iso (\ f)" using f iso_lunit by simp moreover have "iso (\ \ dom f)" using \ f src_def trg_def ide_char arr_char apply (intro iso_hcomp, simp_all) by (metis (no_types, lifting) in_homE) moreover have "seq (\ f) (\ \ dom f)" proof (intro seqI') show " \\ f : a \ f \ f\" using f lunit_in_hom(2) \_ide_simp ide_char arr_char trg_def by simp show "\\ \ dom f : w \ f \ a \ f\" using \ f ide_char arr_char hcomp_def src_def trg_def obj_a ide_in_hom in_hom_char by (intro hcomp_in_vhom, auto) qed ultimately show "iso (\ f \ (\ \ dom f))" using isos_compose by simp qed qed show "equivalence_functor (\) (\) (\f. fst (w, f) \ snd (w, f))" using \.natural_isomorphism_axioms L.isomorphic_to_identity_is_equivalence by simp qed interpretation L: equivalence_functor \(\)\ \(\)\ \\f. fst (cod \, f) \ snd (cod \, f)\ proof - have "(\f. fst (cod \, f) \ snd (cod \, f)) = (\f. fst (w, f) \ snd (w, f))" using \_in_vhom by simp thus "equivalence_functor (\) (\) (\f. fst (cod \, f) \ snd (cod \, f))" using L'.equivalence_functor_axioms by simp qed interpretation R: endofunctor \(\)\ \\f. fst (f, w) \ snd (f, w)\ proof fix f show "\ arr f \ fst (f, w) \ snd (f, w) = null" using arr_char hcomp_def by auto assume f: "arr f" show "hseq (fst (f, w)) (snd (f, w))" using f hseq_char arr_char src_def trg_def \_in_vhom cod_char isomorphic_a_w B.isomorphic_def in_hom_char by simp show "dom (fst (f, w) \ snd (f, w)) = fst (dom f, w) \ snd (dom f, w)" using f arr_char dom_char cod_char hcomp_def \_in_vhom by simp show "cod (fst (f, w) \ snd (f, w)) = fst (cod f, w) \ snd (cod f, w)" using f arr_char dom_char cod_char hcomp_def \_in_vhom by simp next fix f g assume fg: "seq g f" have 1: "a \\<^sub>B a = a" using obj_a by auto show "fst (g \ f, w) \ snd (g \ f, w) = (fst (g, w) \ snd (g, w)) \ (fst (f, w) \ snd (f, w))" by (simp add: fg whisker_right) qed interpretation R': equivalence_functor \(\)\ \(\)\ \\f. fst (f, w) \ snd (f, w)\ proof - obtain \ where \: "\\ : w \\<^sub>B a\ \ B.iso \" using isomorphic_a_w B.isomorphic_symmetric by force have "\\ : w \ a\" using \ in_hom_char by (metis (no_types, lifting) B.in_homE B.src_cod B.src_src B.trg_cod B.trg_trg \_in_vhom arr_char arr_cod cod_simp) hence \: "\\ : w \\<^sub>B a\ \ B.iso \ \ \\ : w \ a\ \ iso \" using \ iso_char arr_char by auto interpret \: natural_isomorphism comp comp \\f. fst (f, w) \ snd (f, w)\ map \\f. \ f \ (dom f \ \)\ proof fix \ show "\ arr \ \ \ \ \ (dom \ \ \) = null" using \ arr_char dom_char ext apply simp using comp_null(2) hcomp_def by fastforce assume \: "arr \" have 0: "in_hhom (dom \) a a" using \ arr_char src_dom trg_dom src_def trg_def dom_simp by simp have 1: "in_hhom \ a a" using \ arr_char src_dom trg_dom src_def trg_def by auto have 2: "hseq (B.dom \) \" using \ 0 1 dom_simp hseqI by auto have 3: "seq (\ \) (dom \ \ \)" proof (intro seqI') show "\dom \ \ \ : dom \ \ w \ dom \ \ a\" by (metis (no_types, lifting) "0" "1" \ \ hcomp_in_vhom hseqI hseq_char ide_dom ide_in_hom(2) vconn_implies_hpar(2)) show "\\ \ : dom \ \ a \ cod \\" using \ 2 \.preserves_hom [of \ "dom \" "cod \"] arr_simps(2) arr_cod dom_simp cod_simp by fastforce qed show "dom (\ \ \ (dom \ \ \)) = fst (dom \, w) \ snd (dom \, w)" proof - have "dom (\ \ \ (dom \ \ \)) = dom \ \ dom \" using \ 3 hcomp_simps(3) dom_comp dom_dom apply (elim seqE) by auto also have "... = fst (dom \, w) \ snd (dom \, w)" using \_in_vhom \ by (metis (no_types, lifting) in_homE prod.sel(1) prod.sel(2)) finally show ?thesis by simp qed show "cod (\ \ \ (dom \ \ \)) = map (cod \)" proof - have "seq (\ \) (dom \ \ \)" using 3 by simp hence "cod (\ \ \ (dom \ \ \)) = cod (\ \)" using cod_comp by blast also have "... = map (cod \)" using \ by blast finally show ?thesis by blast qed show "map \ \ \ (dom \) \ (dom (dom \) \ \) = \ \ \ (dom \ \ \)" proof - have "map \ \ \ (dom \) \ (dom (dom \) \ \) = (map \ \ \ (dom \)) \ (dom (dom \) \ \)" using comp_assoc by simp also have "... = (map \ \ \ (dom \)) \ (dom \ \ \)" using \ dom_dom by simp also have "... = \ \ \ (dom \ \ \)" using \ \ \.is_natural_1 by auto finally show ?thesis by blast qed show "(\ (cod \) \ (dom (cod \) \ \)) \ (fst (\, w) \ snd (\, w)) = \ \ \ (dom \ \ \)" proof - have "(\ (cod \) \ (dom (cod \) \ \)) \ (fst (\, w) \ snd (\, w)) = (\ (cod \) \ (B.cod \ \ \)) \ (\ \ w)" using \ \ dom_char arr_char \_in_vhom cod_simp by simp also have "... = \ (cod \) \ (B.cod \ \ \ \ \ \ w)" proof - have 2: "seq \ w" using \ \_in_vhom w_simps(1) by blast moreover have "seq (B.cod \) \" using \ seq_char cod_simp by (simp add: comp_cod_arr) moreover have "src (B.cod \) = trg \" using \ \ 2 using arr_simps(1) calculation(2) seq_char vconn_implies_hpar(2) by force ultimately show ?thesis using interchange comp_assoc by simp qed also have "... = \ (cod \) \ (\ \ \)" using \ \ \_in_vhom comp_arr_dom comp_cod_arr cod_simp apply (elim conjE in_homE) by auto also have "... = (\ (cod \) \ (\ \ cod \)) \ (dom \ \ \)" proof - have "(\ \ cod \) \ (dom \ \ \) = \ \ \" proof - have "seq \ (dom \)" using \ by (simp add: comp_arr_dom) moreover have "seq (cod \) \" using \ iso_is_arr arr_cod dom_cod by auto moreover have "src \ = trg (cod \)" using \ \ 2 by (metis (no_types, lifting) arr_simps(1) arr_simps(2) calculation(2) seqE) ultimately show ?thesis using \ \ iso_is_arr comp_arr_dom comp_cod_arr interchange [of \ "dom \" "cod \" \] by simp qed thus ?thesis using comp_assoc by simp qed also have "... = \ \ \ (dom \ \ \)" proof - have "\ \ cod \ = R \" using \ \ arr_simps(1) in_homE by auto hence "\ (cod \) \ (\ \ cod \) = \ \" using \ \ \.is_natural_2 by simp thus ?thesis by simp qed finally show ?thesis by simp qed next show "\f. ide f \ iso (\ f \ (dom f \ \))" proof - fix f assume f: "ide f" have 1: "iso (\ f)" using f iso_lunit by simp moreover have 2: "iso (dom f \ \)" using \ f src_def trg_def ide_char arr_char apply (intro iso_hcomp, simp_all) by (metis (no_types, lifting) in_homE) moreover have "seq (\ f) (dom f \ \)" proof (intro seqI') show "\\ f : f \ a \ f\" using f runit_in_hom(2) \_ide_simp ide_char arr_char src_def by simp show "\dom f \ \ : f \ w \ f \ a\" using \ f ide_char arr_char hcomp_def src_def trg_def obj_a ide_in_hom in_hom_char by (intro hcomp_in_vhom, auto) qed ultimately show "iso (\ f \ (dom f \ \))" - using isos_compose by simp + using isos_compose by blast qed qed show "equivalence_functor (\) (\) (\f. fst (f, w) \ snd (f, w))" using \.natural_isomorphism_axioms R.isomorphic_to_identity_is_equivalence by simp qed interpretation R: equivalence_functor \(\)\ \(\)\ \\f. fst (f, cod \) \ snd (f, cod \)\ proof - have "(\f. fst (f, cod \) \ snd (f, cod \)) = (\f. fst (f, w) \ snd (f, w))" using \_in_vhom by simp thus "equivalence_functor (\) (\) (\f. fst (f, cod \) \ snd (f, cod \))" using R'.equivalence_functor_axioms by simp qed interpretation M: monoidal_category \(\)\ \\\\. fst \\ \ snd \\\ \ \ proof show "\\ : fst (cod \, cod \) \ snd (cod \, cod \) \ cod \\" using \_in_vhom hcomp_def arr_char by auto show "iso \" using \_is_iso iso_char arr_char inv_char \_in_vhom by auto show "\f g h k. \ ide f; ide g; ide h; ide k \ \ (fst (f, \ (g, h, k)) \ snd (f, \ (g, h, k))) \ \ (f, hcomp (fst (g, h)) (snd (g, h)), k) \ (fst (\ (f, g, h), k) \ snd (\ (f, g, h), k)) = \ (f, g, fst (h, k) \ snd (h, k)) \ \ (fst (f, g) \ snd (f, g), h, k)" proof - fix f g h k assume f: "ide f" and g: "ide g" and h: "ide h" and k: "ide k" have 1: "VVV.arr (f, g, h) \ VVV.arr (g, h, k)" using f g h k VVV.arr_char VV.arr_char src_def trg_def ide_char arr_char by simp have 2: "VVV.arr (f, g \ h, k)" using f g h k 1 HoHV_def VVV.arr_char VV.arr_char src_def trg_def ide_char arr_char VxV.arrI VxVxV.arrI VxVxV_comp_eq_VVV_comp hseqI' by auto have 3: "VVV.arr (f, g, h \ k)" using f g h k 1 VVV.arr_char VV.arr_char src_def trg_def ide_char arr_char VxV.arrI VxVxV.arrI VxVxV_comp_eq_VVV_comp H.preserves_reflects_arr hseqI' by auto have 4: "VVV.arr (f \ g, h, k)" using f g h k VVV.arr_char VV.arr_char src_def trg_def ide_char arr_char hseq_char VxV.arrI VxVxV.arrI VxVxV_comp_eq_VVV_comp by force have "(fst (f, \ (g, h, k)) \ snd (f, \ (g, h, k))) \ \ (f, fst (g, h) \ snd (g, h), k) \ (fst (\ (f, g, h), k) \ snd (\ (f, g, h), k)) = (f \ \\<^sub>B[g, h, k]) \ \\<^sub>B[f, g \ h, k] \ (\\<^sub>B[f, g, h] \ k)" unfolding \_def by (simp add: 1 2) also have "... = (f \\<^sub>B \\<^sub>B g h k) \ \\<^sub>B f (g \\<^sub>B h) k \ (\\<^sub>B f g h \\<^sub>B k)" unfolding hcomp_def using f g h k src_def trg_def arr_char using assoc_closed ide_char by auto also have "... = (f \\<^sub>B \\<^sub>B g h k) \\<^sub>B \\<^sub>B f (g \\<^sub>B h) k \\<^sub>B (\\<^sub>B f g h \\<^sub>B k)" proof - have "arr (f \\<^sub>B \\<^sub>B g h k)" using ide_char arr_char assoc_closed f g h hcomp_closed k by simp moreover have "arr (\\<^sub>B f (g \\<^sub>B h) k)" using ide_char arr_char assoc_closed f g h hcomp_closed k by simp moreover have "arr (\\<^sub>B f g h \\<^sub>B k)" using ide_char arr_char assoc_closed f g h hcomp_closed k by simp moreover have "arr (\\<^sub>B f (g \\<^sub>B h) k \\<^sub>B (\\<^sub>B f g h \\<^sub>B k))" unfolding arr_char apply (intro conjI) using ide_char arr_char assoc_closed f g h hcomp_closed k B.HoHV_def B.HoVH_def apply (intro B.seqI) apply simp_all proof - have 1: "B.arr (\\<^sub>B f (g \\<^sub>B h) k \\<^sub>B \\<^sub>B f g h \\<^sub>B k)" using f g h k ide_char arr_char B.HoHV_def B.HoVH_def apply (intro B.seqI) by auto show "src\<^sub>B (\\<^sub>B f (g \\<^sub>B h) k \\<^sub>B \\<^sub>B f g h \\<^sub>B k) = a" using 1 f g h k arr_char B.src_vcomp B.vseq_implies_hpar(1) by fastforce show "trg\<^sub>B (\\<^sub>B f (g \\<^sub>B h) k \\<^sub>B \\<^sub>B f g h \\<^sub>B k) = a" using "1" arr_char calculation(2-3) by auto qed ultimately show ?thesis using B.ext comp_char by (metis (no_types, lifting)) qed also have "... = \\<^sub>B f g (h \\<^sub>B k) \\<^sub>B \\<^sub>B (f \\<^sub>B g) h k" using f g h k src_def trg_def arr_char ide_char B.pentagon using "4" \_def hcomp_def by auto also have "... = \\<^sub>B f g (h \\<^sub>B k) \ \\<^sub>B (f \\<^sub>B g) h k" proof - have "arr (\\<^sub>B (f \\<^sub>B g) h k)" using ide_char arr_char assoc_closed f g h hcomp_closed k by simp moreover have "arr (\\<^sub>B f g (h \\<^sub>B k))" using ide_char arr_char assoc_closed f g h hcomp_closed k by fastforce ultimately show ?thesis using B.ext comp_char by auto qed also have "... = \\<^sub>B[f, g, fst (h, k) \ snd (h, k)] \ \\<^sub>B[fst (f, g) \ snd (f, g), h, k]" unfolding hcomp_def using f g h k src_def trg_def arr_char ide_char by simp also have "... = \ (f, g, fst (h, k) \ snd (h, k)) \ \ (fst (f, g) \ snd (f, g), h, k)" unfolding \_def using 1 2 3 4 by simp finally show "(fst (f, \ (g, h, k)) \ snd (f, \ (g, h, k))) \ \ (f, fst (g, h) \ snd (g, h), k) \ (fst (\ (f, g, h), k) \ snd (\ (f, g, h), k)) = \ (f, g, fst (h, k) \ snd (h, k)) \ \ (fst (f, g) \ snd (f, g), h, k)" by simp qed qed proposition is_monoidal_category: shows "monoidal_category (\) (\\\. fst \\ \ snd \\) \ \" .. end text \ In a bicategory, the ``objects'' are essentially arbitrarily chosen representatives of their isomorphism classes. Choosing any other representatives results in an equivalent structure. Each object \a\ is additionally equipped with an arbitrarily chosen unit isomorphism \\\ : a \ a \ a\\. For any \(a, \)\ and \(a', \')\, where \a\ and \a'\ are isomorphic to the same object, there exists a unique isomorphism \\\: a \ a'\\ that is compatible with the chosen unit isomorphisms \\\ and \\'\. We have already proved this property for monoidal categories, which are bicategories with just one ``object''. Here we use that already-proven property to establish its generalization to arbitary bicategories, by exploiting the fact that if \a\ is an object in a bicategory, then the sub-bicategory consisting of all \\\ such that \src \ = a = trg \\, is a monoidal category. At some point it would potentially be nicer to transfer the proof for monoidal categories to obtain a direct, ``native'' proof of this fact for bicategories. \ lemma (in bicategory) unit_unique_upto_unique_iso: assumes "obj a" and "isomorphic a w" and "\\ : w \ w \ w\" and "iso \" shows "\!\. \\ : a \ w\ \ iso \ \ \ \ \[a] = \ \ (\ \ \)" proof - have \_in_hhom: "\\ : a \ a\" using assms apply (intro in_hhomI) apply auto apply (metis src_cod in_homE isomorphic_implies_hpar(3) objE) by (metis trg_cod in_homE isomorphic_implies_hpar(4) objE) interpret S: subbicategory V H \ \ src trg \\\. arr \ \ src \ = a \ trg \ = a\ using assms iso_unit in_homE isoE isomorphicE VVV.arr_char VV.arr_char apply unfold_locales apply auto[7] proof fix f g h assume f: "(arr f \ src f = a \ trg f = a) \ ide f" and g: "(arr g \ src g = a \ trg g = a) \ ide g" and h: "(arr h \ src h = a \ trg h = a) \ ide h" and fg: "src f = trg g" and gh: "src g = trg h" show "arr (\[f, g, h])" using assms f g h fg gh by auto show "src (\[f, g, h]) = a \ trg (\[f, g, h]) = a" using assms f g h fg gh by auto show "arr (inv (\[f, g, h])) \ src (inv (\[f, g, h])) = a \ trg (inv (\[f, g, h])) = a" using assms f g h fg gh \.preserves_hom src_dom trg_dom by simp next fix f assume f: "arr f \ src f = a \ trg f = a" assume ide_left: "ide f" show "arr (\ f) \ src (\ f) = a \ trg (\ f) = a" using f assms(1) \.preserves_hom src_cod [of "\ f"] trg_cod [of "\ f"] by simp show "arr (inv (\ f)) \ src (inv (\ f)) = a \ trg (inv (\ f)) = a" using f ide_left assms(1) \'.preserves_hom src_dom [of "\'.map f"] trg_dom [of "\'.map f"] by simp show "arr (\ f) \ src (\ f) = a \ trg (\ f) = a" using f assms(1) \.preserves_hom src_cod [of "\ f"] trg_cod [of "\ f"] by simp show "arr (inv (\ f)) \ src (inv (\ f)) = a \ trg (inv (\ f)) = a" using f ide_left assms(1) \'.preserves_hom src_dom [of "\'.map f"] trg_dom [of "\'.map f"] by simp qed interpret S: subbicategory_at_object V H \ \ src trg a a \\[a]\ proof show "obj a" by fact show "isomorphic a a" using assms(1) isomorphic_reflexive by blast show "S.in_hom \[a] (a \ a) a" using S.arr_char S.in_hom_char assms(1) by fastforce show "iso \[a]" using assms iso_unit by simp qed interpret S\<^sub>\: subbicategory_at_object V H \ \ src trg a w \ proof show "obj a" by fact show "iso \" by fact show "isomorphic a w" using assms by simp show "S.in_hom \ (w \ w) w" using assms S.arr_char S.dom_char S.cod_char \_in_hhom by (intro S.in_homI, auto) qed interpret M: monoidal_category S.comp \\\\. S.hcomp (fst \\) (snd \\)\ S.\ \\[a]\ using S.is_monoidal_category by simp interpret M\<^sub>\: monoidal_category S.comp \\\\. S.hcomp (fst \\) (snd \\)\ S.\ \ using S\<^sub>\.is_monoidal_category by simp interpret M: monoidal_category_with_alternate_unit S.comp \\\\. S.hcomp (fst \\) (snd \\)\ S.\ \\[a]\ \ .. have 1: "M\<^sub>\.unity = w" using assms M\<^sub>\.unity_def S.cod_char S.arr_char by (metis (no_types, lifting) S.in_homE S\<^sub>\.\_in_vhom) have 2: "M.unity = a" using assms M.unity_def S.cod_char S.arr_char by simp have "\!\. S.in_hom \ a w \ S.iso \ \ S.comp \ \[a] = S.comp \ (M.tensor \ \)" using assms 1 2 M.unit_unique_upto_unique_iso M.unity_def M\<^sub>\.unity_def S.cod_char by simp show "\!\. \\ : a \ w\ \ iso \ \ \ \ \[a] = \ \ (\ \ \)" proof - have 1: "\\. S.in_hom \ a w \ \\ : a \ w\" using assms S.in_hom_char S.arr_char by (metis (no_types, lifting) S.ideD(1) S.w_simps(1) S\<^sub>\.w_simps(1) in_homE src_dom trg_dom) moreover have "\\. S.in_hom \ a w \ S.iso \ \ iso \" using assms S.in_hom_char S.arr_char S.iso_char by auto moreover have "\\. S.in_hom \ a w \ M.tensor \ \ = \ \ \" using assms S.in_hom_char S.arr_char S.hcomp_def by simp moreover have "\\. S.in_hom \ a w \ S.comp \ \[a] = \ \ \[a]" using assms S.in_hom_char S.comp_char by auto moreover have "\\. S.in_hom \ a w \ S.comp \ (M.tensor \ \) = \ \ (\ \ \)" using assms S.in_hom_char S.arr_char S.hcomp_def S.comp_char S.dom_char S.cod_char by (metis (no_types, lifting) M\<^sub>\.arr_tensor S\<^sub>\.\_simps(1) calculation(3) ext) ultimately show ?thesis by (metis (no_types, lifting) M.unit_unique_upto_unique_iso M.unity_def M\<^sub>\.unity_def S.\_in_vhom S.in_homE S\<^sub>\.\_in_vhom) qed qed end diff --git a/thys/Category3/Adjunction.thy b/thys/Category3/Adjunction.thy --- a/thys/Category3/Adjunction.thy +++ b/thys/Category3/Adjunction.thy @@ -1,3190 +1,3187 @@ (* Title: Adjunction Author: Eugene W. Stark , 2016 Maintainer: Eugene W. Stark *) chapter Adjunction theory Adjunction imports Yoneda begin text\ This theory defines the notions of adjoint functor and adjunction in various ways and establishes their equivalence. The notions ``left adjoint functor'' and ``right adjoint functor'' are defined in terms of universal arrows. ``Meta-adjunctions'' are defined in terms of natural bijections between hom-sets, where the notion of naturality is axiomatized directly. ``Hom-adjunctions'' formalize the notion of adjunction in terms of natural isomorphisms of hom-functors. ``Unit-counit adjunctions'' define adjunctions in terms of functors equipped with unit and counit natural transformations that satisfy the usual ``triangle identities.'' The \adjunction\ locale is defined as the grand unification of all the definitions, and includes formulas that connect the data from each of them. It is shown that each of the definitions induces an interpretation of the \adjunction\ locale, so that all the definitions are essentially equivalent. Finally, it is shown that right adjoint functors are unique up to natural isomorphism. The reference \cite{Wikipedia-Adjoint-Functors} was useful in constructing this theory. \ section "Left Adjoint Functor" text\ ``@{term e} is an arrow from @{term "F x"} to @{term y}.'' \ locale arrow_from_functor = C: category C + D: category D + F: "functor" D C F for D :: "'d comp" (infixr "\\<^sub>D" 55) and C :: "'c comp" (infixr "\\<^sub>C" 55) and F :: "'d \ 'c" and x :: 'd and y :: 'c and e :: 'c + assumes arrow: "D.ide x \ C.in_hom e (F x) y" begin notation C.in_hom ("\_ : _ \\<^sub>C _\") notation D.in_hom ("\_ : _ \\<^sub>D _\") text\ ``@{term g} is a @{term[source=true] D}-coextension of @{term f} along @{term e}.'' \ definition is_coext :: "'d \ 'c \ 'd \ bool" where "is_coext x' f g \ \g : x' \\<^sub>D x\ \ f = e \\<^sub>C F g" end text\ ``@{term e} is a terminal arrow from @{term "F x"} to @{term y}.'' \ locale terminal_arrow_from_functor = arrow_from_functor D C F x y e for D :: "'d comp" (infixr "\\<^sub>D" 55) and C :: "'c comp" (infixr "\\<^sub>C" 55) and F :: "'d \ 'c" and x :: 'd and y :: 'c and e :: 'c + assumes is_terminal: "arrow_from_functor D C F x' y f \ (\!g. is_coext x' f g)" begin definition the_coext :: "'d \ 'c \ 'd" where "the_coext x' f = (THE g. is_coext x' f g)" lemma the_coext_prop: assumes "arrow_from_functor D C F x' y f" shows "\the_coext x' f : x' \\<^sub>D x\" and "f = e \\<^sub>C F (the_coext x' f)" by (metis assms is_coext_def is_terminal the_coext_def the_equality)+ lemma the_coext_unique: assumes "arrow_from_functor D C F x' y f" and "is_coext x' f g" shows "g = the_coext x' f" using assms is_terminal the_coext_def the_equality by metis end text\ A left adjoint functor is a functor \F: D \ C\ that enjoys the following universal coextension property: for each object @{term y} of @{term C} there exists an object @{term x} of @{term D} and an arrow \e \ C.hom (F x) y\ such that for any arrow \f \ C.hom (F x') y\ there exists a unique \g \ D.hom x' x\ such that @{term "f = C e (F g)"}. \ locale left_adjoint_functor = C: category C + D: category D + "functor" D C F for D :: "'d comp" (infixr "\\<^sub>D" 55) and C :: "'c comp" (infixr "\\<^sub>C" 55) and F :: "'d \ 'c" + assumes ex_terminal_arrow: "C.ide y \ (\x e. terminal_arrow_from_functor D C F x y e)" begin notation C.in_hom ("\_ : _ \\<^sub>C _\") notation D.in_hom ("\_ : _ \\<^sub>D _\") end section "Right Adjoint Functor" text\ ``@{term e} is an arrow from @{term x} to @{term "G y"}.'' \ locale arrow_to_functor = C: category C + D: category D + G: "functor" C D G for C :: "'c comp" (infixr "\\<^sub>C" 55) and D :: "'d comp" (infixr "\\<^sub>D" 55) and G :: "'c \ 'd" and x :: 'd and y :: 'c and e :: 'd + assumes arrow: "C.ide y \ D.in_hom e x (G y)" begin notation C.in_hom ("\_ : _ \\<^sub>C _\") notation D.in_hom ("\_ : _ \\<^sub>D _\") text\ ``@{term f} is a @{term[source=true] C}-extension of @{term g} along @{term e}.'' \ definition is_ext :: "'c \ 'd \ 'c \ bool" where "is_ext y' g f \ \f : y \\<^sub>C y'\ \ g = G f \\<^sub>D e" end text\ ``@{term e} is an initial arrow from @{term x} to @{term "G y"}.'' \ locale initial_arrow_to_functor = arrow_to_functor C D G x y e for C :: "'c comp" (infixr "\\<^sub>C" 55) and D :: "'d comp" (infixr "\\<^sub>D" 55) and G :: "'c \ 'd" and x :: 'd and y :: 'c and e :: 'd + assumes is_initial: "arrow_to_functor C D G x y' g \ (\!f. is_ext y' g f)" begin definition the_ext :: "'c \ 'd \ 'c" where "the_ext y' g = (THE f. is_ext y' g f)" lemma the_ext_prop: assumes "arrow_to_functor C D G x y' g" shows "\the_ext y' g : y \\<^sub>C y'\" and "g = G (the_ext y' g) \\<^sub>D e" by (metis assms is_initial is_ext_def the_equality the_ext_def)+ lemma the_ext_unique: assumes "arrow_to_functor C D G x y' g" and "is_ext y' g f" shows "f = the_ext y' g" using assms is_initial the_ext_def the_equality by metis end text\ A right adjoint functor is a functor \G: C \ D\ that enjoys the following universal extension property: for each object @{term x} of @{term D} there exists an object @{term y} of @{term C} and an arrow \e \ D.hom x (G y)\ such that for any arrow \g \ D.hom x (G y')\ there exists a unique \f \ C.hom y y'\ such that @{term "h = D e (G f)"}. \ locale right_adjoint_functor = C: category C + D: category D + "functor" C D G for C :: "'c comp" (infixr "\\<^sub>C" 55) and D :: "'d comp" (infixr "\\<^sub>D" 55) and G :: "'c \ 'd" + assumes initial_arrows_exist: "D.ide x \ (\y e. initial_arrow_to_functor C D G x y e)" begin notation C.in_hom ("\_ : _ \\<^sub>C _\") notation D.in_hom ("\_ : _ \\<^sub>D _\") end section "Various Definitions of Adjunction" subsection "Meta-Adjunction" text\ A ``meta-adjunction'' consists of a functor \F: D \ C\, a functor \G: C \ D\, and for each object @{term x} of @{term C} and @{term y} of @{term D} a bijection between \C.hom (F y) x\ to \D.hom y (G x)\ which is natural in @{term x} and @{term y}. The naturality is easy to express at the meta-level without having to resort to the formal baggage of ``set category,'' ``hom-functor,'' and ``natural isomorphism,'' hence the name. \ locale meta_adjunction = C: category C + D: category D + F: "functor" D C F + G: "functor" C D G for C :: "'c comp" (infixr "\\<^sub>C" 55) and D :: "'d comp" (infixr "\\<^sub>D" 55) and F :: "'d \ 'c" and G :: "'c \ 'd" and \ :: "'d \ 'c \ 'd" and \ :: "'c \ 'd \ 'c" + assumes \_in_hom: "\ D.ide y; C.in_hom f (F y) x \ \ D.in_hom (\ y f) y (G x)" and \_in_hom: "\ C.ide x; D.in_hom g y (G x) \ \ C.in_hom (\ x g) (F y) x" and \_\: "\ D.ide y; C.in_hom f (F y) x \ \ \ x (\ y f) = f" and \_\: "\ C.ide x; D.in_hom g y (G x) \ \ \ y (\ x g) = g" and \_naturality: "\ C.in_hom f x x'; D.in_hom g y' y; C.in_hom h (F y) x \ \ \ y' (f \\<^sub>C h \\<^sub>C F g) = G f \\<^sub>D \ y h \\<^sub>D g" begin notation C.in_hom ("\_ : _ \\<^sub>C _\") notation D.in_hom ("\_ : _ \\<^sub>D _\") text\ The naturality of @{term \} is a consequence of the naturality of @{term \} and the other assumptions. \ lemma \_naturality: assumes f: "\f : x \\<^sub>C x'\" and g: "\g : y' \\<^sub>D y\" and h: "\h : y \\<^sub>D G x\" shows "f \\<^sub>C \ x h \\<^sub>C F g = \ x' (G f \\<^sub>D h \\<^sub>D g)" using f g h \_naturality \_in_hom C.ide_dom D.ide_dom D.in_homE \_\ \_\ by (metis C.comp_in_homI' F.preserves_hom C.in_homE D.in_homE) lemma respects_natural_isomorphism: assumes "natural_isomorphism D C F' F \" and "natural_isomorphism C D G G' \" shows "meta_adjunction C D F' G' (\y f. \ (C.cod f) \\<^sub>D \ y (f \\<^sub>C inverse_transformation.map D C F \ y)) (\x g. \ x ((inverse_transformation.map C D G' \ x) \\<^sub>D g) \\<^sub>C \ (D.dom g))" proof - interpret \: natural_isomorphism D C F' F \ using assms(1) by simp interpret \': inverse_transformation D C F' F \ .. interpret \: natural_isomorphism C D G G' \ using assms(2) by simp interpret \': inverse_transformation C D G G' \ .. let ?\' = "\y f. \ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y)" let ?\' = "\x g. \ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g)" show "meta_adjunction C D F' G' ?\' ?\'" proof show "\y f x. \D.ide y; \f : F' y \\<^sub>C x\\ \ \\ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y) : y \\<^sub>D G' x\" proof - fix x y f assume y: "D.ide y" and f: "\f : F' y \\<^sub>C x\" show "\\ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y) : y \\<^sub>D G' x\" proof (intro D.comp_in_homI) show "\\ (C.cod f) : G x \\<^sub>D G' x\" using f by fastforce show "\\ y (f \\<^sub>C \'.map y) : y \\<^sub>D G x\" using f y \_in_hom by auto qed qed show "\x g y. \C.ide x; \g : y \\<^sub>D G' x\\ \ \\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g) : F' y \\<^sub>C x\" proof - fix x y g assume x: "C.ide x" and g: "\g : y \\<^sub>D G' x\" show "\\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g) : F' y \\<^sub>C x\" proof (intro C.comp_in_homI) show "\\ (D.dom g) : F' y \\<^sub>C F y\" using g by fastforce show "\\ x (\'.map x \\<^sub>D g) : F y \\<^sub>C x\" using x g \_in_hom by auto qed qed show "\y f x. \D.ide y; \f : F' y \\<^sub>C x\\ \ \ x (\'.map x \\<^sub>D \ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y)) \\<^sub>C \ (D.dom (\ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y))) = f" proof - fix x y f assume y: "D.ide y" and f: "\f : F' y \\<^sub>C x\" have 1: "\\ y (f \\<^sub>C \'.map y) : y \\<^sub>D G x\" using f y \_in_hom by auto show "\ x (\'.map x \\<^sub>D \ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y)) \\<^sub>C \ (D.dom (\ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y))) = f" proof - have "\ x (\'.map x \\<^sub>D \ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y)) \\<^sub>C \ (D.dom (\ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y))) = \ x ((\'.map x \\<^sub>D \ (C.cod f)) \\<^sub>D \ y (f \\<^sub>C \'.map y)) \\<^sub>C \ (D.dom (\ (C.cod f) \\<^sub>D \ y (f \\<^sub>C \'.map y)))" using D.comp_assoc by simp also have "... = \ x (\ y (f \\<^sub>C \'.map y)) \\<^sub>C \ y" - using f 1 - by (metis C.ide_cod C.in_homE C.seqE D.comp_inv_arr D.in_homE D.seqI - G.functor_axioms \'.inverts_components \.preserves_dom - \.preserves_reflects_arr category.comp_cod_arr category.dom_comp - functor_def) + by (metis "1" C.arr_cod C.dom_cod C.ide_cod C.in_homE D.comp_ide_arr D.dom_comp + D.ide_compE D.in_homE D.inverse_arrowsE \'.inverts_components \.preserves_dom + \.preserves_reflects_arr category.seqI f meta_adjunction_axioms + meta_adjunction_def) also have "... = f" using f y \_\ C.comp_assoc \'.inverts_components [of y] C.comp_arr_dom by fastforce finally show ?thesis by blast qed qed show "\x g y. \C.ide x; \g : y \\<^sub>D G' x\\ \ \ (C.cod (\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g))) \\<^sub>D \ y ((\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g)) \\<^sub>C \'.map y) = g" proof - fix x y g assume x: "C.ide x" and g: "\g : y \\<^sub>D G' x\" have 1: "\\ x (\'.map x \\<^sub>D g) : F y \\<^sub>C x\" using x g \_in_hom by auto show "\ (C.cod (\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g))) \\<^sub>D \ y ((\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g)) \\<^sub>C \'.map y) = g" proof - have "\ (C.cod (\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g))) \\<^sub>D \ y ((\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g)) \\<^sub>C \'.map y) = \ (C.cod (\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g))) \\<^sub>D \ y (\ x (\'.map x \\<^sub>D g) \\<^sub>C \ (D.dom g) \\<^sub>C \'.map y)" using C.comp_assoc by simp also have "... = \ x \\<^sub>D \ y (\ x (\'.map x \\<^sub>D g))" using 1 C.comp_arr_dom C.comp_arr_inv' g by fastforce also have "... = (\ x \\<^sub>D \'.map x) \\<^sub>D g" using x g \_\ D.comp_assoc by auto also have "... = g" using x g \'.inverts_components [of x] D.comp_cod_arr by fastforce finally show ?thesis by blast qed qed show "\f x x' g y' y h. \\f : x \\<^sub>C x'\; \g : y' \\<^sub>D y\; \h : F' y \\<^sub>C x\\ \ \ (C.cod (f \\<^sub>C h \\<^sub>C F' g)) \\<^sub>D \ y' ((f \\<^sub>C h \\<^sub>C F' g) \\<^sub>C \'.map y') = G' f \\<^sub>D (\ (C.cod h) \\<^sub>D \ y (h \\<^sub>C \'.map y)) \\<^sub>D g" proof - fix x y x' y' f g h assume f: "\f : x \\<^sub>C x'\" and g: "\g : y' \\<^sub>D y\" and h: "\h : F' y \\<^sub>C x\" show "\ (C.cod (f \\<^sub>C h \\<^sub>C F' g)) \\<^sub>D \ y' ((f \\<^sub>C h \\<^sub>C F' g) \\<^sub>C \'.map y') = G' f \\<^sub>D (\ (C.cod h) \\<^sub>D \ y (h \\<^sub>C \'.map y)) \\<^sub>D g" proof - have "\ (C.cod (f \\<^sub>C h \\<^sub>C F' g)) \\<^sub>D \ y' ((f \\<^sub>C h \\<^sub>C F' g) \\<^sub>C \'.map y') = \ x' \\<^sub>D \ y' ((f \\<^sub>C h \\<^sub>C F' g) \\<^sub>C \'.map y')" using f g h by fastforce also have "... = \ x' \\<^sub>D \ y' (f \\<^sub>C (h \\<^sub>C \'.map y) \\<^sub>C F g)" using g \'.naturality C.comp_assoc by auto also have "... = (\ x' \\<^sub>D G f) \\<^sub>D \ y (h \\<^sub>C \'.map y) \\<^sub>D g" using f g h \_naturality [of f x x' g y' y "h \\<^sub>C \'.map y"] D.comp_assoc by fastforce also have "... = (G' f \\<^sub>D \ x) \\<^sub>D \ y (h \\<^sub>C \'.map y) \\<^sub>D g" using f \.naturality by auto also have "... = G' f \\<^sub>D (\ (C.cod h) \\<^sub>D \ y (h \\<^sub>C \'.map y)) \\<^sub>D g" using h D.comp_assoc by auto finally show ?thesis by blast qed qed qed qed end subsection "Hom-Adjunction" text\ The bijection between hom-sets that defines an adjunction can be represented formally as a natural isomorphism of hom-functors. However, stating the definition this way is more complex than was the case for \meta_adjunction\. One reason is that we need to have a ``set category'' that is suitable as a target category for the hom-functors, and since the arrows of the categories @{term C} and @{term D} will in general have distinct types, we need a set category that simultaneously embeds both. Another reason is that we simply have to formally construct the various categories and functors required to express the definition. This is a good place to point out that I have often included more sublocales in a locale than are strictly required. The main reason for this is the fact that the locale system in Isabelle only gives one name to each entity introduced by a locale: the name that it has in the first locale in which it occurs. This means that entities that make their first appearance deeply nested in sublocales will have to be referred to by long qualified names that can be difficult to understand, or even to discover. To counteract this, I have typically introduced sublocales before the superlocales that contain them to ensure that the entities in the sublocales can be referred to by short meaningful (and predictable) names. In my opinion, though, it would be better if the locale system would make entities that occur in multiple locales accessible by \emph{all} possible qualified names, so that the most perspicuous name could be used in any particular context. \ locale hom_adjunction = C: category C + D: category D + S: replete_set_category S + Cop: dual_category C + Dop: dual_category D + CopxC: product_category Cop.comp C + DopxD: product_category Dop.comp D + DopxC: product_category Dop.comp C + F: "functor" D C F + G: "functor" C D G + HomC: hom_functor C S \C + HomD: hom_functor D S \D + Fop: dual_functor Dop.comp Cop.comp F + FopxC: product_functor Dop.comp C Cop.comp C Fop.map C.map + DopxG: product_functor Dop.comp C Dop.comp D Dop.map G + Hom_FopxC: composite_functor DopxC.comp CopxC.comp S FopxC.map HomC.map + Hom_DopxG: composite_functor DopxC.comp DopxD.comp S DopxG.map HomD.map + Hom_FopxC: set_valued_functor DopxC.comp S Hom_FopxC.map + Hom_DopxG: set_valued_functor DopxC.comp S Hom_DopxG.map + \: set_valued_transformation DopxC.comp S Hom_FopxC.map Hom_DopxG.map \ + \: set_valued_transformation DopxC.comp S Hom_DopxG.map Hom_FopxC.map \ + \\: inverse_transformations DopxC.comp S Hom_FopxC.map Hom_DopxG.map \ \ for C :: "'c comp" (infixr "\\<^sub>C" 55) and D :: "'d comp" (infixr "\\<^sub>D" 55) and S :: "'s comp" (infixr "\\<^sub>S" 55) and \C :: "'c * 'c \ 'c \ 's" and \D :: "'d * 'd \ 'd \ 's" and F :: "'d \ 'c" and G :: "'c \ 'd" and \ :: "'d * 'c \ 's" and \ :: "'d * 'c \ 's" begin notation C.in_hom ("\_ : _ \\<^sub>C _\") notation D.in_hom ("\_ : _ \\<^sub>D _\") abbreviation \C :: "'c * 'c \ 's \ 'c" where "\C \ HomC.\" abbreviation \D :: "'d * 'd \ 's \ 'd" where "\D \ HomD.\" end subsection "Unit/Counit Adjunction" text\ Expressed in unit/counit terms, an adjunction consists of functors \F: D \ C\ and \G: C \ D\, equipped with natural transformations \\: 1 \ GF\ and \\: FG \ 1\ satisfying certain ``triangle identities''. \ locale unit_counit_adjunction = C: category C + D: category D + F: "functor" D C F + G: "functor" C D G + GF: composite_functor D C D F G + FG: composite_functor C D C G F + FGF: composite_functor D C C F \F o G\ + GFG: composite_functor C D D G \G o F\ + \: natural_transformation D D D.map \G o F\ \ + \: natural_transformation C C \F o G\ C.map \ + F\: natural_transformation D C F \F o G o F\ \F o \\ + \G: natural_transformation C D G \G o F o G\ \\ o G\ + \F: natural_transformation D C \F o G o F\ F \\ o F\ + G\: natural_transformation C D \G o F o G\ G \G o \\ + \FoF\: vertical_composite D C F \F o G o F\ F \F o \\ \\ o F\ + G\o\G: vertical_composite C D G \G o F o G\ G \\ o G\ \G o \\ for C :: "'c comp" (infixr "\\<^sub>C" 55) and D :: "'d comp" (infixr "\\<^sub>D" 55) and F :: "'d \ 'c" and G :: "'c \ 'd" and \ :: "'d \ 'd" and \ :: "'c \ 'c" + assumes triangle_F: "\FoF\.map = F" and triangle_G: "G\o\G.map = G" begin notation C.in_hom ("\_ : _ \\<^sub>C _\") notation D.in_hom ("\_ : _ \\<^sub>D _\") end lemma unit_determines_counit: assumes "unit_counit_adjunction C D F G \ \" and "unit_counit_adjunction C D F G \ \'" shows "\ = \'" proof - (* IDEA: \' = \'FG o (FG\ o F\G) = \'\ o F\G = \FG o (\'FG o F\G) = \ *) interpret Adj: unit_counit_adjunction C D F G \ \ using assms(1) by auto interpret Adj': unit_counit_adjunction C D F G \ \' using assms(2) by auto interpret FGFG: composite_functor C D C G \F o G o F\ .. interpret FG\: natural_transformation C C \(F o G) o (F o G)\ \F o G\ \(F o G) o \\ using Adj.\.natural_transformation_axioms Adj.FG.as_nat_trans.natural_transformation_axioms horizontal_composite by fastforce interpret F\G: natural_transformation C C \F o G\ \F o G o F o G\ \F o \ o G\ using Adj.\.natural_transformation_axioms Adj.F\.natural_transformation_axioms Adj.G.as_nat_trans.natural_transformation_axioms horizontal_composite by blast interpret \'\: natural_transformation C C \F o G o F o G\ Adj.C.map \\' o \\ proof - have "natural_transformation C C ((F o G) o (F o G)) Adj.C.map (\' o \)" using Adj.\.natural_transformation_axioms Adj'.\.natural_transformation_axioms horizontal_composite Adj.C.is_functor comp_functor_identity by (metis (no_types, lifting)) thus "natural_transformation C C (F o G o F o G) Adj.C.map (\' o \)" using o_assoc by metis qed interpret \'\oF\G: vertical_composite C C \F o G\ \F o G o F o G\ Adj.C.map \F o \ o G\ \\' o \\ .. have "\' = vertical_composite.map C C (F o Adj.G\o\G.map) \'" using vcomp_ide_dom [of C C "F o G" Adj.C.map \'] Adj.triangle_G by (simp add: Adj'.\.natural_transformation_axioms) also have "... = vertical_composite.map C C (vertical_composite.map C C (F o \ o G) (F o G o \)) \'" using whisker_left Adj.F.functor_axioms Adj.G\.natural_transformation_axioms Adj.\G.natural_transformation_axioms o_assoc by (metis (no_types, lifting)) also have "... = vertical_composite.map C C (vertical_composite.map C C (F o \ o G) (\' o F o G)) \" proof - have "vertical_composite.map C C (vertical_composite.map C C (F o \ o G) (F o G o \)) \' = vertical_composite.map C C (F o \ o G) (vertical_composite.map C C (F o G o \) \')" using vcomp_assoc by (metis (no_types, lifting) Adj'.\.natural_transformation_axioms FG\.natural_transformation_axioms F\G.natural_transformation_axioms o_assoc) also have "... = vertical_composite.map C C (F o \ o G) (vertical_composite.map C C (\' o F o G) \)" using Adj'.\.natural_transformation_axioms Adj.\.natural_transformation_axioms interchange_spc [of C C "F o G" Adj.C.map \ C "F o G" Adj.C.map \'] by (metis hcomp_ide_cod hcomp_ide_dom o_assoc) also have "... = vertical_composite.map C C (vertical_composite.map C C (F o \ o G) (\' o F o G)) \" using vcomp_assoc by (metis Adj'.\F.natural_transformation_axioms Adj.G.as_nat_trans.natural_transformation_axioms Adj.\.natural_transformation_axioms F\G.natural_transformation_axioms horizontal_composite) finally show ?thesis by simp qed also have "... = vertical_composite.map C C (vertical_composite.map D C (F o \) (\' o F) o G) \" using whisker_right Adj'.\F.natural_transformation_axioms Adj.F\.natural_transformation_axioms Adj.G.functor_axioms by metis also have "... = \" using Adj'.triangle_F vcomp_ide_cod Adj.\.natural_transformation_axioms by simp finally show ?thesis by simp qed lemma counit_determines_unit: assumes "unit_counit_adjunction C D F G \ \" and "unit_counit_adjunction C D F G \' \" shows "\ = \'" proof - interpret Adj: unit_counit_adjunction C D F G \ \ using assms(1) by auto interpret Adj': unit_counit_adjunction C D F G \' \ using assms(2) by auto interpret GFGF: composite_functor D C D F \G o F o G\ .. interpret GF\: natural_transformation D D \G o F\ \(G o F) o (G o F)\ \(G o F) o \\ using Adj.\.natural_transformation_axioms Adj.GF.functor_axioms Adj.GF.as_nat_trans.natural_transformation_axioms comp_functor_identity horizontal_composite by (metis (no_types, lifting)) interpret \'GF: natural_transformation D D \G o F\ \(G o F) o (G o F)\ \\' o (G o F)\ using Adj'.\.natural_transformation_axioms Adj.GF.functor_axioms Adj.GF.as_nat_trans.natural_transformation_axioms comp_identity_functor horizontal_composite by (metis (no_types, lifting)) interpret G\F: natural_transformation D D \G o F o G o F\ \G o F\ \G o \ o F\ using Adj.\.natural_transformation_axioms Adj.F.as_nat_trans.natural_transformation_axioms Adj.G\.natural_transformation_axioms horizontal_composite by blast interpret \'\: natural_transformation D D Adj.D.map \G o F o G o F\ \\' o \\ proof - have "natural_transformation D D Adj.D.map ((G o F) o (G o F)) (\' o \)" - using Adj.\.natural_transformation_axioms Adj'.\.natural_transformation_axioms - horizontal_composite Adj.D.as_nat_trans.natural_transformation_axioms hcomp_ide_cod - by (metis (no_types, lifting)) + using Adj'.\.natural_transformation_axioms Adj.D.identity_functor_axioms + Adj.\.natural_transformation_axioms horizontal_composite identity_functor.is_functor + by fastforce thus "natural_transformation D D Adj.D.map (G o F o G o F) (\' o \)" using o_assoc by metis qed interpret G\Fo\'\: vertical_composite D D Adj.D.map \G o F o G o F\ \G o F\ \\' o \\ \G o \ o F\ .. have "\' = vertical_composite.map D D \' (G o Adj.\FoF\.map)" using vcomp_ide_cod [of D D Adj.D.map "G o F" \'] Adj.triangle_F by (simp add: Adj'.\.natural_transformation_axioms) also have "... = vertical_composite.map D D \' (vertical_composite.map D D (G o (F o \)) (G o (\ o F)))" using whisker_left Adj.F\.natural_transformation_axioms Adj.G.functor_axioms Adj.\F.natural_transformation_axioms by fastforce also have "... = vertical_composite.map D D (vertical_composite.map D D \' (G o (F o \))) (G o \ o F)" using vcomp_assoc Adj'.\.natural_transformation_axioms GF\.natural_transformation_axioms G\F.natural_transformation_axioms o_assoc by (metis (no_types, lifting)) also have "... = vertical_composite.map D D (vertical_composite.map D D \ (\' o G o F)) (G o \ o F)" using interchange_spc [of D D Adj.D.map "G o F" \ D Adj.D.map "G o F" \'] Adj.\.natural_transformation_axioms Adj'.\.natural_transformation_axioms by (metis hcomp_ide_cod hcomp_ide_dom o_assoc) also have "... = vertical_composite.map D D \ (vertical_composite.map D D (\' o G o F) (G o \ o F))" using vcomp_assoc by (metis (no_types, lifting) Adj.\.natural_transformation_axioms G\F.natural_transformation_axioms \'GF.natural_transformation_axioms o_assoc) also have "... = vertical_composite.map D D \ (vertical_composite.map C D (\' o G) (G o \) o F)" using whisker_right Adj'.\G.natural_transformation_axioms Adj.F.functor_axioms Adj.G\.natural_transformation_axioms by fastforce also have "... = \" using Adj'.triangle_G vcomp_ide_dom Adj.GF.functor_axioms Adj.\.natural_transformation_axioms by simp finally show ?thesis by simp qed subsection "Adjunction" text\ The grand unification of everything to do with an adjunction. \ locale adjunction = C: category C + D: category D + S: replete_set_category S + Cop: dual_category C + Dop: dual_category D + CopxC: product_category Cop.comp C + DopxD: product_category Dop.comp D + DopxC: product_category Dop.comp C + idDop: identity_functor Dop.comp + HomC: hom_functor C S \C + HomD: hom_functor D S \D + F: left_adjoint_functor D C F + G: right_adjoint_functor C D G + GF: composite_functor D C D F G + FG: composite_functor C D C G F + FGF: composite_functor D C C F FG.map + GFG: composite_functor C D D G GF.map + Fop: dual_functor Dop.comp Cop.comp F + FopxC: product_functor Dop.comp C Cop.comp C Fop.map C.map + DopxG: product_functor Dop.comp C Dop.comp D Dop.map G + Hom_FopxC: composite_functor DopxC.comp CopxC.comp S FopxC.map HomC.map + Hom_DopxG: composite_functor DopxC.comp DopxD.comp S DopxG.map HomD.map + Hom_FopxC: set_valued_functor DopxC.comp S Hom_FopxC.map + Hom_DopxG: set_valued_functor DopxC.comp S Hom_DopxG.map + \: natural_transformation D D D.map GF.map \ + \: natural_transformation C C FG.map C.map \ + F\: natural_transformation D C F \F o G o F\ \F o \\ + \G: natural_transformation C D G \G o F o G\ \\ o G\ + \F: natural_transformation D C \F o G o F\ F \\ o F\ + G\: natural_transformation C D \G o F o G\ G \G o \\ + \FoF\: vertical_composite D C F FGF.map F \F o \\ \\ o F\ + G\o\G: vertical_composite C D G GFG.map G \\ o G\ \G o \\ + \\: meta_adjunction C D F G \ \ + \\: unit_counit_adjunction C D F G \ \ + \\: hom_adjunction C D S \C \D F G \ \ for C :: "'c comp" (infixr "\\<^sub>C" 55) and D :: "'d comp" (infixr "\\<^sub>D" 55) and S :: "'s comp" (infixr "\\<^sub>S" 55) and \C :: "'c * 'c \ 'c \ 's" and \D :: "'d * 'd \ 'd \ 's" and F :: "'d \ 'c" and G :: "'c \ 'd" and \ :: "'d \ 'c \ 'd" and \ :: "'c \ 'd \ 'c" and \ :: "'d \ 'd" and \ :: "'c \ 'c" and \ :: "'d * 'c \ 's" and \ :: "'d * 'c \ 's" + assumes \_in_terms_of_\: "\ D.ide y; \f : F y \\<^sub>C x\ \ \ \ y f = G f \\<^sub>D \ y" and \_in_terms_of_\: "\ C.ide x; \g : y \\<^sub>D G x\ \ \ \ x g = \ x \\<^sub>C F g" and \_in_terms_of_\: "D.ide y \ \ y = \ y (F y)" and \_in_terms_of_\: "C.ide x \ \ x = \ x (G x)" and \_in_terms_of_\: "\ D.ide y; \f : F y \\<^sub>C x\ \ \ \ y f = (\\.\D (y, G x) o S.Fun (\ (y, x)) o \C (F y, x)) f" and \_in_terms_of_\: "\ C.ide x; \g : y \\<^sub>D G x\ \ \ \ x g = (\\.\C (F y, x) o S.Fun (\ (y, x)) o \D (y, G x)) g" and \_in_terms_of_\: "\ C.ide x; D.ide y \ \ \ (y, x) = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \\.\C (F y, x))" and \_in_terms_of_\: "\ C.ide x; D.ide y \ \ \ (y, x) = S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\C (F y, x) o \ x o \\.\D (y, G x))" section "Meta-Adjunctions Induce Unit/Counit Adjunctions" context meta_adjunction begin interpretation GF: composite_functor D C D F G .. interpretation FG: composite_functor C D C G F .. interpretation FGF: composite_functor D C C F FG.map .. interpretation GFG: composite_functor C D D G GF.map .. definition \o :: "'d \ 'd" where "\o y = \ y (F y)" lemma \o_in_hom: assumes "D.ide y" shows "\\o y : y \\<^sub>D G (F y)\" using assms D.ide_in_hom \o_def \_in_hom by force lemma \_in_terms_of_\o: assumes "D.ide y" and "\f : F y \\<^sub>C x\" shows "\ y f = G f \\<^sub>D \o y" proof (unfold \o_def) have 1: "\F y : F y \\<^sub>C F y\" using assms(1) D.ide_in_hom by blast hence "\ y (F y) = \ y (F y) \\<^sub>D y" by (metis assms(1) D.in_homE \_in_hom D.comp_arr_dom) thus "\ y f = G f \\<^sub>D \ y (F y)" using assms 1 D.ide_in_hom by (metis C.comp_arr_dom C.in_homE \_naturality) qed lemma \_F_char: assumes "\g : y' \\<^sub>D y\" shows "\ y' (F g) = \o y \\<^sub>D g" using assms \o_def \_in_hom [of y "F y" "F y"] D.comp_cod_arr [of "D (\ y (F y)) g" "G (F y)"] \_naturality [of "F y" "F y" "F y" g y' y "F y"] - by (metis D.arr_cod D.cod_cod D.comp_in_homI' D.ide_char' D.ide_in_hom D.in_homE - F.as_nat_trans.is_natural_2 F.preserves_hom) + by (metis C.ide_in_hom D.arr_cod_iff_arr D.arr_dom D.cod_cod D.cod_dom D.comp_ide_arr + D.comp_ide_self D.ide_cod D.in_homE F.as_nat_trans.is_natural_2 F.functor_axioms + F.preserves_section_retraction \_in_hom functor.preserves_hom) interpretation \: transformation_by_components D D D.map GF.map \o proof show "\a. D.ide a \ \\o a : D.map a \\<^sub>D GF.map a\" using \o_def \_in_hom D.ide_in_hom by force fix f assume f: "D.arr f" show "\o (D.cod f) \\<^sub>D D.map f = GF.map f \\<^sub>D \o (D.dom f)" using f \_F_char [of "D.map f" "D.dom f" "D.cod f"] \_in_terms_of_\o [of "D.dom f" "F f" "F (D.cod f)"] by force qed lemma \_map_simp: assumes "D.ide y" shows "\.map y = \ y (F y)" using assms \.map_simp_ide \o_def by simp definition \o :: "'c \ 'c" where "\o x = \ x (G x)" lemma \o_in_hom: assumes "C.ide x" shows "\\o x : F (G x) \\<^sub>C x\" using assms C.ide_in_hom \o_def \_in_hom by force lemma \_in_terms_of_\o: assumes "C.ide x" and "\g : y \\<^sub>D G x\" shows "\ x g = \o x \\<^sub>C F g" proof - have "\o x \\<^sub>C F g = x \\<^sub>C \ x (G x) \\<^sub>C F g" using assms \o_def \_in_hom [of x "G x" "G x"] C.comp_cod_arr [of "\ x (G x) \\<^sub>C F g" x] by fastforce also have "... = \ x (G x \\<^sub>D G x \\<^sub>D g)" using assms \_naturality [of x x x g y "G x" "G x"] by force also have "... = \ x g" using assms D.comp_cod_arr by fastforce finally show ?thesis by simp qed lemma \_G_char: assumes "\f: x \\<^sub>C x'\" shows "\ x' (G f) = f \\<^sub>C \o x" proof (unfold \o_def) have 0: "C.ide x \ C.ide x'" using assms by auto thus "\ x' (G f) = f \\<^sub>C \ x (G x)" using 0 assms \_naturality \_in_hom [of x "G x" "G x"] G.preserves_hom \o_def \_in_terms_of_\o G.as_nat_trans.is_natural_1 C.ide_in_hom by (metis C.arrI C.in_homE) qed interpretation \: transformation_by_components C C FG.map C.map \o apply unfold_locales using \o_in_hom apply simp using \_G_char \_in_terms_of_\o by (metis C.arr_iff_in_hom C.ide_cod C.map_simp G.preserves_hom comp_apply) lemma \_map_simp: assumes "C.ide x" shows "\.map x = \ x (G x)" using assms \o_def by simp interpretation FD: composite_functor D D C D.map F .. interpretation CF: composite_functor D C C F C.map .. interpretation GC: composite_functor C C D C.map G .. interpretation DG: composite_functor C D D G D.map .. interpretation F\: natural_transformation D C F \F o G o F\ \F o \.map\ by (metis (no_types, lifting) F.as_nat_trans.natural_transformation_axioms F.functor_axioms \.natural_transformation_axioms comp_functor_identity horizontal_composite o_assoc) interpretation \F: natural_transformation D C \F o G o F\ F \\.map o F\ using \.natural_transformation_axioms F.as_nat_trans.natural_transformation_axioms horizontal_composite by fastforce interpretation \G: natural_transformation C D G \G o F o G\ \\.map o G\ using \.natural_transformation_axioms G.as_nat_trans.natural_transformation_axioms horizontal_composite by fastforce interpretation G\: natural_transformation C D \G o F o G\ G \G o \.map\ by (metis (no_types, lifting) G.as_nat_trans.natural_transformation_axioms G.functor_axioms \.natural_transformation_axioms comp_functor_identity horizontal_composite o_assoc) interpretation \FoF\: vertical_composite D C F \F o G o F\ F \F o \.map\ \\.map o F\ .. interpretation G\o\G: vertical_composite C D G \G o F o G\ G \\.map o G\ \G o \.map\ .. lemma unit_counit_F: assumes "D.ide y" shows "F y = \o (F y) \\<^sub>C F (\o y)" using assms \_in_terms_of_\o \o_def \_\ \o_in_hom F.preserves_ide C.ide_in_hom by metis lemma unit_counit_G: assumes "C.ide x" shows "G x = G (\o x) \\<^sub>D \o (G x)" using assms \_in_terms_of_\o \o_def \_\ \o_in_hom G.preserves_ide D.ide_in_hom by metis lemma induces_unit_counit_adjunction': shows "unit_counit_adjunction C D F G \.map \.map" proof show "\FoF\.map = F" using \FoF\.is_natural_transformation \FoF\.map_simp_ide unit_counit_F F.as_nat_trans.natural_transformation_axioms by (intro NaturalTransformation.eqI) auto show "G\o\G.map = G" using G\o\G.is_natural_transformation G\o\G.map_simp_ide unit_counit_G G.as_nat_trans.natural_transformation_axioms by (intro NaturalTransformation.eqI) auto qed definition \ :: "'d \ 'd" where "\ \ \.map" definition \ :: "'c \ 'c" where "\ \ \.map" theorem induces_unit_counit_adjunction: shows "unit_counit_adjunction C D F G \ \" unfolding \_def \_def using induces_unit_counit_adjunction' by simp lemma \_is_natural_transformation: shows "natural_transformation D D D.map GF.map \" unfolding \_def .. lemma \_is_natural_transformation: shows "natural_transformation C C FG.map C.map \" unfolding \_def .. text\ From the defined @{term \} and @{term \} we can recover the original @{term \} and @{term \}. \ lemma \_in_terms_of_\: assumes "D.ide y" and "\f : F y \\<^sub>C x\" shows "\ y f = G f \\<^sub>D \ y" using assms \_def by (simp add: \_in_terms_of_\o) lemma \_in_terms_of_\: assumes "C.ide x" and "\g : y \\<^sub>D G x\" shows "\ x g = \ x \\<^sub>C F g" using assms \_def by (simp add: \_in_terms_of_\o) end section "Meta-Adjunctions Induce Left and Right Adjoint Functors" context meta_adjunction begin interpretation unit_counit_adjunction C D F G \ \ using induces_unit_counit_adjunction \_def \_def by auto lemma has_terminal_arrows_from_functor: assumes x: "C.ide x" shows "terminal_arrow_from_functor D C F (G x) x (\ x)" and "\y' f. arrow_from_functor D C F y' x f \ terminal_arrow_from_functor.the_coext D C F (G x) (\ x) y' f = \ y' f" proof - interpret \x: arrow_from_functor D C F \G x\ x \\ x\ using x \.preserves_hom G.preserves_ide by unfold_locales auto have 1: "\y' f. arrow_from_functor D C F y' x f \ \x.is_coext y' f (\ y' f) \ (\g'. \x.is_coext y' f g' \ g' = \ y' f)" using x by (metis (full_types) \x.is_coext_def \_\ \_in_terms_of_\ arrow_from_functor.arrow \_in_hom \_\) interpret \x: terminal_arrow_from_functor D C F \G x\ x \\ x\ using 1 by unfold_locales blast show "terminal_arrow_from_functor D C F (G x) x (\ x)" .. show "\y' f. arrow_from_functor D C F y' x f \ \x.the_coext y' f = \ y' f" using 1 \x.the_coext_def by auto qed lemma has_left_adjoint_functor: shows "left_adjoint_functor D C F" apply unfold_locales using has_terminal_arrows_from_functor by auto lemma has_initial_arrows_to_functor: assumes y: "D.ide y" shows "initial_arrow_to_functor C D G y (F y) (\ y)" and "\x' g. arrow_to_functor C D G y x' g \ initial_arrow_to_functor.the_ext C D G (F y) (\ y) x' g = \ x' g" proof - interpret \y: arrow_to_functor C D G y \F y\ \\ y\ using y by unfold_locales auto have 1: "\x' g. arrow_to_functor C D G y x' g \ \y.is_ext x' g (\ x' g) \ (\f'. \y.is_ext x' g f' \ f' = \ x' g)" using y by (metis (full_types) \y.is_ext_def \_\ \_in_terms_of_\ arrow_to_functor.arrow \_in_hom \_\) interpret \y: initial_arrow_to_functor C D G y \F y\ \\ y\ apply unfold_locales using 1 by blast show "initial_arrow_to_functor C D G y (F y) (\ y)" .. show "\x' g. arrow_to_functor C D G y x' g \ \y.the_ext x' g = \ x' g" using 1 \y.the_ext_def by auto qed lemma has_right_adjoint_functor: shows "right_adjoint_functor C D G" apply unfold_locales using has_initial_arrows_to_functor by auto end section "Unit/Counit Adjunctions Induce Meta-Adjunctions" context unit_counit_adjunction begin definition \ :: "'d \ 'c \ 'd" where "\ y h = G h \\<^sub>D \ y" definition \ :: "'c \ 'd \ 'c" where "\ x h = \ x \\<^sub>C F h" interpretation meta_adjunction C D F G \ \ proof fix x :: 'c and y :: 'd and f :: 'c assume y: "D.ide y" and f: "\f : F y \\<^sub>C x\" show 0: "\\ y f : y \\<^sub>D G x\" using f y G.preserves_hom \.preserves_hom \_def D.ide_in_hom by auto show "\ x (\ y f) = f" proof - have "\ x (\ y f) = (\ x \\<^sub>C F (G f)) \\<^sub>C F (\ y)" using y f \_def \_def C.comp_assoc by auto also have "... = (f \\<^sub>C \ (F y)) \\<^sub>C F (\ y)" using y f \.naturality by auto also have "... = f" using y f \FoF\.map_simp_2 triangle_F C.comp_arr_dom D.ide_in_hom C.comp_assoc by fastforce finally show ?thesis by auto qed next fix x :: 'c and y :: 'd and g :: 'd assume x: "C.ide x" and g: "\g : y \\<^sub>D G x\" show "\\ x g : F y \\<^sub>C x\" using g x \_def by fastforce show "\ y (\ x g) = g" proof - have "\ y (\ x g) = (G (\ x) \\<^sub>D \ (G x)) \\<^sub>D g" using g x \_def \_def \.naturality [of g] D.comp_assoc by auto also have "... = g" using x g triangle_G D.comp_ide_arr G\o\G.map_simp_ide by auto finally show ?thesis by auto qed next fix f :: 'c and g :: 'd and h :: 'c and x :: 'c and x' :: 'c and y :: 'd and y' :: 'd assume f: "\f : x \\<^sub>C x'\" and g: "\g : y' \\<^sub>D y\" and h: "\h : F y \\<^sub>C x\" show "\ y' (f \\<^sub>C h \\<^sub>C F g) = G f \\<^sub>D \ y h \\<^sub>D g" using \_def f g h \.naturality D.comp_assoc by fastforce qed theorem induces_meta_adjunction: shows "meta_adjunction C D F G \ \" .. text\ From the defined @{term \} and @{term \} we can recover the original @{term \} and @{term \}. \ lemma \_in_terms_of_\: assumes "D.ide y" shows "\ y = \ y (F y)" using assms \_def D.comp_cod_arr by auto lemma \_in_terms_of_\: assumes "C.ide x" shows "\ x = \ x (G x)" using assms \_def C.comp_arr_dom by auto end section "Left and Right Adjoint Functors Induce Meta-Adjunctions" text\ A left adjoint functor induces a meta-adjunction, modulo the choice of a right adjoint and counit. \ context left_adjoint_functor begin definition Go :: "'c \ 'd" where "Go a = (SOME b. \e. terminal_arrow_from_functor D C F b a e)" definition \o :: "'c \ 'c" where "\o a = (SOME e. terminal_arrow_from_functor D C F (Go a) a e)" lemma Go_\o_terminal: assumes "\b e. terminal_arrow_from_functor D C F b a e" shows "terminal_arrow_from_functor D C F (Go a) a (\o a)" using assms Go_def \o_def someI_ex [of "\b. \e. terminal_arrow_from_functor D C F b a e"] someI_ex [of "\e. terminal_arrow_from_functor D C F (Go a) a e"] by simp text\ The right adjoint @{term G} to @{term F} takes each arrow @{term f} of @{term[source=true] C} to the unique @{term[source=true] D}-coextension of @{term "C f (\o (C.dom f))"} along @{term "\o (C.cod f)"}. \ definition G :: "'c \ 'd" where "G f = (if C.arr f then terminal_arrow_from_functor.the_coext D C F (Go (C.cod f)) (\o (C.cod f)) (Go (C.dom f)) (f \\<^sub>C \o (C.dom f)) else D.null)" lemma G_ide: assumes "C.ide x" shows "G x = Go x" proof - interpret terminal_arrow_from_functor D C F \Go x\ x \\o x\ using assms ex_terminal_arrow Go_\o_terminal by blast have 1: "arrow_from_functor D C F (Go x) x (\o x)" .. have "is_coext (Go x) (\o x) (Go x)" using arrow is_coext_def C.in_homE C.comp_arr_dom by auto hence "Go x = the_coext (Go x) (\o x)" using 1 the_coext_unique by blast moreover have "\o x = C x (\o (C.dom x))" using assms arrow C.comp_ide_arr C.seqI' C.ide_in_hom C.in_homE by metis ultimately show ?thesis using assms G_def C.cod_dom C.ide_in_hom C.in_homE by metis qed lemma G_is_functor: shows "functor C D G" proof fix f :: 'c assume "\C.arr f" thus "G f = D.null" using G_def by auto next fix f :: 'c assume f: "C.arr f" let ?x = "C.dom f" let ?x' = "C.cod f" interpret x\: terminal_arrow_from_functor D C F \Go ?x\ \?x\ \\o ?x\ using f ex_terminal_arrow Go_\o_terminal by simp interpret x'\: terminal_arrow_from_functor D C F \Go ?x'\ \?x'\ \\o ?x'\ using f ex_terminal_arrow Go_\o_terminal by simp have 1: "arrow_from_functor D C F (Go ?x) ?x' (C f (\o ?x))" using f x\.arrow by (unfold_locales, auto) have "G f = x'\.the_coext (Go ?x) (C f (\o ?x))" using f G_def by simp hence Gf: "\G f : Go ?x \\<^sub>D Go ?x'\ \ f \\<^sub>C \o ?x = \o ?x' \\<^sub>C F (G f)" using 1 x'\.the_coext_prop by simp show "D.arr (G f)" using Gf by auto show "D.dom (G f) = G ?x" using f Gf G_ide by auto show "D.cod (G f) = G ?x'" using f Gf G_ide by auto next fix f f' :: 'c assume ff': "C.arr (C f' f)" have f: "C.arr f" using ff' by auto let ?x = "C.dom f" let ?x' = "C.cod f" let ?x'' = "C.cod f'" interpret x\: terminal_arrow_from_functor D C F \Go ?x\ \?x\ \\o ?x\ using f ex_terminal_arrow Go_\o_terminal by simp interpret x'\: terminal_arrow_from_functor D C F \Go ?x'\ \?x'\ \\o ?x'\ using f ex_terminal_arrow Go_\o_terminal by simp interpret x''\: terminal_arrow_from_functor D C F \Go ?x''\ \?x''\ \\o ?x''\ using ff' ex_terminal_arrow Go_\o_terminal by auto have 1: "arrow_from_functor D C F (Go ?x) ?x' (f \\<^sub>C \o ?x)" using f x\.arrow by (unfold_locales, auto) have 2: "arrow_from_functor D C F (Go ?x') ?x'' (f' \\<^sub>C \o ?x')" using ff' x'\.arrow by (unfold_locales, auto) have "G f = x'\.the_coext (Go ?x) (C f (\o ?x))" using f G_def by simp hence Gf: "D.in_hom (G f) (Go ?x) (Go ?x') \ f \\<^sub>C \o ?x = \o ?x' \\<^sub>C F (G f)" using 1 x'\.the_coext_prop by simp have "G f' = x''\.the_coext (Go ?x') (f' \\<^sub>C \o ?x')" using ff' G_def by auto hence Gf': "\G f' : Go (C.cod f) \\<^sub>D Go (C.cod f')\ \ f' \\<^sub>C \o ?x' = \o ?x'' \\<^sub>C F (G f')" using 2 x''\.the_coext_prop by simp show "G (f' \\<^sub>C f) = G f' \\<^sub>D G f" proof - have "x''\.is_coext (Go ?x) ((f' \\<^sub>C f) \\<^sub>C \o ?x) (G f' \\<^sub>D G f)" proof - have 3: "\G f' \\<^sub>D G f : Go (C.dom f) \\<^sub>D Go (C.cod f')\" using 1 2 Gf Gf' by auto moreover have "(f' \\<^sub>C f) \\<^sub>C \o ?x = \o ?x'' \\<^sub>C F (G f' \\<^sub>D G f)" by (metis 3 C.comp_assoc D.in_homE Gf Gf' preserves_comp) ultimately show ?thesis using x''\.is_coext_def by auto qed moreover have "arrow_from_functor D C F (Go ?x) ?x'' ((f' \\<^sub>C f) \\<^sub>C \o ?x)" using ff' x\.arrow by unfold_locales blast ultimately show ?thesis using ff' G_def x''\.the_coext_unique C.seqE C.cod_comp C.dom_comp by auto qed qed interpretation G: "functor" C D G using G_is_functor by auto lemma G_simp: assumes "C.arr f" shows "G f = terminal_arrow_from_functor.the_coext D C F (Go (C.cod f)) (\o (C.cod f)) (Go (C.dom f)) (f \\<^sub>C \o (C.dom f))" using assms G_def by simp interpretation idC: identity_functor C .. interpretation GF: composite_functor C D C G F .. interpretation \: transformation_by_components C C GF.map C.map \o proof fix x :: 'c assume x: "C.ide x" show "\\o x : GF.map x \\<^sub>C C.map x\" proof - interpret terminal_arrow_from_functor D C F \Go x\ x \\o x\ using x Go_\o_terminal ex_terminal_arrow by simp show ?thesis using x G_ide arrow by auto qed next fix f :: 'c assume f: "C.arr f" show "\o (C.cod f) \\<^sub>C GF.map f = C.map f \\<^sub>C \o (C.dom f)" proof - let ?x = "C.dom f" let ?x' = "C.cod f" interpret x\: terminal_arrow_from_functor D C F \Go ?x\ ?x \\o ?x\ using f Go_\o_terminal ex_terminal_arrow by simp interpret x'\: terminal_arrow_from_functor D C F \Go ?x'\ ?x' \\o ?x'\ using f Go_\o_terminal ex_terminal_arrow by simp have 1: "arrow_from_functor D C F (Go ?x) ?x' (C f (\o ?x))" using f x\.arrow by unfold_locales auto have "G f = x'\.the_coext (Go ?x) (f \\<^sub>C \o ?x)" using f G_simp by blast hence "x'\.is_coext (Go ?x) (f \\<^sub>C \o ?x) (G f)" using 1 x'\.the_coext_prop x'\.is_coext_def by auto thus ?thesis using f x'\.is_coext_def by simp qed qed definition \ where "\ x h = C (\.map x) (F h)" lemma \_in_hom: assumes "C.ide x" and "\g : y \\<^sub>D G x\" shows "\\ x g : F y \\<^sub>C x\" unfolding \_def using assms \.maps_ide_in_hom by auto lemma \_natural: assumes f: "\f : x \\<^sub>C x'\" and g: "\g : y' \\<^sub>D y\" and h: "\h : y \\<^sub>D G x\" shows "f \\<^sub>C \ x h \\<^sub>C F g = \ x' ((G f \\<^sub>D h) \\<^sub>D g)" proof - have "f \\<^sub>C \ x h \\<^sub>C F g = f \\<^sub>C (\.map x \\<^sub>C F h) \\<^sub>C F g" unfolding \_def by auto also have "... = (f \\<^sub>C \.map x) \\<^sub>C F h \\<^sub>C F g" using C.comp_assoc by fastforce also have "... = (f \\<^sub>C \.map x) \\<^sub>C F (h \\<^sub>D g)" using g h by fastforce also have "... = (\.map x' \\<^sub>C F (G f)) \\<^sub>C F (h \\<^sub>D g)" using f \.naturality by auto also have "... = \.map x' \\<^sub>C F ((G f \\<^sub>D h) \\<^sub>D g)" using f g h C.comp_assoc by fastforce also have "... = \ x' ((G f \\<^sub>D h) \\<^sub>D g)" unfolding \_def by auto finally show ?thesis by auto qed lemma \_inverts_coext: assumes x: "C.ide x" and g: "\g : y \\<^sub>D G x\" shows "arrow_from_functor.is_coext D C F (G x) (\.map x) y (\ x g) g" proof - interpret x\: arrow_from_functor D C F \G x\ x \\.map x\ using x \.maps_ide_in_hom by unfold_locales auto show "x\.is_coext y (\ x g) g" using x g \_def x\.is_coext_def G_ide by blast qed lemma \_invertible: assumes y: "D.ide y" and f: "\f : F y \\<^sub>C x\" shows "\!g. \g : y \\<^sub>D G x\ \ \ x g = f" proof have x: "C.ide x" using f by auto interpret x\: terminal_arrow_from_functor D C F \Go x\ x \\o x\ using x ex_terminal_arrow Go_\o_terminal by auto have 1: "arrow_from_functor D C F y x f" using y f by (unfold_locales, auto) let ?g = "x\.the_coext y f" have "\ x ?g = f" using 1 x y \_def x\.the_coext_prop G_ide \_inverts_coext x\.is_coext_def by simp thus "\?g : y \\<^sub>D G x\ \ \ x ?g = f" using 1 x x\.the_coext_prop G_ide by simp show "\g'. \g' : y \\<^sub>D G x\ \ \ x g' = f \ g' = ?g" using 1 x y \_inverts_coext G_ide x\.the_coext_unique by force qed definition \ where "\ y f = (THE g. \g : y \\<^sub>D G (C.cod f)\ \ \ (C.cod f) g = f)" lemma \_in_hom: assumes "D.ide y" and "\f : F y \\<^sub>C x\" shows "\\ y f : y \\<^sub>D G x\" using assms \_invertible \_def theI' [of "\g. \g : y \\<^sub>D G x\ \ \ x g = f"] by auto lemma \_\: assumes "C.ide x" and "\g : y \\<^sub>D G x\" shows "\ y (\ x g) = g" proof - have "\ y (\ x g) = (THE g'. \g' : y \\<^sub>D G x\ \ \ x g' = \ x g)" proof - have "C.cod (\ x g) = x" using assms \_in_hom by auto thus ?thesis using \_def by auto qed moreover have "\!g'. \g' : y \\<^sub>D G x\ \ \ x g' = \ x g" using assms \_in_hom \_invertible D.ide_dom by blast ultimately show "\ y (\ x g) = g" using assms(2) by auto qed lemma \_\: assumes "D.ide y" and "\f : F y \\<^sub>C x\" shows "\ x (\ y f) = f" using assms \_invertible \_def theI' [of "\g. \g : y \\<^sub>D G x\ \ \ x g = f"] by auto lemma \_natural: assumes "\f : x \\<^sub>C x'\" and "\g : y' \\<^sub>D y\" and "\h : F y \\<^sub>C x\" shows "\ y' (f \\<^sub>C h \\<^sub>C F g) = (G f \\<^sub>D \ y h) \\<^sub>D g" proof - have "C.ide x' \ D.ide y \ D.in_hom (\ y h) y (G x)" using assms \_in_hom by auto thus ?thesis using assms D.comp_in_homI G.preserves_hom \_natural [of f x x' g y' y "\ y h"] \_\ \_\ by auto qed theorem induces_meta_adjunction: shows "meta_adjunction C D F G \ \" using \_in_hom \_in_hom \_\ \_\ \_natural D.comp_assoc by unfold_locales auto end text\ A right adjoint functor induces a meta-adjunction, modulo the choice of a left adjoint and unit. \ context right_adjoint_functor begin definition Fo :: "'d \ 'c" where "Fo y = (SOME x. \u. initial_arrow_to_functor C D G y x u)" definition \o :: "'d \ 'd" where "\o y = (SOME u. initial_arrow_to_functor C D G y (Fo y) u)" lemma Fo_\o_initial: assumes "\x u. initial_arrow_to_functor C D G y x u" shows "initial_arrow_to_functor C D G y (Fo y) (\o y)" using assms Fo_def \o_def someI_ex [of "\x. \u. initial_arrow_to_functor C D G y x u"] someI_ex [of "\u. initial_arrow_to_functor C D G y (Fo y) u"] by simp text\ The left adjoint @{term F} to @{term g} takes each arrow @{term g} of @{term[source=true] D} to the unique @{term[source=true] C}-extension of @{term "D (\o (D.cod g)) g"} along @{term "\o (D.dom g)"}. \ definition F :: "'d \ 'c" where "F g = (if D.arr g then initial_arrow_to_functor.the_ext C D G (Fo (D.dom g)) (\o (D.dom g)) (Fo (D.cod g)) (\o (D.cod g) \\<^sub>D g) else C.null)" lemma F_ide: assumes "D.ide y" shows "F y = Fo y" proof - interpret initial_arrow_to_functor C D G y \Fo y\ \\o y\ using assms initial_arrows_exist Fo_\o_initial by blast have 1: "arrow_to_functor C D G y (Fo y) (\o y)" .. have "is_ext (Fo y) (\o y) (Fo y)" unfolding is_ext_def using arrow D.comp_ide_arr [of "G (Fo y)" "\o y"] by force hence "Fo y = the_ext (Fo y) (\o y)" using 1 the_ext_unique by blast moreover have "\o y = D (\o (D.cod y)) y" using assms arrow D.comp_arr_ide D.comp_arr_dom by auto ultimately show ?thesis using assms F_def D.dom_cod D.in_homE D.ide_in_hom by metis qed lemma F_is_functor: shows "functor D C F" proof fix g :: 'd assume "\D.arr g" thus "F g = C.null" using F_def by auto next fix g :: 'd assume g: "D.arr g" let ?y = "D.dom g" let ?y' = "D.cod g" interpret y\: initial_arrow_to_functor C D G ?y \Fo ?y\ \\o ?y\ using g initial_arrows_exist Fo_\o_initial by simp interpret y'\: initial_arrow_to_functor C D G ?y' \Fo ?y'\ \\o ?y'\ using g initial_arrows_exist Fo_\o_initial by simp have 1: "arrow_to_functor C D G ?y (Fo ?y') (D (\o ?y') g)" using g y'\.arrow by unfold_locales auto have "F g = y\.the_ext (Fo ?y') (D (\o ?y') g)" using g F_def by simp hence Fg: "\F g : Fo ?y \\<^sub>C Fo ?y'\ \ \o ?y' \\<^sub>D g = G (F g) \\<^sub>D \o ?y" using 1 y\.the_ext_prop by simp show "C.arr (F g)" using Fg by auto show "C.dom (F g) = F ?y" using Fg g F_ide by auto show "C.cod (F g) = F ?y'" using Fg g F_ide by auto next fix g :: 'd fix g' :: 'd assume g': "D.arr (D g' g)" have g: "D.arr g" using g' by auto let ?y = "D.dom g" let ?y' = "D.cod g" let ?y'' = "D.cod g'" interpret y\: initial_arrow_to_functor C D G ?y \Fo ?y\ \\o ?y\ using g initial_arrows_exist Fo_\o_initial by simp interpret y'\: initial_arrow_to_functor C D G ?y' \Fo ?y'\ \\o ?y'\ using g initial_arrows_exist Fo_\o_initial by simp interpret y''\: initial_arrow_to_functor C D G ?y'' \Fo ?y''\ \\o ?y''\ using g' initial_arrows_exist Fo_\o_initial by auto have 1: "arrow_to_functor C D G ?y (Fo ?y') (\o ?y' \\<^sub>D g)" using g y'\.arrow by unfold_locales auto have "F g = y\.the_ext (Fo ?y') (\o ?y' \\<^sub>D g)" using g F_def by simp hence Fg: "\F g : Fo ?y \\<^sub>C Fo ?y'\ \ \o ?y' \\<^sub>D g = G (F g) \\<^sub>D \o ?y" using 1 y\.the_ext_prop by simp have 2: "arrow_to_functor C D G ?y' (Fo ?y'') (\o ?y'' \\<^sub>D g')" using g' y''\.arrow by unfold_locales auto have "F g' = y'\.the_ext (Fo ?y'') (\o ?y'' \\<^sub>D g')" using g' F_def by auto hence Fg': "\F g' : Fo ?y' \\<^sub>C Fo ?y''\ \ \o ?y'' \\<^sub>D g' = G (F g') \\<^sub>D \o ?y'" using 2 y'\.the_ext_prop by simp show "F (g' \\<^sub>D g) = F g' \\<^sub>C F g" proof - have "y\.is_ext (Fo ?y'') (\o ?y'' \\<^sub>D g' \\<^sub>D g) (F g' \\<^sub>C F g)" proof - have 3: "\F g' \\<^sub>C F g : Fo ?y \\<^sub>C Fo ?y''\" using 1 2 Fg Fg' by auto moreover have "\o ?y'' \\<^sub>D g' \\<^sub>D g = G (F g' \\<^sub>C F g) \\<^sub>D \o ?y" using Fg Fg' g g' 3 y''\.arrow by (metis C.arrI D.comp_assoc preserves_comp) ultimately show ?thesis using y\.is_ext_def by auto qed moreover have "arrow_to_functor C D G ?y (Fo ?y'') (\o ?y'' \\<^sub>D g' \\<^sub>D g)" using g g' y''\.arrow by unfold_locales auto ultimately show ?thesis using g g' F_def y\.the_ext_unique D.dom_comp D.cod_comp by auto qed qed interpretation F: "functor" D C F using F_is_functor by auto lemma F_simp: assumes "D.arr g" shows "F g = initial_arrow_to_functor.the_ext C D G (Fo (D.dom g)) (\o (D.dom g)) (Fo (D.cod g)) (\o (D.cod g) \\<^sub>D g)" using assms F_def by simp interpretation FG: composite_functor D C D F G .. interpretation \: transformation_by_components D D D.map FG.map \o proof fix y :: 'd assume y: "D.ide y" show "\\o y : D.map y \\<^sub>D FG.map y\" proof - interpret initial_arrow_to_functor C D G y \Fo y\ \\o y\ using y Fo_\o_initial initial_arrows_exist by simp show ?thesis using y F_ide arrow by auto qed next fix g :: 'd assume g: "D.arr g" show "\o (D.cod g) \\<^sub>D D.map g = FG.map g \\<^sub>D \o (D.dom g)" proof - let ?y = "D.dom g" let ?y' = "D.cod g" interpret y\: initial_arrow_to_functor C D G ?y \Fo ?y\ \\o ?y\ using g Fo_\o_initial initial_arrows_exist by simp interpret y'\: initial_arrow_to_functor C D G ?y' \Fo ?y'\ \\o ?y'\ using g Fo_\o_initial initial_arrows_exist by simp have "arrow_to_functor C D G ?y (Fo ?y') (\o ?y' \\<^sub>D g)" using g y'\.arrow by unfold_locales auto moreover have "F g = y\.the_ext (Fo ?y') (\o ?y' \\<^sub>D g)" using g F_simp by blast ultimately have "y\.is_ext (Fo ?y') (\o ?y' \\<^sub>D g) (F g)" using y\.the_ext_prop y\.is_ext_def by auto thus ?thesis using g y\.is_ext_def by simp qed qed definition \ where "\ y h = D (G h) (\.map y)" lemma \_in_hom: assumes y: "D.ide y" and f: "\f : F y \\<^sub>C x\" shows "\\ y f : y \\<^sub>D G x\" unfolding \_def using assms \.maps_ide_in_hom by auto lemma \_natural: assumes f: "\f : x \\<^sub>C x'\" and g: "\g : y' \\<^sub>D y\" and h: "\h : F y \\<^sub>C x\" shows "\ y' (f \\<^sub>C h \\<^sub>C F g) = (G f \\<^sub>D \ y h) \\<^sub>D g" proof - have "(G f \\<^sub>D \ y h) \\<^sub>D g = (G f \\<^sub>D G h \\<^sub>D \.map y) \\<^sub>D g" unfolding \_def by auto also have "... = (G f \\<^sub>D G h) \\<^sub>D \.map y \\<^sub>D g" using D.comp_assoc by fastforce also have "... = G (f \\<^sub>C h) \\<^sub>D G (F g) \\<^sub>D \.map y'" using f g h \.naturality by fastforce also have "... = (G (f \\<^sub>C h) \\<^sub>D G (F g)) \\<^sub>D \.map y'" using D.comp_assoc by fastforce also have "... = G (f \\<^sub>C h \\<^sub>C F g) \\<^sub>D \.map y'" using f g h D.comp_assoc by fastforce also have "... = \ y' (f \\<^sub>C h \\<^sub>C F g)" unfolding \_def by auto finally show ?thesis by auto qed lemma \_inverts_ext: assumes y: "D.ide y" and f: "\f : F y \\<^sub>C x\" shows "arrow_to_functor.is_ext C D G (F y) (\.map y) x (\ y f) f" proof - interpret y\: arrow_to_functor C D G y \F y\ \\.map y\ using y \.maps_ide_in_hom by unfold_locales auto show "y\.is_ext x (\ y f) f" using f y \_def y\.is_ext_def F_ide by blast qed lemma \_invertible: assumes x: "C.ide x" and g: "\g : y \\<^sub>D G x\" shows "\!f. \f : F y \\<^sub>C x\ \ \ y f = g" proof have y: "D.ide y" using g by auto interpret y\: initial_arrow_to_functor C D G y \Fo y\ \\o y\ using y initial_arrows_exist Fo_\o_initial by auto have 1: "arrow_to_functor C D G y x g" using x g by (unfold_locales, auto) let ?f = "y\.the_ext x g" have "\ y ?f = g" using \_def y\.the_ext_prop 1 F_ide x y \_inverts_ext y\.is_ext_def by fastforce moreover have "\?f : F y \\<^sub>C x\" using 1 y y\.the_ext_prop F_ide by simp ultimately show "\?f : F y \\<^sub>C x\ \ \ y ?f = g" by auto show "\f'. \f' : F y \\<^sub>C x\ \ \ y f' = g \ f' = ?f" using 1 y \_inverts_ext y\.the_ext_unique F_ide by force qed definition \ where "\ x g = (THE f. \f : F (D.dom g) \\<^sub>C x\ \ \ (D.dom g) f = g)" lemma \_in_hom: assumes "C.ide x" and "\g : y \\<^sub>D G x\" shows "C.in_hom (\ x g) (F y) x" using assms \_invertible \_def theI' [of "\f. \f : F y \\<^sub>C x\ \ \ y f = g"] by auto lemma \_\: assumes "D.ide y" and "\f : F y \\<^sub>C x\" shows "\ x (\ y f) = f" proof - have "D.dom (\ y f) = y" using assms \_in_hom by blast hence "\ x (\ y f) = (THE f'. \f' : F y \\<^sub>C x\ \ \ y f' = \ y f)" using \_def by auto moreover have "\!f'. \f' : F y \\<^sub>C x\ \ \ y f' = \ y f" using assms \_in_hom \_invertible C.ide_cod by blast ultimately show ?thesis using assms(2) by auto qed lemma \_\: assumes "C.ide x" and "\g : y \\<^sub>D G x\" shows "\ y (\ x g) = g" using assms \_invertible \_def theI' [of "\f. \f : F y \\<^sub>C x\ \ \ y f = g"] by auto theorem induces_meta_adjunction: shows "meta_adjunction C D F G \ \" using \_in_hom \_in_hom \_\ \_\ \_natural D.comp_assoc by (unfold_locales, auto) end section "Meta-Adjunctions Induce Hom-Adjunctions" text\ To obtain a hom-adjunction from a meta-adjunction, we need to exhibit hom-functors from @{term C} and @{term D} to a common set category @{term S}, so it is necessary to apply an actual concrete construction of such a category. We use the replete set category generated by the disjoint sum @{typ "('c+'d)"} of the arrow types of @{term C} and @{term D}. \ context meta_adjunction begin interpretation S: replete_setcat \undefined :: 'c+'d\ . definition inC :: "'c \ ('c+'d) setcat.arr" where "inC \ S.UP o Inl" definition inD :: "'d \ ('c+'d) setcat.arr" where "inD \ S.UP o Inr" interpretation Cop: dual_category C .. interpretation Dop: dual_category D .. interpretation CopxC: product_category Cop.comp C .. interpretation DopxD: product_category Dop.comp D .. interpretation DopxC: product_category Dop.comp C .. interpretation HomC: hom_functor C S.comp \\_. inC\ proof show "\f. C.arr f \ inC f \ S.Univ" unfolding inC_def using S.UP_mapsto by auto show "\b a. \C.ide b; C.ide a\ \ inj_on inC (C.hom b a)" unfolding inC_def using S.inj_UP by (metis injD inj_Inl inj_compose inj_on_def) qed interpretation HomD: hom_functor D S.comp \\_. inD\ proof show "\f. D.arr f \ inD f \ S.Univ" unfolding inD_def using S.UP_mapsto by auto show "\b a. \D.ide b; D.ide a\ \ inj_on inD (D.hom b a)" unfolding inD_def using S.inj_UP by (metis injD inj_Inr inj_compose inj_on_def) qed interpretation Fop: dual_functor D C F .. interpretation FopxC: product_functor Dop.comp C Cop.comp C Fop.map C.map .. interpretation DopxG: product_functor Dop.comp C Dop.comp D Dop.map G .. interpretation Hom_FopxC: composite_functor DopxC.comp CopxC.comp S.comp FopxC.map HomC.map .. interpretation Hom_DopxG: composite_functor DopxC.comp DopxD.comp S.comp DopxG.map HomD.map .. lemma inC_\ [simp]: assumes "C.ide b" and "C.ide a" and "x \ inC ` C.hom b a" shows "inC (HomC.\ (b, a) x) = x" using assms by auto lemma \_inC [simp]: assumes "C.arr f" shows "HomC.\ (C.dom f, C.cod f) (inC f) = f" using assms HomC.\_\ by blast lemma inD_\ [simp]: assumes "D.ide b" and "D.ide a" and "x \ inD ` D.hom b a" shows "inD (HomD.\ (b, a) x) = x" using assms by auto lemma \_inD [simp]: assumes "D.arr f" shows "HomD.\ (D.dom f, D.cod f) (inD f) = f" using assms HomD.\_\ by blast lemma Hom_FopxC_simp: assumes "DopxC.arr gf" shows "Hom_FopxC.map gf = S.mkArr (HomC.set (F (D.cod (fst gf)), C.dom (snd gf))) (HomC.set (F (D.dom (fst gf)), C.cod (snd gf))) (inC \ (\h. snd gf \\<^sub>C h \\<^sub>C F (fst gf)) \ HomC.\ (F (D.cod (fst gf)), C.dom (snd gf)))" using assms HomC.map_def by simp lemma Hom_DopxG_simp: assumes "DopxC.arr gf" shows "Hom_DopxG.map gf = S.mkArr (HomD.set (D.cod (fst gf), G (C.dom (snd gf)))) (HomD.set (D.dom (fst gf), G (C.cod (snd gf)))) (inD \ (\h. G (snd gf) \\<^sub>D h \\<^sub>D fst gf) \ HomD.\ (D.cod (fst gf), G (C.dom (snd gf))))" using assms HomD.map_def by simp definition \o where "\o yx = S.mkArr (HomC.set (F (fst yx), snd yx)) (HomD.set (fst yx, G (snd yx))) (inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx))" lemma \o_in_hom: assumes yx: "DopxC.ide yx" shows "\\o yx : Hom_FopxC.map yx \\<^sub>S Hom_DopxG.map yx\" proof - have "Hom_FopxC.map yx = S.mkIde (HomC.set (F (fst yx), snd yx))" using yx HomC.map_ide by auto moreover have "Hom_DopxG.map yx = S.mkIde (HomD.set (fst yx, G (snd yx)))" using yx HomD.map_ide by auto moreover have "\S.mkArr (HomC.set (F (fst yx), snd yx)) (HomD.set (fst yx, G (snd yx))) (inD \ \ (fst yx) \ HomC.\ (F (fst yx), snd yx)) : S.mkIde (HomC.set (F (fst yx), snd yx)) \\<^sub>S S.mkIde (HomD.set (fst yx, G (snd yx)))\" proof (intro S.mkArr_in_hom) show "HomC.set (F (fst yx), snd yx) \ S.Univ" using yx HomC.set_subset_Univ by simp show "HomD.set (fst yx, G (snd yx)) \ S.Univ" using yx HomD.set_subset_Univ by simp show "inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx) \ HomC.set (F (fst yx), snd yx) \ HomD.set (fst yx, G (snd yx))" proof fix x assume x: "x \ HomC.set (F (fst yx), snd yx)" show "(inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx)) x \ HomD.set (fst yx, G (snd yx))" using x yx HomC.\_mapsto [of "F (fst yx)" "snd yx"] \_in_hom [of "fst yx"] HomD.\_mapsto [of "fst yx" "G (snd yx)"] by auto qed qed ultimately show ?thesis using \o_def by auto qed interpretation \: transformation_by_components DopxC.comp S.comp Hom_FopxC.map Hom_DopxG.map \o proof fix yx assume yx: "DopxC.ide yx" show "\\o yx : Hom_FopxC.map yx \\<^sub>S Hom_DopxG.map yx\" using yx \o_in_hom by auto next fix gf assume gf: "DopxC.arr gf" show "S.comp (\o (DopxC.cod gf)) (Hom_FopxC.map gf) = S.comp (Hom_DopxG.map gf) (\o (DopxC.dom gf))" proof - let ?g = "fst gf" let ?f = "snd gf" let ?x = "C.dom ?f" let ?x' = "C.cod ?f" let ?y = "D.cod ?g" let ?y' = "D.dom ?g" let ?Fy = "F ?y" let ?Fy' = "F ?y'" let ?Fg = "F ?g" let ?Gx = "G ?x" let ?Gx' = "G ?x'" let ?Gf = "G ?f" have 1: "S.arr (Hom_FopxC.map gf) \ Hom_FopxC.map gf = S.mkArr (HomC.set (?Fy, ?x)) (HomC.set (?Fy', ?x')) (inC o (\h. ?f \\<^sub>C h \\<^sub>C ?Fg) o HomC.\ (?Fy, ?x))" using gf Hom_FopxC.preserves_arr Hom_FopxC_simp by blast have 2: "S.arr (\o (DopxC.cod gf)) \ \o (DopxC.cod gf) = S.mkArr (HomC.set (?Fy', ?x')) (HomD.set (?y', ?Gx')) (inD o \ ?y' o HomC.\ (?Fy', ?x'))" using gf \o_in_hom [of "DopxC.cod gf"] \o_def [of "DopxC.cod gf"] \_in_hom S.card_of_leq by auto have 3: "S.arr (\o (DopxC.dom gf)) \ \o (DopxC.dom gf) = S.mkArr (HomC.set (?Fy, ?x)) (HomD.set (?y, ?Gx)) (inD o \ ?y o HomC.\ (?Fy, ?x))" using gf \o_in_hom [of "DopxC.dom gf"] \o_def [of "DopxC.dom gf"] \_in_hom S.card_of_leq by auto have 4: "S.arr (Hom_DopxG.map gf) \ Hom_DopxG.map gf = S.mkArr (HomD.set (?y, ?Gx)) (HomD.set (?y', ?Gx')) (inD o (\h. ?Gf \\<^sub>D h \\<^sub>D ?g) o HomD.\ (?y, ?Gx))" using gf Hom_DopxG.preserves_arr Hom_DopxG_simp by blast have 5: "S.seq (\o (DopxC.cod gf)) (Hom_FopxC.map gf) \ S.comp (\o (DopxC.cod gf)) (Hom_FopxC.map gf) = S.mkArr (HomC.set (?Fy, ?x)) (HomD.set (?y', ?Gx')) ((inD o \ ?y' o HomC.\ (?Fy', ?x')) o (inC o (\h. ?f \\<^sub>C h \\<^sub>C ?Fg) o HomC.\ (?Fy, ?x)))" by (metis gf 1 2 DopxC.arr_iff_in_hom DopxC.ide_cod Hom_FopxC.preserves_hom S.comp_mkArr S.seqI' \o_in_hom) have 6: "S.comp (Hom_DopxG.map gf) (\o (DopxC.dom gf)) = S.mkArr (HomC.set (?Fy, ?x)) (HomD.set (?y', ?Gx')) ((inD o (\h. ?Gf \\<^sub>D h \\<^sub>D ?g) o HomD.\ (?y, ?Gx)) o (inD o \ ?y o HomC.\ (?Fy, ?x)))" by (metis 3 4 S.comp_mkArr) have 7: "restrict ((inD o \ ?y' o HomC.\ (?Fy', ?x')) o (inC o (\h. ?f \\<^sub>C h \\<^sub>C ?Fg) o HomC.\ (?Fy, ?x))) (HomC.set (?Fy, ?x)) = restrict ((inD o (\h. ?Gf \\<^sub>D h \\<^sub>D ?g) o HomD.\ (?y, ?Gx)) o (inD o \ ?y o HomC.\ (?Fy, ?x))) (HomC.set (?Fy, ?x))" proof (intro restrict_ext) show "\h. h \ HomC.set (?Fy, ?x) \ ((inD o \ ?y' o HomC.\ (?Fy', ?x')) o (inC o (\h. ?f \\<^sub>C h \\<^sub>C ?Fg) o HomC.\ (?Fy, ?x))) h = ((inD o (\h. ?Gf \\<^sub>D h \\<^sub>D ?g) o HomD.\ (?y, ?Gx)) o (inD o \ ?y o HomC.\ (?Fy, ?x))) h" proof - fix h assume h: "h \ HomC.set (?Fy, ?x)" have \h: "\HomC.\ (?Fy, ?x) h : ?Fy \\<^sub>C ?x\" using gf h HomC.\_mapsto [of ?Fy ?x] CopxC.ide_char by auto show "((inD o \ ?y' o HomC.\ (?Fy', ?x')) o (inC o (\h. ?f \\<^sub>C h \\<^sub>C ?Fg) o HomC.\ (?Fy, ?x))) h = ((inD o (\h. ?Gf \\<^sub>D h \\<^sub>D ?g) o HomD.\ (?y, ?Gx)) o (inD o \ ?y o HomC.\ (?Fy, ?x))) h" proof - have "((inD o \ ?y' o HomC.\ (?Fy', ?x')) o (inC o (\h. ?f \\<^sub>C h \\<^sub>C ?Fg) o HomC.\ (?Fy, ?x))) h = inD (\ ?y' (?f \\<^sub>C HomC.\ (?Fy, ?x) h \\<^sub>C ?Fg))" using gf \h HomC.\_mapsto HomC.\_mapsto \_in_hom \_inC [of "?f \\<^sub>C HomC.\ (?Fy, ?x) h \\<^sub>C ?Fg"] by auto also have "... = inD (D ?Gf (D (\ ?y (HomC.\ (?Fy, ?x) h)) ?g))" by (metis (no_types, lifting) C.arr_cod C.arr_dom_iff_arr C.arr_iff_in_hom C.in_homE D.arr_cod_iff_arr D.arr_iff_in_hom F.preserves_reflects_arr \_naturality \h) also have "... = ((inD o (\h. ?Gf \\<^sub>D h \\<^sub>D ?g) o HomD.\ (?y, ?Gx)) o (inD o \ ?y o HomC.\ (?Fy, ?x))) h" using gf \h \_in_hom by simp finally show ?thesis by auto qed qed qed have 8: "S.mkArr (HomC.set (?Fy, ?x)) (HomD.set (?y', ?Gx')) ((inD o \ ?y' o HomC.\ (?Fy', ?x')) o (inC o (\h. ?f \\<^sub>C h \\<^sub>C ?Fg) o HomC.\ (?Fy, ?x))) = S.mkArr (HomC.set (?Fy, ?x)) (HomD.set (?y', ?Gx')) ((inD o (\h. ?Gf \\<^sub>D h \\<^sub>D ?g) o HomD.\ (?y, ?Gx)) o (inD o \ ?y o HomC.\ (?Fy, ?x)))" using 5 7 by force show ?thesis using 5 6 8 by auto qed qed lemma \_simp: assumes YX: "DopxC.ide yx" shows "\.map yx = S.mkArr (HomC.set (F (fst yx), snd yx)) (HomD.set (fst yx, G (snd yx))) (inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx))" using YX \o_def by simp abbreviation \o where "\o yx \ S.mkArr (HomD.set (fst yx, G (snd yx))) (HomC.set (F (fst yx), snd yx)) (inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx)))" lemma \o_in_hom: assumes yx: "DopxC.ide yx" shows "\\o yx : Hom_DopxG.map yx \\<^sub>S Hom_FopxC.map yx\" proof - have "Hom_FopxC.map yx = S.mkIde (HomC.set (F (fst yx), snd yx))" using yx HomC.map_ide by auto moreover have "Hom_DopxG.map yx = S.mkIde (HomD.set (fst yx, G (snd yx)))" using yx HomD.map_ide by auto moreover have "\\o yx : S.mkIde (HomD.set (fst yx, G (snd yx))) \\<^sub>S S.mkIde (HomC.set (F (fst yx), snd yx))\" proof (intro S.mkArr_in_hom) show "HomC.set (F (fst yx), snd yx) \ S.Univ" using yx HomC.set_subset_Univ by simp show "HomD.set (fst yx, G (snd yx)) \ S.Univ" using yx HomD.set_subset_Univ by simp show "inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx)) \ HomD.set (fst yx, G (snd yx)) \ HomC.set (F (fst yx), snd yx)" proof fix x assume x: "x \ HomD.set (fst yx, G (snd yx))" show "(inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx))) x \ HomC.set (F (fst yx), snd yx)" using x yx HomD.\_mapsto [of "fst yx" "G (snd yx)"] \_in_hom [of "snd yx"] HomC.\_mapsto [of "F (fst yx)" "snd yx"] by auto qed qed ultimately show ?thesis by auto qed lemma \_inv: assumes yx: "DopxC.ide yx" shows "S.inverse_arrows (\.map yx) (\o yx)" proof - have 1: "\\.map yx : Hom_FopxC.map yx \\<^sub>S Hom_DopxG.map yx\" using yx \.preserves_hom [of yx yx yx] DopxC.ide_in_hom by blast have 2: "\\o yx : Hom_DopxG.map yx \\<^sub>S Hom_FopxC.map yx\" using yx \o_in_hom by simp have 3: "\.map yx = S.mkArr (HomC.set (F (fst yx), snd yx)) (HomD.set (fst yx, G (snd yx))) (inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx))" using yx \_simp by blast have antipar: "S.antipar (\.map yx) (\o yx)" using 1 2 by blast moreover have "S.ide (S.comp (\o yx) (\.map yx))" proof - have "S.comp (\o yx) (\.map yx) = S.mkArr (HomC.set (F (fst yx), snd yx)) (HomC.set (F (fst yx), snd yx)) ((inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx))) o (inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx)))" using 1 2 3 antipar S.comp_mkArr by auto also have "... = S.mkArr (HomC.set (F (fst yx), snd yx)) (HomC.set (F (fst yx), snd yx)) (\x. x)" proof - have "S.mkArr (HomC.set (F (fst yx), snd yx)) (HomC.set (F (fst yx), snd yx)) (\x. x) = ..." proof show "S.arr (S.mkArr (HomC.set (F (fst yx), snd yx)) (HomC.set (F (fst yx), snd yx)) (\x. x))" using yx HomC.set_subset_Univ S.arr_mkArr by simp show "\x. x \ HomC.set (F (fst yx), snd yx) \ x = ((inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx))) o (inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx))) x" proof - fix x assume x: "x \ HomC.set (F (fst yx), snd yx)" have "((inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx))) o (inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx))) x = inC (\ (snd yx) (HomD.\ (fst yx, G (snd yx)) (inD (\ (fst yx) (HomC.\ (F (fst yx), snd yx) x)))))" by simp also have "... = inC (\ (snd yx) (\ (fst yx) (HomC.\ (F (fst yx), snd yx) x)))" using x yx HomC.\_mapsto [of "F (fst yx)" "snd yx"] \_in_hom by force also have "... = inC (HomC.\ (F (fst yx), snd yx) x)" using x yx HomC.\_mapsto [of "F (fst yx)" "snd yx"] \_\ by force also have "... = x" using x yx inC_\ by simp finally show "x = ((inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx))) o (inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx))) x" by auto qed qed thus ?thesis by auto qed also have "... = S.mkIde (HomC.set (F (fst yx), snd yx))" using yx S.mkIde_as_mkArr HomC.set_subset_Univ by force finally have "S.comp (\o yx) (\.map yx) = S.mkIde (HomC.set (F (fst yx), snd yx))" by auto thus ?thesis using yx HomC.set_subset_Univ S.ide_mkIde by simp qed moreover have "S.ide (S.comp (\.map yx) (\o yx))" proof - have "S.comp (\.map yx) (\o yx) = S.mkArr (HomD.set (fst yx, G (snd yx))) (HomD.set (fst yx, G (snd yx))) ((inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx)) o (inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx))))" using 1 2 3 S.comp_mkArr antipar by fastforce also have "... = S.mkArr (HomD.set (fst yx, G (snd yx))) (HomD.set (fst yx, G (snd yx))) (\x. x)" proof - have "S.mkArr (HomD.set (fst yx, G (snd yx))) (HomD.set (fst yx, G (snd yx))) (\x. x) = ..." proof show "S.arr (S.mkArr (HomD.set (fst yx, G (snd yx))) (HomD.set (fst yx, G (snd yx))) (\x. x))" using yx HomD.set_subset_Univ S.arr_mkArr by simp show "\x. x \ (HomD.set (fst yx, G (snd yx))) \ x = ((inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx)) o (inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx)))) x" proof - fix x assume x: "x \ HomD.set (fst yx, G (snd yx))" have "((inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx)) o (inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx)))) x = inD (\ (fst yx) (HomC.\ (F (fst yx), snd yx) (inC (\ (snd yx) (HomD.\ (fst yx, G (snd yx)) x)))))" by simp also have "... = inD (\ (fst yx) (\ (snd yx) (HomD.\ (fst yx, G (snd yx)) x)))" proof - have "\\ (snd yx) (HomD.\ (fst yx, G (snd yx)) x) : F (fst yx) \ snd yx\" using x yx HomD.\_mapsto [of "fst yx" "G (snd yx)"] \_in_hom by auto thus ?thesis by simp qed also have "... = inD (HomD.\ (fst yx, G (snd yx)) x)" using x yx HomD.\_mapsto [of "fst yx" "G (snd yx)"] \_\ by force also have "... = x" using x yx inD_\ by simp finally show "x = ((inD o \ (fst yx) o HomC.\ (F (fst yx), snd yx)) o (inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx)))) x" by auto qed qed thus ?thesis by auto qed also have "... = S.mkIde (HomD.set (fst yx, G (snd yx)))" using yx S.mkIde_as_mkArr HomD.set_subset_Univ by force finally have "S.comp (\.map yx) (\o yx) = S.mkIde (HomD.set (fst yx, G (snd yx)))" by auto thus ?thesis using yx HomD.set_subset_Univ S.ide_mkIde by simp qed ultimately show ?thesis by auto qed interpretation \: natural_isomorphism DopxC.comp S.comp Hom_FopxC.map Hom_DopxG.map \.map using \_inv by unfold_locales blast interpretation \: inverse_transformation DopxC.comp S.comp Hom_FopxC.map Hom_DopxG.map \.map .. interpretation \\: inverse_transformations DopxC.comp S.comp Hom_FopxC.map Hom_DopxG.map \.map \.map using \.inverts_components by unfold_locales simp abbreviation \ where "\ \ \.map" abbreviation \ where "\ \ \.map" abbreviation HomC where "HomC \ HomC.map" abbreviation \C where "\C \ \_. inC" abbreviation HomD where "HomD \ HomD.map" abbreviation \D where "\D \ \_. inD" theorem induces_hom_adjunction: "hom_adjunction C D S.comp \C \D F G \ \" using F.is_extensional by unfold_locales auto lemma \_simp: assumes yx: "DopxC.ide yx" shows "\ yx = S.mkArr (HomD.set (fst yx, G (snd yx))) (HomC.set (F (fst yx), snd yx)) (inC o \ (snd yx) o HomD.\ (fst yx, G (snd yx)))" using assms \o_def \_inv S.inverse_unique by simp text\ The original @{term \} and @{term \} can be recovered from @{term \} and @{term \}. \ interpretation \: set_valued_transformation DopxC.comp S.comp Hom_FopxC.map Hom_DopxG.map \.map .. interpretation \: set_valued_transformation DopxC.comp S.comp Hom_DopxG.map Hom_FopxC.map \.map .. lemma \_in_terms_of_\': assumes y: "D.ide y" and f: "\f: F y \\<^sub>C x\" shows "\ y f = (HomD.\ (y, G x) o \.FUN (y, x) o inC) f" proof - have x: "C.ide x" using f by auto have "(HomD.\ (y, G x) o \.FUN (y, x) o inC) f = HomD.\ (y, G x) (restrict (inD o \ y o HomC.\ (F y, x)) (HomC.set (F y, x)) (inC f))" proof - have "S.arr (\ (y, x))" using x y by fastforce thus ?thesis using x y \o_def by simp qed also have "... = \ y f" using x y f HomC.\_mapsto \_in_hom HomC.\_mapsto C.ide_in_hom D.ide_in_hom by auto finally show ?thesis by auto qed lemma \_in_terms_of_\': assumes x: "C.ide x" and g: "\g : y \\<^sub>D G x\" shows "\ x g = (HomC.\ (F y, x) o \.FUN (y, x) o inD) g" proof - have y: "D.ide y" using g by auto have "(HomC.\ (F y, x) o \.FUN (y, x) o inD) g = HomC.\ (F y, x) (restrict (inC o \ x o HomD.\ (y, G x)) (HomD.set (y, G x)) (inD g))" proof - have "S.arr (\ (y, x))" using x y \.preserves_reflects_arr [of "(y, x)"] by simp thus ?thesis using x y \_simp by simp qed also have "... = \ x g" using x y g HomD.\_mapsto \_in_hom HomD.\_mapsto C.ide_in_hom D.ide_in_hom by auto finally show ?thesis by auto qed end section "Hom-Adjunctions Induce Meta-Adjunctions" context hom_adjunction begin definition \ :: "'d \ 'c \ 'd" where "\ y h = (HomD.\ (y, G (C.cod h)) o \.FUN (y, C.cod h) o \C (F y, C.cod h)) h" definition \ :: "'c \ 'd \ 'c" where "\ x h = (HomC.\ (F (D.dom h), x) o \.FUN (D.dom h, x) o \D (D.dom h, G x)) h" lemma Hom_FopxC_map_simp: assumes "DopxC.arr gf" shows "Hom_FopxC.map gf = S.mkArr (HomC.set (F (D.cod (fst gf)), C.dom (snd gf))) (HomC.set (F (D.dom (fst gf)), C.cod (snd gf))) (\C (F (D.dom (fst gf)), C.cod (snd gf)) o (\h. snd gf \\<^sub>C h \\<^sub>C F (fst gf)) o HomC.\ (F (D.cod (fst gf)), C.dom (snd gf)))" using assms HomC.map_def by simp lemma Hom_DopxG_map_simp: assumes "DopxC.arr gf" shows "Hom_DopxG.map gf = S.mkArr (HomD.set (D.cod (fst gf), G (C.dom (snd gf)))) (HomD.set (D.dom (fst gf), G (C.cod (snd gf)))) (\D (D.dom (fst gf), G (C.cod (snd gf))) o (\h. G (snd gf) \\<^sub>D h \\<^sub>D fst gf) o HomD.\ (D.cod (fst gf), G (C.dom (snd gf))))" using assms HomD.map_def by simp lemma \_Fun_mapsto: assumes "D.ide y" and "\f : F y \\<^sub>C x\" shows "\.FUN (y, x) \ HomC.set (F y, x) \ HomD.set (y, G x)" proof - have "S.arr (\ (y, x)) \ \.DOM (y, x) = HomC.set (F y, x) \ \.COD (y, x) = HomD.set (y, G x)" using assms HomC.set_map HomD.set_map by auto thus ?thesis using S.Fun_mapsto by blast qed lemma \_mapsto: assumes y: "D.ide y" shows "\ y \ C.hom (F y) x \ D.hom y (G x)" proof fix h assume h: "h \ C.hom (F y) x" hence 1: " \h : F y \\<^sub>C x\" by simp show "\ y h \ D.hom y (G x)" proof - have "\C (F y, x) h \ HomC.set (F y, x)" using y h 1 HomC.\_mapsto [of "F y" x] by fastforce hence "\.FUN (y, x) (\C (F y, x) h) \ HomD.set (y, G x)" using h y \_Fun_mapsto by auto thus ?thesis using y h 1 \_def HomC.\_mapsto HomD.\_mapsto [of y "G x"] by fastforce qed qed lemma \_simp: assumes "D.ide y" and "C.ide x" shows "S.arr (\ (y, x))" and "\ (y, x) = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x))" proof - show 1: "S.arr (\ (y, x))" using assms by auto hence "\ (y, x) = S.mkArr (\.DOM (y, x)) (\.COD (y, x)) (\.FUN (y, x))" using S.mkArr_Fun by metis also have "... = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\.FUN (y, x))" using assms HomC.set_map HomD.set_map by fastforce also have "... = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x))" proof (intro S.mkArr_eqI') show 2: "S.arr (S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\.FUN (y, x)))" using 1 calculation by argo show "\h. h \ HomC.set (F y, x) \ \.FUN (y, x) h = (\D (y, G x) o \ y o \C (F y, x)) h" proof - fix h assume h: "h \ HomC.set (F y, x)" have "(\D (y, G x) o \ y o HomC.\ (F y, x)) h = \D (y, G x) (\D (y, G x) (\.FUN (y, x) (\C (F y, x) (\C (F y, x) h))))" proof - have "\\C (F y, x) h : F y \\<^sub>C x\" using assms h HomC.\_mapsto [of "F y" x] by auto thus ?thesis using h \_def by auto qed also have "... = \D (y, G x) (\D (y, G x) (\.FUN (y, x) h))" using assms h HomC.\_\ \_Fun_mapsto by simp also have "... = \.FUN (y, x) h" using assms h \_Fun_mapsto [of y "\C (F y, x) h"] HomC.\_mapsto HomD.\_\ [of y "G x"] C.ide_in_hom D.ide_in_hom by (meson 2 G.preserves_ide S.arr_mkArr funcset_mem) finally show "\.FUN (y, x) h = (\D (y, G x) o \ y o \C (F y, x)) h" by auto qed qed finally show "\ (y, x) = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x))" by force qed lemma \_Fun_mapsto: assumes "C.ide x" and "\g : y \\<^sub>D G x\" shows "\.FUN (y, x) \ HomD.set (y, G x) \ HomC.set (F y, x)" proof - have "S.arr (\ (y, x)) \ \.COD (y, x) = HomC.set (F y, x) \ \.DOM (y, x) = HomD.set (y, G x)" using assms HomC.set_map HomD.set_map by auto thus ?thesis using S.Fun_mapsto by fast qed lemma \_mapsto: assumes x: "C.ide x" shows "\ x \ D.hom y (G x) \ C.hom (F y) x" proof fix h assume h: "h \ D.hom y (G x)" hence 1: "\h : y \\<^sub>D G x\" by auto show "\ x h \ C.hom (F y) x" proof - have "\.FUN (y, x) (\D (y, G x) h) \ HomC.set (F y, x)" proof - have "\D (y, G x) h \ HomD.set (y, G x)" using x h 1 HomD.\_mapsto [of y "G x"] by fastforce thus ?thesis using h x \_Fun_mapsto by auto qed thus ?thesis using x h 1 \_def HomD.\_mapsto HomC.\_mapsto [of "F y" x] by fastforce qed qed lemma \_simp: assumes "D.ide y" and "C.ide x" shows "S.arr (\ (y, x))" and "\ (y, x) = S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\C (F y, x) o \ x o \D (y, G x))" proof - show 1: "S.arr (\ (y, x))" using assms by auto hence "\ (y, x) = S.mkArr (\.DOM (y, x)) (\.COD (y, x)) (\.FUN (y, x))" using S.mkArr_Fun by metis also have "... = S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\.FUN (y, x))" using assms HomC.set_map HomD.set_map by auto also have "... = S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\C (F y, x) o \ x o \D (y, G x))" proof (intro S.mkArr_eqI') show "S.arr (S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\.FUN (y, x)))" using 1 calculation by argo show "\h. h \ HomD.set (y, G x) \ \.FUN (y, x) h = (\C (F y, x) o \ x o \D (y, G x)) h" proof - fix h assume h: "h \ HomD.set (y, G x)" have "(\C (F y, x) o \ x o HomD.\ (y, G x)) h = \C (F y, x) (\C (F y, x) (\.FUN (y, x) (\D (y, G x) (\D (y, G x) h))))" proof - have "\\D (y, G x) h : y \\<^sub>D G x\" using assms h HomD.\_mapsto [of y "G x"] by auto thus ?thesis using h \_def by auto qed also have "... = \C (F y, x) (\C (F y, x) (\.FUN (y, x) h))" using assms h HomD.\_\ \_Fun_mapsto by simp also have "... = \.FUN (y, x) h" using assms h \_Fun_mapsto HomD.\_mapsto [of y "G x"] HomC.\_\ [of "F y" x] C.ide_in_hom D.ide_in_hom by blast finally show "\.FUN (y, x) h = (\C (F y, x) o \ x o HomD.\ (y, G x)) h" by auto qed qed finally show "\ (y, x) = S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\C (F y, x) o \ x o \D (y, G x))" by force qed text\ The length of the next proof stems from having to use properties of composition of arrows in @{term[source=true] S} to infer properties of the composition of the corresponding functions. \ interpretation \\: meta_adjunction C D F G \ \ proof fix y :: 'd and x :: 'c and h :: 'c assume y: "D.ide y" and h: "\h : F y \\<^sub>C x\" have x: "C.ide x" using h by auto show "\\ y h : y \\<^sub>D G x\" proof - have "\.FUN (y, x) \ HomC.set (F y, x) \ HomD.set (y, G x)" using y h \_Fun_mapsto by blast thus ?thesis using x y h \_def HomD.\_mapsto [of y "G x"] HomC.\_mapsto [of "F y" x] by auto qed show "\ x (\ y h) = h" proof - have 0: "restrict (\h. h) (HomC.set (F y, x)) = restrict (\C (F y, x) o (\ x o \ y) o \C (F y, x)) (HomC.set (F y, x))" proof - have 1: "S.ide (\ (y, x) \\<^sub>S \ (y, x))" using x y \\.inv [of "(y, x)"] by auto hence 6: "S.seq (\ (y, x)) (\ (y, x))" by auto have 2: "\ (y, x) = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x)) \ \ (y, x) = S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\C (F y, x) o \ x o \D (y, G x))" using x y \_simp \_simp by force have 3: "S (\ (y, x)) (\ (y, x)) = S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) (\C (F y, x) o (\ x o \ y) o \C (F y, x))" proof - have 4: "S.arr (\ (y, x) \\<^sub>S \ (y, x))" using 1 by auto hence "S (\ (y, x)) (\ (y, x)) = S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) ((\C (F y, x) o \ x o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x)))" using 1 2 S.ide_in_hom S.comp_mkArr by fastforce also have "... = S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) (\C (F y, x) o (\ x o \ y) o \C (F y, x))" proof (intro S.mkArr_eqI') show "S.arr (S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) ((\C (F y, x) o \ x o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))))" using 4 calculation by simp show "\h. h \ HomC.set (F y, x) \ ((\C (F y, x) o \ x o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))) h = (\C (F y, x) o (\ x o \ y) o \C (F y, x)) h" proof - fix h assume h: "h \ HomC.set (F y, x)" hence "\\ y (\C (F y, x) h) : y \\<^sub>D G x\" using x y h HomC.\_mapsto [of "F y" x] \_mapsto by auto thus "((\C (F y, x) o \ x o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))) h = (\C (F y, x) o (\ x o \ y) o \C (F y, x)) h" using x y 1 \_mapsto HomD.\_\ by simp qed qed finally show ?thesis by simp qed moreover have "\ (y, x) \\<^sub>S \ (y, x) = S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) (\h. h)" using 1 2 6 calculation S.mkIde_as_mkArr S.arr_mkArr S.dom_mkArr S.ideD(2) by metis ultimately have 4: "S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) (\C (F y, x) o (\ x o \ y) o \C (F y, x)) = S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) (\h. h)" by auto have 5: "S.arr (S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) (\C (F y, x) o (\ x o \ y) o \C (F y, x)))" using 1 3 6 by presburger hence "restrict (\C (F y, x) o (\ x o \ y) o \C (F y, x)) (HomC.set (F y, x)) = S.Fun (S.mkArr (HomC.set (F y, x)) (HomC.set (F y, x)) (\C (F y, x) o (\ x o \ y) o \C (F y, x)))" by auto also have "... = restrict (\h. h) (HomC.set (F y, x))" using 4 5 by auto finally show ?thesis by auto qed moreover have "\C (F y, x) h \ HomC.set (F y, x)" using x y h HomC.\_mapsto [of "F y" x] by auto ultimately have "\C (F y, x) h = (\C (F y, x) o (\ x o \ y) o \C (F y, x)) (\C (F y, x) h)" using x y h HomC.\_mapsto [of "F y" x] by fast hence "\C (F y, x) (\C (F y, x) h) = \C (F y, x) ((\C (F y, x) o (\ x o \ y) o \C (F y, x)) (\C (F y, x) h))" by simp hence "h = \C (F y, x) (\C (F y, x) (\ x (\ y (\C (F y, x) (\C (F y, x) h)))))" using x y h HomC.\_\ [of "F y" x] by simp also have "... = \ x (\ y h)" using x y h HomC.\_\ HomC.\_\ \_mapsto \_mapsto by (metis PiE mem_Collect_eq) finally show ?thesis by auto qed next fix x :: 'c and h :: 'd and y :: 'd assume x: "C.ide x" and h: "\h : y \\<^sub>D G x\" have y: "D.ide y" using h by auto show "\\ x h : F y \\<^sub>C x\" using x y h \_mapsto [of x y] by auto show "\ y (\ x h) = h" proof - have 0: "restrict (\h. h) (HomD.set (y, G x)) = restrict (\D (y, G x) o (\ y o \ x) o \D (y, G x)) (HomD.set (y, G x))" proof - have 1: "S.ide (S (\ (y, x)) (\ (y, x)))" using x y \\.inv by force hence 6: "S.seq (\ (y, x)) (\ (y, x))" by auto have 2: "\ (y, x) = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x)) \ \ (y, x) = S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\C (F y, x) o \ x o \D (y, G x))" using x h \_simp \_simp by auto have 3: "S (\ (y, x)) (\ (y, x)) = S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) (\D (y, G x) o (\ y o \ x) o \D (y, G x))" proof - have 4: "S.seq (\ (y, x)) (\ (y, x))" using 1 by auto hence "S (\ (y, x)) (\ (y, x)) = S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) ((\D (y, G x) o \ y o \C (F y, x)) o (\C (F y, x) o \ x o \D (y, G x)))" using 1 2 6 S.ide_in_hom S.comp_mkArr by fastforce also have "... = S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) (\D (y, G x) o (\ y o \ x) o \D (y, G x))" proof show "S.arr (S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) ((\D (y, G x) o \ y o \C (F y, x)) o (\C (F y, x) o \ x o \D (y, G x))))" using 4 calculation by simp show "\h. h \ HomD.set (y, G x) \ ((\D (y, G x) o \ y o \C (F y, x)) o (\C (F y, x) o \ x o \D (y, G x))) h = (\D (y, G x) o (\ y o \ x) o \D (y, G x)) h" proof - fix h assume h: "h \ HomD.set (y, G x)" hence "\\ x (\D (y, G x) h) : F y \\<^sub>C x\" using x y HomD.\_mapsto [of y "G x"] \_mapsto by auto thus "((\D (y, G x) o \ y o \C (F y, x)) o (\C (F y, x) o \ x o \D (y, G x))) h = (\D (y, G x) o (\ y o \ x) o \D (y, G x)) h" using x y HomC.\_\ by simp qed qed finally show ?thesis by auto qed moreover have "\ (y, x) \\<^sub>S \ (y, x) = S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) (\h. h)" using 1 2 6 calculation by (metis S.arr_mkArr S.cod_mkArr S.ide_in_hom S.mkIde_as_mkArr S.in_homE) ultimately have 4: "S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) (\D (y, G x) o (\ y o \ x) o \D (y, G x)) = S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) (\h. h)" by auto have 5: "S.arr (S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) (\D (y, G x) o (\ y o \ x) o \D (y, G x)))" using 1 3 by fastforce hence "restrict (\D (y, G x) o (\ y o \ x) o \D (y, G x)) (HomD.set (y, G x)) = S.Fun (S.mkArr (HomD.set (y, G x)) (HomD.set (y, G x)) (\D (y, G x) o (\ y o \ x) o \D (y, G x)))" by auto also have "... = restrict (\h. h) (HomD.set (y, G x))" using 4 5 by auto finally show ?thesis by auto qed moreover have "\D (y, G x) h \ HomD.set (y, G x)" using x y h HomD.\_mapsto [of y "G x"] by auto ultimately have "\D (y, G x) h = (\D (y, G x) o (\ y o \ x) o \D (y, G x)) (\D (y, G x) h)" by fast hence "\D (y, G x) (\D (y, G x) h) = \D (y, G x) ((\D (y, G x) o (\ y o \ x) o \D (y, G x)) (\D (y, G x) h))" by simp hence "h = \D (y, G x) (\D (y, G x) (\ y (\ x (\D (y, G x) (\D (y, G x) h)))))" using x y h HomD.\_\ by simp also have "... = \ y (\ x h)" using x y h HomD.\_\ HomD.\_\ [of "\ y (\ x h)" y "G x"] \_mapsto \_mapsto by fastforce finally show ?thesis by auto qed next fix x :: 'c and x' :: 'c and y :: 'd and y' :: 'd and f :: 'c and g :: 'd and h :: 'c assume f: "\f : x \\<^sub>C x'\" and g: "\g : y' \\<^sub>D y\" and h: "\h : F y \\<^sub>C x\" have x: "C.ide x" using f by auto have y: "D.ide y" using g by auto have x': "C.ide x'" using f by auto have y': "D.ide y'" using g by auto show "\ y' (f \\<^sub>C h \\<^sub>C F g) = G f \\<^sub>D \ y h \\<^sub>D g" proof - have 0: "restrict ((\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))) (HomC.set (F y, x)) = restrict ((\D (y', G x') o \ y' o \C (F y', x')) o (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g)) o \C (F y, x)) (HomC.set (F y, x))" proof - have 1: "S.arr (\ (y, x)) \ \ (y, x) = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x))" using x y \_simp [of y x] by auto have 2: "S.arr (\ (y', x')) \ \ (y', x') = S.mkArr (HomC.set (F y', x')) (HomD.set (y', G x')) (\D (y', G x') o \ y' o \C (F y', x'))" using x' y' \_simp [of y' x'] by auto have 3: "S.arr (S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x)))) \ S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))) = S (S.mkArr (HomD.set (y, G x)) (HomD.set (y', G x')) (\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x))) (S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x)))" proof - have 1: "S.seq (S.mkArr (HomD.set (y, G x)) (HomD.set (y', G x')) (\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x))) (S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x)))" proof - have "S.arr (Hom_DopxG.map (g, f)) \ Hom_DopxG.map (g, f) = S.mkArr (HomD.set (y, G x)) (HomD.set (y', G x')) (\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x))" using f g Hom_DopxG.preserves_arr Hom_DopxG_map_simp by fastforce thus ?thesis using 1 S.cod_mkArr S.dom_mkArr S.seqI by metis qed have "S.seq (S.mkArr (HomD.set (y, G x)) (HomD.set (y', G x')) (\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x))) (S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x)))" using 1 by (intro S.seqI', auto) moreover have "S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))) = S (S.mkArr (HomD.set (y, G x)) (HomD.set (y', G x')) (\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x))) (S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x)))" using 1 S.comp_mkArr by fastforce ultimately show ?thesis by auto qed moreover have 4: "S.arr (S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o \ y' o \C (F y', x')) o (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x)))) \ S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o \ y' o \C (F y', x')) o (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x))) = S (S.mkArr (HomC.set (F y', x')) (HomD.set (y', G x')) (\D (y', G x') o \ y' o \C (F y', x'))) (S.mkArr (HomC.set (F y, x)) (HomC.set (F y', x')) (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x)))" proof - have 5: "S.seq (S.mkArr (HomC.set (F y', x')) (HomD.set (y', G x')) (\D (y', G x') o \ y' o \C (F y', x'))) (S.mkArr (HomC.set (F y, x)) (HomC.set (F y', x')) (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x)))" proof - have "S.arr (Hom_FopxC.map (g, f)) \ Hom_FopxC.map (g, f) = S.mkArr (HomC.set (F y, x)) (HomC.set (F y', x')) (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x))" using f g Hom_FopxC.preserves_arr Hom_FopxC_map_simp by fastforce thus ?thesis using 2 S.cod_mkArr S.dom_mkArr S.seqI by metis qed have "S.seq (S.mkArr (HomC.set (F y', x')) (HomD.set (y', G x')) (\D (y', G x') o \ y' o \C (F y', x'))) (S.mkArr (HomC.set (F y, x)) (HomC.set (F y', x')) (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x)))" using 5 by (intro S.seqI', auto) moreover have "S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o \ y' o \C (F y', x')) o (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x))) = S (S.mkArr (HomC.set (F y', x')) (HomD.set (y', G x')) (\D (y', G x') o \ y' o \C (F y', x'))) (S.mkArr (HomC.set (F y, x)) (HomC.set (F y', x')) (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x)))" using 5 S.comp_mkArr by fastforce ultimately show ?thesis by argo qed moreover have 2: "S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))) = S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o \ y' o \C (F y', x')) o (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x)))" proof - have "S (Hom_DopxG.map (g, f)) (\ (y, x)) = S (\ (y', x')) (Hom_FopxC.map (g, f))" using f g \.is_natural_1 \.is_natural_2 by fastforce moreover have "Hom_DopxG.map (g, f) = S.mkArr (HomD.set (y, G x)) (HomD.set (y', G x')) (\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x))" using f g Hom_DopxG_map_simp [of "(g, f)"] by fastforce moreover have "Hom_FopxC.map (g, f) = S.mkArr (HomC.set (F y, x)) (HomC.set (F y', x')) (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x))" using f g Hom_FopxC_map_simp [of "(g, f)"] by fastforce ultimately show ?thesis using 1 2 3 4 by simp qed ultimately have 6: "S.arr (S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))))" by fast hence "restrict ((\D (y', G x') o (\h. D (G f) (D h g)) o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))) (HomC.set (F y, x)) = S.Fun (S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o (\h. G f \\<^sub>D h \\<^sub>D g) o \D (y, G x)) o (\D (y, G x) o \ y o \C (F y, x))))" by simp also have "... = S.Fun (S.mkArr (HomC.set (F y, x)) (HomD.set (y', G x')) ((\D (y', G x') o \ y' o \C (F y', x')) o (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x))))" using 2 by argo also have "... = restrict ((\D (y', G x') o \ y' o \C (F y', x')) o (\C (F y', x') o (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x))) (HomC.set (F y, x))" using 4 S.Fun_mkArr by meson finally show ?thesis by auto qed hence 5: "((\D (y', G x') \ (\h. G f \\<^sub>D h \\<^sub>D g) \ \D (y, G x)) \ (\D (y, G x) \ \ y \ \C (F y, x))) (\C (F y, x) h) = (\D (y', G x') \ \ y' \ \C (F y', x') \ (\C (F y', x') \ (\h. f \\<^sub>C h \\<^sub>C F g)) \ \C (F y, x)) (\C (F y, x) h)" proof - have "\C (F y, x) h \ HomC.set (F y, x)" using x y h HomC.\_mapsto [of "F y" x] by auto thus ?thesis using 0 h restr_eqE [of "(\D (y', G x') \ (\h. G f \\<^sub>D h \\<^sub>D g) \ \D (y, G x)) \ (\D (y, G x) \ \ y \ \C (F y, x))" "HomC.set (F y, x)" "(\D (y', G x') \ \ y' \ \C (F y', x')) \ (\C (F y', x') \ (\h. f \\<^sub>C h \\<^sub>C F g) o \C (F y, x))"] by fast qed show ?thesis proof - have "\ y' (C f (C h (F g))) = \D (y', G x') (\D (y', G x') (\ y' (\C (F y', x') (\C (F y', x') (C f (C (\C (F y, x) (\C (F y, x) h)) (F g)))))))" proof - have "\D (y', G x') (\D (y', G x') (\ y' (\C (F y', x') (\C (F y', x') (C f (C (\C (F y, x) (\C (F y, x) h)) (F g))))))) = \D (y', G x') (\D (y', G x') (\ y' (\C (F y', x') (\C (F y', x') (C f (C h (F g)))))))" using x y h HomC.\_\ by simp also have "... = \D (y', G x') (\D (y', G x') (\ y' (C f (C h (F g)))))" using f g h HomC.\_\ [of "C f (C h (F g))"] by fastforce also have "... = \ y' (C f (C h (F g)))" proof - have "\\ y' (f \\<^sub>C h \\<^sub>C F g) : y' \\<^sub>D G x'\" using f g h y' x' \_mapsto [of y' x'] by auto thus ?thesis by simp qed finally show ?thesis by auto qed also have "... = \D (y', G x') (\D (y', G x') (G f \\<^sub>D \D (y, G x) (\D (y, G x) (\ y (\C (F y, x) (\C (F y, x) h)))) \\<^sub>D g))" using 5 by force also have "... = D (G f) (D (\ y h) g)" proof - have \yh: "\\ y h : y \\<^sub>D G x\" using x y h \_mapsto by auto have "\D (y', G x') (\D (y', G x') (G f \\<^sub>D \D (y, G x) (\D (y, G x) (\ y (\C (F y, x) (\C (F y, x) h)))) \\<^sub>D g)) = \D (y', G x') (\D (y', G x') (G f \\<^sub>D \D (y, G x) (\D (y, G x) (\ y h)) \\<^sub>D g))" using x y f g h by auto also have "... = \D (y', G x') (\D (y', G x') (G f \\<^sub>D \ y h \\<^sub>D g))" using \yh x' y' f g by simp also have "... = G f \\<^sub>D \ y h \\<^sub>D g" using \yh f g by fastforce finally show ?thesis by auto qed finally show ?thesis by auto qed qed qed theorem induces_meta_adjunction: shows "meta_adjunction C D F G \ \" .. end section "Putting it All Together" text\ Combining the above results, an interpretation of any one of the locales: \left_adjoint_functor\, \right_adjoint_functor\, \meta_adjunction\, \hom_adjunction\, and \unit_counit_adjunction\ extends to an interpretation of \adjunction\. \ context meta_adjunction begin interpretation F: left_adjoint_functor D C F using has_left_adjoint_functor by auto interpretation G: right_adjoint_functor C D G using has_right_adjoint_functor by auto interpretation \\: unit_counit_adjunction C D F G \ \ using induces_unit_counit_adjunction \_def \_def by auto interpretation \\: hom_adjunction C D replete_setcat.comp \C \D F G \ \ using induces_hom_adjunction by auto theorem induces_adjunction: shows "adjunction C D replete_setcat.comp \C \D F G \ \ \ \ \ \" using \_map_simp \_map_simp \_in_terms_of_\ \_in_terms_of_\' \_in_terms_of_\ \_in_terms_of_\' \_simp \_simp \_def \_def by unfold_locales auto end context unit_counit_adjunction begin interpretation \\: meta_adjunction C D F G \ \ using induces_meta_adjunction by auto interpretation F: left_adjoint_functor D C F using \\.has_left_adjoint_functor by auto interpretation G: right_adjoint_functor C D G using \\.has_right_adjoint_functor by auto interpretation \\: hom_adjunction C D replete_setcat.comp \\.\C \\.\D F G \\.\ \\.\ using \\.induces_hom_adjunction by auto theorem induces_adjunction: shows "adjunction C D replete_setcat.comp \\.\C \\.\D F G \ \ \ \ \\.\ \\.\" using \_in_terms_of_\ \_in_terms_of_\ \\.\_in_terms_of_\' \_def \\.\_in_terms_of_\' \\.\_simp \\.\_simp \_def by unfold_locales auto end context hom_adjunction begin interpretation \\: meta_adjunction C D F G \ \ using induces_meta_adjunction by auto interpretation F: left_adjoint_functor D C F using \\.has_left_adjoint_functor by auto interpretation G: right_adjoint_functor C D G using \\.has_right_adjoint_functor by auto interpretation \\: unit_counit_adjunction C D F G \\.\ \\.\ using \\.induces_unit_counit_adjunction \\.\_def \\.\_def by auto theorem induces_adjunction: shows "adjunction C D S \C \D F G \ \ \\.\ \\.\ \ \" proof fix x assume "C.ide x" thus "\\.\ x = \ x (G x)" using \\.\_map_simp \\.\_def by simp next fix y assume "D.ide y" thus "\\.\ y = \ y (F y)" using \\.\_map_simp \\.\_def by simp fix x y f assume y: "D.ide y" and f: "\f : F y \\<^sub>C x\" show "\ y f = G f \\<^sub>D \\.\ y" using y f \\.\_in_terms_of_\ \\.\_def by simp show "\ y f = (\D (y, G x) \ \.FUN (y, x) \ \C (F y, x)) f" using y f \_def by auto next fix x y g assume x: "C.ide x" and g: "\g : y \\<^sub>D G x\" show "\ x g = \\.\ x \\<^sub>C F g" using x g \\.\_in_terms_of_\ \\.\_def by simp show "\ x g = (\C (F y, x) \ \.FUN (y, x) \ \D (y, G x)) g" using x g \_def by fast next fix x y assume x: "C.ide x" and y: "D.ide y" show "\ (y, x) = S.mkArr (HomC.set (F y, x)) (HomD.set (y, G x)) (\D (y, G x) o \ y o \C (F y, x))" using x y \_simp by simp show "\ (y, x) = S.mkArr (HomD.set (y, G x)) (HomC.set (F y, x)) (\C (F y, x) o \ x o \D (y, G x))" using x y \_simp by simp qed end context left_adjoint_functor begin interpretation \\: meta_adjunction C D F G \ \ using induces_meta_adjunction by auto theorem induces_adjunction: shows "adjunction C D replete_setcat.comp \\.\C \\.\D F G \ \ \\.\ \\.\ \\.\ \\.\" using \\.induces_adjunction by auto end context right_adjoint_functor begin interpretation \\: meta_adjunction C D F G \ \ using induces_meta_adjunction by auto theorem induces_adjunction: shows "adjunction C D replete_setcat.comp \\.\C \\.\D F G \ \ \\.\ \\.\ \\.\ \\.\" using \\.induces_adjunction by auto end definition adjoint_functors where "adjoint_functors C D F G = (\\ \. meta_adjunction C D F G \ \)" lemma adjoint_functors_respects_naturally_isomorphic: assumes "adjoint_functors C D F G" and "naturally_isomorphic D C F' F" and "naturally_isomorphic C D G G'" shows "adjoint_functors C D F' G'" proof - obtain \ \ where \\: "meta_adjunction C D F G \ \" using assms(1) adjoint_functors_def by blast interpret \\: meta_adjunction C D F G \ \ using \\ by simp obtain \ where \: "natural_isomorphism D C F' F \" using assms(2) naturally_isomorphic_def by blast obtain \ where \: "natural_isomorphism C D G G' \" using assms(3) naturally_isomorphic_def by blast show ?thesis using adjoint_functors_def \ \ \\.respects_natural_isomorphism by blast qed lemma left_adjoint_functor_respects_naturally_isomorphic: assumes "left_adjoint_functor D C F" and "naturally_isomorphic D C F F'" shows "left_adjoint_functor D C F'" proof - interpret F: left_adjoint_functor D C F using assms(1) by simp have 1: "meta_adjunction C D F F.G F.\ F.\" using F.induces_meta_adjunction by simp interpret \\: meta_adjunction C D F F.G F.\ F.\ using 1 by simp have "adjoint_functors C D F F.G" using 1 adjoint_functors_def by blast hence 2: "adjoint_functors C D F' F.G" using assms(2) adjoint_functors_respects_naturally_isomorphic [of C D F F.G F' F.G] naturally_isomorphic_reflexive naturally_isomorphic_symmetric \\.G.functor_axioms by blast obtain \' \' where \'\': "meta_adjunction C D F' F.G \' \'" using 2 adjoint_functors_def by blast interpret \'\': meta_adjunction C D F' F.G \' \' using \'\' by simp show ?thesis using \'\'.has_left_adjoint_functor by simp qed lemma right_adjoint_functor_respects_naturally_isomorphic: assumes "right_adjoint_functor C D G" and "naturally_isomorphic C D G G'" shows "right_adjoint_functor C D G'" proof - interpret G: right_adjoint_functor C D G using assms(1) by simp have 1: "meta_adjunction C D G.F G G.\ G.\" using G.induces_meta_adjunction by simp interpret \\: meta_adjunction C D G.F G G.\ G.\ using 1 by simp have "adjoint_functors C D G.F G" using 1 adjoint_functors_def by blast hence 2: "adjoint_functors C D G.F G'" using assms(2) adjoint_functors_respects_naturally_isomorphic naturally_isomorphic_reflexive naturally_isomorphic_symmetric \\.F.functor_axioms by blast obtain \' \' where \'\': "meta_adjunction C D G.F G' \' \'" using 2 adjoint_functors_def by blast interpret \'\': meta_adjunction C D G.F G' \' \' using \'\' by simp show ?thesis using \'\'.has_right_adjoint_functor by simp qed section "Inverse Functors are Adjoints" (* TODO: This really should show that inverse functors induce an adjoint equivalence. *) lemma inverse_functors_induce_meta_adjunction: assumes "inverse_functors C D F G" shows "meta_adjunction C D F G (\x. G) (\y. F)" proof - interpret inverse_functors C D F G using assms by auto interpret meta_adjunction C D F G \\x. G\ \\y. F\ proof - have 1: "\y. B.arr y \ G (F y) = y" by (metis B.map_simp comp_apply inv) have 2: "\x. A.arr x \ F (G x) = x" by (metis A.map_simp comp_apply inv') show "meta_adjunction C D F G (\x. G) (\y. F)" proof fix y f x assume y: "B.ide y" and f: "\f : F y \\<^sub>A x\" show "\G f : y \\<^sub>B G x\" using y f 1 G.preserves_hom by (elim A.in_homE, auto) show "F (G f) = f" using f 2 by auto next fix x g y assume x: "A.ide x" and g: "\g : y \\<^sub>B G x\" show "\F g : F y \\<^sub>A x\" using x g 2 F.preserves_hom by (elim B.in_homE, auto) show "G (F g) = g" using g 1 A.map_def by blast next fix f x x' g y' y h assume f: "\f : x \\<^sub>A x'\" and g: "\g : y' \\<^sub>B y\" and h: "\h : F y \\<^sub>A x\" show "G (C f (C h (F g))) = D (G f) (D (G h) g)" using f g h 1 2 inv inv' A.map_def B.map_def by (elim A.in_homE B.in_homE, auto) qed qed show ?thesis .. qed lemma inverse_functors_are_adjoints: assumes "inverse_functors A B F G" shows "adjoint_functors A B F G" using assms inverse_functors_induce_meta_adjunction adjoint_functors_def by fast context inverse_functors begin lemma \_char: shows "meta_adjunction.\ B F (\x. G) = identity_functor.map B" proof (intro eqI) interpret meta_adjunction A B F G \\y. G\ \\x. F\ using inverse_functors_induce_meta_adjunction inverse_functors_axioms by auto interpret adjunction A B replete_setcat.comp \C \D F G \\y. G\ \\x. F\ \ \ \ \ using induces_adjunction by force show "natural_transformation B B B.map GF.map \" using \.natural_transformation_axioms by auto show "natural_transformation B B B.map GF.map B.map" by (simp add: B.as_nat_trans.natural_transformation_axioms inv) show "\b. B.ide b \ \ b = B.map b" using \_in_terms_of_\ \o_def \o_in_hom by fastforce qed lemma \_char: shows "meta_adjunction.\ A F G (\y. F) = identity_functor.map A" proof (intro eqI) interpret meta_adjunction A B F G \\y. G\ \\x. F\ using inverse_functors_induce_meta_adjunction inverse_functors_axioms by auto interpret adjunction A B replete_setcat.comp \C \D F G \\y. G\ \\x. F\ \ \ \ \ using induces_adjunction by force show "natural_transformation A A FG.map A.map \" using \.natural_transformation_axioms by auto show "natural_transformation A A FG.map A.map A.map" by (simp add: A.as_nat_trans.natural_transformation_axioms inv') show "\a. A.ide a \ \ a = A.map a" using \_in_terms_of_\ \o_def \o_in_hom by fastforce qed end section "Composition of Adjunctions" locale composite_adjunction = A: category A + B: category B + C: category C + F: "functor" B A F + G: "functor" A B G + F': "functor" C B F' + G': "functor" B C G' + FG: meta_adjunction A B F G \ \ + F'G': meta_adjunction B C F' G' \' \' for A :: "'a comp" (infixr "\\<^sub>A" 55) and B :: "'b comp" (infixr "\\<^sub>B" 55) and C :: "'c comp" (infixr "\\<^sub>C" 55) and F :: "'b \ 'a" and G :: "'a \ 'b" and F' :: "'c \ 'b" and G' :: "'b \ 'c" and \ :: "'b \ 'a \ 'b" and \ :: "'a \ 'b \ 'a" and \' :: "'c \ 'b \ 'c" and \' :: "'b \ 'c \ 'b" begin interpretation FG: adjunction A B replete_setcat.comp FG.\C FG.\D F G \ \ FG.\ FG.\ FG.\ FG.\ using FG.induces_adjunction by simp interpretation F'G': adjunction B C replete_setcat.comp F'G'.\C F'G'.\D F' G' \' \' F'G'.\ F'G'.\ F'G'.\ F'G'.\ using F'G'.induces_adjunction by simp (* Notation for C.in_hom is inherited here somehow, but I don't know from where. *) lemma is_meta_adjunction: shows "meta_adjunction A C (F o F') (G' o G) (\z. \' z o \ (F' z)) (\x. \ x o \' (G x))" proof - interpret G'oG: composite_functor A B C G G' .. interpret FoF': composite_functor C B A F' F .. show ?thesis proof fix y f x assume y: "C.ide y" and f: "\f : FoF'.map y \\<^sub>A x\" show "\(\' y \ \ (F' y)) f : y \\<^sub>C G'oG.map x\" using y f FG.\_in_hom F'G'.\_in_hom by simp show "(\ x \ \' (G x)) ((\' y \ \ (F' y)) f) = f" using y f FG.\_in_hom F'G'.\_in_hom FG.\_\ F'G'.\_\ by simp next fix x g y assume x: "A.ide x" and g: "\g : y \\<^sub>C G'oG.map x\" show "\(\ x \ \' (G x)) g : FoF'.map y \\<^sub>A x\" using x g FG.\_in_hom F'G'.\_in_hom by auto show "(\' y \ \ (F' y)) ((\ x \ \' (G x)) g) = g" using x g FG.\_in_hom F'G'.\_in_hom FG.\_\ F'G'.\_\ by simp next fix f x x' g y' y h assume f: "\f : x \\<^sub>A x'\" and g: "\g : y' \\<^sub>C y\" and h: "\h : FoF'.map y \\<^sub>A x\" show "(\' y' \ \ (F' y')) (f \\<^sub>A h \\<^sub>A FoF'.map g) = G'oG.map f \\<^sub>C (\' y \ \ (F' y)) h \\<^sub>C g" using f g h FG.\_naturality [of f x x' "F' g" "F' y'" "F' y" h] F'G'.\_naturality [of "G f" "G x" "G x'" g y' y "\ (F' y) h"] FG.\_in_hom by fastforce qed qed interpretation K\H: natural_transformation C C \G' o F'\ \G' o G o F o F'\ \G' o FG.\ o F'\ proof - interpret \F': natural_transformation C B F' \(G o F) o F'\ \FG.\ o F'\ using FG.\_is_natural_transformation F'.as_nat_trans.natural_transformation_axioms horizontal_composite by fastforce interpret G'\F': natural_transformation C C \G' o F'\ \G' o (G o F o F')\ \G' o (FG.\ o F')\ using \F'.natural_transformation_axioms G'.as_nat_trans.natural_transformation_axioms horizontal_composite by blast show "natural_transformation C C (G' o F') (G' o G o F o F') (G' o FG.\ o F')" using G'\F'.natural_transformation_axioms o_assoc by metis qed interpretation G'\F'o\': vertical_composite C C C.map \G' o F'\ \G' o G o F o F'\ F'G'.\ \G' o FG.\ o F'\ .. interpretation F\G: natural_transformation A A \F o F' o G' o G\ \F o G\ \F o F'G'.\ o G\ proof - interpret F\': natural_transformation B A \F o (F' o G')\ F \F o F'G'.\\ using F'G'.\.natural_transformation_axioms F.as_nat_trans.natural_transformation_axioms horizontal_composite by fastforce interpret F\'G: natural_transformation A A \F o (F' o G') o G\ \F o G\ \F o F'G'.\ o G\ using F\'.natural_transformation_axioms G.as_nat_trans.natural_transformation_axioms horizontal_composite by blast show "natural_transformation A A (F o F' o G' o G) (F o G) (F o F'G'.\ o G)" using F\'G.natural_transformation_axioms o_assoc by metis qed interpretation \oF\'G: vertical_composite A A \F \ F' \ G' \ G\ \F o G\ A.map \F o F'G'.\ o G\ FG.\ .. interpretation meta_adjunction A C \F o F'\ \G' o G\ \\z. \' z o \ (F' z)\ \\x. \ x o \' (G x)\ using is_meta_adjunction by auto interpretation adjunction A C replete_setcat.comp \C \D \F \ F'\ \G' \ G\ \\z. \' z \ \ (F' z)\ \\x. \ x \ \' (G x)\ \ \ \ \ using induces_adjunction by simp lemma \_char: shows "\ = G'\F'o\'.map" proof (intro NaturalTransformation.eqI) show "natural_transformation C C C.map (G' o G o F o F') G'\F'o\'.map" .. show "natural_transformation C C C.map (G' o G o F o F') \" by (metis (no_types, lifting) \_is_natural_transformation o_assoc) fix a assume a: "C.ide a" show "\ a = G'\F'o\'.map a" unfolding \_def using a G'\F'o\'.map_def FG.\.preserves_hom [of "F' a" "F' a" "F' a"] F'G'.\_in_terms_of_\ FG.\_map_simp \_map_simp [of a] C.ide_in_hom F'G'.\_def FG.\_def by auto qed lemma \_char: shows "\ = \oF\'G.map" proof (intro NaturalTransformation.eqI) show "natural_transformation A A (F o F' o G' o G) A.map \" by (metis (no_types, lifting) \_is_natural_transformation o_assoc) show "natural_transformation A A (F \ F' \ G' \ G) A.map \oF\'G.map" .. fix a assume a: "A.ide a" show "\ a = \oF\'G.map a" proof - have "\ a = \ a (\' (G a) (G' (G a)))" using a \_in_terms_of_\ by simp also have "... = FG.\ a \\<^sub>A F (F'G'.\ (G a) \\<^sub>B F' (G' (G a)))" - unfolding \_def - using a F'G'.\_in_terms_of_\ [of "G a" "G' (G a)" "G' (G a)"] - F'G'.\.preserves_hom [of "G a" "G a" "G a"] - FG.\_in_terms_of_\ [of a "F'G'.\ (G a) \\<^sub>B F' (G' (G a))" "(F'G'.FG.map (G a))"] - F'G'.\_def FG.\_def - by fastforce + by (metis F'G'.\_in_terms_of_\ F'G'.\o_def F'G'.\o_in_hom F'G'.\\.\_in_terms_of_\ + F'G'.\\.\_def FG.G\.natural_transformation_axioms FG.\_in_terms_of_\ a + functor.preserves_ide natural_transformation_def) also have "... = \oF\'G.map a" using a B.comp_arr_dom \oF\'G.map_def by simp finally show ?thesis by blast qed qed end section "Right Adjoints are Unique up to Natural Isomorphism" text\ As an example of the use of the of the foregoing development, we show that two right adjoints to the same functor are naturally isomorphic. \ theorem two_right_adjoints_naturally_isomorphic: assumes "adjoint_functors C D F G" and "adjoint_functors C D F G'" shows "naturally_isomorphic C D G G'" proof - text\ For any object @{term x} of @{term C}, we have that \\ x \ C.hom (F (G x)) x\ is a terminal arrow from @{term F} to @{term x}, and similarly for \\' x\. We may therefore obtain the unique coextension \\ x \ D.hom (G x) (G' x)\ of \\ x\ along \\' x\. An explicit formula for \\ x\ is \D (G' (\ x)) (\' (G x))\. Similarly, we obtain \\' x = D (G (\' x)) (\ (G' x)) \ D.hom (G' x) (G x)\. We show these are the components of inverse natural transformations between @{term G} and @{term G'}. \ obtain \ \ where \\: "meta_adjunction C D F G \ \" using assms adjoint_functors_def by blast obtain \' \' where \'\': "meta_adjunction C D F G' \' \'" using assms adjoint_functors_def by blast interpret Adj: meta_adjunction C D F G \ \ using \\ by auto interpret Adj: adjunction C D replete_setcat.comp Adj.\C Adj.\D F G \ \ Adj.\ Adj.\ Adj.\ Adj.\ using Adj.induces_adjunction by auto interpret Adj': meta_adjunction C D F G' \' \' using \'\' by auto interpret Adj': adjunction C D replete_setcat.comp Adj'.\C Adj'.\D F G' \' \' Adj'.\ Adj'.\ Adj'.\ Adj'.\ using Adj'.induces_adjunction by auto write C (infixr "\\<^sub>C" 55) write D (infixr "\\<^sub>D" 55) write Adj.C.in_hom ("\_ : _ \\<^sub>C _\") write Adj.D.in_hom ("\_ : _ \\<^sub>D _\") let ?\o = "\a. G' (Adj.\ a) \\<^sub>D Adj'.\ (G a)" interpret \: transformation_by_components C D G G' ?\o proof show "\a. Adj.C.ide a \ \G' (Adj.\ a) \\<^sub>D Adj'.\ (G a) : G a \\<^sub>D G' a\" by fastforce show "\f. Adj.C.arr f \ (G' (Adj.\ (Adj.C.cod f)) \\<^sub>D Adj'.\ (G (Adj.C.cod f))) \\<^sub>D G f = G' f \\<^sub>D G' (Adj.\ (Adj.C.dom f)) \\<^sub>D Adj'.\ (G (Adj.C.dom f))" proof - fix f assume f: "Adj.C.arr f" let ?x = "Adj.C.dom f" let ?x' = "Adj.C.cod f" have "(G' (Adj.\ (Adj.C.cod f)) \\<^sub>D Adj'.\ (G (Adj.C.cod f))) \\<^sub>D G f = G' (Adj.\ (Adj.C.cod f) \\<^sub>C F (G f)) \\<^sub>D Adj'.\ (G (Adj.C.dom f))" using f Adj'.\.naturality [of "G f"] Adj.D.comp_assoc by simp also have "... = G' (f \\<^sub>C Adj.\ (Adj.C.dom f)) \\<^sub>D Adj'.\ (G (Adj.C.dom f))" using f Adj.\.naturality by simp also have "... = G' f \\<^sub>D G' (Adj.\ (Adj.C.dom f)) \\<^sub>D Adj'.\ (G (Adj.C.dom f))" using f Adj.D.comp_assoc by simp finally show "(G' (Adj.\ (Adj.C.cod f)) \\<^sub>D Adj'.\ (G (Adj.C.cod f))) \\<^sub>D G f = G' f \\<^sub>D G' (Adj.\ (Adj.C.dom f)) \\<^sub>D Adj'.\ (G (Adj.C.dom f))" by auto qed qed interpret natural_isomorphism C D G G' \.map proof fix a assume a: "Adj.C.ide a" show "Adj.D.iso (\.map a)" proof show "Adj.D.inverse_arrows (\.map a) (\ (G' a) (Adj'.\ a))" proof text\ The proof that the two composites are identities is a modest diagram chase. This is a good example of the inference rules for the \category\, \functor\, and \natural_transformation\ locales in action. Isabelle is able to use the single hypothesis that \a\ is an identity to implicitly fill in all the details that the various quantities are in fact arrows and that the indicated composites are all well-defined, as well as to apply associativity of composition. In most cases, this is done by auto or simp without even mentioning any of the rules that are used. $$\xymatrix{ {G' a} \ar[dd]_{\eta'(G'a)} \ar[rr]^{\tau' a} \ar[dr]_{\eta(G'a)} && {G a} \ar[rr]^{\tau a} \ar[dr]_{\eta'(Ga)} && {G' a} \\ & {GFG'a} \rrtwocell\omit{\omit(2)} \ar[ur]_{G(\epsilon' a)} \ar[dr]_{\eta'(GFG'a)} && {G'FGa} \drtwocell\omit{\omit(3)} \ar[ur]_{G'(\epsilon a)} & \\ {G'FG'a} \urtwocell\omit{\omit(1)} \ar[rr]_{G'F\eta(G'a)} \ar@/_8ex/[rrrr]_{G'FG'a} && {G'FGFG'a} \dtwocell\omit{\omit(4)} \ar[ru]_{G'FG(\epsilon' a)} \ar[rr]_{G'(\epsilon(FG'a))} && {G'FG'a} \ar[uu]_{G'(\epsilon' a)} \\ &&&& }$$ \ show "Adj.D.ide (\.map a \\<^sub>D \ (G' a) (Adj'.\ a))" proof - have "\.map a \\<^sub>D \ (G' a) (Adj'.\ a) = G' a" proof - have "\.map a \\<^sub>D \ (G' a) (Adj'.\ a) = G' (Adj.\ a) \\<^sub>D (Adj'.\ (G a) \\<^sub>D G (Adj'.\ a)) \\<^sub>D Adj.\ (G' a)" using a \.map_simp_ide Adj.\_in_terms_of_\ Adj'.\_in_terms_of_\ Adj'.\.preserves_hom [of a a a] Adj.C.ide_in_hom Adj.D.comp_assoc Adj.\_def Adj.\_def by simp also have "... = G' (Adj.\ a) \\<^sub>D (G' (F (G (Adj'.\ a))) \\<^sub>D Adj'.\ (G (F (G' a)))) \\<^sub>D Adj.\ (G' a)" using a Adj'.\.naturality [of "G (Adj'.\ a)"] by auto also have "... = (G' (Adj.\ a) \\<^sub>D G' (F (G (Adj'.\ a)))) \\<^sub>D G' (F (Adj.\ (G' a))) \\<^sub>D Adj'.\ (G' a)" using a Adj'.\.naturality [of "Adj.\ (G' a)"] Adj.D.comp_assoc by auto also have "... = G' (Adj'.\ a) \\<^sub>D (G' (Adj.\ (F (G' a))) \\<^sub>D G' (F (Adj.\ (G' a)))) \\<^sub>D Adj'.\ (G' a)" proof - have "G' (Adj.\ a) \\<^sub>D G' (F (G (Adj'.\ a))) = G' (Adj'.\ a) \\<^sub>D G' (Adj.\ (F (G' a)))" proof - have "G' (Adj.\ a \\<^sub>C F (G (Adj'.\ a))) = G' (Adj'.\ a \\<^sub>C Adj.\ (F (G' a)))" using a Adj.\.naturality [of "Adj'.\ a"] by auto thus ?thesis using a by force qed thus ?thesis using Adj.D.comp_assoc by auto qed also have "... = G' (Adj'.\ a) \\<^sub>D Adj'.\ (G' a)" proof - have "G' (Adj.\ (F (G' a))) \\<^sub>D G' (F (Adj.\ (G' a))) = G' (F (G' a))" proof - have "G' (Adj.\ (F (G' a))) \\<^sub>D G' (F (Adj.\ (G' a))) = G' (Adj.\FoF\.map (G' a))" using a Adj.\FoF\.map_simp_1 by auto moreover have "Adj.\FoF\.map (G' a) = F (G' a)" using a by (simp add: Adj.\\.triangle_F) ultimately show ?thesis by auto qed thus ?thesis using a Adj.D.comp_cod_arr [of "Adj'.\ (G' a)"] by auto qed also have "... = G' a" using a Adj'.\\.triangle_G Adj'.G\o\G.map_simp_1 [of a] by auto finally show ?thesis by auto qed thus ?thesis using a by simp qed show "Adj.D.ide (\ (G' a) (Adj'.\ a) \\<^sub>D \.map a)" proof - have "\ (G' a) (Adj'.\ a) \\<^sub>D \.map a = G a" proof - have "\ (G' a) (Adj'.\ a) \\<^sub>D \.map a = G (Adj'.\ a) \\<^sub>D (Adj.\ (G' a) \\<^sub>D G' (Adj.\ a)) \\<^sub>D Adj'.\ (G a)" using a \.map_simp_ide Adj.\_in_terms_of_\ Adj'.\.preserves_hom [of a a a] Adj.C.ide_in_hom Adj.D.comp_assoc Adj.\_def by auto also have "... = G (Adj'.\ a) \\<^sub>D (G (F (G' (Adj.\ a))) \\<^sub>D Adj.\ (G' (F (G a)))) \\<^sub>D Adj'.\ (G a)" using a Adj.\.naturality [of "G' (Adj.\ a)"] by auto also have "... = (G (Adj'.\ a) \\<^sub>D G (F (G' (Adj.\ a)))) \\<^sub>D G (F (Adj'.\ (G a))) \\<^sub>D Adj.\ (G a)" using a Adj.\.naturality [of "Adj'.\ (G a)"] Adj.D.comp_assoc by auto also have "... = G (Adj.\ a) \\<^sub>D (G (Adj'.\ (F (G a))) \\<^sub>D G (F (Adj'.\ (G a)))) \\<^sub>D Adj.\ (G a)" proof - have "G (Adj'.\ a) \\<^sub>D G (F (G' (Adj.\ a))) = G (Adj.\ a) \\<^sub>D G (Adj'.\ (F (G a)))" proof - have "G (Adj'.\ a \\<^sub>C F (G' (Adj.\ a))) = G (Adj.\ a \\<^sub>C Adj'.\ (F (G a)))" using a Adj'.\.naturality [of "Adj.\ a"] by auto thus ?thesis using a by force qed thus ?thesis using Adj.D.comp_assoc by auto qed also have "... = G (Adj.\ a) \\<^sub>D Adj.\ (G a)" proof - have "G (Adj'.\ (F (G a))) \\<^sub>D G (F (Adj'.\ (G a))) = G (F (G a))" proof - have "G (Adj'.\ (F (G a))) \\<^sub>D G (F (Adj'.\ (G a))) = G (Adj'.\FoF\.map (G a))" using a Adj'.\FoF\.map_simp_1 [of "G a"] by auto moreover have "Adj'.\FoF\.map (G a) = F (G a)" using a by (simp add: Adj'.\\.triangle_F) ultimately show ?thesis by auto qed thus ?thesis using a Adj.D.comp_cod_arr by auto qed also have "... = G a" using a Adj.\\.triangle_G Adj.G\o\G.map_simp_1 [of a] by auto finally show ?thesis by auto qed thus ?thesis using a by auto qed qed qed qed have "natural_isomorphism C D G G' \.map" .. thus "naturally_isomorphic C D G G'" using naturally_isomorphic_def by blast qed end

\<^sub>1[?R, ?w1]" let ?\ = "\?R \r0, r0\ ?R\" have P: "?P = ru.apex" using ru.apex_composite by auto have Chn_\: "\?\ : ?V \\<^sub>C ?P\" using P Chn_in_hom \ by force have p0\: "\?p0 \ ?\ : ?V \\<^sub>C ?U\" using Chn_\ ru.legs_form_cospan by auto have w1: "\?w1 : ?V \\<^sub>C ?R\" using Chn_\ ru.legs_form_cospan r.dom.apex_def by blast have r1w1: "r1 \ ?w1 = ?v1" by (metis C.comp_assoc T.base_simps(3) \ \.leg1_commutes arrow_of_spans_data.select_convs(3) cod_char dom_char ideD(1) ideD(2) in_homE ru.composite_in_hom ru.leg1_composite u v) have w: "ide w" unfolding w_def using P \ w1 by (intro ide_mkIde, auto) interpret w: identity_arrow_of_spans C w using w_def w ide_char' by auto have hseq_fw: "hseq f w" using w_def ide_f w src_def trg_def w1 by auto interpret fw: two_composable_arrows_of_spans C prj0 prj1 f w using w_def hseq_fw hseq_char by unfold_locales auto interpret fw: two_composable_identity_arrows_of_spans C prj0 prj1 f w .. have hseq_gw: "hseq g w" using w_def ide_g w src_def trg_def w1 by auto interpret gw: two_composable_arrows_of_spans C prj0 prj1 g w using hseq_gw hseq_char by unfold_locales auto interpret gw: two_composable_identity_arrows_of_spans C prj0 prj1 g w .. interpret rfw: three_composable_arrows_of_spans C prj0 prj1 r f w .. interpret rfw: three_composable_identity_arrows_of_spans C prj0 prj1 r f w .. have arfw: "\\[r, f, w] : (r \ f) \ w \ r \ f \ w\" using fw.composable ide_f ide_r w rf.composable by auto have fw_apex_eq: "fw.apex = ?R \\ ?w1" using w_def fw.dom.apex_def hcomp_def hseq_fw hseq_char \ C.arr_dom_iff_arr C.pbdom_def fw.chine_eq_apex fw.chine_simps(1) by auto have gw_apex_eq: "gw.apex = ?R \\ ?w1" using w_def \ w1 gw.dom.apex_def hcomp_def hseq_gw hseq_char by auto text \ Well, CKS say take \\ = p\<^sub>0\\, but taking this literally and trying to define \\\ so that \Chn \ = ?p\<^sub>0 \ ?\\, does not yield the required \dom \ = ?R \\ ?w1\. We need \\Chn \ : ?R \\ ?w1 \\<^sub>C ?U\\, so we have to compose with a projection, which leads to: \Chn \ = ?p0 \ ?\ \ \