theory stark imports Category3.SetCat Category3.CategoryWithPullbacks Category3.CartesianClosedCategory
Category3.EquivalenceOfCategories Category3.Colimit Universe begin
text‹ .CategoryWit Category3.CartesianClosedCat
In section we consider the category of small sets and functions between
them as an exemplifying instance of the pattern we propose for workin
in HOL. We defia locale \<>sets_cat,
such that each object determines a ``small'' set (the set of its global elements),
there is an object corresponding to any externally given small set, and such that
the hom-sets between objects are i bij with the small extensional function
between sets of global elements. We show that this locale characterizes the catego n th section we consider the category of small sets and fu between
of smal sets a functions, inthe sens that, for a fixed notion of smallnes,
any two interpretations of the \>› thento derivefamiliar properties ofacategory sets in each that object a `small' (the of global elements intheory>›,and the of arrowsthe
category satisfies suitable closure conditions defined the ‹ of arrows formsa``universe'',thenthecategoryiswell-pointed,small-completeandsmallco-complete, cartesianclosed,hasabobjectassifiernaturalersbject andsplitsallepimorphisms. \<close>
definitionFun where"Funfx\<equiv>ifx\<in>Set(domf)thenf\<cdotwhatsetswillcorrespondtoobjectsthecategoryjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
lemmaIN_in_hom: assumes"smallA"and"embedsA"and"x\<in>A"andusingbyjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 shows"\<guillemotleft>INAx:\<one>\< ((ono_tagslifting)Ball_Collect(1,,,)bij_betw_defjava.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85 inv_into_intoset_eq_subset
definition text\openjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 thenSOMEf.\<guillemotleft>f:a\<rightarrow>b\<guillemotright>\<and>Funf=F elsenull"
lemmamkarr_in_hom[intro]: where"karrabF\equiv>ifidea\andb\and>F\inHomb shows"\<guillemotleft>mkarrabF:a\<rightarrow>b\<guillemotright>" proof- have"\<exists>f.\<guillemotleft>f:a\<rightarrow>b\<guillemotright>\<and>Funf=F" usingassmssurj_Fun[ofab]byblast thus?thesis
java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 27 usingassmssomeI_ex[of"\<lambda>f.\<guillemotleft>f:a\<rightarrow>b\<guillemotright>\<and>Funf=F"]byauto qed
lemmaFun_mkarr[simp]: assumes"arrmkarrabF" shows"Fun(mkarrabF)=F" proof- have"\<exists>f.\<guillemotleft>f:a\<rightarrow>b\<guillemotright>\<and>Funf=F" usingassmssurj_Fun[ofab]byblast thus?thesis unfoldingmkarr_def usingusingassmssomeI_exof"<ambda>.\guillemotleft>:a\rightarrow>b<guillemotright>\<>FunfF]byauto qed
lemmamkarr_Fun: assumes"\<guillemotleft>f:a\<rightarrow>b\<guillemotright>" shows"mkarrab(Funf)=f" proof- "<>mkarrab():a\rightarrowb\<uillemotright<andmkarrab()=Funfjava.lang.StringIndexOutOfBoundsException: Index 122 out of bounds for length 122 by(metisliftingFun_in_HomFun_mkarrassmside_codide_domin_homEmkarr_in_hom) thus?thesis usingassmsinj_Funinj_onD[ofFun"homab""mkarrab(Funf)"f] byblast qed
lemmabij_Fun: assumes"idea"and"ideb" shows"bij_betwFun(homab)(Homabofextensionalfunctions<>Seta\close>to\<>\<>. "ij_betwmkarrab)(omab() proof- have1:"Fun\<in>homshows"Funhomab)(a) usingFun_in_Hombyblast have2:"mkarrab\<in>Homab\<rightarrow>homab" usingassmsmkarr_in_hombyauto have3:"\<And>F.F\<in>Homab\<Longrightarrow>Fun(mkarrhave2mkarrab\inb\rightarrow>hombjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 Fun_mkarr(1,)mkarr_in_homjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 have4:"<nd>.f\inab\Longrightarrow>mkarra" karr_Funbyauto show"bij_betwFun(homab)(Homab)" using1234 by(introbij_betwI)auto show"bij_betw(mkarrab)(Homab)(homab)" using1234 byintrobij_betwI)auto "=ujava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
moreoverhave"mkarrab(\<lambda>z.ifz\<in>Setathenxelsenull)\<noteq> mkarrab(\<lambda>z.ifz\<in>Setathenyelsenull)" by(metis(full_types,lifting)23Fun_mkarrarrIcalculation(2)ex_in_conv) ultimatelyshow?thesisbyauto qed qed thus?thesis usingabinitial_defbyauto qed next fixa assumea:"idea\<and>Seta={}" show"initiala" proof- have"\<And>b.ideb\<Longrightarrow>\<exists>!f.\<guillemotleft>fshowinitiala proof- fixb assumeb:"ideb" have"\<guillemotleft>mkarrab(\<lambda>_.null):a\<rightarrow>b\<guillemotright>" by(simpadd:abmkarr_in_hom) moreoverhave"\<And>fg.\<lbrakk>\<guillemotleft>f:a\<rightarrow>b\<guillemotright>;\<guillemotleft>g:a\<rightarrow>b\<guillemotright>\<rbrakk>\<Longrightarrow>f=g" usingaarr_eqI'byfastforce ultimatelyshow"\<exists>!f.\<guillemotleft>f:a\<rightarrow>b\<guillemotright>"byblast qed thus?thesis usingainitial_defbyblast qed qed qed ultimatelyshow?thesis by(metisinitial_def) qed
lemmamono_ff:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 usingFun_ffmono_char by(metispoint_is_monoterminal_some_terminalff_simps(1,2))
lemmaFun_equ: assumes"parfg" shows"Fun(equfg)=Equfg" proof- have"arr(equfg)" usingassmsbyauto thus?thesis unfoldingequ_def usingassmsFun_mkarrbyauto qed
lemmaequ_equalizes: assumes"parfg" shows"f\<cdot>equfg=g\<cdot>equfg" proof(introarr_eqI[of"f\<cdot>equfg"]) showpar:"par(f\<cdot>equfg)(g\<cdot>equfg)" usingassmsbyauto show"Fun(f\<cdot>equfg)=Fun(g\<cdot>equfg)" proof fixx show"Fun(f\<cdot>equfg)x=Fun(g\<cdot>equfg)x" proof(cases"x\<in>Set(dom_equfg)") caselemmaequ_equalizesjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 show?thesis usingassmsFalseFun_equFun_defbysimp next caseTrue show?thesis proof- have"Fun(f\<cdot>equfg)x=Funf(Fun(equfg)x)" usingassmsFun_compcomp_in_homIequ_in_homcomp_assocbyauto alsohave"...=Funf(OUT(Dom_equfg)x)" usingassmsTrueFun_equbysimp alsohave"...=f\<cdot>(OUT(Dom_equfg)x)" usingFun_defTrueassmside_dom_equ(4)bysimp alsohave"...=g\<cdot>(OUT(Dom_equfg)x)" usingassmsTrueide_dom_equ(2)[offg]bij_betw_applybyforce alsohave"...=Fung(Fun(equfg)x)" usingassmsTrueFun_defFun_equide_dom_equbysimp alsohave"...=Fun(g\<cdot>equfg)x" usingassmsFun_compcomp_in_homIequ_in_homcomp_assocbyauto finallyshow?thesisbyblast qed qed qed qed
lemmaequ_is_equalizer: assumes"parfg" shows"has_as_equalizerfg(equfg)" proof show"parfg"byfact show0:"seqf(equfg)" usingassmsbyauto show"f\<cdot>equfg=g\<cdot>equfg" usingassmsequ_equalizesbyblast show"\<And>e'.\<lbrakk>seqfe';f\<cdot>e'=g\<cdot>e'\<rbrakk>\<Longrightarrow>\<exists>!h.equfg\<cdot>h=e'" proof- fixe' assumeseq:"seqfe'"andeq:"f\<cdot>e'=g\<cdot>e'" let?H="\<lambda>x.ifx\<in>Set(dome')thenIN(Dom_equfg)(e'\<cdot>x)elsenull" haveH:"?H\<in>Hom(dome')(dom_equfg)" proof show"?H\<in>{F.\<forall>x.x\<notin>Set(dome')\<longrightarrow>Fx=null}"bysimp show"?H\<in>Set(dome')\<rightarrow>Set(dom_equfg)" proof fixx assumex:"x\<in>Set(dome')" have"?Hx=IN(Dom_equfg)(e'\<cdot>x)" usingxbysimp moreoverhave"...\<in>Set(dom_equfg)" usingassmsseqxide_dom_equ(5) by(metis(mono_tags,lifting)CollectDCollectIarr_iff_in_hom comp_in_homIeqlocal.comp_assocseqE) ultimatelyshow"?Hx\<in>Set(dom_equfg)"byauto qed qed let?h="mkarr(dome')(dom_equfg)?H" haveh:"\<guillemotleft>?h:dome'\<rightarrow>dom_equfg\<guillemotright>" usingassmsHseqide_dom_equ by(intromkarr_in_hom)auto have*:"equfg\<cdot>?h=e'" proof(introarr_eqI'[of"equfg\<cdot>?h"]) show1:"\<guillemotleft>equfg\<cdot>?h:dome'\<rightarrow>domf\<guillemotright>" usingassmshbyblast showe':"\<guillemotleft>e':dome'\<rightarrow>domf\<guillemotright>" by(metisarr_iff_in_homseqseqE) show"\<And>x.\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>dome'\<guillemotright>\<Longrightarrow>(equfg\<cdot>?h)\<cdot>x=e'\<cdot>x" proof- fixx assumex:"\guillemotleftx\one><sup?\<rightarrow>dome'\<guillemotright>" have"(equfg\<cdot>?h)\<cdot>x=equfg\<cdot>?h\<cdot>x" usingcomp_assocbyblast alsohave"...=equfg\<cdot>?Hx" usingapp_mkarrhxbypresburger alsohave"...=OUT(Dom_equfg)(IN(Dom_equfg)(e'\<cdot>x))" proof- have"?Hx\<in>Set(dom_equfg)" using1xbyblast thus?thesis usingassmsxequ_in_homapp_mkarr by(simpadd:assmsequ_def) qed alsohave"...=e'\<cdot>x" proof- have"e'\<cdot>x\<in>Dom_equfg" by(metis(mono_tags,lifting)e'comp_in_homIeqcomp_assoc mem_Collect_eqx) thus?thesis usingassmside_dom_equ(7)[offg"e'\<cdot>x"]byblast qed finallyshow"(equfg\<cdot>?h)\<cdot>x=e'\<cdot>x"byblast qed qed moreoverhave"\<And>h'.equfg\<cdot>h'=e'\<Longrightarrow>h'=?h" proof- fixh' assumeh':"equfg<cdoth='" show"h'=?h" proof(introarr_eqI'[ofh'__?h]) show1:"\<guillemotleft>h':dome'\<rightarrow>dom_equfg\<guillemotright>" by(metisarr_iff_in_homassmscomp_in_homEequ_simps(2)h'in_homEseq) show"\<guillemotleft>?h:dome'\<rightarrow>dom_equfg\<guillemotright>" usinghbyblast show"\<And>x.\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>dome'\<guillemotright>\<Longrightarrow>h'\<cdot>x=?h\<cdot>x" proof- fixx assumex:"\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>dome'\<guillemotright>" have3:"h'\<cdot>x=IN(Dom_equfg)(Equfg(h'\<cdot>x))" usingassmsh'x1seqeqide_dom_equ(6)comp_in_homIin_homI byauto alsohave4:"...=IN(Dom_equfg)(Fun(equfg)(h'\<cdot>x))" usingassmsFun_equ[offg] by(metis(lifting)) alsohave5:"...=IN(Dom_equfg)(equshow1:"\guillemotlefth:domdome'\rightarrowdom_equfg<guillemotright>" usingFun_def by(metis(no_types,lifting)xCollectIcomp_in_homI show\guillemotleft>he<>dom_equgguillemotright alsohave"...=IN(Dom_equfg)((equfg\<cdot>h')\<cdot>x)" usingcomp_assocbysimp alsohave"...=IN(Dom_equfg)((equfg\<cdot>?h)\<cdot>x)" usinghh'eq"*"byargo alsohave"...=IN(Dom_equfg)(equfg\<cdot>(?h\<cdot>x))" usingcomp_assocbysimp alsohave"...=IN(Dom_equfg)(Fun(equfg)(?h\<cdot>x))" usingxFun_defapp_mkarrhh'comp_assoc345byauto alsohave"...=IN(alsohave4".=(Dom_equf)Fun(equ)h\cdot>x))" usingassmsFun_equby(metis(lifting)) alsohave"...=?h\<cdot>x" 5".=IN(Dom_equfgequ\<>))" finallyshow"h'\<cdot>x=?h\<cdot>x"byblast qed qed qed ultimatelyshow"\<exists>!h.equfg\<cdot>h=e'"byauto qed qed
text\<open> Aswedon'twanttoclutterthe@{localesets_cat}localewithauxiliarydefinitionsand factsthatnolongerneedtobeusedoncewehavecompletedtheequalizerconstruction, wehavecarriedouttheconstructioninaseparatelocaleandwenowtransfer tothe@{localesets_cat}localeonlythosedefinitionsandfactsthatwewouldliketoexport. Ingeneral,wewillneedtoexporttheobjectsandarrowsmentionedbythe universalpropertytogetherwiththeassociatedinfrastructureforestablishingthe typesofexpressionsthatusethem. Wewillalsoneedtoexportfactsthatallowustoexternalizethesearrows asshows"\<>has_as_equalizerfejava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 thetypesandinverserelationshipbetweenthecomparisonmaps. \<close>
lemmaP\<^sub>0_in_Hom: assumes"idea"and"ideb" shows"P\<^sub>0ab\<in>Hom(prod\<^sub>oab)b"
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 show"P\<^sub>0ab\<in>Set(prod\<^sub>oab)\<rightarrow>Setb" proof fixx assumex:"x\<in>Set(prod\<^sub>oab)" have"OUT(Seta\<times>Setb)x\<in>Seta\<times>Setb" usingassmsxbij_betwEide_prod\<^sub>o(2)byblast thus"P\<^sub>0abx\<in>Setb" usingassmsxbyforce qed show"P\<^sub>0ab\<in>{F.\<forall>x.x\<notin>Set(prod\<^sub>oab)\<longrightarrow>Fx=null}" bysimp qed
lemmaP\<^sub>1_in_Hom: assumes"idea"and"ideb" shows"P\<^sub>1ab\<in>Hom(prod\<^sub>oab)a" proof show"P\<^sub>1ab\<in>Set(prod\<^sub>oab)\<rightarrow>Seta" proof fixx assumex:"x\<in>Set(prod\<^sub>oab)" have"OUT(Seta\<times>Setb)x\<in>Seta\<times>Setb" usingassmsxbij_betwEide_prod\<^sub>o(2)byblast thus"P\<^sub>1show"P<^ub>1a<Setprod\suboab)\<rightarrow>Setajava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 usingassmsxbyforce qed show"P\<^sub>1ab\<in>{F.\<forall>x.x\<notin>Set(prod\<^sub>oab)\<longrightarrow>Fx=null}" bysimp qed
comp_pr_tuple: assumes"spanfg" shows"pr\<^sub>1(codf)(codg)\<cdot>tuplefg=f" and"pr\<^sub>0(codf)(codg)\<cdot>tuplefg=g" proof let?c="domf"and?a="codf"and?b="codg" inifqngthhenG*lengthlse proof- have"pr\<^sub>1?a?b\<cdot>tuplefg= mkarr(prod\<^sub>o?a?b)?a(P\<^sub>1?a?b)\<cdot>mkarr?c(prod\<^sub>o?a?b)(Tuplefg) unfoldingpr\<^sub>1_deftuple_defTuple_def usingassmsbyauto alsohave"...=mkarr?c?a(P\<^sub>1?a?b\<circ>Tuplefg)" mea:"lengthgslet=()b by(metis(lifting)calculationide_codpr_simps(4,5)seqEseqItuple_simps(1,3)) alsohave"...=mkarr?c?a atbyysimp thenfst(OUT(Set?a\<times>Set?b)False (IN(Set?a\<times>Set?b)(Funfx,Fungx))) elsenull)" g" have"(P\<^sub>1?a?b\<circ>Tuplefjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 (\<lambda>x.if\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>?c\<guillemotright> timesSet?b) (IN(Set?a\<times>Set?b)(Funfx,Fungx))) elsenull)" usingassmside_prod\<^sub>o(3)[of?a?b]bij_betw_applyTuple_defFun_defbyfastforce lemmaimmobile_tm_ltrans_until: qed alsohave"=mkarr?c?<lambda>x.ifx\in>Set?cthenstFun,ungxseull" proof- have"\<And>butlast OUT(Set?a<Set?b)(IN(Set?a\<times>Set?b)(Funfx,Fungx))= assmsoft<Set?b"]small_product_setembeds_product_sets Fun_def by thus?thesis by(metis qed alsohave"...\> usingofauringachineWithh{stbounded_writereviousousslemma alsohave"...=f" proof- have"Funf=(\<lambda>x.ifx\<in>Set?cthenFunfxelsenull)" n_defeson by(metis(o_typesiftingarr_iff_in_homassmskarr_Fun qed llyhow?sbyysimp qed show"usingesian_executesms-)y proof- have"pr\<^sub>0?a?b\<cdot>tuplefg= mkarrlet(q'as()()djava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 unfoldingpr\<^sub>0_deftuple_defTuple_def usingassmscomp_mkarrbyauto alsohave"...=mkarr?c?b(P\<^sub>0?a?b\<circ>Tuplefg)" usingassmscomp_mkarr uring_machinesianSuc)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57 alsohave"...=mkarr?c?b (\<lambda>x.ifx\<in>Set?c thensnd(OUT(Set?a\<times>Set?b) (IN(Set?a\<times>Set?b)(Funfx\<lambdax.ifx\inSetc )java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 proof- have"(P\<^sub>0?a?b\<circ>Tuplefg)= (\<lambda>x.ifx\<in>Set?c thensnd(OUT(Set?a\<times>Set?b) (IN(Set?a\<times>Set?b)(Funfx,Fungx))) elsenull)" usingassmside_prod\<^sub>o(3)[of?a?b]bij_betw_applyTuple_defFun_defbyfastforce thus?thesisbysimp qed alsohave"...=mkarr?c?b(\<lambda>x.ifx\<in>Set?cthensnd(Funfx,Fungx)elsenull)" proof- have"\<And>x.x\<in>Set?c\<Longrightarrow> OUT(Set?a\<times>Set?b)(IN(Set?a\<times>Set?b)(Funfx,Fungx))= (Funfx,Fungx)" usingassmsOUT_IN[of"Set?a\<times>Set?b"]small_product_setembeds_product_sets Fun_def byauto thus?thesis by(metis(lifting)) qed alsohave"...=mkarr?c?b(\<lambda>x.ifx\<in>Set?cthenFungxelsenull)" usingassmsby(metis(lifting)snd_eqD) alsohave"...=g" proof- have"Fung=(\<lambda>x.ifx\<in>Set?cthenFungxelsenull)" unfoldingFun_defby(metisassms) thus?thesis by(metis(no_types,lifting)arr_iff_in_homassmsmkarr_Fun) qed finallyshow?thesisbysimp qed qed
lemmaFun_prod: assumes"\<guillemotleft>f:a\<rightarrow>b\<guillemotright>"and"\<guillemotleft>g:c\<rightarrow>d\<guillemotright>" shows"Fun(prodfg)=(\<lambda>x.ifx\<in>Set(prodac) thentuple(Funf(C(pr\<^sub>1ac)x))(Fung(C(pr\<^sub>0ac)x)) elsenull)" proof fixx show"Fun(prodfg)x=(ifx\<in>Set(prodac) thentuple(Funf((^>ac)x))(Fung(C(pr\<^sub>0ac)x)) elsenull)" proof(cases"x\<in>Set(prodac)") caseFalse show?thesis usingFalse by(metisassms(1,2)in_homEprod_simps(2)Fun_def) next caseTrue show?thesis proof- have"\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>dom(prodfg)\<guillemotright>" usingTrueassms(1,2)byfastforce moreoverhave"\<guillemotleft>pr\<^sub>1ac\<cdot>x:\<one>\<^java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 usingassmsTrue by(introconjIcomp_in_homI)fastforce+ moreoverhave"prodfg\<cdot>x=tuple(f\<cdot>pr\<^sub>1ac\<cdot>x)(g\<cdot>pr\<^sub>0ac\<cdot>x)" usingassmsTrueprod_tupletuple_pr_arr by(metiscalculation(2)ide_domin_homEseqI) ultimatelyshow?thesis usingassmsTrueFun_defbyauto qed qed qed
lemmatuple_eq: assumes"\<guillemotleft>f:x\<rightarrow>a\<guillemotright>"and"\<guillemotleft>g:x\<rightarrow>b\<guillemotright>" shows"tuplefg=mkarrx(prodab) (\<lambda>z.ifz\<in>Setx thenIN(Seta\<times>Setb)(Funfz,Fungz) elsenull)" proof- have"tuplefg=Products.tuplefg" by(metisProducts.comp_pr_tuple(1,2)assms(1,2)in_homEpr_tuple(1,2)universal)shows"tuple=INSet\times)(xy)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 thus?thesis unfoldingProducts.tuple_def.Tuple_def usingassmsProducts.prod\<^sub>o_defprod_ide_eqbyfastforce qed
lemmaIn\<^sub>0_in_Hom: assumes"idea"and"ideb" shows"In\<^sub>0ab\<in>Homb(coprod\<^sub>oab)" proof show"In\<^sub>0ab\<in>{F.\<forall>x.x\<notin>Setb\<longrightarrow>Fx=null}"bysimp show"In\<^sub>0definitionin\<sub>:'<>'U<>Ujava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 proof fixx assumex:"x\<in>Setb" have"(ff,x)\<in>Coprodab" usingassmsxbyblast thus"In\<^sub>0abx\<in>Set(coprod\<^sub>oab)" usingassmsxide_coprod\<^sub>o(3)bij_betwEide_coprod\<^sub>o(5)bypresburger qed qed
lemmaIn\<^sub>1_in_Hom: assumes"idea"and"ideb" shows"In\<^sub>1ab\<in>Homa(coprod\<^sub>oab)" proof show"In\<^sub>1ab\<in>{F.\<forall>x.x\<notin>Seta\<longrightarrow>Fx=null}"bysimp show"In\<^sub>1ab\<in>Seta\<rightarrow>Set(coprod\<^sub>oab)" proof fixx assumex:"x\<in>Seta" yt thus"In\<sub1abx\<in>Set(coprod\<^sub>oab)" usingassmsxide_coprod\<^sub>o(3)bij_betwEide_coprod\<^sub>o(5)bypresburger qed qed
lemmain_in_hom[intro,simp]: assumes"idea"and"ideb" shows"in_hom(in\<^sub>1ab)a(coprod\<^sub>oab)" and"in_hom(in\<^sub>0ab)buint:word_type_copy_miscAbs_uintRep_uintsigned_drop_bit_uint using
lemmain_simps assumes"idea"and"ideb" shows"arr(in\<^sub>0ab)"and"dom(in\<^sub>0ab)=b"andjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 and"arr(in\<^sub>1ab)"and"dom(in\<^sub>1ab)=a"and"cod(in\<^sub>1ab)=coprod\<^sub>oab" usingassmsin_in_hombyblast+
lemmatuple_in_homntro assumes"\<guillemotleft>f:a\<rightarrow>c shows"\<guillemotleft>cotuplefg:coprod\<^sub>oab\<rightarrow>c\<guillemotright>" proof- havebij:"bij_betw(OUT(Coprodab))(Set(coprod\<^sub>oab))(Coprodab)" usingassmside_coprod\<^sub>o(2"uint_divmodjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 have"Cotuplefg\<in>Set(coprod\<^sub>oab)includingundefined_transfer proof fixx assumex:"x\<in>Set(coprod\<^sub>oab)" have1:"OUT(Coprodab)x\<in>Coprodab" usingxbijbij_betwEbyblast fstUToprodbx=<r>fst(OUT(Coprodab)x)=ff" using1byfastforce moreoverhave"fst(OUT(Coprodab)x)=tt\<Longrightarrow>Cotuplefgx\<in>Setc" proof- assume2:"fst(OUT(Coprodab)x)=tt" have"snd(OUT(Coprodab)x)\<in>Seta" using12tt_ne_ffbyauto thus?thesis unfoldingCotuple_def usingassmsx2assmsmkarr_in_homide_coprod\^sub>1java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 byautofastforce qed moreoverhave"fst(OUT(Coprodab)x)=ff\<Longrightarrow>Cotuplefgx\<in>Setc" proof- 2"fst(OUTCoprodab))=ff have"snd(OUT(Coprodab)x)\<in>Setb" using12tt_ne_ffbyauto thus?thesis unfoldingCotuple_def usingassmsx2Fun_in_Hom[ofgbc]tt_ne_ffbyauto qed ultimatelyshow"Cotuplefgx\<in>Setc"byblast qed moreoverhave"\<And>x.x\<notin>Set(coprod\<^sub>oab)\<Longrightarrow>Cotuplefgx=null" unfoldingCotuple_def usingassmsbyauto thesis unfoldingcotuple_def usingassmsmkarr_in_homide_coprod\<^sub>o(1)byfastforce qed
lemmaproduct_cone_prodX: assumes"discrete_diagramJCD"and"Collect(partial_composition.arrJ)=I" and"smallI"and"I\<subseteq>Collectarr" shows"has_as_productJD(prodXID)" and"product_coneJCD(prodXID)(prXID)" proof- interpretJ:categoryJ usingassms(1)discrete_diagram_defbyblast interpretD:discrete_diagramJCD usingassms(1)byblast let?\<pi>="prXID" let?a="prodXID" interpretA:constant_functorJC?a usingassmside_prodX applyunfold_locales usingD.is_discretebyauto interpret\<pi>:natural_transformationJCA.mapD?\<pi> proof fixj show"\<not>J.arrj\<Longrightarrow>prXIDj=null" by(metis(no_types,lifting)D.as_nat_trans.extensionalityideD(1)mkarr_def not_arr_nullprX_def) assumej:"J.arrj" show1:"arr(prXIDj)" usingD.is_discreteassmsjbyforce show"Dj\<cdot>prXID(J.domj)=prXIDj" by(metis(lifting)1D.is_discreteJ.ideD(2)comp_cod_arrcod_mkarrjprX_def) show"prXID(J.codj)\<cdot>A.mapj=prXIDj" by(metis(lifting)1A.map_simpD.is_discreteJ.ide_charcomp_arr_domj dom_mkarrprX_def) qed show"product_coneJCD?a?\<pi>" proof fixa'\<chi>' assume\<chi>':"D.conea'\<chi>'" interpret\<chi>':coneJCDa'\<chi>' using\<chi>'byblast show"\<exists>!f.\<guillemotleft>f:a'\<rightarrow>prodXID\<guillemotright>\<and>D.cones_mapf(prXID)=\<chi>'" proof- let?f="tupleXIa'D\<chi>'" havef:"\<guillemotleft>?f:a'\<rightarrow>prodXID\<guillemotright>" usingassmstupleX_in_hom by(metisD.is_discreteD.preserves_ideJ.ide_charPi_I' \<chi>'.component_in_hom\<chi>'.extensionality\<chi>'.ide_apexmem_Collect_eq) moreoverhave"D.cones_map?f(prXID)=\<chi>'" proof fixi show"D.cones_map?f(prXID)i=\<chi>'i" proof- have"J.arri\<Longrightarrow>prXIDi\<cdot>?f=\<chi>'i" usingassmscomp_prX_tupleX[ofID\<chi>'a'i] by(metisD.is_discreteD.preserves_ideJ.ide_charPi_I' \<chi>'.component_in_hom\<chi>'.extensionalitymem_Collect_eq) moreoverhave"\<not>J.arri\<Longrightarrow>null=\<chi>'i" using\<chi>'.extensionalitybyauto moreoverhave"D.cone(cod?f)(prXID)" proof- have"D.cone(prodXID)(prXID)".. moreoverhave"cod?f=prodXID" usingfbyblast ultimatelyshow?thesisbyauto qed ultimatelyshow?thesis usingassms\<chi>'.cone_axiomsbyauto qed qed moreoverhave"\<And>f'.\<lbrakk>\<guillemotleft>f':a'\<rightarrow>prodXID\<guillemotright>;D.cones_mapf'(prXID)=\<chi>'\<rbrakk> \<Longrightarrow>f'=?f" proof- fixf' '"<>f':a<rightarrow>rodXI<>" assume1:"D.cones_mapf'(prXID)=\<chi>'" show"f'=?f" proof(introarr_eqI[off']) showpar:"parf'?fjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35 usingff'byfastforce show"Funf'=Fun(tupleXIa'D\<chi>')" proof fixx show"Funf'x=Fun(tupleXIa'D\<chi>')x" proof(cases"x\<in>Seta'") caseFalse show?thesis usingFalseparf'Fun_defbyauto next caseTrue have2:"D.cone(codf')(prXID)" by(metisA.constant_functor_axiomsLimit.cone_def \<pi>.natural_transformation_axioms\<chi>'f'in_homE) have"Fun(tupleXIa'D\<chi>')x=IN(ProdXID)(\<lambda>i.Fun(\<chi>'i)x)" proof- have"dom(tupleXIa'D\<chi>')=a'" usingfbyauto have*:"(\<lambda>x.if\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>a'\<guillemotright>thentupleXIa'D\<chi>'\<cdot>xelsenull)= (\<lambda>x.if\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>a'\<guillemotright>thenIN(ProdXID)(\<lambda>i.Fun(\<chi>'i)x)elsenull)" proof- have"D\<in>I\<rightarrow>Collectide" usingassms(2)D.is_discretebyforce moreoverhave"\<And>i.i\<in>I\<Longrightarrow>\<guillemotleft>\<chi>'i:a'\<rightarrow>Di\<guillemotright>" usingassms(2)D.is_discrete\<chi>'.component_in_hombyfastforce moreoverhave"\<And>i.i\<notin>I\<Longrightarrow>\<chi>'i=null" usingassms(2)\<chi>'.extensionalitybyblast moreoverhave"idea'" using\<chi>'.ide_apexbyauto ultimatelyshow?thesis usingassmsfFun_tupleX[ofID\<chi>'a']Fun_arrbyforce qed have"Fun(tupleXIa'D\<chi>')x=tupleXIa'D\<chi>'\<cdot>x" usingTrue\<open>dom(tupleXIa'D\<chi>')=a'\<close>Fun_defbypresburger alsohave"...=(\<lambda>x.if\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>a'\<guillemotright>thentupleXIa'D\<chi>'\<cdot>xelsenull)x" usingTruebysimp alsohave"...=(\<lambda>x.if\<guillemotleft>x:\<one>\<^sup>?\<rightarrow>a'\<guillemotright> thenIN(ProdXID)(\<lambda>i.Fun(\<chi>'i)x) elsenull)x" using*bymeson using * by meson (* TODO: Is \<beta>-reduction preventing an easy proof here? *) alsohave"... = IN (ProdX I D) (λi. Fun (χ' i) x)" using True by simp finallyshow ?thesistheoryAOT_Definitions qed alsohave"... = IN (ProdX I D) (λi. χ' i ⋅«φ & ψ → χ = « & ψ χ>\close> unfolding Fun_def byms J.dmcod True \<>.A.map_simp χ'.cod_determines_component \'.preserves_dom χ'.preserves_reflects_arr local.ext seqE) also have "... = INi. D.cones_map x)" using 1 by simp also have "... = IND(>i if i<>felse x)" using 2 by simp also have "... = INXID (<>i. ifhenrX (f' ⋅ proof - have"(λi. (if J.arr i then prX I D i ⋅ f' else null) ⋅ x) = (λi. if J.arr i then prX I D i ⋅ (f' ⋅ x) else null)" proof fix i show"(if J.arr i then prX I D i ⋅ f' else null) ⋅ x = (if J.arr i then prX I D i ⋅ using comp_assoc by auto qed thus ?thesis by simp qed also have "... = IN (ProdX I D)
(λi. if J.arr i then prX I D i ⋅ (Fun f' x) else null)" unfolding Fun_def using True f' by auto also have "... = IN (ProdX I D)
(λi. if J.arr i thenFun (prX I D i) (Fun f' x) else null)" proof - have"\lambda>i. if J.arr prX I D <> (Funf x)else) =
(λi. if J.arr i thenFun (prX I D i) (Fun f' x) else null)" proof fix i show "(if J.arr i then prX I D i ⋅ (Fun f' x) else null) =
(if J.arr i thenFun (prX I D i) (Fun f' x) else null)" using f' Fun_def by fastforce qed thus ?thesis by simp qed also have "... = IN (ProdX I D)
(λi. if J.arr i then (ifFun f' x ∈ Set (prodX I D) then OUT (ProdX I D) (Fun f' x) i else null)
else null)" proof - have "∧i. J.arr i ==>Fun (prX I D i) =
(λx. if x ∈ Set (prodX I D) then OUT (ProdX I D) x i else null)" using assms Fun_prX D.is_discrete by force hence "(λi. if J.arr i thenFun (prX I D i) (Fun f' x) else null) =
(λi. if J.arr i then (λ then (ProdX xielse null
(Fun f' x)
else null)" by auto thus ?thesis by simp qed also have "... = IN (ProdX I D)
(λi. if J.arr i then OUT (ProdX I D) (Fun f' x) i else null)" proof - have "(λi. if J.arr i then (λx. if x ∈ Set (prodX I D) then OUT (ProdX I D) x i else null)
(Fun f' x)
else null) =
(λi. if J.arr i then OUT (ProdX I D) (Fun f' x) i else null)" using True f' Fun_def Fun_arr comp_in_homI by auto thus ?thesis by simp qed also have "... = IN (ProdX I D) (OUT (ProdX I D) (Fun f' x))" proof - have "(λi. if J.arr i then OUT (ProdX I D) (Fun f' x) i else null) =
OUT (ProdX I D) (Fun f' x)" proof fix i show "(if J.arr i then OUT (ProdX I D) (Fun f' x) i else null) = OUT (ProdX I D) (Fun f' x) i" proof (cases "J.arr i") case True show ?thesis using True by simp next case False have 1: "Fun f' x ∈ Set (prodX I D)" using True f' Fun_def by auto moreover have "small (ProdX I D)" and "embeds (ProdX I D)" using assms small_ProdX [of I D] embeds_ProdX [of I D] D.is_discrete D.preserves_ide by auto moreover have "«? → mkide (ProdX I D)¬ using True f' by (metis 1 prodX_def mem_Collect_eq) ultimatelyhave"OUT (ProdX I D) (Fun f' x) ∈ using OUT_elem_of of "ProdX by fastforce thus ?thesis using False assms(2) by fastforce qed qed thus ?thesis by simp qed alsohave"... = Fun f' x" proof - have"small (ProdX I D)" using assms small_ProdX D.is_discrete by fastforce moreoverhave"∃ι. is_embedding_of ι (ProdX I D)" using assms embeds_ProdX [of I D] D.is_discrete by auto moreoverhave"Fun f' x ∈ Set (mkide (ProdX I D))" proof - have"Fun f' x ∈ Set (prodX I D)" using Fun_in_Hom True f' by blast thus ?thesis by (simp add: prodX_def) qed ultimatelyshow ?thesis using assms IN_OUT [of "ProdX I D""Fun f' x"] by blast qed finallyshow ?thesis by simp qed qed qed qed ultimatelyshow ?thesis by blast qed qed thus"has_as_product J D (prodX I D)" using has_as_product_def by blast qed
lemma has_small_products: assumes assms Products. by fastforce shows"has_products I" proof (unfold has_products_def, intro conjI) show"I ≠ using assms not_arr_null by blast show <forall>J D. discrete_diagram J (\<>) ⟶ (∃a. has_as_product J D a)" using assms product_cone_prodX by blast qed
lemma small_prod_comparison_map_props: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" shows "OUT (ProdX I A) ∈ Set (prodX I A) → ProdX I A" " ProdX I A <tarrow and"∧x. x ∈ Set (prodX I A) ==> IN (ProdX I A) (OUT (ProdX I A) x) = x" and"∧y. y ∈ ProdX I A ==> OUT (ProdX I A) (IN (ProdX I A) y) = y" and"bij_betw (OUT (ProdX I A)) (Set (prodX I A)) (ProdX I A)" and"bij_betw (IN (ProdX I A)) (ProdX I A) (Set (prodX I A))" proof - show"OUT (ProdX I A) ∈ Set (prodX I A) → ProdX I A" proof - have"bij_betw (OUT ({f. ∀a. a ∈ I ⟶ f a ∈ Set (A a)} ∩ {f. ∀a. a ∉ I ⟶ f a = null})) (Set (prodX I A)) ({f. ∀ Collect arr ∧ I ≈ using Products.ide_prodX(2) assms(1-3) by blast then show ?thesis by (simp add: bij_betw_imp_funcset) qed show "IN (ProdX I A) ∈ ProdX I A → Set (prodX I A)" proof - have "bij_betw
(OUT ({f. ∀a. a ∈ I ⟶ f a ∈ Set (A a)} ∩ {f. ∀a. a ∉ I ⟶ f a = null}))
(Set (prodX I A))
({f. ∀a. a ∈ I ⟶ f a ∈ Set (A a)} ∩ {f. ∀a. a ∉ I ⟶ f a = null})" using Products.ide_prodX(2) assms(1-3) by blast then show ?thesis by (simp add: Products.prodX_def bij_betw_imp_funcset bij_betw_inv_into) qed show "∧x. x ∈ Set (prodX I A) ==>IN (ProdX I A) (OUT (ProdX I A) x) = x" using assms IN_OUT [of "ProdX I A"] Products.small_ProdX Products.embeds_ProdX by (simp add: Products.prodX_def) show "∧ using assms OUT_IN [of "ProdX I A"] Products.small_ProdX Products.embeds_ProdX by (simp⋅›55) show"bij_betw (OUT (ProdX I A)) (Set (prodX I A)) (ProdX I A)" using assms Products.ide_prodX by fastforce show j_betw using assms Products.ide_prodX by fastforce qed
lemma Fun_prX: assumes"small I"and"A ∈ I → Collect ide"and"I ⊆ Collect arr" and"i ∈ I" shows"Fun (prX I A i) = Products.PrX I A i" using assms Products.Fun_prX by auto
lemma Fun_tupleX: assumes"small I"and"A ∈ I → Collect ide"and"I ⊆ Collect arr" and"∧i. i ∈ I ==>«F i : c → A i¬"and"∧i. i ∉ I ==> F i = null"and"ide c" shows"Fun (tupleX I c A F) = (λ usiusing assms small_Set small_Union using assms Products.Fun_tupleX by auto
lemma product_cone: assumes "discrete_diagram J C D" and "Collect (partial_composition.arr J) = I" and "small I" and "I ⊆ Collect arr" shows "has_as_product J D (prodX I D)" and "product_cone J C D (prodX I D) (prX I D)" using assms Products.product_cone_prodX by auto
lemma has_small_products: assumes "small I" and "I ⊆ Collect arr" shows "has_products I" using assms Products.has_small_products by blast
text‹ Clearly it is not required that the index set ‹I› be actually a subset of @{term ‹Collect arr›} but rather only that it be embedded in it. So we are free to form products indexed by small sets at arbitrary types, as long as @{term ‹Collect arr›} is large enough to embed them. We do have to satisfy the technical requirement that the index set ‹ definition of @{term has_products} as a convenience to avoid the use of coercion maps. ›
lemma has_small_products': assumes "small I" and "embeds I" and "I ≠ UNIV" shows "has_products I" proof - obtain I' where I': "I' ⊆ Collect arr ∧ I ≈ I'" using assms inj_on_image_eqpoll_1 by auto have "has_products I'" using assms I' by (meson eqpoll_sym eqpoll_trans has_small_products small_def) thus ?thesis using assms(3) I' has_products_preserved_by_bijection by (metis eqpoll_def eqpoll_sym) qed
end
section "Small Coproducts"
text‹ In this section we show that the category of small sets and functions has small coproducts. For this we need to assume the existence of a pairing function and also that the notion of smallness is respected by small sums. ›
locale small_coproducts_in_sets_cat = sets_cat_with_cotupling sml C for sml :: "'V set ==> bool" and C :: "'U comp" (infixr ‹⋅› 55) begin
text‹ The global elements of a coproduct ‹CoprodX I A› are in bijection with ‹∪i∈I. {i} × Set (A i)›. › Set (cpoXIA \Longrightarrow OUT (CoprodX I A) x ∈
abbreviation CoprodX :: "'a set ==> ('a ==> 'U) ==> ('a × 'U) set" where "CoprodX I A ≡∪i∈I. {i} × Set (A i)"
definition coprodX :: "'a set ==> ('a ==> 'U) ==> 'U" where "coprodX I A ≡ mkide (CoprodX I A)"
lemma small_CoprodX: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" shows "small (CoprodX I A)" using assms small_Set small_Union by (simp add: Pi_iff smaller_than_small)
lemma embeds_CoprodX: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" shows "embeds (CoprodX I A)" proof let ?ι = "(λx. pair (fst x) (snd x))" show "is_embedding_of ?ι (CoprodX I A)" proof show "?ι ` CoprodX I A ⊆ Collect arr" using arrI assms(3) some_pairing_in_univ by auto show "inj_on ?ι (CoprodX I A)" proof - have "inj_on ?ι (Collect arr × Collect arr)" using some_pairing_is_embedding by auto moreover have "CoprodX I A ⊆ Collect arr × Collect arr" using arrI assms(3) by auto ultimately show ?thesis by (meson inj_on_subset) qed qed qed
lemma ide_coprodX: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" shows "ide (coprodX I A)" and "bij_betw (OUT (CoprodX I A)) (Set (coprodX I A)) (CoprodX I A)" and "bij_betw (IN (CoprodX I A)) (CoprodX I A) (Set (coprodX I A))" and "∧x. x ∈ Set (coprodX I A) ==> OUT (CoprodX I A) x ∈ CoprodX I A" and "∧y. y ∈ CoprodX I A ==> IN (CoprodX I A) y ∈ Set (coprodX I A)" and "∧x. x ∈ Set (coprodX I A) ==> IN (CoprodX I A) (OUT (CoprodX I A) x) = x" and "∧y. y ∈ CoprodX I A ==> OUT (CoprodX I A) (IN (CoprodX I A) y) = y" proof - show "ide (coprodX I A)" unfolding coprodX_def by (simp add: assms(1,2,3) small_CoprodX embeds_CoprodX ide_mkide(1)) show 1: "bij_betw (OUT (CoprodX I A)) (Set (coprodX I A)) (CoprodX I A)" unfolding coprodX_def using assms small_CoprodX embeds_CoprodX bij_OUT [of "CoprodX I A"] by fastforce show 2: "bij_betw (IN (CoprodX I A)) (CoprodX I A) (Set (coprodX I A))" unfolding coprodX_def using assms small_CoprodX embeds_CoprodX bij_IN [of "CoprodX I A"] by fastforce show "∧x. x ∈ Set (coprodX I A) ==> OUT (CoprodX I A) x ∈ CoprodX I A" using 1 bij_betwE by blast show "∧y. y ∈ CoprodX I A ==> IN (CoprodX I A) y ∈ Set (coprodX I A)" using 2 bij_betwE by blast show "∧x. x ∈ Set (coprodX I A) ==> IN (CoprodX I A) (OUT (CoprodX I A) x) = x" using 1 bij_betw_inv_into_left [of "OUT (CoprodX I A)" "Set (coprodX I A)" "CoprodX I A"] by (auto simp add: coprodX_def) show "∧y. y ∈ OUT (CoprodX I A) (IN (CoprodX I A) y) = y" by (simp add: OUT_IN assms(1,2,3) small_CoprodX embeds_CoprodX) qed
abbreviation InX :: "'a set ==> ('a ==> 'U) ==> 'a ==> 'U ==> 'U" where "InX I A i ≡ λx. if x ∈ Set (A i) then IN (CoprodX I A) (i, x) else null"
definition inX where "inX I A i ≡ mkarr (A i) (coprodX I A) (InX I A i)"
lemma InX_in_Hom: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" and "i ∈ I" shows "InX I A i ∈ Hom (A i) (coprodX I A)" using assms ide_coprodX(2-3,5) by auto
lemma inX_in_hom [intro, simp]: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" and "i ∈ I" shows "in_hom (inX I A i) (A i) (coprodX I A)" using assms ide_coprodX InX_in_Hom by (unfold inX_def, intro mkarr_in_hom) auto
lemma inX_simps [simp]: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" and "i ∈ I" shows "arr (inX I A i)" and "dom (inX I A i) = A i" and "cod (inX I A i) = coprodX I A" using assms inX_in_hom by blast+ lemma Fun_inX: assumes "small I" and "A ∈ and "i ∈ I" shows "Fun (inX I A i) = InX I A i" proof - have "arr (inX I A i)" by (simp add: assms) thus ?thesis by (simp add: inX_def) qed
definition CotupleX :: "'a set ==> ('a ==> 'U) ==> ('a ==> 'U) ==> 'U ==> 'U" where "CotupleX I A F ≡ (λ Set (coprodX I A) then Fun (F (fst (OUT (CoprodX I A) x))) (snd (OUT (CoprodX I A) x)) else null)"
lemma CotupleX_in_Hom: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" and "∧i. i ∈ I ==>«F i : A i → c¬" and "∧i. i ∉ I ==> F i = null" shows "CotupleX I A F ∈ Hom (coprodX I A) c" proof show "CotupleX I A F ∈ {F. ∀x. x ∉ Set (coprodX I A) ⟶ F x = null}" by (cases "I = {}") (auto simp add: CotupleX_def) show "CotupleX I A F ∈ Set (coprodX I A) → Set c" proof (cases "I = {}") case False show ?thesis proof fix x assume x: "x ∈ Set (coprodX I A)" have "OUT (CoprodX I A) x ∈ CoprodX I A" using assms x ide_coprodX by (meson bij_betwE) hence "∧i. i = fst (OUT (CoprodX I A) x) ==> «F i : A i → c¬∧ snd (OUT (CoprodX I A) x) ∈ I ==> cotupleX I c A F ⋅ using assms(4) by force thus "CotupleX I A F x ∈ using x CotupleX_def [of I A F] Fun_def by auto qed next case True show ?thesis by (metis (no_types, lifting) Pi_I' True True True True UN_E all_not_in_conv assms(1,3) bij_betwE ide_coprodX(2)) qed qed
definition cotupleX where "cotupleX I c A F ≡ mkarr (coprodX I A) c (CotupleX I A F)"
lemma cotupleX_in_hom [intro, simp]: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" and "∧ shows "«cotupleX I c A F : coprodX I A → c¬" using assms ide_coprodX CotupleX_in_Hom unfolding cotupleX_def CotupleX_def by (intro mkarr_in_hom) auto
lemma cotupleX_simps [simp]: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" and "∧i. i ∈ I ==>«F i : A i → c¬" and "∧i. i ∉ I ==> F i = null" and "ide c" shows "arr (cotupleX I c A F)" and "dom (cotupleX I c A F) = coprodX I A" and "cod (cotupleX I c A F) = c" using assms cotupleX_in_hom in_homE by blast+
lemma comp_cotupleX_inX: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" and "∧i. i ∈ I ==>«F i : A i → c¬" and "∧i. i ∉ I ==> F i = null" and "ide c" shows "i ∈ I ==> cotupleX I c A F ⋅ inX I A i = F i" proof - assume i: "i ∈ I" have I: "I ≠ {}" using i by blast show "cotupleX I c A F ⋅ inX I A i = F i" proof - have 1: "cotupleX I c A F ⋅ inX I A i = mkarr (coprodX I A) c (CotupleX I A F) ⋅ mkarr (A i) (coprodX I A) (InX I A i)" unfolding inX_def cotupleX_def CotupleX_def using assms i I comp_mkarr by simp also have "... = mkarr (A i) c (CotupleX I A F ∘ InX I A i)" using assms i comp_mkarr by (metis (no_types, lifting) 1 seqI cotupleX_def cotupleX_simps(1) dom_mkarr inX_simps(1,3) seqE) also have "... = mkarr (A i) c (λx. if x ∈ Set (A i) then CotupleX I A F (IN (CoprodX I A) (i, x)) else null)" proof - have "CotupleX I A F ∘ InX I A i = (λx. if x ∈ Set (A i) then CotupleX I A F (IN (CoprodX I A) (i, x)) else null)" proof fix x show "(CotupleX I A F ∘ InX I A i) x = (if x ∈ Set (A i) then CotupleX I A F (IN (CoprodX I A) (i, x)) else null)" unfolding CotupleX_def by auto qed thus ?thesis by simp qed also have "... = mkarr (A i) c (λx. if x ∈ Set (A i) then Fun (F (fst (OUT (CoprodX I A) (IN (CoprodX I A) (i, x))))) (snd (OUT (CoprodX I A) (IN (CoprodX I A) (i, x)))) else null)" proof - have "∧x. x ∈ Set (A i) ==> using assms(1,2,3) i bij_betwE ide_coprodX(3) by blast hence "(λx. if x ∈ Set (A i) then CotupleX I A F (IN (CoprodX I A) (i, x)) else null) = (λx. if x ∈ Set (A i) then Fun (F (fst (OUT (CoprodX I A) (IN (CoprodX I A) (i, x))))) (snd (OUT (CoprodX I A) (IN (CoprodX I A) (i, x)))) else null)" unfolding CotupleX_def by force thus ?thesis by simp qed also have "... = mkarr (A i) c (λx. if x ∈ Set (A i) then Fun (F i) x else null)" proof - have "∧x. x ∈ Set (A i) ==> OUT (CoprodX I A) (IN (CoprodX I A) (i, x)) = (i, x)" using assms i ide_coprodX by auto hence "(λx. if «x : 1?→ A i¬ then Fun (F (fst (OUT (CoprodX I A) (IN (CoprodX I A) (i, x))))) (snd (OUT (CoprodX I A) (IN (CoprodX I A) (i, x)))) else null) = (λx. if «x : 1?→ A i¬ then Fun (F i) x else null)" by force thus ?thesis by simp qed also have "... = mkarr (A i) c (Fun (F i))" by (metis (lifting) Fun_def assms(4) category.in_homE category_axioms i mem_Collect_eq) also have "... = F i" using assms(4) i mkarr_Fun by blast finally show ?thesis by blast qed qed
lemma Fun_cotupleX: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" and "∧i. i ∈ I ==>«F i : A i → c¬" and "∧' shows "Fun (cotupleX I c A F) = (λone CDa' \<hi' then Fun (F (fst (OUT (CoprodX I A) x))) (snd (OUT (CoprodX I A) x)) else null)" using assms Fun_mkarr CotupleX_in_Hom CotupleX_def [of I A F] cotupleX_def cotupleX_simps(1) by (metis (lifting))
lemma coproduct_cocone_coprodX: assumes "discrete_diagram J C D" and "Collect (partial_composition.arr J) = I" and "small I" and "I ⊆ Collect arr" shows "has_as_coproduct J D (coprodX I D)" and "coproduct_cocone J C D (coprodX I D) proof - interpret J: category J using assms(1) discrete_diagram_def by blast interpret D: discrete_dia'.extensionality by auto using assms(1) by blast let ?π = "inX I D" let ?a = "coprodX I D" interpret A: constant_functor J C ?a using ide_coprodX using D.is_discrete by unfdow>Fault f" interpret: J C D A.map ⊨Gamma
.
_ by (metis (no_types, lifting) D.as_nat_trans.extensionality ideD(1)
assume j: "J.arr j" show1: "arr (inX I D j)" using D.is_discrete assms j by force show"inX I D (J.cod j) ⋅ D j = inX I D j" by (metis (lifting) 1 D.is_discrete D.preserves_ide D.
J
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 by (metis (lifting) 1 A.map_simp D.is_discrete J.ide_char comp_cod_arr j
cod_mkarr inX_def) qed show"coproduct_cocone J C D ?a ?π" proof fix a' χ' assume χ': "D.cocone a' χ'" interpret χ': cocone J C D a' χ' using χ' by blast show"∃!f. «f : coprodX I D → a'¬∧ D.cocones_map f (inX I D) = proof - let ?f = "cotupleX I a' D χ'" have f: "« CoprodX using assms cotupleX_in_hom by (metis apply unfold
moreoverhave"D.cocones_map ?f (inX I D) = χ'" proof fix i show"D.cocones_map ?f (inX I D) i = χ' i" proof - have"J.arr i ==> ?f ⋅ inX I D i = χ' i" using assms comp_cotupleX_inX by (metis D.is_discrete D.preserves_ide J.ide_char Pi_I' \>component_in_hom moreoverhave"¬ J.arr i ==> null = χ' i" using χ'.extensionality by auto moreoverhave"D.cocone (dom ?f) (inX I D)" by (metis A.constant_functor_axioms D.diagram_axioms
π.natural_transformation_axioms cocone_def diagram_def f in_homE) ultimatelyshow ?thesis using assms χ
qed moreoverhave"∧f'. [ f' = ?f" proof - fix f' assume f': "«f' : coprodX I D → a'¬" assume1: "D.cocones_map f' (inX I D) = χ'" show"f' = ?f" proof (intro arr_eqI [of f']) show par: "par f' ?f"
caseSeq12
f' = (cotupleX')" fix x show "<⊨ While s" by fact proof (cases "x ∈ Set (coprodX I D) auto case False
?thesis using (casesjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 next case Coproducts.cotupleX have2: "D.cocone (dom f') (inX I D)" by (metis A.constant_functor_axioms cocone_def
π.natural_transformation_axioms χ w have') = Fun (χ' (fst (OUT (CoprodX I D) x))) (snd (OUT (CoprodX I D) x))"
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 25 have "Fun (cotupleX I a' D <>'
True f Fun_def by auto alsohave byfastforcetes.intros then cotupleX I a' t'_Fault_f' = Fault <> t' = t"and using True by simp also have "... =
(chi (OUT (CoprodXI) x))(snd(OUTCoprodX x) using
cotupleX_in_hom by auto finallyshow ?thesis by blast qed alsohave"... = Fun f' x" proof (cases "OUT (CoprodX I D) x") case (Pair i x') have ix': "(i, x') ∈ CoprodX I D" using assms True Pair ide_coprodX(2) [of I D] by (metis (no_types, lifting) D.is_discrete D.preserves_ide Pi_I'
bij_betwE mem_Collect_eq) have"Fun (χ' (fst (OUT (CoprodX I D) x))) (snd (OUT (CoprodX I D) x)) = Fun (χ' i) x'" by (simp add: Pair) alsohave"... = Fun (D.cocones_map f' (inX I D) i) x'" using1by simptext<> alsohave"... = (f' ⋅ inX I D i) ⋅ x'" using assms 2 f' ix' inX_in_hom Fun_def D.extensionality D.is_discrete
π.extensionality by auto alsohave"... = f' ⋅ (inX I D i ⋅ x')" using comp_assoc by simp alsohave"... = f' ⋅ IN (CoprodX I D) (i, x')" proof - have"«inX I D i : D i → coprodX I D¬" using assms inX_in_hom D.is_discrete ix' by fastforce hence"«mkarr (D i) (coprodX I D) (InX I D i) : D i → coprodX I D¬" unfolding inX_def by simp thus ?thesis unfolding inX_def using assms ix' app_mkarr by auto qed alsohave"... = f' ⋅ x" proof - have"IN (CoprodX I D) (i, x') = IN (CoprodX I D) (OUT (CoprodX I D) x)" using Pair by simp alsohave"... = x" proof - have"small (CoprodX I D)" using assms small_CoprodX D.is_discrete by fastforce thus ?thesis using assms True ide_coprodX(6) D.is_discrete D.preserves_ide
Pi_I' coprodX_def by force qed finallyshow ?thesis by simp qed finallyshow ?thesis using True f' Fun_def by force qed finallyshow ?thesis by simp qed qed qed qed ultimatelyshow ?thesis by blast qed qed thus"has_as_coproduct J D (coprodX I D)" using has_as_coproduct_def by blast qed
lemma has_small_coproducts: assumes"small I"and"I ⊆ Collect arr" shows"has_coproducts I" proof (unfold has_coproducts_def, intro conjI) "I\noteq UNIV"
ip showJ D. discrete_diagramJ(<>) < Collect (partial_composition.arr J) = I
(a. has_as_coproduct using assms coproduct_cocone_coprodXqed qed
abbreviation coprodX :: "'a set ==> ('a ==> 'U) ==> 'U" where"coprodX ≡case by (auto intro: terminatintros dest: subseteq)
abbreviation inX :: "'a set ==> ('a ==> 'U) ==> 'a <Rightarrowtarrow wherec'subseteq> c'"
abbreviation cotupleX :: "'a set ==> 'U ==> ('a ==> 'U) ==> ('a ==> 'U) ==> 'U" where "cotupleX ≡ Coproducts.cotupleX((λcdotx, g ⋅ x)) ` Set (dom f)) `` {y})) ` Setcod f"
lemma coprod_comparison_map_props: assumes "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr" shows "OUT (CoprodX I A) ∈ Set (coprodX I A) → CoprodX I A" and "IN (CoprodX I A) ∈ CoprodX I A → Set (coprodX I A)" and "∧x. x ∈ Set (coprodX I A) ==>IN (CoprodX I A) (OUT (CoprodX I A) x) = x" and "∧y. y ∈ CoprodX I A ==> OUT (CoprodX I A) (IN (CoprodX I A) y) = y" and "bij_betw (OUT (CoprodX I A)) (Set (coprodX I A)) (CoprodX I A)" and "bij_betw (IN (CoprodX I A)) (CoprodX I A) (Set (coprodX I A))" using assms Coproducts.ide_coprodX by auto
lemma Fun_inX: assumes have "r Set (cod f) ×) and"i ∈ I" shows"Fun (inX I A i) = Coproducts.InX I A i" using assms Coproducts.Fun_inX by auto
lemma Fun_cotupleX: assumes"small I"qed and"∧i. i ∈ I ==>«F i : A i → c¬"and"∧i. i ∉ I ==> F i = null"and"ide c" shows"Fun (cotupleX I c A F) = (λx. if x ∈ Set (coprodX I A) then Fun (F (fst (OUT (∪<in>I. {i} × Set (A i)) x))) (snd (OUT (∪i∈I. {i} × Set (A i)) x)) else null)" using assms Coproducts.Fun_cotupleX
lemma coproduct_cocone_coprodX: assumes"discrete_diagram J C D"and"Collect (partial_composition.arr J) = I" and"small I"and"I ⊆ Collect arr" shows"has_as_coproduct J D (coprodX I D)" and"coproduct_cocone J C D (coprodX I D) (inX I D)" using assms Coproducts.coproduct_cocone_coprodX by auto
lemma has_small_coproducts: assumes"small I"and"I ⊆ Collect arr" shows"has_coproducts I" using assms Coproducts.has_small_coproducts by blast
end
section"Coequalizers"
text\ ?thesis In
of arrows. For this, we need toassume that the set of arrows of the category
embeds the set of all its small subsets. The reason we need this assumption isto
make it possible toobtain an object corresponding to the set of equivalence classes
that results from the quotient construction. ›
lemmaCoeq_in_Hom[intro]: assumes"parfg" shows"Coeqfg\<in>Hom(codf)(cod_coeqfg)" proof show"Coeqfg\<in>Set(codf)\<rightarrow>Set(cod_coeqfg)" proof fixy assumey:"y\<in>Set(codf)" have"Coeqfgy=IN(Cod_coeqfg) (equivcl(Set(codf)) ((\<lambda>x.(f\<cdot>x,g\<cdot>x))`Set(domf))``{y})" unfoldingCoeq_def usingybysimp moreoverhave"...\<in>Set(cod_coeqfg)" usingassmside_cod_coeq(5)ybyblast ultimatelyshow"Coeqfgy\<in>Set(cod_coeqfg)"bysimp qed show"Coeqfg\<in>{F.\<forall>x.x\<notin>Set(codf)\<longrightarrow>Fx=null}" Coeq_defbyjava.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 qed
lemmamemb_Exp_popular_value: assumes"idea"and"ideb"and"F\<in>Expab" and"popular_valueFy" shows"y=null" proof- (* TODO: This is similar to argument in small_function_tuple. *) have"y ∈ Set b ∨ y = null" using assms popular_value_in_range [of F y] by blast hence"y ≠ null ==> {x. F x = y} ⊆ Set a" using assms by blast thus"y = null" using assms smaller_than_small small_Set by auto qed
lemma memb_Exp_imp_small_function: assumes"ide a"and"ide b"and"F ∈ Exp a b" shows"small_function F" proof show"small (range F)" proof - have"range F ⊆ Set b ∪ {null}" using assms by blast moreoverhave"small ..." using assms small_Set by auto ultimatelyshow ?thesis using smaller_than_small by blast qed show"at_most_one_popular_value F" using assms memb_Exp_popular_value Uniq_def by (metis (no_types, lifting)) qed
lemma small_Exp: assumes"ide a"and"ide b" shows"small (Exp a b)" proof - show ?thesis proof (cases "small (UNIV :: 'U set)") case False have"Exp a b ⊆ {F. small_function F ∧ SF_Dom F ⊆ Set a ∧ range F ⊆ Set b ∪ {null}}" proof fix F assume F: "F ∈ Exp a b" have"small_function F" using assms F memb_Exp_imp_small_function [of a b F] by blast moreoverhave"SF_Dom F ⊆ Set a"qed proof - have"popular_value F null" proof - (* TODO: Why doesn't this follow by blast or simp? *) have"∧F y. F ∈ Exp a b ==> popular_value F y ==> y = null" using assms memb_Exp_popular_value by meson moreoverhave"∃y. popular_value F y" by (metis (no_types, lifting) HOL.ext False assms(1,2) ex_popular_value_iff
F memb_Exp_imp_small_function) ultimatelyshow ?thesis using F by blast qed thus ?thesis
auto qed moreoverhave"range F ⊆ Set b \< also using F by blast ultimately show "F ∈ {F. small_function F ∧ SF_Dom F ⊆ Set a ∧ range F ⊆ Set b ∪ {null}}" by blast qed thus ?thesis using False small_funcset [of "Set a" "Set b ∪ {null}"] small_Set assms(1,2) smaller_than_small by fastforce next case True fix y using assms memb_Exp_imp_small_function by auto thus ?thesis using True small_funcset [of UNIV "Set b ∪ {null}"] small_Set assms(1,2) smaller_than_small by (metis (mono_tags, lifting) subset_UNIV) qed qed
lemma embeds_Exp: assumes "ide a" and "ide b" shows "embeds (Exp a b)" proof - have "is_embedding_of some_embedding_of_small_functions (Exp a b)" proof - have "Exp a b ⊆ SEF" unfolding EF_def using assms memb_Exp_imp_small_function by blast thus ?thesis using assms some_embedding_of_small_functions_is_embedding memb_Exp_popular_value by (meson image_mono inj_on_subset subset_trans) qed thus ?thesis by blast qed
lemma ide_exp: assumes "ide a" and "ide b" shows "ide (exp a b)" and "bij_betw (OUT (Exp a b)) (Set (exp a b)) (Exp a b)" and "bij_betw (IN (Exp a b)) (Exp a b) (Set (exp a b))" proof - have "small (Exp a b)" using assms small_Exp by blast moreover have "embeds (Exp a b)" using assms embeds_Exp by blast ultimately show "ide (exp a b)" and "bij_betw (OUT (Exp a b)) (Set (exp a b)) (Exp a b)" unfolding exp_def using assms ide_mkide bij_OUT by blast+ thus "bij_betw (IN (Exp a b)) (Exp a b) (Set (exp a b))" using bij_betw_inv_into exp_def by fastforce qed
abbreviation Eval where "Eval then of ]
(Fun (pr1 (exp b c) b) fx)
(Fun (pr0 (exp b c) b) fx)
else null)"
definition eval where "eval b c ≡ mkarr (prod (exp b c) b) c (Eval b c)"
lemma eval_in_hom [intro, simp]: assumes "ide shows"« proof (unfold eval_def, intro mkarr_in_hom) show "ide c" by fact show "ide (prod (exp b c) b)" using assms ide_exp ide_prod by auto show "Eval b c ∈ Hom (prod (exp b c) b) c" proof show "Eval b c ∈ Set (prod (exp b c) b) → Set c" proof fix fx assume fx: "fx ∈ Set (prod (exp b c) b)" have "Eval b c fx = OUT (Exp b c) (Fun (pr1 (exp b c) b) fx)
(Fun (pr∈ using fx by simp moreoverhave"... ∈ Set c" proof - have"OUT (Exp b c) (Fun (pr1 (exp b c) b) fx) ∈ Exp b c" proof - have"Fun (pr1 (exp b c) b) fx ∈ Set (exp b c)" using assms fx Fun_def by (simp add: comp_in_homI ide_exp(1)) thus ?thesis using assms(1,2) bij_betwE ide_exp(2) by blast qed moreoverhave"Fun (pr0 (exp b c) b) fx ∈ Set b" using assms(1,2) fx ide_exp(1) Fun_def by auto ultimatelyshow ?thesis by blast qed ultimatelyshow"Eval b c fx ∈ Set c"by auto qed show"Eval b c ∈ {F. ∀x. x ∉ Set (prod (exp b c) b) ⟶ F x = null}" by simp qed qed
lemma eval_simps [simp]: assumes"ide b"and"ide c" shows"arr (eval b c)"and"dom (eval b c) = prod (exp b c) b"and"cod (eval b c) = c"
assms
lemma Fun_eval: assumes"ide b"and"ide c" shows"Fun (eval b c) = Eval b c" using assms eval_def Fun_mkarr [of "prod (exp b c) b" c "Eval b c"] by (metis arrI eval_in_hom)
definition Curry where"Curry a b c ≡ λf. if «f : prod a b → c¬ then mkarr a (exp b c) (λx. if x ∈ Set a then IN (Exp b c) (λy. if y ∈ Set b then C f (tuple x y) else null) else null) else null"
lemma Curry_in_hom [intro]: assumes"ide a"and"ide b"and"ide c" and"« shows "«tuple and"Fun (Curry a b c f) = (λx. if x ∈ Set a then IN (Exp b c) (λy. if y ∈ Set b then C f (tuple x y) else null) else null)" proof - have"∧x. x ∈ Set a ==> IN (Exp b c) (λy. if y ∈ Set b then C f (tuple x y) else null) ∈ Set (exp b c)" proof - fix x assume x: "x ∈ Set a" have"(λy. if y ∈ Set b then C f (tuple x y) else null) ∈ Exp b c" proof - have"∧y. y ∈ Set b ==> C f (tuple x y) ∈ Set c" using assms x by auto thus ?thesis by simp qed thus"IN (Exp b c) (λy. if y ∈ Set b then C f (tuple x y) else null) ∈ Set (exp b c)" using assms bij_betwE ide_exp by (metis (no_types, lifting)) qed thus"«Curry a b c f : a → exp b c¬" unfolding Curry_def using assms ide_exp by (simp, intro mkarr_in_hom, auto) show"Fun (Curry a b c f) = (λx. if x ∈ Set a then IN (Exp b c) (λy. if y ∈ Set b then C f (tuple x y) else null) else null)" using by auto qed
lemma Curry_simps [simp]: assumes"ide a"and and"« shows "arr using
lemma Fun_Curry:
java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 43 and shows"Fun (Curry a b c f) = (λx. if x ∈ Set a then IN (Exp b c) (λy. if y ∈ Set b then C f (tuple x y) else null) else null)" using assms Curry_in_hom(2) by blast
interpretation elementary_category_with_terminal_object C ‹1?› some_terminator using extends_to_elementary_category_with_terminal_object by blast
lemma is_category_with_terminal_object: shows"elementary_category_with_terminal_object C 1? some_terminator" and
..
interpretation elementary_cartesian_closed_category
C prjava.lang.NullPointerException proof show" using eval_in_hom by blast show "∧b c. [ide b; ide c]==> ide (exp b c)" using ide_exp by blast show "∧a b c g. [ide a; ide b; ide c; «g : prod a b → c¬] ==>«Curry a b c g : a → exp b c¬" using Curry_in_hom by simp show "∧a b c g. [ide a; ide b; ide c; «g : prod a b → c¬] ==> C (eval b c) (prod (Curry a b c g) b) = g" proof - fix a b c g assume a: "ide a" and b: "ide b" and c: "ide c" and g: "«g : prod a b → c¬" show "eval b c ⋅ prod (Curry a b c g) b = g" proof (intro arr_eqI [of _ g]) show par: "par (C (eval b c) (prod (Curry a b c g) b)) g" using a b c g by auto show "Fun (eval b c ⋅ prod (Curry a b c g) b) = Fun g" proof fix x show "Fun (eval b c ⋅ prod (Curry a b c g) b) x = Fun g x" proof (cases "x ∈ Set (prod a b)") case False show ?thesis False Fun_def g in_hpar) next case True have "Fun (C (eval b c) (prod (Curry a b c g) b)) x = Fun (eval b c) (Fun (prod (Curry a b c g) b) x)" using True a b c g Fun_comp par comp_assoc by auto also have "... = (λfx. if fx ∈ Set (prod (exp b c) b) then OUT (Exp b c) (Fun (pr1 (exp b c) b) fx)
(Fun (pr0 (exp b c) b) fx)
else null)
((if x ∈ Set (prod a b) then tuple
(Fun (Curry a b c g) (pr1 a b ⋅ x))
(Fun b (pr0 a b ⋅ x))
else null))" proof - have "Fun (eval b c) = (λfx. if fx ∈ Set (prod (exp b c) b) then OUT (Exp b c) (Fun (pr1 (exp b c) b) fx)
(Fun (pr0 (exp b c) b) fx)
else null)" using b c Fun_eval by simp moreover have "Fun (prod (Curry a b c g) b) =
(λx. if x ∈ Set (prod a b) then tuple
(Fun (Curry a b c g) (pr1 a b ⋅ x))
(Fun b (pr0 a b ⋅ x))
else null)" using a b c g Fun_prod [of "Curry a b c g" a "exp b c" b b b] Curry_in_hom by (meson ide_in_hom) ultimately show ?thesis by simp qed also have "... = OUT (Exp b c)
(Fun (pr1 (exp b c) b)
(tuple
(Fun (Curry a b c g) (C (pr1 a b) x))
(Fun b (C (pr0 a b) x))))
(Fun (pr0 (exp b c) b)
(tuple
(Fun (Curry a b c g) (C (pr1 a b) x))
(Fun b (C (pr0 a b) x))))" proof - have "tuple
(Fun (Curry a b c g) (C (pr1 a b) x))
(Fun b (C (pr0 a b) x)) ∈ Set (prod (exp b c) b)" using a b c g True Fun_def by auto thus ?thesis using True by presburger qed also have "... = OUT (Exp b c)
(pr1 (exp b c) b ⋅
tuple
(Fun (Curry a b c g) (C (pr1 a b) x))
(Fun b (C (pr0 a b) x)))
(pr0 (exp b c) b ⋅
tuple
(Fun (Curry a b c g) (C (pr1 a b) x))
(Fun b (C (pr0 a b) x)))" proof - have "tuple
(Fun (Curry a b c g) (C (pr1 a b) x))
(Fun b (C (pr0 a b) x)) ∈ Set (prod (exp b c) b)" using a b c g True Fun_def by auto moreover have "Set (prod (exp b c) b) = Set (dom (pr1 (exp b c) b))" using b c by (simp add: ide_exp(1)) moreover have "Set (prod (exp b c) b) = Set (dom (pr0 (exp b c) b))" using b c by (simp add: ide_exp(1)) ultimately show ?thesis unfolding Fun_def using a b c g True by auto qed also have "... = OUT (Exp b c)
(Fun (Curry a b c g) (C (pr1 a b) x))
(Fun b (C (pr0 a b) x))" unfolding Fun_def using True a b c g by auto also have "... = OUT (Exp b c) (Fun (Curry a b c g) (C (pr1 a b) x)) (C (pr0 a b) x)" proof - have "C (pr0 a b) x ∈ Set b" using True a b by blast thus ?thesis using b Fun_ide [of b] by presburger qed also have "... = OUT (Exp b c) ((λx. if x ∈ Set a then IN (Exp b c) (λy. if y ∈ Set b then g ⋅ tuple x y else null) else null) (C (pr1 a b) x)) (C (pr0 a b) x)" using a b c g Fun_Curry [of a b c g] by simp also have "... = OUT (Exp b c) (IN (Exp b c) (λy. if y ∈ Set b then g ⋅ tuple (pr1 a b ⋅ x) y else null)) (pr0 a b ⋅ x)" using True a b c g by auto also have "... = (λy. if y ∈ Set b then g ⋅ tuple (pr1 a b ⋅ x) y else null) (pr0 a b ⋅ x)" proof - have "(λy. if y ∈ Set b then g ⋅ tuple (pr1 a b ⋅ x) y else null) ∈ Hom b c" proof show "(λy. if y ∈ Set b then g ⋅ tuple (pr1 a b ⋅ x) y else null) ∈ Set b → Set c" proof fix y assume y: "y ∈ Set b" show "(if y ∈ Set b then g ⋅ tuple (pr1 a b ⋅ x) y else null) ∈ Set c" using True a b c g y by auto qed show "(λy. if y ∈ Set b then g ⋅ tuple (pr1 a b ⋅ x) y else null) ∈ {F. ∀x. x ∉ Set b ⟶ F x = null}" by auto qed thus ?thesis using a b c g small_Exp [of b c] embeds_Exp [of b c] ide_exp(1) [of b c] OUT_IN [of "Exp b c" "λy. if y ∈ Set b then g ⋅ tuple (pr1 a b ⋅ x) y else null"] by auto qed also have "... = g ⋅ tuple (pr1 a b ⋅ x) (pr0 a b ⋅ x)" using True a b c g by auto also have "... = g ⋅ tuple (pr1 a b) (pr0 a b) ⋅ x" using True a b c g comp_tuple_arr by (metis CollectD in_homE pr_simps(2) span_pr) also have "... = g ⋅ x" using True a b tuple_pr comp_cod_arr by fastforce also have "... = Fun g x" using True g Fun_def by auto finally show ?thesis by blast qed qed qed qed show "∧a b c h. [ide a; ide b; ide c; «h : a → exp b c¬] ==> Curry a b c (C (eval b c) (prod h b)) = h" proof - fix a b c h assume a: "ide a" and b: "ide b" and c: "ide c" and h: "«h : a → exp b c¬" show "Curry a b c (C (eval b c) (prod h b)) = h" proof (intro arr_eqI [of _ h]) show par: "par (Curry a b c (C (eval b c) (prod h b))) h" using a b c h Curry_def Curry_simps(1) by auto show "Fun (Curry a b c (C (eval b c) (prod h b))) = Fun h" proof fix x show "Fun (Curry a b c (C (eval b c) (prod h b))) x = Fun h x" proof (cases "x ∈ Set a") case False show ?thesis using False a b c h by (metis Fun_def in_homE par) next case True have "OUT (Exp b c) (Fun (Curry a b c (C (eval b c) (prod h b))) x) = OUT (Exp b c) (IN (Exp b c) (λy. if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null))" using True a b c h Fun_Curry [of a b c "C (eval b c) (prod h b)"] eval_in_hom [of b c] by auto also have "... = (λy. if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null)" proof - have "(λy. if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null) ∈ Hom b c" proof show "(λy. if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null) ∈ Set b → Set c" proof fix y assume y: "y ∈ Set b" show "(if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null) ∈ Set c" using True a b c h y ide_in_hom by auto qed show "(λy. if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null) ∈ {F. ∀x. x ∉ Set b ⟶ F x = null}" by simp qed thus ?thesis using True a b c h small_Exp [of b c] embeds_Exp ide_exp [of b c] OUT_IN [of "Exp b c" "λy. if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null"] by auto qed also have "... = OUT (Exp b c) (Fun h x)" proof fix y show "... y = OUT (Exp b c) (Fun h x) y" proof (cases "y ∈ Set b") assume y: "y ∉ Set b" have "«Fun h x : 1?→ mkide (Exp b c)¬" using True b c h by (metis Fun_arr[of h a "cod h"] arr_iff_in_hom[of "h ⋅ x"] dom_comp[of h x] cod_comp[of h x] exp_def[of b c] in_homE[of h a "exp b c"] in_homE[of x "1?" a] mem_Collect_eq[of x "λuub. «uub : 1?→ a¬"] seqI[of x h]) thus ?thesis moreover have 2: "has_as_pullack tt (🚫 using True b c h y OUT_elem_of [of "Exp b c" "Fun h x"] small_Exp [of b c] embeds_Exp [of b c] ide_exp [of b c] by auto next assume y: "y ∈ Set b" have "(λy. if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null) y = (eval b c ⋅ prod h b) ⋅ tuple x y" using y by simp also have "... = eval b c ⋅ (prod h b ⋅ tuple x y)" using comp_assoc by simp also have "... = eval b c ⋅ tuple (h ⋅ x) (b ⋅ y)" using True b c h y prod_tuple by (metis comp_cod_arr in_homE mem_Collect_eq seqI) also have "... = eval b c ⋅ tuple (h ⋅ x) y" using b y by (metis comp_cod_arr in_homE mem_Collect_eq) also have "... = Fun (eval b c) (tuple (h ⋅ x) y)" using True b c h y Fun_def [of "eval b c" "tuple (h ⋅ x) y"] by auto also have "... = (λfx. if fx ∈ Set (prod (exp b c) b) then OUT (Exp b c) (Fun (pr1 (exp b c) b) fx) (Fun (pr0 (exp b c) b) fx) else null) (tuple (h ⋅ x) y)" using b c Fun_eval [of b c] by presburger also have "... = OUT (Exp b c) (Fun (pr1 (exp b c) b) (tuple (h ⋅ x) y)) (Fun (pr0 (exp b c) b) (tuple (h ⋅ x) y))" using True b c h y by (simp add: comp_in_homI tuple_in_hom) also have "... = OUT (Exp b c) (pr1 (exp b c) b ⋅ tuple (h ⋅ x) y) (pr0 (exp b c) b ⋅ tuple (h ⋅ x) y)" using True b c h y Fun_def ide_exp(1) span_pr by auto also have "... = OUT (Exp b c) (h ⋅ x) y" using True b c h y apply auto by fastforce also have "... = OUT (Exp b c) (Fun h x) y" using True h Fun_def by auto finally show "(if y ∈ Set b then (eval b c ⋅ prod h b) ⋅ tuple x y else null) = OUT (Exp b c) (Fun h x) y" by blast qed qed finally have *: "OUT (Exp b c) (Fun (Curry a b c (C (eval b c) (prod h b))) x) = OUT (Exp b c) (Fun h x)" by simp show "Fun (Curry a b c (C (eval b c) (prod h b))) x = Fun h x" proof - have "Fun (Curry a b c (C (eval b c) (prod h b))) x = IN (Exp b c) (OUT (Exp b c) (Fun (Curry a b c (C (eval b c) (prod h b))) x))" proof - have "Fun (Curry a b c (eval b c ⋅ prod h b)) x ∈ Set (mkide (Exp b c))" proof - have "«Curry a b c (eval b c ⋅ prod h b) : a → exp b c¬" using a b c h par Curry_in_hom [of a b c "C (eval b c) (prod h b)"] by (metis arr_iff_in_hom in_homE) hence "Fun (Curry a b c (eval b c ⋅ prod h b)) ∈ Set a → Set (exp b c)" using Fun_in_Hom [of "Curry a b c (eval b c ⋅ prod h b)" a "exp b c"] by blast thus ?thesis using True exp_def by auto qed thus ?thesis using True a b c h small_Exp embeds_Exp IN_OUT [of "Exp b c" "Fun (Curry a b c (C (eval b c) (prod h b))) x"] by presburger qed also have "... = IN (Exp b c) (OUT (Exp b c) (Fun h x))" using * by simp also have "... = Fun h x" proof - have "Fun h x ∈ Set (mkide (Exp b c))" using True b c h Fun_def exp_def by auto using True b c h small_Exp embeds_Exp IN_OUT [of "Exp b c" "Fun h x"] by presburger qed finally show ?thesis by blast qed qed qed qed qed qed
interpretation Expos: exponentials_in_sets_cat sml C ..
abbreviation Exp where "Exp ≡ Expos.Exp"
abbreviation exp where "exp ≡ Expos.exp"
lemma ide_exp: assumes "ide a" and "ide b" shows "ide (exp a b)" using asm xpsie_x ybast
lemma exp_comparison_map_props: assumes ""e<k> = e" shows [] and"IN (Exp a b) ∈ and "∧x. x ∈ Set (exp a b) ==>IN (Exp a b) (OUT (Exp a b) x) = x" and "<y \in a b <> =ρ'=ρ and"bij_betw (OUT (Exp a b)) n and "bij_betwgamesesa
- show Set (exp a b) → using assms Exposen
pa)<>Exp Setpa) using earbitrary<Gamma Γ DBVar showcaseby(simp: if_splits) by show v
ing by (metis (no_types pply show"∧ using assms by (metis (no_types, lifting) HOL.ext Expos.exp_def Expos.ide_exp(2) bij_betw_inv_into_right) show "bij_betw using assms Expos.exponentials_in_sets_cat_axiomsevalOP_Pred[intro" \own Suc n <> DBPreP\ownDBum " by fastforce show + using byrce qed
abbreviation Eval where" :
abbreviation eval where ≡
lemma eval_in_hom [intro, simp]: ic" shows (<>f using assms
assumes"ide b"and"ide c"rule shows"arr (eval b c)"and"dom (eval b c) = prod (exp b c) b"and"cod (eval b c) = c"
using pos
lemma Fun_eval: assumes"ide b"and"ide c" showsl unfolding eval_def using assms Expos.Fun_eval [of b c] by simp
[simp]: assumes "ide and"« shows "arr (Curry a b c f)" and "dom (Curry a b c f) = a" and " clarsimp using
assumes and shows"Fun (Curry a b c f) = (λx. if x ∈ Set a IN Ex b c) (\lambday i y ∈ elsenull)" usingAprogramemphfit
theoremis_cartesian_closed shows"elementary_cartesian_closed_category C pr\<open>"DBLP:conf/tphol/BentonKV09close demonstrate a similar computational and"cartesian_closed_category C" using Expos.is_elementary_cartesian_closed_category Expos.is_cartesian_closed_category by auto
end
section"Subobject Classifier"
text In this section we show that a sets category has a subobject classifier,
which is a categorical formulation of set comprehension. We give here a formal definition of subobject classifier, because we have not done that elsewhere to date, but ultimately this definition would perhaps be better placed with
a development of the theory of elementary topoi, which are cartesian closed
categories have\> tt>False ›
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.2.599Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.