(* Title: CanonicalIsomorphisms Author: Eugene W. Stark , 2019 Maintainer: Eugene W. Stark *) section "Canonical Isomorphisms" text \ In this section we develop some technology for working with canonical isomorphisms in a bicategory, which permits them to be specified simply by giving syntactic terms that evaluate to the domain and codomain, rather than often-cumbersome formulas expressed in terms of unitors and associators. \ theory CanonicalIsos imports Coherence begin context bicategory begin interpretation bicategorical_language .. interpretation E: self_evaluation_map V H \ \ src trg .. notation E.eval ("\_\") text \ The next definition defines \can u t\, which denotes the unique canonical isomorphism from \\t\\ to \\u\\. The ordering of the arguments of \can\ has been chosen to be the opposite of what was used for \hom\. Having the arguments to \can\ this way makes it easier to see at a glance when canonical isomorphisms are composable. It could probably be argued that \hom\ should have been defined this way as well, but that choice is somewhat well-entrenched by now and the argument for \can\ is stronger, as it denotes an arrow and therefore appears in expressions composed with other arrows, rather than just as a hypothesis or conclusion. \ definition can where "can u t \ \Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\" subsection "Basic Properties" text \ The following develop basic properties of \can\. \ lemma can_in_hom [intro]: assumes "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" shows "\can u t : \t\ \ \u\\" proof - let ?v = "Inv (u\<^bold>\) \<^bold>\ t\<^bold>\" have 1: "Can ?v \ Dom ?v = t \ Cod ?v = u" using assms red_in_Hom Can_red Inv_in_Hom Can_Inv(1) by simp show "\can u t : \t\ \ \u\\" unfolding can_def using 1 E.eval_in_hom Can_implies_Arr by (metis (no_types, lifting)) qed lemma can_simps [simp]: assumes "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" shows "arr (can u t)" and "dom (can u t) = \t\" and "cod (can u t) = \u\" using assms can_in_hom by auto lemma inverse_arrows_can: assumes "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" shows "iso (can u t)" and "inverse_arrows (can u t) (can t u)" proof - let ?v = "Inv (u\<^bold>\) \<^bold>\ t\<^bold>\" have 1: "Can ?v \ Dom ?v = t \ Cod ?v = u" using assms red_in_Hom Can_red Inv_in_Hom Can_Inv(1) by simp show "iso (can u t)" unfolding can_def using 1 E.iso_eval_Can by blast show "inverse_arrows (can u t) (can t u)" proof (unfold can_def) show "inverse_arrows \Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ \Inv (t\<^bold>\) \<^bold>\ u\<^bold>\\" proof show "ide (\Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ \ \Inv (t\<^bold>\) \<^bold>\ u\<^bold>\\)" proof - have "\Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ \ \Inv (t\<^bold>\) \<^bold>\ u\<^bold>\\ = \(Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) \<^bold>\ (Inv (t\<^bold>\) \<^bold>\ u\<^bold>\)\" by simp also have "... = \u\" proof (intro E.eval_eqI) show 2: "VPar ((Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) \<^bold>\ Inv (t\<^bold>\) \<^bold>\ u\<^bold>\) u" using assms 1 red_in_Hom Inv_in_Hom Ide_implies_Can Can_Inv Can_implies_Arr Can_red(1) by (simp add: Dom_Ide Cod_Ide) show "\<^bold>\(Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) \<^bold>\ Inv (t\<^bold>\) \<^bold>\ u\<^bold>\\<^bold>\ = \<^bold>\u\<^bold>\" proof - have 3: "Can (Inv (t\<^bold>\) \<^bold>\ u\<^bold>\)" using Arr.simps(4) Can.simps(4) Can_Inv(1) Can_red(1) 2 assms(1) assms(2) by presburger have "VSeq (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) (Inv (t\<^bold>\) \<^bold>\ u\<^bold>\)" using 2 Arr.simps(4) by blast hence "Can (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) \ Can (Inv (t\<^bold>\) \<^bold>\ u\<^bold>\) \ Dom (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) = Cod (Inv (t\<^bold>\) \<^bold>\ u\<^bold>\)" using 3 1 by metis thus ?thesis by (metis (no_types) 2 Can.simps(4) Nmlize_Dom Dom_Ide Ide_Nmlize_Can assms(2)) qed qed finally have "\Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ \ \Inv (t\<^bold>\) \<^bold>\ u\<^bold>\\ = \u\" by blast moreover have "ide \u\" using assms E.ide_eval_Ide by simp ultimately show ?thesis by simp qed show "ide (\Inv (t\<^bold>\) \<^bold>\ u\<^bold>\\ \ \Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\)" proof - have "\Inv (t\<^bold>\) \<^bold>\ u\<^bold>\\ \ \Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ = \(Inv (t\<^bold>\) \<^bold>\ u\<^bold>\) \<^bold>\ (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\)\" by simp also have "... = \t\" proof (intro E.eval_eqI) show 2: "VPar ((Inv (t\<^bold>\) \<^bold>\ u\<^bold>\) \<^bold>\ Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) t" using assms 1 red_in_Hom Inv_in_Hom Ide_implies_Can Can_Inv Can_implies_Arr Can_red(1) by (simp add: Dom_Ide Cod_Ide) show "\<^bold>\(Inv (t\<^bold>\) \<^bold>\ u\<^bold>\) \<^bold>\ Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\<^bold>\ = \<^bold>\t\<^bold>\" using assms 1 2 by (metis (full_types) Arr.simps(4) Can.simps(4) Can_Inv(1) Can_red(1) Nml_Nmlize(4) Dom_Ide Ide_Nmlize_Can) qed finally have "\Inv (t\<^bold>\) \<^bold>\ u\<^bold>\\ \ \Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ = \t\" by blast moreover have "ide \t\" using assms E.ide_eval_Ide by simp ultimately show ?thesis by simp qed qed qed qed lemma inv_can [simp]: assumes "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" shows "inv (can u t) = can t u" using assms inverse_arrows_can by (simp add: inverse_unique) lemma vcomp_can [simp]: assumes "Ide t" and "Ide u" and "Ide v" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" and "\<^bold>\u\<^bold>\ = \<^bold>\v\<^bold>\" shows "can v u \ can u t = can v t" proof (unfold can_def) have "\Inv (v\<^bold>\) \<^bold>\ u\<^bold>\\ \ \Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ = \(Inv (v\<^bold>\) \<^bold>\ u\<^bold>\) \<^bold>\ (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\)\" using assms by simp also have "... = \Inv (v\<^bold>\) \<^bold>\ t\<^bold>\\" proof (intro E.eval_eqI) show "VPar ((Inv (v\<^bold>\) \<^bold>\ u\<^bold>\) \<^bold>\ Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) (Inv (v\<^bold>\) \<^bold>\ t\<^bold>\)" using assms red_in_Hom Inv_in_Hom Ide_implies_Can by (simp add: Can_red(1)) show "\<^bold>\(Inv (v\<^bold>\) \<^bold>\ u\<^bold>\) \<^bold>\ Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\<^bold>\ = \<^bold>\Inv (v\<^bold>\) \<^bold>\ t\<^bold>\\<^bold>\" using assms Can_red(1) Nml_Nmlize(1) Nmlize_Inv Ide_Nmlize_Can Ide_implies_Can \VPar ((Inv (v\<^bold>\) \<^bold>\ u\<^bold>\) \<^bold>\ Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) (Inv (v\<^bold>\) \<^bold>\ t\<^bold>\)\ apply simp by (metis red_simps(4) Nmlize_red Dom_Cod VcompNml_Nml_Dom) qed finally show "\Inv (v\<^bold>\) \<^bold>\ u\<^bold>\\ \ \Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ = \Inv (v\<^bold>\) \<^bold>\ t\<^bold>\\" by blast qed lemma hcomp_can [simp]: assumes "Ide t" and "Ide u" and "Ide v" and "Ide w" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" and "\<^bold>\v\<^bold>\ = \<^bold>\w\<^bold>\" and "Src t = Trg v" and "Src u = Trg w" shows "can u t \ can w v = can (u \<^bold>\ w) (t \<^bold>\ v)" proof (unfold can_def) have "\Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ \ \Inv (w\<^bold>\) \<^bold>\ v\<^bold>\\ = \(Inv (u\<^bold>\) \<^bold>\ t\<^bold>\) \<^bold>\ (Inv (w\<^bold>\) \<^bold>\ v\<^bold>\)\" using assms by simp also have "... = \Inv ((u \<^bold>\ w)\<^bold>\) \<^bold>\ (t \<^bold>\ v)\<^bold>\\" proof (intro E.eval_eqI) show "VPar (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\ \<^bold>\ Inv (w\<^bold>\) \<^bold>\ v\<^bold>\) (Inv ((u \<^bold>\ w)\<^bold>\) \<^bold>\ (t \<^bold>\ v)\<^bold>\)" proof - have "Arr (Inv ((u \<^bold>\ w)\<^bold>\) \<^bold>\ (t \<^bold>\ v)\<^bold>\)" proof - have "Ide (u \<^bold>\ w)" using assms by simp hence "Can ((u \<^bold>\ w)\<^bold>\)" using assms Can_red by blast thus ?thesis using assms Can.simps(4) Can_Inv(1) Dom_Inv Can_implies_Arr Can_red(1) red_simps(4) Nmlize.simps(3) Ide.simps(3) by presburger qed moreover have "Arr (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\ \<^bold>\ Inv (w\<^bold>\) \<^bold>\ v\<^bold>\)" using assms red_in_Hom Inv_in_Hom Ide_implies_Can by (simp add: Can_red(1)) moreover have "Dom (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\ \<^bold>\ Inv (w\<^bold>\) \<^bold>\ v\<^bold>\) = Dom (Inv ((u \<^bold>\ w)\<^bold>\) \<^bold>\ (t \<^bold>\ v)\<^bold>\)" using assms red_in_Hom Inv_in_Hom Ide_implies_Can by (metis (no_types, lifting) Nml_HcompD(3-4) Dom.simps(3-4) red.simps(3) red_Nml) moreover have "Cod (Inv (u\<^bold>\) \<^bold>\ t\<^bold>\ \<^bold>\ Inv (w\<^bold>\) \<^bold>\ v\<^bold>\) = Cod (Inv ((u \<^bold>\ w)\<^bold>\) \<^bold>\ (t \<^bold>\ v)\<^bold>\)" using assms red_in_Hom Inv_in_Hom Ide_implies_Can red_Nml by (simp add: Can_red(1) Cod_Ide) ultimately show ?thesis by simp qed show "\<^bold>\Inv (u\<^bold>\) \<^bold>\ t\<^bold>\ \<^bold>\ Inv (w\<^bold>\) \<^bold>\ v\<^bold>\\<^bold>\ = \<^bold>\Inv ((u \<^bold>\ w)\<^bold>\) \<^bold>\ (t \<^bold>\ v)\<^bold>\\<^bold>\" using assms Inv_in_Hom Ide_implies_Can Nmlize_Inv Ide_Nmlize_Can Can_red red2_Nml apply auto using VcompNml_HcompNml [of u w u w] apply (metis red_simps(4) Nml_HcompD(3-4) Nmlize_Nml red_simps(3) red_Nml) apply (metis Nml_HcompD(3-4) Nmlize.simps(3) Nmlize_Nml red_simps(3) Ide.simps(3) VcompNml_Nml_Dom red_Nml) apply (metis Can_red2(1) red_simps(4) Nml_HcompD(3-4) Nmlize.simps(3) Nmlize_Nml VcompNml_Cod_Nml red_Nml) using red2_Nml Nmlize_red2 Can_red2(1) Nmlize_Hcomp Dom_Ide Ide_implies_Arr VcompNml_Nml_Dom Nml_Nmlize(1) Nml_Nmlize(2) Nml_Nmlize(3) Nmlize.simps(3) by metis qed finally show "\Inv (u\<^bold>\) \<^bold>\ t\<^bold>\\ \ \Inv (w\<^bold>\) \<^bold>\ v\<^bold>\\ = \Inv ((u \<^bold>\ w)\<^bold>\) \<^bold>\ (t \<^bold>\ v)\<^bold>\\" by blast qed subsection "Introduction Rules" text \ To make the \can\ notation useful, we need a way to introduce it. This is a bit tedious, because in general there can multiple \can\ notations for the same isomorphism, and we have to use the right ones in the right contexts, otherwise we won't be able to compose them properly. Thankfully, we don't need the inverse versions of the theorems below, as they are easily provable from the non-inverse versions using \inv_can\. \ lemma canI_unitor_0: assumes "ide f" shows "\[f] = can \<^bold>\f\<^bold>\ (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\)" and "\[f] = can \<^bold>\f\<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0)" proof - have "can \<^bold>\f\<^bold>\ (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus 1: "\[f] = can \<^bold>\f\<^bold>\ (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\)" using assms by (simp add: \_ide_simp) have "can \<^bold>\f\<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus "\[f] = can \<^bold>\f\<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0)" using assms by (simp add: \_ide_simp) qed lemma canI_unitor_1: assumes "obj a" shows "\[a] = can \<^bold>\a\<^bold>\\<^sub>0 (\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0)" and "\[a] = can \<^bold>\a\<^bold>\\<^sub>0 (\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0)" proof - have "can \<^bold>\a\<^bold>\\<^sub>0 (\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0) = \\<^bold>\\<^bold>[\<^bold>\a\<^bold>\\<^sub>0\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus 1: "\[a] = can \<^bold>\a\<^bold>\\<^sub>0 (\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0)" using assms by (auto simp add: \_ide_simp) have "can \<^bold>\a\<^bold>\\<^sub>0 (\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0) = \\<^bold>\\<^bold>[\<^bold>\a\<^bold>\\<^sub>0\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus "\[a] = can \<^bold>\a\<^bold>\\<^sub>0 (\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0)" using assms by (auto simp add: \_ide_simp) qed lemma canI_associator_0: assumes "ide f" and "ide g" and "ide h" and "src f = trg g" and "src g = trg h" shows "\[f, g, h] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\)" proof - have "can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\) = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\g\<^bold>\, \<^bold>\h\<^bold>\\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus "\[f, g, h] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\)" using assms by (simp add: \_def) qed lemma canI_associator_1: assumes "ide f" and "ide g" and "src f = trg g" shows "\[trg f, f, g] = can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ \<^bold>\g\<^bold>\)" and "\[f, src f, g] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\g\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\g\<^bold>\)" and "\[f, g, src g] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\src g\<^bold>\\<^sub>0) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\src g\<^bold>\\<^sub>0)" proof - show "\[trg f, f, g] = can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ \<^bold>\g\<^bold>\)" proof - have "can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ \<^bold>\g\<^bold>\) = \\<^bold>\\<^bold>[\<^bold>\trg f\<^bold>\\<^sub>0, \<^bold>\f\<^bold>\, \<^bold>\g\<^bold>\\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus ?thesis using assms \_def by simp qed show "\[f, src f, g] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\g\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\g\<^bold>\)" proof - have "can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\g\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\g\<^bold>\) = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\src f\<^bold>\\<^sub>0, \<^bold>\g\<^bold>\\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus ?thesis using assms \_def by simp qed show "\[f, g, src g] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\src g\<^bold>\\<^sub>0) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\src g\<^bold>\\<^sub>0)" proof - have "can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\src g\<^bold>\\<^sub>0) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\src g\<^bold>\\<^sub>0) = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\g\<^bold>\, \<^bold>\src g\<^bold>\\<^sub>0\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus ?thesis using assms \_def by simp qed qed lemma canI_associator_2: assumes "ide f" shows "\[trg f, trg f, f] = can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\trg f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\f\<^bold>\)" and "\[trg f, f, src f] = can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0)" and "\[f, src f, src f] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0)" proof - show "\[trg f, trg f, f] = can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\trg f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\f\<^bold>\)" proof - have "can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\trg f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\f\<^bold>\) = \\<^bold>\\<^bold>[\<^bold>\trg f\<^bold>\\<^sub>0, \<^bold>\trg f\<^bold>\\<^sub>0, \<^bold>\f\<^bold>\\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus ?thesis using assms \_def by simp qed show "\[trg f, f, src f] = can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0)" proof - have "can (\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) ((\<^bold>\trg f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) = \\<^bold>\\<^bold>[\<^bold>\trg f\<^bold>\\<^sub>0, \<^bold>\f\<^bold>\, \<^bold>\src f\<^bold>\\<^sub>0\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus ?thesis using assms \_def by simp qed show "\[f, src f, src f] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0)" proof - have "can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\src f\<^bold>\\<^sub>0) = \\<^bold>\\<^bold>[\<^bold>\f\<^bold>\, \<^bold>\src f\<^bold>\\<^sub>0, \<^bold>\src f\<^bold>\\<^sub>0\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus ?thesis using assms \_def by simp qed qed lemma canI_associator_3: assumes "obj a" shows "\[a, a, a] = can (\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0) ((\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0)" proof - have "can (\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0) ((\<^bold>\a\<^bold>\\<^sub>0 \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0) \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0) = \\<^bold>\\<^bold>[\<^bold>\a\<^bold>\\<^sub>0, \<^bold>\a\<^bold>\\<^sub>0, \<^bold>\a\<^bold>\\<^sub>0\<^bold>]\" unfolding can_def using assms by (intro E.eval_eqI, simp_all) thus ?thesis using assms \_def by auto qed lemma canI_associator_hcomp: assumes "ide f" and "ide g" and "ide h" and "ide k" and "src f = trg g" and "src g = trg h" and "src h = trg k" shows "\[f \ g, h, k] = can ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\) (((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ \<^bold>\k\<^bold>\)" and "\[f, g \ h, k] = can (\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ \<^bold>\k\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\)) \<^bold>\ \<^bold>\k\<^bold>\)" and "\[f, g, h \ k] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\)" proof - show "\[f \ g, h, k] = can ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\) (((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ \<^bold>\k\<^bold>\)" proof - have "can ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\) (((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ \<^bold>\k\<^bold>\) = (((f \ g) \ h \ k) \ (\\<^sup>-\<^sup>1[f, g, h \ k] \ (f \ g \ h \ k)) \ (f \ g \ h \ k)) \ ((f \ g \ h \ k) \ (f \ (g \ h \ k) \ (g \ h \ k) \ \[g, h, k]) \ \[f, g \ h, k]) \ (((f \ g \ h) \ (f \ g \ h) \ \[f, g, h]) \ ((f \ g) \ h) \ k)" unfolding can_def using assms \_def \'_def \'.map_ide_simp by simp also have "... = \\<^sup>-\<^sup>1[f, g, h \ k] \ (f \ \[g, h, k]) \ \[f, g \ h, k] \ (\[f, g, h] \ k)" using assms comp_arr_dom comp_cod_arr comp_assoc by simp also have "... = \[f \ g, h, k]" using assms pentagon [of f g h k] invert_side_of_triangle(1) \_def \'.map_ide_simp assoc_simps(1,4-5) ideD(1) iso_assoc preserves_ide seqI by simp finally show ?thesis by simp qed show "\[f, g \ h, k] = can (\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ \<^bold>\k\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\)) \<^bold>\ \<^bold>\k\<^bold>\)" proof - have "can (\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\) \<^bold>\ \<^bold>\k\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ (\<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\)) \<^bold>\ \<^bold>\k\<^bold>\) = ((f \ ((g \ h) \ k) \ (\\<^sup>-\<^sup>1[g, h, k] \ (g \ h \ k)) \ (g \ h \ k)) \ (f \ g \ h \ k)) \ ((f \ g \ h \ k) \ (f \ (g \ h \ k) \ (g \ h \ k) \ \[g, h, k]) \ \[f, g \ h, k]) \ ((f \ g \ h) \ k)" unfolding can_def using assms \_def \'.map_ide_simp \'_def by simp also have "... = ((f \ \\<^sup>-\<^sup>1[g, h, k]) \ (f \ \[g, h, k])) \ \[f, g \ h, k]" using assms comp_arr_dom comp_cod_arr comp_assoc by simp also have "... = \[f, g \ h, k]" using assms comp_cod_arr whisker_left [of f "\\<^sup>-\<^sup>1[g, h, k]" "\[g, h, k]"] comp_assoc_assoc' by simp finally show ?thesis by simp qed show "\[f, g, h \ k] = can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\)" proof - have "can (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\ \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\) ((\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\g\<^bold>\) \<^bold>\ \<^bold>\h\<^bold>\ \<^bold>\ \<^bold>\k\<^bold>\) = (f \ g \ h \ k) \ ((f \ g \ h \ k) \ (f \ g \ h \ k) \ \[f, g, h \ k]) \ ((f \ g) \ h \ k)" unfolding can_def using assms \_def \'.map_ide_simp by simp also have "... = \[f, g, h \ k]" using assms comp_arr_dom comp_cod_arr by simp finally show ?thesis by simp qed qed subsection "Rules for Eliminating `can'" text \ The following rules are used for replacing \can\ in an expression by terms expressed using unit and associativity isomorphisms. They are not really expressed in the form of elimination rules, so the names are perhaps a bit misleading. They are typically applied as simplifications. \ lemma canE_unitor: assumes "Ide f" shows "can f (f \<^bold>\ Src f) = \[\f\]" and "can f (Trg f \<^bold>\ f) = \[\f\]" and "can (f \<^bold>\ Src f) f = \\<^sup>-\<^sup>1[\f\]" and "can (Trg f \<^bold>\ f) f = \\<^sup>-\<^sup>1[\f\]" proof - show 1: "can f (f \<^bold>\ Src f) = \[\f\]" proof - have f: "\Nml (f \<^bold>\ Src f)" using assms Nml_HcompD(5) is_Prim0_Src by blast have "can f (f \<^bold>\ Src f) = \Inv (f\<^bold>\) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\) \<^bold>\ (f\<^bold>\ \<^bold>\ Src f\<^bold>\)\" using assms f can_def by simp also have "... = \\<^bold>\\<^bold>[f\<^bold>]\" proof (intro E.eval_eqI) show "VPar (Inv (f\<^bold>\) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\) \<^bold>\ (f\<^bold>\ \<^bold>\ Src f\<^bold>\)) \<^bold>\\<^bold>[f\<^bold>]" using assms Nmlize_in_Hom red_in_Hom red2_in_Hom Inv_in_Hom Can_red Can_implies_Arr Nml_Nmlize(1) Ide_implies_Can Nml_Src Nml_implies_Arr HcompNml_Nml_Src Ide_Cod Obj_implies_Ide apply (simp add: Dom_Ide Cod_Ide) apply (intro conjI) proof - assume f: "Ide f" have 1: "Nml (Src f)" proof - have "Ide (Src f)" using f Obj_implies_Ide by simp thus ?thesis using f Obj_Src Nml_Nmlize(1) Nmlize_Src(2) Ide_implies_Arr by metis qed show "Arr (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\)" using f 1 Can_red2 Ide_Nmlize_Ide Nml_Nmlize Obj_implies_Ide by simp show "Dom (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\) = \<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\" using f 1 Nml_Nmlize red2_in_Hom Ide_Nmlize_Ide Obj_implies_Ide by auto show "\<^bold>\f\<^bold>\ = Cod (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\)" proof - have "Src \<^bold>\f\<^bold>\ = Trg \<^bold>\Src f\<^bold>\" using f Nml_Nmlize Obj_implies_Ide by simp moreover have "\<^bold>\\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\\<^bold>\ = \<^bold>\f\<^bold>\" using f 1 Nml_Nmlize Nmlize_Src HcompNml_Nml_Src Nml_Src by (auto simp add: HcompNml_Nml_Obj) thus ?thesis using f 1 Obj_Src red2_in_Hom [of "\<^bold>\f\<^bold>\" "\<^bold>\Src f\<^bold>\"] HcompNml_Nml_Src Nml_Nmlize Ide_Nmlize_Ide Obj_implies_Ide by auto qed qed show "\<^bold>\Inv (f\<^bold>\) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\) \<^bold>\ (f\<^bold>\ \<^bold>\ Src f\<^bold>\)\<^bold>\ = \<^bold>\\<^bold>\\<^bold>[f\<^bold>]\<^bold>\" using assms f HcompNml_Nml_Src Nml_Nmlize Can_red Nmlize_Hcomp Nmlize_Inv Nmlize_Src(1) Nmlize_red Nmlize_red2 Ide_Nmlize_Can VcompNml_Nml_Ide red_Src apply (simp add: HcompNml_Nml_Obj) proof - assume f: "Ide f" have "\<^bold>\\<^bold>\f\<^bold>\ \<^bold>\ Src f\<^bold>\ = \<^bold>\f\<^bold>\" proof - have "Obj (Src f)" using f Obj_Src by simp thus ?thesis using f apply (cases "Src f") by (simp_all add: Nml_Nmlize(1) Nml_Nmlize(2) Ide_Nmlize_Ide) qed thus "\<^bold>\f\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\\<^bold>\f\<^bold>\ \<^bold>\ Src f\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\f\<^bold>\ = \<^bold>\f\<^bold>\" by (metis Cod_Inv Can_red(1) Cod.simps(4) Nmlize.simps(4) Nmlize.simps(7) Nmlize_Vcomp_Cod_Arr red_simps(3) \VPar (Inv (f\<^bold>\) \<^bold>\ (\<^bold>\f\<^bold>\ \<^bold>\ \<^bold>\Src f\<^bold>\) \<^bold>\ (f\<^bold>\ \<^bold>\ Src f\<^bold>\)) \<^bold>\\<^bold>[f\<^bold>]\ f) qed qed also have "... = \[\f\]" using assms E.eval_Runit_Ide by blast finally show ?thesis by simp qed show 2: "can f (Trg f \<^bold>\ f) = \[\f\]" proof - have f: "\Nml (Trg f \<^bold>\ f)" using assms by (metis Nml.simps(4) Nml_HcompD(6)) have "can f (Trg f \<^bold>\ f) = \Inv (f\<^bold>\) \<^bold>\ (\<^bold>\Trg f\<^bold>\ \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ (Trg f\<^bold>\ \<^bold>\ f\<^bold>\)\" using assms f can_def by simp also have "... = \\<^bold>\\<^bold>[f\<^bold>]\" proof (intro E.eval_eqI) show "VPar (Inv (f\<^bold>\) \<^bold>\ (\<^bold>\Trg f\<^bold>\ \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ (Trg f\<^bold>\ \<^bold>\ f\<^bold>\)) \<^bold>\\<^bold>[f\<^bold>]" using assms Nmlize_in_Hom red_in_Hom red2_in_Hom Inv_in_Hom Can_red Can_implies_Arr Nml_Nmlize(1) Ide_implies_Can Nml_Trg Nml_implies_Arr HcompNml_Trg_Nml Ide_Cod Nmlize_Trg(1) Obj_implies_Ide apply (simp add: Dom_Ide Cod_Ide) apply (intro conjI) proof - assume f: "Ide f" have 1: "Nml (Trg f)" proof - have "Ide (Trg f)" using f Obj_implies_Ide by simp thus ?thesis using f Obj_Trg Nml_Nmlize(1) Nmlize_Trg(2) Ide_implies_Arr by metis qed show "Arr (Trg f \<^bold>\ \<^bold>\f\<^bold>\)" using f 1 Can_red2 Ide_Nmlize_Ide Nml_Nmlize(1,3) Obj_implies_Ide by simp show "Dom (Trg f \<^bold>\ \<^bold>\f\<^bold>\) = Trg f \<^bold>\ \<^bold>\f\<^bold>\" using f Obj_Trg 1 Nml_Nmlize(1,3) red2_in_Hom Ide_Nmlize_Ide Obj_implies_Ide by auto show "\<^bold>\f\<^bold>\ = Cod (Trg f \<^bold>\ \<^bold>\f\<^bold>\)" proof - have "Src (Trg f) = Trg \<^bold>\f\<^bold>\" using f Nml_Nmlize(3) by simp thus ?thesis using f 1 Obj_Trg HcompNml_Trg_Nml Nml_Nmlize(1) Ide_Nmlize_Ide Obj_implies_Ide by auto qed qed show "\<^bold>\Inv (f\<^bold>\) \<^bold>\ (\<^bold>\Trg f\<^bold>\ \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ (Trg f\<^bold>\ \<^bold>\ f\<^bold>\)\<^bold>\ = \<^bold>\\<^bold>\\<^bold>[f\<^bold>]\<^bold>\" using assms f HcompNml_Nml_Src Nml_Nmlize Can_red Nmlize_Hcomp Nmlize_Inv Nmlize_Trg(1) Nmlize_red Nmlize_red2 Ide_Nmlize_Can VcompNml_Nml_Ide red_Trg apply (simp add: HcompNml_Obj_Nml) proof - assume f: "Ide f" have "\<^bold>\Trg f \<^bold>\ \<^bold>\f\<^bold>\\<^bold>\ = \<^bold>\f\<^bold>\" proof - have "Obj (Trg f)" using f Obj_Trg by simp thus ?thesis using f apply (cases "Trg f") by (simp_all add: Nml_Nmlize(1) Nml_Nmlize(2) Ide_Nmlize_Ide) qed thus "\<^bold>\f\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\Trg f \<^bold>\ \<^bold>\f\<^bold>\\<^bold>\ \<^bold>\\<^bold>\\<^bold>\ \<^bold>\f\<^bold>\ = \<^bold>\f\<^bold>\" by (metis Cod_Inv Can_red(1) Cod.simps(4) Nmlize.simps(4) Nmlize.simps(5) Nmlize_Vcomp_Cod_Arr red_simps(3) \VPar (Inv (f\<^bold>\) \<^bold>\ (\<^bold>\Trg f\<^bold>\ \<^bold>\ \<^bold>\f\<^bold>\) \<^bold>\ (Trg f\<^bold>\ \<^bold>\ f\<^bold>\)) \<^bold>\\<^bold>[f\<^bold>]\ f) qed qed also have "... = \[\f\]" using assms E.eval_Lunit_Ide by blast finally show ?thesis by simp qed show "can (f \<^bold>\ Src f) f = \\<^sup>-\<^sup>1[\f\]" using assms 1 inv_can inv_inv by (metis (no_types, lifting) Nml_Nmlize(1) Nmlize.simps(3) Nmlize_Src(1) HcompNml_Nml_Src Ide.simps(3) Ide_implies_Arr Obj_Src Obj_implies_Ide Trg_Src) show "can (Trg f \<^bold>\ f) f = \\<^sup>-\<^sup>1[\f\]" using assms 2 inv_can inv_inv by (metis (no_types, lifting) Nml_Nmlize(1) Nmlize.simps(3) Nmlize_Trg(1) HcompNml_Trg_Nml Ide.simps(3) Ide_implies_Arr Obj_Trg Obj_implies_Ide Src_Trg) qed lemma canE_associator: assumes "Ide f" and "Ide g" and "Ide h" and "Src f = Trg g" and "Src g = Trg h" shows "can (f \<^bold>\ g \<^bold>\ h) ((f \<^bold>\ g) \<^bold>\ h) = \[\f\, \g\, \h\]" and "can ((f \<^bold>\ g) \<^bold>\ h) (f \<^bold>\ g \<^bold>\ h) = \\<^sup>-\<^sup>1[\f\, \g\, \h\]" proof - show "can (f \<^bold>\ g \<^bold>\ h) ((f \<^bold>\ g) \<^bold>\ h) = \[\f\, \g\, \h\]" proof - have "can (f \<^bold>\ g \<^bold>\ h) ((f \<^bold>\ g) \<^bold>\ h) = \Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\\" using can_def by simp also have "... = \\<^bold>\\<^bold>[f, g, h\<^bold>]\" proof (intro E.eval_eqI) have 1: "Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\ \ VHom ((f \<^bold>\ g) \<^bold>\ h) (f \<^bold>\ g \<^bold>\ h)" using assms Inv_in_Hom [of "(f \<^bold>\ g \<^bold>\ h)\<^bold>\"] Can_red [of "f \<^bold>\ g \<^bold>\ h"] red_in_Hom [of "f \<^bold>\ g \<^bold>\ h"] red_in_Hom [of "(f \<^bold>\ g) \<^bold>\ h"] Nmlize_Hcomp_Hcomp Nmlize_Hcomp_Hcomp' Ide_implies_Arr Nml_HcompNml Nmlize_Nml Ide_HcompNml by auto show par: "VPar (Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\\<^bold>[f, g, h\<^bold>]" using assms 1 Inv_in_Hom red_in_Hom Ide_in_Hom by simp show "\<^bold>\Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\\<^bold>\ = \<^bold>\\<^bold>\\<^bold>[f, g, h\<^bold>]\<^bold>\" proof - have "\<^bold>\Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\\<^bold>\ = Dom \<^bold>\Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\\<^bold>\" proof - have "Can (Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\)" (* Here presburger depends on par being at the end, not after assms. *) using assms Nmlize_Inv Can_Inv Arr.simps(10) Arr.simps(4) Can.simps(4) Can_red(1) Ide.simps(3) Src.simps(3) Trg.simps(3) par by presburger hence "Ide \<^bold>\Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\\<^bold>\" using Ide_Nmlize_Can by blast thus ?thesis using Ide_in_Hom Dom_Ide by presburger qed also have 6: "... = \<^bold>\(f \<^bold>\ g) \<^bold>\ h\<^bold>\" using 1 Nmlize_Dom [of "Inv ((f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\ ((f \<^bold>\ g) \<^bold>\ h)\<^bold>\"] by (metis (mono_tags, lifting) mem_Collect_eq) also have 5: "... = Dom \<^bold>\\<^bold>\\<^bold>[f, g, h\<^bold>]\<^bold>\" using assms 6 par Nmlize_Dom Nml_Nmlize(4) by metis also have "... = \<^bold>\\<^bold>\\<^bold>[f, g, h\<^bold>]\<^bold>\" using assms 5 Ide_in_Hom by auto finally show ?thesis by simp qed qed also have "... = \[\f\, \g\, \h\]" using assms E.eval_Assoc_Ide \_def by fastforce finally show ?thesis by simp qed show "can ((f \<^bold>\ g) \<^bold>\ h) (f \<^bold>\ g \<^bold>\ h) = \\<^sup>-\<^sup>1[\f\, \g\, \h\]" proof - have "can ((f \<^bold>\ g) \<^bold>\ h) (f \<^bold>\ g \<^bold>\ h) = \Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\\" using can_def by simp also have "... = \\<^bold>\\<^sup>-\<^sup>1\<^bold>[f, g, h\<^bold>]\" proof (intro E.eval_eqI) have 1: "Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\ \ VHom (f \<^bold>\ g \<^bold>\ h) ((f \<^bold>\ g) \<^bold>\ h)" using assms Inv_in_Hom [of "((f \<^bold>\ g) \<^bold>\ h)\<^bold>\"] Can_red [of "(f \<^bold>\ g) \<^bold>\ h"] red_in_Hom [of "(f \<^bold>\ g) \<^bold>\ h"] red_in_Hom [of "f \<^bold>\ g \<^bold>\ h"] Nmlize_Hcomp_Hcomp Nmlize_Hcomp_Hcomp' Ide_implies_Arr Nml_HcompNml Nmlize_Nml Ide_HcompNml by auto show par: "VPar (Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\) \<^bold>\\<^sup>-\<^sup>1\<^bold>[f, g, h\<^bold>]" using assms 1 Inv_in_Hom red_in_Hom Ide_in_Hom by simp show "\<^bold>\Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\\<^bold>\ = \<^bold>\\<^bold>\\<^sup>-\<^sup>1\<^bold>[f, g, h\<^bold>]\<^bold>\" proof - have "\<^bold>\Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\\<^bold>\ = Dom \<^bold>\Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\\<^bold>\" proof - have "Can (Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\)" using assms Nmlize_Inv Can_Inv Arr.simps(10) Arr.simps(4) Can.simps(4) Can_red(1) Ide.simps(3) Src.simps(3) Trg.simps(3) par by presburger hence "Ide \<^bold>\Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\\<^bold>\" using Ide_Nmlize_Can by blast thus ?thesis using Ide_in_Hom Dom_Ide by presburger qed also have 6: "... = \<^bold>\f \<^bold>\ g \<^bold>\ h\<^bold>\" using 1 Nmlize_Dom [of "Inv (((f \<^bold>\ g) \<^bold>\ h)\<^bold>\) \<^bold>\ (f \<^bold>\ g \<^bold>\ h)\<^bold>\"] by (metis (mono_tags, lifting) mem_Collect_eq) also have 5: "... = Dom \<^bold>\\<^bold>\\<^sup>-\<^sup>1\<^bold>[f, g, h\<^bold>]\<^bold>\" using assms 6 par Nmlize_Dom Nml_Nmlize(4) by metis also have "... = \<^bold>\\<^bold>\\<^sup>-\<^sup>1\<^bold>[f, g, h\<^bold>]\<^bold>\" using assms 5 Ide_in_Hom by auto finally show ?thesis by simp qed qed also have "... = \\<^sup>-\<^sup>1[\f\, \g\, \h\]" using assms E.eval_Assoc'_Ide by fastforce finally show ?thesis by simp qed qed lemma can_Ide_self: assumes "Ide t" shows "can t t = \t\" proof (unfold can_def) show "\Inv (t\<^bold>\) \<^bold>\ t\<^bold>\\ = \t\" proof (intro E.eval_eqI) show "VPar (Inv (t\<^bold>\) \<^bold>\ t\<^bold>\) t" using assms red_in_Hom Inv_in_Hom Ide_implies_Can Can_Inv Can_red(1) Ide_in_Hom(2) by auto show "\<^bold>\Inv (t\<^bold>\) \<^bold>\ t\<^bold>\\<^bold>\ = \<^bold>\t\<^bold>\" using assms red_in_Hom Inv_in_Hom Ide_implies_Can Cod_Inv by (metis (mono_tags, lifting) Can_red(1) Nml_Nmlize(1) Nmlize.simps(4) Nmlize_Inv Ide_Nmlize_Ide Nmlize_red Inv_Ide VcompNml_Ide_Nml \VPar (Inv (t\<^bold>\) \<^bold>\ t\<^bold>\) t\) qed qed subsection "Rules for Whiskering" lemma whisker_can_right_0: assumes "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" and "ide f" and "Src t = \<^bold>\trg f\<^bold>\\<^sub>0" shows "can u t \ f = can (u \<^bold>\ \<^bold>\f\<^bold>\) (t \<^bold>\ \<^bold>\f\<^bold>\)" proof - have "f = can \<^bold>\f\<^bold>\ \<^bold>\f\<^bold>\" using assms can_Ide_self by simp thus ?thesis using assms Ide_implies_Arr hcomp_can by (metis Nml_Nmlize(2) Ide.simps(2) Trg.simps(2)) qed lemma whisker_can_right_1: assumes "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" and "obj a" and "Src t = \<^bold>\a\<^bold>\\<^sub>0" shows "can u t \ a = can (u \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0) (t \<^bold>\ \<^bold>\a\<^bold>\\<^sub>0)" proof - have "a = can \<^bold>\a\<^bold>\\<^sub>0 \<^bold>\a\<^bold>\\<^sub>0" using assms can_Ide_self by auto thus ?thesis using assms Ide_implies_Arr hcomp_can by (metis Nml_Nmlize(2) Ide.simps(1) Trg.simps(1)) qed lemma whisker_can_left_0: assumes "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" and "ide g" and "Trg t = \<^bold>\src g\<^bold>\\<^sub>0" shows "g \ can u t = can (\<^bold>\g\<^bold>\ \<^bold>\ u) (\<^bold>\g\<^bold>\ \<^bold>\ t)" proof - have "g = can \<^bold>\g\<^bold>\ \<^bold>\g\<^bold>\" using assms can_Ide_self by simp thus ?thesis using assms Ide_implies_Arr hcomp_can by (metis Nml_Nmlize(3) Ide.simps(2) Src.simps(2)) qed lemma whisker_can_left_1: assumes "Ide t" and "Ide u" and "\<^bold>\t\<^bold>\ = \<^bold>\u\<^bold>\" and "obj b" and "Trg t = \<^bold>\b\<^bold>\\<^sub>0" shows "b \ can u t = can (\<^bold>\b\<^bold>\\<^sub>0 \<^bold>\ u) (\<^bold>\b\<^bold>\\<^sub>0 \<^bold>\ t)" proof - have "b = can \<^bold>\b\<^bold>\\<^sub>0 \<^bold>\b\<^bold>\\<^sub>0" using assms can_Ide_self by auto thus ?thesis using assms Ide_implies_Arr hcomp_can by (metis Nml_Nmlize(3) Ide.simps(1) Src.simps(1)) qed end end