(* Title: Strictness Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) section "Strictness" theory Strictness imports Category3.ConcreteCategory Pseudofunctor CanonicalIsos begin text \ In this section we consider bicategories in which some or all of the canonical isomorphisms are assumed to be identities. A \emph{normal} bicategory is one in which the unit isomorphisms are identities, so that unit laws for horizontal composition are satisfied ``on the nose''. A \emph{strict} bicategory (also known as a \emph{2-category}) is a bicategory in which both the unit and associativity isomoprhisms are identities, so that horizontal composition is strictly associative as well as strictly unital. From any given bicategory \B\ we may construct a related strict bicategory \S\, its \emph{strictification}, together with a pseudofunctor that embeds \B\ in \S\. The Strictness Theorem states that this pseudofunctor is an equivalence pseudofunctor, so that bicategory \B\ is biequivalent to its strictification. The Strictness Theorem is often used informally to justify suppressing canonical isomorphisms; which amounts to proving a theorem about 2-categories and asserting that it holds for all bicategories. Here we are working formally, so we can't just wave our hands and mutter something about the Strictness Theorem when we want to avoid dealing with units and associativities. However, in cases where we can establish that the property we would like to prove is reflected by the embedding of a bicategory in its strictification, then we can formally apply the Strictness Theorem to generalize to all bicategories a result proved for 2-categories. We will apply this approach here to simplify the proof of some facts about internal equivalences in a bicategory. \ subsection "Normal and Strict Bicategories" text \ A \emph{normal} bicategory is one in which the unit isomorphisms are identities, so that unit laws for horizontal composition are satisfied ``on the nose''. \ locale normal_bicategory = bicategory + assumes strict_lunit: "\f. ide f \ \[f] = f" and strict_runit: "\f. ide f \ \[f] = f" begin lemma strict_unit: assumes "obj a" shows "ide \[a]" using assms strict_runit unitor_coincidence(2) [of a] by auto lemma strict_lunit': assumes "ide f" shows "\\<^sup>-\<^sup>1[f] = f" using assms strict_lunit by simp lemma strict_runit': assumes "ide f" shows "\\<^sup>-\<^sup>1[f] = f" using assms strict_runit by simp lemma hcomp_obj_arr: assumes "obj b" and "arr f" and "b = trg f" shows "b \ f = f" using assms strict_lunit by (metis comp_arr_dom comp_ide_arr ide_cod ide_dom lunit_naturality) lemma hcomp_arr_obj: assumes "arr f" and "obj a" and "src f = a" shows "f \ a = f" using assms strict_runit by (metis comp_arr_dom comp_ide_arr ide_cod ide_dom runit_naturality) end text \ A \emph{strict} bicategory is a normal bicategory in which the associativities are also identities, so that associativity of horizontal composition holds ``on the nose''. \ locale strict_bicategory = normal_bicategory + assumes strict_assoc: "\f g h. \ide f; ide g; ide h; src f = trg g; src g = trg h\ \ ide \[f, g, h]" begin lemma strict_assoc': assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "ide \\<^sup>-\<^sup>1[f, g, h]" using assms strict_assoc by simp lemma hcomp_assoc: shows "(\ \ \) \ \ = \ \ \ \ \" proof (cases "hseq \ \ \ hseq \ \") show "\ (hseq \ \ \ hseq \ \) \ ?thesis" by (metis hseqE hseq_char' match_1 match_2) show "hseq \ \ \ hseq \ \ \ ?thesis" proof - assume 1: "hseq \ \ \ hseq \ \" have 2: "arr \ \ arr \ \ arr \ \ src \ = trg \ \ src \ = trg \" using 1 by blast have "(\ \ \) \ \ = \[cod \, cod \, cod \] \ ((\ \ \) \ \)" using 1 assoc_in_hom strict_assoc comp_cod_arr assoc_simps(4) hseq_char by simp also have "... = (\ \ \ \ \) \ \[dom \, dom \, dom \]" using 1 assoc_naturality by auto also have "... = \ \ \ \ \" using 2 assoc_in_hom [of "dom \" "dom \" "dom \"] strict_assoc comp_arr_dom by auto finally show ?thesis by simp qed qed text \ In a strict bicategory, every canonical isomorphism is an identity. \ interpretation bicategorical_language .. interpretation E: self_evaluation_map V H \ \ src trg .. notation E.eval ("\_\") lemma ide_eval_Can: assumes "Can t" shows "ide \t\" proof - have 1: "\u1 u2. \ ide \u1\; ide \u2\; Arr u1; Arr u2; Dom u1 = Cod u2 \ \ ide (\u1\ \ \u2\)" by (metis (no_types, lifting) E.eval_simps'(4-5) comp_ide_self ide_char) have "\u. Can u \ ide \u\" proof - fix u show "Can u \ ide \u\" (* TODO: Rename \_ide_simp \_ide_simp to \_ide_eq \_ide_eq *) using 1 \_def \'_def strict_lunit strict_runit strict_assoc strict_assoc' \_ide_simp \_ide_simp Can_implies_Arr comp_ide_arr E.eval_simps'(2-3) by (induct u) auto qed thus ?thesis using assms by simp qed lemma ide_can: assumes "Ide f" and "Ide g" and "\<^bold>\f\<^bold>\ = \<^bold>\g\<^bold>\" shows "ide (can g f)" using assms Can_red Can_Inv red_in_Hom Inv_in_Hom can_def ide_eval_Can Can.simps(4) Dom_Inv red_simps(4) by presburger end context bicategory begin text \ The following result gives conditions for strictness of a bicategory that are typically somewhat easier to verify than those used for the definition. \ lemma is_strict_if: assumes "\f. ide f \ f \ src f = f" and "\f. ide f \ trg f \ f = f" and "\a. obj a \ ide \[a]" and "\f g h. \ide f; ide g; ide h; src f = trg g; src g = trg h\ \ ide \[f, g, h]" shows "strict_bicategory V H \ \ src trg" proof show "\f g h. \ide f; ide g; ide h; src f = trg g; src g = trg h\ \ ide \[f, g, h]" by fact fix f assume f: "ide f" show "\[f] = f" proof - have "f = \[f]" using assms f unit_simps(5) by (intro lunit_eqI) (auto simp add: comp_arr_ide) thus ?thesis by simp qed show "\[f] = f" proof - have "f = \[f]" proof (intro runit_eqI) show "ide f" by fact show "\f : f \ src f \ f\" using f assms(1) by auto show "f \ src f = (f \ \[src f]) \ \[f, src f, src f]" proof - have "(f \ \[src f]) \ \[f, src f, src f] = (f \ src f) \ \[f, src f, src f]" using f assms(2-3) unit_simps(5) by simp also have "... = (f \ src f \ src f) \ \[f, src f, src f]" using f assms(1-2) ideD(1) trg_src src.preserves_ide by metis also have "... = f \ src f" using f comp_arr_ide assms(1,4) assoc_in_hom [of f "src f" "src f"] by auto finally show ?thesis by simp qed qed thus ?thesis by simp qed qed end subsection "Strictification" (* * TODO: Perhaps change the typeface used for a symbol that stands for a bicategory; * for example, to avoid the clashes here between B used as the name of a bicategory * and B used to denote a syntactic identity term. *) text \ The Strictness Theorem asserts that every bicategory is biequivalent to a strict bicategory. More specifically, it shows how to construct, given an arbitrary bicategory, a strict bicategory (its \emph{strictification}) that is biequivalent to it. Consequently, given a property \P\ of bicategories that is ``bicategorical'' (\emph{i.e.}~respects biequivalence), if we want to show that \P\ holds for a bicategory \B\ then it suffices to show that \P\ holds for the strictification of \B\, and if we want to show that \P\ holds for all bicategories, it is sufficient to show that it holds for all strict bicategories. This is very useful, because it becomes quite tedious, even with the aid of a proof assistant, to do ``diagram chases'' with all the units and associativities fully spelled out. Given a bicategory \B\, the strictification \S\ of \B\ may be constructed as the bicategory whose arrows are triples \(A, B, \)\, where \X\ and \Y\ are ``normal identity terms'' (essentially, nonempty horizontally composable lists of 1-cells of \B\) having the same syntactic source and target, and \\\ : \X\ \ \Y\\\ in \B\. Vertical composition in \S\ is given by composition of the underlying arrows in \B\. Horizontal composition in \S\ is given by \(A, B, \) \ (A', B', \') = (AA', BB', \)\, where \AA'\ and \BB'\ denote concatenations of lists and where \\\ is defined as the composition \can BB' (B \<^bold>\ B') \ (\ \ \') \ can (A \<^bold>\ A') AA'\, where \can (A \<^bold>\ A') AA'\ and \can BB' (B \<^bold>\ B')\ are canonical isomorphisms in \B\. The canonical isomorphism \can (A \<^bold>\ A') AA'\ corresponds to taking a pair of lists \A \<^bold>\ A'\ and ``shifting the parentheses to the right'' to obtain a single list \AA'\. The canonical isomorphism can \BB' (B \<^bold>\ B')\ corresponds to the inverse rearrangement. The bicategory \B\ embeds into its strictification \S\ via the functor \UP\ that takes each arrow \\\ of \B\ to \(\<^bold>\dom \\<^bold>\, \<^bold>\cod \\<^bold>\, \)\, where \\<^bold>\dom \\<^bold>\\ and \\<^bold>\cod \\<^bold>\\ denote one-element lists. This mapping extends to a pseudofunctor. There is also a pseudofunctor \DN\, which maps \(A, B, \)\ in \S\ to \\\ in \B\; this is such that \DN o UP\ is the identity on \B\ and \UP o DN\ is equivalent to the identity on \S\, so we obtain a biequivalence between \B\ and \S\. It seems difficult to find references that explicitly describe a strictification construction in elementary terms like this (in retrospect, it ought to have been relatively easy to rediscover such a construction, but my thinking got off on the wrong track). One reference that I did find useful was \cite{unapologetic-strictification}, which discusses strictification for monoidal categories. \ locale strictified_bicategory = B: bicategory V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B for V\<^sub>B :: "'a comp" (infixr "\\<^sub>B" 55) and H\<^sub>B :: "'a \ 'a \ 'a" (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 sublocale E: self_evaluation_map V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B .. notation B.in_hhom ("\_ : _ \\<^sub>B _\") notation B.in_hom ("\_ : _ \\<^sub>B _\") notation E.eval ("\_\") notation E.Nmlize ("\<^bold>\_\<^bold>\") text \ The following gives the construction of a bicategory whose arrows are triples \(A, B, \)\, where \Nml A \ Ide A\, \Nml B \ Ide B\, \Src A = Src B\, \Trg A = Trg B\, and \\ : \A\ \ \B\\. We use @{locale concrete_category} to construct the vertical composition, so formally the arrows of the bicategory will be of the form \MkArr A B \\. \ text \ The 1-cells of the bicategory correspond to normal, identity terms \A\ in the bicategorical language associated with \B\. \ abbreviation IDE where "IDE \ {A. E.Nml A \ E.Ide A}" text \ If terms \A\ and \B\ determine 1-cells of the strictification and have a common source and target, then the 2-cells between these 1-cells correspond to arrows \\\ of the underlying bicategory such that \\\ : \A\ \\<^sub>B \B\\\. \ abbreviation HOM where "HOM A B \ {\. E.Src A = E.Src B \ E.Trg A = E.Trg B \ \\ : \A\ \\<^sub>B \B\\}" text \ The map taking term \A \ OBJ\ to its evaluation \\A\ \ HOM A A\ defines the embedding of 1-cells as identity 2-cells. \ abbreviation EVAL where "EVAL \ E.eval" sublocale concrete_category IDE HOM EVAL \\_ _ _ \ \. \ \\<^sub>B \\ using E.ide_eval_Ide B.comp_arr_dom B.comp_cod_arr B.comp_assoc by (unfold_locales, auto) lemma is_concrete_category: shows "concrete_category IDE HOM EVAL (\_ _ _ \ \. \ \\<^sub>B \)" .. abbreviation vcomp (infixr "\" 55) where "vcomp \ COMP" lemma arr_char: shows "arr F \ E.Nml (Dom F) \ E.Ide (Dom F) \ E.Nml (Cod F) \ E.Ide (Cod F) \ E.Src (Dom F) = E.Src (Cod F) \ E.Trg (Dom F) = E.Trg (Cod F) \ \Map F : \Dom F\ \\<^sub>B \Cod F\\ \ F \ Null" using arr_char by auto lemma arrI (* [intro] *): assumes "E.Nml (Dom F)" and "E.Ide (Dom F)" and "E.Nml (Cod F)" and "E.Ide (Cod F)" and "E.Src (Dom F) = E.Src (Cod F)" and "E.Trg (Dom F) = E.Trg (Cod F)" and "\Map F : \Dom F\ \\<^sub>B \Cod F\\" and "F \ Null" shows "arr F" using assms arr_char by blast lemma arrE [elim]: assumes "arr F" shows "(\ E.Nml (Dom F); E.Ide (Dom F); E.Nml (Cod F); E.Ide (Cod F); E.Src (Dom F) = E.Src (Cod F); E.Trg (Dom F) = E.Trg (Cod F); \Map F : \Dom F\ \\<^sub>B \Cod F\\; F \ Null \ \ T) \ T" using assms arr_char by simp lemma ide_char: shows "ide F \ endo F \ B.ide (Map F)" proof show "ide F \ endo F \ B.ide (Map F)" using ide_char by (simp add: E.ide_eval_Ide) show "endo F \ B.ide (Map F) \ ide F" by (metis (no_types, lifting) B.ide_char B.in_homE arr_char ide_char mem_Collect_eq seq_char) qed lemma ideI [intro]: assumes "arr F" and "Dom F = Cod F" and "B.ide (Map F)" shows "ide F" using assms ide_char dom_char cod_char seq_char by presburger lemma ideE [elim]: assumes "ide F" shows "(\ arr F; Dom F = Cod F; B.ide (Map F); Map F = \Dom F\; Map F = \Cod F\ \ \ T) \ T" using assms by (metis (no_types, lifting) Map_ide(2) ide_char seq_char) text \ Source and target are defined by the corresponding syntactic operations on terms. \ definition src where "src F \ if arr F then MkIde (E.Src (Dom F)) else null" definition trg where "trg F \ if arr F then MkIde (E.Trg (Dom F)) else null" lemma src_simps [simp]: assumes "arr F" shows "Dom (src F) = E.Src (Dom F)" and "Cod (src F) = E.Src (Dom F)" and "Map (src F) = \E.Src (Dom F)\" using assms src_def arr_char by auto lemma trg_simps [simp]: assumes "arr F" shows "Dom (trg F) = E.Trg (Dom F)" and "Cod (trg F) = E.Trg (Dom F)" and "Map (trg F) = \E.Trg (Dom F)\" using assms trg_def arr_char by auto interpretation src: endofunctor vcomp src using src_def comp_char E.Obj_implies_Ide apply (unfold_locales) apply auto[4] proof - show "\g f. seq g f \ src (g \ f) = src g \ src f" proof - fix g f assume gf: "seq g f" have "src (g \ f) = MkIde (E.Src (Dom (g \ f)))" using gf src_def comp_char by simp also have "... = MkIde (E.Src (Dom f))" using gf by (simp add: seq_char) also have "... = MkIde (E.Src (Dom g)) \ MkIde (E.Src (Dom f))" using gf seq_char E.Obj_implies_Ide by auto also have "... = src g \ src f" using gf src_def comp_char by auto finally show "src (g \ f) = src g \ src f" by blast qed qed interpretation trg: endofunctor vcomp trg using trg_def comp_char E.Obj_implies_Ide apply (unfold_locales) apply auto[4] proof - show "\g f. seq g f \ trg (g \ f) = trg g \ trg f" proof - fix g f assume gf: "seq g f" have "trg (g \ f) = MkIde (E.Trg (Dom (g \ f)))" using gf trg_def comp_char by simp also have "... = MkIde (E.Trg (Dom f))" using gf by (simp add: seq_char) also have "... = MkIde (E.Trg (Dom g)) \ MkIde (E.Trg (Dom f))" using gf seq_char E.Obj_implies_Ide by auto also have "... = trg g \ trg f" using gf trg_def comp_char by auto finally show "trg (g \ f) = trg g \ trg f" by blast qed qed interpretation horizontal_homs vcomp src trg using src_def trg_def Cod_in_Obj Map_in_Hom E.Obj_implies_Ide by unfold_locales auto notation in_hhom ("\_ : _ \ _\") definition hcomp (infixr "\" 53) where "\ \ \ \ if arr \ \ arr \ \ src \ = trg \ then MkArr (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)) else null" lemma arr_hcomp: assumes "arr \" and "arr \" and "src \ = trg \" shows "arr (\ \ \)" proof - have 1: "E.Ide (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \ E.Nml (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \ E.Ide (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \ E.Nml (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \)" using assms arr_char src_def trg_def E.Ide_HcompNml E.Nml_HcompNml(1) by auto moreover have "\B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) : \Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \\ \\<^sub>B \Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \\\" proof - have "\Map \ \\<^sub>B Map \ : \Dom \ \<^bold>\ Dom \\ \\<^sub>B \Cod \ \<^bold>\ Cod \\\" using assms arr_char dom_char cod_char src_def trg_def E.eval_simps'(2-3) by auto moreover have "\B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) : \Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \\ \\<^sub>B \Dom \ \<^bold>\ Dom \\\ \ \B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) : \Cod \ \<^bold>\ Cod \\ \\<^sub>B \Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \\\" using assms 1 arr_char src_def trg_def apply (intro conjI B.in_homI) by auto ultimately show ?thesis by auto qed moreover have "E.Src (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) = E.Src (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \ E.Trg (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) = E.Trg (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \)" using assms arr_char src_def trg_def by (simp add: E.Src_HcompNml E.Trg_HcompNml) ultimately show ?thesis unfolding hcomp_def using assms by (intro arrI, auto) qed lemma src_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "src (\ \ \) = src \" using assms arr_char hcomp_def src_def trg_def arr_hcomp E.Src_HcompNml by simp lemma trg_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "trg (hcomp \ \) = trg \" using assms arr_char hcomp_def src_def trg_def arr_hcomp E.Trg_HcompNml by simp lemma hseq_char: shows "arr (\ \ \) \ arr \ \ arr \ \ src \ = trg \" using arr_hcomp hcomp_def by simp lemma Dom_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "Dom (\ \ \) = Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \" using assms hcomp_def [of \ \] by simp lemma Cod_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "Cod (\ \ \) = Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \" using assms hcomp_def [of \ \] by simp lemma Map_hcomp [simp]: assumes "arr \" and "arr \" and "src \ = trg \" shows "Map (\ \ \) = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" using assms hcomp_def [of \ \] by simp interpretation "functor" VV.comp vcomp \\\\. hcomp (fst \\) (snd \\)\ proof show "\f. \ VV.arr f \ fst f \ snd f = null" using hcomp_def by auto show A: "\f. VV.arr f \ arr (fst f \ snd f)" using VV.arrE hseq_char by blast show "\f. VV.arr f \ dom (fst f \ snd f) = fst (VV.dom f) \ snd (VV.dom f)" proof - fix f assume f: "VV.arr f" have "dom (fst f \ snd f) = MkIde (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f))" using f VV.arrE [of f] dom_char arr_hcomp hcomp_def by simp also have "... = fst (VV.dom f) \ snd (VV.dom f)" proof - have "hcomp (fst (VV.dom f)) (snd (VV.dom f)) = MkArr (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)) (B.can (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\ Dom (snd f)) \\<^sub>B (\Dom (fst f)\ \\<^sub>B \Dom (snd f)\) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)))" using f VV.arrE [of f] arr_hcomp hcomp_def VV.dom_simp by simp moreover have "B.can (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\ Dom (snd f)) \\<^sub>B (\Dom (fst f)\ \\<^sub>B \Dom (snd f)\) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)) = \Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)\" proof - have 1: "E.Ide (Dom (fst f) \<^bold>\ Dom (snd f))" using f VV.arr_char arr_char dom_char apply simp by (metis (no_types, lifting) src_simps(1) trg_simps(1)) have 2: "E.Ide (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f))" using f VV.arr_char arr_char dom_char apply simp by (metis (no_types, lifting) E.Ide_HcompNml src_simps(1) trg_simps(1)) have 3: "\<^bold>\Dom (fst f) \<^bold>\ Dom (snd f)\<^bold>\ = \<^bold>\Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)\<^bold>\" using f VV.arr_char arr_char dom_char apply simp by (metis (no_types, lifting) E.Nml_HcompNml(1) E.Nmlize_Nml src_simps(1) trg_simps(1)) have "(\Dom (fst f)\ \\<^sub>B \Dom (snd f)\) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)) = B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f))" using "1" "2" "3" B.comp_cod_arr by force thus ?thesis using 1 2 3 f VV.arr_char B.can_Ide_self B.vcomp_can by simp qed ultimately show ?thesis by simp qed finally show "dom (fst f \ snd f) = fst (VV.dom f) \ snd (VV.dom f)" by simp qed show "\f. VV.arr f \ cod (fst f \ snd f) = fst (VV.cod f) \ snd (VV.cod f)" proof - fix f assume f: "VV.arr f" have "cod (fst f \ snd f) = MkIde (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f))" using f VV.arrE [of f] cod_char arr_hcomp hcomp_def by simp also have "... = fst (VV.cod f) \ snd (VV.cod f)" proof - have "hcomp (fst (VV.cod f)) (snd (VV.cod f)) = MkArr (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f)) \\<^sub>B (\Cod (fst f)\ \\<^sub>B \Cod (snd f)\) \\<^sub>B B.can (Cod (fst f) \<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)))" using f VV.arrE [of f] arr_hcomp hcomp_def VV.cod_simp by simp moreover have "B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f)) \\<^sub>B (\Cod (fst f)\ \\<^sub>B \Cod (snd f)\) \\<^sub>B B.can (Cod (fst f) \<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) = \Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)\" proof - have 1: "E.Ide (Cod (fst f) \<^bold>\ Cod (snd f))" using f VV.arr_char arr_char dom_char apply simp by (metis (no_types, lifting) src_simps(1) trg_simps(1)) have 2: "E.Ide (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f))" using f VV.arr_char arr_char dom_char apply simp by (metis (no_types, lifting) E.Ide_HcompNml src_simps(1) trg_simps(1)) have 3: "\<^bold>\Cod (fst f) \<^bold>\ Cod (snd f)\<^bold>\ = \<^bold>\Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)\<^bold>\" using f VV.arr_char arr_char dom_char apply simp by (metis (no_types, lifting) E.Nml_HcompNml(1) E.Nmlize_Nml src_simps(1) trg_simps(1)) have "(\Cod (fst f)\ \\<^sub>B \Cod (snd f)\) \\<^sub>B B.can (Cod (fst f) \<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) = B.can (Cod (fst f) \<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f))" using "1" "2" "3" B.comp_cod_arr by force thus ?thesis using 1 2 3 f VV.arr_char B.can_Ide_self B.vcomp_can by simp qed ultimately show ?thesis by simp qed finally show "cod (fst f \ snd f) = fst (VV.cod f) \ snd (VV.cod f)" by simp qed show "\g f. VV.seq g f \ fst (VV.comp g f) \ snd (VV.comp g f) = (fst g \ snd g) \ (fst f \ snd f)" proof - fix f g assume fg: "VV.seq g f" have f: "arr (fst f) \ arr (snd f) \ src (fst f) = trg (snd f)" using fg VV.seq_char VV.arr_char by simp have g: "arr (fst g) \ arr (snd g) \ src (fst g) = trg (snd g)" using fg VV.seq_char VV.arr_char by simp have 1: "arr (fst (VV.comp g f)) \ arr (snd (VV.comp g f)) \ src (fst (VV.comp g f)) = trg (snd (VV.comp g f))" using fg VV.arrE by blast have 0: "VV.comp g f = (fst g \ fst f, snd g \ snd f)" using fg 1 VV.comp_char VxV.comp_char by (metis (no_types, lifting) VV.seq_char VxV.seqE) let ?X = "MkArr (Dom (fst (VV.comp g f)) \<^bold>\\<^bold>\\<^bold>\ Dom (snd (VV.comp g f))) (Cod (fst (VV.comp g f)) \<^bold>\\<^bold>\\<^bold>\ Cod (snd (VV.comp g f))) (B.can (Cod (fst (VV.comp g f)) \<^bold>\\<^bold>\\<^bold>\ Cod (snd (VV.comp g f))) (Cod (fst (VV.comp g f)) \<^bold>\ Cod (snd (VV.comp g f))) \\<^sub>B (Map (fst (VV.comp g f)) \\<^sub>B Map (snd (VV.comp g f))) \\<^sub>B B.can (Dom (fst (VV.comp g f)) \<^bold>\ Dom (snd (VV.comp g f))) (Dom (fst (VV.comp g f)) \<^bold>\\<^bold>\\<^bold>\ Dom (snd (VV.comp g f))))" have 2: "fst (VV.comp g f) \ snd (VV.comp g f) = ?X" unfolding hcomp_def using 1 by simp also have "... = (fst g \ snd g) \ (fst f \ snd f)" proof - let ?GG = "MkArr (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g)) (Cod (fst g) \<^bold>\\<^bold>\\<^bold>\ Cod (snd g)) (B.can (Cod (fst g) \<^bold>\\<^bold>\\<^bold>\ Cod (snd g)) (Cod (fst g) \<^bold>\ Cod (snd g)) \\<^sub>B (Map (fst g) \\<^sub>B Map (snd g)) \\<^sub>B B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g)))" let ?FF = "MkArr (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)) (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f)) \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f)) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)))" have 4: "arr ?FF \ arr ?GG \ Dom ?GG = Cod ?FF" proof - have "arr ?FF \ arr ?GG" using f g fg VV.arr_char VV.seqE hcomp_def A by presburger thus ?thesis using 0 1 by (simp add: fg seq_char) qed have "(fst g \ snd g) \ (fst f \ snd f) = ?GG \ ?FF" unfolding hcomp_def using 1 f g fg VV.arr_char VV.seqE by simp also have "... = ?X" proof (intro arr_eqI) show "seq ?GG ?FF" using fg 4 seq_char by blast show "arr ?X" using fg 1 arr_hcomp hcomp_def by simp show "Dom (?GG \ ?FF) = Dom ?X" using fg 0 1 4 seq_char by simp show "Cod (?GG \ ?FF) = Cod ?X" using fg 0 1 4 seq_char by simp show "Map (?GG \ ?FF) = Map ?X" proof - have "Map (?GG \ ?FF) = Map ?GG \\<^sub>B Map ?FF" using 4 by auto also have "... = (B.can (Cod (fst g) \<^bold>\\<^bold>\\<^bold>\ Cod (snd g)) (Cod (fst g) \<^bold>\ Cod (snd g)) \\<^sub>B (Map (fst g) \\<^sub>B Map (snd g)) \\<^sub>B B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g))) \\<^sub>B (B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f)) \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f)) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f)))" using fg by simp also have "... = B.can (Cod (fst g) \<^bold>\\<^bold>\\<^bold>\ Cod (snd g)) (Cod (fst g) \<^bold>\ Cod (snd g)) \\<^sub>B ((Map (fst g) \\<^sub>B Map (snd g)) \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f))) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f))" proof - have "(B.can (Cod (fst g) \<^bold>\\<^bold>\\<^bold>\ Cod (snd g)) (Cod (fst g) \<^bold>\ Cod (snd g)) \\<^sub>B (Map (fst g) \\<^sub>B Map (snd g)) \\<^sub>B B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g))) \\<^sub>B (B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f)) \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f)) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f))) = B.can (Cod (fst g) \<^bold>\\<^bold>\\<^bold>\ Cod (snd g)) (Cod (fst g) \<^bold>\ Cod (snd g)) \\<^sub>B ((Map (fst g) \\<^sub>B Map (snd g)) \\<^sub>B (B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g)) \\<^sub>B B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f))) \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f))) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f))" using B.comp_assoc by simp also have "... = B.can (Cod (fst g) \<^bold>\\<^bold>\\<^bold>\ Cod (snd g)) (Cod (fst g) \<^bold>\ Cod (snd g)) \\<^sub>B ((Map (fst g) \\<^sub>B Map (snd g)) \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f))) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f))" proof - have "(B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g))) \\<^sub>B (B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f))) = \Cod (fst f) \<^bold>\ Cod (snd f)\" proof - have "(B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g))) \\<^sub>B (B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f))) = B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Cod (fst f) \<^bold>\ Cod (snd f))" proof - have "E.Ide (Dom (fst g) \<^bold>\ Dom (snd g))" using g arr_char by (metis (no_types, lifting) E.Ide.simps(3) src_simps(2) trg_simps(2)) moreover have "E.Ide (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g))" using 4 by auto moreover have "E.Ide (Cod (fst f) \<^bold>\ Cod (snd f))" using f arr_char by (metis (no_types, lifting) E.Ide.simps(3) src_simps(2) trg_simps(2)) moreover have "\<^bold>\Dom (fst g) \<^bold>\ Dom (snd g)\<^bold>\ = \<^bold>\Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g)\<^bold>\" using g E.Nml_HcompNml(1) calculation(1) by fastforce moreover have "\<^bold>\Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g)\<^bold>\ = \<^bold>\Cod (fst f) \<^bold>\ Cod (snd f)\<^bold>\" using g fg seq_char by (metis (no_types, lifting) VV.seq_char VxV.seqE calculation(4)) moreover have "Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g) = Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)" using 0 1 by (simp add: seq_char) ultimately show ?thesis using B.vcomp_can by simp qed also have "... = \Cod (fst f) \<^bold>\ Cod (snd f)\" proof - have "Dom (fst g) \<^bold>\ Dom (snd g) = Cod (fst f) \<^bold>\ Cod (snd f)" using 0 f g fg seq_char VV.seq_char VV.arr_char by simp thus ?thesis using f B.can_Ide_self [of "Dom (fst f) \<^bold>\ Dom (snd f)"] by (metis (no_types, lifting) B.can_Ide_self E.Ide.simps(3) arrE src_simps(2) trg_simps(2)) qed finally show ?thesis by simp qed hence "(B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g)) \\<^sub>B B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f))) \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f)) = \Cod (fst f) \<^bold>\ Cod (snd f)\ \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f))" by simp also have "... = Map (fst f) \\<^sub>B Map (snd f)" proof - have 1: "\p. arr p \ map (cod p) \ map p = map p" by blast have 3: "\Cod (fst f)\ \\<^sub>B Map (fst f) = Map (map (cod (fst f)) \ map (fst f))" by (simp add: f) have 4: "map (cod (fst f)) \ map (fst f) = fst f" using 1 f map_simp by simp show ?thesis proof - have 2: "\Cod (snd f)\ \\<^sub>B Map (snd f) = Map (snd f)" using 1 f map_simp by (metis (no_types, lifting) Dom_cod Map_cod Map_comp arr_cod) have "B.seq \Cod (snd f)\ (Map (snd f))" using f 2 by auto moreover have "B.seq \Cod (fst f)\ (Map (fst f))" using 4 f 3 by auto moreover have "\Cod (fst f)\ \\<^sub>B Map (fst f) \\<^sub>B \Cod (snd f)\ \\<^sub>B Map (snd f) = Map (fst f) \\<^sub>B Map (snd f)" using 2 3 4 by presburger ultimately show ?thesis by (simp add: B.interchange) qed qed finally have "(B.can (Dom (fst g) \<^bold>\ Dom (snd g)) (Dom (fst g) \<^bold>\\<^bold>\\<^bold>\ Dom (snd g)) \\<^sub>B B.can (Cod (fst f) \<^bold>\\<^bold>\\<^bold>\ Cod (snd f)) (Cod (fst f) \<^bold>\ Cod (snd f))) \\<^sub>B (Map (fst f) \\<^sub>B Map (snd f)) = Map (fst f) \\<^sub>B Map (snd f)" by simp thus ?thesis using fg B.comp_cod_arr by simp qed finally show ?thesis by simp qed also have "... = B.can (Cod (fst g) \<^bold>\\<^bold>\\<^bold>\ Cod (snd g)) (Cod (fst g) \<^bold>\ Cod (snd g)) \\<^sub>B (Map (fst g \ fst f) \\<^sub>B Map (snd g \ snd f)) \\<^sub>B B.can (Dom (fst f) \<^bold>\ Dom (snd f)) (Dom (fst f) \<^bold>\\<^bold>\\<^bold>\ Dom (snd f))" proof - have 2: "Dom (fst g) = Cod (fst f)" using 0 f g fg VV.seq_char [of g f] VV.arr_char arr_char seq_char by (metis (no_types, lifting) fst_conv) hence "Map (fst g \ fst f) = Map (fst g) \\<^sub>B Map (fst f)" using f g Map_comp [of "fst f" "fst g"] by simp moreover have "B.seq (Map (fst g)) (Map (fst f)) \ B.seq (Map (snd g)) (Map (snd f))" using f g 0 1 2 arr_char by (metis (no_types, lifting) B.seqI' prod.sel(2) seq_char) ultimately show ?thesis using 0 1 seq_char Map_comp B.interchange by auto qed also have "... = Map ?X" using fg 0 1 by (simp add: seq_char) finally show ?thesis by simp qed qed finally show ?thesis by simp qed finally show "fst (VV.comp g f) \ snd (VV.comp g f) = (fst g \ snd g) \ (fst f \ snd f)" by simp qed qed interpretation horizontal_composition vcomp hcomp src trg using hseq_char by (unfold_locales, auto) lemma hcomp_assoc: assumes "arr \" and "arr \" and "arr \" and "src \ = trg \" and "src \ = trg \" shows "(\ \ \) \ \ = \ \ \ \ \" proof (intro arr_eqI) have \\: "\Map \ \\<^sub>B Map \ : \Dom \ \<^bold>\ Dom \\ \\<^sub>B \Cod \ \<^bold>\ Cod \\\" using assms src_def trg_def arr_char by (auto simp add: E.eval_simps'(2-3) Pair_inject) have \\: "\Map \ \\<^sub>B Map \ : \Dom \ \<^bold>\ Dom \\ \\<^sub>B \Cod \ \<^bold>\ Cod \\\" using assms src_def trg_def arr_char by (auto simp add: E.eval_simps'(2-3) Pair_inject) show "hseq (\ \ \) \" using assms \\ \\ by auto show "hseq \ (\ \ \)" using assms \\ \\ by auto show "Dom ((\ \ \) \ \) = Dom (\ \ \ \ \)" proof - have "E.Nml (Dom \) \ E.Nml (Dom \) \ E.Nml (Dom \)" using assms by blast moreover have "E.Src (Dom \) = E.Trg (Dom \) \ E.Src (Dom \) = E.Trg (Dom \)" using assms \\ \\ by (metis (no_types, lifting) src_simps(2) trg_simps(2)) ultimately show ?thesis using assms \\ \\ E.HcompNml_assoc by simp qed show "Cod ((\ \ \) \ \) = Cod (\ \ \ \ \)" proof - have "E.Nml (Cod \) \ E.Nml (Cod \) \ E.Nml (Cod \)" using assms by blast moreover have "E.Src (Cod \) = E.Trg (Cod \) \ E.Src (Cod \) = E.Trg (Cod \)" using assms \\ \\ by (metis (no_types, lifting) arrE src_simps(2) trg_simps(2)) ultimately show ?thesis using assms \\ \\ E.HcompNml_assoc by simp qed show "Map ((\ \ \) \ \) = Map (\ \ \ \ \)" proof - have "Map ((\ \ \) \ \) = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" proof - have 1: "Map ((\ \ \) \ \) = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) \\<^sub>B (B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \\<^sub>B Map \) \\<^sub>B B.can ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" using assms \\ \\ hcomp_def E.HcompNml_assoc src_def trg_def arr_char E.Nml_HcompNml E.Ide_HcompNml by auto (* 5 sec *) also have "... = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) \\<^sub>B (B.can ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \)) \\<^sub>B B.can ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" proof - have "B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \\<^sub>B Map \ = B.can ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \)" proof - have "B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \\<^sub>B Map \ = (B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B B.can (Cod \) (Cod \)) \\<^sub>B ((Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \\<^sub>B Map \)" proof - have "B.seq (B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \)) ((Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \))" by (metis (no_types, lifting) B.arrI Map_hcomp arrE arr_hcomp assms(1) assms(2) assms(4)) moreover have "B.seq (B.can (Cod \) (Cod \)) (Map \)" using B.can_in_hom assms(3) by blast moreover have "B.ide (B.can (Cod \) (Cod \))" using B.can_Ide_self E.ide_eval_Ide arr_char assms(3) by presburger ultimately show ?thesis by (metis (no_types) B.comp_ide_arr B.interchange) qed also have "... = (B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B B.can (Cod \) (Cod \)) \\<^sub>B ((Map \ \\<^sub>B Map \) \\<^sub>B Map \) \\<^sub>B (B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \\<^sub>B B.can (Dom \) (Dom \))" proof - have "B.seq (Map \ \\<^sub>B Map \) (B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \))" by (metis (no_types, lifting) B.arrI B.comp_null(2) B.ext Map_hcomp arrE arr_hcomp assms(1) assms(2) assms(4)) moreover have "B.seq (Map \) (B.can (Dom \) (Dom \))" using assms(3) by fastforce ultimately show ?thesis using B.interchange by (metis (no_types, lifting) B.can_Ide_self B.comp_arr_ide E.ide_eval_Ide arrE assms(3)) qed also have "... = (B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B B.can (Cod \) (Cod \)) \\<^sub>B (B.can ((Cod \ \<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\ Dom \) \<^bold>\ Dom \)) \\<^sub>B (B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \\<^sub>B B.can (Dom \) (Dom \))" proof - have "(Map \ \\<^sub>B Map \) \\<^sub>B Map \ = B.\' \Cod \\ \Cod \\ \Cod \\ \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B \\<^sub>B \Dom \\ \Dom \\ \Dom \\" using B.hcomp_reassoc(1) by (metis (no_types, lifting) B.hcomp_in_vhomE B.in_homE \\ \\ arrE assms(1) assms(2) assms(3)) also have "... = B.can ((Cod \ \<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\ Dom \) \<^bold>\ Dom \)" using assms arr_char src_def trg_def arr_char B.canE_associator by simp finally show ?thesis by simp qed also have "... = ((B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B B.can (Cod \) (Cod \)) \\<^sub>B (B.can ((Cod \ \<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \))) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B (B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\ Dom \) \<^bold>\ Dom \) \\<^sub>B (B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \\<^sub>B B.can (Dom \) (Dom \)))" using B.comp_assoc by simp also have "... = B.can ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \)" proof - have "(B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B B.can (Cod \) (Cod \)) \\<^sub>B (B.can ((Cod \ \<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \)) = B.can ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \)" proof - have "E.Ide (Cod \ \<^bold>\ Cod \)" by (metis (no_types, lifting) E.Ide.simps(3) arrE assms(1-2,4) src_simps(1) trg_simps(1)) moreover have "E.Ide (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \)" using E.Ide_HcompNml assms(1) assms(2) calculation by auto moreover have "\<^bold>\Cod \ \<^bold>\ Cod \\<^bold>\ = \<^bold>\Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \\<^bold>\" using E.Nml_HcompNml(1) assms(1) assms(2) calculation(1) by fastforce moreover have "E.Src (Cod \ \<^bold>\ Cod \) = E.Trg (Cod \)" by (metis (no_types, lifting) E.Src.simps(3) arrE assms(2-3,5) src_simps(2) trg_simps(2)) moreover have "E.Src (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) = E.Trg (Cod \)" using E.Src_HcompNml assms(1) assms(2) calculation(1) calculation(4) by fastforce moreover have "\<^bold>\Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \\<^bold>\ = \<^bold>\(Cod \ \<^bold>\ Cod \) \<^bold>\ Cod \\<^bold>\" by (metis (no_types, lifting) E.Arr.simps(3) E.Nmlize_Hcomp_Hcomp E.Nmlize_Hcomp_Hcomp' E.Ide_implies_Arr E.Src.simps(3) arrE assms(3) calculation(1) calculation(4)) ultimately show ?thesis using assms(3) B.hcomp_can B.vcomp_can by auto qed moreover have "B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\ Dom \) \<^bold>\ Dom \) \\<^sub>B (B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \\<^sub>B B.can (Dom \) (Dom \)) = B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \)" proof - have "E.Ide (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" by (metis (no_types, lifting) E.Ide_HcompNml arrE assms(1-2,4) src_simps(2) trg_simps(2)) moreover have "E.Ide (Dom \ \<^bold>\ Dom \)" by (metis (no_types, lifting) E.Ide.simps(3) arrE assms(1-2,4) src_simps(1) trg_simps(1)) moreover have "\<^bold>\Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \\<^bold>\ = \<^bold>\Dom \ \<^bold>\ Dom \\<^bold>\" using E.Nml_HcompNml(1) assms(1-2) calculation(2) by fastforce moreover have "E.Src (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) = E.Trg (Dom \)" by (metis (no_types, lifting) E.Ide.simps(3) E.Src_HcompNml arrE assms(1-3,5) calculation(2) src_simps(2) trg_simps(2)) moreover have "E.Src (Dom \ \<^bold>\ Dom \) = E.Trg (Dom \)" using E.Src_HcompNml assms(1-2) calculation(2) calculation(4) by fastforce moreover have "E.Ide ((Dom \ \<^bold>\ Dom \) \<^bold>\ Dom \)" using E.Ide.simps(3) assms(3) calculation(2) calculation(5) by blast moreover have "\<^bold>\(Dom \ \<^bold>\ Dom \) \<^bold>\ Dom \\<^bold>\ = \<^bold>\Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \\<^bold>\" using E.Nmlize_Hcomp_Hcomp calculation(6) by auto ultimately show ?thesis using assms(3) B.hcomp_can B.vcomp_can by auto qed ultimately show ?thesis by simp qed finally show ?thesis by simp qed thus ?thesis by simp qed also have "... = (B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) \\<^sub>B B.can ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \)) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \) \\<^sub>B B.can ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" using B.comp_assoc by simp also have "... = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" proof - have "B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) \\<^sub>B B.can ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \)" proof - have "E.Ide (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \)" using assms src_def trg_def by fastforce moreover have "E.Ide ((Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \)" using assms arr_char src_def trg_def E.Ide_HcompNml E.Src_HcompNml by auto moreover have "E.Ide (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \)" using assms arr_char src_def trg_def by (simp add: E.Nml_HcompNml(1) E.Ide_HcompNml E.Trg_HcompNml) moreover have "\<^bold>\Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \\<^bold>\ = \<^bold>\(Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \\<^bold>\" using assms arr_char src_def trg_def E.Nml_HcompNml E.HcompNml_assoc by simp moreover have "\<^bold>\(Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \<^bold>\ Cod \\<^bold>\ = \<^bold>\Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \\<^bold>\" using assms arr_char src_def trg_def E.Nml_HcompNml E.HcompNml_assoc by simp ultimately show ?thesis by simp qed moreover have "B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \) \\<^sub>B B.can ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) = B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" proof - have "E.Ide (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \)" using assms src_def trg_def by fastforce moreover have "E.Ide ((Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \)" using assms arr_char src_def trg_def E.Ide_HcompNml E.Src_HcompNml by auto moreover have "E.Ide (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" using assms arr_char src_def trg_def by (simp add: E.Nml_HcompNml(1) E.Ide_HcompNml E.Trg_HcompNml) moreover have "\<^bold>\Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \\<^bold>\ = \<^bold>\(Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \\<^bold>\" using assms arr_char src_def trg_def E.Nml_HcompNml E.HcompNml_assoc by simp moreover have "\<^bold>\(Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) \<^bold>\ Dom \\<^bold>\ = \<^bold>\Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \\<^bold>\" using assms arr_char src_def trg_def E.Nml_HcompNml E.HcompNml_assoc by simp ultimately show ?thesis by simp qed ultimately show ?thesis by simp qed finally show ?thesis by simp qed also have "... = Map (\ \ \ \ \)" proof - have 1: "Map (\ \ \ \ \) = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" using assms Map_hcomp [of \ "\ \ \"] Map_hcomp [of \ \] by simp also have "... = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \\<^sub>B ((B.can (Cod \) (Cod \) \\<^sub>B B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \)) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B (B.can (Dom \) (Dom \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \))) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" proof - have "Map \ \\<^sub>B B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) = (B.can (Cod \) (Cod \) \\<^sub>B B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \)) \\<^sub>B (Map \ \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \))" using assms B.interchange B.comp_cod_arr by (metis (no_types, lifting) B.can_Ide_self B.in_homE Map_hcomp arrE hseq_char) also have "... = (B.can (Cod \) (Cod \) \\<^sub>B B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \)) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B (B.can (Dom \) (Dom \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \))" using assms B.interchange B.comp_arr_dom [of "Map \" "B.can (Dom \) (Dom \)"] by (metis (no_types, lifting) B.can_Ide_self B.comp_null(2) B.ext B.in_homE Map_hcomp arrE hseq_char) finally have "Map \ \\<^sub>B B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) = (B.can (Cod \) (Cod \) \\<^sub>B B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \)) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B (B.can (Dom \) (Dom \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \))" by simp thus ?thesis by simp qed also have "... = (B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) \\<^sub>B (B.can (Cod \) (Cod \) \\<^sub>B B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \))) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B ((B.can (Dom \) (Dom \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \))" using B.comp_assoc by simp also have "... = B.can (Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \ \<^bold>\\<^bold>\\<^bold>\ Cod \) (Cod \ \<^bold>\ Cod \ \<^bold>\ Cod \) \\<^sub>B (Map \ \\<^sub>B Map \ \\<^sub>B Map \) \\<^sub>B B.can (Dom \ \<^bold>\ Dom \ \<^bold>\ Dom \) (Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \ \<^bold>\\<^bold>\\<^bold>\ Dom \)" using assms \\ \\ E.HcompNml_assoc src_def trg_def arr_char E.Src_HcompNml E.Trg_HcompNml E.Nml_HcompNml E.Ide_HcompNml by simp finally show ?thesis by simp qed ultimately show ?thesis by metis qed qed lemma obj_char: shows "obj a \ endo a \ E.Obj (Dom a) \ Map a = \Dom a\" proof assume a: "obj a" show "endo a \ E.Obj (Dom a) \ Map a = \Dom a\" proof (intro conjI) show "endo a" using a ide_char by blast show "E.Obj (Dom a)" using a ide_char src_def by (metis (no_types, lifting) E.Ide_implies_Arr E.Obj_Trg arrE obj_def trg_simps(1) trg_src) show "Map a = \Dom a\" using a ide_char src_def by blast qed next assume a: "endo a \ E.Obj (Dom a) \ Map a = \Dom a\" show "obj a" proof - have "arr a" using a by auto moreover have "src a = a" using a E.Obj_in_Hom(1) seq_char by (intro arr_eqI, auto) ultimately show ?thesis using obj_def by simp qed qed lemma hcomp_obj_self: assumes "obj a" shows "a \ a = a" proof (intro arr_eqI) show "hseq a a" using assms by auto show "arr a" using assms by auto show 1: "Dom (a \ a) = Dom a" unfolding hcomp_def using assms arr_char E.HcompNml_Trg_Nml apply simp by (metis (no_types, lifting) objE obj_def trg_simps(1)) show 2: "Cod (a \ a) = Cod a" unfolding hcomp_def using assms 1 arr_char E.HcompNml_Trg_Nml apply simp by (metis (no_types, lifting) Dom_hcomp ideE objE) show "Map (a \ a) = Map a" using "1" Map_ide(1) assms by fastforce qed lemma hcomp_ide_src: assumes "ide f" shows "f \ src f = f" proof (intro arr_eqI) show "hseq f (src f)" using assms by simp show "arr f" using assms by simp show 1: "Dom (f \ src f) = Dom f" unfolding hcomp_def using assms apply simp using assms ide_char arr_char E.HcompNml_Nml_Src by (metis (no_types, lifting) ideD(1)) show "Cod (f \ src f) = Cod f" unfolding hcomp_def using assms apply simp using assms ide_char arr_char E.HcompNml_Nml_Src by (metis (no_types, lifting) ideD(1)) show "Map (f \ src f) = Map f" by (simp add: "1" Map_ide(1) assms) qed lemma hcomp_trg_ide: assumes "ide f" shows "trg f \ f = f" proof (intro arr_eqI) show "hseq (trg f) f" using assms by auto show "arr f" using assms by auto show 1: "Dom (trg f \ f) = Dom f" unfolding hcomp_def using assms apply simp using assms ide_char arr_char E.HcompNml_Trg_Nml by (metis (no_types, lifting) ideD(1)) show "Cod (trg f \ f) = Cod f" unfolding hcomp_def using assms apply simp using assms ide_char arr_char E.HcompNml_Trg_Nml by (metis (no_types, lifting) ideD(1)) show "Map (trg f \ f) = Map f" by (simp add: "1" Map_ide(1) assms) qed interpretation L: full_functor vcomp vcomp L proof fix a a' g assume a: "ide a" and a': "ide a'" assume g: "in_hom g (L a') (L a)" have a_eq: "a = MkIde (Dom a)" using a dom_char [of a] by simp have a'_eq: "a' = MkIde (Dom a')" using a' dom_char [of a'] by simp have 1: "Cod g = Dom a" proof - have "Dom (L a) = Dom a" by (simp add: a hcomp_trg_ide) thus ?thesis using g cod_char [of g] by (metis (no_types, lifting) Dom_cod in_homE) qed have 2: "Dom g = Dom a'" using a' g hcomp_trg_ide in_hom_char by auto let ?f = "MkArr (Dom a') (Cod a) (Map g)" have f: "in_hom ?f a' a" by (metis (no_types, lifting) "1" "2" MkArr_Map a a' g ideE in_hom_char) moreover have "L ?f = g" proof - have "L ?f = trg (MkArr (Dom a') (Cod a) (Map g)) \ MkArr (Dom a') (Cod a) (Map g)" using f by auto also have "... = MkIde (E.Trg (Cod a)) \ MkArr (Dom a') (Cod a) (Map g)" using a a' f trg_def [of a] vconn_implies_hpar by auto also have "... = MkArr (E.Trg (Cod a) \<^bold>\\<^bold>\\<^bold>\ Dom a') (E.Trg (Cod a) \<^bold>\\<^bold>\\<^bold>\ Cod a) (B.can (E.Trg (Cod a) \<^bold>\\<^bold>\\<^bold>\ Cod a) (E.Trg (Cod a) \<^bold>\ Cod a) \\<^sub>B (\E.Trg (Cod a)\ \\<^sub>B Map g) \\<^sub>B B.can (E.Trg (Cod a) \<^bold>\ Dom a') (E.Trg (Cod a) \<^bold>\\<^bold>\\<^bold>\ Dom a'))" using hcomp_def apply simp by (metis (no_types, lifting) Cod.simps(1) arrE f in_homE src_trg trg.preserves_arr trg_def) also have "... = MkArr (Dom a') (Cod a) (B.can (Cod a) (E.Trg (Cod a) \<^bold>\ Cod a) \\<^sub>B (trg\<^sub>B \Cod a\ \\<^sub>B Map g) \\<^sub>B B.can (E.Trg (Cod a) \<^bold>\ Dom a') (Dom a'))" proof - have "E.Trg (Cod a) \<^bold>\\<^bold>\\<^bold>\ Dom a' = Dom a'" using a a' arr_char E.HcompNml_Trg_Nml by (metis (no_types, lifting) f ideE trg_simps(1) vconn_implies_hpar(4)) moreover have "E.Trg (Cod a) \<^bold>\\<^bold>\\<^bold>\ Cod a = Cod a" using a a' arr_char E.HcompNml_Trg_Nml by blast moreover have "\E.Trg (Cod a)\ = trg\<^sub>B \Cod a\" using a a' arr_char E.eval_simps'(3) by fastforce ultimately show ?thesis by simp qed also have "... = MkArr (Dom a') (Cod a) (B.lunit \Cod a\ \\<^sub>B (trg\<^sub>B \Cod a\ \\<^sub>B Map g) \\<^sub>B B.lunit' \Dom a'\)" proof - have "E.Trg (Cod a) = E.Trg (Dom a')" using a a' a_eq g ide_char arr_char src_def trg_def trg_hcomp \Cod g = Dom a\ \Dom g = Dom a'\ by (metis (no_types, lifting) Cod.simps(1) in_homE) moreover have "B.can (Cod a) (E.Trg (Cod a) \<^bold>\ Cod a) = B.lunit \Cod a\" using a ide_char arr_char B.canE_unitor(2) by blast moreover have "B.can (E.Trg (Dom a') \<^bold>\ Dom a') (Dom a') = B.lunit' \Dom a'\" using a' ide_char arr_char B.canE_unitor(4) by blast ultimately show ?thesis by simp qed also have "... = MkArr (Dom g) (Cod g) (Map g)" proof - have "src\<^sub>B \Cod a\ = src\<^sub>B (Map g)" using a f g ide_char arr_char src_def B.comp_cod_arr by (metis (no_types, lifting) B.vconn_implies_hpar(1) B.vconn_implies_hpar(3) Cod.simps(1) Map.simps(1) in_homE) moreover have "B.lunit \Cod g\ \\<^sub>B (trg\<^sub>B (Map g) \\<^sub>B Map g) \\<^sub>B B.lunit' \Dom g\ = Map g" proof - have "B.lunit \Cod g\ \\<^sub>B (trg\<^sub>B (Map g) \\<^sub>B Map g) \\<^sub>B B.lunit' \Dom g\ = B.lunit \Cod g\ \\<^sub>B B.lunit' \Cod g\ \\<^sub>B Map g" using g ide_char arr_char B.lunit'_naturality by (metis (no_types, lifting) partial_magma_axioms B.in_homE partial_magma.arrI) also have "... = (B.lunit \Cod g\ \\<^sub>B B.lunit' \Cod g\) \\<^sub>B Map g" using B.comp_assoc by simp also have "... = \Cod g\ \\<^sub>B Map g" using g E.ide_eval_Ide B.comp_arr_inv' by fastforce also have "... = Map g" using g E.ide_eval_Ide B.comp_cod_arr by fastforce finally show ?thesis by simp qed ultimately have "B.lunit \Cod a\ \\<^sub>B (trg\<^sub>B \Cod a\ \\<^sub>B Map g) \\<^sub>B B.lunit' \Dom a'\ = Map g" using a a' 1 2 f g hcomp_def dom_char cod_char by (metis (no_types, lifting) B.comp_null(2) B.ext B.lunit_simps(2) B.lunit_simps(3) B.src.preserves_reflects_arr B.trg_vcomp B.vseq_implies_hpar(1) ideE) thus ?thesis using a 1 2 by auto qed also have "... = g" using g MkArr_Map by blast finally show ?thesis by simp qed ultimately show "\f. in_hom f a' a \ L f = g" by blast qed interpretation R: full_functor vcomp vcomp R proof fix a a' g assume a: "ide a" and a': "ide a'" assume g: "in_hom g (R a') (R a)" have a_eq: "a = MkIde (Dom a)" using a dom_char [of a] by simp have a'_eq: "a' = MkIde (Dom a')" using a' dom_char [of a'] by simp have 1: "Cod g = Dom a" using a g hcomp_ide_src in_hom_char by force have 2: "Dom g = Dom a'" using a' g hcomp_ide_src by auto let ?f = "MkArr (Dom a') (Cod a) (Map g)" have f: "in_hom ?f a' a" proof (intro in_homI) show 3: "arr (MkArr (Dom a') (Cod a) (Map g))" by (metis (no_types, lifting) "1" "2" Cod.simps(1) MkArr_Map a_eq g in_homE) show "dom (MkArr (Dom a') (Cod a) (Map g)) = a'" using a a' 3 dom_char by auto show "cod (MkArr (Dom a') (Cod a) (Map g)) = a" using a a' 3 cod_char by auto qed moreover have "R ?f = g" proof - have "R ?f = MkArr (Dom a') (Cod a) (Map g) \ src (MkArr (Dom a') (Cod a) (Map g))" using f by auto also have "... = MkArr (Dom a') (Cod a) (Map g) \ MkIde (E.Src (Cod a))" using a a' f src_def [of a] vconn_implies_hpar by auto also have "... = MkArr (Dom a' \<^bold>\\<^bold>\\<^bold>\ E.Src (Cod a)) (Cod a \<^bold>\\<^bold>\\<^bold>\ E.Src (Cod a)) (B.can (Cod a \<^bold>\\<^bold>\\<^bold>\ E.Src (Cod a)) (Cod a \<^bold>\ E.Src (Cod a)) \\<^sub>B (Map g \\<^sub>B \E.Src (Cod a)\) \\<^sub>B B.can (Dom a' \<^bold>\ E.Src (Cod a)) (Dom a' \<^bold>\\<^bold>\\<^bold>\ E.Src (Cod a)))" using hcomp_def apply simp by (metis (no_types, lifting) Cod_cod arrE f in_homE trg_src src.preserves_arr src_def) also have "... = MkArr (Dom a') (Cod a) (B.can (Cod a) (Cod a \<^bold>\ E.Src (Cod a)) \\<^sub>B (Map g \\<^sub>B src\<^sub>B \Cod a\) \\<^sub>B B.can (Dom a' \<^bold>\ E.Src (Cod a)) (Dom a'))" proof - have "Dom a' \<^bold>\\<^bold>\\<^bold>\ E.Src (Cod a) = Dom a'" using a a' arr_char E.HcompNml_Nml_Src by (metis (no_types, lifting) f ideE src_simps(1) vconn_implies_hpar(3)) moreover have "Cod a \<^bold>\\<^bold>\\<^bold>\ E.Src (Cod a) = Cod a" using a a' arr_char E.HcompNml_Nml_Src by blast moreover have "\E.Src (Cod a)\ = src\<^sub>B \Cod a\" using a a' arr_char E.eval_simps'(2) by fastforce ultimately show ?thesis by simp qed also have "... = MkArr (Dom a') (Cod a) (B.runit \Cod a\ \\<^sub>B (Map g \\<^sub>B src\<^sub>B \Cod a\) \\<^sub>B B.runit' \Dom a'\)" by (metis (no_types, lifting) B.canE_unitor(1) B.canE_unitor(3) a a' arrE f ideE src_simps(1) vconn_implies_hpar(3)) also have "... = MkArr (Dom g) (Cod g) (Map g)" proof - have "src\<^sub>B \Cod a\ = src\<^sub>B (Map g)" using a f g ide_char arr_char src_def B.comp_cod_arr by (metis (no_types, lifting) B.vconn_implies_hpar(1) B.vconn_implies_hpar(3) Cod.simps(1) Map.simps(1) in_homE) moreover have "B.runit \Cod g\ \\<^sub>B (Map g \\<^sub>B src\<^sub>B (Map g)) \\<^sub>B B.runit' \Dom g\ = Map g" proof - have "B.runit \Cod g\ \\<^sub>B (Map g \\<^sub>B src\<^sub>B (Map g)) \\<^sub>B B.runit' \Dom g\ = B.runit \Cod g\ \\<^sub>B B.runit'\Cod g\ \\<^sub>B Map g" using g ide_char arr_char B.runit'_naturality [of "Map g"] by (metis (no_types, lifting) partial_magma_axioms B.in_homE partial_magma.arrI) also have "... = (B.runit \Cod g\ \\<^sub>B B.runit' \Cod g\) \\<^sub>B Map g" using B.comp_assoc by simp also have "... = \Cod g\ \\<^sub>B Map g" using g E.ide_eval_Ide B.comp_arr_inv' by fastforce also have "... = Map g" using g E.ide_eval_Ide B.comp_cod_arr by fastforce finally show ?thesis by simp qed ultimately have "B.runit \Cod a\ \\<^sub>B (Map g \\<^sub>B src\<^sub>B \Cod a\) \\<^sub>B B.runit' \Dom a'\ = Map g" using a a' 1 2 f g hcomp_def dom_char cod_char by (metis (no_types, lifting) ideE) thus ?thesis using a 1 2 by auto qed also have "... = g" using g MkArr_Map by blast finally show ?thesis by simp qed ultimately show "\f. in_hom f a' a \ R f = g" by blast qed interpretation L: faithful_functor vcomp vcomp L proof fix f f' assume par: "par f f'" and eq: "L f = L f'" show "f = f'" proof (intro arr_eqI) have 1: "Dom f = Dom f' \ Cod f = Cod f'" using par dom_char cod_char by auto show "arr f" using par by simp show "arr f'" using par by simp show 2: "Dom f = Dom f'" and 3: "Cod f = Cod f'" using 1 by auto show "Map f = Map f'" proof - have "B.L (Map f) = trg\<^sub>B (Map f) \\<^sub>B Map f" using par by auto also have "... = trg\<^sub>B (Map f') \\<^sub>B Map f'" proof - have "\E.Trg (Dom f)\ \\<^sub>B Map f = \E.Trg (Dom f')\ \\<^sub>B Map f'" proof - have A: "\B.can (E.Trg (Dom f) \<^bold>\ Dom f) (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Dom f) : \E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Dom f\ \\<^sub>B \E.Trg (Dom f)\ \\<^sub>B \Dom f\\" using par arr_char B.can_in_hom E.Ide_HcompNml E.Ide_Nmlize_Ide E.Nml_Trg E.Nmlize_Nml E.HcompNml_Trg_Nml src_def trg_def by (metis (no_types, lifting) E.eval_simps(3) E.ide_eval_Ide E.Ide_implies_Arr B.canE_unitor(4) B.lunit'_in_vhom) have B: "\B.can (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Cod f) (E.Trg (Dom f) \<^bold>\ Cod f) : \E.Trg (Dom f)\ \\<^sub>B \Cod f\ \\<^sub>B \E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Cod f\\" using par arr_char B.can_in_hom E.Ide_HcompNml E.Ide_Nmlize_Ide E.Nml_Trg E.Nmlize_Nml E.HcompNml_Trg_Nml src_def trg_def by (metis (no_types, lifting) E.Nmlize.simps(3) E.eval.simps(3) E.Ide.simps(3) E.Ide_implies_Arr E.Src_Trg trg.preserves_arr trg_simps(2)) have C: "\\E.Trg (Dom f)\ \\<^sub>B Map f : \E.Trg (Dom f)\ \\<^sub>B \Dom f\ \\<^sub>B \E.Trg (Dom f)\ \\<^sub>B \Cod f\\" using par arr_char by (metis (no_types, lifting) E.eval_simps'(1) E.eval_simps(3) E.ide_eval_Ide E.Ide_implies_Arr E.Obj_Trg E.Obj_implies_Ide B.hcomp_in_vhom B.ide_in_hom(2) B.src_trg) have 3: "(\E.Trg (Dom f)\ \\<^sub>B Map f) \\<^sub>B B.can (E.Trg (Dom f) \<^bold>\ Dom f) (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Dom f) = (\E.Trg (Dom f')\ \\<^sub>B Map f') \\<^sub>B B.can (E.Trg (Dom f') \<^bold>\ Dom f') (E.Trg (Dom f') \<^bold>\\<^bold>\\<^bold>\ Dom f')" proof - have 2: "B.can (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Cod f) (E.Trg (Dom f) \<^bold>\ Cod f) \\<^sub>B (\E.Trg (Dom f)\ \\<^sub>B Map f) \\<^sub>B B.can (E.Trg (Dom f) \<^bold>\ Dom f) (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Dom f) = B.can (E.Trg (Dom f') \<^bold>\\<^bold>\\<^bold>\ Cod f') (E.Trg (Dom f') \<^bold>\ Cod f') \\<^sub>B (\E.Trg (Dom f')\ \\<^sub>B Map f') \\<^sub>B B.can (E.Trg (Dom f') \<^bold>\ Dom f') (E.Trg (Dom f') \<^bold>\\<^bold>\\<^bold>\ Dom f')" using par eq hcomp_def trg_def src_trg trg.preserves_arr Map_hcomp trg_simps(1) trg_simps(2) trg_simps(3) by auto have "B.mono (B.can (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Cod f) (E.Trg (Dom f) \<^bold>\ Cod f))" using par arr_char B.inverse_arrows_can B.iso_is_section B.section_is_mono src_def trg_def E.Nmlize_Nml E.HcompNml_Trg_Nml E.Ide_implies_Arr trg.preserves_arr trg_simps(1) by auto moreover have "B.seq (B.can (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Cod f) (E.Trg (Dom f) \<^bold>\ Cod f)) ((\E.Trg (Dom f)\ \\<^sub>B Map f) \\<^sub>B B.can (E.Trg (Dom f) \<^bold>\ Dom f) (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Dom f))" using A B C by auto moreover have "B.seq (B.can (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Cod f) (E.Trg (Dom f) \<^bold>\ Cod f)) ((\E.Trg (Dom f')\ \\<^sub>B Map f') \\<^sub>B B.can (E.Trg (Dom f') \<^bold>\ Dom f') (E.Trg (Dom f') \<^bold>\\<^bold>\\<^bold>\ Dom f'))" using par 1 2 arr_char calculation(2) by auto moreover have "B.can (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Cod f) (E.Trg (Dom f) \<^bold>\ Cod f) = B.can (E.Trg (Dom f') \<^bold>\\<^bold>\\<^bold>\ Cod f') (E.Trg (Dom f') \<^bold>\ Cod f')" using par 1 arr_char by simp ultimately show ?thesis using 2 B.monoE cod_char by auto qed show ?thesis proof - have "B.epi (B.can (E.Trg (Dom f) \<^bold>\ Dom f) (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Dom f))" using par arr_char B.inverse_arrows_can B.iso_is_retraction B.retraction_is_epi E.Nmlize_Nml E.HcompNml_Trg_Nml src_def trg_def E.Ide_implies_Arr by (metis (no_types, lifting) E.Nmlize.simps(3) E.Ide.simps(3) E.Src_Trg trg.preserves_arr trg_simps(1)) moreover have "B.seq (\E.Trg (Dom f)\ \\<^sub>B Map f) (B.can (E.Trg (Dom f) \<^bold>\ Dom f) (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Dom f))" using A C by auto moreover have "B.seq (\E.Trg (Dom f')\ \\<^sub>B Map f') (B.can (E.Trg (Dom f) \<^bold>\ Dom f) (E.Trg (Dom f) \<^bold>\\<^bold>\\<^bold>\ Dom f))" using 1 3 calculation(2) by auto ultimately show ?thesis using par 1 3 arr_char B.epiE by simp qed qed moreover have "trg\<^sub>B (Map f) = \E.Trg (Dom f)\ \ trg\<^sub>B (Map f') = \E.Trg (Dom f')\" using par arr_char trg_def E.Ide_implies_Arr B.comp_arr_dom B.vseq_implies_hpar(2) E.eval_simps(3) by (metis (no_types, lifting) B.vconn_implies_hpar(2)) ultimately show ?thesis by simp qed also have "... = B.L (Map f')" using par B.hseqE B.hseq_char' by auto finally have "B.L (Map f) = B.L (Map f')" by simp thus ?thesis using 2 3 par arr_char B.L.is_faithful by (metis (no_types, lifting) B.in_homE) qed qed qed interpretation R: faithful_functor vcomp vcomp R proof fix f f' assume par: "par f f'" and eq: "R f = R f'" show "f = f'" proof (intro arr_eqI) have 1: "Dom f = Dom f' \ Cod f = Cod f'" using par dom_char cod_char by auto show "arr f" using par by simp show "arr f'" using par by simp show 2: "Dom f = Dom f'" and 3: "Cod f = Cod f'" using 1 by auto show "Map f = Map f'" proof - have "B.R (Map f) = Map f \\<^sub>B src\<^sub>B (Map f)" using par apply simp by (metis B.hseqE B.hseq_char') also have "... = Map f' \\<^sub>B src\<^sub>B (Map f')" proof - have "Map f \\<^sub>B \E.Src (Dom f)\ = Map f' \\<^sub>B \E.Src (Dom f')\" proof - have 2: "E.Ide (Cod f \<^bold>\ E.Src (Dom f))" using par arr_char src.preserves_arr by auto hence 3: "E.Ide (Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f))" using par arr_char E.Nml_Src E.Ide_HcompNml calculation by auto have 4: "\<^bold>\Cod f \<^bold>\ E.Src (Dom f)\<^bold>\ = \<^bold>\Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)\<^bold>\" using par arr_char by (simp add: E.Nml_HcompNml(1)) have A: "\B.can (Dom f \<^bold>\ E.Src (Dom f)) (Dom f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) : \Dom f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)\ \\<^sub>B \Dom f\ \\<^sub>B \E.Src (Dom f)\\" using par arr_char B.can_in_hom E.Ide_HcompNml E.Ide_Nmlize_Ide E.Nml_Src E.Nmlize_Nml E.HcompNml_Nml_Src src_def trg_def by (metis (no_types, lifting) E.eval_simps(2) E.ide_eval_Ide E.Ide_implies_Arr B.canE_unitor(3) B.runit'_in_vhom) have B: "\B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) (Cod f \<^bold>\ E.Src (Dom f)) : \Cod f\ \\<^sub>B \E.Src (Dom f)\ \\<^sub>B \Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)\\" using 2 3 4 B.can_in_hom [of "Cod f \<^bold>\ E.Src (Dom f)" "Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)"] by simp have C: "\Map f \\<^sub>B \E.Src (Dom f)\ : \Dom f\ \\<^sub>B \E.Src (Dom f)\ \\<^sub>B \Cod f\ \\<^sub>B \E.Src (Dom f)\\" using par arr_char E.Ide_Nmlize_Ide E.Nml_Trg E.Nmlize_Nml E.HcompNml_Trg_Nml src_def trg_def E.ide_eval_Ide E.Ide_implies_Arr E.Obj_implies_Ide apply (intro B.hcomp_in_vhom) apply (simp add: B.ide_in_hom(2)) apply simp by (metis (no_types, lifting) A B.ideD(1) B.not_arr_null B.seq_if_composable B.src.preserves_reflects_arr B.vconn_implies_hpar(3) E.HcompNml_Nml_Src) have 5: "(Map f \\<^sub>B \E.Src (Dom f)\) \\<^sub>B B.can (Dom f \<^bold>\ E.Src (Dom f)) (Dom f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) = (Map f' \\<^sub>B \E.Src (Dom f')\) \\<^sub>B B.can (Dom f' \<^bold>\ E.Src (Dom f')) (Dom f' \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f'))" proof - have 6: "B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) (Cod f \<^bold>\ E.Src (Dom f)) \\<^sub>B (Map f \\<^sub>B \E.Src (Dom f)\) \\<^sub>B B.can (Dom f \<^bold>\ E.Src (Dom f)) (Dom f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) = B.can (Cod f' \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f')) (Cod f' \<^bold>\ E.Src (Dom f')) \\<^sub>B (Map f' \\<^sub>B \E.Src (Dom f')\) \\<^sub>B B.can (Dom f' \<^bold>\ E.Src (Dom f')) (Dom f' \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f'))" using par eq hcomp_def src_def trg_src src.preserves_arr Map_hcomp src_simps(1) src_simps(2) src_simps(3) by auto have "B.mono (B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) (Cod f \<^bold>\ E.Src (Dom f)))" using 2 3 4 B.inverse_arrows_can(1) B.iso_is_section B.section_is_mono by simp moreover have "B.seq (B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) (Cod f \<^bold>\ E.Src (Dom f))) ((Map f \\<^sub>B \E.Src (Dom f)\) \\<^sub>B B.can (Dom f \<^bold>\ E.Src (Dom f)) (Dom f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)))" using A B C by auto moreover have "B.seq (B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) (Cod f \<^bold>\ E.Src (Dom f))) ((Map f' \\<^sub>B \E.Src (Dom f')\) \\<^sub>B B.can (Dom f' \<^bold>\ E.Src (Dom f')) (Dom f' \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f')))" using par 1 6 arr_char calculation(2) by auto moreover have "B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)) (Cod f \<^bold>\ E.Src (Dom f)) = B.can (Cod f' \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f')) (Cod f' \<^bold>\ E.Src (Dom f'))" using par 1 arr_char by simp ultimately show ?thesis using 6 B.monoE cod_char by auto qed show ?thesis proof - have "B.epi (B.can (Dom f \<^bold>\ E.Src (Dom f)) (Dom f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)))" using 2 3 4 B.inverse_arrows_can(1) B.iso_is_retraction B.retraction_is_epi by (metis (no_types, lifting) E.Nml_Src E.Nmlize.simps(3) E.Nmlize_Nml E.HcompNml_Nml_Src E.Ide.simps(3) par arrE) moreover have "B.seq (Map f \\<^sub>B \E.Src (Dom f)\) (B.can (Dom f \<^bold>\ E.Src (Dom f)) (Dom f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)))" using A C by auto moreover have "B.seq (Map f' \\<^sub>B \E.Src (Dom f')\) (B.can (Dom f \<^bold>\ E.Src (Dom f)) (Dom f \<^bold>\\<^bold>\\<^bold>\ E.Src (Dom f)))" using 1 5 calculation(2) by auto ultimately show ?thesis using par 1 5 arr_char B.epiE by simp qed qed moreover have "src\<^sub>B (Map f) = \E.Src (Dom f)\ \ src\<^sub>B (Map f') = \E.Src (Dom f')\" using par arr_char src_def by (metis (no_types, lifting) B.vconn_implies_hpar(1) E.Nml_implies_Arr E.eval_simps(2)) ultimately show ?thesis by simp qed also have "... = B.R (Map f')" using par B.hseqE B.hseq_char' by auto finally have "B.R (Map f) = B.R (Map f')" by simp thus ?thesis using 2 3 par arr_char B.R.is_faithful by (metis (no_types, lifting) B.in_homE) qed qed qed definition \ where "\ \ \ \ \ if VVV.arr (\, \, \) then hcomp \ (hcomp \ \) else null" interpretation natural_isomorphism VVV.comp vcomp HoHV HoVH \\\\\. \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))\ proof show "\\\\. \ VVV.arr \\\ \ \ (fst \\\) (fst (snd \\\)) (snd (snd \\\)) = null" using \_def by simp show "\\\\. VVV.arr \\\ \ dom (\ (fst \\\) (fst (snd \\\)) (snd (snd \\\))) = HoHV (VVV.dom \\\)" using VVV.arr_char VV.arr_char \_def hcomp_assoc HoHV_def VVV.dom_simp VV.dom_simp by force show 1: "\\\\. VVV.arr \\\ \ cod (\ (fst \\\) (fst (snd \\\)) (snd (snd \\\))) = HoVH (VVV.cod \\\)" using VVV.arr_char VV.arr_char \_def HoVH_def VVV.cod_simp VV.cod_simp by force show "\\\\. VVV.arr \\\ \ HoVH \\\ \ \ (fst (VVV.dom \\\)) (fst (snd (VVV.dom \\\))) (snd (snd (VVV.dom \\\))) = \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))" using \_def HoVH.as_nat_trans.is_natural_1 HoVH_def by auto show "\\\\. VVV.arr \\\ \ \ (fst (VVV.cod \\\)) (fst (snd (VVV.cod \\\))) (snd (snd (VVV.cod \\\))) \ HoHV \\\ = \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))" proof - fix \\\ assume \\\: "VVV.arr \\\" have "HoHV \\\ = \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))" unfolding \_def HoHV_def using \\\ HoHV.preserves_cod hcomp_assoc VVV.arr_char VV.arr_char by simp thus "\ (fst (VVV.cod \\\)) (fst (snd (VVV.cod \\\))) (snd (snd (VVV.cod \\\))) \ HoHV \\\ = \ (fst \\\) (fst (snd \\\)) (snd (snd \\\))" using 1 \\\ comp_cod_arr \_def by (metis (no_types, lifting) HoVH_def HoHV.preserves_arr prod.collapse) qed show "\fgh. VVV.ide fgh \ iso (\ (fst fgh) (fst (snd fgh)) (snd (snd fgh)))" using \_def HoVH.preserves_ide HoVH_def by auto qed definition \ where "\ \ \a. a" sublocale bicategory vcomp hcomp \ \ src trg using hcomp_obj_self \_def hcomp_assoc VVV.arr_char VV.arr_char apply unfold_locales by (auto simp add: \_def ide_in_hom(2)) lemma is_bicategory: shows "bicategory vcomp hcomp \ \ src trg" .. sublocale strict_bicategory vcomp hcomp \ \ src trg proof show "\fgh. ide fgh \ lunit fgh = fgh" proof - fix fgh assume fgh: "ide fgh" have "fgh = lunit fgh" proof (intro lunit_eqI) show "ide fgh" using fgh by simp show "\fgh : trg fgh \ fgh \ fgh\" using fgh hcomp_def hcomp_trg_ide by auto show "trg fgh \ fgh = (\ (trg fgh) \ fgh) \ \' (trg fgh) (trg fgh) fgh" proof - have "(\ (trg fgh) \ fgh) \ \' (trg fgh) (trg fgh) fgh = (trg fgh \ fgh) \ \' (trg fgh) (trg fgh) fgh" using fgh \_def by metis also have "... = (trg fgh \ fgh) \ (trg fgh \ trg fgh \ fgh)" using fgh \_def by fastforce also have "... = trg fgh \ fgh" using fgh hcomp_obj_self hcomp_assoc by (simp add: hcomp_trg_ide) finally show ?thesis by simp qed qed thus "lunit fgh = fgh" by simp qed show "\fgh. ide fgh \ runit fgh = fgh" proof - fix fgh assume fgh: "ide fgh" have "fgh = runit fgh" proof (intro runit_eqI) show "ide fgh" using fgh by simp show "\fgh : fgh \ src fgh \ fgh\" using fgh hcomp_def hcomp_ide_src by auto show "fgh \ src fgh = (fgh \ \ (src fgh)) \ \ fgh (src fgh) (src fgh)" proof - have "(fgh \ \ (src fgh)) \ \ fgh (src fgh) (src fgh) = (fgh \ src fgh) \ \ fgh (src fgh) (src fgh)" using fgh \_def by metis also have "... = (fgh \ src fgh) \ (fgh \ src fgh \ src fgh)" using fgh \_def by fastforce also have "... = fgh \ src fgh" using fgh comp_arr_dom hcomp_obj_self by simp finally show ?thesis by simp qed qed thus "runit fgh = fgh" by simp qed show "\f g h. \ ide f; ide g; ide h; src f = trg g; src g = trg h \ \ ide (\ f g h)" using \_def VV.arr_char VVV.arr_char by auto qed theorem is_strict_bicategory: shows "strict_bicategory vcomp hcomp \ \ src trg" .. lemma iso_char: shows "iso \ \ arr \ \ B.iso (Map \)" and "iso \ \ inv \ = MkArr (Cod \) (Dom \) (B.inv (Map \))" proof - have 1: "iso \ \ arr \ \ B.iso (Map \)" proof - assume \: "iso \" obtain \ where \: "inverse_arrows \ \" using \ by auto have "B.inverse_arrows (Map \) (Map \)" proof show "B.ide (Map \ \\<^sub>B Map \)" proof - have "Map \ \\<^sub>B Map \ = Map (\ \ \)" using \ \ inverse_arrows_def Map_comp arr_char seq_char by (metis (no_types, lifting) ide_compE) moreover have "B.ide ..." using \ ide_char by blast ultimately show ?thesis by simp qed show "B.ide (Map \ \\<^sub>B Map \)" proof - have "Map \ \\<^sub>B Map \ = Map (\ \ \)" using \ \ inverse_arrows_def comp_char [of \ \] by simp moreover have "B.ide ..." using \ ide_char by blast ultimately show ?thesis by simp qed qed thus "arr \ \ B.iso (Map \)" using \ by auto qed let ?\ = "MkArr (Cod \) (Dom \) (B.inv (Map \))" have 2: "arr \ \ B.iso (Map \) \ iso \ \ inv \ = ?\" proof assume \: "arr \ \ B.iso (Map \)" have \: "\?\ : cod \ \ dom \\" using \ arr_char dom_char cod_char by auto have 4: "inverse_arrows \ ?\" proof show "ide (?\ \ \)" proof - have "?\ \ \ = dom \" using \ \ MkArr_Map comp_char seq_char B.comp_inv_arr' dom_char by auto thus ?thesis using \ by simp qed show "ide (\ \ ?\)" proof - have "\ \ ?\ = cod \" using \ \ MkArr_Map comp_char seq_char B.comp_arr_inv' cod_char by auto thus ?thesis using \ by simp qed qed thus "iso \" by auto show "inv \ = ?\" using 4 inverse_unique by simp qed have 3: "arr \ \ B.iso (Map \) \ iso \" using 2 by simp show "iso \ \ arr \ \ B.iso (Map \)" using 1 3 by blast show "iso \ \ inv \ = ?\" using 1 2 by blast qed subsection "The Strictness Theorem" text \ The Strictness Theorem asserts: ``Every bicategory is biequivalent to a strict bicategory.'' This amounts to an equivalent (and perhaps more desirable) formulation of the Coherence Theorem. In this section we prove the Strictness Theorem by constructing an equivalence pseudofunctor from a bicategory to its strictification. \ text \ We define a map \UP\ from the given bicategory \B\ to its strictification, and show that it is an equivalence pseudofunctor. The following auxiliary definition is not logically necessary, but it provides some terms that can be the targets of simplification rules and thereby enables some proofs to be done by simplification that otherwise could not be. Trying to eliminate it breaks some short proofs below, so I have kept it. \ definition UP\<^sub>0 where "UP\<^sub>0 a \ if B.obj a then MkIde \<^bold>\a\<^bold>\\<^sub>0 else null" lemma obj_UP\<^sub>0 [simp]: assumes "B.obj a" shows "obj (UP\<^sub>0 a)" unfolding obj_def using assms UP\<^sub>0_def ide_MkIde [of "\<^bold>\a\<^bold>\\<^sub>0"] src_def by simp lemma UP\<^sub>0_in_hom [intro]: assumes "B.obj a" shows "\UP\<^sub>0 a : UP\<^sub>0 a \ UP\<^sub>0 a\" and "\UP\<^sub>0 a : UP\<^sub>0 a \ UP\<^sub>0 a\" using assms obj_UP\<^sub>0 by blast+ lemma UP\<^sub>0_simps [simp]: assumes "B.obj a" shows "ide (UP\<^sub>0 a)" "arr (UP\<^sub>0 a)" and "src (UP\<^sub>0 a) = UP\<^sub>0 a" and "trg (UP\<^sub>0 a) = UP\<^sub>0 a" and "dom (UP\<^sub>0 a) = UP\<^sub>0 a" and "cod (UP\<^sub>0 a) = UP\<^sub>0 a" using assms obj_UP\<^sub>0 apply blast using assms obj_UP\<^sub>0 obj_simps by simp_all definition UP where "UP \ \ if B.arr \ then MkArr \<^bold>\B.dom \\<^bold>\ \<^bold>\B.cod \\<^bold>\ \ else null" lemma Dom_UP [simp]: assumes "B.arr \" shows "Dom (UP \) = \<^bold>\B.dom \\<^bold>\" using assms UP_def by fastforce lemma Cod_UP [simp]: assumes "B.arr \" shows "Cod (UP \) = \<^bold>\B.cod \\<^bold>\" using assms UP_def by fastforce lemma Map_UP [simp]: assumes "B.arr \" shows "Map (UP \) = \" using assms UP_def by fastforce lemma arr_UP: assumes "B.arr \" shows "arr (UP \)" using assms UP_def by (intro arrI, fastforce+) lemma UP_in_hom [intro]: assumes "B.arr \" shows "\UP \ : UP\<^sub>0 (src\<^sub>B \) \ UP\<^sub>0 (trg\<^sub>B \)\" and "\UP \ : UP (B.dom \) \ UP (B.cod \)\" using assms arr_UP UP_def UP\<^sub>0_def dom_char cod_char src_def trg_def by auto lemma UP_simps [simp]: assumes "B.arr \" shows "arr (UP \)" and "src (UP \) = UP\<^sub>0 (src\<^sub>B \)" and "trg (UP \) = UP\<^sub>0 (trg\<^sub>B \)" and "dom (UP \) = UP (B.dom \)" and "cod (UP \) = UP (B.cod \)" using assms arr_UP UP_in_hom by auto interpretation UP: "functor" V\<^sub>B vcomp UP using UP_def arr_UP UP_simps(4-5) arr_UP UP_def comp_char seq_char by unfold_locales auto interpretation UP: weak_arrow_of_homs V\<^sub>B src\<^sub>B trg\<^sub>B vcomp src trg UP proof fix \ assume \: "B.arr \" show "isomorphic (UP (src\<^sub>B \)) (src (UP \))" proof - let ?\ = "MkArr \<^bold>\src\<^sub>B \\<^bold>\ \<^bold>\src\<^sub>B \\<^bold>\\<^sub>0 (src\<^sub>B \)" have \: "\?\ : UP (src\<^sub>B \) \ src (UP \)\" proof show 1: "arr ?\" using \ by (intro arrI, auto) show "dom ?\ = UP (src\<^sub>B \)" using \ 1 dom_char UP_def by simp show "cod ?\ = src (UP \)" using \ 1 cod_char src_def by auto qed have "iso ?\" using \ \ iso_char src_def by auto thus ?thesis using \ isomorphic_def by auto qed show "isomorphic (UP (trg\<^sub>B \)) (trg (UP \))" proof - let ?\ = "MkArr \<^bold>\trg\<^sub>B \\<^bold>\ \<^bold>\trg\<^sub>B \\<^bold>\\<^sub>0 (trg\<^sub>B \)" have \: "\?\ : UP (trg\<^sub>B \) \ trg (UP \)\" proof show 1: "arr ?\" using \ by (intro arrI, auto) show "dom ?\ = UP (trg\<^sub>B \)" using \ 1 dom_char UP_def by simp show "cod ?\ = trg (UP \)" using \ 1 cod_char trg_def by auto qed have "iso ?\" using \ \ iso_char trg_def by auto thus ?thesis using \ isomorphic_def by auto qed qed interpretation HoUP_UP: composite_functor B.VV.comp VV.comp vcomp UP.FF \\\\. hcomp (fst \\) (snd \\)\ .. interpretation UPoH: composite_functor B.VV.comp V\<^sub>B vcomp \\\\. fst \\ \\<^sub>B snd \\\ UP .. abbreviation \\<^sub>o where "\\<^sub>o fg \ MkArr (\<^bold>\fst fg\<^bold>\ \<^bold>\ \<^bold>\snd fg\<^bold>\) \<^bold>\fst fg \\<^sub>B snd fg\<^bold>\ (fst fg \\<^sub>B snd fg)" interpretation \: transformation_by_components B.VV.comp vcomp HoUP_UP.map UPoH.map \\<^sub>o proof fix fg assume fg: "B.VV.ide fg" show "\\\<^sub>o fg : HoUP_UP.map fg \ UPoH.map fg\" proof (intro in_homI) show 1: "arr (\\<^sub>o fg)" using fg arr_char B.VV.ide_char B.VV.arr_char by auto show "dom (\\<^sub>o fg) = HoUP_UP.map fg" using 1 fg UP.FF_def B.VV.arr_char B.VV.ide_char dom_char hcomp_def B.can_Ide_self by simp show "cod (\\<^sub>o fg) = UPoH.map fg" using fg arr_char cod_char B.VV.ide_char B.VV.arr_char UP_def by auto qed next fix \\ assume \\: "B.VV.arr \\" show "\\<^sub>o (B.VV.cod \\) \ HoUP_UP.map \\ = UPoH.map \\ \ \\<^sub>o (B.VV.dom \\)" proof - have "\\<^sub>o (B.VV.cod \\) \ HoUP_UP.map \\ = MkArr (\<^bold>\B.dom (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.dom (snd \\)\<^bold>\) (\<^bold>\B.cod (fst \\) \\<^sub>B B.cod (snd \\)\<^bold>\) (fst \\ \\<^sub>B snd \\)" proof - have "\\<^sub>o (B.VV.cod \\) \ HoUP_UP.map \\ = MkArr (\<^bold>\B.cod (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.cod (snd \\)\<^bold>\) (\<^bold>\B.cod (fst \\) \\<^sub>B B.cod (snd \\)\<^bold>\) (B.cod (fst \\) \\<^sub>B B.cod (snd \\)) \ MkArr (\<^bold>\B.dom (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.dom (snd \\)\<^bold>\) (\<^bold>\B.cod (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.cod (snd \\)\<^bold>\) (fst \\ \\<^sub>B snd \\)" using \\ B.VV.arr_char arr_char UP.FF_def hcomp_def UP_def B.VV.cod_simp src_def trg_def B.can_in_hom B.can_Ide_self B.comp_arr_dom B.comp_cod_arr by auto also have "... = MkArr (\<^bold>\B.dom (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.dom (snd \\)\<^bold>\) (\<^bold>\B.cod (fst \\) \\<^sub>B B.cod (snd \\)\<^bold>\) ((B.cod (fst \\) \\<^sub>B B.cod (snd \\)) \\<^sub>B (fst \\ \\<^sub>B snd \\))" using \\ B.VV.arr_char by (intro comp_MkArr arr_MkArr, auto) also have "... = MkArr (\<^bold>\B.dom (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.dom (snd \\)\<^bold>\) (\<^bold>\B.cod (fst \\) \\<^sub>B B.cod (snd \\)\<^bold>\) (fst \\ \\<^sub>B snd \\)" using \\ B.VV.arr_char B.comp_cod_arr by auto finally show ?thesis by simp qed also have "... = UPoH.map \\ \ \\<^sub>o (B.VV.dom \\)" proof - have "UPoH.map \\ \ \\<^sub>o (B.VV.dom \\) = MkArr (\<^bold>\B.dom (fst \\) \\<^sub>B B.dom (snd \\)\<^bold>\) (\<^bold>\B.cod (fst \\) \\<^sub>B B.cod (snd \\)\<^bold>\) (fst \\ \\<^sub>B snd \\) \ MkArr (\<^bold>\B.dom (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.dom (snd \\)\<^bold>\) (\<^bold>\B.dom (fst \\) \\<^sub>B B.dom (snd \\)\<^bold>\) (B.dom (fst \\) \\<^sub>B B.dom (snd \\))" using \\ B.VV.arr_char arr_char UP.FF_def hcomp_def UP_def B.VV.dom_simp src_def trg_def B.can_in_hom B.can_Ide_self B.comp_arr_dom B.comp_cod_arr by auto also have "... = MkArr (\<^bold>\B.dom (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.dom (snd \\)\<^bold>\) (\<^bold>\B.cod (fst \\) \\<^sub>B B.cod (snd \\)\<^bold>\) ((fst \\ \\<^sub>B snd \\) \\<^sub>B (B.dom (fst \\) \\<^sub>B B.dom (snd \\)))" using \\ B.VV.arr_char arr_MkArr apply (intro comp_MkArr arr_MkArr) by auto also have "... = MkArr (\<^bold>\B.dom (fst \\)\<^bold>\ \<^bold>\ \<^bold>\B.dom (snd \\)\<^bold>\) (\<^bold>\B.cod (fst \\) \\<^sub>B B.cod (snd \\)\<^bold>\) (fst \\ \\<^sub>B snd \\)" using \\ B.VV.arr_char B.comp_arr_dom by auto finally show ?thesis by simp qed finally show ?thesis by simp qed qed abbreviation cmp\<^sub>U\<^sub>P where "cmp\<^sub>U\<^sub>P \ \.map" lemma cmp\<^sub>U\<^sub>P_in_hom [intro]: assumes "B.arr (fst \\)" and "B.arr (snd \\)" and "src\<^sub>B (fst \\) = trg\<^sub>B (snd \\)" shows "\cmp\<^sub>U\<^sub>P \\ : UP\<^sub>0 (src\<^sub>B (snd \\)) \ UP\<^sub>0 (trg\<^sub>B (fst \\))\" and "\cmp\<^sub>U\<^sub>P \\ : UP (B.dom (fst \\)) \ UP (B.dom (snd \\)) \ UP (B.cod (fst \\) \\<^sub>B B.cod (snd \\))\" proof - let ?\ = "fst \\" and ?\ = "snd \\" show 1: "\cmp\<^sub>U\<^sub>P \\ : UP (B.dom ?\) \ UP (B.dom ?\) \ UP (B.cod ?\ \\<^sub>B B.cod ?\)\" proof show "arr (cmp\<^sub>U\<^sub>P \\)" using assms by auto show "dom (cmp\<^sub>U\<^sub>P \\) = UP (B.dom ?\) \ UP (B.dom ?\)" proof - have "B.VV.in_hom (?\, ?\) (B.dom ?\, B.dom ?\) (B.cod ?\, B.cod ?\)" using assms B.VV.in_hom_char B.VV.arr_char by auto hence "dom (cmp\<^sub>U\<^sub>P \\) = HoUP_UP.map (B.dom ?\, B.dom ?\)" by auto also have "... = UP (B.dom ?\) \ UP (B.dom ?\)" using assms UP.FF_def by fastforce finally show ?thesis by simp qed show "cod (cmp\<^sub>U\<^sub>P \\) = UP (B.cod ?\ \\<^sub>B B.cod ?\)" using assms B.VV.in_hom_char B.VV.arr_char B.VV.cod_simp by auto qed show "\cmp\<^sub>U\<^sub>P \\ : UP\<^sub>0 (src\<^sub>B ?\) \ UP\<^sub>0 (trg\<^sub>B ?\)\" using assms 1 src_dom [of "cmp\<^sub>U\<^sub>P \\"] trg_dom [of "cmp\<^sub>U\<^sub>P \\"] by fastforce qed lemma cmp\<^sub>U\<^sub>P_simps [simp]: assumes "B.arr (fst \\)" and "B.arr (snd \\)" and "src\<^sub>B (fst \\) = trg\<^sub>B (snd \\)" shows "arr (cmp\<^sub>U\<^sub>P \\)" and "src (cmp\<^sub>U\<^sub>P \\) = UP\<^sub>0 (src\<^sub>B (snd \\))" and "trg (cmp\<^sub>U\<^sub>P \\) = UP\<^sub>0 (trg\<^sub>B (fst \\))" and "dom (cmp\<^sub>U\<^sub>P \\) = UP (B.dom (fst \\)) \ UP (B.dom (snd \\))" and "cod (cmp\<^sub>U\<^sub>P \\) = UP (B.cod (fst \\) \\<^sub>B B.cod (snd \\))" using assms cmp\<^sub>U\<^sub>P_in_hom [of \\] by auto lemma cmp\<^sub>U\<^sub>P_ide_simps [simp]: assumes "B.ide (fst fg)" and "B.ide (snd fg)" and "src\<^sub>B (fst fg) = trg\<^sub>B (snd fg)" shows "Dom (cmp\<^sub>U\<^sub>P fg) = \<^bold>\fst fg\<^bold>\ \<^bold>\ \<^bold>\snd fg\<^bold>\" and "Cod (cmp\<^sub>U\<^sub>P fg) = \<^bold>\fst fg \\<^sub>B snd fg\<^bold>\" and "Map (cmp\<^sub>U\<^sub>P fg) = fst fg \\<^sub>B snd fg" using assms B.VV.ide_char B.VV.arr_char by auto interpretation \: natural_isomorphism B.VV.comp vcomp HoUP_UP.map UPoH.map cmp\<^sub>U\<^sub>P proof fix fg assume fg: "B.VV.ide fg" have "arr (cmp\<^sub>U\<^sub>P fg)" using fg \.preserves_reflects_arr [of fg] by simp thus "iso (cmp\<^sub>U\<^sub>P fg)" using fg iso_char by simp qed lemma cmp\<^sub>U\<^sub>P_ide_simp: assumes "B.ide f" and "B.ide g" and "src\<^sub>B f = trg\<^sub>B g" shows "cmp\<^sub>U\<^sub>P (f, g) = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g)" using assms B.VV.ide_char B.VV.arr_char by simp lemma cmp\<^sub>U\<^sub>P'_ide_simp: assumes "B.ide f" and "B.ide g" and "src\<^sub>B f = trg\<^sub>B g" shows "inv (cmp\<^sub>U\<^sub>P (f, g)) = MkArr \<^bold>\f \\<^sub>B g\<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (f \\<^sub>B g)" using assms cmp\<^sub>U\<^sub>P_ide_simp iso_char \.components_are_iso [of "(f, g)"] B.VV.ide_char B.VV.arr_char by simp interpretation UP: pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B vcomp hcomp \ \ src trg UP cmp\<^sub>U\<^sub>P proof fix f g h assume f: "B.ide f" and g: "B.ide g" and h: "B.ide h" and fg: "src\<^sub>B f = trg\<^sub>B g" and gh: "src\<^sub>B g = trg\<^sub>B h" show "UP \\<^sub>B[f, g, h] \ cmp\<^sub>U\<^sub>P (f \\<^sub>B g, h) \ (cmp\<^sub>U\<^sub>P (f, g) \ UP h) = cmp\<^sub>U\<^sub>P (f, g \\<^sub>B h) \ (UP f \ cmp\<^sub>U\<^sub>P (g, h)) \ \ (UP f) (UP g) (UP h)" proof - have "UP \\<^sub>B[f, g, h] \ cmp\<^sub>U\<^sub>P (f \\<^sub>B g, h) \ (cmp\<^sub>U\<^sub>P (f, g) \ UP h) = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ (f \\<^sub>B g \\<^sub>B h)" proof - have 1: "UP.hseq\<^sub>D (MkIde \<^bold>\f\<^bold>\) (MkIde \<^bold>\g\<^bold>\)" using f g fg hseq_char src_def trg_def arr_char by auto have 2: "UP.hseq\<^sub>D (MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g) \ MkIde (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\)) (MkIde \<^bold>\h\<^bold>\)" proof - have "MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g) \ MkIde (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g)" proof - have "MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g) \ MkIde (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g) \ MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (f \\<^sub>B g)" using f g fg by simp also have "... = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ ((f \\<^sub>B g) \\<^sub>B (f \\<^sub>B g))" using f g fg by (intro comp_MkArr arr_MkArr, auto) also have "... = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g)" using f g fg by simp finally show ?thesis by blast qed thus ?thesis using f g h fg gh arr_char src_def trg_def by auto qed have "UP \\<^sub>B[f, g, h] = MkArr \<^bold>\(f \\<^sub>B g) \\<^sub>B h\<^bold>\ \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ \\<^sub>B[f, g, h]" using f g h fg gh UP_def B.HoHV_def B.HoVH_def B.VVV.arr_char B.VV.arr_char B.VVV.dom_char B.VVV.cod_char by simp moreover have "cmp\<^sub>U\<^sub>P (f \\<^sub>B g, h) = MkArr (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\(f \\<^sub>B g) \\<^sub>B h\<^bold>\ ((f \\<^sub>B g) \\<^sub>B h) \ MkArr (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) ((f \\<^sub>B g) \\<^sub>B h)" using f g h fg gh \.map_simp_ide \.map_def B.VV.arr_char UP.FF_def B.VV.cod_simp hcomp_def B.can_Ide_self by simp moreover have "cmp\<^sub>U\<^sub>P (f, g) \ UP h = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (B.inv \\<^sub>B[f, g, h])" proof - have "MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (B.can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \\<^sub>B (f \\<^sub>B g) \\<^sub>B B.can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\)) = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (f \\<^sub>B g)" using f g fg B.can_Ide_self B.comp_arr_dom B.comp_cod_arr by simp moreover have "MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g) \ MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) (f \\<^sub>B g) = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\f \\<^sub>B g\<^bold>\ (f \\<^sub>B g)" by (metis (no_types, lifting) 2 B.ideD(1) E.eval.simps(2-3) cod_MkArr comp_arr_ide f g ide_char' seq_char) moreover have "B.can ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) = B.inv \\<^sub>B[f, g, h]" using f g h fg gh B.canI_associator_0 B.inverse_arrows_can by simp ultimately show ?thesis using 1 2 f g h fg gh \.map_def UP_def hcomp_def UP.FF_def B.VV.arr_char B.can_Ide_self B.comp_cod_arr B.VV.cod_simp by simp qed ultimately have "UP \\<^sub>B[f, g, h] \ cmp\<^sub>U\<^sub>P (f \\<^sub>B g, h) \ (cmp\<^sub>U\<^sub>P (f, g) \ UP h) = MkArr \<^bold>\(f \\<^sub>B g) \\<^sub>B h\<^bold>\ \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ \\<^sub>B[f, g, h] \ MkArr (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\(f \\<^sub>B g) \\<^sub>B h\<^bold>\ ((f \\<^sub>B g) \\<^sub>B h) \ MkArr (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) ((f \\<^sub>B g) \\<^sub>B h) \ MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (B.inv \\<^sub>B[f, g, h])" using comp_assoc by presburger also have "... = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ (\\<^sub>B[f, g, h] \\<^sub>B ((f \\<^sub>B g) \\<^sub>B h) \\<^sub>B ((f \\<^sub>B g) \\<^sub>B h) \\<^sub>B B.inv \\<^sub>B[f, g, h])" proof - have "Arr (MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (B.inv \\<^sub>B[f, g, h])) \ Arr (MkArr (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) ((f \\<^sub>B g) \\<^sub>B h)) \ Arr (MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (((f \\<^sub>B g) \\<^sub>B h) \\<^sub>B B.inv \\<^sub>B[f, g, h])) \ Arr (MkArr (\<^bold>\f \\<^sub>B g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\(f \\<^sub>B g) \\<^sub>B h\<^bold>\ ((f \\<^sub>B g) \\<^sub>B h)) \ Arr (MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\(f \\<^sub>B g) \\<^sub>B h\<^bold>\ (((f \\<^sub>B g) \\<^sub>B h) \\<^sub>B ((f \\<^sub>B g) \\<^sub>B h) \\<^sub>B B.inv \\<^sub>B[f, g, h])) \ Arr (MkArr \<^bold>\(f \\<^sub>B g) \\<^sub>B h\<^bold>\ \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ \\<^sub>B[f, g, h])" using f g h fg gh B.\.preserves_hom B.HoHV_def B.HoVH_def by auto thus ?thesis using f g h fg gh comp_def B.comp_arr_dom B.comp_cod_arr by simp qed also have "... = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ (f \\<^sub>B g \\<^sub>B h)" using B.comp_cod_arr B.comp_arr_inv' by (auto simp add: f fg g gh h) finally show ?thesis by simp qed also have "... = cmp\<^sub>U\<^sub>P (f, g \\<^sub>B h) \ (UP f \ cmp\<^sub>U\<^sub>P (g, h)) \ \ (UP f) (UP g) (UP h)" proof - have "cmp\<^sub>U\<^sub>P (f, g \\<^sub>B h) \ (UP f \ cmp\<^sub>U\<^sub>P (g, h)) \ \ (UP f) (UP g) (UP h) = cmp\<^sub>U\<^sub>P (f, g \\<^sub>B h) \ (MkIde \<^bold>\f\<^bold>\ \ cmp\<^sub>U\<^sub>P (g, h)) \ (MkIde \<^bold>\f\<^bold>\ \ MkIde \<^bold>\g\<^bold>\ \ MkIde \<^bold>\h\<^bold>\)" using f g h fg gh VVV.arr_char VV.arr_char arr_char src_def trg_def UP_def \_def by auto also have "... = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ (f \\<^sub>B g \\<^sub>B h) \ MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (f \\<^sub>B g \\<^sub>B h) \ MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (f \\<^sub>B g \\<^sub>B h) \ MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (f \\<^sub>B g \\<^sub>B h)" proof - have "cmp\<^sub>U\<^sub>P (f, g \\<^sub>B h) = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ (f \\<^sub>B g \\<^sub>B h) \ MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (f \\<^sub>B g \\<^sub>B h)" using f g h fg gh \.map_simp_ide \.map_def UP.FF_def UP_def hcomp_def B.VV.arr_char B.can_Ide_self B.comp_arr_dom B.comp_cod_arr src_def trg_def arr_char B.VV.cod_simp by auto moreover have "cmp\<^sub>U\<^sub>P (g, h) = MkArr (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\g \\<^sub>B h\<^bold>\ (g \\<^sub>B h)" using g h gh cmp\<^sub>U\<^sub>P_ide_simp by blast moreover have "MkIde \<^bold>\f\<^bold>\ \ MkArr (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\g \\<^sub>B h\<^bold>\ (g \\<^sub>B h) = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (f \\<^sub>B g \\<^sub>B h)" using f g h fg gh hcomp_def arr_char src_def trg_def B.can_Ide_self B.comp_arr_dom B.comp_cod_arr by auto moreover have "MkIde \<^bold>\f\<^bold>\ \ MkIde \<^bold>\g\<^bold>\ \ MkIde \<^bold>\h\<^bold>\ = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (f \\<^sub>B g \\<^sub>B h)" proof - have "\f : f \\<^sub>B f\ \ \g : g \\<^sub>B g\ \ \h : h \\<^sub>B h\" using f g h by auto thus ?thesis using f g h fg gh hcomp_def arr_char src_def trg_def B.can_Ide_self B.comp_arr_dom B.comp_cod_arr by auto qed ultimately show ?thesis using comp_assoc by auto qed also have "... = MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ (f \\<^sub>B g \\<^sub>B h)" proof - have "Arr (MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (f \\<^sub>B g \\<^sub>B h)) \ Arr (MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (f \\<^sub>B g \\<^sub>B h)) \ Arr (MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) (f \\<^sub>B g \\<^sub>B h)) \ Arr (MkArr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g \\<^sub>B h\<^bold>\) \<^bold>\f \\<^sub>B g \\<^sub>B h\<^bold>\ (f \\<^sub>B g \\<^sub>B h))" using f g h fg gh by auto thus ?thesis using f g h fg gh comp_def by auto qed finally show ?thesis by simp qed finally show ?thesis by blast qed qed lemma UP_is_pseudofunctor: shows "pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B vcomp hcomp \ \ src trg UP cmp\<^sub>U\<^sub>P" .. lemma UP_map\<^sub>0_obj [simp]: assumes "B.obj a" shows "UP.map\<^sub>0 a = UP\<^sub>0 a" using assms UP.map\<^sub>0_def by auto interpretation UP: full_functor V\<^sub>B vcomp UP proof fix \ f g assume f: "B.ide f" and g: "B.ide g" assume \: "\\ : UP f \ UP g\" show "\\. \\ : f \\<^sub>B g\ \ UP \ = \" proof - have 1: "\Map \ : f \\<^sub>B g\" using f g \ UP_def arr_char in_hom_char by auto moreover have "UP (Map \) = \" proof - have "\ = MkArr (Dom \) (Cod \) (Map \)" using \ MkArr_Map by auto also have "... = UP (Map \)" using "1" B.arrI UP.as_nat_trans.preserves_hom UP_def \ in_hom_char by force finally show ?thesis by auto qed ultimately show ?thesis by blast qed qed interpretation UP: faithful_functor V\<^sub>B vcomp UP using arr_char UP_def by (unfold_locales, simp_all) interpretation UP: fully_faithful_functor V\<^sub>B vcomp UP .. lemma UP_is_fully_faithful_functor: shows "fully_faithful_functor V\<^sub>B vcomp UP" .. no_notation B.in_hom ("\_ : _ \\<^sub>B _\") (* Inherited from functor, I think. *) lemma Map_reflects_hhom: assumes "B.obj a" and "B.obj b" and "ide g" and "\g : UP.map\<^sub>0 a \ UP.map\<^sub>0 b\" shows "\Map g : a \\<^sub>B b\" proof have 1: "B.ide (Map g)" using assms ide_char by blast show "B.arr (Map g)" using 1 by simp show "src\<^sub>B (Map g) = a" proof - have "src\<^sub>B (Map g) = Map (src g)" using assms src_def apply simp by (metis (no_types, lifting) E.eval_simps(2) E.Ide_implies_Arr arr_char ideE) also have "... = Map (UP.map\<^sub>0 a)" using assms by (metis (no_types, lifting) in_hhomE) also have "... = a" using assms UP.map\<^sub>0_def UP_def [of a] src_def by auto finally show ?thesis by simp qed show "trg\<^sub>B (Map g) = b" proof - have "trg\<^sub>B (Map g) = Map (trg g)" using assms trg_def apply simp by (metis (no_types, lifting) E.eval_simps(3) E.Ide_implies_Arr arr_char ideE) also have "... = Map (UP.map\<^sub>0 b)" using assms by (metis (no_types, lifting) in_hhomE) also have "... = b" using assms UP.map\<^sub>0_def UP_def [of b] src_def by auto finally show ?thesis by simp qed qed lemma eval_Dom_ide [simp]: assumes "ide g" shows "\Dom g\ = Map g" using assms dom_char ideD by auto lemma Cod_ide: assumes "ide f" shows "Cod f = Dom f" using assms dom_char by auto lemma Map_preserves_objects: assumes "obj a" shows "B.obj (Map a)" proof - have "src\<^sub>B (Map a) = Map (src a)" using assms src_def apply simp using E.eval_simps(2) E.Ide_implies_Arr arr_char ideE by (metis (no_types, lifting) objE) also have 1: "... = \E.Src (Dom a)\" using assms src_def by auto also have "... = \\<^bold>\Map a\<^bold>\\<^sub>0\" using assms B.src.is_extensional 1 obj_simps(2) by force also have "... = Map a" using assms by auto finally have "src\<^sub>B (Map a) = Map a" by simp moreover have "B.arr (Map a)" using assms B.ideD arr_char by auto ultimately show ?thesis using B.obj_def by simp qed interpretation UP: equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B vcomp hcomp \ \ src trg UP cmp\<^sub>U\<^sub>P proof (* UP is full, hence locally full. *) 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'; \\ : UP f \ UP f'\ \ \ \\. \\ : f \\<^sub>B f'\ \ UP \ = \" using UP.is_full by simp (* UP is biessentially surjective on objects. *) show "\b. obj b \ \a. B.obj a \ equivalent_objects (UP.map\<^sub>0 a) b" proof - fix b assume b: "obj b" have 1: "B.obj (Map b)" using b Map_preserves_objects by simp have 3: "UP.map\<^sub>0 (Map b) = MkArr \<^bold>\Map b\<^bold>\\<^sub>0 \<^bold>\Map b\<^bold>\\<^sub>0 (Map b)" using b 1 UP.map\<^sub>0_def [of "Map b"] UP_def src_def arr_char by auto have 4: "b = MkArr (Dom b) (Dom b) (Map b)" using b objE eval_Dom_ide by (metis (no_types, lifting) dom_char ideD(2) obj_def) let ?\ = "MkArr \<^bold>\Map b\<^bold>\\<^sub>0 (Dom b) (Map b)" have \: "arr ?\" proof - have 2: "E.Obj (Dom b)" using b obj_char by blast have "E.Nml \<^bold>\Map b\<^bold>\\<^sub>0 \ E.Ide \<^bold>\Map b\<^bold>\\<^sub>0" using 1 by auto moreover have "E.Nml (Dom b) \ E.Ide (Dom b)" using b arr_char [of b] by auto moreover have "E.Src \<^bold>\Map b\<^bold>\\<^sub>0 = E.Src (Dom b)" using b 1 2 apply (cases "Dom b") apply simp_all by fastforce moreover have "E.Trg \<^bold>\Map b\<^bold>\\<^sub>0 = E.Trg (Dom b)" using b 1 2 apply (cases "Dom b") apply simp_all by fastforce moreover have "\Map b : \\<^bold>\Map b\<^bold>\\<^sub>0\ \\<^sub>B \Dom b\\" using b 1 by (elim objE, auto) ultimately show ?thesis using arr_char \E.Nml \<^bold>\Map b\<^bold>\\<^sub>0 \ E.Ide \<^bold>\Map b\<^bold>\\<^sub>0\ by auto qed hence "iso ?\" using 1 iso_char by auto moreover have "dom ?\ = UP.map\<^sub>0 (Map b)" using \ dom_char b 1 3 B.objE UP.map\<^sub>0_def UP_def src_def by auto moreover have "cod ?\ = b" using \ cod_char b 4 1 by auto ultimately have "isomorphic (UP.map\<^sub>0 (Map b)) b" using \ 3 4 isomorphic_def by blast moreover have 5: "obj (UP.map\<^sub>0 (Map b))" using 1 UP.map\<^sub>0_simps(2) by simp ultimately have 6: "UP.map\<^sub>0 (Map b) = b" using b isomorphic_objects_are_equal by simp have "equivalent_objects (UP.map\<^sub>0 (Map b)) b" using b 6 equivalent_objects_reflexive [of b] by simp thus "\a. B.obj a \ equivalent_objects (UP.map\<^sub>0 a) b" using 1 6 by auto qed (* UP is locally essentially surjective. *) show "\a b g. \ B.obj a; B.obj b; \g : UP.map\<^sub>0 a \ UP.map\<^sub>0 b\; ide g \ \ \f. \f : a \\<^sub>B b\ \ B.ide f \ isomorphic (UP f) g" proof - fix a b g assume a: "B.obj a" and b: "B.obj b" assume g_in_hhom: "\g : UP.map\<^sub>0 a \ UP.map\<^sub>0 b\" assume ide_g: "ide g" have 1: "B.ide (Map g)" using ide_g ide_char by blast have "arr (UP a)" using a by auto have "arr (UP b)" using b by auto have Map_g_eq: "Map g = \Dom g\" using ide_g by simp have Map_g_in_hhom: "\Map g : a \\<^sub>B b\" using a b ide_g g_in_hhom Map_reflects_hhom by simp let ?\ = "MkArr \<^bold>\Map g\<^bold>\ (Dom g) (Map g)" have \: "arr ?\" proof - have "\Map ?\ : \Dom ?\\ \\<^sub>B \Cod ?\\\" using 1 Map_g_eq by auto moreover have "E.Ide \<^bold>\Map g\<^bold>\ \ E.Nml \<^bold>\Map g\<^bold>\" using 1 by simp moreover have "E.Ide (Dom g) \ E.Nml (Dom g)" using ide_g arr_char ide_char by blast moreover have "E.Src \<^bold>\Map g\<^bold>\ = E.Src (Dom g)" using ide_g g_in_hhom src_def Map_g_in_hhom by (metis (no_types, lifting) B.ideD(2) B.in_hhom_def B.objE B.obj_def' Dom.simps(1) E.Src.simps(2) UP.map\<^sub>0_def \arr (UP a)\ a in_hhomE UP_def) moreover have "E.Trg \<^bold>\Map g\<^bold>\ = E.Trg (Dom g)" proof - have "E.Trg \<^bold>\Map g\<^bold>\ = \<^bold>\b\<^bold>\\<^sub>0" using Map_g_in_hhom by auto also have "... = E.Trg (Dom g)" proof - have "E.Trg (Dom g) = Dom (trg g)" using ide_g trg_def by simp also have "... = Dom (UP.map\<^sub>0 b)" using g_in_hhom by auto also have "... = \<^bold>\b\<^bold>\\<^sub>0" using b \arr (UP b)\ UP.map\<^sub>0_def src_def UP_def B.objE by auto finally show ?thesis by simp qed finally show ?thesis by simp qed ultimately show ?thesis using arr_char by simp qed have "\?\ : UP (Map g) \ g\" by (simp add: "1" \ ide_g in_hom_char) moreover have "iso ?\" using \ 1 iso_char by simp ultimately have "isomorphic (UP (Map g)) g" using isomorphic_def by auto thus "\f. \f : a \\<^sub>B b\ \ B.ide f \ isomorphic (UP f) g" using 1 Map_g_in_hhom by auto qed qed theorem UP_is_equivalence_pseudofunctor: shows "equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B vcomp hcomp \ \ src trg UP cmp\<^sub>U\<^sub>P" .. text \ Next, we work out the details of the equivalence pseudofunctor \DN\ in the converse direction. \ definition DN where "DN \ \ if arr \ then Map \ else B.null" lemma DN_in_hom [intro]: assumes "arr \" shows "\DN \ : DN (src \) \\<^sub>B DN (trg \)\" and "\DN \ : DN (dom \) \\<^sub>B DN (cod \)\" using assms DN_def arr_char [of \] B.vconn_implies_hpar(1-2) E.eval_in_hom(1) B.in_hhom_def by auto lemma DN_simps [simp]: assumes "arr \" shows "B.arr (DN \)" and "src\<^sub>B (DN \) = DN (src \)" and "trg\<^sub>B (DN \) = DN (trg \)" and "B.dom (DN \) = DN (dom \)" and "B.cod (DN \) = DN (cod \)" using assms DN_in_hom by auto interpretation "functor" vcomp V\<^sub>B DN using DN_def seqE Map_comp seq_char by unfold_locales auto interpretation DN: weak_arrow_of_homs vcomp src trg V\<^sub>B src\<^sub>B trg\<^sub>B DN proof fix \ assume \: "arr \" show "B.isomorphic (DN (src \)) (src\<^sub>B (DN \))" proof - have "DN (src \) = src\<^sub>B (DN \)" using B.src.is_extensional DN_def DN_simps(2) by auto moreover have "B.ide (DN (src \))" using \ by simp ultimately show ?thesis using \ B.isomorphic_reflexive by auto qed show "B.isomorphic (DN (trg \)) (trg\<^sub>B (DN \))" proof - have "DN (trg \) = trg\<^sub>B (DN \)" using \B.isomorphic (DN (src \)) (src\<^sub>B (DN \))\ by fastforce moreover have "B.ide (DN (trg \))" using \ by simp ultimately show ?thesis using B.isomorphic_reflexive by auto qed qed interpretation "functor" VV.comp B.VV.comp DN.FF using DN.functor_FF by auto interpretation HoDN_DN: composite_functor VV.comp B.VV.comp V\<^sub>B DN.FF \\\\. H\<^sub>B (fst \\) (snd \\)\ .. interpretation DNoH: composite_functor VV.comp vcomp V\<^sub>B \\\\. fst \\ \ snd \\\ DN .. abbreviation \\<^sub>o where "\\<^sub>o fg \ B.can (Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)) (Dom (fst fg) \<^bold>\ Dom (snd fg))" abbreviation \\<^sub>o' where "\\<^sub>o' fg \ B.can (Dom (fst fg) \<^bold>\ Dom (snd fg)) (Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg))" lemma \\<^sub>o_in_hom: assumes "VV.ide fg" shows "\\\<^sub>o fg : Map (fst fg) \\<^sub>B Map (snd fg) \\<^sub>B \Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)\\" and "\\\<^sub>o' fg : \Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)\ \\<^sub>B Map (fst fg) \\<^sub>B Map (snd fg)\" and "B.inverse_arrows (\\<^sub>o fg) (\\<^sub>o' fg)" proof - have 1: "E.Ide (Dom (fst fg) \<^bold>\ Dom (snd fg))" unfolding E.Ide.simps(3) apply (intro conjI) using assms VV.ide_char VV.arr_char arr_char apply simp using VV.arr_char VV.ideD(1) assms apply blast by (metis (no_types, lifting) VV.arrE VV.ideD(1) assms src_simps(1) trg_simps(1)) have 2: "E.Ide (Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg))" using 1 by (meson E.Ide.simps(3) E.Ide_HcompNml VV.arr_char VV.ideD(1) arr_char assms) have 3: "\<^bold>\Dom (fst fg) \<^bold>\ Dom (snd fg)\<^bold>\ = \<^bold>\Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)\<^bold>\" by (metis (no_types, lifting) E.Ide.simps(3) E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml VV.arr_char VV.ideD(1) arr_char assms 1) have 4: "\Dom (fst fg) \<^bold>\ Dom (snd fg)\ = Map (fst fg) \\<^sub>B Map (snd fg)" using assms VV.ide_char VV.arr_char arr_char by simp show "\\\<^sub>o fg : Map (fst fg) \\<^sub>B Map (snd fg) \\<^sub>B \Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)\\" using 1 2 3 4 by auto show "\\\<^sub>o' fg : \Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)\ \\<^sub>B Map (fst fg) \\<^sub>B Map (snd fg)\" using 1 2 3 4 by auto show "B.inverse_arrows (\\<^sub>o fg) (\\<^sub>o' fg)" using 1 2 3 B.inverse_arrows_can by blast qed interpretation \: transformation_by_components VV.comp V\<^sub>B HoDN_DN.map DNoH.map \\<^sub>o proof fix fg assume fg: "VV.ide fg" have 1: "\Dom (fst fg) \<^bold>\ Dom (snd fg)\ = Map (fst fg) \\<^sub>B Map (snd fg)" using fg VV.ide_char VV.arr_char arr_char by simp show "\\\<^sub>o fg : HoDN_DN.map fg \\<^sub>B DNoH.map fg\" proof show "B.arr (\\<^sub>o fg)" using fg \\<^sub>o_in_hom by blast show "B.dom (\\<^sub>o fg) = HoDN_DN.map fg" proof - have "B.dom (\\<^sub>o fg) = Map (fst fg) \\<^sub>B Map (snd fg)" using fg \\<^sub>o_in_hom by blast also have "... = HoDN_DN.map fg" using fg DN.FF_def DN_def VV.arr_char src_def trg_def VV.ide_char by auto finally show ?thesis by simp qed show "B.cod (\\<^sub>o fg) = DNoH.map fg" proof - have "B.cod (\\<^sub>o fg) = \Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)\" using fg \\<^sub>o_in_hom by blast also have "... = DNoH.map fg" proof - have "DNoH.map fg = B.can (Cod (fst fg) \<^bold>\\<^bold>\\<^bold>\ Cod (snd fg)) (Cod (fst fg) \<^bold>\ Cod (snd fg)) \\<^sub>B (Map (fst fg) \\<^sub>B Map (snd fg)) \\<^sub>B B.can (Dom (fst fg) \<^bold>\ Dom (snd fg)) (Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg))" using fg DN_def Map_hcomp VV.arr_char apply simp using VV.ideD(1) by blast also have "... = B.can (Cod (fst fg) \<^bold>\\<^bold>\\<^bold>\ Cod (snd fg)) (Cod (fst fg) \<^bold>\ Cod (snd fg)) \\<^sub>B B.can (Dom (fst fg) \<^bold>\ Dom (snd fg)) (Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg))" proof - have "(Map (fst fg) \\<^sub>B Map (snd fg)) \\<^sub>B B.can (Dom (fst fg) \<^bold>\ Dom (snd fg)) (Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)) = B.can (Dom (fst fg) \<^bold>\ Dom (snd fg)) (Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg))" using fg 1 \\<^sub>o_in_hom B.comp_cod_arr by blast thus ?thesis by simp qed also have "... = \Dom (fst fg) \<^bold>\\<^bold>\\<^bold>\ Dom (snd fg)\" proof - have "B.can (Cod (fst fg) \<^bold>\\<^bold>\\<^bold>\ Cod (snd fg)) (Cod (fst fg) \<^bold>\ Cod (snd fg)) = \\<^sub>o fg" using fg VV.ide_char Cod_ide by simp thus ?thesis using fg 1 \\<^sub>o_in_hom [of fg] B.comp_arr_inv' by fastforce qed finally show ?thesis by simp qed finally show ?thesis by blast qed qed next show "\f. VV.arr f \ \\<^sub>o (VV.cod f) \\<^sub>B HoDN_DN.map f = DNoH.map f \\<^sub>B \\<^sub>o (VV.dom f)" proof - fix \\ assume \\: "VV.arr \\" show "\\<^sub>o (VV.cod \\) \\<^sub>B HoDN_DN.map \\ = DNoH.map \\ \\<^sub>B \\<^sub>o (VV.dom \\)" proof - have 1: "E.Ide (Dom (fst \\) \<^bold>\ Dom (snd \\))" unfolding E.Ide.simps(3) by (metis (no_types, lifting) VV.arrE \\ arrE src_simps(2) trg_simps(2)) have 2: "E.Ide (Dom (fst \\) \<^bold>\\<^bold>\\<^bold>\ Dom (snd \\))" using 1 by (meson E.Ide.simps(3) E.Ide_HcompNml VV.arr_char VV.ideD(1) arr_char \\) have 3: "\<^bold>\Dom (fst \\) \<^bold>\ Dom (snd \\)\<^bold>\ = \<^bold>\Dom (fst \\) \<^bold>\\<^bold>\\<^bold>\ Dom (snd \\)\<^bold>\" by (metis (no_types, lifting) E.Ide.simps(3) E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml VV.arr_char arr_char \\ 1) have 4: "E.Ide (Cod (fst \\) \<^bold>\ Cod (snd \\))" unfolding E.Ide.simps(3) by (metis (no_types, lifting) "1" E.Ide.simps(3) VV.arrE \\ arr_char) have 5: "E.Ide (Cod (fst \\) \<^bold>\\<^bold>\\<^bold>\ Cod (snd \\))" using 4 by (meson E.Ide.simps(3) E.Ide_HcompNml VV.arr_char VV.ideD(1) arr_char \\) have 6: "\<^bold>\Cod (fst \\) \<^bold>\ Cod (snd \\)\<^bold>\ = \<^bold>\Cod (fst \\) \<^bold>\\<^bold>\\<^bold>\ Cod (snd \\)\<^bold>\" by (metis (no_types, lifting) E.Ide.simps(3) E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml VV.arr_char arr_char \\ 1) have A: "\\\<^sub>o' \\ : \Dom (fst \\) \<^bold>\\<^bold>\\<^bold>\ Dom (snd \\)\ \\<^sub>B \Dom (fst \\) \<^bold>\ Dom (snd \\)\\" using 1 2 3 by auto have B: "\Map (fst \\) \\<^sub>B Map (snd \\) : \Dom (fst \\) \<^bold>\ Dom (snd \\)\ \\<^sub>B \Cod (fst \\) \<^bold>\ Cod (snd \\)\\" using \\ VV.arr_char arr_char src_def trg_def E.Nml_implies_Arr E.eval_simps'(2-3) by auto have C: "\B.can (Cod (fst \\) \<^bold>\\<^bold>\\<^bold>\ Cod (snd \\)) (Cod (fst \\) \<^bold>\ Cod (snd \\)) : \Cod (fst \\) \<^bold>\ Cod (snd \\)\ \\<^sub>B \Cod (fst \\) \<^bold>\\<^bold>\\<^bold>\ Cod (snd \\)\\" using 4 5 6 by auto have "\\<^sub>o (VV.cod \\) \\<^sub>B HoDN_DN.map \\ = B.can (Cod (fst \\) \<^bold>\\<^bold>\\<^bold>\ Cod (snd \\)) (Cod (fst \\) \<^bold>\ Cod (snd \\)) \\<^sub>B (Map (fst \\) \\<^sub>B Map (snd \\))" using \\ VV.arr_char VV.cod_char arr_char src_def trg_def cod_char DN.FF_def DN_def by auto also have "... = B.can (Cod (fst \\) \<^bold>\\<^bold>\\<^bold>\ Cod (snd \\)) (Cod (fst \\) \<^bold>\ Cod (snd \\)) \\<^sub>B (Map (fst \\) \\<^sub>B Map (snd \\)) \\<^sub>B \\<^sub>o' \\ \\<^sub>B \\<^sub>o \\" using B \\ VV.arr_char arr_char src_def trg_def E.Ide_HcompNml E.Nml_HcompNml(1) B.can_Ide_self B.comp_arr_dom by auto also have "... = DNoH.map \\ \\<^sub>B \\<^sub>o (VV.dom \\)" proof - have "DNoH.map \\ \\<^sub>B \\<^sub>o (VV.dom \\) = B.can (Cod (fst \\) \<^bold>\\<^bold>\\<^bold>\ Cod (snd \\)) (Cod (fst \\) \<^bold>\ Cod (snd \\)) \\<^sub>B (Map (fst \\) \\<^sub>B Map (snd \\)) \\<^sub>B \\<^sub>o' \\ \\<^sub>B \\<^sub>o (VV.dom \\)" using \\ DN_def VV.arr_char B.comp_assoc by simp moreover have "\\<^sub>o (VV.dom \\) = \\<^sub>o \\" using \\ VV.dom_char VV.arr_char by auto ultimately show ?thesis using B.comp_assoc by simp qed finally show ?thesis by blast qed qed qed abbreviation cmp\<^sub>D\<^sub>N where "cmp\<^sub>D\<^sub>N \ \.map" interpretation \: natural_isomorphism VV.comp V\<^sub>B HoDN_DN.map DNoH.map cmp\<^sub>D\<^sub>N using \\<^sub>o_in_hom B.iso_def \.map_simp_ide apply unfold_locales apply auto by blast no_notation B.in_hom ("\_ : _ \\<^sub>B _\") lemma cmp\<^sub>D\<^sub>N_in_hom [intro]: assumes "arr (fst \\)" and "arr (snd \\)" and "src (fst \\) = trg (snd \\)" shows "\cmp\<^sub>D\<^sub>N \\ : DN (src (snd \\)) \\<^sub>B DN (trg (fst \\))\" and "\cmp\<^sub>D\<^sub>N \\ : DN (dom (fst \\)) \\<^sub>B DN (dom (snd \\)) \\<^sub>B DN (cod (fst \\) \ cod (snd \\))\" proof - have 1: "VV.arr \\" using assms VV.arr_char by simp show 2: "\cmp\<^sub>D\<^sub>N \\ : DN (dom (fst \\)) \\<^sub>B DN (dom (snd \\)) \\<^sub>B DN (cod (fst \\) \ cod (snd \\))\" proof - have "HoDN_DN.map (VV.dom \\) = DN (dom (fst \\)) \\<^sub>B DN (dom (snd \\))" using assms 1 DN.FF_def VV.dom_simp by auto moreover have "DNoH.map (VV.cod \\) = DN (cod (fst \\) \ cod (snd \\))" using assms 1 VV.cod_simp by simp ultimately show ?thesis using assms 1 \.preserves_hom by auto qed show "\cmp\<^sub>D\<^sub>N \\ : DN (src (snd \\)) \\<^sub>B DN (trg (fst \\))\" using assms 2 B.src_dom [of "cmp\<^sub>D\<^sub>N \\"] B.trg_dom [of "cmp\<^sub>D\<^sub>N \\"] by (elim B.in_homE, intro B.in_hhomI) auto qed lemma cmp\<^sub>D\<^sub>N_simps [simp]: assumes "arr (fst \\)" and "arr (snd \\)" and "src (fst \\) = trg (snd \\)" shows "B.arr (cmp\<^sub>D\<^sub>N \\)" and "src\<^sub>B (cmp\<^sub>D\<^sub>N \\) = DN (src (snd \\))" and "trg\<^sub>B (cmp\<^sub>D\<^sub>N \\) = DN (trg (fst \\))" and "B.dom (cmp\<^sub>D\<^sub>N \\) = DN (dom (fst \\)) \\<^sub>B DN (dom (snd \\))" and "B.cod (cmp\<^sub>D\<^sub>N \\) = DN (cod (fst \\) \ cod (snd \\))" proof show "VV.arr \\" using assms by blast have 1: "\cmp\<^sub>D\<^sub>N \\ : DN (src (snd \\)) \\<^sub>B DN (trg (fst \\))\" using assms by blast show "src\<^sub>B (cmp\<^sub>D\<^sub>N \\) = DN (src (snd \\))" using 1 by fast show "trg\<^sub>B (cmp\<^sub>D\<^sub>N \\) = DN (trg (fst \\))" using 1 by fast have 2: "\cmp\<^sub>D\<^sub>N \\ : DN (dom (fst \\)) \\<^sub>B DN (dom (snd \\)) \\<^sub>B DN (cod (fst \\) \ cod (snd \\))\" using assms by blast show "B.dom (cmp\<^sub>D\<^sub>N \\) = DN (dom (fst \\)) \\<^sub>B DN (dom (snd \\))" using 2 by fast show "B.cod (cmp\<^sub>D\<^sub>N \\) = DN (cod (fst \\) \ cod (snd \\))" using 2 by fast qed interpretation DN: pseudofunctor vcomp hcomp \ \ src trg V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B DN cmp\<^sub>D\<^sub>N proof show "\f g h. \ ide f; ide g; ide h; src f = trg g; src g = trg h \ \ DN (\ f g h) \\<^sub>B cmp\<^sub>D\<^sub>N (f \ g, h) \\<^sub>B (cmp\<^sub>D\<^sub>N (f, g) \\<^sub>B DN h) = cmp\<^sub>D\<^sub>N (f, g \ h) \\<^sub>B (DN f \\<^sub>B cmp\<^sub>D\<^sub>N (g, h)) \\<^sub>B \\<^sub>B[DN f, DN g, DN h]" proof - fix f g h assume f: "ide f" and g: "ide g" and h: "ide h" and fg: "src f = trg g" and gh: "src g = trg h" show "DN (\ f g h) \\<^sub>B cmp\<^sub>D\<^sub>N (f \ g, h) \\<^sub>B (cmp\<^sub>D\<^sub>N (f, g) \\<^sub>B DN h) = cmp\<^sub>D\<^sub>N (f, g \ h) \\<^sub>B (DN f \\<^sub>B cmp\<^sub>D\<^sub>N (g, h)) \\<^sub>B \\<^sub>B[DN f, DN g, DN h]" proof - have 1: "E.Trg (Dom g) = E.Trg (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \ \E.Trg (Dom g)\ = \E.Trg (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)\" using f g h fg gh arr_char src_def trg_def E.Trg_HcompNml by (metis (no_types, lifting) ideD(1) src_simps(2) trg_simps(2)) have 2: "arr (MkArr (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod f \<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) \\<^sub>B (Map f \\<^sub>B B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)) \\<^sub>B B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)))" proof - have "\B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod f \<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) \\<^sub>B (Map f \\<^sub>B B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)) \\<^sub>B B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : EVAL (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B EVAL (Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)\" proof (intro B.comp_in_homI) show 2: "\B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : EVAL (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B EVAL (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)\" using f g h fg gh 1 apply (intro B.can_in_hom) apply (metis (no_types, lifting) E.Ide_HcompNml E.Nml_HcompNml(1) arr_char ideD(1) src_simps(1) trg_simps(1)) apply (metis (no_types, lifting) E.Ide.simps(3) E.Ide_HcompNml ideD(1) arr_char src_simps(1) trg_simps(1)) by (metis (no_types, lifting) E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml ideD(1) arr_char src_simps(1) trg_simps(1)) show "\B.can (Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod f \<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) : EVAL (Cod f \<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) \\<^sub>B EVAL (Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)\" proof - have "E.Ide (Cod f \<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)" using f g h fg gh 1 Cod_ide E.Ide_HcompNml arr_char apply simp by (metis (no_types, lifting) ideD(1) src_simps(1) trg_simps(1)) moreover have "E.Ide (Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)" using f g h fg gh by (metis (no_types, lifting) E.Ide.simps(3) E.Ide_HcompNml E.Nml_HcompNml(1) arr_char calculation ideD(1) src_simps(1) trg_simps(1)) moreover have "E.Nmlize (Cod f \<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) = E.Nmlize (Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)" using f g h fg gh by (metis (no_types, lifting) E.Ide.simps(3) E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml arr_char calculation(1) ideD(1) src_simps(1) trg_simps(1)) ultimately show ?thesis using B.can_in_hom [of "Cod f \<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h" "Cod f \<^bold>\\<^bold>\\<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h"] by blast qed show "\Map f \\<^sub>B B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : EVAL (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B EVAL (Cod f \<^bold>\ Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)\" using f g h fg gh B.can_in_hom apply simp proof (intro B.hcomp_in_vhom B.comp_in_homI) show 1: "\B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : EVAL (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B EVAL (Dom g \<^bold>\ Dom h)\" using g h gh B.can_in_hom by (metis (no_types, lifting) E.Ide.simps(3) E.Ide_HcompNml E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml arr_char ideD(1) src_simps(1) trg_simps(1)) show "\B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) : EVAL (Cod g \<^bold>\ Cod h) \\<^sub>B EVAL (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)\" using g h gh B.can_in_hom by (metis (no_types, lifting) Cod_ide E.Ide.simps(3) E.Ide_HcompNml E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml arr_char ideD(1) src_simps(2) trg_simps(2)) show "\Map g \\<^sub>B Map h : EVAL (Dom g \<^bold>\ Dom h) \\<^sub>B EVAL (Cod g \<^bold>\ Cod h)\" proof show 2: "B.hseq (Map g) (Map h)" using g h gh by (metis (no_types, lifting) B.comp_null(1-2) B.hseq_char' B.ideD(1) Map_hcomp ideE ide_hcomp) show "B.dom (Map g \\<^sub>B Map h) = EVAL (Dom g \<^bold>\ Dom h)" using g h gh 2 by fastforce show "B.cod (Map g \\<^sub>B Map h) = EVAL (Cod g \<^bold>\ Cod h)" using g h gh 2 by fastforce qed show "\Map f : Map f \\<^sub>B EVAL (Cod f)\" using f arr_char Cod_ide by auto show "src\<^sub>B (Map f) = trg\<^sub>B \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\" using f g h fg gh 1 2 src_def trg_def B.arrI B.hseqE B.not_arr_null B.trg.is_extensional B.trg.preserves_hom B.vconn_implies_hpar(2) B.vconn_implies_hpar(4) E.eval.simps(3) by (metis (no_types, lifting) Map_ide(1)) qed qed thus ?thesis using f g h fg gh arr_char src_def trg_def E.Nml_HcompNml E.Ide_HcompNml ideD(1) apply (intro arr_MkArr) by auto qed have 3: "E.Ide (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using g h gh ide_char arr_char src_def trg_def E.Ide_HcompNml Cod_ide by (metis (no_types, lifting) ideD(1) src_simps(2) trg_simps(2)) have 4: "E.Ide (Dom g \<^bold>\ Dom h)" by (metis (no_types, lifting) E.Ide.simps(3) arrE g gh h ideE src_simps(1) trg_simps(1)) have 5: "E.Nmlize (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = E.Nmlize (Dom g \<^bold>\ Dom h)" using g h gh ide_char arr_char src_def trg_def E.Nml_HcompNml by (metis (no_types, lifting) 4 E.Ide.simps(3) E.Nmlize.simps(3) E.Nmlize_Nml ideD(1)) have 6: "E.Ide (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h fg gh arr_char src_def trg_def by (metis (no_types, lifting) 1 E.Nml_HcompNml(1) E.Ide_HcompNml ideD(1) src_simps(2) trg_simps(2)) have 7: "E.Ide (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h fg gh arr_char src_def trg_def by (metis (no_types, lifting) 1 3 E.Ide.simps(3) ideD(1) src_simps(2) trg_simps(2)) have 8: "E.Nmlize (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = E.Nmlize (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h fg gh arr_char src_def trg_def 7 E.Nml_HcompNml(1) ideD(1) by auto have "DN (\ f g h) \\<^sub>B cmp\<^sub>D\<^sub>N (f \ g, h) \\<^sub>B (cmp\<^sub>D\<^sub>N (f, g) \\<^sub>B DN h) = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" proof - have 9: "VVV.arr (f, g, h)" using f g h fg gh VVV.arr_char VV.arr_char arr_char ideD by simp have 10: "VV.ide (f, g)" using f g fg VV.ide_char by auto have 11: "VV.ide (hcomp f g, h)" using f g h fg gh VV.ide_char VV.arr_char by simp have 12: "arr (MkArr (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)))" proof (intro arr_MkArr) show "Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h \ IDE" using g h gh by (metis (no_types, lifting) 3 E.Nml_HcompNml(1) arr_char ideD(1) mem_Collect_eq src_simps(2) trg_simps(2)) show "Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h \ IDE" using g h gh Cod_ide \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h \ IDE\ by auto show "B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \ HOM (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)" proof show "E.Src (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = E.Src (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) \ E.Trg (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = E.Trg (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) \ \B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\ \\<^sub>B \Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h\\" proof (intro conjI) show "E.Src (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = E.Src (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)" using g h gh Cod_ide by simp show "E.Trg (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = E.Trg (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h)" using g h gh Cod_ide by simp show "\B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\ \\<^sub>B \Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h\\" proof (intro B.comp_in_homI) show "\B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\ \\<^sub>B \Dom g \<^bold>\ Dom h\\" using 3 4 5 by blast show "\Map g \\<^sub>B Map h : \Dom g \<^bold>\ Dom h\ \\<^sub>B \Cod g \<^bold>\ Cod h\\" using g h gh by (metis (no_types, lifting) 4 B.ide_in_hom(2) Cod_ide E.eval.simps(3) E.ide_eval_Ide Map_ide(2)) show "\B.can (Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h) (Cod g \<^bold>\ Cod h) : \Cod g \<^bold>\ Cod h\ \\<^sub>B \Cod g \<^bold>\\<^bold>\\<^bold>\ Cod h\\" using 3 4 5 Cod_ide g h by auto qed qed qed qed have "DN (\ f g h) = \Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\" proof - have "DN (\ f g h) = (B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B ((Map f \\<^sub>B B.can (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom g \<^bold>\ Dom h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h))) \\<^sub>B B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h))" using f g h fg gh 1 2 9 12 DN_def \_def Cod_ide by simp also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B (Map f \\<^sub>B \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\) \\<^sub>B B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" proof - have "\B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\ \\<^sub>B Map g \\<^sub>B Map h\" using g h 3 4 5 B.can_in_hom [of "Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h" "Dom g \<^bold>\ Dom h"] by simp hence "Map f \\<^sub>B B.can (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom g \<^bold>\ Dom h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = Map f \\<^sub>B B.can (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom g \<^bold>\ Dom h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using B.comp_cod_arr by auto also have "... = Map f \\<^sub>B \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\" using f g h fg gh 3 4 5 B.can_Ide_self by auto finally have "Map f \\<^sub>B B.can (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom g \<^bold>\ Dom h) \\<^sub>B (Map g \\<^sub>B Map h) \\<^sub>B B.can (Dom g \<^bold>\ Dom h) (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = Map f \\<^sub>B \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\" by simp thus ?thesis by simp qed also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" proof - have "\B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) : \Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\ \\<^sub>B Map f \\<^sub>B \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\\" using f g h 6 7 8 B.can_in_hom [of "Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h" "Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h"] by simp hence "(Map f \\<^sub>B \Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\) \\<^sub>B B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) = B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using B.comp_cod_arr by auto thus ?thesis by simp qed also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h fg gh 6 7 8 by auto also have "... = \Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\" using f g h fg gh 6 B.can_Ide_self by blast finally show ?thesis by simp qed have "DN (\ f g h) \\<^sub>B cmp\<^sub>D\<^sub>N (f \ g, h) \\<^sub>B (cmp\<^sub>D\<^sub>N (f, g) \\<^sub>B DN h) = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B B.can ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h) \\<^sub>B (B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) (Dom f \<^bold>\ Dom g) \\<^sub>B Map h)" proof - have "DN (\ f g h) = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h fg gh DN_def 1 4 6 7 B.can_Ide_self E.HcompNml_assoc E.Ide.simps(3) \DN (\ f g h) = \Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h\\ ide_char by (metis (no_types, lifting) arr_char ideD(1)) thus ?thesis using f g h fg gh 10 11 DN_def \.map_simp_ide by simp qed also have "... = (B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B B.can ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h)) \\<^sub>B (B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) (Dom f \<^bold>\ Dom g) \\<^sub>B Map h)" using B.comp_assoc by simp also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h) \\<^sub>B B.can ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h) ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" proof - have "B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) (Dom f \<^bold>\ Dom g) \\<^sub>B Map h = B.can ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h) ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" proof - have "B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) (Dom f \<^bold>\ Dom g) \\<^sub>B Map h = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) (Dom f \<^bold>\ Dom g) \\<^sub>B B.can (Dom h) (Dom h)" using h B.can_Ide_self by fastforce also have "... = B.can ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h) ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" using f g h 1 4 7 arr_char E.Nml_HcompNml(1) E.Src_HcompNml B.hcomp_can [of "Dom f \<^bold>\ Dom g" "Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g" "Dom h" "Dom h"] by (metis (no_types, lifting) E.Nmlize.simps(3) E.Nmlize_Nml E.Ide.simps(3) E.Ide_HcompNml E.Src.simps(3) arrE ideD(1)) finally show ?thesis by simp qed moreover have "B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B B.can ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h) = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h)" proof - have "E.Ide ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h)" using f g h 1 4 7 by (metis (no_types, lifting) E.Ide.simps(3) E.Ide_HcompNml E.Src_HcompNml arrE ideD(1)) moreover have "E.Ide ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h 1 7 E.Ide_HcompNml E.Nml_HcompNml(1) arr_char calculation ideD(1) by auto moreover have "E.Ide (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h 1 4 6 by blast moreover have "E.Nmlize ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h) = E.Nmlize ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h 1 4 7 by (metis (no_types, lifting) E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml E.Ide.simps(3) arrE calculation(1) ideD(1)) moreover have "E.Nmlize ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\\<^bold>\\<^bold>\ Dom h) = E.Nmlize (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h 1 4 7 E.HcompNml_assoc by fastforce ultimately show ?thesis using B.vcomp_can by simp qed ultimately show ?thesis by simp qed also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" proof - have "E.Ide ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" using 1 4 7 by simp moreover have "E.Ide ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h)" using f g 1 4 7 by (metis (no_types, lifting) E.Ide.simps(3) E.Ide_HcompNml E.Src_HcompNml arrE ideD(1)) moreover have "E.Ide (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h 6 by blast moreover have "E.Nmlize ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h) = E.Nmlize ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h)" using f g h 1 7 E.Nml_HcompNml(1) by fastforce moreover have "E.Nmlize ((Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g) \<^bold>\ Dom h) = E.Nmlize (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h)" using f g h 1 4 7 by (metis (no_types, lifting) E.Nml_HcompNml(1) E.Nmlize.simps(3) E.Nmlize_Nml E.HcompNml_assoc E.Ide.simps(3) arrE ideD(1)) ultimately show ?thesis using B.vcomp_can by simp qed finally show ?thesis by simp qed also have "... = cmp\<^sub>D\<^sub>N (f, g \ h) \\<^sub>B (DN f \\<^sub>B cmp\<^sub>D\<^sub>N (g, h)) \\<^sub>B \\<^sub>B[DN f, DN g, DN h]" proof - have "cmp\<^sub>D\<^sub>N (f, g \ h) \\<^sub>B (DN f \\<^sub>B cmp\<^sub>D\<^sub>N (g, h)) \\<^sub>B \\<^sub>B[DN f, DN g, DN h] = (cmp\<^sub>D\<^sub>N (f, g \ h) \\<^sub>B (DN f \\<^sub>B cmp\<^sub>D\<^sub>N (g, h))) \\<^sub>B \\<^sub>B[DN f, DN g, DN h]" using B.comp_assoc by simp also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\ Dom h) \\<^sub>B B.can (Dom f \<^bold>\ Dom g \<^bold>\ Dom h) ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" proof - have "cmp\<^sub>D\<^sub>N (f, g \ h) \\<^sub>B (DN f \\<^sub>B cmp\<^sub>D\<^sub>N (g, h)) = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\ Dom h)" proof - have "cmp\<^sub>D\<^sub>N (f, g \ h) \\<^sub>B (DN f \\<^sub>B cmp\<^sub>D\<^sub>N (g, h)) = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B (Map f \\<^sub>B B.can (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom g \<^bold>\ Dom h))" using f g h fg gh VV.ide_char VV.arr_char DN_def by simp also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B (B.can (Dom f) (Dom f) \\<^sub>B B.can (Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom g \<^bold>\ Dom h))" proof - have "Map f = B.can (Dom f) (Dom f)" using f arr_char B.can_Ide_self [of "Dom f"] Map_ide by (metis (no_types, lifting) ide_char') thus ?thesis by simp qed also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) \\<^sub>B B.can (Dom f \<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\ Dom h)" using 1 4 5 7 B.hcomp_can by auto also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) (Dom f \<^bold>\ Dom g \<^bold>\ Dom h)" using 1 4 5 6 7 8 B.vcomp_can by auto finally show ?thesis by simp qed moreover have "\\<^sub>B[DN f, DN g, DN h] = B.can (Dom f \<^bold>\ Dom g \<^bold>\ Dom h) ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" using f g h 1 4 7 DN_def B.canE_associator(1) by auto ultimately show ?thesis by simp qed also have "... = B.can (Dom f \<^bold>\\<^bold>\\<^bold>\ Dom g \<^bold>\\<^bold>\\<^bold>\ Dom h) ((Dom f \<^bold>\ Dom g) \<^bold>\ Dom h)" using 1 4 5 6 7 8 E.Nmlize_Hcomp_Hcomp B.vcomp_can by simp finally show ?thesis by simp qed finally show ?thesis by blast qed qed qed lemma DN_is_pseudofunctor: shows "pseudofunctor vcomp hcomp \ \ src trg V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B DN cmp\<^sub>D\<^sub>N" .. interpretation faithful_functor vcomp V\<^sub>B DN using arr_char dom_char cod_char DN_def apply unfold_locales by (metis (no_types, lifting) Cod_dom Dom_cod MkArr_Map) no_notation B.in_hom ("\_ : _ \\<^sub>B _\") lemma DN_UP: assumes "B.arr \" shows "DN (UP \) = \" using assms UP_def DN_def arr_UP by auto interpretation DN: equivalence_pseudofunctor vcomp hcomp \ \ src trg V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B DN cmp\<^sub>D\<^sub>N proof (* DN is locally (but not globally) full. *) show "\f f' \. \ ide f; ide f'; src f = src f'; trg f = trg f'; \\ : DN f \\<^sub>B DN f'\ \ \ \\. \\ : f \ f'\ \ DN \ = \" proof - fix f f' \ assume f: "ide f" and f': "ide f'" and eq_src: "src f = src f'" and eq_trg: "trg f = trg f'" and \: "\\ : DN f \\<^sub>B DN f'\" show "\\. \\ : f \ f'\ \ DN \ = \" proof - let ?\ = "MkArr (Dom f) (Dom f') \" have \: "\?\ : f \ f'\" proof have "Map f = \Dom f\" using f by simp have "Map f' = \Dom f'\" using f' by simp have "Dom f' = Cod f'" using f' Cod_ide by simp show \: "arr ?\" proof - have "E.Nml (Dom ?\) \ E.Ide (Dom ?\)" proof - have "E.Nml (Dom f) \ E.Ide (Dom f)" using f ide_char arr_char by blast thus ?thesis using f by simp qed moreover have "E.Nml (Cod ?\) \ E.Ide (Cod ?\)" proof - have "E.Nml (Dom f') \ E.Ide (Dom f')" using f' ide_char arr_char by blast thus ?thesis using f' by simp qed moreover have "E.Src (Dom ?\) = E.Src (Cod ?\)" using f f' \ arr_char src_def eq_src ideD(1) by auto moreover have "E.Trg (Dom ?\) = E.Trg (Cod ?\)" using f f' \ arr_char trg_def eq_trg ideD(1) by auto moreover have "\Map ?\ : \Dom ?\\ \\<^sub>B \Cod ?\\\" proof - have "\\ : \Dom f\ \\<^sub>B \Dom f'\\" using f f' \ ide_char arr_char DN_def Cod_ide Map_ide by (metis (no_types, lifting) ideD(1)) thus ?thesis by simp qed ultimately show ?thesis using f f' \ ide_char arr_char by blast qed show "dom ?\ = f" using f \ dom_char MkArr_Map MkIde_Dom' by simp show "cod ?\ = f'" proof - have "cod ?\ = MkIde (Dom f')" using \ cod_char by simp also have "... = MkArr (Dom f') (Cod f') (Map f')" using f' by auto also have "... = f'" using f' MkArr_Map by simp finally show ?thesis by simp qed qed moreover have "DN ?\ = \" using \ DN_def by auto ultimately show ?thesis by blast qed qed (* DN is biessentially surjective on objects. *) show "\a'. B.obj a' \ \a. obj a \ B.equivalent_objects (DN.map\<^sub>0 a) a'" proof - fix a' assume a': "B.obj a'" have "obj (UP.map\<^sub>0 a')" using a' UP.map\<^sub>0_simps(1) by simp moreover have "B.equivalent_objects (DN.map\<^sub>0 (UP.map\<^sub>0 a')) a'" proof - have "arr (MkArr \<^bold>\a'\<^bold>\ \<^bold>\a'\<^bold>\ a')" using a' UP_def [of a'] UP.preserves_reflects_arr [of a'] by auto moreover have "arr (MkArr \<^bold>\a'\<^bold>\\<^sub>0 \<^bold>\a'\<^bold>\\<^sub>0 a')" using a' arr_char obj_simps by auto ultimately have "DN.map\<^sub>0 (UP.map\<^sub>0 a') = a'" using a' UP.map\<^sub>0_def DN.map\<^sub>0_def DN_def src_def by auto thus ?thesis using a' B.equivalent_objects_reflexive by simp qed ultimately show "\a. obj a \ B.equivalent_objects (DN.map\<^sub>0 a) a'" by blast qed (* DN is locally essentially surjective. *) show "\a b g. \ obj a; obj b; \g : DN.map\<^sub>0 a \\<^sub>B DN.map\<^sub>0 b\; B.ide g \ \ \f. \f : a \ b\ \ ide f \ B.isomorphic (DN f) g" proof - fix a b g assume a: "obj a" and b: "obj b" and g: "\g : DN.map\<^sub>0 a \\<^sub>B DN.map\<^sub>0 b\" and ide_g: "B.ide g" have "ide (UP g)" using ide_g UP.preserves_ide by simp moreover have "B.isomorphic (DN (UP g)) g" using ide_g DN_UP B.isomorphic_reflexive by simp moreover have "\UP g : a \ b\" proof show "arr (UP g)" using g UP.preserves_reflects_arr by auto show "src (UP g) = a" proof - have "src (UP g) = MkArr \<^bold>\src\<^sub>B g\<^bold>\\<^sub>0 \<^bold>\src\<^sub>B g\<^bold>\\<^sub>0 (src\<^sub>B g)" using ide_g src_def UP_def UP.preserves_reflects_arr [of g] B.ideD(1) by simp also have "... = a" proof - have "src\<^sub>B g = src\<^sub>B (DN.map\<^sub>0 a)" using a g B.in_hhom_def by simp also have "... = Map a" using a Map_preserves_objects DN.map\<^sub>0_def DN_def B.src_src B.obj_simps by auto finally have "src\<^sub>B g = Map a" by simp hence "MkArr \<^bold>\src\<^sub>B g\<^bold>\\<^sub>0 \<^bold>\src\<^sub>B g\<^bold>\\<^sub>0 (src\<^sub>B g) = MkArr \<^bold>\Map a\<^bold>\\<^sub>0 \<^bold>\Map a\<^bold>\\<^sub>0 (Map a)" by simp also have "... = a" using a obj_char [of a] MkIde_Dom [of a] apply (cases "Dom a") apply force by simp_all finally show ?thesis by simp qed finally show ?thesis by simp qed show "trg (UP g) = b" proof - have "trg (UP g) = MkArr \<^bold>\trg\<^sub>B g\<^bold>\\<^sub>0 \<^bold>\trg\<^sub>B g\<^bold>\\<^sub>0 (trg\<^sub>B g)" using ide_g trg_def UP_def UP.preserves_reflects_arr [of g] B.ideD(1) by simp also have "... = b" proof - have "trg\<^sub>B g = trg\<^sub>B (DN.map\<^sub>0 b)" using b g B.in_hhom_def by simp also have "... = Map b" using b Map_preserves_objects DN.map\<^sub>0_def DN_def B.src_src B.obj_simps by auto finally have "trg\<^sub>B g = Map b" by simp hence "MkArr \<^bold>\trg\<^sub>B g\<^bold>\\<^sub>0 \<^bold>\trg\<^sub>B g\<^bold>\\<^sub>0 (trg\<^sub>B g) = MkArr \<^bold>\Map b\<^bold>\\<^sub>0 \<^bold>\Map b\<^bold>\\<^sub>0 (Map b)" by simp also have "... = b" using b obj_char [of b] MkIde_Dom [of b] apply (cases "Dom b") apply force by simp_all finally show ?thesis by simp qed finally show ?thesis by simp qed qed ultimately show "\f. \f : a \ b\ \ ide f \ B.isomorphic (DN f) g" by blast qed qed theorem DN_is_equivalence_pseudofunctor: shows "equivalence_pseudofunctor vcomp hcomp \ \ src trg V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B DN cmp\<^sub>D\<^sub>N" .. text \ The following gives an explicit formula for a component of the unit isomorphism of the pseudofunctor \UP\ from a bicategory to its strictification. It is not currently being used -- I originally proved it in order to establish something that I later proved in a more abstract setting -- but it might be useful at some point. \ interpretation UP: equivalence_pseudofunctor V\<^sub>B H\<^sub>B \\<^sub>B \\<^sub>B src\<^sub>B trg\<^sub>B vcomp hcomp \ \ src trg UP cmp\<^sub>U\<^sub>P using UP_is_equivalence_pseudofunctor by auto lemma UP_unit_char: assumes "B.obj a" shows "UP.unit a = MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a" proof - have " MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a = UP.unit a" proof (intro UP.unit_eqI) show "B.obj a" using assms by simp have 0: "\a : a \\<^sub>B a\" using assms by auto have 1: "arr (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a)" apply (unfold arr_char, intro conjI) using assms by auto have 2: "arr (MkArr \<^bold>\a\<^bold>\ \<^bold>\a\<^bold>\ a)" apply (unfold arr_char, intro conjI) using assms by auto have 3: "arr (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\\<^sub>0 a)" apply (unfold arr_char, intro conjI) using assms by auto show "\MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a : UP.map\<^sub>0 a \ UP a\" proof show "arr (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a)" by fact show "dom (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a) = UP.map\<^sub>0 a" using assms 1 2 dom_char UP.map\<^sub>0_def UP_def src_def by auto show "cod (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a) = UP a" using assms 1 2 cod_char UP.map\<^sub>0_def UP_def src_def by auto qed show "iso (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a)" using assms 1 iso_char by auto show "MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a \ \ (UP.map\<^sub>0 a) = (UP \\<^sub>B[a] \ cmp\<^sub>U\<^sub>P (a, a)) \ (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a \ MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a)" proof - have "MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a \ \ (UP.map\<^sub>0 a) = MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a" unfolding \_def UP.map\<^sub>0_def UP_def using assms 0 1 2 src_def by auto also have "... = (UP \\<^sub>B[a] \ cmp\<^sub>U\<^sub>P (a, a)) \ (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a \ MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a)" proof - have "(UP \\<^sub>B[a] \ cmp\<^sub>U\<^sub>P (a, a)) \ (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a \ MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a) = (MkArr \<^bold>\a \\<^sub>B a\<^bold>\ \<^bold>\a\<^bold>\ \\<^sub>B[a] \ MkArr (\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\a\<^bold>\) \<^bold>\a \\<^sub>B a\<^bold>\ (a \\<^sub>B a)) \ (MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a \ MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a)" using assms UP_def cmp\<^sub>U\<^sub>P_ide_simp by auto also have "... = (MkArr \<^bold>\a \\<^sub>B a\<^bold>\ \<^bold>\a\<^bold>\ \\<^sub>B[a] \ MkArr (\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\a\<^bold>\) \<^bold>\a \\<^sub>B a\<^bold>\ (a \\<^sub>B a)) \ MkArr \<^bold>\a\<^bold>\\<^sub>0 (\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\a\<^bold>\) (B.runit' a)" using assms 0 1 2 3 hcomp_def B.comp_cod_arr src_def trg_def B.can_Ide_self B.canE_unitor [of "\<^bold>\a\<^bold>\\<^sub>0"] B.comp_cod_arr by auto also have "... = MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ ((\\<^sub>B[a] \\<^sub>B (a \\<^sub>B a)) \\<^sub>B B.runit' a)" proof - have "MkArr \<^bold>\a \\<^sub>B a\<^bold>\ \<^bold>\a\<^bold>\ \\<^sub>B[a] \ MkArr (\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\a\<^bold>\) \<^bold>\a \\<^sub>B a\<^bold>\ (a \\<^sub>B a) = MkArr (\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\a\<^bold>\) \<^bold>\a\<^bold>\ (\\<^sub>B[a] \\<^sub>B (a \\<^sub>B a))" using assms by (intro comp_MkArr arr_MkArr) auto moreover have "MkArr (\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\a\<^bold>\) \<^bold>\a\<^bold>\ (\\<^sub>B[a] \\<^sub>B (a \\<^sub>B a)) \ MkArr \<^bold>\a\<^bold>\\<^sub>0 (\<^bold>\a\<^bold>\ \<^bold>\ \<^bold>\a\<^bold>\) (B.runit' a) = MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ ((\\<^sub>B[a] \\<^sub>B (a \\<^sub>B a)) \\<^sub>B B.runit' a)" using assms 0 B.comp_arr_dom by (intro comp_MkArr arr_MkArr, auto) ultimately show ?thesis by argo qed also have "... = MkArr \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\ a" using assms B.comp_arr_dom B.comp_arr_inv' B.iso_unit B.unitor_coincidence(2) by simp finally show ?thesis by argo qed finally show ?thesis by simp qed qed thus ?thesis by simp qed end subsection "Pseudofunctors into a Strict Bicategory" text \ In the special case of a pseudofunctor into a strict bicategory, we can obtain explicit formulas for the images of the units and associativities under the pseudofunctor, which only involve the structure maps of the pseudofunctor, since the units and associativities in the target bicategory are all identities. This is useful in applying strictification. \ locale pseudofunctor_into_strict_bicategory = pseudofunctor + D: strict_bicategory V\<^sub>D H\<^sub>D \\<^sub>D \\<^sub>D src\<^sub>D trg\<^sub>D begin lemma image_of_unitor: assumes "C.ide g" shows "F \\<^sub>C[g] = (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) \\<^sub>D D.inv (\ (trg\<^sub>C g, g))" and "F \\<^sub>C[g] = (F g \\<^sub>D D.inv (unit (src\<^sub>C g))) \\<^sub>D D.inv (\ (g, src\<^sub>C g))" and "F (C.lunit' g) = \ (trg\<^sub>C g, g) \\<^sub>D (unit (trg\<^sub>C g) \\<^sub>D F g)" and "F (C.runit' g) = \ (g, src\<^sub>C g) \\<^sub>D (F g \\<^sub>D unit (src\<^sub>C g))" proof - show A: "F \\<^sub>C[g] = (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) \\<^sub>D D.inv (\ (trg\<^sub>C g, g))" proof - have 1: "\(D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) \\<^sub>D D.inv (\ (trg\<^sub>C g, g)) : F (trg\<^sub>C g \\<^sub>C g) \\<^sub>D F g\" proof show "\D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g : F (trg\<^sub>C g) \\<^sub>D F g \\<^sub>D F g\" using assms unit_char by (auto simp add: D.hcomp_obj_arr) show "\D.inv (\ (trg\<^sub>C g, g)) : F (trg\<^sub>C g \\<^sub>C g) \\<^sub>D F (trg\<^sub>C g) \\<^sub>D F g\" using assms cmp_in_hom(2) D.inv_is_inverse by simp qed have "(D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) \\<^sub>D D.inv (\ (trg\<^sub>C g, g)) = F g \\<^sub>D (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) \\<^sub>D D.inv (\ (trg\<^sub>C g, g))" using 1 D.comp_cod_arr by auto also have "... = (F \\<^sub>C[g] \\<^sub>D \ (trg\<^sub>C g, g) \\<^sub>D (unit (trg\<^sub>C g) \\<^sub>D F g)) \\<^sub>D (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) \\<^sub>D D.inv (\ (trg\<^sub>C g, g))" using assms lunit_coherence [of g] D.strict_lunit by simp also have "... = F \\<^sub>C[g] \\<^sub>D \ (trg\<^sub>C g, g) \\<^sub>D ((unit (trg\<^sub>C g) \\<^sub>D F g) \\<^sub>D (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g)) \\<^sub>D D.inv (\ (trg\<^sub>C g, g))" using D.comp_assoc by simp also have "... = F \\<^sub>C[g]" proof - have "(unit (trg\<^sub>C g) \\<^sub>D F g) \\<^sub>D (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) = F (trg\<^sub>C g) \\<^sub>D F g" using assms unit_char D.whisker_right by (metis C.ideD(1) C.obj_trg C.trg.preserves_reflects_arr D.comp_arr_inv' unit_simps(5) preserves_arr preserves_ide) moreover have "\ (trg\<^sub>C g, g) \\<^sub>D D.inv (\ (trg\<^sub>C g, g)) = F (trg\<^sub>C g \\<^sub>C g)" using assms D.comp_arr_inv D.inv_is_inverse by simp ultimately show ?thesis using assms D.comp_arr_dom D.comp_cod_arr unit_char by auto qed finally show ?thesis by simp qed show B: "F \\<^sub>C[g] = (F g \\<^sub>D D.inv (unit (src\<^sub>C g))) \\<^sub>D D.inv (\ (g, src\<^sub>C g))" proof - have 1: "\(F g \\<^sub>D D.inv (unit (src\<^sub>C g))) \\<^sub>D D.inv (\ (g, src\<^sub>C g)) : F (g \\<^sub>C src\<^sub>C g) \\<^sub>D F g\" proof show "\F g \\<^sub>D D.inv (unit (src\<^sub>C g)) : F g \\<^sub>D F (src\<^sub>C g) \\<^sub>D F g\" using assms unit_char by (auto simp add: D.hcomp_arr_obj) show "\D.inv (\ (g, src\<^sub>C g)) : F (g \\<^sub>C src\<^sub>C g) \\<^sub>D F g \\<^sub>D F (src\<^sub>C g)\" using assms cmp_in_hom(2) by simp qed have "(F g \\<^sub>D D.inv (unit (src\<^sub>C g))) \\<^sub>D D.inv (\ (g, src\<^sub>C g)) = F g \\<^sub>D (F g \\<^sub>D D.inv (unit (src\<^sub>C g))) \\<^sub>D D.inv (\ (g, src\<^sub>C g))" using 1 D.comp_cod_arr by auto also have "... = (F \\<^sub>C[g] \\<^sub>D \ (g, src\<^sub>C g) \\<^sub>D (F g \\<^sub>D unit (src\<^sub>C g))) \\<^sub>D (F g \\<^sub>D D.inv (unit (src\<^sub>C g))) \\<^sub>D D.inv (\ (g, src\<^sub>C g))" using assms runit_coherence [of g] D.strict_runit by simp also have "... = F \\<^sub>C[g] \\<^sub>D (\ (g, src\<^sub>C g) \\<^sub>D ((F g \\<^sub>D unit (src\<^sub>C g)) \\<^sub>D (F g \\<^sub>D D.inv (unit (src\<^sub>C g))))) \\<^sub>D D.inv (\ (g, src\<^sub>C g))" using D.comp_assoc by simp also have "... = F \\<^sub>C[g]" proof - have "(F g \\<^sub>D unit (src\<^sub>C g)) \\<^sub>D (F g \\<^sub>D D.inv (unit (src\<^sub>C g))) = F g \\<^sub>D F (src\<^sub>C g)" using assms D.whisker_left unit_char by (metis C.ideD(1) C.obj_src C.src.preserves_ide D.comp_arr_inv' D.ideD(1) unit_simps(5) preserves_ide) moreover have "\ (g, src\<^sub>C g) \\<^sub>D D.inv (\ (g, src\<^sub>C g)) = F (g \\<^sub>C src\<^sub>C g)" using assms D.comp_arr_inv D.inv_is_inverse by simp ultimately show ?thesis using assms D.comp_arr_dom D.comp_cod_arr unit_char cmp_in_hom(2) [of g "src\<^sub>C g"] by auto qed finally show ?thesis by simp qed show "F (C.lunit' g) = \ (trg\<^sub>C g, g) \\<^sub>D (unit (trg\<^sub>C g) \\<^sub>D F g)" proof - have "F (C.lunit' g) = D.inv (F \\<^sub>C[g])" using assms C.iso_lunit preserves_inv by simp also have "... = D.inv ((D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) \\<^sub>D D.inv (\ (trg\<^sub>C g, g)))" using A by simp also have "... = \ (trg\<^sub>C g, g) \\<^sub>D (unit (trg\<^sub>C g) \\<^sub>D F g)" proof - have "D.iso (D.inv (\ (trg\<^sub>C g, g))) \ D.inv (D.inv (\ (trg\<^sub>C g, g))) = \ (trg\<^sub>C g, g)" using assms by simp moreover have "D.iso (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) \ D.inv (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) = unit (trg\<^sub>C g) \\<^sub>D F g" using assms unit_char by simp moreover have "D.seq (D.inv (unit (trg\<^sub>C g)) \\<^sub>D F g) (D.inv (\ (trg\<^sub>C g, g)))" using assms unit_char by (metis A C.lunit_simps(1) preserves_arr) ultimately show ?thesis using D.inv_comp by simp qed finally show ?thesis by simp qed show "F (C.runit' g) = \ (g, src\<^sub>C g) \\<^sub>D (F g \\<^sub>D unit (src\<^sub>C g))" proof - have "F (C.runit' g) = D.inv (F \\<^sub>C[g])" using assms C.iso_runit preserves_inv by simp also have "... = D.inv ((F g \\<^sub>D D.inv (unit (src\<^sub>C g))) \\<^sub>D D.inv (\ (g, src\<^sub>C g)))" using B by simp also have "... = \ (g, src\<^sub>C g) \\<^sub>D (F g \\<^sub>D unit (src\<^sub>C g))" proof - have "D.iso (D.inv (\ (g, src\<^sub>C g))) \ D.inv (D.inv (\ (g, src\<^sub>C g))) = \ (g, src\<^sub>C g)" using assms by simp moreover have "D.iso (F g \\<^sub>D D.inv (unit (src\<^sub>C g))) \ D.inv (F g \\<^sub>D D.inv (unit (src\<^sub>C g))) = F g \\<^sub>D unit (src\<^sub>C g)" using assms unit_char by simp moreover have "D.seq (F g \\<^sub>D D.inv (unit (src\<^sub>C g))) (D.inv (\ (g, src\<^sub>C g)))" using assms unit_char by (metis B C.runit_simps(1) preserves_arr) ultimately show ?thesis using D.inv_comp by simp qed finally show ?thesis by simp qed qed lemma image_of_associator: 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 (D.inv (\ (f, g)) \\<^sub>D F h) \\<^sub>D D.inv (\ (f \\<^sub>C g, h))" and "F (C.\' f g h) = \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D 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 (D.inv (\ (f, g)) \\<^sub>D F h) \\<^sub>D D.inv (\ (f \\<^sub>C g, h))" proof - have 2: "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 D.assoc_in_hom(2) [of "F f" "F g" "F h"] cmp_simps(1,4) C.VV.cod_simp by (intro D.seqI) auto moreover have 3: "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 blast moreover have "D.iso (\ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h))" using assms 2 3 C.VV.arr_char C.VV.dom_char C.VV.cod_char FF_def D.isos_compose by auto ultimately have "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 \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h))" 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)"] by presburger also have "... = \ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D (D.inv (\ (f, g)) \\<^sub>D F h) \\<^sub>D D.inv (\ (f \\<^sub>C g, h))" proof - 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))" proof - have "D.seq (\ (f \\<^sub>C g, h)) (\ (f, g) \\<^sub>D F h)" using assms by fastforce thus ?thesis using assms D.inv_comp by simp qed moreover have "(F f \\<^sub>D \ (g, h)) \\<^sub>D \\<^sub>D[F f, F g, F h] = (F f \\<^sub>D \ (g, h))" using assms D.comp_arr_dom D.assoc_in_hom [of "F f" "F g" "F h"] cmp_in_hom by (metis "2" "3" D.comp_arr_ide D.hseq_char D.seqE D.strict_assoc cmp_simps(2) cmp_simps(3) preserves_ide) ultimately show ?thesis using D.comp_assoc by simp qed finally show ?thesis by simp qed show "F (C.\' f g h) = \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h) \\<^sub>D (F f \\<^sub>D D.inv (\ (g, h))) \\<^sub>D D.inv (\ (f, g \\<^sub>C h))" proof - have "F (C.\' f g h) = D.inv (F \\<^sub>C[f, g, h])" using assms preserves_inv by simp also have "... = D.inv (\ (f, g \\<^sub>C h) \\<^sub>D (F f \\<^sub>D \ (g, h)) \\<^sub>D (D.inv (\ (f, g)) \\<^sub>D F h) \\<^sub>D D.inv (\ (f \\<^sub>C g, h)))" using 1 by simp also have "... = \ (f \\<^sub>C g, h) \\<^sub>D (\ (f, g) \\<^sub>D F h) \\<^sub>D (F f \\<^sub>D D.inv (\ (g, h))) \\<^sub>D D.inv (\ (f, g \\<^sub>C h))" using assms C.VV.arr_char FF_def D.hcomp_assoc D.comp_assoc C.VV.dom_simp C.VV.cod_simp (* OK, this is pretty cool, but not as cool as if I didn't have to direct it. *) by (simp add: D.inv_comp D.isos_compose) finally show ?thesis by simp qed qed end subsection "Internal Equivalences in a Strict Bicategory" text \ In this section we prove a useful fact about internal equivalences in a strict bicategory: namely, that if the ``right'' triangle identity holds for such an equivalence then the ``left'' does, as well. Later we will dualize this property, and use strictification to extend it to arbitrary bicategories. \ locale equivalence_in_strict_bicategory = strict_bicategory + equivalence_in_bicategory begin lemma triangle_right_implies_left: shows "(g \ \) \ (\ \ g) = g \ (\ \ f) \ (f \ \) = f" proof - text \ The formal proof here was constructed following the string diagram sketch below, which appears in \cite{nlab-zigzag-diagram} (see it also in context in \cite{nlab-adjoint-equivalence}). The diagram is reproduced here by permission of its author, Mike Shulman, who says (private communication): ``Just don't give the impression that the proof itself is due to me, because it's not. I don't know who first gave that proof; it's probably folklore.'' \begin{figure}[h] \includegraphics[width=6.5in]{triangle_right_implies_left.png} \end{figure} \ assume 1: "(g \ \) \ (\ \ g) = g" have 2: "(inv \ \ g) \ (g \ inv \) = g" proof - have "(inv \ \ g) \ (g \ inv \) = inv ((g \ \) \ (\ \ g))" using antipar inv_comp hcomp_assoc by simp also have "... = g" using 1 by simp finally show ?thesis by blast qed have "(\ \ f) \ (f \ \) = (\ \ f) \ (f \ (inv \ \ g) \ (g \ inv \) \ f) \ (f \ \)" proof - have "(f \ (inv \ \ g) \ (g \ inv \) \ f) \ (f \ \) = f \ \" using 2 ide_left ide_right antipar whisker_left by (metis comp_cod_arr unit_simps(1) unit_simps(3)) thus ?thesis by simp qed also have "... = (\ \ f) \ (f \ (inv \ \ g) \ (g \ inv \) \ f) \ (f \ \) \ (inv \ \ \)" proof - have "inv \ \ \ = src f" by (simp add: comp_inv_arr') thus ?thesis by (metis antipar(1) antipar(2) arrI calculation comp_ide_arr hcomp_arr_obj ideD(1) ide_left ide_right obj_src seqE strict_assoc' triangle_in_hom(1) vconn_implies_hpar(1)) qed also have "... = (\ \ (f \ (inv \ \ g) \ (g \ inv \)) \ ((f \ inv \) \ (f \ \))) \ (f \ \)" using ide_left ide_right antipar unit_is_iso by (metis "2" arr_inv calculation comp_arr_dom comp_inv_arr' counit_simps(1) counit_simps(2) dom_inv hcomp_arr_obj ideD(1) unit_simps(1) unit_simps(2) unit_simps(5) obj_trg seqI whisker_left) also have "... = (\ \ (f \ (inv \ \ g) \ (g \ inv \)) \ ((f \ inv \) \ ((inv \ \ f) \ (\ \ f)) \ (f \ \))) \ (f \ \)" proof - have "(inv \ \ f) \ (\ \ f) = (f \ g) \ f" using whisker_right [of f "inv \" \] counit_in_hom by (simp add: antipar(1) comp_inv_arr') thus ?thesis using hcomp_assoc comp_arr_dom by (metis comp_cod_arr ide_left local.unit_simps(1) local.unit_simps(3) whisker_left) qed also have "... = (((\ \ (f \ (inv \ \ g) \ (g \ inv \))) \ (f \ g)) \ (((f \ inv \) \ (inv \ \ f)) \ (\ \ f) \ (f \ \))) \ (f \ \)" using ide_left ide_right antipar comp_assoc whisker_right comp_cod_arr by (metis "2" comp_arr_dom counit_simps(1-2)) also have "... = (((\ \ (f \ (inv \ \ g) \ (g \ inv \))) \ ((f \ inv \) \ (inv \ \ f))) \ ((f \ g) \ (\ \ f) \ (f \ \))) \ (f \ \)" proof - have 3: "seq (\ \ (f \ (inv \ \ g) \ (g \ inv \))) (f \ g)" using 2 antipar by auto moreover have 4: "seq ((f \ inv \) \ (inv \ \ f)) ((\ \ f) \ (f \ \))" using antipar hcomp_assoc by auto ultimately show ?thesis using interchange by simp qed also have "... = ((\ \ (f \ (inv \ \ g) \ (g \ inv \))) \ ((f \ inv \) \ (inv \ \ f))) \ ((f \ g) \ (\ \ f) \ (f \ \)) \ (f \ \)" using comp_assoc by presburger also have "... = ((\ \ (f \ inv \) \ (inv \ \ f)) \ ((f \ (inv \ \ g) \ (g \ inv \)) \ f)) \ (f \ (g \ \) \ (\ \ g) \ f) \ (f \ \)" proof - have "(\ \ (f \ (inv \ \ g) \ (g \ inv \))) \ ((f \ inv \) \ (inv \ \ f)) = (\ \ (f \ inv \) \ (inv \ \ f)) \ ((f \ (inv \ \ g) \ (g \ inv \)) \ f)" proof - have "seq \ (f \ (inv \ \ g) \ (g \ inv \))" using 2 antipar by simp moreover have "seq ((f \ inv \) \ (inv \ \ f)) f" using antipar hcomp_assoc hcomp_obj_arr by auto ultimately show ?thesis using comp_assoc comp_arr_dom hcomp_obj_arr interchange [of \ "f \ (inv \ \ g) \ (g \ inv \)" "(f \ inv \) \ (inv \ \ f)" f] by simp qed moreover have "((f \ g) \ (\ \ f) \ (f \ \)) \ (f \ \) = (f \ (g \ \) \ (\ \ g) \ f) \ (f \ \)" proof - have "((f \ g) \ (\ \ f) \ (f \ \)) \ (f \ \) = (f \ g \ \ \ f) \ (f \ (g \ f) \ \) \ (f \ \ \ src f)" using antipar comp_assoc hcomp_assoc whisker_left hcomp_arr_obj by simp also have "... = (f \ g \ \ \ f) \ (f \ ((g \ f) \ \) \ (\ \ src f))" using antipar comp_arr_dom whisker_left hcomp_arr_obj by simp also have "... = (f \ g \ \ \ f) \ (f \ \ \ \)" using antipar comp_arr_dom comp_cod_arr hcomp_arr_obj interchange [of "g \ f" \ \ "src f"] by simp also have "... = (f \ g \ \ \ f) \ (f \ \ \ g \ f) \ (f \ src f \ \)" using antipar comp_arr_dom comp_cod_arr whisker_left interchange [of \ "src f" "g \ f" \] by simp also have "... = ((f \ g \ \ \ f) \ (f \ \ \ g \ f)) \ (f \ \)" using antipar comp_assoc by (simp add: hcomp_obj_arr) also have "... = (f \ (g \ \) \ (\ \ g) \ f) \ (f \ \)" using antipar comp_assoc whisker_left whisker_right hcomp_assoc by simp finally show ?thesis by blast qed ultimately show ?thesis by simp qed also have "... = (\ \ (f \ inv \) \ (inv \ \ f)) \ ((f \ (inv \ \ g) \ (g \ inv \) \ f) \ (f \ (g \ \) \ (\ \ g) \ f)) \ (f \ \)" using comp_assoc hcomp_assoc antipar(1) antipar(2) by auto also have "... = (\ \ (f \ inv \) \ (inv \ \ f)) \ ((f \ (inv \ \ g) \ (g \ inv \) \ (g \ \) \ (\ \ g) \ f)) \ (f \ \)" using ide_left ide_right antipar comp_cod_arr comp_assoc whisker_left by (metis "1" "2" comp_ide_self unit_simps(1) unit_simps(3)) also have "... = (\ \ (f \ inv \) \ (inv \ \ f)) \ (f \ \)" proof - have "(inv \ \ g) \ (g \ inv \) \ (g \ \) \ (\ \ g) = g" using ide_left ide_right antipar comp_arr_dom comp_assoc by (metis "1" "2" comp_ide_self) thus ?thesis using antipar comp_cod_arr by simp qed also have "... = (f \ inv \) \ ((inv \ \ f) \ (\ \ f)) \ (f \ \)" proof - have "(\ \ (f \ inv \) \ (inv \ \ f)) \ (f \ \) = (trg f \ \ \ (f \ inv \) \ (inv \ \ f)) \ (f \ \)" using hcomp_obj_arr comp_cod_arr by simp also have "... = ((trg f \ f \ inv \) \ (\ \ inv \ \ f)) \ (f \ \)" using antipar hcomp_arr_obj hcomp_assoc interchange by auto also have "... = (f \ inv \) \ ((inv \ \ f) \ (\ \ f)) \ (f \ \)" proof - have "(inv \ \ f) \ (\ \ f) = (trg f \ inv \ \ f) \ (\ \ trg f \ f)" using hseqI' by (simp add: hcomp_obj_arr) also have "... = \ \ inv \ \ f" using antipar comp_arr_dom comp_cod_arr interchange [of "trg f" \ "inv \ \ f" "trg f \ f"] by force finally have "(inv \ \ f) \ (\ \ f) = \ \ inv \ \ f" by simp moreover have "trg f \ f \ inv \ = f \ inv \" using hcomp_obj_arr [of "trg f" "f \ inv \"] by fastforce ultimately have "((trg f \ f \ inv \) \ (\ \ inv \ \ f)) \ (f \ \) = ((f \ inv \) \ ((inv \ \ f) \ (\ \ f))) \ (f \ \)" by simp thus ?thesis using comp_assoc by simp qed finally show ?thesis by simp qed also have "... = f \ inv \ \ \" proof - have "(inv \ \ f) \ (\ \ f) = f \ g \ f" using ide_left ide_right antipar counit_is_iso whisker_right hcomp_assoc by (metis comp_arr_dom comp_inv_arr' counit_simps(1) counit_simps(2) seqE) thus ?thesis using ide_left ide_right antipar unit_is_iso comp_cod_arr by (metis arr_inv dom_inv unit_simps(1) unit_simps(3) seqI whisker_left) qed also have "... = f \ src f" using antipar by (simp add: comp_inv_arr') also have "... = f" using hcomp_arr_obj by simp finally show ?thesis by simp qed end text \ Now we use strictification to generalize the preceding result to arbitrary bicategories. I originally attempted to generalize this proof directly from the strict case, by filling in the necessary canonical isomorphisms, but it turned out to be too daunting. The proof using strictification is still fairly tedious, but it is manageable. \ context equivalence_in_bicategory begin interpretation S: strictified_bicategory V H \ \ src trg .. notation S.vcomp (infixr "\\<^sub>S" 55) notation S.hcomp (infixr "\\<^sub>S" 53) notation S.in_hom ("\_ : _ \\<^sub>S _\") notation S.in_hhom ("\_ : _ \\<^sub>S _\") interpretation UP: equivalence_pseudofunctor V H \ \ src trg S.vcomp S.hcomp S.\ S.\ S.src S.trg S.UP S.cmp\<^sub>U\<^sub>P using S.UP_is_equivalence_pseudofunctor by auto interpretation UP: pseudofunctor_into_strict_bicategory V H \ \ src trg S.vcomp S.hcomp S.\ S.\ S.src S.trg S.UP S.cmp\<^sub>U\<^sub>P .. interpretation E: equivalence_in_bicategory S.vcomp S.hcomp S.\ S.\ S.src S.trg \S.UP f\ \S.UP g\ \S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S UP.unit (src f)\ \S.inv (UP.unit (trg f)) \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)\ using equivalence_in_bicategory_axioms UP.preserves_equivalence [of f g \ \] by auto interpretation E: equivalence_in_strict_bicategory S.vcomp S.hcomp S.\ S.\ S.src S.trg \S.UP f\ \S.UP g\ \S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S UP.unit (src f)\ \S.inv (UP.unit (trg f)) \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)\ .. lemma UP_triangle: shows "S.UP ((g \ \) \ \[g, f, g] \ (\ \ g)) = S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" and "S.UP (\\<^sup>-\<^sup>1[g] \ \[g]) = (S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S UP.unit (src g))) \\<^sub>S (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" and "S.UP ((\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \)) = S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" and "S.UP (\\<^sup>-\<^sup>1[f] \ \[f]) = (S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (UP.unit (trg f) \\<^sub>S S.UP f)) \\<^sub>S (S.UP f \\<^sub>S S.inv (UP.unit (src f))) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" and "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g] \ S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f)) = (S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (UP.unit (trg f) \\<^sub>S S.UP f)) \\<^sub>S (S.UP f \\<^sub>S S.inv (UP.unit (src f))) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" proof - show T1: "S.UP ((g \ \) \ \[g, f, g] \ (\ \ g)) = S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" proof - have "S.UP ((g \ \) \ \[g, f, g] \ (\ \ g)) = S.UP (g \ \) \\<^sub>S S.UP \[g, f, g] \\<^sub>S S.UP (\ \ g)" using antipar by simp also have "... = (S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S S.UP \) \\<^sub>S ((S.inv (S.cmp\<^sub>U\<^sub>P (g, f \ g)) \\<^sub>S S.cmp\<^sub>U\<^sub>P (g, f \ g)) \\<^sub>S (S.UP g \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g))) \\<^sub>S (((S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP g) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g \ f, g)))) \\<^sub>S S.cmp\<^sub>U\<^sub>P (g \ f, g)) \\<^sub>S (S.UP \ \\<^sub>S S.UP g)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" proof - have "S.UP \[g, f, g] = S.cmp\<^sub>U\<^sub>P (g, f \ g) \\<^sub>S (S.UP g \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g \ f, g))" using ide_left ide_right antipar UP.image_of_associator [of g f g] by simp moreover have "S.UP (g \ \) = S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S S.UP \) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f \ g))" proof - have "S.seq (S.cmp\<^sub>U\<^sub>P (g, src g)) (S.UP g \\<^sub>S S.UP \)" using antipar UP.FF_def UP.cmp_in_hom [of g "src g"] apply (intro S.seqI) by auto moreover have "S.UP (g \ \) \\<^sub>S S.cmp\<^sub>U\<^sub>P (g, f \ g) = S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S S.UP \)" using antipar UP.\.naturality [of "(g, \)"] UP.FF_def VV.arr_char VV.dom_simp VV.cod_simp by simp moreover have "S.iso (S.cmp\<^sub>U\<^sub>P (g, f \ g))" using antipar by simp ultimately show ?thesis using S.invert_side_of_triangle(2) [of "S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S S.UP \)" "S.UP (g \ \)" "S.cmp\<^sub>U\<^sub>P (g, f \ g)"] S.comp_assoc by presburger qed moreover have "S.UP (\ \ g) = (S.cmp\<^sub>U\<^sub>P (g \ f, g) \\<^sub>S (S.UP \ \\<^sub>S S.UP g)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" proof - have "S.UP (\ \ g) \\<^sub>S S.cmp\<^sub>U\<^sub>P (trg g, g) = S.cmp\<^sub>U\<^sub>P (g \ f, g) \\<^sub>S (S.UP \ \\<^sub>S S.UP g)" using antipar UP.\.naturality [of "(\, g)"] UP.FF_def VV.arr_char VV.dom_simp VV.cod_simp by simp moreover have "S.seq (S.cmp\<^sub>U\<^sub>P (g \ f, g)) (S.UP \ \\<^sub>S S.UP g)" using antipar UP.cmp_in_hom(2) by (intro S.seqI, auto) ultimately show ?thesis using antipar S.invert_side_of_triangle(2) by simp qed ultimately show ?thesis using S.comp_assoc by simp qed also have "... = S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S ((S.UP g \\<^sub>S S.UP \) \\<^sub>S (S.UP g \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g))) \\<^sub>S ((S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP g) \\<^sub>S (S.UP \ \\<^sub>S S.UP g)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" proof - have "(S.inv (S.cmp\<^sub>U\<^sub>P (g \ f, g)) \\<^sub>S S.cmp\<^sub>U\<^sub>P (g \ f, g)) \\<^sub>S (S.UP \ \\<^sub>S S.UP g) = (S.UP \ \\<^sub>S S.UP g)" using antipar S.comp_inv_arr' S.comp_cod_arr by auto moreover have "(S.inv (S.cmp\<^sub>U\<^sub>P (g, f \ g)) \\<^sub>S S.cmp\<^sub>U\<^sub>P (g, f \ g)) \\<^sub>S (S.UP g \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) = (S.UP g \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g))" proof - have "S.inv (S.cmp\<^sub>U\<^sub>P (g, f \ g)) \\<^sub>S S.cmp\<^sub>U\<^sub>P (g, f \ g) = S.UP g \\<^sub>S S.UP (f \ g)" using antipar S.comp_inv_arr' UP.cmp_in_hom by auto thus ?thesis using antipar VV.arr_char S.comp_cod_arr by simp qed ultimately show ?thesis using S.comp_assoc by simp qed also have "... = S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" using antipar VV.arr_char S.whisker_left S.whisker_right by auto finally show ?thesis by simp qed show T2: "S.UP (\\<^sup>-\<^sup>1[g] \ \[g]) = (S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S UP.unit (src g))) \\<^sub>S (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" using UP.image_of_unitor by simp show "S.UP ((\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \)) = S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" proof - have "S.UP ((\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \)) = S.UP (\ \ f) \\<^sub>S S.UP \\<^sup>-\<^sup>1[f, g, f] \\<^sub>S S.UP (f \ \)" using antipar by simp also have "... = S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.UP f) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (f \ g, f)) \\<^sub>S S.cmp\<^sub>U\<^sub>P (f \ g, f) \\<^sub>S (S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f)) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f))) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (f, g \ f)) \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g \ f) \\<^sub>S (S.UP f \\<^sub>S S.UP \)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" proof - have "S.UP \\<^sup>-\<^sup>1[f, g, f] = S.cmp\<^sub>U\<^sub>P (f \ g, f) \\<^sub>S (S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f))) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, g \ f))" using ide_left ide_right antipar UP.image_of_associator by simp moreover have "S.UP (\ \ f) = S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.UP f) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f \ g, f))" proof - have "S.seq (S.cmp\<^sub>U\<^sub>P (trg f, f)) (S.UP \ \\<^sub>S S.UP f)" using antipar UP.FF_def VV.ide_char VV.arr_char UP.cmp_in_hom [of "trg f" f] apply (intro S.seqI) by auto moreover have "S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.UP f) = S.UP (\ \ f) \\<^sub>S S.cmp\<^sub>U\<^sub>P (f \ g, f)" using antipar UP.\.naturality [of "(\, f)"] UP.FF_def VV.arr_char VV.dom_simp VV.cod_simp by simp moreover have "S.iso (S.cmp\<^sub>U\<^sub>P (f \ g, f))" using antipar by simp ultimately show ?thesis using antipar S.comp_assoc S.invert_side_of_triangle(2) [of "S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.UP f)" "S.UP (\ \ f)" "S.cmp\<^sub>U\<^sub>P (f \ g, f)"] by metis qed moreover have "S.UP (f \ \) = (S.cmp\<^sub>U\<^sub>P (f, g \ f) \\<^sub>S (S.UP f \\<^sub>S S.UP \)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" proof - have "S.cmp\<^sub>U\<^sub>P (f, g \ f) \\<^sub>S (S.UP f \\<^sub>S S.UP \) = S.UP (f \ \) \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, src f)" using antipar UP.\.naturality [of "(f, \)"] UP.FF_def VV.arr_char VV.dom_simp VV.cod_simp by simp moreover have "S.seq (S.cmp\<^sub>U\<^sub>P (f, g \ f)) (S.UP f \\<^sub>S S.UP \)" using antipar by (intro S.seqI, auto) ultimately show ?thesis using antipar S.invert_side_of_triangle(2) by auto qed ultimately show ?thesis using S.comp_assoc by simp qed also have "... = S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S ((S.UP \ \\<^sub>S S.UP f) \\<^sub>S (S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f)) \\<^sub>S ((S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f))) \\<^sub>S (S.UP f \\<^sub>S S.UP \)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" proof - have "(S.inv (S.cmp\<^sub>U\<^sub>P (f \ g, f)) \\<^sub>S S.cmp\<^sub>U\<^sub>P (f \ g, f)) \\<^sub>S (S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) = (S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f)" using antipar S.comp_cod_arr VV.arr_char S.comp_inv_arr' by auto moreover have "(S.inv (S.cmp\<^sub>U\<^sub>P (f, g \ f)) \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g \ f)) \\<^sub>S (S.UP f \\<^sub>S S.UP \) = (S.UP f \\<^sub>S S.UP \)" using antipar S.comp_inv_arr' S.comp_cod_arr by auto ultimately show ?thesis using S.comp_assoc by simp qed also have "... = S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" using antipar VV.arr_char S.whisker_left S.whisker_right by auto finally show ?thesis by simp qed show "S.UP (\\<^sup>-\<^sup>1[f] \ \[f]) = (S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (UP.unit (trg f) \\<^sub>S S.UP f)) \\<^sub>S (S.UP f \\<^sub>S S.inv (UP.unit (src f))) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" using UP.image_of_unitor by simp show "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g] \ S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f)) = (S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (UP.unit (trg f) \\<^sub>S S.UP f)) \\<^sub>S (S.UP f \\<^sub>S S.inv (UP.unit (src f))) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" proof - assume A: "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" have B: "(S.UP g \\<^sub>S S.inv (UP.unit (src g)) \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S UP.unit (trg g) \\<^sub>S S.UP g) = S.UP g" proof - show "(S.UP g \\<^sub>S S.inv (UP.unit (src g)) \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S UP.unit (trg g) \\<^sub>S S.UP g) = S.UP g" proof - have 2: "S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g)) = (S.cmp\<^sub>U\<^sub>P (g, src g) \\<^sub>S (S.UP g \\<^sub>S UP.unit (src g))) \\<^sub>S (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" using A T1 T2 by simp show ?thesis proof - have 8: "S.seq (S.cmp\<^sub>U\<^sub>P (g, src g)) ((S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g)))" using antipar VV.arr_char S.hcomp_assoc by (metis (no_types, lifting) S.arr_UP T1 arrI triangle_in_hom(2)) have 7: "S.seq (S.cmp\<^sub>U\<^sub>P (g, src g)) ((S.UP g \\<^sub>S UP.unit (src g)) \\<^sub>S (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g)))" using antipar 2 8 S.comp_assoc by auto have 5: "(S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g) = (S.UP g \\<^sub>S UP.unit (src g)) \\<^sub>S (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g)" proof - have "((S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g)) = ((S.UP g \\<^sub>S UP.unit (src g)) \\<^sub>S (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g))" proof - have "S.mono (S.cmp\<^sub>U\<^sub>P (g, src g))" using antipar S.iso_is_section S.section_is_mono by simp thus ?thesis using 2 8 7 S.monoE S.comp_assoc by presburger qed moreover have "S.epi (S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g)))" using antipar S.iso_is_retraction S.retraction_is_epi by simp moreover have "S.seq ((S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g)) (S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g)))" using S.comp_assoc S.seq_char 8 by presburger moreover have "S.seq ((S.UP g \\<^sub>S UP.unit (src g)) \\<^sub>S (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g)) (S.inv (S.cmp\<^sub>U\<^sub>P (trg g, g)))" using antipar calculation(1,3) by presburger ultimately show ?thesis using 2 S.epiE by blast qed have 6: "S.seq (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g)" using antipar VV.arr_char S.hcomp_assoc by auto have 3: "(S.UP g \\<^sub>S S.inv (UP.unit (src g))) \\<^sub>S (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g) = (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g)" proof - have "S.seq (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g)" using 6 by simp moreover have "(S.UP g \\<^sub>S UP.unit (src g)) \\<^sub>S (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g) = (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g)" using 5 by argo moreover have "S.iso (S.UP g \\<^sub>S UP.unit (src g))" using antipar UP.unit_char S.UP_map\<^sub>0_obj by simp moreover have "S.inv (S.UP g \\<^sub>S UP.unit (src g)) = S.UP g \\<^sub>S S.inv (UP.unit (src g))" using antipar UP.unit_char S.UP_map\<^sub>0_obj by simp ultimately show ?thesis using S.invert_side_of_triangle(1) [of "(S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g)) \\<^sub>S (S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g)" "S.UP g \\<^sub>S UP.unit (src g)" "S.inv (UP.unit (trg g)) \\<^sub>S S.UP g"] by presburger qed have 4: "((S.UP g \\<^sub>S S.inv (UP.unit (src g))) \\<^sub>S (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g))) \\<^sub>S ((S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g)) \\<^sub>S (UP.unit (trg g) \\<^sub>S S.UP g) = S.UP g" proof - have "(((S.UP g \\<^sub>S S.inv (UP.unit (src g))) \\<^sub>S (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g))) \\<^sub>S ((S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g)) \\<^sub>S (UP.unit (trg g) \\<^sub>S S.UP g)) = (((S.UP g \\<^sub>S S.inv (UP.unit (src g))) \\<^sub>S (S.UP g \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g))) \\<^sub>S ((S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S S.UP g))) \\<^sub>S (UP.unit (trg g) \\<^sub>S S.UP g)" using S.comp_assoc by simp also have "... = (S.inv (UP.unit (trg g)) \\<^sub>S S.UP g) \\<^sub>S (UP.unit (trg g) \\<^sub>S S.UP g)" using 3 S.comp_assoc by auto also have "... = S.inv (UP.unit (trg g)) \\<^sub>S UP.unit (trg g) \\<^sub>S S.UP g" using UP.unit_char(2) S.whisker_right by auto also have "... = UP.map\<^sub>0 (trg g) \\<^sub>S S.UP g" using UP.unit_char [of "trg g"] S.comp_inv_arr S.inv_is_inverse by simp also have "... = S.UP g" using S.UP_map\<^sub>0_obj by (simp add: S.hcomp_obj_arr) finally show ?thesis by blast qed thus ?thesis using antipar S.whisker_left S.whisker_right UP.unit_char S.comp_assoc by simp qed qed qed show "S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f)) = (S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S (UP.unit (trg f) \\<^sub>S S.UP f)) \\<^sub>S (S.UP f \\<^sub>S S.inv (UP.unit (src f))) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" proof - have "(S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \) = (UP.unit (trg f) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (UP.unit (src f)))" proof - have 2: "(S.inv (UP.unit (trg f)) \\<^sub>S S.UP f) \\<^sub>S ((S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \)) \\<^sub>S (S.UP f \\<^sub>S UP.unit (src f)) = S.UP f" proof - have "S.UP f = (S.inv (UP.unit (trg f)) \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S UP.unit (src f))" using B antipar E.triangle_right_implies_left by argo also have "... = (S.inv (UP.unit (trg f)) \\<^sub>S S.UP f) \\<^sub>S ((S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \)) \\<^sub>S (S.UP f \\<^sub>S UP.unit (src f))" proof - have "S.inv (UP.unit (trg f)) \\<^sub>S S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f = (S.inv (UP.unit (trg f)) \\<^sub>S S.UP f) \\<^sub>S (S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f)" using UP.unit_char S.whisker_right by simp moreover have "S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \ \\<^sub>S UP.unit (src f) = (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \) \\<^sub>S (S.UP f \\<^sub>S UP.unit (src f))" using antipar UP.unit_char S.whisker_left S.comp_assoc by simp ultimately show ?thesis using S.comp_assoc by presburger qed finally show ?thesis by argo qed show ?thesis proof - have "((S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \)) \\<^sub>S (S.UP f \\<^sub>S UP.unit (src f)) = (UP.unit (trg f) \\<^sub>S S.UP f)" proof - have "S.inv (S.inv (UP.unit (trg f)) \\<^sub>S S.UP f) \\<^sub>S S.UP f = UP.unit (trg f) \\<^sub>S S.UP f" using UP.unit_char S.comp_arr_dom S.UP_map\<^sub>0_obj by (simp add: S.hcomp_obj_arr) moreover have "S.arr (S.UP f)" by simp moreover have "S.iso (S.inv (UP.unit (trg f)) \\<^sub>S S.UP f)" using S.UP_map\<^sub>0_obj by (simp add: UP.unit_char(2)) ultimately show ?thesis using 2 S.invert_side_of_triangle(1) [of "S.UP f" "S.inv (UP.unit (trg f)) \\<^sub>S S.UP f" "((S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \)) \\<^sub>S (S.UP f \\<^sub>S UP.unit (src f))"] by presburger qed moreover have "S.hseq (UP.unit (trg f)) (S.UP f) \ S.iso (S.UP f \\<^sub>S UP.unit (src f)) \ S.inv (S.UP f \\<^sub>S UP.unit (src f)) = S.UP f \\<^sub>S S.inv (UP.unit (src f))" using UP.unit_char S.UP_map\<^sub>0_obj by simp ultimately show ?thesis using S.invert_side_of_triangle(2) [of "UP.unit (trg f) \\<^sub>S S.UP f" "(S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \)" "S.UP f \\<^sub>S UP.unit (src f)"] by presburger qed qed hence "S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S ((S.UP \ \\<^sub>S S.cmp\<^sub>U\<^sub>P (f, g) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (g, f)) \\<^sub>S S.UP \)) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f)) = S.cmp\<^sub>U\<^sub>P (trg f, f) \\<^sub>S ((UP.unit (trg f) \\<^sub>S S.UP f) \\<^sub>S (S.UP f \\<^sub>S S.inv (UP.unit (src f)))) \\<^sub>S S.inv (S.cmp\<^sub>U\<^sub>P (f, src f))" by simp thus ?thesis using S.comp_assoc by simp qed qed qed lemma triangle_right_implies_left: assumes "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" shows "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f]" proof - have "par ((\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \)) (\\<^sup>-\<^sup>1[f] \ \[f])" using antipar by simp moreover have "S.UP ((\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \)) = S.UP (\\<^sup>-\<^sup>1[f] \ \[f])" using assms UP_triangle(3-5) by simp ultimately show "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f]" using UP.is_faithful by blast qed text \ We \emph{really} don't want to go through the ordeal of proving a dual version of \UP_triangle(5)\, do we? So let's be smart and dualize via the opposite bicategory. \ lemma triangle_left_implies_right: assumes "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f]" shows "(g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" proof - interpret Cop: op_bicategory V H \ \ src trg .. interpret Eop: equivalence_in_bicategory V Cop.H Cop.\ \ Cop.src Cop.trg g f \ \ using antipar unit_in_hom counit_in_hom by (unfold_locales) simp_all have "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f] \ (g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" using antipar Cop.lunit_ide_simp Cop.runit_ide_simp Cop.assoc_ide_simp VVV.ide_char VVV.arr_char VV.arr_char Eop.triangle_right_implies_left by simp thus ?thesis using assms by simp qed lemma triangle_left_iff_right: shows "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f] \ (g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" using triangle_left_implies_right triangle_right_implies_left by auto end text \ We might as well specialize the dual result back to the strict case while we are at it. \ context equivalence_in_strict_bicategory begin lemma triangle_left_iff_right: shows "(\ \ f) \ (f \ \) = f \ (g \ \) \ (\ \ g) = g" proof - have "(\ \ f) \ (f \ \) = f \ (\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = \\<^sup>-\<^sup>1[f] \ \[f]" proof - have "\\<^sup>-\<^sup>1[f] \ \[f] = f" using strict_lunit strict_runit by simp moreover have "(\ \ f) \ \\<^sup>-\<^sup>1[f, g, f] \ (f \ \) = (\ \ f) \ (f \ \)" using antipar strict_assoc assoc'_in_hom(2) [of f g f] comp_cod_arr by auto ultimately show ?thesis by simp qed also have "... \ (g \ \) \ \[g, f, g] \ (\ \ g) = \\<^sup>-\<^sup>1[g] \ \[g]" using triangle_left_iff_right by blast also have "... \ (g \ \) \ (\ \ g) = g" proof - have "\\<^sup>-\<^sup>1[g] \ \[g] = g" using strict_lunit strict_runit by simp moreover have "(g \ \) \ \[g, f, g] \ (\ \ g) = (g \ \) \ (\ \ g)" using antipar strict_assoc assoc_in_hom(2) [of g f g] comp_cod_arr by auto ultimately show ?thesis by simp qed finally show ?thesis by simp qed end end