theory SetsCat imports Category3arioustegory
achfies begin>›Universe›. In particular
text In this section we consider the category of small sets and functions
them as an exemplifying instance of the pattern we propose for working with large categories in HOL. We define a locale‹terminal oject, uchhattterminesllsetesetofalelements hereisanobjectcorrespondingtoanyexternallygivensmallset,andsuchthat thehom-setsbetweenobjectsareinbijectionwiththesmallextensionalfunctions betweennetsglobalelementsWeowthatsocaleharacterizesrizesegory thatforixednotionflness anytwo Wethenproceedtoderivevariousfamiliarpropertiesofacategoryofsetsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ineachcasethatthenotionof``smallness''satisfiesnditionsnssasdefinedd sjectivendrjective;ndatheegory`plete' categorysatisfiessuitableclosureconditionsasdefinedinthetheory \<open>Universe\<andsurj_Fun:<>e;derbrakk\<Longrightarrow>Homab\<ubseteqqn(homa" cartesianclosed,hasasubobjectclassifierandanaturalnumbersobject, andsplitsallepimorphisms.
localesets_cat_base= ness category_with_terminal_objectC forsml::"et<>ooljava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 whosetofobalallelementsquipollentllentent\>\<close>. begin
text\<open> Thefollowingfunctionwillstoobtainanbjectcorrespondingpondingtoan givensetThesetfglobalmentsfhejecttojava.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 equipollentwiththegivenset.Wegivethedefinitionhere,butofcourse itwillbenecessarytoprovethatthisfunctionactuallydoesproducesuch nectndersuitableconditions. <>
lemmamkarr_Fun: assumes"\<guillemotleft>f:a\<rightarrow>b\<guillemotright>" shows"mkarrab(Funf)f proof- qed by(tisliftingtingg)un_in_Homin_Hom_omFun_mkarr_arrssmside_code_dom_mEarr_in_homin_hom) thus?thesis usingassmsinj_Funinj_onD[ofFun"homab" byblast qed
lemmaisomorphic_char: shows"isomorphicab\<longleftrightarrow>idea\<and>ideb\<and>Seta proof assume1:"isomorphicab" show"idea\<and>ideb\<and>Seta\<approx>Setb" using(C.unf next assume1:"idea\<and>ideb\<and>Seta\approxb" obtainalsohave...=.Fun?(gf)x" using1eqpoll_defbyblast let?F'="\<lambda>x.ifx\<in>SetathenFxelsenull" let?f="mkarrab(\<lambda>x.ifx\<in>SetathenFxelsenull)" havef:"\<guillemotleft>?f:a\proofintroC.arr_eqI'[off]java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39 proof x:\<one>\<^sup>?\<rightarrow>C.domf\<guillemotright>" using1byauto show"(\<lambda>x.ifx\<in>SetathenFsell<in>Hom" usingFPi_membij_betw_imp_funcsetbyfastforce qed moreoverhave"bij_betw(Fun?f)(Seta)alsohave"..=D.OUT(C.Set(Ccodf)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 FFun_mkarrarrIbij_betw_congf apply(unfoldbij_betw_def) by(autosimpadd:inj_on_def) ultimatelyhave"iso?f\<and>dom?f=a\<and>cod?f=b" usingiso_charFun_mkarrbyauto thus"isomorphicab" usingisomorphicIbyforce qed(C.unf
text\<open> Inthissectionweassumethatsmallnessencompassessetsfrbitraryaryfiniterdinality andthatthecategoryhaseastwoarrowssohatatwenhowheistencefn objectwithtwoglobalelements. Ifthisfailstobethecase,thenthesituationissomewhatpathologicalandowsdeprodX)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 interesting. \<close>
localesets_cat_with_bool= sets_catsmlC+ small_finitesml forsml::"'Vset\<Rightarrow>bool" andC::"'Ucomp"(infixr\<open>\<cdot>\<close>55)+ assumesembeds_bool_ax:"embeds(UNIV:boolset)" begin
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)") caseFalse 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:"\<guillemotleft>x:\<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" - fixh' assumeh':"equfg\<cdot>h'=e'" show"h'=?h" proof(introarr_eqI'show2:"bij_betw((a)(ab(Set(<subob)java.lang.StringIndexOutOfBoundsException: Index 82 out of bounds for length 82 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)(equfg\<cdot>(h'\<cdot>x))" usingFun_def by(metis(no_types,lifting)xCollectIcomp_in_homI dom_comph'in_homIseqseqE) 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 usingxFun_defapp_mkarrhh'comp_assoc345byauto alsohave"...=IN(Dom_equfg)(Equfg(?h\<cdot>x))" usingassmsFun_equby(metis(lifting)) alsohave"...=?h\<cdot>x" usingassmsxide_dom_equ(6)hbyauto finallyshow"h'\<cdot>x=?h\<cdot>x"byblast qed qed qed ultimatelyshow"\<exists>!h.equfg\<cdot>h=e'"byauto qed qed
lemmahas_equalizers: "parfgjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 shows"\<exists>e.has_as_equalizerfge" usingassmsequ_is_equalizerbyblast
text\<open> Inthissectionweshowthatthecategoryofsmallsetsandfunctionshasbinaryproducts. Wefollowthesamepatternasforequalizers,exceptthatnowthesettowhichwewould liketoapply\<open>mkide\<close>toobtainaproductobjectwillconsistofpairsofarrows, ranndividualsseansthatlleedmeheistencejava.lang.StringIndexOutOfBoundsException: Index 91 out of bounds for length 91 apairingfunctionthatembedsthesetofpairsofarrowsofthecategorybackintothe originalsetofarrows.Onceagain,inshowingthattheconstructionmakessense\And>y.y\<in>Cod_coeqfg\<Longrightarrow>OUT(Cod_coeqfg)(IN(Cod_coeqfg)y" needtoreasonaboutcomparisonmaps,butoncethisisdonewewillbeleftsimplywitha universalpropertywhichdoesnotmentionthesemaps.Afterthat,weonlyhavetowork withthecomparisonmapswhenrelatingnotionsinternaltothecategorytonotions externaltoit. \<close>
lemmapr_in_hom[intro]: assumes"idea"and"ideb" shows"in_hom(pr\<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 and"in_hom(pr\<^sub>0ab)(prod\<^sub>oab)b" usingassmspr\<^sub>0_defpr\<^sub>1_defmkarr_in_homide_prod\<^sub>oP\<^sub>0_in_HomP\<^sub>1_in_Hombyauto
lemmapr_simps[simp]: assumes"idea"and"idebjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 shows"arr(pr\<^sub>0ab)"and"dom(pr\<^sub>0ab)=prod\<^sub>oab"and"cod(pr\<^sub>0ab)=b" and"arr(pr\<^sub>1ab)"and"dom(pr\<^sub>1ab)=prod\<^sub>oab"and"cod(pr\<^sub>1ab)=a" usingassmspr_in_hombyblast+
lemmain<sub1in_hom[introsimpmp assumes"idea"and"ideb" shows"in_hom(in\<^"\<And>y.<in>ProdXIA\<Longrightarrow(ProdXIA)IN(ProdXI))=y oductsjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
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 )yast let?\<pi>="prXID" let?a="prodXID" interpretA:constant_functorJC?a usingassmside_prodX applyunfold_locales usingD.is_discretebyauto interpret\<pi:natural_transformationral_transformationCmap\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>'" definitioncod_coeq let?f="tupleXIa'D\<chi>'java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42 havef:"\<guillemotleft>?flemmade_cod_coeq 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 fix 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" show"\<And>x.<in>Set(cod_coeqf<ongrightarrow>OUT(Cod_coeqfg)x\<in>Cod_coeqfg" moreoverhave"D.cone(cod?f)(prXID)" proof- have"D.cone(prodXID)(prXI\<ongrightarrow>IN(Cod_coeqOUT(d_coeq)) moreoverhave"cod?f=prodXID" usingfbylast 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' assumef':"\<guillemotleft>f':a'\<rightarrow>prodXID\<guillemotright>" assume1:"D.cones_mapf'(prXID)=\<chi>'" show"f'=?f" proof(introarr_eqI[off']) showpar:"parf'?f" 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: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" ()\<chi>'.extensionalitybylast 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 * by meson (* TODO: Is \<beta>-reduction preventing an easy proof here? *) alsohave"... = IN (ProdX I D) (λce_no oscbat using True by simp finally show ?thesis by blast qed also have "... = IN (ProdX I D) (λi. χ' i ⋅ x)" unfolding Fun_def by (metis J.dom_cod True χ'.A.map_simp χ'.cod_determines_component χ'.preserves_dom χ'.preserves_reflects_arr local.ext seqE) also have "... = IN (ProdX I D) (λi. D.cones_map f' (prX I D) i ⋅ x)" using 1 by simp also have "... = IN (ProdX I D) (λi. (if J.arr i then prX I D equivcl_props<x. (f ⋅"codf using 2 by simp also have "... = IN (ProdX I D) (λi. if J.arr i then prX I D i ⋅ (f' ⋅ x) else null)" proof - have "(λ
(λ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 ⋅ (f' ⋅ x) else null)" 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 "(λi. if J.arr i then prX I D i ⋅ (Fun f' x) else null) =
(λ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) =
(λ Set (rodX D then OUT (ProdX I D) x i else null)" using assms Fun_prX D.is_discrete by force hence "(λ ide_cod_coeq
(λi. if J.arr i have< Cod_coeq f g" then OUT (ProdX I D) x i else null) (Fun f' x) else null)" by auto thus ?thesis by simp qed alsohave"... = IN (ProdX I D) (λi. if J.arr i then OUT (ProdX I D) (Fun f' x) i else null)"
- 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 alsohave"... = 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
( J. i thenProdX 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 small( I D) a " (ProdX using assms small_ProdXCoeq_surj
D.is_discrete D.preserves_ide by auto moreoverhave"« Set (cod_coeq f g) ⟶ using True f' by (metis 1 prodX_def mem_Collect_eq) ultimately have "OUT (ProdX I D) (Fun f' x) ∈ ProdX <guillemotleft? cod q'¬ using OUT_elem_of [of "ProdX I D""Fun f' x"] Fun_in_Hom by fastforce thus ?thesis using False(2 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"E> ⊆ ultimately show ?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 "small I" and "I ⊆ Collect arr" shows "has_products I" proof (unfold has_products_def, intro conjI) show "I ≠ UNIV" using assms not_arr_null by blast show "∀J D. discrete_diagram J (⋅ ⟶ (∃a. has_as_product J D a)" using assms product_cone_prodX by blast qed
abbreviation ProdX :: "'a set ==> ('a ==> 'U) ==> ('a ==> 'U) set" where "ProdX ≡ Products.ProdX"
abbreviation prodX :: "'a set ==> ('a ==> 'U) ==> 'U" where "prodX ≡ Products.prodX"
abbreviation prX :: "'a set ==> ('a ==> 'U) ==> 'a ==> 'U" where "prX ≡ Products.prX"
:: 'aset ==> ('a ==> 'U\Rightarrow where "tupleX ≡ Products.tupleX"
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" and "IN (ProdX I A) ∈ ProdX I A → Set (prodX I A)" 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. <foralla Set (A ) <nter{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: 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 "∧y. y ∈ ProdX I A ==> OUT (ProdX I A) (IN (ProdX I A) y) = y" using assms OUT_IN [of "ProdX I A"] Products.small_ProdX Products.embeds_ProdX by (simp add: Products.prodX_def) show "bij_betw (OUT (ProdX I A)) (Set (prodX I A)) (ProdX I A)" using assms Products.ide_prodX by fastforce show "bij_betw (IN (ProdX I A)) (ProdX I A) (Set (prodX I A))" 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 "∧ shows"Fun (tupleX I c A F) = (λx. if x ∈ Set c then IN (Products.ProdX I A) (λi. Fun (F i) x) else null)" 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 ‹I› not exhaust the elements at its type, which we introduced in the
definition of @{term has_products} as a convenience to avoid the use of coercion maps. ›
assms byblast 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∈ " f g ›
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"
"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
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 "∧
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 ∈
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 ≡
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 ∈
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 ∈ I → ass(1,) smaller_than_small
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)
definition CotupleX :: "'a set ==> ('a ==> 'U) ==> ('a ==> 'U) ==> 'U ==> 'U"
where "CotupleX I A F ≡
(λx. if x ∈ 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 \ in> {F. ∀. x ∉ Set (coprodX I A) ⟶ F x = null}"
((cases "I = {}") auto simp a: CotupleX_def)
show "CotupleX I A F ∈ Set (coprodX I A) → Set c"
proof (cases "I = {}")
case False
show ?thj_betw_in exp_def by fastforce
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)
using assms(4) by force
thus "CotupleX I A F x ∈ Set c"
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 "∧i. i ∈ I ==>«F i : A i → c¬" and "∧i. i ∉ I ==>0 (exp b c) b) fx)"
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 ∈ ur
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
CotupleX I A F ∘
(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) ==> IN (CoprodX I A) (i, x) ∈ Set (coprodX I A)"
using assms(1,2,3) i bij_betwE ide_coprodX(3) by blast
hence(λ 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?lemma Curry_simps [simp]:
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 "∧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 (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) (inX I D)"
proof -
interpret J: category J
assms(1) disc by blast
interpret D: discrete_diagram J C D
using assms(1) by blast
let ?π = "inX I D"
let ?a = "coprodX I D"
interpret A: constant_functor J C ?a
using assms ide_coprodX
using D.is_discrete by unfold_locales auto
interpret π: natural_transformation J C D A.map ?π
proof
fix j
show "¬ J.arr j ==> inX I D j = null"
by (metis (no_types, lifting) D.as_nat_trans.extensionality ideD(1)
mkarr_def not_arr_null inX_def)
assume j: "J.arr j"
show 1: "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.preserves_reflects_arr
J.ideD(3) comp_arr_ide dom_mkarr ideD(3) j inX_def seqI)
show "A.map j ⋅ inX I D (J.dom j) = inX I D j"
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: "«?f : coprodX I D → a'¬"
using assms cotupleX_in_hom
by (metis D.is_discrete D.preserves_ide J.ide_char Pi_I'
χ'.component_in_hom χ'.extensionality χ'.ide_apex mem_Collect_eq)
moreover have "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 ⋅
using assms comp_cotupleX_inX
by (metis D.is_discrete D.preserves_ide J.ide_char Pi_I'
χ'.component_in_hom χ'.extensionality χ'.ide_apex mem_Collect_eq)
moreover have "¬ J.arr i ==> null = χ' i"
using χ'.extensionality by auto
moreover have "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)
ultimately show ?thesis
using assms χ'.cocone_axioms by auto
qed
qed
moreover have "∧f'. [«f' : coprodX I D → a'¬; D.cocones_map f' (inX I D) = χ(Fun (Curry a b c g) ) (C (pr\^sb1 x) ==> f' = ?f"
proof -
fix f'
assume f': "«f' : coprodX I D → a'¬"
assume 1: "D.cocones_map f' (inX I D) = χ'"
show "f' = ?f"
proof (intro arr_eqI [of f'])
show par: "par f' ?f"
using f f' by fastforce
show "Fun f' = Fun (cotupleX I a' D χ')"
proof
fix x
show "Fun f' x = Fun (cotupleX I a' D χ') x"
proof (cases "x ∈ Set (coprodX I D)")
case False
using False par f' Fun_def by auto
next
case True
have 2: "D.cocone (dom f') (inX I D)"
by (metis A.constant_functor_axioms cocone_def
π.natural_transformation_axioms χ' f' in_homE)
have "Fun (cotupleX I a' D χ') x =
Fun (χ' (fst (OUT (CoprodX I D) x))) (snd (OUT (CoprodX I D) x))"
proof -
have "Fun (cotupleX I a' D χ') x = cotupleX I a' D χ' ⋅ x"
using True f Fun_def by auto
also have "... = (λx. if «x : 1?→ coprodX I D¬
then cotupleX I a' D χ' ⋅ x else null) x"
using True by simp
also have "... =
Fun (χ' (fst (OUT (CoprodX I D) x))) (snd (OUT (CoprodX I D) x))"
using assms f True cotupleX_def [of I a' D χ'] CotupleX_def [of I D χ']
app_mkarr cotupleX_in_hom
by auto
finally show ?thesis by blast
qed
' 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)) =
proof -
by (simp add: Pair)
also have "... = Fun (D.cocones_map f' (inX I D) i) x'"
using 1 by simp
also have "... = (f' ⋅ inX I D i) ⋅ x'"
using assms 2 f' ix' inX_in_hom Fun_def D.extensionality D.is_discrete
π.extensionality
by auto
also have "... = f' ⋅ (inX I D i ⋅ x')"
using comp_assoc by simp
also have "... = 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
also have "... = f' ⋅ x"
proof -
have "IN (CoprodX I D) (i, x') = IN (CoprodX I D) (OUT (CoprodX I D) x)"
using Pair by simp
also have "... = 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
finally show ?thesis by simp
qed
finally show ?thesis
qed
finally show ?thesis by simp
qed
qed
qed
qed
ultimately show ?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)
show "I ≠ UNIV"
using assms not_arr_null by blast
show ⟶ (∃a. has_as_coproduct J D a)"
using assms coproduct_cocone_coprodX by blast
qed
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 "small I" and "A ∈ I → Collect ide" and "I ⊆ Collect arr"
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" 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 "Fun (cotupleX I c A F) =
(λx. if x ∈ Set (coprodX I A)
then Fun (F (fsby (metis comp_cod_arr in_homE e seqI)
(snd (OUT (∪i∈I. {i} × Set (A i)) x))
else null)"
using assms Coproducts.Fun_cotupleX app_mkarr Coproducts.cotupleX_def by auto
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
"Coequalizers"
text‹
In this section we show that a sets category has coequalizers of parallel pairs
of arrows. For this, we need to assume that the set of arrows of the category
embeds the set of all its small subsets. The reason we need this assumption is to
make it possible to obtain an object corresponding to the set of equivalence classes
that results from the quotient construction.
close
locale sets_cat_with_powering =
sets_cat sml C +
powering sml \<open exp b c¬
for sml :: "'V set ==>
and C :: "'U comp" (infixr ‹⋅› 55)
locale coequalizers_in_sets_cat =
sets_cat_with_powering
for sml :: "'V set ==> bool"
and C :: "'U comp" (infixr ‹⋅› 55)
begin
text‹
The following defines the ``equivalence closure'' of a binary relation ‹r›
on a set ‹A›, and proves the characterization of it as the least equivalence relation
on ‹ have "FFun h x ∈
Isabelle distribution, though I did find a predicate version @{term equivclp}. ›
definition equivcl
where "equivcl A r ≡ SOME r'. r ⊆ r' ∧ equiv A r' ∧ (∀s'. r ⊆
lemma equivcl_props:
assumes "r ⊆ A × A"
shows "∃r'. r ⊆ r' ∧ equiv A r' ∧ (∀s'. r ⊆ s' ∧ equiv A s' ⟶ r' ⊆ s')"
and "r ⊆ equivcl A r" and "equiv A (equi emma iscar:
and "∧\and qui As ==> s'"
proof -
have 1: "equiv A (A × A)"
using refl_on_def trans_on_def
by (intro equivI symI) auto
show 2: "∃r'. r ⊆ r' ∧ equiv A r' ∧ (∀s'. r ⊆ s' ∧ equiv A s' ⟶ r' ⊆contex stsca_wt_tulig
proof -
let ?r' = "∩ {s. equiv A s ∧ r ⊆ s}"
have "r ⊆ ?r'"
by blast
moreover have "∀s'. r ⊆ s' ∧ equiv A s' ⟶ ?r' ⊆ s'"
by blast
moreover have "equiv A ?r'"
using assms 1
apply (intro equivI symI transI refl_onI)
apply auto[4]
apply (simp add: equiv_def refl_on_def)
apply (meson equiv_def symD)
by (meson equivE transE)
ultimately show ?thesis by blast
qed
have "r ⊆y. y ∈ OUT (Exp a b) (IN (Exp a b) ) = "
(∀s'. r ⊆ s' ∧ equiv A s' ⟶ equivcl A r ⊆ s')"
unfolding equivcl_def
using 2 someI_ex [of "λr'. r ⊆ r' ∧ equiv A r' ∧ (∀s'. r ⊆ s' ∧ equiv A s' ⟶ r' ⊆ s')"]
by fastforce
thus "r ⊆ equivcl A r" and "equiv A (equivcl A r)"
and "∧s'. r ⊆ s' ∧ equiv A s' ==> equivcl A r ⊆ s'"
by auto
qed
text‹
The elements of the codomain of the coequalizer of ‹f› and ‹g› are the equivalence
classes of the least equivalence relation on ‹Set (cod f)› that relates ‹f ⋅ x›
(metis (no_types, li) HO.ext Expos.exp_def Expos.ide_exp(2) bij_betw_inv_into_r) ›
abbreviation Cod_coeq :: "'U ==> 'U ==> 'U set set"
where "Cod_coeq f g ≡ (λy. (equivcl (Set (cod f))
((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) `` {y})) ` Set (cod f)"
lemma small_Cod_coeq:
assumes "par f g"
shows "small (Cod_coeq f g)"
using assms ide_cod small_Set by blast
lemma embeds_Cod_coeq:
assumes "par f g"
shows "embeds (Cod_coeq f g)"
and "Cod_coeq f g ⊆ Pow (Set (cod f))"
proof -
show 1: "Cod_coeq f g ⊆ Pow (Set (cod f))"
proof -
let ?r = "(λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)"
have "?r ⊆ Set (cod f) × Set (cod f)"
using assms by auto
hence "equivcl (Set (cod f)) ?r ⊆ Set (cod f) × Set (cod f)"
using equivcl_props(3)
by (metis (no_types, lifting) Sigma_cong equiv_type)
thus ?thesis by blast
qed
show "embeds (Cod_coeq f g)"
proof -
have "Cod_coeq f g ⊆ {X. X ⊆ Collect arr ∧ small X}"
proof -
have "Cod_coeq f g ⊆ {X. X ⊆ Collect arr}"
using 1 by blast
moreover have "Cod_coeq f g ⊆ {X. small X}"
using assms 1 small_Set smaller_than_small
by (metis (no_types, lifting) HOL.ext Collect_mono Pow_def
ide_cod subset_trans)
ultimately show ?thesis by blast
qed
thus ?thesis
embeds
by (meson image_mono inj_on_subset subset_trans)
qed
qed
definition cod_coeq
where "cod_coeq f g ≡ mkide (Cod_coeq f g)"
lemma ide_cod_coeq:
assumes "par f g"
shows "ide (cod_coeq f g)"
and "bij_betw (OUT (Cod_coeq f g)) (Set (cod_coeq f g)) (Cod_coeq f g)"
and "bij_betw (IN (Cod_coeq f g)) (Cod_coeq f g) (Set (cod_coeq f g))"
and "∧x. x ∈ Set (cod_coeq f g) ==> OUT (Cod_coeq f g) x ∈ Cod_coeq f g"
and "∧y. y ∈ Cod_coeq f g ==> IN (Cod_coeq f g) y ∈ Set (cod_coeq f g)"
and "∧x. x ∈ Set (cod_coeq f g) ==> IN (Cod_coeq f g) (OUT (Cod_coeq f g) x) = x"
and "🪙
proof -
have "(λx. {f ⋅ x, g ⋅ x}) ` Set (dom f) ⊆ Pow (Set (cod f))"
using assms by auto
show "ide (cod_coeq f g)"
using small_Cod_coeq embeds_Cod_coeq assms cod_coeq_def by auto
show 1: "bij_betw (OUT (Cod_coeq f g)) (Set (cod_coeq f g)) (Cod_coeq f g)"
unfolding cod_coeq_def
using assms ide_mkide bij_OUT small_Cod_coeq [of f g] embeds_Cod_coeq [of f g]
by auto
show 2: "bij_betw (IN (Cod_coeq f g)) (Cod_coeq f g) (Set (cod_coeq f g))"
unfolding cod_coeq_def
using assms ide_mkide bij_OUT bij_IN small_Cod_coeq [of f g] embeds_Cod_coeq
by fastforce
show "∧x. x ∈ Set (cod_coeq f g) ==> OUT (Cod_coeq f g) x ∈ Cod_coeq f g"
using 1 bij_betwE by blast
show "∧
using 2 bij_betwE by blast
show "∧x. x ∈ Set (cod_coeq f g) ==> IN (Cod_coeq f g) (OUT (Cod_coeq f g) x) = x"
by (metis (no_types, lifting) HOL.ext "1" bij_betw_inv_into_left cod_coeq_def)
show "∧y. y ∈ Cod_coeq f g ==> OUT (Cod_coeq f g) (IN (Cod_coeq f g) y) = y"
by (metis (no_types, lifting) HOL.ext "1" bij_betw_inv_into_right cod_coeq_def)
qed
definition Coeq
where "Coeq f g ≡ λy. if y ∈ Set (cod f)
then IN (Cod_coeq f g)
(equivcl (Set (cod f))
((λx. (f ⋅ x, g ⋅
else null"
lemma Coeq_in_Hom [intro]:
assumes "par f g"
shows "Coeq f g ∈ Hom (cod f) (cod_coeq f g)"
proof
show "Coeq f g ∈ Set (cod f) → Set (cod_coeq f g)"
proof
fix y
assume y: "y ∈ Set (cod f)"
have "Coeq f g y = IN (Cod_coeq f g)
(equivcl (Set (cod f))
((λ x,x, g ⋅
unfolding Coeq_def
using y by simp
moreover have "... ∈ Set (cod_coeq f g)"
using assms ide_cod_coeq(5) y by blast
ultimately show "Coeq f g y ∈ Set (cod_coeq f g)" by simp
qed
show "Coeq f g ∈ {F. ∀x. x ∉ Set (cod f) ⟶ F x = null}"
unfolding Coeq_def by simp
qed
definition coeq
where "coeq f g ≡ mkarr (cod f) (cod_coeq f g) (Coeq f g)"
lemma coeq_in_hom [intro, simp]:
assumes "par f g"
shows "«
using assms ide_cod_coeq(1) Coeq_in_Hom
by (unfold coeq_def, intro mkarr_in_hom) auto
lemma coeq_simps [simp]:
assumes "par f g"
shows "arr (coeq f g)" and "dom (coeq f g) = cod f" and "cod (coeq f g) = cod_coeq f g"
using assms coeq_in_hom by blast+
lemma Fun_coeq:
assumes "par f g"
shows "Fun (coeq f g) = Coeq f g"
using assms Fun_mkarr coeq_def coeq_simps(1) by presburger
lemma coeq_coequalizes:
assumes "par f g"
shows "coeq f g ⋅ f = coeq f g ⋅ g"
proof (intro arr_eqI)
show par: "par (coeq f g ⋅ f) (coeq f g ⋅ g)"
using assms by auto
show "Fun (coeq f g ⋅ f) = Fun (coeq f g ⋅ g)"
proof
fix x
show "Fun (coeq f g ⋅ f) x = Fun (coeq f g ⋅ g) x"
proof (cases "x ∈ Set (dom f)")
case False
show ?thesis
using assms False Fun_coeq Fun_def by simp
next
case True
show ?thesis
proof -
have "Fun (coeq f g ⋅ f) x = Fun (coeq f g) (Fun f x)"
using assms Fun_comp comp_in_homI coeq_in_hom comp_assoc by auto
also have "... = Coeq f g (Fun f x)"
using assms True Fun_coeq
by (metis (full_types, lifting))
also have "... = IN (Cod_coeq f g)
(equivcl (Set (cod f))
((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) `` {f ⋅ x})"
unfolding Coeq_def
using True assms Fun_def by auto
also have "... = IN (Cod_coeq f g)
(equivcl (Set (cod f))
((λ
proof
have "equivcl (Set (cod f)) ((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) `` {f ⋅ x} =
equivcl (Set (cod f)) ((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) `` {g ⋅ x}"
using assms True
equivcl_props(2-3) [of "(λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)" "Set (cod f)"]
equiv_class_eq_iff
[of "Set (cod f)"
"equivcl (Set (cod f)) ((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f))"
"f ⋅ x" "g ⋅ x"]
by auto
thus ?thesis by simp
qed
also have "... = Coeq f g (Fun g x)"
unfolding Coeq_def
using True assms Fun_def by auto
also have "... = Fun (coeq f g) (Fun g x)"
using assms True Fun_coeq
by (metis (full_types, lifting))
using assms Fun_comp comp_in_homI coeq_in_hom comp_assoc by auto
finally show ?thesis by blast
qed
qed
qed
qed
lemma Coeq_surj:
assumes "par f g" and "Set (cod f) ≠ {}" and "y ∈ Set (cod_coeq f g)"
shows "∃x. x ∈ Set (cod f) ∧ Coeq f g x = y"
proof -
have 1: "(∪x∈Set (dom f). {f ⋅ x, g ⋅ x}) ⊆ Set (cod f)"
using assms by auto
have y: "OUT (Cod_coeq f g) y ∈ Cod_coeq f g"
using assms ide_cod_coeq(2) [of f g] bij_betwE by blast
obtain x where x: "x ∈ Set (cod f) ∧
OUT (Cod_coeq f g) y =
(SSet (codf) ((\lambda( \<>
a b blas
hence 2: "x ∈ OUT (Cod_coeq f g) y"
proof -
have "(λx. (f ⋅ x, g ⋅ x)) ` Set (dom f) ⊆ Set (cod f) × Set (cod f)"
using assms by auto
hence "x ∈ equivcl (Set (cod f)) ((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) ``{x}"
using assms x equivcl_props(3) [of "(λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)" "Set (cod f)"]
equiv_class_self
by (metis (lifting))
thus ?thesis
using x by argo
qed
have "Coeq f g x = y"
proof -
have "OUT (Cod_coeq f g) (Coeq f g x) =
OUT (Cod_coeq f g)
(IN (Cod_coeq f g)
(equivcl (Set (cod f)) ((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) ``{x}))"
unfolding Coeq_def
using x by presburger
also have "... = equivcl (Set (cod f)) ((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) ``{x}"
using assms x y ide_cod_coeq(7) by (metis (lifting))
also have "... = OUT (Cod_coeq f g) y"
proof -
have "OUT (Cod_coeq f g) y ∈ Cod_coeq f g"
using assms x by force
(*
* x ∈ OUT (Cod_coeq f g) y, which is a class of the coequalizing equivalence.
* Therefore the class of x in that equivalence is the same class.
*) thus ?thesis using assms x 12by blast qed finallyhave"IN (Cod_coeq f g) (OUT (Cod_coeq f g) (Coeq f g x)) = IN (Cod_coeq f g) (OUT (Cod_coeq f g) y)" by simp thus ?thesis using assms x y ide_cod_coeq(6) cod_coeq_def Coeq_def by (metis (lifting)) qed thus"∃x. x ∈ Set (cod f) ∧ Coeq f g x = y" using x by blast qed
lemma coeq_is_coequalizer: assumes"par f g"and"Set (cod f) ≠ shows "has_as_coequalizer f g (coeq f g)" proof show "par f g" by fact show "seq (coeq f g) f" using assms by auto show "coeq f g ⋅ f = coeq f g ⋅ g" using assms coeq_coequalizes by blast show "∧q'. [seq q' f; q' ⋅ f = q' ⋅ g]==>∃!h. h ⋅ coeq f g = q'" proof -
assume seq: "seq q' f" and eq: "q' proof let ?H = "λy. if y ∈ Set (cod_coeq f g) then q' ⋅ (SOME x. x ∈ Set (cod f) ∧ Coeq f g x = y) else null" have H: "?H ∈ Hom (cod_coeq f g) (cod q')" proof show"?H ∈ Set (cod_coeq f g) → Set (cod q')" proof fix y assume y: "y ∈ Set (cod_coeq f g)" have"?H y = q' ⋅ (SOME x. x ∈ Set (cod f) ∧ Coeq f g x = y)" using y by simp moreoverhave"... ∈ Set (cod q')" using assms y someI_ex [of "λx. x ∈ Set (cod f) ∧ Coeq f g x = y"]
Coeq_surj seq in_homI by blast ultimatelyshow"?H y ∈ Set (cod q')"by simp qed show"?H ∈ {F. ∀x. x ∉ Set (cod_coeq f g) ⟶ F x = null}" by simp qed let ?h = "mkarr (cod_coeq f g) (cod q') ?H" have h: "«?h : cod_coeq f g → cod q'¬" using assms H ide_cod_coeq seq by (intro mkarr_in_hom) auto have *: "?h ⋅ coeq f g = q'" proof (intro arr_eqI) show par: "par (?h ⋅ using assms h seq by fastforce show "Fun (?h ⋅ coeq f g) = Fun q'" proof - have "Fun (?h ⋅ using Fun_comp par by blast alsohave"... = ?H ∘ Coeq f g" using assms h Fun_coeq Fun_mkarr arrI by auto alsohave"... = Fun q'" proof fix y show b proof (cases "y ∈ Set (cod f)") case False show ?thesis unfolding Coeq_def using False seq Fun_def by auto next case True have"(?H ∘ q' ⋅ (SOME x'. x' ∈ Set (cod f) ∧ Coeq f g x' = Coeq f g y)" using Coeq_in_Hom True assms(1) by auto alsohave"... = q' ⋅ y"
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 let ?e = "(λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)" have e: "?e ⊆ Set (cod f) × Set (cod f)" using assms by auto let ?E = "equivcl (Set (cod f)) ?e" let ?E' = "{p ∈ Set (cod f) × Set (cod f). q' ⋅ have "?E⊆ ?E'" proof - have "equiv (Set (cod f)) ?E'" by (intro equivI symI) (auto simp add: refl_on_def trans_on_def) moreover have "(λx. (f ⋅ x, g ⋅ x)) ` Set (dom f) ⊆ ?E'" case True have "∧x. x ∈ Set (dom f) ==> (f ⋅ x, g ⋅ x) ∈ ?E'" proof - fix x assume x: "x ∈ Set (dom f)" have "(f ⋅ x, g ⋅ x) ∈ Set (cod f) ×using using assms x by auto moreoverhave"q' ⋅ f ⋅ x = q' ⋅ g ⋅ x" using eq comp_assoc by metis ultimatelyshow"(f ⋅ x, g ⋅ x) ∈ ?E'"by fastforce qed thus ?thesis by (meson image_subsetI) qed ultimatelyshow ?thesis by (meson equiv_type equivcl_props(4) subset_trans) qed moreoverhave"∧y'. y' ∈ Set (cod f) ∧ Coeq f g y' = Coeq f g y ==> (y', y) ∈ ?E"<>l.\t^?[b]\cdot> l''=h∧l ?l" proof - fix y' by me lift) <> \cdot? k\close s' m) assume' "'< Sety" have eq: "equivcl (Set (cod f)) ?e `` {y'} =
equivcl (Set (cod f)) ?e `` {y}" using assms(1) True y' ide_cod_coeq(7) [of f g] unfolding Coeq_def by (metis (mono_tags, lifting) image_eqI) moreover have "y' ∈ equivcl (Set (cod f)) ?e `` {y'} ∧
y ∈ equivcl (Set (cod f)) ?e `` {y}" proof have 1: "equiv (Set (cod f)) (equivcl (Set (cod f)) ?e)" by (simp add: e equivcl_props(3)) show "y' ∈ equivcl (Set (cod f)) ?e `` {y'}" by (metis (lifting) 1 equiv_class_self y') show "y ∈ equivcl (Set (cod f)) ((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) `` {y}" y (meis no_t, li) 1 True e) qed ultimately show "(y', y) ∈ ?E" by blast qed ultimately have "∧y'. y' ∈ Set (cod f) ∧ Coeq f g y' = Coeq f g y ==> (y', y) ∈ ?E'" by (meson subsetD) thus ?thesis using [of "<lambda>y' y\in Setcodf <>Coeq = Coeqfgy by (metis (mono_tags, lifting) fst_conv mem_Collect_eq snd_conv) qed alsoproofcases Fun Set using finallyshow ?thesis by blast qed qed finallyshow ?thesis by blast qed qed moreoverhave"∧h'. h' ⋅ coeq f g = q' ==> h' = ?h" proof - fix h' assume h': "h' ⋅ coeq f g = q'" show"h' = ?h" proof (intro arr_eqI [of h']) show par: "par h' ?h" using h h' seq by (metis (lifting) calculation cod_comp seqE) show"Fun finally show ?thesis by blast proof - have 1: "Fun h' ∘ using assms h' * Fun_coeq Fun_comp seq seqE by (metis (lifting)) show proof fix z show"Fun h' z = Fun ?h z" proof (cases "z ∈ Set (cod_coeq f g)") case False show ?thesis using assms False h' par Fun_def by auto next case True obtain x where x: "x ∈ Set (cod f) ∧ Coeq f g x = z" using assms True Coeq_surj by blast show ?thesis using True x h' 1 * Fun_comp comp_apply by (metis (lifting)) qed qed qed qed qed ultimatelyshow"∃!h. h ⋅ coeq f g = q'"by auto qed qed
lemma has_coequalizers assumes"par f g" shows"∃e. has_as_coequalizer f g e" proof (cases "Set (cod f) = {}") case False show ?thesis using assms False coeq_is_coequalizer by blast next case True have"f = g" using assms True by (metis arr_eqI' comp_in_homI empty_Collect_eq in_homI) hence"has_as_coequalizer f g (cod f)" using assms comp_arr_dom comp_cod_arr seqE by (intro has_as_coequalizerI) metis+ thus ?thesis by blast qed
end
subsection"Exported Notions"
context sets_cat_with_powering begin
interpretation Coeq: coequalizers_in_sets_cat sml C ..
lemma coequalizer_comparison_map_props: assumes"par f g" shows"bij_betw (OUT (Cod_coeq f g)) (Set (cod (coeq f g))) (Cod_coeq f g)" and"bij_betw (IN (Cod_coeq f g)) (Cod_coeq f g) (Set (cod (coeq f g)))" and"∧x. x ∈ Set (cod (coeq f g)) ==> OUT (Cod_coeq f g) x ∈ Cod_coeq f g" and"∧y. y ∈ Cod_coeq f g ==> IN (Cod_coeq f g) y ∈ Set (cod (coeq f g))" and"∧x. x ∈ Set (cod (coeq f g)) ==> IN (Cod_coeq f g) (OUT (Cod_coeq f g) x) = x" and"∧y. y ∈ Cod_coeq f g ==> OUT (Cod_coeq f g) (IN (Cod_coeq f g) y) = y" using assms Coeq.ide_cod_coeq by auto
lemma coeq_is_coequalizer: assumes"par f g"and"Set (cod f) ≠ {}" shows"has_as_coequalizer f g (coeq f g)" using assms Coeq.coeq_is_coequalizer by blast
text‹
Since the fact ‹Fun_coeq› below is not very useful without the notions used in
stating it, the function ‹equivcl› and characteristic fact ‹equivcl_props› are
also exported here. It would be better if ‹Fun_coeq› could be expressed completely
in terms of existing notions from the library. ›
definition equivcl where"equivcl ≡ Coeq.equivcl"
lemma equivcl_props: assumes"r ⊆ shows "∃r'. r ⊆ r' ∧ equiv A r' ∧ (∀s'. r ⊆ s' ∧ equiv A s' ⟶ r' ⊆ s')" and "r ⊆ equivcl definition and"∧s'. r ⊆ s' ∧ equiv A s' ==> equivcl A r ⊆ s'" using assms Coeq.equivcl_props [of r A] unfolding equivcl_def by auto
lemma Fun_coeq: assumes"par f g" shows"Fun (coeq f g) = (λ then IN (Cod_coeq f g) (equivcl (Set (cod f)) ((λx. (f ⋅ x, g ⋅ x)) ` Set (dom f)) `` {y}) else null)" using assms Coeq.Fun_coeq Coeq.Coeq_def unfolding equivcl_def by auto
lemma has_coequalizers: assumes"par f g" shows"∃e. has_as_coequalizer f g e" using assms Coeq.has_coequalizers by blast
end
section"Exponentials"
text‹
In this section we show that the category is cartesian closed. › locale exponentials_in_sets_cat =
sets_cat_with_tupling sml C for sml :: "'V set ==> bool" and C :: "'U comp" (infixr‹⋅›55) begin
abbreviation app :: "'U ==> 'U ==> 'U" where"app f ≡ inv_into SEF some_embedding_of_small_functions f"
abbreviation Exp :: "'U ==> 'U ==> ('U ==> 'U) set" where"Exp a b ≡ {F. F ∈ Set a → Set b ∧ (∀have f: \guillemotleft : \^>N → a¬"
definition exp :: "'U ==> 'U ==> 'U" where"exp a b ≡ mkide (Exp a b)"
lemma memb_Exp_popular_value: assumes"ide a"and"ide b"and"F ∈ Exp a b" and"popular_value F y" 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
show"small (range F)" proof - have"range F ⊆ Set b ∪ {null}" using assms by blast moreoverhave"proof using assms small_Set by auto ultimately show ?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 ⊆ 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 ⊆ 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 moreover have "∃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) ultimately show ?thesis using F by blast qed thus ?thesis using F by auto qed moreover have "range F ⊆ Set b ∪ {null}" 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 have "Exp a b ⊆ {F. small_function F ∧ SF_Dom F ⊆ UNIV ∧ range F ⊆ Set b ∪ {null}}" 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)" bij OU ( ab) (et ( ab))(Ex ab)" 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 moreoverhave"embeds (Exp a b)" using assms embeds_Exp by blast ultimatelyshow"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))"
qed
abbreviation Eval where"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)"
definition eval where"eval b c ≡ mkarr (prod (exp b c) b) c (Eval b c)"
lemma eval_in_hom [intro, simp]: assumes"ide b"and"ide c" 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 (pr0 (exp b c) b) fx)" using fx by simp moreover have "... ∈ 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) fxproof 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 java.lang.NullPointerException using assms(1,2) fx ide_exp(1) Fun_def by auto ultimately show ?thesis by blast qed ultimately show "EvalTupling" qed 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" using assms eval_in_hom by blast+
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 thenIN (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 "«f : prod a b → c¬" shows "«Curry a b c f : a → exp b c¬" and "Fun (Curry a b c f) =
(λx. if x ∈ Set a thenIN (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 thenIN (Exp b c) (λy. if y ∈ Set b then C f (tuple x y) else null)
else null)" using ‹«Curry a b c f : a → exp b c¬› arrI assms(4) Curry_def app_mkarr by auto qed
lemma Curry_simps [simp]: assumes "ide a" and "ide b" and "ide c" and "«f : prod a b → c¬" shows "arr (Curry a b c f)" and "dom (Curry a b c f) = a" and "cod (Curry a b c f) = exp b c" using assms Curry_in_hom by blast+
lemma Fun_Curry: assumes "ide a" and "ide b" and "ide c" and "«f : prod a b → c¬" shows "Fun (Curry a b c f) =
(λx. if x ∈ Set a thenIN (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 "category_with_terminal_object C" ..
interpretation elementary_cartesian_closed_category C pr0 pr1‹1?› some_terminator exp eval Curry proof show "∧b c. [ide b; ide c]==>«eval b c : prod (exp b c) b → c¬" 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 using False Fun_def by (metis g in_homE par) 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 thenIN (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 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 thus ?thesis 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 assms Expos.ide_exp by blast
lemma exp_comparison_map_props: assumes "ide a" and "ide b" shows "OUT (Exp a b) ∈ Set (exp a b) → Exp a b" and "IN (Exp a b) ∈ Exp a b → Set (exp a b)" and "∧x. x ∈ Set (exp a b) ==>IN (Exp a b) (OUT (Exp a b) x) = x" and "∧y. y ∈ Exp a b ==> OUT (Exp a b) (IN (Exp a b) y) = y" 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 - show "OUT (Exp a b) ∈ Set (exp a b) → Exp a b" using assms Expos.ide_exp(2) [of a b] bij_betw_def bij_betw_imp_funcset by simp thus "IN (Exp a b) ∈ Exp a b → Set (exp a b)" using assms Expos.exp_def by (metis (no_types, lifting) HOL.ext Expos.ide_exp(2) bij_betw_imp_funcset bij_betw_inv_into) show "∧x. x ∈ Set (exp a b) ==>IN (Exp a b) (OUT (Exp a b) x) = x" using assms by (metis (no_types, lifting) HOL.ext Expos.exp_def Expos.ide_exp(2) bij_betw_inv_into_left) show "∧y. y ∈ Exp a b ==> OUT (Exp a b) (IN (Exp a b) y) = y" using assms by (metis (no_types, lifting) HOL.ext Expos.exp_def Expos.ide_exp(2) bij_betw_inv_into_right) show "bij_betw (OUT (Exp a b)) (Set (exp a b)) (Exp a b)" using assms Expos.exponentials_in_sets_cat_axioms exponentials_in_sets_cat.ide_exp(2) by fastforce show "bij_betw (IN (Exp a b)) (Exp a b) (Set (exp a b))" using assms Expos.exponentials_in_sets_cat_axioms exponentials_in_sets_cat.ide_exp(3) by fastforce qed
abbreviation Eval where "Eval ≡ Expos.Eval"
abbreviation eval where "eval ≡ Expos.eval"
lemma eval_in_hom [intro, simp]: assumes "ide b" and "ide c" shows "«eval b c : prod (exp b c) b → c¬" using assms Expos.eval_in_hom by blast
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" using assms Expos.eval_simps by auto
lemma Fun_eval: assumes "ide b" and "ide c" shows "Fun (eval b c) = Eval b c" unfolding eval_def using assms Expos.Fun_eval [of b c] by simp
abbreviation Curry where "Curry ≡ Expos.Curry"
lemma Curry_in_hom [intro, simp]: assumes "ide a" and "ide b" and "ide c" and "«f : prod a b → c¬" shows "«Curry a b c f : a → exp b c¬" using assms Expos.Curry_in_hom by auto
lemma Curry_simps [simp]: assumes "ide a" and "ide b" and "ide c" and "«f : prod a b → c¬" shows "arr (Curry a b c f)" and "dom (Curry a b c f) = a" and "cod (Curry a b c f) = exp b c" using assms Expos.Curry_simps by auto
lemma Fun_Curry: assumes "ide a" and "ide b" and "ide c" and "«f : prod a b → c¬" shows "Fun (Curry a b c f) =
(λx. if x ∈ Set a thenIN (Exp b c) (λy. if y ∈ Set b then C f (tuple x y) else null)
else null)" using assms Expos.Fun_Curry by blast
theorem is_cartesian_closed: shows "elementary_cartesian_closed_category C pr0pr11? some_terminator exp eval Curry" 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 with subobject classifier. ›
context category begin
text‹ A subobject classifier is a monomorphism ‹tt› from a terminal object into an object ‹Ω›, which we may regard as an ``object of truth values'', such that for every monomorphism ‹m› there exists a unique arrow ‹χ : cod m → Ω›, such that ‹m› is given by the pullback of ‹tt› along ‹χ›. ›
definition subobject_classifier where "subobject_classifier tt ≡
mono tt ∧ terminal (dom tt) ∧
(∀m. mono m ⟶
(∃!χ. «χ : cod m → cod tt¬∧
has_as_pullback tt χ (THE f. «f : dom m → dom tt¬) m))"
lemma subobject_classifierI [intro]: assumes "«tt : one → Ω¬" and "terminal one" and "mono tt" and "∧m. mono m ==>∃!χ. «χ : cod m → Ω¬∧
has_as_pullback tt χ (THE f. «f : dom m → one¬) m" shows "subobject_classifier tt" using assms subobject_classifier_def by blast
lemma subobject_classifierE [elim]: assumes "subobject_classifier tt" and "[mono tt; terminal (dom tt); ∧m. mono m ==>∃!χ. «χ : cod m → cod tt¬∧
has_as_pullback tt χ (THE f. «f : dom m → dom tt¬) m] ==> T" shows T using assms subobject_classifier_def by force
sublocale category_with_terminal_object using category_axioms category_with_terminal_object.intro category_with_terminal_object_axioms_def has_subobject_classifier_ax by force
end
context sets_cat_with_bool begin
text‹ For a sets category, the two-point object ‹\<two>› (which exists in the current context @{locale sets_cat_with_bool}) serves as the object of truth values. The subobject classifier will be the arrow ‹tt : 1?→\<two>›.
Here we define a mapping ‹χ› that takes a monomorphism ‹m› to a corresponding ``predicate'' ‹χ m : cod m →\<two>›. ›
abbreviation Chi where "Chi m ≡ λy. if y ∈ Set (cod m) then if y ∈Fun m ` Set (dom m) then tt else ff
else null"
definition χ :: "'U ==> 'U" where "χ m ≡ mkarr (cod m) \<two> (Chi m)"
lemma χ_in_hom [intro, simp]: assumes "«m : b → a¬" and "mono m" shows "«χ m : a →\<two>¬" using assms ide_two ff_in_hom tt_in_hom χ_def mkarr_in_hom by auto
lemma χ_simps [simp]: assumes "«m : b → a¬" and "mono m" shows "arr (χ m)" and "dom (χ m) = a" and "cod (χ m) = \<two>" using assms χ_in_hom by blast+
lemma Fun_χ: assumes "«m : b → a¬" and "mono m" shows "Fun (χ m) = Chi m" unfolding χ_def using assms Fun_mkarr by (metis (no_types, lifting) χ_def χ_in_hom arrI)
lemma bij_Fun_mono: assumes "«m : b → a¬" and "mono m" shows "bij_betw (Fun m) (Set b) {y. y ∈ Set a ∧ χ m ⋅ y = tt}" proof - have "{y. y ∈ Set a ∧ χ m ⋅ y = tt} = {y. y ∈ Set a ∧ Chi m y = tt}" proof - have "∧y. y ∈ Set a ==> χ m ⋅ y = tt ⟷ Chi m y = tt" by (metis Fun_χ Fun_arr χ_in_hom assms(1,2)) thus ?thesis by blast qed moreover have "bij_betw (Fun m) (Set b) {y. y ∈ Set a ∧ Chi m y = tt}" unfolding bij_betw_def using assms mono_char tt_def ff_def tt_ne_ff Fun_def by auto ultimately show ?thesis by simp qed
lemma has_subobject_classifier: shows "subobject_classifier tt" proof show "«tt : 1?→\<two>¬" using tt_in_hom by blast show "terminal 1?" using terminal_some_terminal by blast show "mono tt" using mono_tt by blast fix m assume m: "mono m" define b where b_def: "b = dom m" define a where a_def: "a = cod m" have m: "«m : b → a¬∧ mono m" using m a_def b_def mono_implies_arr by blast have bij_Fun_m: "bij_betw (Fun m) (Set b) {y ∈ Set a. χ m ⋅ y = tt}" using m bij_Fun_mono by presburger have "∃!χ. «χ : a →\<two>¬∧ has_as_pullback tt χ t?[b] m" proof - have 1: "«χ m : a →\<two>¬" using m χ_in_hom by blast moreover have 2: "has_as_pullback tt (χ m) t?[b] m" proof show cs: "commutative_square tt (χ m) t?[b] m" proof show "cospan tt (χ m)" by (metis (lifting) χ_in_hom arr_iff_in_hom m in_homE mono_char tt_simps(1,3)) show span: "span t?[b] m" using m by auto show "dom tt = cod t?[b]" using m by auto show "tt ⋅t?[b] = χ m ⋅ m" proof (intro arr_eqI) show par: "par (tt ⋅t?[b]) (χ m ⋅ m)" using m ‹span t?[b] m› a_def b_def by auto show "Fun (tt ⋅t?[b]) = Fun (χ m ⋅ m)" proof fix x show "Fun (tt ⋅t?[b]) x = Fun (χ m ⋅ m) x" proof (cases "x ∈ Set b") case False show ?thesis using False par m Fun_def by auto next case True have "Fun (tt ⋅t?[b]) x = Fun tt (Funt?[b] x)" using Fun_comp par by auto also have "... = (λx. if x ∈ Set 1?then tt else null)
(if x ∈ Set b then1? else null)" using Fun_some_terminator Fun_tt span b_def ide_dom by auto also have "... = tt" using True ide_in_hom ide_some_terminal by auto also have "... = (λx. if x ∈ Set a then tt else null) (Fun m x)" using m True Fun_def by (metis CollectD CollectI in_homE comp_in_homI) also have "... = Chi m (Fun m x)" using app_mkarr m Fun_def by auto also have "... = Fun (χ m) (Fun m x)" using m Fun_χ [of m b a] by simp also have "... = Fun (χ m ⋅ m) x" by (metis comp_eq_dest_lhs par Fun_comp) finally show ?thesis by blast qed qed qed qed show "∧h k. commutative_square tt (χ m) h k ==>∃!l. t?[b] ⋅ l = h ∧ m ⋅ l = k" proof - fix h k assume hk: "commutative_square tt (χ m) h k" have inj_m: "inj_on (Fun m) (Set b)" using m mono_char by blast have kx: "∧x. x ∈ Set (dom h) ==> k ⋅ x ∈ {y ∈ Set a. χ m ⋅ y = tt}" proof - fix x assume x: "x ∈ Set (dom h)" have "χ m ⋅ k ⋅ x = tt ⋅ h ⋅ x" using hk comp_assoc by (metis (no_types, lifting) commutative_squareE) hence "χ m ⋅ k ⋅ x = tt" by (metis (lifting) IntI Int_Collect comp_arr_dom comp_in_homI' in_homE commutative_squareE hk ide_some_terminal ide_in_hom some_trm_eqI tt_simps(2) x) thus "k ⋅ x ∈ {y ∈ Set a. χ m ⋅ y = tt}" using hk comp_assoc by (metis (mono_tags, lifting) "1" dom_comp in_homE in_homI mem_Collect_eq seqE tt_simps(1,2)) qed let ?l = "mkarr (dom h) b
(λx. if x ∈ Set (dom h) then inv_into (Set b) (Fun m) (k ⋅ x) else null)" have l: "«?l : dom h → b¬" proof (intro mkarr_in_hom) show "ide (dom h)" using hk ide_dom by blast show "ide b" using m by auto show "(λx. if x ∈ Set (dom h) then inv_into (Set b) (Fun m) (k ⋅ x) else null) ∈ Hom (dom h) b" proof show "(λx. if x ∈ Set (dom h) then inv_into (Set b) (Fun m) (k ⋅ x) else null) ∈ Set (dom h) → Set b" proof fix x assume x: "x ∈ Set (dom h)" have "inv_into (Set b) (Fun m) (k ⋅ x) ∈ Set b ∧ Fun m (inv_into (Set b) (Fun m) (k ⋅ x)) = k ⋅ x" using x bij_Fun_m kx by (meson bij_betw_apply bij_betw_inv_into bij_betw_inv_into_right) thus "(if x ∈ Set (dom h) then inv_into (Set b) (Fun m) (k ⋅ x) else null) ∈ Set b" using x by presburger qed show "(λx. if x ∈ Set (dom h) then inv_into (Set b) (Fun m) (k ⋅ x) else null) ∈ {F. ∀x. x ∉ Set (dom h) ⟶ F x = null}" by auto qed qed have "t?[b] ⋅ ?l = h" by (metis (lifting) commutative_square_def comp_cod_arr elementary_category_with_terminal_object.trm_naturality elementary_category_with_terminal_object.trm_one extends_to_elementary_category_with_terminal_object hk in_homE l tt_simps(2)) moreover have "m ⋅ ?l = k" proof (intro arr_eqI) show par: "par (m ⋅ ?l) k" by (metis (no_types, lifting) HOL.ext χ_simps(2) m cod_comp dom_comp seqI' commutative_squareE hk in_homE l) show "Fun (m ⋅ ?l) = Fun k" proof fix x show "Fun (m ⋅ ?l) x = Fun k x" proof (cases "x ∈ Set (dom h)") case False show ?thesis using False par commutative_square_def Fun_def by auto next case True have "Fun (m ⋅ ?l) x = Fun m (Fun ?l x)" using True Fun_comp CollectI m comp_in_homI in_homE l comp_assoc par by fastforce also have "... = Fun m (inv_into (Set b) (Fun m) (k ⋅ x))" using True m app_mkarr l by auto also have "... = k ⋅ x" using True bij_Fun_m bij_betw_inv_into_right kx by force also have "... = Fun k x" using True hk Fun_def by fastforce finally show ?thesis by blast qed qed qed ultimately have 1: "t?[b] ⋅ ?l = h ∧ m ⋅ ?l = k" by blast moreover have "∧l'. t?[b] ⋅ l' = h ∧ m ⋅ l' = k ==> l' = ?l" using m l by (metis (lifting) ‹m ⋅ ?l = k› seqI' mono_cancel) ultimately show "∃!l. t?[b] ⋅ l = h ∧ m ⋅ l = k" by auto qed qed moreover have "∧χ'. «χ' : a →\<two>¬∧ has_as_pullback tt χ' t?[b] m ==> χ' = χ m" proof - fix χ' assume χ': "«χ' : a →\<two>¬∧ has_as_pullback tt χ' t?[b] m" show "χ' = χ m" proof (intro arr_eqI' [of χ']) show "«χ' : a →\<two>¬" using χ' by simp show "«χ m : a →\<two>¬" using "1" by force show "∧y. «y : 1?→ a¬==> χ' ⋅ y = χ m ⋅ y" proof - fix y assume y: "«y : 1?→ a¬" show "χ' ⋅ y = χ m ⋅ y" proof (cases "y ∈ Set a") case False show ?thesis using False y by blast next case True show ?thesis proof (cases "y ∈Fun m ` Set b") case True obtain x where x: "x ∈ Set b ∧ y = Fun m x" using True by blast have "χ' ⋅ y = χ' ⋅ m ⋅ x" using x y Fun_def by auto also have "... = tt ⋅1?" using χ' x Fun_def by (metis (no_types, lifting) HOL.ext Fun_some_terminator m commutative_square_def has_as_pullbackE ide_dom in_homE comp_assoc) also have "... = χ m ⋅ m ⋅ x" using 1 2 x χ_def app_mkarr m comp_arr_dom y Fun_def by auto also have "... = χ m ⋅ y" using x y Fun_def by auto finally show ?thesis by blast next case False have "χ' ⋅ y = ff" proof - have "χ' ⋅ y = tt ==> False" proof - assume 3: "χ' ⋅ y = tt" hence "commutative_square tt χ' 1? y" by (metis ‹«χ' : a →\<two>¬› commutative_squareI comp_arr_dom ideD(1,2,3) ide_some_terminal in_homE tt_simps(1,2,3) y) hence "∃x. x ∈ Set b ∧ m ⋅ x = y ∧t?[b] ⋅ x = 1?" using χ' has_as_pullbackE [of tt χ' "t?[b]" m] by (metis arr_iff_in_hom m dom_comp in_homE mem_Collect_eq seqE y) thus False using False χ' m Fun_def by auto qed thus ?thesis using Set_two χ' y by blast qed also have "... = χ m ⋅ y" using "1" False app_mkarr m y χ_def by auto finally show ?thesis by blast qed qed qed qed qed ultimately show "∃!χ. «χ : a →\<two>¬∧ has_as_pullback tt χ t?[b] m" by blast qed moreover have "t?[b] = (THE t. «t : dom m →1?¬)" using terminal_some_terminal the1_equality [of "λt. «t : dom m →1?¬"] by (simp add: b_def m mono_implies_arr some_terminator_def) ultimately show "∃!χ. «χ : cod m →\<two>¬∧
has_as_pullback tt χ (THE t. «t : dom m →1?¬) m" using m by auto qed
sublocale category_with_subobject_classifier using has_subobject_classifier by unfold_locales auto
text‹ In this section we show that a sets category has a natural numbers object, assuming that the smallness notion is such that the set of natural numbers is small, and assuming that that the collection of arrows admits lifting, so that the category has infinitely many arrows. ›
locale sets_cat_with_infinity = sets_cat sml C + small_nat sml + lifting ‹Collect arr› for sml :: "'V set ==> bool" and C :: "'U comp" (infixr ‹⋅› 55) begin
lemma ide_nat: shows "ide N" and "bij_betw (OUT (UNIV :: nat set)) (Set N) (UNIV :: nat set)" and "bij_betw (IN (UNIV :: nat set)) (UNIV :: nat set) (Set N)" using small_nat embeds_nat bij_OUT bij_IN by auto
abbreviation Zero where "Zero ≡ λx. if x ∈ Set 1?thenIN (UNIV :: nat set) 0 else null"
lemma Zero_in_Hom: shows "Zero ∈ Hom 1?N" using Pi_I' bij_betwE ide_nat(3) by fastforce
definition zero where "zero ≡ mkarr 1?N Zero"
lemma zero_in_hom [intro, simp]: shows "«zero : 1?→N¬" using mkarr_in_hom [of "1?" "N"] Zero_in_Hom ide_nat(1) ide_some_terminal zero_def by presburger
lemma zero_simps [simp]: shows "arr zero" and "dom zero = 1?" and "cod zero = N" using zero_in_hom by blast+
lemma Fun_zero: shows "Fun zero = Zero" using zero_def app_mkarr zero_in_hom zero_simps(2) by auto
abbreviation Succ where "Succ ≡ λx. if x ∈ Set NthenIN (UNIV :: nat set) (Suc (OUT UNIV x)) else null"
lemma Succ_in_Hom: shows "Succ ∈ Hom NN" using Pi_I' bij_betwE ide_nat(3) by fastforce
definition succ where "succ ≡ mkarr NN Succ"
lemma succ_in_hom [intro]: shows "«succ : N→N¬" using Succ_in_Hom ide_nat(1) succ_def by auto
lemma succ_simps [simp]: shows "arr succ" and "dom succ = N" and "cod succ = N" using succ_in_hom by blast+
lemma Fun_succ: shows "Fun succ = Succ" using succ_def app_mkarr succ_in_hom succ_simps(2) by auto
lemma nat_universality: assumes "«Z : 1?→ a¬" and "«S : a → a¬" shows "∃!f. «f : N→ a¬∧ f ⋅ zero = Z ∧ f ⋅ succ = S ⋅ f" proof - let ?F = "λn. if n ∈ Set Nthen ((⋅) S ^^ OUT (UNIV :: nat set) n) Z else null" have F: "?F ∈ Hom N a" proof show "?F ∈ {F. ∀x. x ∉ Set (mkide (UNIV :: nat set)) ⟶ F x = null}" by simp show "?F ∈ Set N→ Set a" proof have 1: "∧k. ((⋅) S ^^ k) Z ∈ Set a" proof - fix k show "((⋅) S ^^ k) Z ∈ Set a" using assms by (induct k) auto qed fix n assume n: "n ∈ Set N" show "?F n ∈ Set a" using n 1 by auto qed qed let ?f = "mkarr N a ?F" have f: "«?f : N→ a¬" using mkarr_in_hom F assms(2) ide_nat(1) by auto have "«?f : N→ a¬∧ ?f ⋅ zero = Z ∧ ?f ⋅ succ = S ⋅ ?f" proof (intro conjI) show "«?f : N→ a¬" by fact show "?f ⋅ zero = Z" proof (intro arr_eqI) show par: "par (?f ⋅ zero) Z" using assms(1) f by fastforce show "Fun (?f ⋅ zero) = Fun Z" proof - have "Fun (?f ⋅ zero) = Fun ?f ∘Fun zero" using Fun_comp par by blast also have "... = ?F ∘ Zero" using Fun_mkarr Fun_zero par by fastforce also have "... = Fun Z" proof fix x show "(?F ∘ Zero) x = Fun Z x" proof (cases "x ∈ Set 1?") case False show ?thesis using False par Fun_def by auto next case True have "(?F ∘ Zero) x =
((⋅) S ^^ OUT (UNIV :: nat set) (IN (UNIV :: nat set) 0)) Z" using True bij_betw_imp_surj_on ide_nat(3) by fastforce also have "... = ((⋅) S ^^ 0) Z" using OUT_IN [of "UNIV :: nat set" "0 :: nat"] small_nat embeds_nat by simp also have "... = Fun Z x" using True Fun_def by (metis assms(1) comp_arr_dom funpow_0 ide_in_hom ide_some_terminal in_homE mem_Collect_eq some_trm_eqI) finally show ?thesis by blast qed qed finally show ?thesis by blast qed qed show "?f ⋅ succ = S ⋅ ?f" proof (intro arr_eqI) show par: "par (?f ⋅ succ) (S ⋅ ?f)" using assms(2) f by fastforce show "Fun (?f ⋅ succ) = Fun (S ⋅ ?f)" proof - have "Fun (?f ⋅ succ) = Fun ?f ∘Fun succ" using Fun_comp par by blast also have "... = Fun S ∘Fun ?f" proof fix x show "(Fun ?f ∘Fun succ) x = (Fun S ∘Fun ?f) x" proof (cases "x ∈ Set N") case False show ?thesis using False f Fun_def by auto next case True have "(Fun ?f ∘Fun succ) x = ?F (succ ⋅ x)" using True f app_mkarr [of "N" a _ "succ ⋅ x"] Fun_def by auto also have "... = ((⋅) S ^^ OUT UNIV (succ ⋅ x)) Z" using True f by auto also have "... = ((⋅) S ^^ Suc (OUT UNIV x)) Z" by (metis (no_types, lifting) Fun_def Fun_succ True UNIV_I bij_betw_def bij_betw_inv_into_left ide_nat(2,3) mem_Collect_eq rangeI succ_simps(2)) also have "... = S ⋅ ((⋅) S ^^ OUT UNIV x) Z" by auto also have "... = S ⋅ ?F x" using True by auto also have "... = S ⋅Fun ?f x" using f by auto also have "... = Fun S (Fun ?f x)" by (metis (no_types, lifting) CollectD CollectI Fun_def dom_comp in_homE in_homI ext null_is_zero(2) seqE) also have "... = (Fun S ∘Fun ?f) x" by simp finally show ?thesis by blast qed qed also have "... = Fun (S ⋅ ?f)" using Fun_comp par by presburger finally show ?thesis by blast qed qed qed moreover have "∧f'. «f' : N→ a¬∧ f' ⋅ zero = Z ∧ f' ⋅ succ = S ⋅ f' ⟶ f' = ?f" proof (intro impI arr_eqI) fix f' assume f': "«f' : N→ a¬∧ f' ⋅ zero = Z ∧ f' ⋅ succ = S ⋅ f'" show par: "par f' ?f" using f f' by fastforce have *: "∧k. ((⋅) S ^^ k) Z = Fun f' (IN UNIV k)" proof - fix k show "((⋅) S ^^ k) Z = Fun f' (IN UNIV k)" proof (induct k) show "((⋅) S ^^ 0) Z = Fun f' (IN (UNIV :: nat set) 0)" using f' app_mkarr unfolding zero_def by (metis (no_types, lifting) CollectI Fun_zero comp_arr_dom f' funpow_0 ide_in_hom ide_some_terminal in_homE zero_in_hom Fun_def) fix k assume ind: "((⋅) S ^^ k) Z = Fun f' (IN UNIV k)" have "Fun f' (IN UNIV (Suc k)) = Fun f' (succ ⋅IN UNIV k)" proof - have "∧n. OUT UNIV (IN UNIV (n::nat)) = n" by (metis (no_types) bij_betw_inv_into_right ide_nat(2) iso_tuple_UNIV_I) thus ?thesis by (metis (no_types) Fun_def Fun_succ bij_betwE ide_nat(3) iso_tuple_UNIV_I succ_simps(2)) qed also have "... = f' ⋅ succ ⋅IN UNIV k" using bij_betwE f' ide_nat(3) Fun_def by fastforce also have "... = (f' ⋅ succ) ⋅IN UNIV k" using comp_assoc by simp also have "... = S ⋅Fun f' (IN UNIV k)" using f' bij_betw_apply ide_nat(3) comp_assoc Fun_def by fastforce also have "... = S ⋅ ((⋅) S ^^ k) Z" using ind by simp also have "... = ((⋅) S ^^ Suc k) Z" by auto finally show "((⋅) S ^^ Suc k) Z = Fun f' (IN UNIV (Suc k))" by simp qed qed show "Fun f' = Fun ?f" proof fix x show "Fun f' x = Fun ?f x" proof (cases "x ∈ Set N") case False show ?thesis using False par Fun_def by auto next case True have "Fun ?f x = ((⋅) S ^^ OUT UNIV x) Z" using True app_mkarr f par by force also have "... = Fun f' (IN (UNIV :: nat set) (OUT UNIV x))" using * by simp also have "... = Fun f' x" using True IN_OUT small_nat embeds_nat by metis finally show ?thesis by simp qed qed qed ultimately show ?thesis by auto qed
lemma has_natural_numbers_object: shows "∃a z s. «z : 1?→ a¬∧«s : a → a¬∧
(∀a' z' s'. «z' : 1?→ a'¬∧«s' : a' → a'¬⟶
(∃!f. «f : a → a'¬∧ f ⋅ z = z' ∧ f ⋅ s = s' ⋅ f))" proof - have "«zero : 1?→ nat¬∧«succ : nat → nat¬∧
(∀a' z' s'. «z' : 1?→ a'¬∧«s' : a' → a'¬⟶
(∃!f. «f : nat → a'¬∧ f ⋅ zero = z' ∧ f ⋅ succ = s' ⋅ f))" using nat_universality by auto thus ?thesis by auto qed
end
section "Sets Category with Tupling and Infinity"
text‹ Finally, if the collection of arrows of a sets category admits embeddings of all the usual set-theoretic constructions, then the category supports all of the constructions considered; in particular it is small-complete and small-cocomplete, is cartesian closed, has a subobject classifier (so that it is an elementary topos), and validates an axiom of infinity in the form of the existence of a natural numbers object. ›
locale sets_cat_with_tupling_and_infinity = sets_cat_with_tupling sml C + sets_cat_with_infinity sml C for sml :: "'V set ==> bool" and C :: "'U comp" (infixr ‹⋅› 55) begin
sublocale universe sml ‹Collect arr› null ..
lemmas has_natural_numbers_object
end
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 1.625 Sekunden
(vorverarbeitet am 2026-06-13)
¤
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.