(* Title: InternalEquivalence Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) section "Internal Equivalences" theory InternalEquivalence imports Bicategory begin text \ An \emph{internal equivalence} in a bicategory consists of antiparallel 1-cells \f\ and \g\ together with invertible 2-cells \\\ : src f \ g \ f\\ and \\\ : f \ g \ src g\\. Objects in a bicategory are said to be \emph{equivalent} if they are connected by an internal equivalence. In this section we formalize the definition of internal equivalence and the related notions ``equivalence map'' and ``equivalent objects'', and we establish some basic facts about these notions. \ subsection "Definition of Equivalence" text \ The following locale is defined to prove some basic facts about an equivalence (or an adjunction) in a bicategory that are ``syntactic'' in the sense that they depend only on the configuration (source, target, domain, codomain) of the arrows involved and not on further properties such as the triangle identities (for adjunctions) or assumptions about invertibility (for equivalences). Proofs about adjunctions and equivalences become more automatic once we have introduction and simplification rules in place about this syntax. \ locale adjunction_data_in_bicategory = bicategory + fixes f :: 'a and g :: 'a and \ :: 'a and \ :: 'a assumes ide_left [simp]: "ide f" and ide_right [simp]: "ide g" and unit_in_vhom: "\\ : src f \ g \ f\" and counit_in_vhom: "\\ : f \ g \ src g\" begin (* * TODO: It is difficult to orient the following equations to make them useful as * default simplifications, so they have to be cited explicitly where they are used. *) lemma antipar (*[simp]*): shows "trg g = src f" and "src g = trg f" apply (metis counit_in_vhom hseqE ideD(1) ide_right src.preserves_reflects_arr vconn_implies_hpar(3)) by (metis arrI not_arr_null seq_if_composable src.preserves_reflects_arr unit_in_vhom vconn_implies_hpar(1) vconn_implies_hpar(3)) lemma counit_in_hom [intro]: shows "\\ : trg f \ trg f\" and "\\ : f \ g \ trg f\" using counit_in_vhom vconn_implies_hpar antipar by auto lemma unit_in_hom [intro]: shows "\\ : src f \ src f\" and "\\ : src f \ g \ f\" using unit_in_vhom vconn_implies_hpar antipar by auto lemma unit_simps [simp]: shows "arr \" and "dom \ = src f" and "cod \ = g \ f" and "src \ = src f" and "trg \ = src f" using unit_in_hom antipar by auto lemma counit_simps [simp]: shows "arr \" and "dom \ = f \ g" and "cod \ = trg f" and "src \ = trg f" and "trg \ = trg f" using counit_in_hom antipar by auto text \ The expressions found in the triangle identities for an adjunction come up relatively frequently, so it is useful to have established some basic facts about them, even if the triangle identities themselves have not actually been introduced as assumptions in the current context. \ lemma triangle_in_hom: shows "\(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) : f \ src f \ trg f \ f\" and "\(g \ \) \ \[g, f, g] \ (\ \ g) : trg g \ g \ g \ src g\" and "\\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f] : f \ f\" and "\\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g] : g \ g\" using antipar by auto lemma triangle_equiv_form: shows "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f] \ \[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f] = f" and "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g] \ \[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g] = g" proof - show "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f] \ \[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f] = f" proof assume 1: "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f]" have "\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f] = \[f] \ ((\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \)) \ \\<^sup>-\<^sup>1[f]" using comp_assoc by simp also have "... = \[f] \ (\\<^sup>-\<^sup>1[f] \ \[f]) \ \\<^sup>-\<^sup>1[f]" using 1 by simp also have "... = f" using comp_assoc comp_arr_inv' comp_inv_arr' iso_lunit iso_runit comp_arr_dom comp_cod_arr by simp finally show "\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f] = f" by simp next assume 2: "\[f] \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) \ \\<^sup>-\<^sup>1[f] = f" have "\\<^sup>-\<^sup>1[f] \ \[f] = \\<^sup>-\<^sup>1[f] \ f \ \[f]" using comp_cod_arr by simp also have "... = (\\<^sup>-\<^sup>1[f] \ \[f]) \ ((\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \)) \ (\\<^sup>-\<^sup>1[f] \ \[f])" using 2 comp_assoc by (metis (no_types, lifting)) also have "... = (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \)" using comp_arr_inv' comp_inv_arr' iso_lunit iso_runit comp_arr_dom comp_cod_arr hseqI' antipar by (metis ide_left in_homE lunit_simps(4) runit_simps(4) triangle_in_hom(1)) finally show "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f]" by simp qed show "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g] \ \[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g] = g" proof assume 1: "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" have "\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g] = \[g] \ ((g \ \) \ \[g, f, g] \ (\ \ g)) \ \\<^sup>-\<^sup>1[g]" using comp_assoc by simp also have "... = \[g] \ (\\<^sup>-\<^sup>1[g] \ \[g]) \ \\<^sup>-\<^sup>1[g]" using 1 by simp also have "... = g" using comp_assoc comp_arr_inv' comp_inv_arr' iso_lunit iso_runit comp_arr_dom comp_cod_arr by simp finally show "\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g] = g" by simp next assume 2: "\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g] = g" have "\\<^sup>-\<^sup>1[g] \ \[g] = \\<^sup>-\<^sup>1[g] \ g \ \[g]" using comp_cod_arr by simp also have "... = \\<^sup>-\<^sup>1[g] \ (\[g] \ (g \ \) \ \[g, f, g] \ (\ \ g) \ \\<^sup>-\<^sup>1[g]) \ \[g]" using 2 by simp also have "... = (\\<^sup>-\<^sup>1[g] \ \[g]) \ ((g \ \) \ \[g, f, g] \ (\ \ g)) \ (\\<^sup>-\<^sup>1[g] \ \[g])" using comp_assoc by simp also have "... = (g \ \) \ \[g, f, g] \ (\ \ g)" using comp_arr_inv' comp_inv_arr' iso_lunit iso_runit comp_arr_dom comp_cod_arr hseqI' antipar by (metis ide_right in_homE lunit_simps(4) runit_simps(4) triangle_in_hom(2)) finally show "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" by simp qed qed end locale equivalence_in_bicategory = adjunction_data_in_bicategory + assumes unit_is_iso [simp]: "iso \" and counit_is_iso [simp]: "iso \" begin lemma dual_equivalence: shows "equivalence_in_bicategory V H \ \ src trg g f (inv \) (inv \)" using antipar by unfold_locales auto end abbreviation (in bicategory) internal_equivalence where "internal_equivalence f g \ \ \ equivalence_in_bicategory V H \ \ src trg f g \ \" subsection "Quasi-Inverses and Equivalence Maps" text \ Antiparallel 1-cells \f\ and \g\ are \emph{quasi-inverses} if they can be extended to an internal equivalence. We will use the term \emph{equivalence map} to refer to a 1-cell that has a quasi-inverse. \ context bicategory begin definition quasi_inverses where "quasi_inverses f g \ \\ \. internal_equivalence f g \ \" lemma quasi_inversesI: assumes "ide f" and "ide g" and "src f \ g \ f" and "f \ g \ trg f" shows "quasi_inverses f g" proof (unfold quasi_inverses_def) have 1: "src g = trg f" using assms ideD(1) isomorphic_implies_ide(2) by blast obtain \ where \: "\\ : src f \ g \ f\ \ iso \" using assms isomorphic_def by auto obtain \ where \: "\\ : f \ g \ trg f\ \ iso \" using assms isomorphic_def by auto have "equivalence_in_bicategory V H \ \ src trg f g \ \" using assms 1 \ \ by unfold_locales auto thus "\\ \. internal_equivalence f g \ \" by auto qed lemma quasi_inversesE: assumes "quasi_inverses f g" and "\ide f; ide g; src f \ g \ f; f \ g \ trg f\ \ T" shows T proof - obtain \ \ where \\: "internal_equivalence f g \ \" using assms quasi_inverses_def by auto interpret \\: equivalence_in_bicategory V H \ \ src trg f g \ \ using \\ by simp have "ide f \ ide g" by simp moreover have "src f \ g \ f" using isomorphic_def \\.unit_in_hom by auto moreover have "f \ g \ trg f" using isomorphic_def \\.counit_in_hom by auto ultimately show T using assms by blast qed lemma quasi_inverse_unique: assumes "quasi_inverses f g" and "quasi_inverses f g'" shows "isomorphic g g'" proof - obtain \ \ where \\: "internal_equivalence f g \ \" using assms quasi_inverses_def by auto interpret \\: equivalence_in_bicategory V H \ \ src trg f g \ \ using \\ by simp obtain \' \' where \'\': "internal_equivalence f g' \' \'" using assms quasi_inverses_def by auto interpret \'\': equivalence_in_bicategory V H \ \ src trg f g' \' \' using \'\' by simp have "\\[g'] \ (g' \ \) \ \[g', f, g] \ (\' \ g) \ \\<^sup>-\<^sup>1[g] : g \ g'\" using \\.unit_in_hom \\.unit_is_iso \\.antipar \'\'.antipar by (intro comp_in_homI' hseqI') auto moreover have "iso (\[g'] \ (g' \ \) \ \[g', f, g] \ (\' \ g) \ \\<^sup>-\<^sup>1[g])" using \\.unit_in_hom \\.unit_is_iso \\.antipar \'\'.antipar by (intro isos_compose) auto ultimately show ?thesis using isomorphic_def by auto qed lemma quasi_inverses_symmetric: assumes "quasi_inverses f g" shows "quasi_inverses g f" using assms quasi_inverses_def equivalence_in_bicategory.dual_equivalence by metis definition equivalence_map where "equivalence_map f \ \g \ \. equivalence_in_bicategory V H \ \ src trg f g \ \" lemma equivalence_mapI: assumes "quasi_inverses f g" shows "equivalence_map f" using assms quasi_inverses_def equivalence_map_def by auto lemma equivalence_mapE: assumes "equivalence_map f" obtains g where "quasi_inverses f g" using assms equivalence_map_def quasi_inverses_def by auto lemma equivalence_map_is_ide: assumes "equivalence_map f" shows "ide f" using assms adjunction_data_in_bicategory.ide_left equivalence_in_bicategory_def equivalence_map_def by fastforce lemma obj_is_equivalence_map: assumes "obj a" shows "equivalence_map a" using assms by (metis equivalence_mapI isomorphic_symmetric objE obj_self_composable(2) quasi_inversesI) lemma equivalence_respects_iso: assumes "equivalence_in_bicategory V H \ \ src trg f g \ \" and "\\ : f \ f'\" and "iso \" and "\\ : g \ g'\" and "iso \" shows "internal_equivalence f' g' ((g' \ \) \ (\ \ f) \ \) (\ \ (inv \ \ g) \ (f' \ inv \))" proof - interpret E: equivalence_in_bicategory V H \ \ src trg f g \ \ using assms by auto show ?thesis proof show f': "ide f'" using assms by auto show g': "ide g'" using assms by auto show 1: "\(g' \ \) \ (\ \ f) \ \ : src f' \ g' \ f'\" using assms f' g' E.unit_in_hom E.antipar(2) vconn_implies_hpar(3) apply (intro comp_in_homI) apply auto by (intro hcomp_in_vhom) auto show "iso ((g' \ \) \ (\ \ f) \ \)" using assms 1 g' vconn_implies_hpar(3) E.antipar(2) iso_hcomp by (intro isos_compose) auto show 1: "\\ \ (inv \ \ g) \ (f' \ inv \) : f' \ g' \ src g'\" using assms f' ide_in_hom(2) vconn_implies_hpar(3-4) E.antipar(1-2) by (intro comp_in_homI) auto show "iso (\ \ (inv \ \ g) \ (f' \ inv \))" using assms 1 isos_compose by (metis E.counit_is_iso E.ide_right arrI f' hseqE ide_is_iso iso_hcomp iso_inv_iso seqE) qed qed lemma equivalence_map_preserved_by_iso: assumes "equivalence_map f" and "f \ f'" shows "equivalence_map f'" proof - obtain g \ \ where E: "equivalence_in_bicategory V H \ \ src trg f g \ \" using assms equivalence_map_def by auto interpret E: equivalence_in_bicategory V H \ \ src trg f g \ \ using E by auto obtain \ where \: "\\ : f \ f'\ \ iso \" using assms isomorphic_def isomorphic_symmetric by blast have "equivalence_in_bicategory V H \ \ src trg f' g ((g \ \) \ (g \ f) \ \) (\ \ (inv \ \ g) \ (f' \ inv g))" using E \ equivalence_respects_iso [of f g \ \ \ f' g g] by fastforce thus ?thesis using equivalence_map_def by auto qed lemma equivalence_preserved_by_iso_right: assumes "equivalence_in_bicategory V H \ \ src trg f g \ \" and "\\ : g \ g'\" and "iso \" shows "equivalence_in_bicategory V H \ \ src trg f g' ((\ \ f) \ \) (\ \ (f \ inv \))" proof interpret E: equivalence_in_bicategory V H \ \ src trg f g \ \ using assms by auto show "ide f" by simp show "ide g'" using assms(2) isomorphic_def by auto show "\(\ \ f) \ \ : src f \ g' \ f\" using assms E.antipar(2) E.ide_left by blast show "\\ \ (f \ inv \) : f \ g' \ src g'\" using assms vconn_implies_hpar(3-4) E.counit_in_vhom E.antipar(1) ide_in_hom(2) by (intro comp_in_homI, auto) show "iso ((\ \ f) \ \)" using assms E.antipar isos_compose by auto show "iso (\ \ (f \ inv \))" using assms E.antipar isos_compose by auto qed lemma equivalence_preserved_by_iso_left: assumes "equivalence_in_bicategory V H \ \ src trg f g \ \" and "\\ : f \ f'\" and "iso \" shows "equivalence_in_bicategory V H \ \ src trg f' g ((g \ \) \ \) (\ \ (inv \ \ g))" proof interpret E: equivalence_in_bicategory V H \ \ src trg f g \ \ using assms by auto show "ide f'" using assms by auto show "ide g" by simp show "\(g \ \) \ \ : src f' \ g \ f'\" using assms E.unit_in_hom E.antipar by auto show "\\ \ (inv \ \ g) : f' \ g \ src g\" using assms E.counit_in_hom E.antipar ide_in_hom(2) vconn_implies_hpar(3) by auto show "iso ((g \ \) \ \)" using assms E.antipar isos_compose by auto show "iso (\ \ (inv \ \ g))" using assms E.antipar isos_compose by auto qed definition some_quasi_inverse where "some_quasi_inverse f = (SOME g. quasi_inverses f g)" notation some_quasi_inverse ("_\<^sup>~" [1000] 1000) lemma quasi_inverses_some_quasi_inverse: assumes "equivalence_map f" shows "quasi_inverses f f\<^sup>~" and "quasi_inverses f\<^sup>~ f" using assms some_quasi_inverse_def quasi_inverses_def equivalence_map_def someI_ex [of "\g. quasi_inverses f g"] quasi_inverses_symmetric by auto lemma quasi_inverse_antipar: assumes "equivalence_map f" shows "src f\<^sup>~ = trg f" and "trg f\<^sup>~ = src f" proof - obtain \ \ where \\: "equivalence_in_bicategory V H \ \ src trg f f\<^sup>~ \ \" using assms equivalence_map_def quasi_inverses_some_quasi_inverse quasi_inverses_def by blast interpret \\: equivalence_in_bicategory V H \ \ src trg f \f\<^sup>~\ \ \ using \\ by simp show "src f\<^sup>~ = trg f" using \\.antipar by simp show "trg f\<^sup>~ = src f" using \\.antipar by simp qed lemma quasi_inverse_in_hom [intro]: assumes "equivalence_map f" shows "\f\<^sup>~ : trg f \ src f\" and "\f\<^sup>~ : f\<^sup>~ \ f\<^sup>~\" using assms equivalence_mapE apply (intro in_homI in_hhomI) apply (metis equivalence_map_is_ide ideD(1) not_arr_null quasi_inverse_antipar(2) src.preserves_ide trg.is_extensional) apply (simp_all add: quasi_inverse_antipar) using assms quasi_inversesE quasi_inverses_some_quasi_inverse(2) by blast lemma quasi_inverse_simps [simp]: assumes "equivalence_map f" shows "equivalence_map f\<^sup>~" and "ide f\<^sup>~" and "src f\<^sup>~ = trg f" and "trg f\<^sup>~ = src f" and "dom f\<^sup>~ = f\<^sup>~" and "cod f\<^sup>~ = f\<^sup>~" using assms equivalence_mapE quasi_inverse_in_hom quasi_inverses_some_quasi_inverse equivalence_map_is_ide apply auto by (meson equivalence_mapI) lemma quasi_inverse_quasi_inverse: assumes "equivalence_map f" shows "(f\<^sup>~)\<^sup>~ \ f" proof - have "quasi_inverses f\<^sup>~ (f\<^sup>~)\<^sup>~" using assms quasi_inverses_some_quasi_inverse by simp moreover have "quasi_inverses f\<^sup>~ f" using assms quasi_inverses_some_quasi_inverse quasi_inverses_symmetric by simp ultimately show ?thesis using quasi_inverse_unique by simp qed lemma comp_quasi_inverse: assumes "equivalence_map f" shows "f\<^sup>~ \ f \ src f" and "f \ f\<^sup>~ \ trg f" proof - obtain \ \ where \\: "equivalence_in_bicategory V H \ \ src trg f f\<^sup>~ \ \" using assms equivalence_map_def quasi_inverses_some_quasi_inverse quasi_inverses_def by blast interpret \\: equivalence_in_bicategory V H \ \ src trg f \f\<^sup>~\ \ \ using \\ by simp show "f\<^sup>~ \ f \ src f" using quasi_inverses_some_quasi_inverse quasi_inverses_def \\.unit_in_hom \\.unit_is_iso isomorphic_def by blast show "f \ f\<^sup>~ \ trg f" using quasi_inverses_some_quasi_inverse quasi_inverses_def \\.counit_in_hom \\.counit_is_iso isomorphic_def by blast qed lemma quasi_inverse_transpose: assumes "ide f" and "ide g" and "ide h" and "f \ g \ h" shows "equivalence_map g \ f \ h \ g\<^sup>~" and "equivalence_map f \ g \ f\<^sup>~ \ h" proof - have 1: "src f = trg g" using assms equivalence_map_is_ide by fastforce show "equivalence_map g \ f \ h \ g\<^sup>~" proof - assume g: "equivalence_map g" have 2: "ide g\<^sup>~" using g by simp have "f \ f \ src f" using assms isomorphic_unit_right isomorphic_symmetric by blast also have "... \ f \ trg g" using assms 1 isomorphic_reflexive by auto also have "... \ f \ g \ g\<^sup>~" using assms g 1 comp_quasi_inverse(2) isomorphic_symmetric hcomp_ide_isomorphic by simp also have "... \ (f \ g) \ g\<^sup>~" using assms g 1 2 assoc'_in_hom [of f g "g\<^sup>~"] iso_assoc' isomorphic_def by auto also have "... \ h \ g\<^sup>~" using assms g 1 2 by (simp add: hcomp_isomorphic_ide) finally show ?thesis by blast qed show "equivalence_map f \ g \ f\<^sup>~ \ h" proof - assume f: "equivalence_map f" have 2: "ide f\<^sup>~" using f by simp have "g \ src f \ g" using assms 1 isomorphic_unit_left isomorphic_symmetric by metis also have "... \ (f\<^sup>~ \ f) \ g" using assms f 1 comp_quasi_inverse(1) [of f] isomorphic_symmetric hcomp_isomorphic_ide by simp also have "... \ f\<^sup>~ \ f \ g" using assms f 1 assoc_in_hom [of "f\<^sup>~" f g] iso_assoc isomorphic_def by auto also have "... \ f\<^sup>~ \ h" using assms f 1 equivalence_map_is_ide quasi_inverses_some_quasi_inverse hcomp_ide_isomorphic by simp finally show ?thesis by blast qed qed end subsection "Composing Equivalences" locale composite_equivalence_in_bicategory = bicategory V H \ \ src trg + fg: equivalence_in_bicategory V H \ \ src trg f g \ \ + hk: equivalence_in_bicategory V H \ \ src trg h k \ \ for V :: "'a \ 'a \ 'a" (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 \ :: "'a" and \ :: "'a" and h :: "'a" and k :: "'a" and \ :: "'a" and \ :: "'a" + assumes composable: "src h = trg f" begin abbreviation \ where "\ \ \\<^sup>-\<^sup>1[g, k, h \ f] \ (g \ \[k, h, f]) \ (g \ \ \ f) \ (g \ \\<^sup>-\<^sup>1[f]) \ \" abbreviation \ where "\ \ \ \ (h \ \[k]) \ (h \ \ \ k) \ (h \ \\<^sup>-\<^sup>1[f, g, k]) \ \[h, f, g \ k]" interpretation adjunction_data_in_bicategory V H \ \ src trg \h \ f\ \g \ k\ \ \ proof show "ide (h \ f)" using composable by simp show "ide (g \ k)" using fg.antipar hk.antipar composable by simp show "\\ : src (h \ f) \ (g \ k) \ h \ f\" using fg.antipar hk.antipar composable by fastforce show "\\ : (h \ f) \ g \ k \ src (g \ k)\" using fg.antipar hk.antipar composable by fastforce qed interpretation equivalence_in_bicategory V H \ \ src trg \h \ f\ \g \ k\ \ \ proof show "iso \" using fg.antipar hk.antipar composable fg.unit_is_iso hk.unit_is_iso iso_hcomp iso_lunit' hseq_char by (intro isos_compose, auto) show "iso \" using fg.antipar hk.antipar composable fg.counit_is_iso hk.counit_is_iso iso_hcomp iso_lunit hseq_char by (intro isos_compose, auto) qed lemma is_equivalence: shows "equivalence_in_bicategory V H \ \ src trg (h \ f) (g \ k) \ \" .. sublocale equivalence_in_bicategory V H \ \ src trg \h \ f\ \g \ k\ \ \ using is_equivalence by simp end context bicategory begin lemma equivalence_maps_compose: assumes "equivalence_map f" and "equivalence_map f'" and "src f' = trg f" shows "equivalence_map (f' \ f)" proof - obtain g \ \ where fg: "equivalence_in_bicategory V H \ \ src trg f g \ \" using assms(1) equivalence_map_def by auto interpret fg: equivalence_in_bicategory V H \ \ src trg f g \ \ using fg by auto obtain g' \' \' where f'g': "equivalence_in_bicategory V H \ \ src trg f' g' \' \'" using assms(2) equivalence_map_def by auto interpret f'g': equivalence_in_bicategory V H \ \ src trg f' g' \' \' using f'g' by auto interpret composite_equivalence_in_bicategory V H \ \ src trg f g \ \ f' g' \' \' using assms(3) by (unfold_locales, auto) show ?thesis using equivalence_map_def equivalence_in_bicategory_axioms by auto qed lemma quasi_inverse_hcomp': assumes "equivalence_map f" and "equivalence_map f'" and "equivalence_map (f \ f')" and "quasi_inverses f g" and "quasi_inverses f' g'" shows "quasi_inverses (f \ f') (g' \ g)" proof - obtain \ \ where g: "internal_equivalence f g \ \" using assms quasi_inverses_def by auto interpret g: equivalence_in_bicategory V H \ \ src trg f g \ \ using g by simp obtain \' \' where g': "internal_equivalence f' g' \' \'" using assms quasi_inverses_def by auto interpret g': equivalence_in_bicategory V H \ \ src trg f' g' \' \' using g' by simp interpret gg': composite_equivalence_in_bicategory V H \ \ src trg f' g' \' \' f g \ \ using assms equivalence_map_is_ide [of "f \ f'"] apply unfold_locales using ideD(1) by fastforce show ?thesis unfolding quasi_inverses_def using gg'.equivalence_in_bicategory_axioms by auto qed lemma quasi_inverse_hcomp: assumes "equivalence_map f" and "equivalence_map f'" and "equivalence_map (f \ f')" shows "(f \ f')\<^sup>~ \ f'\<^sup>~ \ f\<^sup>~" using assms quasi_inverses_some_quasi_inverse quasi_inverse_hcomp' quasi_inverse_unique by metis lemma quasi_inverse_respects_isomorphic: assumes "equivalence_map f" and "equivalence_map f'" and "f \ f'" shows "f\<^sup>~ \ f'\<^sup>~" proof - have hpar: "src f = src f' \ trg f = trg f'" using assms isomorphic_implies_hpar by simp have "f\<^sup>~ \ f\<^sup>~ \ trg f" using isomorphic_unit_right by (metis assms(1) isomorphic_symmetric quasi_inverse_simps(2-3)) also have "... \ f\<^sup>~ \ f' \ f'\<^sup>~" proof - have "trg f \ f' \ f'\<^sup>~" using assms quasi_inverse_hcomp by (simp add: comp_quasi_inverse(2) hpar isomorphic_symmetric) thus ?thesis using assms hpar hcomp_ide_isomorphic isomorphic_implies_hpar(2) by auto qed also have "... \ (f\<^sup>~ \ f') \ f'\<^sup>~" using assms hcomp_assoc_isomorphic hpar isomorphic_implies_ide(2) isomorphic_symmetric by auto also have "... \ (f\<^sup>~ \ f) \ f'\<^sup>~" proof - have "f\<^sup>~ \ f' \ f\<^sup>~ \ f" using assms isomorphic_symmetric hcomp_ide_isomorphic isomorphic_implies_hpar(1) by auto thus ?thesis using assms hcomp_isomorphic_ide isomorphic_implies_hpar(1) by auto qed also have "... \ src f \ f'\<^sup>~" proof - have "f\<^sup>~ \ f \ src f" using assms comp_quasi_inverse by simp thus ?thesis using assms hcomp_isomorphic_ide isomorphic_implies_hpar by simp qed also have "... \ f'\<^sup>~" using assms isomorphic_unit_left by (metis hpar quasi_inverse_simps(2,4)) finally show ?thesis by blast qed end subsection "Equivalent Objects" context bicategory begin definition equivalent_objects where "equivalent_objects a b \ \f. \f : a \ b\ \ equivalence_map f" lemma equivalent_objects_reflexive: assumes "obj a" shows "equivalent_objects a a" using assms by (metis equivalent_objects_def ide_in_hom(1) objE obj_is_equivalence_map) lemma equivalent_objects_symmetric: assumes "equivalent_objects a b" shows "equivalent_objects b a" using assms by (metis equivalent_objects_def in_hhomE quasi_inverse_in_hom(1) quasi_inverse_simps(1)) lemma equivalent_objects_transitive [trans]: assumes "equivalent_objects a b" and "equivalent_objects b c" shows "equivalent_objects a c" proof - obtain f where f: "\f : a \ b\ \ equivalence_map f" using assms equivalent_objects_def by auto obtain g where g: "\g : b \ c\ \ equivalence_map g" using assms equivalent_objects_def by auto have "\g \ f : a \ c\ \ equivalence_map (g \ f)" using f g equivalence_maps_compose by auto thus ?thesis using equivalent_objects_def by auto qed end subsection "Transporting Arrows along Equivalences" text \ We show in this section that transporting the arrows of one hom-category to another along connecting equivalence maps yields an equivalence of categories. This is useful, because it seems otherwise hard to establish that the transporting functor is full. \ locale two_equivalences_in_bicategory = bicategory V H \ \ src trg + e\<^sub>0: equivalence_in_bicategory V H \ \ src trg e\<^sub>0 d\<^sub>0 \\<^sub>0 \\<^sub>0 + e\<^sub>1: equivalence_in_bicategory V H \ \ src trg e\<^sub>1 d\<^sub>1 \\<^sub>1 \\<^sub>1 for V :: "'a \ 'a \ 'a" (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 e\<^sub>0 :: "'a" and d\<^sub>0 :: "'a" and \\<^sub>0 :: "'a" and \\<^sub>0 :: "'a" and e\<^sub>1 :: "'a" and d\<^sub>1 :: "'a" and \\<^sub>1 :: "'a" and \\<^sub>1 :: "'a" begin interpretation hom: subcategory V \\\. \\ : src e\<^sub>0 \ src e\<^sub>1\\ using hhom_is_subcategory by simp (* TODO: The preceding interpretation somehow brings in unwanted notation. *) no_notation in_hom ("\_ : _ \ _\") interpretation hom': subcategory V \\\. \\ : trg e\<^sub>0 \ trg e\<^sub>1\\ using hhom_is_subcategory by simp no_notation in_hom ("\_ : _ \ _\") abbreviation (input) F where "F \ \\. e\<^sub>1 \ \ \ d\<^sub>0" interpretation F: "functor" hom.comp hom'.comp F proof show 1: "\f. hom.arr f \ hom'.arr (e\<^sub>1 \ f \ d\<^sub>0)" using hom.arr_char hom'.arr_char in_hhom_def e\<^sub>0.antipar(1-2) by simp show "\f. \ hom.arr f \ e\<^sub>1 \ f \ d\<^sub>0 = hom'.null" using 1 hom.arr_char hom'.null_char in_hhom_def by (metis e\<^sub>0.antipar(1) hseqE hseq_char' hcomp_simps(2)) show "\f. hom.arr f \ hom'.dom (e\<^sub>1 \ f \ d\<^sub>0) = e\<^sub>1 \ hom.dom f \ d\<^sub>0" using hom.arr_char hom.dom_char hom'.arr_char hom'.dom_char by (metis 1 hcomp_simps(3) e\<^sub>0.ide_right e\<^sub>1.ide_left hom'.inclusion hseq_char ide_char) show "\f. hom.arr f \ hom'.cod (e\<^sub>1 \ f \ d\<^sub>0) = e\<^sub>1 \ hom.cod f \ d\<^sub>0" using hom.arr_char hom.cod_char hom'.arr_char hom'.cod_char by (metis 1 hcomp_simps(4) e\<^sub>0.ide_right e\<^sub>1.ide_left hom'.inclusion hseq_char ide_char) show "\g f. hom.seq g f \ e\<^sub>1 \ hom.comp g f \ d\<^sub>0 = hom'.comp (e\<^sub>1 \ g \ d\<^sub>0) (e\<^sub>1 \ f \ d\<^sub>0)" using 1 hom.seq_char hom.arr_char hom.comp_char hom'.arr_char hom'.comp_char whisker_left [of e\<^sub>1] whisker_right [of d\<^sub>0] apply auto apply (metis hseq_char seqE src_vcomp) by (metis hseq_char hseq_char') qed abbreviation (input) G where "G \ \\'. d\<^sub>1 \ \' \ e\<^sub>0" interpretation G: "functor" hom'.comp hom.comp G proof show 1: "\f. hom'.arr f \ hom.arr (d\<^sub>1 \ f \ e\<^sub>0)" using hom.arr_char hom'.arr_char in_hhom_def e\<^sub>1.antipar(1) e\<^sub>1.antipar(2) by simp show "\f. \ hom'.arr f \ d\<^sub>1 \ f \ e\<^sub>0 = hom.null" using 1 hom.arr_char hom'.null_char in_hhom_def by (metis e\<^sub>1.antipar(2) hom'.arrI hom.null_char hseqE hseq_char' hcomp_simps(2)) show "\f. hom'.arr f \ hom.dom (d\<^sub>1 \ f \ e\<^sub>0) = d\<^sub>1 \ hom'.dom f \ e\<^sub>0" using 1 hom.arr_char hom.dom_char hom'.arr_char hom'.dom_char by (metis hcomp_simps(3) e\<^sub>0.ide_left e\<^sub>1.ide_right hom.inclusion hseq_char ide_char) show "\f. hom'.arr f \ hom.cod (d\<^sub>1 \ f \ e\<^sub>0) = d\<^sub>1 \ hom'.cod f \ e\<^sub>0" using 1 hom.arr_char hom.cod_char hom'.arr_char hom'.cod_char by (metis hcomp_simps(4) e\<^sub>0.ide_left e\<^sub>1.ide_right hom.inclusion hseq_char ide_char) show "\g f. hom'.seq g f \ d\<^sub>1 \ hom'.comp g f \ e\<^sub>0 = hom.comp (d\<^sub>1 \ g \ e\<^sub>0) (d\<^sub>1 \ f \ e\<^sub>0)" using 1 hom'.seq_char hom'.arr_char hom'.comp_char hom.arr_char hom.comp_char whisker_left [of d\<^sub>1] whisker_right [of e\<^sub>0] apply auto apply (metis hseq_char seqE src_vcomp) by (metis hseq_char hseq_char') qed interpretation GF: composite_functor hom.comp hom'.comp hom.comp F G .. interpretation FG: composite_functor hom'.comp hom.comp hom'.comp G F .. abbreviation (input) \\<^sub>0 where "\\<^sub>0 f \ (d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, f \ d\<^sub>0, e\<^sub>0]) \ \[d\<^sub>1, e\<^sub>1, (f \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[f, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ f \ \\<^sub>0) \ \\<^sup>-\<^sup>1[f \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[f]" lemma \\<^sub>0_in_hom: assumes "\f : src e\<^sub>0 \ src e\<^sub>1\" and "ide f" shows "\\\<^sub>0 f : src e\<^sub>0 \ src e\<^sub>1\" and "\\\<^sub>0 f : f \ d\<^sub>1 \ (e\<^sub>1 \ f \ d\<^sub>0) \ e\<^sub>0\" proof - show "\\\<^sub>0 f : f \ d\<^sub>1 \ (e\<^sub>1 \ f \ d\<^sub>0) \ e\<^sub>0\" using assms e\<^sub>0.antipar e\<^sub>1.antipar by fastforce thus "\\\<^sub>0 f : src e\<^sub>0 \ src e\<^sub>1\" using assms src_dom [of "\\<^sub>0 f"] trg_dom [of "\\<^sub>0 f"] by (metis arrI dom_comp in_hhom_def runit'_simps(4) seqE) qed lemma iso_\\<^sub>0: assumes "\f : src e\<^sub>0 \ src e\<^sub>1\" and "ide f" shows "iso (\\<^sub>0 f)" using assms iso_lunit' iso_runit' e\<^sub>0.antipar e\<^sub>1.antipar by (intro isos_compose) auto interpretation \: transformation_by_components hom.comp hom.comp hom.map \G o F\ \\<^sub>0 proof fix f assume f: "hom.ide f" show "hom.in_hom (\\<^sub>0 f) (hom.map f) (GF.map f)" proof (unfold hom.in_hom_char, intro conjI) show "hom.arr (hom.map f)" using f by simp show "hom.arr (GF.map f)" using f by simp show "hom.arr (\\<^sub>0 f)" using f hom.ide_char hom.arr_char \\<^sub>0_in_hom by simp show "\\\<^sub>0 f : hom.map f \ GF.map f\" using f hom.ide_char hom.arr_char hom'.ide_char hom'.arr_char F.preserves_arr \\<^sub>0_in_hom by auto qed next fix \ assume \: "hom.arr \" show "hom.comp (\\<^sub>0 (hom.cod \)) (hom.map \) = hom.comp (GF.map \) (\\<^sub>0 (hom.dom \))" proof - have "hom.comp (\\<^sub>0 (hom.cod \)) (hom.map \) = \\<^sub>0 (cod \) \ \" proof - have "hom.map \ = \" using \ by simp moreover have "\\<^sub>0 (hom.cod \) = \\<^sub>0 (cod \)" using \ hom.arr_char hom.cod_char by simp moreover have "hom.arr (\\<^sub>0 (cod \))" using \ hom.arr_char \\<^sub>0_in_hom [of "cod \"] by (metis hom.arr_cod hom.cod_simp ide_cod in_hhom_def) moreover have "seq (\\<^sub>0 (cod \)) \" proof show 1: "\\ : dom \ \ cod \\" using \ hom.arr_char by auto show "\\\<^sub>0 (cod \) : cod \ \ d\<^sub>1 \ (e\<^sub>1 \ cod \ \ d\<^sub>0) \ e\<^sub>0\" using \ hom.arr_char \\<^sub>0_in_hom by (metis 1 arrI hom.arr_cod hom.cod_simp ide_cod) qed ultimately show ?thesis using \ hom.comp_char by simp qed also have "... = (d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ \[d\<^sub>1, e\<^sub>1, (cod \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[cod \, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ cod \ \ \\<^sub>0) \ \\<^sup>-\<^sup>1[cod \ \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[cod \] \ \" using \ hom.arr_char comp_assoc by auto also have "... = ((d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ \[d\<^sub>1, e\<^sub>1, (cod \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[cod \, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ cod \ \ \\<^sub>0) \ \\<^sup>-\<^sup>1[cod \ \ src e\<^sub>0] \ (\ \ src e\<^sub>0)) \ \\<^sup>-\<^sup>1[dom \]" using \ hom.arr_char runit'_naturality [of \] comp_assoc by auto also have "... = ((d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ \[d\<^sub>1, e\<^sub>1, (cod \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[cod \, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ cod \ \ \\<^sub>0) \ (src e\<^sub>1 \ \ \ src e\<^sub>0) \ \\<^sup>-\<^sup>1[dom \ \ src e\<^sub>0]) \ \\<^sup>-\<^sup>1[dom \]" using \ hom.arr_char lunit'_naturality [of "\ \ src e\<^sub>0"] by force also have "... = ((d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ \[d\<^sub>1, e\<^sub>1, (cod \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[cod \, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ cod \ \ \\<^sub>0) \ (src e\<^sub>1 \ \ \ src e\<^sub>0)) \ \\<^sup>-\<^sup>1[dom \ \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[dom \]" using comp_assoc by simp also have "... = ((d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ \[d\<^sub>1, e\<^sub>1, (cod \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[cod \, d\<^sub>0, e\<^sub>0]) \ ((d\<^sub>1 \ e\<^sub>1) \ \ \ d\<^sub>0 \ e\<^sub>0)) \ (\\<^sub>1 \ dom \ \ \\<^sub>0) \ \\<^sup>-\<^sup>1[dom \ \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[dom \]" proof - have "(\\<^sub>1 \ cod \ \ \\<^sub>0) \ (src e\<^sub>1 \ \ \ src e\<^sub>0) = \\<^sub>1 \ \ \ \\<^sub>0" using \ hom.arr_char comp_arr_dom comp_cod_arr interchange [of \\<^sub>1 "src e\<^sub>1" "cod \ \ \\<^sub>0" "\ \ src e\<^sub>0"] interchange [of "cod \" \ \\<^sub>0 "src e\<^sub>0"] by (metis e\<^sub>0.unit_in_hom(1) e\<^sub>0.unit_simps(2) e\<^sub>1.unit_simps(1) e\<^sub>1.unit_simps(2) hseqI' in_hhom_def) also have "... = ((d\<^sub>1 \ e\<^sub>1) \ \ \ d\<^sub>0 \ e\<^sub>0) \ (\\<^sub>1 \ dom \ \ \\<^sub>0)" proof - have "\\<^sub>1 \ \ \ \\<^sub>0 = (d\<^sub>1 \ e\<^sub>1) \ \\<^sub>1 \ \ \ dom \ \ (d\<^sub>0 \ e\<^sub>0) \ \\<^sub>0" using \ hom.arr_char comp_arr_dom comp_cod_arr by auto also have "... = (d\<^sub>1 \ e\<^sub>1) \ \\<^sub>1 \ (\ \ d\<^sub>0 \ e\<^sub>0) \ (dom \ \ \\<^sub>0)" using \ hom.arr_char comp_cod_arr interchange [of \ "dom \" "d\<^sub>0 \ e\<^sub>0" \\<^sub>0] by auto also have "... = ((d\<^sub>1 \ e\<^sub>1) \ \ \ d\<^sub>0 \ e\<^sub>0) \ (\\<^sub>1 \ dom \ \ \\<^sub>0)" using \ hom.arr_char comp_arr_dom comp_cod_arr interchange [of "d\<^sub>1 \ e\<^sub>1" \\<^sub>1 "\ \ d\<^sub>0 \ e\<^sub>0" "dom \ \ \\<^sub>0"] interchange [of \ "dom \" "d\<^sub>0 \ e\<^sub>0" \\<^sub>0] by (metis e\<^sub>0.unit_in_hom(1) e\<^sub>0.unit_simps(1) e\<^sub>0.unit_simps(3) e\<^sub>1.unit_simps(1) e\<^sub>1.unit_simps(3) hom.inclusion hseqI) finally show ?thesis by simp qed finally have "(\\<^sub>1 \ cod \ \ \\<^sub>0) \ (src e\<^sub>1 \ \ \ src e\<^sub>0) = ((d\<^sub>1 \ e\<^sub>1) \ \ \ d\<^sub>0 \ e\<^sub>0) \ (\\<^sub>1 \ dom \ \ \\<^sub>0)" by simp thus ?thesis using comp_assoc by simp qed also have "... = ((d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ \[d\<^sub>1, e\<^sub>1, (cod \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ (\ \ d\<^sub>0) \ e\<^sub>0) \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[dom \, d\<^sub>0, e\<^sub>0])) \ (\\<^sub>1 \ dom \ \ \\<^sub>0) \ \\<^sup>-\<^sup>1[dom \ \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[dom \]" using \ hom.arr_char e\<^sub>0.antipar e\<^sub>1.antipar assoc'_naturality [of \ d\<^sub>0 e\<^sub>0] whisker_left [of "d\<^sub>1 \ e\<^sub>1" "\\<^sup>-\<^sup>1[cod \, d\<^sub>0, e\<^sub>0]" "\ \ d\<^sub>0 \ e\<^sub>0"] whisker_left [of "d\<^sub>1 \ e\<^sub>1" "(\ \ d\<^sub>0) \ e\<^sub>0" "\\<^sup>-\<^sup>1[dom \, d\<^sub>0, e\<^sub>0]"] by auto also have "... = ((d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ \[d\<^sub>1, e\<^sub>1, (cod \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ (\ \ d\<^sub>0) \ e\<^sub>0)) \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[dom \, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ dom \ \ \\<^sub>0) \ \\<^sup>-\<^sup>1[dom \ \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[dom \]" using comp_assoc by simp also have "... = ((d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ (d\<^sub>1 \ e\<^sub>1 \ (\ \ d\<^sub>0) \ e\<^sub>0) \ \[d\<^sub>1, e\<^sub>1, (dom \ \ d\<^sub>0) \ e\<^sub>0]) \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[dom \, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ dom \ \ \\<^sub>0) \ \\<^sup>-\<^sup>1[dom \ \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[dom \]" using \ hom.arr_char e\<^sub>0.antipar e\<^sub>1.antipar assoc_naturality [of d\<^sub>1 e\<^sub>1 "(\ \ d\<^sub>0) \ e\<^sub>0"] hseqI by auto also have "... = ((d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]) \ (d\<^sub>1 \ e\<^sub>1 \ (\ \ d\<^sub>0) \ e\<^sub>0)) \ \[d\<^sub>1, e\<^sub>1, (dom \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[dom \, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ dom \ \ \\<^sub>0) \ \\<^sup>-\<^sup>1[dom \ \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[dom \]" using comp_assoc by simp also have "... = ((d\<^sub>1 \ (e\<^sub>1 \ \ \ d\<^sub>0) \ e\<^sub>0) \ (d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, dom \ \ d\<^sub>0, e\<^sub>0])) \ \[d\<^sub>1, e\<^sub>1, (dom \ \ d\<^sub>0) \ e\<^sub>0] \ ((d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[dom \, d\<^sub>0, e\<^sub>0]) \ (\\<^sub>1 \ dom \ \ \\<^sub>0) \ \\<^sup>-\<^sup>1[dom \ \ src e\<^sub>0] \ \\<^sup>-\<^sup>1[dom \]" using \ hom.arr_char e\<^sub>0.antipar e\<^sub>1.antipar assoc'_naturality [of e\<^sub>1 "\ \ d\<^sub>0" e\<^sub>0] whisker_left [of d\<^sub>1 "\\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0]" "e\<^sub>1 \ (\ \ d\<^sub>0) \ e\<^sub>0"] whisker_left [of d\<^sub>1 "(e\<^sub>1 \ \ \ d\<^sub>0) \ e\<^sub>0" "\\<^sup>-\<^sup>1[e\<^sub>1, dom \ \ d\<^sub>0, e\<^sub>0]"] by auto also have "... = hom.comp (GF.map \) (\\<^sub>0 (hom.dom \))" proof - have "hom.arr (GF.map \)" using \ by blast moreover have "hom.arr (\\<^sub>0 (hom.dom \))" using \ hom.arr_char hom.in_hom_char \\<^sub>0_in_hom(1) hom.dom_closed hom.dom_simp hom.inclusion ide_dom by metis moreover have "seq (GF.map \) (\\<^sub>0 (hom.dom \))" proof show "\\\<^sub>0 (hom.dom \) : dom \ \ d\<^sub>1 \ (e\<^sub>1 \ dom \ \ d\<^sub>0) \ e\<^sub>0\" using \ hom.arr_char hom.dom_char hom.in_hom_char \\<^sub>0_in_hom hom.dom_closed hom.dom_simp hom.inclusion ide_dom by metis show "\GF.map \ : d\<^sub>1 \ (e\<^sub>1 \ dom \ \ d\<^sub>0) \ e\<^sub>0 \ d\<^sub>1 \ (e\<^sub>1 \ cod \ \ d\<^sub>0) \ e\<^sub>0\" using \ hom.arr_char hom'.arr_char F.preserves_arr apply simp apply (intro hcomp_in_vhom) by (auto simp add: e\<^sub>0.antipar e\<^sub>1.antipar in_hhom_def) qed ultimately show ?thesis using \ hom.comp_char comp_assoc hom.dom_simp by auto qed finally show ?thesis by blast qed qed lemma transformation_by_components_\\<^sub>0: shows "transformation_by_components hom.comp hom.comp hom.map (G o F) \\<^sub>0" .. interpretation \: natural_isomorphism hom.comp hom.comp hom.map \G o F\ \.map proof fix f assume "hom.ide f" hence f: "ide f \ \f : src e\<^sub>0 \ src e\<^sub>1\" using hom.ide_char hom.arr_char by simp show "hom.iso (\.map f)" proof (unfold hom.iso_char hom.arr_char, intro conjI) show "iso (\.map f)" using f iso_\\<^sub>0 \.map_simp_ide hom.ide_char hom.arr_char by simp moreover show "\\.map f : src e\<^sub>0 \ src e\<^sub>1\" using f hom.ide_char hom.arr_char by blast ultimately show "\inv (\.map f) : src e\<^sub>0 \ src e\<^sub>1\" by auto qed qed lemma natural_isomorphism_\: shows "natural_isomorphism hom.comp hom.comp hom.map (G o F) \.map" .. definition \ where "\ \ \.map" lemma \_ide_simp: assumes "\f : src e\<^sub>0 \ src e\<^sub>1\" and "ide f" shows "\ f = \\<^sub>0 f" unfolding \_def using assms hom.ide_char hom.arr_char by simp lemma \_components_are_iso: assumes "\f : src e\<^sub>0 \ src e\<^sub>1\" and "ide f" shows "iso (\ f)" using assms \_def \.components_are_iso hom.ide_char hom.arr_char hom.iso_char by simp lemma \_eq: shows "\ = (\\. if \\ : src e\<^sub>0 \ src e\<^sub>1\ then \\<^sub>0 (cod \) \ \ else null)" proof fix \ have "\ \\ : src e\<^sub>0 \ src e\<^sub>1\ \ \.map \ = null" using hom.comp_char hom.null_char hom.arr_char by (simp add: \.is_extensional) moreover have "\\ : src e\<^sub>0 \ src e\<^sub>1\ \ \.map \ = \\<^sub>0 (cod \) \ \" unfolding \.map_def apply auto using hom.comp_char hom.arr_char hom.dom_simp hom.cod_simp apply simp by (metis (no_types, lifting) \\<^sub>0_in_hom(1) hom.cod_closed hom.inclusion ide_cod local.ext) ultimately show "\ \ = (if \\ : src e\<^sub>0 \ src e\<^sub>1\ then \\<^sub>0 (cod \) \ \ else null)" unfolding \_def by auto qed lemma \_in_hom [intro]: assumes "\\ : src e\<^sub>0 \ src e\<^sub>1\" shows "\\ \ : src e\<^sub>0 \ src e\<^sub>1\" and "\\ \ : dom \ \ d\<^sub>1 \ (e\<^sub>1 \ cod \ \ d\<^sub>0) \ e\<^sub>0\" proof - show "\\ \ : src e\<^sub>0 \ src e\<^sub>1\" using assms \_eq \_def hom.arr_char \.preserves_reflects_arr by presburger show "\\ \ : dom \ \ d\<^sub>1 \ (e\<^sub>1 \ cod \ \ d\<^sub>0) \ e\<^sub>0\" unfolding \_eq using assms apply simp apply (intro comp_in_homI) apply auto proof - show "\\\<^sup>-\<^sup>1[cod \] : cod \ \ cod \ \ src e\<^sub>0\" using assms by auto show "\\\<^sup>-\<^sup>1[cod \ \ src e\<^sub>0] : cod \ \ src e\<^sub>0 \ src e\<^sub>1 \ cod \ \ src e\<^sub>0\" using assms by auto show "\\\<^sub>1 \ cod \ \ \\<^sub>0 : src e\<^sub>1 \ cod \ \ src e\<^sub>0 \ (d\<^sub>1 \ e\<^sub>1) \ cod \ \ (d\<^sub>0 \ e\<^sub>0)\" using assms e\<^sub>0.unit_in_hom(2) e\<^sub>1.unit_in_hom(2) apply (intro hcomp_in_vhom) apply auto by fastforce show "\(d\<^sub>1 \ e\<^sub>1) \ \\<^sup>-\<^sup>1[cod \, d\<^sub>0, e\<^sub>0] : (d\<^sub>1 \ e\<^sub>1) \ cod \ \ d\<^sub>0 \ e\<^sub>0 \ (d\<^sub>1 \ e\<^sub>1) \ (cod \ \ d\<^sub>0) \ e\<^sub>0\" using assms assoc'_in_hom e\<^sub>0.antipar(1-2) e\<^sub>1.antipar(2) apply (intro hcomp_in_vhom) by auto show "\\[d\<^sub>1, e\<^sub>1, (cod \ \ d\<^sub>0) \ e\<^sub>0] : (d\<^sub>1 \ e\<^sub>1) \ (cod \ \ d\<^sub>0) \ e\<^sub>0 \ d\<^sub>1 \ e\<^sub>1 \ (cod \ \ d\<^sub>0) \ e\<^sub>0\" using assms assoc_in_hom e\<^sub>0.antipar(1-2) e\<^sub>1.antipar(2) by auto show "\d\<^sub>1 \ \\<^sup>-\<^sup>1[e\<^sub>1, cod \ \ d\<^sub>0, e\<^sub>0] : d\<^sub>1 \ e\<^sub>1 \ (cod \ \ d\<^sub>0) \ e\<^sub>0 \ d\<^sub>1 \ (e\<^sub>1 \ cod \ \ d\<^sub>0) \ e\<^sub>0\" using assms assoc'_in_hom [of "d\<^sub>1" "e\<^sub>1 \ cod \ \ d\<^sub>0" "e\<^sub>0"] e\<^sub>0.antipar(1-2) e\<^sub>1.antipar(1-2) apply (intro hcomp_in_vhom) apply auto by fastforce qed qed lemma \_simps [simp]: assumes "\\ : src e\<^sub>0 \ src e\<^sub>1\" shows "arr (\ \)" and "src (\ \) = src e\<^sub>0" and "trg (\ \) = src e\<^sub>1" and "dom (\ \) = dom \" and "cod (\ \) = d\<^sub>1 \ (e\<^sub>1 \ cod \ \ d\<^sub>0) \ e\<^sub>0" using assms \_in_hom by auto interpretation d\<^sub>0: equivalence_in_bicategory V H \ \ src trg d\<^sub>0 e\<^sub>0 \inv \\<^sub>0\ \inv \\<^sub>0\ using e\<^sub>0.dual_equivalence by simp interpretation d\<^sub>1: equivalence_in_bicategory V H \ \ src trg d\<^sub>1 e\<^sub>1 \inv \\<^sub>1\ \inv \\<^sub>1\ using e\<^sub>1.dual_equivalence by simp interpretation d\<^sub>0e\<^sub>0: two_equivalences_in_bicategory V H \ \ src trg d\<^sub>0 e\<^sub>0 \inv \\<^sub>0\ \inv \\<^sub>0\ d\<^sub>1 e\<^sub>1 \inv \\<^sub>1\ \inv \\<^sub>1\ .. interpretation \: inverse_transformation hom'.comp hom'.comp hom'.map \F o G\ d\<^sub>0e\<^sub>0.\ proof - interpret \': natural_isomorphism hom'.comp hom'.comp hom'.map \F o G\ d\<^sub>0e\<^sub>0.\ using d\<^sub>0e\<^sub>0.natural_isomorphism_\ e\<^sub>0.antipar e\<^sub>1.antipar d\<^sub>0e\<^sub>0.\_eq d\<^sub>0e\<^sub>0.\_def by metis show "inverse_transformation hom'.comp hom'.comp hom'.map (F o G) d\<^sub>0e\<^sub>0.\" .. qed definition \ where "\ \ \.map" lemma \_ide_simp: assumes "\f': trg e\<^sub>0 \ trg e\<^sub>1\" and "ide f'" shows "\ f' = \[f'] \ \[f' \ trg e\<^sub>0] \ (\\<^sub>1 \ f' \ \\<^sub>0) \ ((e\<^sub>1 \ d\<^sub>1) \ \[f', e\<^sub>0, d\<^sub>0]) \ \\<^sup>-\<^sup>1[e\<^sub>1, d\<^sub>1, (f' \ e\<^sub>0) \ d\<^sub>0] \ (e\<^sub>1 \ \[d\<^sub>1, f' \ e\<^sub>0, d\<^sub>0])" proof - have "hom'.ide f'" using assms hom'.ide_char hom'.arr_char by simp hence "\.map f' = hom'.inv (d\<^sub>0e\<^sub>0.\ f')" using assms by simp also have "... = inv (d\<^sub>0e\<^sub>0.\ f')" using hom'.inv_char \hom'.ide f'\ by simp also have "... = inv (d\<^sub>0e\<^sub>0.\\<^sub>0 f')" using assms e\<^sub>0.antipar e\<^sub>1.antipar d\<^sub>0e\<^sub>0.\_eq d\<^sub>0e\<^sub>0.\_ide_simp [of f'] by simp also have "... = ((((inv \\<^sup>-\<^sup>1[f'] \ inv \\<^sup>-\<^sup>1[f' \ trg e\<^sub>0]) \ inv (inv \\<^sub>1 \ f' \ inv \\<^sub>0)) \ inv ((e\<^sub>1 \ d\<^sub>1) \ \\<^sup>-\<^sup>1[f', e\<^sub>0, d\<^sub>0])) \ inv \[e\<^sub>1, d\<^sub>1, (f' \ e\<^sub>0) \ d\<^sub>0]) \ inv (e\<^sub>1 \ \\<^sup>-\<^sup>1[d\<^sub>1, f' \ e\<^sub>0, d\<^sub>0])" proof - text \There has to be a better way to do this.\ have 1: "\A B C D E F. \ iso A; iso B; iso C; iso D; iso E; iso F; arr (((((A \ B) \ C) \ D) \ E) \ F) \ \ inv (((((A \ B) \ C) \ D) \ E) \ F) = inv F \ inv E \ inv D \ inv C \ inv B \ inv A" using inv_comp isos_compose seqE by metis have "arr (d\<^sub>0e\<^sub>0.\\<^sub>0 f')" using assms e\<^sub>0.antipar(2) e\<^sub>1.antipar(2) d\<^sub>0e\<^sub>0.iso_\\<^sub>0 [of f'] iso_is_arr by simp moreover have "iso \\<^sup>-\<^sup>1[f']" using assms iso_runit' by simp moreover have "iso \\<^sup>-\<^sup>1[f' \ trg e\<^sub>0]" using assms iso_lunit' by auto moreover have "iso (inv \\<^sub>1 \ f' \ inv \\<^sub>0)" using assms e\<^sub>0.antipar(2) e\<^sub>1.antipar(2) in_hhom_def by simp moreover have "iso ((e\<^sub>1 \ d\<^sub>1) \ \\<^sup>-\<^sup>1[f', e\<^sub>0, d\<^sub>0])" using assms e\<^sub>0.antipar e\<^sub>1.antipar(1) e\<^sub>1.antipar(2) in_hhom_def iso_hcomp by (metis calculation(1) e\<^sub>0.ide_left e\<^sub>0.ide_right e\<^sub>1.ide_left e\<^sub>1.ide_right hseqE ide_is_iso iso_assoc' seqE) moreover have "iso \[e\<^sub>1, d\<^sub>1, (f' \ e\<^sub>0) \ d\<^sub>0]" using assms e\<^sub>0.antipar e\<^sub>1.antipar by auto moreover have "iso (e\<^sub>1 \ \\<^sup>-\<^sup>1[d\<^sub>1, f' \ e\<^sub>0, d\<^sub>0])" using assms e\<^sub>0.antipar e\<^sub>1.antipar by (metis calculation(1) e\<^sub>0.ide_left e\<^sub>0.ide_right e\<^sub>1.ide_left e\<^sub>1.ide_right iso_hcomp ide_hcomp hseqE ideD(1) ide_is_iso in_hhomE iso_assoc' seqE hcomp_simps(1-2)) ultimately show ?thesis using 1 [of "e\<^sub>1 \ \\<^sup>-\<^sup>1[d\<^sub>1, f' \ e\<^sub>0, d\<^sub>0]" "\[e\<^sub>1, d\<^sub>1, (f' \ e\<^sub>0) \ d\<^sub>0]" "(e\<^sub>1 \ d\<^sub>1) \ \\<^sup>-\<^sup>1[f', e\<^sub>0, d\<^sub>0]" "inv \\<^sub>1 \ f' \ inv \\<^sub>0" "\\<^sup>-\<^sup>1[f' \ trg e\<^sub>0]" "\\<^sup>-\<^sup>1[f']"] comp_assoc by (metis e\<^sub>0.antipar(2)) qed also have "... = inv \\<^sup>-\<^sup>1[f'] \ inv \\<^sup>-\<^sup>1[f' \ trg e\<^sub>0] \ inv (inv \\<^sub>1 \ f' \ inv \\<^sub>0) \ inv ((e\<^sub>1 \ d\<^sub>1) \ \\<^sup>-\<^sup>1[f', e\<^sub>0, d\<^sub>0]) \ inv \[e\<^sub>1, d\<^sub>1, (f' \ e\<^sub>0) \ d\<^sub>0] \ inv (e\<^sub>1 \ \\<^sup>-\<^sup>1[d\<^sub>1, f' \ e\<^sub>0, d\<^sub>0])" using comp_assoc by simp also have "... = \[f'] \ \[f' \ trg e\<^sub>0] \ (\\<^sub>1 \ f' \ \\<^sub>0) \ ((e\<^sub>1 \ d\<^sub>1) \ \[f', e\<^sub>0, d\<^sub>0]) \ \\<^sup>-\<^sup>1[e\<^sub>1, d\<^sub>1, (f' \ e\<^sub>0) \ d\<^sub>0] \ (e\<^sub>1 \ \[d\<^sub>1, f' \ e\<^sub>0, d\<^sub>0])" proof - have "inv \\<^sup>-\<^sup>1[f'] = \[f']" using assms inv_inv iso_runit by blast moreover have "inv \\<^sup>-\<^sup>1[f' \ trg e\<^sub>0] = \[f' \ trg e\<^sub>0]" using assms iso_lunit by auto moreover have "inv (inv \\<^sub>1 \ f' \ inv \\<^sub>0) = \\<^sub>1 \ f' \ \\<^sub>0" proof - have "src (inv \\<^sub>1) = trg f'" using assms(1) e\<^sub>1.antipar(2) by auto moreover have "src f' = trg (inv \\<^sub>0)" using assms(1) e\<^sub>0.antipar(2) by auto ultimately show ?thesis using assms(2) e\<^sub>0.counit_is_iso e\<^sub>1.counit_is_iso by simp qed ultimately show ?thesis using assms e\<^sub>0.antipar e\<^sub>1.antipar by auto qed finally show ?thesis using \_def by simp qed lemma \_components_are_iso: assumes "\f' : trg e\<^sub>0 \ trg e\<^sub>1\" and "ide f'" shows "iso (\ f')" using assms \_def \.components_are_iso hom'.ide_char hom'.arr_char hom'.iso_char by simp lemma \_eq: shows "\ = (\\'. if \\': trg e\<^sub>0 \ trg e\<^sub>1\ then \' \ \[dom \'] \ \[dom \' \ trg e\<^sub>0] \ (\\<^sub>1 \ dom \' \ \\<^sub>0) \ ((e\<^sub>1 \ d\<^sub>1) \ \[dom \', e\<^sub>0, d\<^sub>0]) \ \\<^sup>-\<^sup>1[e\<^sub>1, d\<^sub>1, (dom \' \ e\<^sub>0) \ d\<^sub>0] \ (e\<^sub>1 \ \[d\<^sub>1, dom \' \ e\<^sub>0, d\<^sub>0]) else null)" proof fix \' have "\ \\': trg e\<^sub>0 \ trg e\<^sub>1\ \ \.map \' = null" using \.is_extensional hom'.arr_char hom'.null_char by simp moreover have "\\': trg e\<^sub>0 \ trg e\<^sub>1\ \ \.map \' = \' \ \[dom \'] \ \[dom \' \ trg e\<^sub>0] \ (\\<^sub>1 \ dom \' \ \\<^sub>0) \ ((e\<^sub>1 \ d\<^sub>1) \ \[dom \', e\<^sub>0, d\<^sub>0]) \ \\<^sup>-\<^sup>1[e\<^sub>1, d\<^sub>1, (dom \' \ e\<^sub>0) \ d\<^sub>0] \ (e\<^sub>1 \ \[d\<^sub>1, dom \' \ e\<^sub>0, d\<^sub>0])" proof - assume \': "\\': trg e\<^sub>0 \ trg e\<^sub>1\" have "\\.map (dom \') : trg e\<^sub>0 \ trg e\<^sub>1\" using \' hom'.arr_char hom'.dom_closed by auto moreover have "seq \' (\.map (dom \'))" proof - have "hom'.seq \' (\.map (dom \'))" using \' \.preserves_cod hom'.arrI hom'.dom_simp hom'.cod_simp apply (intro hom'.seqI) by auto thus ?thesis using hom'.seq_char by blast qed ultimately show ?thesis using \' \.is_natural_1 [of \'] hom'.comp_char hom'.arr_char hom'.dom_closed \_ide_simp [of "dom \'"] hom'.dom_simp hom'.cod_simp apply auto by (metis \_def hom'.inclusion ide_dom) qed ultimately show "\ \' = (if \\' : trg e\<^sub>0 \ trg e\<^sub>1\ then \' \ \[dom \'] \ \[dom \' \ trg e\<^sub>0] \ (\\<^sub>1 \ dom \' \ \\<^sub>0) \ ((e\<^sub>1 \ d\<^sub>1) \ \[dom \', e\<^sub>0, d\<^sub>0]) \ \\<^sup>-\<^sup>1[e\<^sub>1, d\<^sub>1, (dom \' \ e\<^sub>0) \ d\<^sub>0] \ (e\<^sub>1 \ \[d\<^sub>1, dom \' \ e\<^sub>0, d\<^sub>0]) else null)" unfolding \_def by argo qed lemma \_in_hom [intro]: assumes "\\' : trg e\<^sub>0 \ trg e\<^sub>1\" shows "\\ \' : trg e\<^sub>0 \ trg e\<^sub>1\" and "\\ \' : e\<^sub>1 \ (d\<^sub>1 \ dom \' \ e\<^sub>0) \ d\<^sub>0 \ cod \'\" proof - have 0: "\ \' = \.map \'" using \_def by auto hence 1: "hom'.arr (\ \')" using assms hom'.arr_char \.preserves_reflects_arr by auto show "\\ \' : trg e\<^sub>0 \ trg e\<^sub>1\" using 1 hom'.arr_char by blast show "\\ \' : e\<^sub>1 \ (d\<^sub>1 \ dom \' \ e\<^sub>0) \ d\<^sub>0 \ cod \'\" using assms 0 1 \.preserves_hom hom'.in_hom_char hom'.arr_char e\<^sub>0.antipar e\<^sub>1.antipar \.preserves_dom \.preserves_cod hom'.dom_char apply (intro in_homI) apply auto[1] proof - show "dom (\ \') = e\<^sub>1 \ (d\<^sub>1 \ dom \' \ e\<^sub>0) \ d\<^sub>0" proof - have "hom'.dom (\ \') = FG.map (hom'.dom \')" using assms 0 \.preserves_dom hom'.arr_char by (metis (no_types, lifting)) thus ?thesis using assms 0 1 hom.arr_char hom'.arr_char hom'.dom_char G.preserves_arr hom'.dom_closed by auto qed show "cod (\ \') = cod \'" proof - have "hom'.cod (\ \') = cod \'" using assms 0 \.preserves_cod hom'.arr_char hom'.cod_simp by auto thus ?thesis using assms 0 1 hom'.arr_char hom'.cod_char G.preserves_arr hom'.cod_closed by auto qed qed qed lemma \_simps [simp]: assumes "\\' : trg e\<^sub>0 \ trg e\<^sub>1\" shows "arr (\ \')" and "src (\ \') = trg e\<^sub>0" and "trg (\ \') = trg e\<^sub>1" and "dom (\ \') = e\<^sub>1 \ (d\<^sub>1 \ dom \' \ e\<^sub>0) \ d\<^sub>0" and "cod (\ \') = cod \'" using assms \_in_hom by auto interpretation equivalence_of_categories hom'.comp hom.comp F G \ \ proof - interpret \: natural_isomorphism hom.comp hom.comp hom.map \G o F\ \ using \.natural_isomorphism_axioms \_def by simp interpret \: natural_isomorphism hom'.comp hom'.comp \F o G\ hom'.map \ using \.natural_isomorphism_axioms \_def by simp show "equivalence_of_categories hom'.comp hom.comp F G \ \" .. qed lemma induces_equivalence_of_hom_categories: shows "equivalence_of_categories hom'.comp hom.comp F G \ \" .. lemma equivalence_functor_F: shows "equivalence_functor hom.comp hom'.comp F" proof - interpret \': inverse_transformation hom.comp hom.comp hom.map \G o F\ \ .. interpret \': inverse_transformation hom'.comp hom'.comp \F o G\ hom'.map \ .. interpret E: equivalence_of_categories hom.comp hom'.comp G F \'.map \'.map .. show ?thesis using E.equivalence_functor_axioms by simp qed lemma equivalence_functor_G: shows "equivalence_functor hom'.comp hom.comp G" using equivalence_functor_axioms by simp end context bicategory begin text \ We now use the just-established equivalence of hom-categories to prove some cancellation laws for equivalence maps. It is relatively straightforward to prove these results directly, without using the just-established equivalence, but the proofs are somewhat longer that way. \ lemma equivalence_cancel_left: assumes "equivalence_map e" and "par \ \'" and "src e = trg \" and "e \ \ = e \ \'" shows "\ = \'" proof - obtain d \ \ where d\\: "equivalence_in_bicategory V H \ \ src trg e d \ \" using assms equivalence_map_def by auto interpret e: equivalence_in_bicategory V H \ \ src trg e d \ \ using d\\ by simp interpret i: equivalence_in_bicategory V H \ \ src trg \src \\ \src \\ \inv \[src \]\ \\[src \]\ using assms iso_unit obj_src by unfold_locales simp_all interpret two_equivalences_in_bicategory V H \ \ src trg \src \\ \src \\ \inv \[src \]\ \\[src \]\ e d \ \ .. interpret hom: subcategory V \\\'. in_hhom \' (src (src \)) (src e)\ using hhom_is_subcategory by blast interpret hom': subcategory V \\\'. in_hhom \' (trg (src \)) (trg e)\ using hhom_is_subcategory by blast interpret F: equivalence_functor hom.comp hom'.comp \\\'. e \ \' \ src \\ using equivalence_functor_F by simp have "F \ = F \'" using assms hom.arr_char apply simp by (metis e.ide_left hcomp_reassoc(2) i.ide_right ideD(1) src_dom trg_dom trg_src) moreover have "hom.par \ \'" using assms hom.arr_char hom.dom_char hom.cod_char by (metis (no_types, lifting) in_hhomI src_dom src_src trg_dom) ultimately show "\ = \'" using F.is_faithful by blast qed lemma equivalence_cancel_right: assumes "equivalence_map e" and "par \ \'" and "src \ = trg e" and "\ \ e = \' \ e" shows "\ = \'" proof - obtain d \ \ where d\\: "equivalence_in_bicategory V H \ \ src trg e d \ \" using assms equivalence_map_def by auto interpret e: equivalence_in_bicategory V H \ \ src trg e d \ \ using d\\ by simp interpret i: equivalence_in_bicategory V H \ \ src trg \trg \\ \trg \\ \inv \[trg \]\ \\[trg \]\ using assms iso_unit obj_src by unfold_locales simp_all interpret two_equivalences_in_bicategory V H \ \ src trg e d \ \ \trg \\ \trg \\ \inv \[trg \]\ \\[trg \]\ .. interpret hom: subcategory V \\\'. in_hhom \' (trg e) (trg (trg \))\ using hhom_is_subcategory by blast interpret hom': subcategory V \\\'. in_hhom \' (src e) (src (trg \))\ using hhom_is_subcategory by blast interpret G: equivalence_functor hom.comp hom'.comp \\\'. trg \ \ \' \ e\ using equivalence_functor_G by simp have "G \ = G \'" using assms hom.arr_char by simp moreover have "hom.par \ \'" using assms hom.arr_char hom.dom_char hom.cod_char by (metis (no_types, lifting) in_hhomI src_dom trg_dom trg_trg) ultimately show "\ = \'" using G.is_faithful by blast qed lemma equivalence_isomorphic_cancel_left: assumes "equivalence_map e" and "ide f" and "ide f'" and "src f = src f'" and "src e = trg f" and "e \ f \ e \ f'" shows "f \ f'" proof - have ef': "src e = trg f'" using assms R.as_nat_iso.components_are_iso iso_is_arr isomorphic_implies_hpar(2) by blast obtain d \ \ where e: "equivalence_in_bicategory V H \ \ src trg e d \ \" using assms equivalence_map_def by auto interpret e: equivalence_in_bicategory V H \ \ src trg e d \ \ using e by simp interpret i: equivalence_in_bicategory V H \ \ src trg \src f\ \src f\ \inv \[src f]\ \\[src f]\ using assms iso_unit obj_src by unfold_locales auto interpret two_equivalences_in_bicategory V H \ \ src trg \src f\ \src f\ \inv \[src f]\ \\[src f]\ e d \ \ .. interpret hom: subcategory V \\\'. in_hhom \' (src (src f)) (src e)\ using hhom_is_subcategory by blast interpret hom': subcategory V \\\'. in_hhom \' (trg (src f)) (trg e)\ using hhom_is_subcategory by blast interpret F: equivalence_functor hom.comp hom'.comp \\\'. e \ \' \ src f\ using equivalence_functor_F by simp have 1: "F f \ F f'" proof - have "F f \ (e \ f) \ src f" using assms hcomp_assoc_isomorphic equivalence_map_is_ide isomorphic_symmetric by auto also have "... \ (e \ f') \ src f'" using assms ef' by (simp add: hcomp_isomorphic_ide) also have "... \ F f'" using assms ef' hcomp_assoc_isomorphic equivalence_map_is_ide by auto finally show ?thesis by blast qed show "f \ f'" proof - obtain \ where \: "\\ : F f \ F f'\ \ iso \" using 1 isomorphic_def by auto have 2: "hom'.iso \" using assms \ hom'.iso_char hom'.arr_char vconn_implies_hpar(1,2) by auto have 3: "hom'.in_hom \ (F f) (F f')" using assms 2 \ ef' hom'.in_hom_char hom'.arr_char by (metis F.preserves_reflects_arr hom'.iso_is_arr hom.arr_char i.antipar(1) ideD(1) ide_in_hom(1) trg_src) obtain \ where \: "hom.in_hom \ f f' \ F \ = \" using assms 3 \ F.is_full F.preserves_reflects_arr hom'.in_hom_char hom.ide_char by fastforce have "hom.iso \" using 2 \ F.reflects_iso by auto thus ?thesis using \ isomorphic_def hom.in_hom_char hom.arr_char hom.iso_char by auto qed qed lemma equivalence_isomorphic_cancel_right: assumes "equivalence_map e" and "ide f" and "ide f'" and "trg f = trg f'" and "src f = trg e" and "f \ e \ f' \ e" shows "f \ f'" proof - have f'e: "src f' = trg e" using assms R.as_nat_iso.components_are_iso iso_is_arr isomorphic_implies_hpar(2) by blast obtain d \ \ where d\\: "equivalence_in_bicategory V H \ \ src trg e d \ \" using assms equivalence_map_def by auto interpret e: equivalence_in_bicategory V H \ \ src trg e d \ \ using d\\ by simp interpret i: equivalence_in_bicategory V H \ \ src trg \trg f\ \trg f\ \inv \[trg f]\ \\[trg f]\ using assms iso_unit obj_src by unfold_locales auto interpret two_equivalences_in_bicategory V H \ \ src trg e d \ \ \trg f\ \trg f\ \inv \[trg f]\ \\[trg f]\ .. interpret hom: subcategory V \\\'. in_hhom \' (trg e) (trg (trg f))\ using hhom_is_subcategory by blast interpret hom': subcategory V \\\'. in_hhom \' (src e) (src (trg f))\ using hhom_is_subcategory by blast interpret G: equivalence_functor hom.comp hom'.comp \\\'. trg f \ \' \ e\ using equivalence_functor_G by simp have 1: "G f \ G f'" using assms hcomp_isomorphic_ide hcomp_ide_isomorphic by simp show "f \ f'" proof - obtain \ where \: "\\ : G f \ G f'\ \ iso \" using 1 isomorphic_def by auto have 2: "hom'.iso \" using assms \ hom'.iso_char hom'.arr_char vconn_implies_hpar(1-2) by auto have 3: "hom'.in_hom \ (G f) (G f')" using assms 2 \ f'e hom'.in_hom_char hom'.arr_char by (metis G.preserves_arr hom'.iso_is_arr hom.ideI hom.ide_char ideD(1) ide_in_hom(1) trg_trg) obtain \ where \: "hom.in_hom \ f f' \ G \ = \" using assms 3 \ G.is_full G.preserves_reflects_arr hom'.in_hom_char hom.ide_char by fastforce have "hom.iso \" using 2 \ G.reflects_iso by auto thus ?thesis using \ isomorphic_def hom.in_hom_char hom.arr_char hom.iso_char by auto qed qed end end