Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/Category2/   (Sammlung formaler Beweise Version 2026-5©)  Datei vom 29.4.2026 mit Größe 52 kB image not shown  

Quelle  SetCat.thy

  Sprache: Isabelle
 

(*
Author: Alexander Katovsky
*)


section "The Category of Sets"

theory SetCat
imports Functors Universe
begin

notation Elem (infixl || 70)
notation HOLZF.subset (infixl || 71)
notation CartProd (infixl |×| 75)

definition 
  ZFfun :: "ZF ==> ZF ==> (ZF ==> ZF) ==> ZF" where
  "ZFfun d r f Opair (Opair d r) (Lambda d f)"

definition
  ZFfunDom :: "ZF ==> ZF" (|dom|_ [7272where
  "ZFfunDom f Fst (Fst f)"

definition
  ZFfunCod :: "ZF ==> ZF" (|cod|_ [7272where
  "ZFfunCod f Snd (Fst f)"

definition
  ZFfunApp :: "ZF ==> ZF ==> ZF" (infixl |@| 73where
  "ZFfunApp f x app (Snd f) x"

definition 
  ZFfunComp :: "ZF ==> ZF ==> ZF" (infixl |o| 72where
  "ZFfunComp f g ZFfun ( |dom| f) ( |cod| g) (λx. g |@| (f |@| x))"

definition 
  isZFfun :: "ZF ==> bool" where
  "isZFfun drf let f = Snd drf in
                 isOpair drf isOpair (Fst drf) isFun f (f || (Domain f) |×| (Range f))
                  (Domain f = |dom| drf) (Range f || |cod| drf)"

lemma isZFfunE[elim]: "[isZFfun f ;
  [isOpair f ; isOpair (Fst f) ; isFun (Snd f) ;
  ((Snd f) || (Domain (Snd f)) |×| (Range (Snd f))) ;
  (Domain (Snd f) = |dom| f) (Range (Snd f) || |cod| f)] ==> R] ==> R"
  by (auto simp add: isZFfun_def Let_def)

definition  
  SET' :: "(ZF, ZF) Category" where
  "SET' (
      Category.Obj = {x . True} ,
      Category.Mor = {f . isZFfun f} ,
      Category.Dom = ZFfunDom ,
      Category.Cod = ZFfunCod ,
      Category.Id = λx. ZFfun x x (λx . x) ,
      Category.Comp = ZFfunComp
  )"

definition "SET MakeCat SET'"

lemma ZFfunDom: "|dom| (ZFfun A B f) = A"
by (auto simp add: ZFfun_def ZFfunDom_def Fst)

lemma ZFfunCod: "|cod| (ZFfun A B f) = B"
by (auto simp add: ZFfun_def ZFfunCod_def Snd Fst)

lemma SETfun: 
  assumes " x . x || A (f x) || B"
  shows   "isZFfun (ZFfun A B f)"
proof(auto simp add: isZFfun_def ZFfun_def isOpair Fst Snd 
    ZFfunCod_def ZFfunDom_def isFun_Lambda domain_Lambda Let_def)
  {
    fix x
    have "x || Range (Lambda A f) ==> x || B"
      apply(insert isFun_Lambda[of A f])
      apply (drule fun_range_witness[of "Lambda A f" x], simp)
      by (auto simp add: domain_Lambda Lambda_app assms)
  }
  thus "subset (Range (Lambda A f)) B"
    by (auto simp add: subset_def)
  {
    fix x
    have "x || (Lambda A f) ==> x || A |×| Range (Lambda A f)" 
      by(auto simp add: CartProd Lambda_def Repl Range)
  }
  thus "(Lambda A f) || (A |×| Range (Lambda A f))"
    by (auto simp add: HOLZF.subset_def)
qed

lemma ZFCartProd: 
  assumes "x || A |×| B"
  shows   "Fst x || A Snd x || B isOpair x"
proof-
  from CartProd obtain a b 
    where "a || A" 
    and   "b || B" 
    and   "x = Opair a b" using assms by auto
  thus ?thesis using assms by (auto simp add: Fst Snd isOpair_def)
qed

lemma ZFfunDomainOpair:
  assumes "isFun f"
  and     "x || Domain f"
  shows   "Opair x (app f x) || f"
proof-
  have "! y . Opair x y || f" using assms by (auto simp add: unique_fun_value)
  thus "Opair x (app f x) || f" by (auto simp add: app_def intro: theI')
qed
  
lemma ZFFunToLambda: 
  assumes 1"isFun f"
  and     2"f || (Domain f) |×| (Range f)"
  shows   "f = Lambda (Domain f) (λx. app f x)"
proof(subst Ext, rule allI, rule iffI)
  {
    fix x assume a: "x || f" show "x || Lambda (Domain f) (λx. app f x)" 
    proof(simp add: Lambda_def Repl, rule exI[of _ "(Fst x)"], rule conjI)
      have b:"isOpair x Fst x || Domain f" using 2 a by (auto simp add: subset_def ZFCartProd)
      thus "Fst x || Domain f" ..
      hence "Opair (Fst x) (app f (Fst x)) || f" using 1 by (simp add: ZFfunDomainOpair)
      moreover have "Opair (Fst x) (Snd x) || f" using a 2 by (auto simp add: FstSnd subset_def b)
      ultimately have "Snd x = (app f (Fst x))" using 1 by (auto simp add: isFun_def)
      hence "Opair (Fst x) (app f (Fst x)) = Opair (Fst x) (Snd x)" by simp
      also have "... = x"  using b by (simp add: FstSnd)
      finally show "x = Opair (Fst x) (app f (Fst x))" ..
    qed
  }
  moreover 
  {
    fix x assume a: "x || Lambda (Domain f) (λx. app f x)" show "x || f"
      proof-
        from Lambda_def obtain a where "a || Domain f x = Opair a (app f a)" 
          using a by (auto simp add: Repl)
        thus ?thesis using a 1 by (auto simp add: ZFfunDomainOpair)
      qed
  }
qed   

lemma ZFfunApp: 
  assumes "x || A"
  shows   "(ZFfun A B f) |@| x = f x"
proof-
  have "(ZFfun A B f) |@| x = app (Lambda A f) x" by (simp add: ZFfun_def ZFfunApp_def Snd)
  also have "... = f x" using assms by (simp add: Lambda_app)
  finally show ?thesis .
qed

lemma ZFfun: 
  assumes "isZFfun f" 
  shows   "f = ZFfun ( |dom| f) ( |cod| f) (λx. f |@| x)"
proof(auto simp add: ZFfun_def)
  have "isOpair f isOpair (Fst f)" using assms by (simp add: isZFfun_def[of f] Let_def)
  hence "f = Opair (Opair (Fst (Fst f)) (Snd (Fst f))) (Snd f)" by (simp add: FstSnd)
  hence "f = Opair (Opair ( |dom| f) ( |cod| f)) (Snd f)" using assms by (simp add: ZFfunDom_def ZFfunCod_def)
  moreover have "Snd f = Lambda ( |dom| f) (λx . f |@| x)" 
  proof-
    have "|dom| f = Domain (Snd f)" using assms by (simp add: isZFfun_def[of f] Let_def)
    moreover have "isFun (Snd f)" using assms by (simp add: isZFfun_def[of f] Let_def)
    moreover have "(λx . f |@| x) = (λx . app (Snd f) x)"  by(simp add: ZFfunApp_def)
    moreover have "(Snd f) || (Domain (Snd f)) |×| (Range (Snd f))" using assms
      by (auto simp add: isZFfun_def[of f] Let_def)
    ultimately show ?thesis apply simp by(rule ZFFunToLambda[of "Snd f"])
  qed
  ultimately show "f = Opair (Opair ( |dom| f) ( |cod| f)) (Lambda ( |dom| f) (λx . f |@| x))" by simp
qed

lemma ZFfun_ext: 
  assumes " x . x || A f x = g x" 
  shows   "(ZFfun A B f) = (ZFfun A B g)"
proof-
  have "Lambda A f = Lambda A g" using assms by (auto simp add: Lambda_ext)
  thus ?thesis by (simp add: ZFfun_def)
qed

lemma ZFfunExt:
  assumes "|dom| f = |dom| g" and "|cod| f = |cod| g" and funf: "isZFfun f" and fung: "isZFfun g"
  and " x . x || ( |dom| f) ==> f |@| x = g |@| x"
  shows "f = g"
proof-
  have 1"f = ZFfun ( |dom| f) ( |cod| f) (λx. f |@| x)" using funf by (rule ZFfun)
  have "g = ZFfun ( |dom| g) ( |cod| g) (λx. g |@| x)" using fung by (rule ZFfun)
  hence 2"g = ZFfun ( |dom| f) ( |cod| f) (λx. g |@| x)" using assms by simp
  have "ZFfun ( |dom| f) ( |cod| f) (λx. f |@| x) = ZFfun ( |dom| f) ( |cod| f) (λx. g |@| x)" 
    using assms by (simp add: ZFfun_ext)
  thus ?thesis using 1 2 by simp
qed  

lemma ZFfunDomAppCod: 
  assumes "isZFfun f"
  and     "x || |dom|f"
  shows   "f |@| x || |cod|f"
proof(simp add: ZFfunApp_def)
  have "app (Snd f) x || Range (Snd f)" using assms by (auto simp add: fun_value_in_range )
  thus "app (Snd f) x || |cod|f" using assms by (auto simp add: HOLZF.subset_def)
qed

lemma ZFfunComp: 
  assumes " x . x || A f x || B"
  shows   "(ZFfun A B f) |o| (ZFfun B C g) = ZFfun A C (g o f)"
proof (simp add: ZFfunComp_def ZFfunDom ZFfunCod)
  {
    fix x assume a: "x || A"
    have "ZFfun B C g |@| (ZFfun A B f |@| x) = (g o f) x" 
      proof-
        have "(ZFfun A B f |@| x) = f x" using a by (simp add: ZFfunApp)
        hence "ZFfun B C g |@| (ZFfun A B f |@| x) = g (f x)" using assms a by (simp add: ZFfunApp)
        thus ?thesis by simp
      qed
  }
  thus "ZFfun A C (λx. ZFfun B C g |@| (ZFfun A B f |@| x)) = ZFfun A C (g f)"
    by (simp add: ZFfun_ext)
qed

lemma ZFfunCompApp: 
  assumes a:"isZFfun f" and b:"isZFfun g" and c:"|dom|g = |cod|f"
  shows "f |o| g = ZFfun ( |dom| f) ( |cod| g) (λ x . g |@| (f |@| x))"
proof-
  have 1"f = ZFfun ( |dom| f) ( |cod| f) (λ x . f |@| x)" using a by (rule ZFfun)
  have 2"g = ZFfun ( |dom| g) ( |cod| g) (λ x . g |@| x)" using b by (rule ZFfun)
  have 3" x . x || |dom|f (λx. f |@| x) x || |cod|f" using a by (simp add: ZFfunDomAppCod)
  hence 4" x . x || |dom|f (λx. g |@| (f |@| x)) x || |cod|g" 
    using a b c by (simp add: ZFfunDomAppCod)
  have "f |o| g = ZFfun ( |dom| f) ( |cod| f) (λ x . f |@| x) |o|
    ZFfun ( |cod| f) ( |cod| g) (λ x . g |@| x)" using 1 2 c by simp
  hence "f |o| g = ZFfun ( |dom| f) ( |cod| g) (λ x . g |@| (f |@| x))"
    using 3 by (simp add: ZFfunComp comp_def)
  thus ?thesis using 4 by (simp add: SETfun)
qed  

lemma ZFfunCompAppZFfun: 
  assumes "isZFfun f" and "isZFfun g" and "|dom|g = |cod|f"
  shows   "isZFfun (f |o| g)"
proof-
  have "f |o| g = ZFfun ( |dom| f) ( |cod| g) (λ x . g |@| (f |@| x))" using assms
    by (simp add: ZFfunCompApp)
  moreover have " x . x || |dom|f ((λ x . g |@| (f |@| x)) x) || |cod|g" using assms
    by (simp add: ZFfunDomAppCod)
  ultimately show ?thesis by (simp add: SETfun)
qed

lemma ZFfunCompAssoc:
  assumes a: "isZFfun f" and b:"isZFfun h" and c:"|cod|g = |dom|h" 
  and d:"isZFfun g" and e:"|cod|f = |dom|g"
  shows "f |o| g |o| h = f |o| (g |o| h)"
proof-
  have 1"f = ZFfun ( |dom| f) ( |cod| f) (λ x . f |@| x)" using a by (rule ZFfun)
  have 2"g = ZFfun ( |dom| g) ( |cod| g) (λ x . g |@| x)" using d by (rule ZFfun)
  have 3"h = ZFfun ( |dom| h) ( |cod| h) (λ x . h |@| x)" using b by (rule ZFfun)
  have 4" x . x || |dom|f (λx. f |@| x) x || |cod|f" using a by (simp add: ZFfunDomAppCod)
  have "(f |o| g) |o| h = ZFfun ( |dom| f) ( |cod| h) (λ x . h |@| (g |@| (f |@| x)))"
  proof-
    have 5" x . x || |dom|f (λx. g |@| (f |@| x)) x || |cod|g" 
      using 4 e d by (simp add: ZFfunDomAppCod)
    have "(f |o| g) |o| h = (ZFfun ( |dom| f) ( |cod| f) (λ x . f |@| x) |o|
      ZFfun ( |cod| f) ( |cod| g) (λ x . g |@| x)) |o|
      ZFfun ( |cod| g) ( |cod| h) (λ x . h |@| x)" 
      using 1 2 3 c e by (simp)
    thus ?thesis using 4 5 by (simp add: ZFfunComp comp_def)
  qed
  moreover have "f |o| (g |o| h) = ZFfun ( |dom| f) ( |cod| h) (λ x . h |@| (g |@| (f |@| x)))"
  proof-
    have 5" x . x || |dom|g (λx. g |@| x) x || |cod|g" using d by (simp add: ZFfunDomAppCod)
    have "f |o| (g |o| h) = ZFfun ( |dom| f) ( |dom| g) (λ x . f |@| x) |o|
      (ZFfun ( |dom| g) ( |cod| g) (λ x . g |@| x) |o|
      ZFfun ( |cod| g) ( |cod| h) (λ x . h |@| x))" 
      using 1 2 3 c e by (simp)
    thus ?thesis using 4 e 5 by (simp add: ZFfunComp comp_def)
  qed
  ultimately show ?thesis by simp
qed
  
lemma ZFfunCompAppDomCod: 
  assumes "isZFfun f" and "isZFfun g" and "|dom|g = |cod|f"
    
proof
  have java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "macro" is null
   :: "ZF ZF ==> ZF) ==> where
  thus ?thesis by (simp: ZFfunDom ZFfunCod
qed

lemma
  assumes a: "isZFfun f" showsun(mf( dom>. x)) |o| f = f"
proof-
  let ?g = "(ZFfun ( |dom|f) ( |dom|f) (🚫 app (Snd f) x"
  have "ZFfun ( |dom| f) ( |cod| f) (λ x . f |@| x) = ?g |o| f" using a
    by (simp add: ZFfun_ext ZFfunApp ZFfunCompApp SETfun ZFfunCod ZFfunDom)
  moreover have "f = ZFfun(|om)<lambdaf | " usin by uleZfn
  ultimately show ?thesis by sm
qed

lemma ZFfunIdRight:
  assumes a isZfu f"hows| || \lambda) java.lang.StringIndexOutOfBoundsException: Index 86 out of bounds for length 86
proof-
  let ?g = "(ZFfun ( |cod|f) ( |cod|f) (λFn_df et_de)
  have 1: "| |dom|f x. f |@| x |<>d" sng aby smpadd ZFfnomApCod
  have"un cod 🚫x . f |@| x) = f |o| ?g" using a 1
    by (simp add: ZFfun_ext ZFfunApp ZFfunCompApp SETfun ZFfunCod ZFfunDom)
  moreover have "Cod)"
  ultimately show ?thesis by simp
qed

ET
proof-fixx
  have"tegory_axioms
    by byuto_bdams
      ZFfunCompAppZFfun x || Range (Lambda A f)"
  thus ?thesis by (auto simp add: SET_def MakeCat)
qed

lemma SETobj: " Obj (SET)"
by (simp add: SET_def SET'_def MakeCat_def)

lemma SETcodan "<>| B"
by(simp add

lemma SETmor: "(isZFfun f) = (f \in "
by(ipadd SET_de MaeCatdf ET'_def)

lemma SETdom: "isZFfun (ZFfunhave<xists! y . Opair x y || f" using assms by (auto simp add: unique_fun_value)
bympd:SE_de Maeatde ETdf funom)

lemma SETId: assumes "x |
proof-
  have "X f STef akeeCt_d)
  hence "isZFfun(Id SET  impategorygoryCatIdInMormor
  moreover havedET(<lambdax. x)" using assms by (simp add: SET_def SET'_def MaeCtde)
 ltimatelysho ?thesisusig ssmsb (ipdd:ZFuAp
qed

lemma SETCompE[elim]: "[
bytoSETdef

lemma SETmapsToSET
 X to isZFfun f  |cod| f = Y"
by(auto simp add: MapsTo_def SET_def SET'_def MakeCat_def

lemma SETComp: assumes "| A"
proof
  have a: "
  have "f ;;g = f ;;g" by (simp add: SET_def)
  also have "... = f ;;g" using a  by (simp  add
  nally  simpdSETdef
qed

lemma SETCompAt:
  assumes "f | (Domain (Snd f)) |×sss
proof-
  have "f ;;\^SET
 g= f|  usingmpomp
  also have "... = ZFfun ( |dom| f) ( |cod| g) (λ x . g |@| (f |@| x))"usingautopd ompApp
  finally show ?thesissis d:fun_def
qed

lemma SETZFfunfunom(lambda|x using le
  sumesSET
  "shows "ZFfun <>x . f |@| x)"
proof-
  have "isZFfun f" using assms by (autosimp ad: SETor
  hence "f = ZFfun ( |dom  henceg=Ffun \lambda> @ )using yimp
  moreover have "|dom| f = X"nd"usingsin ssmb (uto imp dd ST_efSET_de akCt_ef
  ultimately show
qed

lemma SETfunDomAppCod:
  assumes "f maps to Y" and "x |
  shows "f |@| x |
proof
  have 1pr (simp ad FunCmp_def Zunom Funod
  hence "x |
  ence| |cod| f" using 1 by (simp add: ZFfunDomAppCod)
  thus ?thesis using 2 by simp
qed

(*Locally Small Category has an injective map from the morphisms to ZF*)
record ('o,'m) LSCategory = "('   :sZFfun:m  od"
   or2F: "==>ZFm2z🍋_ fun <> x . g |@| x)" using b by (rule ZFfun)

definition
  ZF2mor (longrightarrow (λ g|@|( @| )) x|
  "ZF2morhave"og  fundom)codf\lambda> x . f |@| x) |ojava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73

definition
  ollection <quiv{2<^bsubC\<^esub> f | f . f maps\<^bsub>C\<^esub> X to Y}"

definition
  HomSet  og|)ZFfundom|f|mg(<ambda x . f |@| x) |o|
  "HomSet C X Y \<equiv implode (HOMCollection C X Y)"

locale LSCategory = Category +
  assumes mor2ZFInj: "\<lbrakk>x \<in  let=Ffun(|f od lambdax. x))"
  and HOMSetIsSet: "\<lbrakk>X \<in> obj ; Y \<in> obj\<rbrakk> \<thusisautosimpSET_defeCat
  and m2zExt: "mor2ZF C \in extensional (Mor C)"

lemma [elim]: "\<lbrakk>LSCategory C ; 
  <>ategory C ; \<lbrakk>x \<in> mor\<^bsub>C\<^esub>  \> r<subC\<^esub> ; m2z\<^bsub>C\<^esub> x = m2z\<^bsub>C\<^esub> y\<rbrakk> \<Longrightarrow> =;
  lbrakkX \<in> obj\<^bsub>C\<^esub> ; Y \<in> obj<bsubC<><rbrakk> \<Longrightarrow> HOMCollection C X Y \<in> range explode\<rbrakk LongrightarrowR\<rbrakk> \<Longrightarrow> R"
by(simp add: LSCategory_def LSCategory_axioms_def)

definition
  ap"',m')LSCategory_scheme \<Rightarrow 'o <Rightarrow>m>ZF" (\<open>Hom\<index>[__\close 6565])where
  "HomFtorMap C X g \<equiv> ZFfun (Hom\<^bsub>C\<^esub> X (dom\<^bsub>C\<^esub> g)\lbrakktegory;lbrakkx \<in> mor\<^bsub>C\<^esub   mor\<^bsub>C\<^esub> ; m2z\<^bsub><esub \subesuby\<rbrakk> \<Longrightarrow>  x = y;

definition 
  HomFtor' :: "('o,'m,'a) def
      ('o,ZF,'m,ZF,\<lparr>mor2ZF :: 'm \<Rightarrow> ZF, \<dots>henceMCollection>range explode" using assms by (simp add: HOMSetIsSet)
  "HomFtor' C X \<equiv> \<lparr>
        CatDom = C, 
        CatCod = SETproof
        MapM   = \<lambda> g . Hom\<^bsub>C\<^esub>[X,g]
  \<rparr>"

definition HomFtor     

lemma [simp]: "LSCategory C       
  by (simp add: LSCategory_def)

lemma (in LSCategory) m2zz2m: 
  assumes "f maps X to Y" shows "(have4\>moring yauto
proof-
  have "X \<in> Obj C" and "Y \<in> Obj C" using ssms mp:sToObj
  hence "HOMCollection C X Y \<in> rangexplodesingsms imp OMSetIsSetetIsSet
  moreover have "(m2z f) \<in> HOMCollection C X Y"usingssmsoimpdMCollection_defon_def
ultimately \in|implode (HOMCollection C X Y)" by (simp add: Elem_implode)
  thus ?thesis by (simp add: HomSet_def) 
qed

lemma (in LSCategory) m2zz2mInv: 
  assumes "f \<in> mor"
  shows "z2m (m2z f) =
proof-
  have 1: "f \    by(paddSETfun
  moreover have "\<exists>! m . m \<in> mor \<and> m2z m =z"java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
  proof(rule ex_ex1I
    om<sub\<^>X,f] \<in> mor\<^bsub>SET'\<^esub>" using assms by (simp add: HomFtorInMor')
      by(rule exI[of _ f], insert
    {
       assume <> morandm2z m = (m2z f)" and "y \<in> mor \<and> m2z y = (m2z f)"
      thus "m = y" by(simp add: mor2ZFInj)
    }
  qed
  ultimately show thesis(paddd 2r_def1quality
qed

lemma (in LSCategory) z2mm2z: 
  assumes "X \<in> obj" and "Y \<in> obj" f\> (Hom X Y)"
  shows "z2m f maps X to Y \<and> m2z (z2m f) = f"
proof
  have 1: "\<exists> m . m maps X to Y \<and> m2z m = f"
proof
    have "HOMCollectionC \in>angeode singssmsbyimpdd:OMSetIsSet
    reovere f|<n| implode (HOMCollection C X Y)" using assms(3) by (simp add: mSet_deft_def
    ultimately have "f \<in> HOMCollection C X Y" by (simp add: HOLZF.Elem_implode)
    thus ?thesisbyoimpdOMCollection_defection_def
  qed
  have 2: "\<exists>! m . m \<in> mor \<and> m2z m = f" 
  proof(rule ex_ex1I)
    show "\<exists> m . m \<in> mor \<and> m2z mfjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
    proof
      from 1 obtain m where "m \<in> mor \<and>      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      thus ?thesis by    
    qed
    {
      fix m y assume "m \<in> mor \<and> m2z m = f" and "y \<in> mor \<and> m2z y = f"
      thus "m = y" by(simp add: mor2ZFInjr2ZFInj
    
  qed
  thus ?thesis
  proof-
    from ain herere:s  \and  a = f" by auto
    have 4:\> mor" using 3 by auto
    have "z2m f = a" 
      d F2mor_def _]
      apply (rule the1_equality[of "\<lambda> m . m \<in> mor \<and> m2z m = f" a])
      apply (auto simp add: 2 3 4)
      done
    thus ?thesis by (simp add: 3)
  qed
qed

lemma  HomFtorMapLemma1: 
  assumes a: "LSCategory C" and b: "X \<in> obj\<^bsub>C\<^esub>" and c: "f \<in> mor\<^bsub>C\<^esub>" and d: "x |\also "..ZFfun<bsubesub Y) (Hom\<^bsub>C \<^esub>X Y) (\<lambda> f . f)" 
  shows "(m2z\<^bsub>C \<^esub>(\<^bsub\^>x) ;C\<^esub> f)) |\<in><bsub\esubbcodC\^> )"
proof-
  haveZFfunCod_def ZFfunDom_defisFun_Lambda domain_Lambda Let_def
tot_def
  hence "  andb"< <^bsub>C\<^esub>"
  hence    unctornctor(ombsubproof
    byauto simp : LSCategorym2zz2m)
  thus ?thesis using c lemmaHomFtorObjjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
qed

lemma HomFtorInMor':
b"
  shows 
proofsimp addHomFtorMap_def
  {
  x|      nceOpair(x(   ) Opairirstx)(  imp
    ncem2z<bsubC \<^esub>((z2m\<^bsub>C \<^esub>x) ;;\<^bsubC>finally show "  ir Fst" .java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}
  hence "\<forall> x . x |\<   " = (Opair   impp ddositeCategory_defor_Op_MapsTo_def
   "isZFfun( (Hom\<bsub>\X m<><>f) Hom\<^bsubC^>X cod\<^bsub>C\<^esub> f(((z2m\<^bsub>C\esubx) ;;\<^>C\^esub)
    by (simp add: SETfunsinggassmsby(mpaddFtorFtorFtor
  thus "ZFfun (Hom\<^bsub>C\<^esub> X
    by (simp add: SET'_def)
qed

lemma HomFtorMor':
  assumes "LSCategory C" and " <in> j<bsub<esub and "f \injava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  shows   hence 4 \forall>java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
proof-
  have  X  usingy(impaddZFfunCompmp_def
  moreover have "dom\<^bsub>SET'\<^esub> (Hom\<^bsub      shows"sZFfun f|)
    by(simp add: HomFtorMap_def SET'_def ZFfunDom)
  moreover have "cod\<^bsub>SET'\<^esub> (Hom
    (mpaddFtorMap_defp_deffSETunCod
ultimatelymatelyshowhesisbyautompaddSET_def
qed

lemma HomFtorMapsTo:
  "\<lbrakk>LSCategory C ; X \
bysimphave:<> .  \in|domg\> (<x. g |@| x) x\>| |g"using dbysimpadd)

thusmpddFfunDom
  assumes "LSCategory C" and "X \<>objbsubC\<^esub>"-
  shows   f|x)using  ule)
    proof
proof-
  have "Hom\{
  thus "Hom\<^bsub>esub[X,f] \<> MorSET" and "mbsub>\^esub> (om\^>C<>f)ombsub > dom\<bsubC\> f and "cod^SET\<^esub> (\<bsub\^>f  <C\esubX(\^>C^>f)
    by auto
ed

lemma HomFtorCompDef':
  assumes "LSCategory C" and "X<in obj\<^ub>esub" and "f \<approx>\^bsub>C\<^esub "
  shows   "(Hom\<^bsub>C\<^esub>[X,f])proofepDefinedI
proof-
  have a: "f \<in> mor\<^bsub>C\<^esubalsohaveave".ZFfunFfun dom  odg <ambda  |||  assms  ( simp : )
  thus "Hom\<^bsub>C\<^esub>[X,f] \  " @  <| Y"
  have "(Hom\<^bsub>C\^esub[fmaps^bsubSET'<> Hom\<>C\esub>  \<^>C<>   Hom\bsub<>  \^>esub"
    and "(Hom\<^bsub>C\<^esub>[X,g]) maps\<^bsub>SET'<^ Hom\<^bsub>C\<^esub> X dom\<^bsub>C<esub Homm<bsub><esub d^>\<^esub> g" using assms a b by ( dHomFtorMor
  hence "cod\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,f]) = Hom\<^bsub>C\<^esub> X (cod\<^bsub>C\<^esub> f)" 
    and "dom\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,g]) = Hom\<^bsub>C\<^esub> X (dom\<^bsub>C\<^esub> g)" by auto
  moreover have "(cod\<^bsub>C\<^esub> f) = (dom\<^bsub>C\<^esub> g)" using assms(3) by auto
  ultimately show "cod\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,f]) = dom\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,g])" by simp
qed

lemma HomFtorDist': 
  assumes a: "LSCategory C" and b: "X \<in> obj\<^bsub>C\<^esub>" and c: "f \<approx>>\<^bsub>C\<^esub> g"
  shows   "(Hom\<^bsub>C\<^esub>[X,f]) ;;\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,g]) = Hom\<^bsub>C\<^esub>[X,f ;;\<^bsub>C\<^esub> g]"
proof-
  let ?A = "(Hom\<^bsub>C\<^esub> X dom\<^bsub>C\<^esub> f)"
  let ?B = "(Hom\<^bsub>C\<^esub> X dom\<^bsub>C\<^esub> g)"
  let ?C = "(Hom\<^bsub>C\<^esub> X cod\<^bsub>C\<^esub> g)"
  let ?f = "(\<lambda>h. m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>h) ;;\<^bsub>C\<^esub> f))"
  let ?g = "(\<lambda>f. m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>f) ;;\<^bsub>C\<^esub> g))"
  have 1: "cod\<^bsub>C\<^esub> f = dom\<^bsub>C\<^esub> g" using c by auto
  have 2: "dom\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> g) = dom\<^bsub>C\<^esub> f" and 3: "cod\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> g) = cod\<^bsub>C\<^esub> g" using assms 
    by (auto simp add: Category.MapsToMorDomCod)
  have "(Hom\<^bsub>C\<^esub>[X,f]) ;;\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,g]) = (ZFfun ?A (Hom\<^bsub>C\<^esub> X cod\<^bsub>C\<^esub> f) ?f) |o| (ZFfun ?B ?C ?g)" 
    by (simp add: HomFtorMap_def SET'_def)
  also have "... = (ZFfun ?A ?B ?f) |o| (ZFfun ?B ?C ?g)" using 1 by simp
  alsohave..= ZFfun A? (?g  ?" 
  proof(rule ZFfunComp, rule allI, rule impI)
    {
      fix h assume aa: "h |\<in>| ?A" show "?f h |\<in>| ?  proof-
      proof-
        have "f \<in> mor\<^bsub>C\<^esub>" using assms by auto
        hence "?f h |\<in>| (Hom\<^bsub>C\<^esub> X cod\<^bsub>C\<^esub> f)" using assms aa by (simp add: HomFtorMapLemma1)
        thus ?thesis using 1 by simp
      qed
    }
  qed
  also have "... = ZFfun ?A ?C (\<lambda>h. m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>h) ;;\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> g)))"
  proof(rule ZFfun_ext, rule allI, rule impI, simp add: comp_def)
    {
      fix h assume aa: "h |\<in>| ?A" 
      show "m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> (m2z\<^bsub>C\<^esub>((z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> f))) ;;\<^bsub>C\<^esub> g) = m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> g))"
      proof-
        have bb: "(z2m\<^bsub>C\<^esub> h) \<approx>>\<^bsub>C\<^esub> f" 
        proof(rule CompDefinedI)
          show "f \<in> mor\<^bsub>C\<^esub>" using c by auto
          hence "dom\<^bsub>C\<^esub> f \<in> obj\<^bsub>C\<^esub>" using a by (simp add: Category.Cdom)
          hence "(z2m\<^bsub>C\<^esub> h) maps\<^bsub>C\<^esub> X to dom\<^bsub>C\<^esub> f" using assms aa by (simp add: LSCategory.z2mm2z)
          thus "(z2m\<^bsub>C\<^esub> h) \<in> mor\<^bsub>C\<^esub>" and "cod\<^bsub>C\<^esub> (z2m\<^bsub>C\<^esub> h) = dom\<^bsub>C\<^esub> f" by auto
        qed
        hence "(z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> f \<in> mor\<^bsub>C\<^esub>" using a by (simp add: Category.MapsToMorDomCod)
        hence "z2m\<^bsub>C\<^esub> (m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> f)) = (z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> f" using a by (simp add: LSCategory.m2zz2mInv)
        hence "m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> (m2z\<^bsub>C\<^esub>((z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> f))) ;;\<^bsub>C\<^esub> g) = m2z\<^bsub>C\<^esub> (((z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> f) ;;\<^bsub>C\<^esub> g)" by simp
        also have "... = m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> g))" using bb c a by (simp add: Category.Cassoc)
        finally show ?thesis .
      qed
    }
  qed
  also have "... = ZFfun (Hom\<^bsub>C\<^esub> X dom\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> g)) (Hom\<^bsub>C\<^esub> X cod\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> g)) (\<lambda>h. m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>h) ;;\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> g)))"
    using 2 3 by simp
  also have "... = Hom\<^bsub>C\<^esub>[X,f ;;\<^bsub>C\<^esub> g]" by (simp add:  HomFtorMap_def)
  finally show ?thesis by (auto simp add: SET_def)
qed

lemma HomFtorDist:
  assumes "LSCategory C" and "X \<in> obj\<^bsub>C\<^esub>" and "f \<approx>>\<^bsub>C\<^esub> g"
  shows   "(Hom\<^bsub>C\<^esub>[X,f]) ;;\<^bsub>SET\<^esub> (Hom\<^bsub>C\<^esub>[X,g]) = Hom\<^bsub>C\<^esub>[X,f ;;\<^bsub>C\<^esub> g]"
proof-thus "ZFfun(Hom<^sub>C<^esub X dom<^bsub>C\^sub> f)(Hom\<bsubC\<esub  cod\bsubC\^>f)(\<>   m2z\^> <^sub(z2m<bsubC\^esubx ;<^>C<^>f)\in>\<bsubSET'<^"
  have "(Hom\<^bsub>C\<^esub>[X,f]) ;;\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,g]) = Hom\<^bsub>C\<^esub>[X,f ;;\<^bsub>C\<^esub>lemma HomFtorMor':
  moreover have "(Hom\<^bsub>C\<^esub>[X,f]) \<approx>>\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,g])" using assms by (simp add: HomFtorCompDef')
  ultimately show ?thesis by (simp add: MakeCatComp SET_def)
qed

lemma HomFtorId':
  assumes a: "LSCategory C" and b: "X \<in> obj\<^bsub>C\<^esub>" and c: "Y \<in> obj\<^bsub>C\<^esub>"
  shows   "Hom\<^bsub>C\<^esub>[X,id\<^bsub>C\<^esub> Y] = id\<^bsub>SET'\<^esub> (Hom\<^bsub>C \<^esub>X Y)"
proof-
  have "(id\<^bsub>C\<^esub> Y) maps\<^bsub>C\<^esub> Y to Y" using a c by (simp add: Category.Simps)
  hence 1: "(dom\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y)) = Y" and 2: "(cod\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y)) = Y" by auto
  have "Hom\<^bsub>C\<^esub>[X,id\<^bsub>C\<^esub> Y] = ZFfun (Hom\<^bsub>C \<^esub>X (dom\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y))) (Hom\<^bsub>C \<^esub>X (cod\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y))) (\<lambda> f . m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> f) ;;\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y)))"
    by (simp add: HomFtorMap_def)
  also have "... = ZFfun (Hom\<^bsub>C \<^esub>X Y) (Hom\<^bsub>C \<^esub>X Y) (\<lambda> f . m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> f) ;;\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y)))" using 1 2 by simp
  also have "... = ZFfun (Hom\<^bsub>C \<^esub>X Y) (Hom\<^bsub>C \<^esub>X Y) (\<lambda> f . f)" 
  proof(rule ZFfun_ext, rule allI, rule impI)
    {
      fix h assume aa: "h |\<in>| (Hom\<^bsub>C\<^esub> X Y)" show "m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y)) = h"
      proof-
        have "(z2m\<^bsub>C\<^esub> h) maps\<^bsub>C\<^esub> X to Y" and bb: "m2z\<^bsub>C\<^esub> (z2m\<^bsub>C\<^esub> h) = h" 
          using assms aa by (simp add: LSCategory.z2mm2z)+
        hence "(z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y) = (z2m\<^bsub>C\<^esub> h)" using a by (auto simp add: Category.Simps)
        hence "m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> h) ;;\<^bsub>C\<^esub> (id\<^bsub>C\<^esub> Y)) = m2z\<^bsub>C\<^esub> (z2m\<^bsub>C\<^esub> h)" by simp
        also have "... = h" using bb .
        finally show ?thesis .
      qed
    }
  qed
  finally show ?thesis by (simp add: SET'_def)
qed

lemma HomFtorId: 
  assumes "LSCategory C" and "X \<in> obj\<^bsub>C\<^esub>" and "Y \<in> obj\<^bsub>C\<^esub>"
  shows   "Hom\<^bsub>C\<^esub>[X,id\<^bsub>C\<^esub> Y] = id\<^bsub>SET\<^esub> (Hom\<^bsub>C \   "Hom\^>C\^>Xf \>mor\^>'<esub" Hom^bsubC<esub[,]\in>mor<bsubSET\^>"using assmsby simpaddHomFtorInMor)+
proof-
  have "Hom\<^bsub>C\<^esub>[X,id\<^bsub>C\<^esub> Y] = id\<^bsub>SET'\<^esub> (Hom\<^bsub>C \<^esub>X Y)" using assms by (simp add: HomFtorId')
  moreover have "(Hom\<^bsub>C \<^esub>X Y) \<in> obj\<^bsub>SET'\<^esub>" by (simp add: SET'_def)
  ultimately show ?thesis by (simp add: MakeCatId SET_def)
qed

lemma HomFtorObj':
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  and     b: "PreFunctor (HomP\<^bsub>C\<^esub>[X,\<midarrow>])"  and c: "X \<in> obj\<^bsub>C\<^esub>" and d: "Y \<in> obj\<^bsub>C\<^esub>"
  shows   "(HomP\<^bsub>C\<^esub>[X,\<midarrow>]) @@ Y = Hom\<^bsub>C \<^esub>X Y" 
proof-
  ultimatelyshowcod^bsub>SET\^> Hom<bsub><esub>Xf) =\^>'\^esub> (om<bsub>C\^[,]" by 
  have "?F ## (id\<^bsub>CatDom ?F\<^esub> Y) = Hom\<^bsub>C\<^esub>[X,id\<^bsub>C\<^esub> Y]" by (simp add: HomFtor'_def)
  also have "... = id\<^bsub>CatCod ?F\<^esub> (Hom\<^bsub>C \<^esub>X Y)" using assms by (simp add: HomFtorId HomFtor'_def)
  finally have "?F ## (id\<^bsub>CatDom ?F\<^esub> Y) = id\<^bsub>CatCod ?F\<^esub> (Hom\<^bsub>C \<^esub>X Y)" by simp
  moreover have "Hom\<^bsub>C \<^esub>X Y \<in> obj\<^bsub>CatCod ?F\<^esub>" using assms 
    by (simp add: HomFtorId HomFtor'_def SET_def SET'_def MakeCatObj)
  moreover have "Y \<in> obj\<^bsub>CatDom ?F\<^esub>" using d by (simp add: HomFtor'_def)
ultimately? using  bysimpadd PreFunctor.FmToFoof FY"Hom<bsub> <^esubXY"])
qed

lemma HomFtorFtor': 
  assumes a: "LSCategory C"
  and     b: "X \<in> obj\<^bsub>C\<^esub>"
  shows   "FunctorM (HomP\<^bsub>C\<^esub>[X,\<midarrow>])"
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 20
  show PF: "PreFunctor (HomP\<^bsub>C\<^esub>[X,\<midarrow>])"
  proof(auto simp add: HomFtor'_def PreFunctor_def SETCategory a HomFtorDist b)
    {
      fix Z assume aa: "Z \<in> obj\<^bsub>C\<^esub>" 
      show "\<exists> Y \<in> obj\<^bsub>SET \<^esub>. Hom\<^bsub>C\<^esub>[X,id\<^bsub>C\<^esub> Z] = id\<^bsub>SET\<^esub> Y"
      proof(rule_tac x="Hom\<^bsub>C \<^esub>X Z" in Set.rev_bexI)
        show "Hom\<^bsub>C\<^esub> X Z \<in> obj\<^bsub>SET\<^esub>" by (simp add: SET_def SET'_def MakeCatObj) 
        show "Hom\<^bsub>C\<^esub>[X,id\<^bsub>C\<^esub> Z] = id\<^bsub>SET\<^esub> (Hom\<^bsub>C\<^esub> X Z)" using assms aa by(simp add:HomFtorId)
      qed
    }
  qed
      by (simpadd: HomFtorMap_def SET_def)
    fix f Z Y assume aa: "f maps\<^bsub>C \<^esub>Z to Y" 
    have "(HomP\<^bsub>C\<^esub>[X,\<midarrow>]) ## f maps\<^bsub>SET\<^esub> ((HomP\<^bsub>C\<^esub>[X,\<midarrow>]) @@ Z) to ((HomP\<^bsub>C\<^esub>[X,\<midarrow>]) @@ Y)" 
    proof-
      have bb: "Z \<in> obj\<^bsub>C\<^esub>" and cc: "Y \<in> obj\<^bsub>C\<^esub>" using aa a by (simp add: Category.MapsToObj)+
      have dd: "dom\<^bsub>C\<^esub> f = Z" and ee: "cod\<^bsub>C\<^esub> f = Y" and ff: "f \<in> mor\<^bsub>C\<^esub>" using aa by auto
      have "(HomP\<^bsub>C\<^esub>[X,\<midarrow>]) ## f = Hom\<^bsub>C\<^esub>[X,f]" by (simp add: HomFtor'_def)
      moreover have "(HomP\<^bsub>C\<^esub>[X,\<midarrow>]) @@ Z = Hom\<^bsub>C \<^esub>X Z" 
        (\<bsubC<^subX,<midarrow>)@ Y = \<bsubC <^esubX Y  assms bb  PFby( add: HomFtorObj')java.lang.StringIndexOutOfBoundsException: Index 133 out of bounds for length 133
      moreover have "Hom\<^bsub>C\<^esub>[X,f] maps\<^bsub>SET\<^esub> (Hom\<^bsub>C \<^esub>X (dom\<^bsub>C\<^esub> f)) to (Hom\<^bsub>C \<^esub>X (cod\<^bsub>C\<^esub> f))" 
        using assms ff by (simp add: HomFtorMapsTo)
      ultimately show ?thesis using dd ee by simp
    qed
  }
  thus "FunctorM_axioms (HomP\<^bsub>C\<^esub>[X,\<midarrow>])" using PF by (auto simp add: FunctorM_axioms_def HomFtor'_def)
qed

lemma HomFtorFtor: 
  assumes a: "LSCategory C"
  and     b: "X \<in> obj\<^bsub>C\<^esub>"
  shows   "Functor (Hom\<^bsub>C\<^esub
proof-
  have "FunctorM (HomP\<^bsub>C\<^esub>[X,\<midarrow>])" using assms by (rule HomFtorFtor')
  thus ?thesis by (simp add: HomFtor_def MakeFtor)
qed 

lemma HomFtorObj:
  assumes "LSCategory C"
  and     "X \<in> obj\<^bsub>C\<^esub>" and "Y \<in> obj\<^bsub>C\<^esub>"
  shows   "(Hom\<^bsub>C\<^esub>[X,\<midarrow>]) @@ Y = Hom\<^bsub>C \<^esub>X Y"
proof-
  have "FunctorM (HomP\<^bsub>C\<^esub>[X,\<midarrow>])" using assms by (simp add: HomFtorFtor')
1PreFunctorHomP<^>C\^sub[X,<midarrow>]) by( : FunctorM_def)
  moreover have "CatDom (HomP\<^bsub>C\<^esub>[X,\<midarrow>]) = C" by (simp add: HomFtor'_def)
  ultimately have "(Hom\<^bsub>C\<^esub>[X,\<midarrow>]) @@ Y = (HomP\<^bsub>C\<^esub>[X,\<midarrow>]) @@ Y" using assms by (simp add: MakeFtorObj HomFtor_def)
  thus ?thesis using assms 1 by (simp add: HomFtorObj')
qed

definition
  HomFtorMapContra :: "('o,'m,'a) LSCategory_scheme \<Rightarrow> 'm \<Rightarrow> 'o \<Rightarrow> ZF" (\<open>HomC\<index>[_,_]\<close> [65,65] 65) where
  "HomFtorMapContra C g X \<equiv> ZFfun (Hom\<^bsub>C\<^esub> (cod\<^bsub>C\<^esub> g) X) (Hom\<^bsub>C\<^esub> (dom\<^bsub>C\<^esub> g) X) (\<lambda> f . m2z\<^bsub>C\<^esub> (g ;;\<^bsub>C\<^esub> (z2m\<^bsub>C\<^esub> f)))"

definition 
  HomFtorContra' :: "('o,'m,'a) LSCategory_scheme \<Rightarrow> 'o \<Rightarrow> 
      ('o,ZF,'m,ZF,\<lparr>mor2ZF :: 'm \<Rightarrow> ZF, \<dots> :: 'a\<rparr>,unit) Functor" (\<open>HomP\<index>[\<midarrow>,_]\<close> [65] 65) where
  "HomFtorContra' C X \<equiv> \<lparr>
        CatDom = (Op C), 
        CatCod = SET ,
        MapM   = \<lambda> g . HomC\<^bsub>C\<^esub>[g,X]
  \<rparr>"

definition HomFtorContra (\<open>Hom\<index>[\<midarrow>,_]\<close> [65] 65) where "HomFtorContra C X \<equiv> MakeFtor(HomFtorContra' C X)"

lemma HomContraAt: "x |\<alsohave".=Hom<>\>Xf;<bsubC\esubg"by(add  HomFtorMap_def
  by (simp add: HomFtorMapContra_def ZFfunApp)

lemma mor2ZF_Op: "mor2ZF (Op C) = mor2ZF C"  
apply (cases C)
apply (simp add: OppositeCategory_def)
done

lemma mor_Op: "mor\<^bsub>Op C\<^esub> = mor\<^bsub>C\<^esub>" by (simp add: OppositeCategory_def)
lemma obj_Op: "obj\<^bsub>Op C\<^esub> = obj\<^bsub>C\<^esub>" by (simp add: OppositeCategory_def)

lemma ZF2mor_Op: "ZF2mor (Op C) f = ZF2mor C f"
by (simp add: ZF2mor_def mor2ZF_Op mor_Op)

lemma mapsTo_Op: "f maps\<^bsub>Op C\<^esub> Y to X = f maps\<^bsub>C\<^esub> X to Y"
by (auto simp add: OppositeCategory_def mor_Op MapsTo_def)

lemma HOMCollection_Op: "HOMCollection (Op C) X Y = HOMCollection C Y X"
by (simp add: HOMCollection_def mapsTo_Op mor2ZF_Op)

lemma Hom_Op: "Hom\<^bsub>Op C\<^esub> X Y = Hom\<^bsub>C\<^esub> Y X"
by (simp add: HomSet_def HOMCollection_Op)

lemma HomFtorContra': "HomP\<^bsub>C\<^esub>[\<midarrow>,X] = HomP\<^bsub>Op C\<^esub>[X,\<midarrow>]"
apply (simp add:  HomFtorContra'_def 
                      HomFtor'_def HomFtorMapContra_def HomFtorMap_def mor2ZF_Op ZF2mor_Op Hom_Op)
by (simp add: OppositeCategory_def)

lemma HomFtorContra: "Hom\<^bsub>C\<^esub>[\<midarrow>,X] = Hom\<^bsub>Op C\<^esub>[X,\<midarrow>]"
by (auto simp add: HomFtorContra' HomFtorContra_def HomFtor_def)

emmaHomFtorContraDom:"CatDom(\<bsub>C<^>[<midarrowX] = OpC
by(simp add: HomFtorContra_def HomFtorContra'_def MakeFtor_def)

lemma HomFtorContraCod: "CatCod (Hom\<^bsub>C\<^esub>[\<midarrow>,X]) = SET"
by(simp add: HomFtorContra_def HomFtorContra'_def MakeFtor_def)

lemma LSCategory_Op: assumes "LSCategory C" shows "LSCategory (Op C)"
proof(auto simp only: LSCategory_def)
  show "Category (Op C)" using assms by (simp add: OpCatCat)
  show "LSCategory_axioms (Op C)" using assms
    by (simp add: LSCategory_axioms_def mor_Op obj_Op mor2ZF_Op HOMCollection_Op 
                     LSCategory.mor2ZFInj LSCategory.HOMSetIsSet LSCategory.m2zExt)
qed

lemma HomFtorContraFtor:
  assumes "LSCategory C"
  and     "X \<in> obj\<^bsub>C\<^esub>"
  shows   "Ftor (Hom\<^bsub>C\<^esub>[\<midarrow>,X]) : (Op C) \<longrightarrow> SET"
proof(auto simp only: functor_abbrev_def)
  show "Functor (Hom\<^bsub>C\<^esub>[\<midarrow>,X])"
  proof-
    have "Hom\<^bsub>C\<^esub>[\<midarrow>,X] = Hom\<^bsub>Op C\<^esub>[X,\<midarrow>]" by (simp add: HomFtorContra)
    moreover have "LSCategory (Op C)" using assms by (simp add: LSCategory_Op)
    moreover have "X \<in> obj\<^bsub>Op C\<^esub>" using assms by (simp add: OppositeCategory_defhence"z2m^><esubh;^\esub \bsub<>)=(<><>husinga  :.
    ultimately show ?thesis using assms by (simp add: HomFtorFtor)
  qed
  show "CatDom (Hom\<^bsub>C\<^esub>[\<midarrow>,X]) = Op C" by(simp add: HomFtorContra_def HomFtorContra'_def MakeFtor_def)
  show "CatCod (Hom\<^bsub>C\<^esub>[\<midarrow>,X]) = SET" by(simp add: HomFtorContra_def HomFtorContra'_def MakeFtor_def)
qed

lemma HomFtorOpObj:
  assumes "LSCategory C"
  and     "X \<in> obj\<^bsub>C\<^esub>" and "Y \<in> obj\<^bsub>C\<^esub>"
  shows   "(Hom\<^bsub>C\<^esub>[\<midarrow>,X]) @@ Y = Hom\<^bsub>C \<^esub>Y X"
proof-
  have 1: "X \<in> Obj (Op C)" and 2: "Y \<in> Obj (Op C)" using assms by (simp add: OppositeCategory_def)+
  have "(Hom\<^bsub>C\<^esub>[\<midarrow>,X]) @@ Y = (Hom\<^bsub>Op C\<^esub>[X,\<midarrow>]) @@ Y" by (simp add: HomFtorContra)
  also have "... = (Hom\<^bsub>Op C \<^esub>X Y)" using assms(1) 1 2 by (simp add: LSCategory_Op HomFtorObj)
  also have "... = (Hom\<^bsub>C \<^esub>Y X)" by (simp add: Hom_Op)
  finally show ?thesis .
qed
  

lemma HomCHomOp: "HomC\<^bsub>C\<^esub>[g,X] = Hom\<^bsub>Op C\<^esub>[X,g]"
apply (simp add:  HomFtorContra'_def 
                      HomFtor'_def HomFtorMapContra_def HomFtorMap_def mor2ZF_Op ZF2mor_Op Hom_Op)
by (simp add: OppositeCategory_def)

lemma HomFtorContraMapsTo:
  assumes "LSCategory C" and "X \<in> obj\<^bsub>C\<^esub>" and "f \<in> mor\<^bsub>C\<^esub>" 
  shows "HomC\<^bsub>C\<^esub>[f,X] maps\<^bsub>SET\<^esub> Hom\<^bsub>C \<^esub>(cod\<^bsub>C\<^esub> f) X  to Hom\<^bsub>C \<^esub>(dom\<^bsub>C\<^esub> f) X"
proof-
  have "LSCategory (Op C)" using assms by(simp add: LSCategory_Op)
  moreover have "X \<in> Obj (Op C)" using assms by (simp add: OppositeCategory_def)
  moreover have "f \<in> Mor (Op C)" using assms by (simp add: OppositeCategory_def)
  ultimately have "Hom\<^bsub>Op C\<^esub>[X,f] maps\<^bsub>SET\<^esub> Hom\<^bsub>Op C \<^esub>X (dom\<^bsub>Op C\<^esub> f) to Hom\<^bsub>Op C \<^esub>X (cod\<^bsub>Op C\<^esub> f)" using assms
    by (simp add: HomFtorMapsTo)
  moreover have "HomC\<^bsub>C\<^esub>[f,X] = Hom\<^bsub>Op C\<^esub>[X,f]" by (simp add: HomCHomOp)
  moreover have "Hom\<^bsub>Op C \<^esub>X (dom\<^bsub>Op C\<^esub> f) = Hom\<^bsub>C \<^esub>(cod\<^bsub>C\<^esub> f) X" 
  proof-
    have "Hom\<^bsub>Op C \<^esub>X (dom\<^bsub>Op C\<^esub> f) = Hom\<^bsub>C\<^esub> (dom\<^bsub>Op C\<^esub> f) X" by (simp add: Hom_Op)
    thus ?thesis by (simp add:  OppositeCategory_def)
  qed
  moreover have "Hom\<^bsub>Op C \<^esub>X (cod\<^bsub>Op C\<^esub> f) = Hom\<^bsub>C \<^esub>(dom\<^bsub>C\<^esub> f) X"
  proof-
    have "Hom\<^bsub>Op C \<^esub>X (cod\<^bsub>Op C\<^esub> f) = Hom\<^bsub>C\<^esub> (cod\<^bsub>Op C\<^esub> f) X" by (simp add: Hom_Op)
    thus ?thesis by (simp add:  OppositeCategory_def)
  qed
  ultimately show ?thesis by simp
qed

lemma HomFtorContraMor:
  assumes "LSCategoryC"and "X\<in obj\<bsubC\^sub>  "f <>\bsubC\^esub> 
  shows "HomC\<^bsub>C\<^esub>[f,X] \<in> Mor SET" and "dom\<^bsub>SET\<^esub> (HomC\<^bsub>C\<^esub>[f,X]) = Hom\<^bsub>C \<^esub>(cod\<^bsub>C\<^esub> f) X" 
  and "cod\<^bsub>SET\<^esub> (HomC\<^bsub>C\<^esub>[f,X]) = Hom\<^bsub>C \<^esub>(dom\<^bsub>C\<^esub> f) X"
proof-
  have "HomC\<^bsub>C\<^esub>[f,X] maps\<^bsub>SET\<^esub  and     " \inobj\<^ obj\esub>
  thus "HomC\<^bsub>C\<^esub>[f,X] \<in> Mor SET" and "dom\<^bsub>SET\<^esub> (HomC\<
  and "cod\<^bsub>SET\<^esub> (HomC\<^bsub>C\<^esub>[f,X]) = Hom\<^bsub>C \<^esub>(dom\<^bsub>C\<^esub> f) X"
    by auto
qed

lemma HomContraMor:
  assumes "LSCategory C" and "f \<in> Mor C" 
  shows "(Hom\<^bsub>C\<^esub>[\<midarrow>,X]) ## f = HomC\<^bsub>C\<^esub>[f,X]"
by(simp add: HomFtorContra_def HomFtorContra'_def MakeFtor_def assms OppositeCategory_def) 



(*This is used in the proof of the naturality of the Yoneda trans*)
lemma HomCHom:
  assumes "LSCategory C" and "f Mor C" and "g Mor C"
  shows "(HomC[g,dom f]) ;; (Hom[dom g,f]) = (Hom[cod
proof-
  have ObjDf: "dom f  obj" and ObjDg: "dom g  obj" using assms by (simp add: Category.Cdom)+
  have ObjCg: "codjava.lang.NullPointerException
  have "(HomC[g,dom f]) ;; (Hom[dom g,f]) = (HomC
  proof-
    have "(HomC[g,dom f]) > (Hom[dom g,f])"
    proof(rule CompDefinedI)
      show "Hom[dom g,f]  Mor SET" using assms ObjDg by (simp add: HomFtorMor)
      show "HomC[g,dom f]  Mor SET" using assms ObjDf by (simp add: HomFtorContraMor)
      show "cod (HomC[g,dom f]) = dom (Hom[dom g,f])" using assms ObjDg ObjDf
        by (simp add: HomFtorMor HomFtorContraMor)
    qed
    thus ?thesis by(simp add: SET_def SET'_def MakeCatComp2)
  qed
  also have "... = ZFfun (Hom (codjava.lang.NullPointerException
              ((λ h . m2z ((z2m h) ;; f)) o (λ h . m2z (g ;;java.lang.NullPointerException
  proof(simp add: HomFtorMapContra_def HomFtorMap_def, rule ZFfunComp, rule allI, rule impI)
    {
      fix x assume aa: "x || (Hom (cod g) (dom f))"
      show "(m2z (g ;; (z2m x))) || (Hom (dom g) (dom f))"
      prooflemma ZF2mor_Op (p C)f=ZF2mor
        have java.lang.NullPointerException
        moreover have "(z2m x) maps (cod g) to (dom mapsTo_Op " map\^Op C\<esub 
          by (simp add: LSCategory.z2mm2z)
        show" ;^bsubesub> z2mbsub
 g) to\^>C<^esub) using(1
          by (simp add: Category.Ccompt)
      qed
    }
  qed
  also have java.lang.NullPointerException
              ((λ h . m2z (g ;; (z2m h))) o (λ h . m2z ((z2m h) ;; f)))" 
  proof(rule ZFfun_ext, rule allI, rule impI)
    {
      fix h assume aa: "h || (Hom (cod g) (dom f))"
      show java.lang.NullPointerException
        ((λ h . m2z (g ;; (z2m h))) o (λ h . m2z ((z2m h) ;; f))) h"
      proof-
        have MapsTo1: "(z2m h) maps (cod g) to (dom f)" using assms(1) ObjCg ObjDf aa by (simp add: LSCategory.z2mm2z)
        have CompDef1: "(z2m h) > f"
        proof(rule CompDefinedI)
           " <>mor\^C\^esu>"  byjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
          show "(z2m h) mor" and "cod (z2m h) = dom f" using MapsTo1 by auto
        qed
        have CompDef2: "g > (z2m h)"
        proof(rule CompDefinedI)
          show "g mor" using assms by simp
          thus "(z2m h) mor" and "cod g = dom (z2m h)" using MapsTo1 by auto
        qed
        have c1: "(z2m h) ;; f (Op C)C)"
        have c2: "g ;; (z2m si only LSCa
        have "g ;; (z2m (m2z ((z2m h) ;; f))) = g ;; ((z2m h) ;; f)" using assms(1) c1
          by (simp add: LSCategory.m2zz2mInv)
        also have "... = (g ;; (z2m h)) ;; f" using CompDef1 CompDef2 assms by (simp add: Category.Cassoc)
        also have "... = (z2m (m2z (g ;; (z2m h)))) ;;
          by (simp add: LSCategory.m2zz2mInv)
        finally have "g ;; (z2m (m2z
         ?hesis byby simp
      qed hows " (<bsub>\midarrow) :(pC)\longrightarrow SET
    }
  qed
  also have "... = (Hom[cod[\midarrowX)"
  proof(simp add: HomFtorMapContra_def HomFtorMap_def, rule ZFfunComp[THEN sym], rule allI, rule impI)
    {
      fix x assume aa: "x || (Hom cod g dom f)"
      show "m2z ((z2m x) ;; f) || (Hom cod g cod f)" 
      proof(rule LSCategory.m2zz2m, simp_all add: assms(1) ObjCg ObjCf)
        have "f maps^bsub>Op C\^esub>"using  ( addOppositeCategory_def
        moreover have "(z2m x) maps (cod g) to (domu show ?the usi assms by (s addd HomFtorFtor)
          by (simp add: LSCategory.z2mm2z)
        ultimately show "(z2m x) ;; f maps cod g to cod f" using assms(1)
          by (simp add: Category.Ccompt)
      qed
    }
  qed
  also have "... = (Hom[cod g,f]) ;;
  proof-
    have "(Hom[codsub>" java.lang.NullPointerException
    proof(rule CompDefinedI)
      show "Hom[cod g,f] ^>\^\midarrow] @ Y= Hom>C 

      show "HomC[g,cod f] Mor SET" using assms ObjCf by (simp add: HomFtorContraMor)
      show "codhave 1: " \inObj"and : " <>Obj C) using(simp OppositeCategory_def
        by (simp add: HomFtorMor HomFtorContraMor)
    qed
    thus ?thesis by(simp add: SET_def SET'_def MakeCatComp2)
  qed
  finally show ?thesis .
qed

end

Messung V0.5 in Prozent
C=81 H=95 G=88

¤ Dauer der Verarbeitung: 0.217 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.