Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/SuffixArray/sais/prop/   (Sammlung formaler Beweise Version 2026-5©) image not shown  

SSL SetCat.thy

  Sprache: Isabelle
 

(*
Author: Alexander Katovsky
*)


section

theory SetCat
imports Functors
begin

notation Elem (infixl java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null
notationZF||java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
notationrtProd<>\times|

definition 
  ZFfun :: "ZF ==>finally av F (i<^bu>aDm?FCatCod ?F\<^esub X Y)" by simp
  "ZFfun d r f om<^bsbC\<^>XCatCod ?F

definition
  ZFfunDom :: "ZF ==>'efeCatObjtObj
  "ZFfunDom f obj using d by (simp add: HomFtor'_def)

definition
  ZFfunCod :: "ZF ==>

  "ZFfunCod f

definition
  ZFfunApp :: "ZF ==> ZF ==>
  assumes

definition 
  ZFfunComp :: "ZF ==> ZF \esub
  "ZFfunComp f g   ctorMC])"

definition
  isZFfun :: "ZF ==>
  "isZFfun drf let f = Snd drf in
                 isOpair drf to Hm\^b>C])"
                 

lemma isZFfunE
  [isOpair f ; isOpair (Fst f) ; isFun (fixaainobj 
  ((Snd f) | Y <>obj^SET 
C>(z2m^bsubesubx ;esubf)"
  (Domain (Snd proo(ue_tcx"^C 

  by (auto simp add"mX Z obj by (simp add: SETef SSE' kCatOb)

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

      Category.Comphave\bsub
[X,←-]   s^SETC]) @@ Z) to(mPbsub[X,←-
  ) obj and cc <> obj using aa a by (simp addgory.psToObj

definition<equiv 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 |C
])@   om^>C 

  shows   "isZFfun (ZFfun A B f)"
proof(auto simp add: isZFfun_defbysimppdd)
    ZFfunCod_def isFun_Lambdadomain_Lambda)
  {
    
    have "x |
      
      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 s simp add: subset_def
  {
    fix x
    have "x |
      by(auto simpassumes"SCategoryaeor "
  }
  thus "(Lambda A f) || (A |× \<in 
    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 |
    and   "b || B"
    and   "x = Opair a b" using assms by auto
  thus (autoadd.m2zz2m
qed

lemma ZFfunDomainOpair:
  assumes "isFun f"
  andDomain f"
  shows "Opair x (app f x) |
proof-
  have
  thus "Opair x (app f x) |leHHo:
qed
  
lemma ZFFunToLambda:
  assumes 1: "isFun f"
  and 2: "f || (Range f)"
  shows "f = Lambda (Domain f) (λx. app f x)"   \^bsub>C[X,\midarrow]) @@ Y = Hom
proof(subst Ext, rule a
  {
    fix x assume a: "x || f" show "x |x. app
    proof(simp add: Lambda_def Repl, rule[  (stonjI
      
      thus "Fst x || Domain f" .ultimately<ub\esubX,←-]) @@ Y = (HomPX,b
      hence "Opair (Fst x) (app f (Fst x)) | 'o ==>HomC🍋[_proof(simp aa: Ho)
      moreover have "Opair
      ultimately have "Snd x = (app f (Fst x))" using 1 by (auto      
      "(stppFst Opairirst dxy
      also have "... = x"  using b by (simp add,ZF<lparrmor2ZF :: 'm ==> :: 'a)HomP🍋[←- [655
     finally"= pair (Fst x) (app f (Fx))" ..
    qed
  }
          Cod
  {
    fixpM g . HomCbsub

      proof-
         mbda_deffobtain here| Domain f  a
          using a by (
        thus ?thesisFtorContra<Hom🍋[←-,_]FtormFtorContra
      qed
  }
qed   

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

lemma ZFfun: 
  assumes "isZFfun f" 
  shows   " ZmorO:"(Cf F2mor
proofmp
  have "isOpair f \<and  
  hence "f =airir st) byaddFstSnd
  hencef = Opair autopadd or_Op 
  moreover have "Snd f = Lambda ( |dom| f) (λ
  proof-
    have "|dom| f = Domain (Snd f)" using assms by (simp add: isZF
    moreover have "isFun (Snd f)" using assms by (simp add: isZFfun_def[of f] Let_def)
    moreover have "(λx . f |@| x) = (< (CP<bsub[X,←-]"
oreovere ")|<>(DomainSnd |<>| (Range (Snd f))" using assms
      by (auto simp add: isZFfun_def[of f] Let_def)
    ultimately show ?thesi
  qed
  ultimately show "f   hence ZFfun^C\esub \bsub\^>f) (Hom><esub C bsub<^> f))"
qed

lemma ZFfun_ext:
  assumes "| A  f x   "
  shows "(ZFfunomFtorContrajava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
proof-
  have "Lambda A f = Lambda A g" using assms by (autosimpefmFtorContra
  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 |
  shows "f = g"
proof-
  have 1: "f = ZFfun ( |dom| f) ( |cod
  have HomFtorContraFtor
  hence 2"g = ZFfun ( |dom| f) ( |cod| f) (λ
  have "ZFfun ( |dom||f(<>. f |@| x) = ZFfun omcodx. g |@| x)"
    using assms by (simp add: ZFfun_ext)
  thus ?thesisug12bysm
qed

lemma ZFfunDomAppCod:
  assumes "isZFfun f"
  and "x || |dom|f"
  shows "f |@| x |haveombsubC,X] = Hom<> C]" by (simp add: HomFtorContra)
proof(simp add: ZFfunApp_def)
  have "app (Snd f) x |
  thus "app (Snd f) x |S sn a i : oFtoF)
qed

lemma ZFfunComp:
  assumes "  <> longrightarrow f x |
  shows   "(Ffu ABfoZBCg Fu g )
proof (simp add: ZFfunComp_def ZFfunDom ZFfunCod)
  {
    fix x assume a: "x |
    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 (shows"Hom\^C,X]) @@ Y = Hom X"
        hence "ZFfun B C g |@| (ZFfun A B f |@| x) = g (f x)" using assmsC
,X]) @@ Y Hom>Op C
        thusalsohave.(m^Op
      qed
  }
  thus "ZFfun A C (λcirf)"
    by (simp add: ZFfun_ext)
qed

lemma ZFfunCompApp"\in obj\^b>C\^e>"and<java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  assumes a:"isZFfun (sid oFtrota_e
  hows w f ||o|g=Zfu ( dm ) ( co (<am>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) ( |o|g(<> x . g |@| x)" using b by (rule ZFfun
  have impdppositeCategory_def
  hence:"\forall>
    using a b c by (simp add: ZFfunDomAppCod)
  have "f |o| g = ZFfun ( |mf(d <lambda x . f |@ ||
    ZFfun ( |cod| f) ( |cod| g) (λ
  hence "f |o| g = ZFfun ( |dom| f) ( |cod| g) (λC) sngsm ysm d:SCagoyO)
     u 3b (si : co)
  thus ?thesis using 4 by (simp add: SETfun)
qed

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

lemma ZFfunCompAssoc
  assumes 
  and d:"isZFfun g" andOp C Op C
  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
  have 2"g = ZFfun ( |dom| g) ( |cod| g) (λ x . g |@| x)" using d by (rule ZFfunomFtorContraMorontraMor
  have 3"h = ZFfun ( |dom| h) ( |cod| h \>x . h |@| x)" usingylen
  have 4"| |dom|f x. f |@| x) x |\<inby
  have "(f |o| g) |o| h = ZFfun ( |dom| f) ( |cod| h) (\>  |( @    matelytely?hesisyautompaddjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
  proof-
    have 5"
      using 4 e d by (simp add: ZFfunDomAppCod)
    have "( |g|
      ZFfun ( |cod| f) ( |cod| g) (λ x . g |@| x)) |o|
      ZFfun ( |codg(|od      
      using 1 2 3 c e bybyauto
    thus ?thesis
  qed
  moreoverC,X]) ## f = omCC
  proof-
       5:forallx  x|<> ||g \longrightarrowλx |\in>||cod using by ( : ZFfunDomAppCod
    have "f |o| (g |o| h) = ZFfun ( |dom| f) ( |dom| g) (λ x . f |@| x) |o|
      (ZFfun ( |dom|
      ZFfun ( |cod| g) ( |cod| h) (λ x . h |@| x))" 
      using HomCHom:
    thus ?thesis using 4 e 5 by (simp add: ZFfunComp comp_def)
  qedqed
  ultimately showis mp
qed
  
lemma ZFfunCompAppDomCod
  assumes "isZFfun f" and "isZFfun g" and "proof-
  shows "|domf||g)=dom| \and || (fo|g ==cod"
proof-
  have "f |o| g = ZFfun ( |dom| fjCg"od\<<bsub g CC
    by (simp add: ZFfunCompApp)
  thus ?thesis by (simp add:: ZFfu ZFfunCod)
qed

lemma ZFfunIdLeft:
  assumes a: is f" shows(fundom (lambda. x)) |o| f = f"
proof-
  let ?g = "(ZFfun ( |dom|f) ( |dom|f) (λx. x))"
  have "ZFfun ( |dom| f) ( |codHom>Cg,f] 
    by (simp add: ZFfun_ext ZFfunApp HomCg,domf]  Mor SET" usi assms ObjDf by (simpadd: HomFtorContraMor)
  moreover have "f = ZFfun ( |dom  |od(<lambdax . f  |@| x a  ( ZFfun
  ultimately  simp: HomFtorMor)
qed

lemma:
  assumes a: "isZFfun f" shows
-
  let ?g = "(ZFfun ( |cod|f) ( |cod|f) (\<((| (Hom(codg) (domdom^e>X,f])= Ho<^>C )"andX,]  esub)
  have 1" x . x || |dom|f (λx. f |@| x) x || |cod|f" using a by (simp add: ZFfunDomAppCod)
  have "ZFfun ( |dom| f) ( |cod| f) (λ x . f |@| x) = f |o| ?g" using a 1
    by (simp add: ZFfun_ext ZFfunApp ZFfunCompApp SETfun ZFfunCod ZFfunDom)
  moreover have "f = ZFfun ( |dom| ) cd )(<lambda> .f@ ) using a by (rule ZF ZF)
  ultimately show ?thesis by simp
qed

lemma SETCategory: "Category(SET)"
proof-
  have "Category_axioms SET'"
    by (auto simp add: Category_axioms_def SET'_def ZFfunCompAppDomCod
      ZFfunCompAppZFfun ZFfunCompAssoc ZFfu ZFfunIdRight ZFfunDom ZFfunCod SETfun MapsTo_def CompDefined_d)
  thus ?thesis by (auto simp add: SET_def MakeCat)
qed

lemma SETobj: " add Category)
by (simp add: SET_def

lemma SETcod: java.lang.NullPointerException
by(simp add: SET_def MakeCat_def SET'_def ZFfunCod)

lemma SETmor: "(isZFfun f) = (f  mor(\lambdaz<bsub
 (g ;;(z2m^sub ))o(<> m2z>CCC

by(simp add: SET_def MakeCat_def SET'_def)

lemma SETdom: "isZFfun (ZFfun A B f) ==> dom ZFfun A B f = A"
by(simp add: SET_def MakeCat_def SET'_def ZFfunDom)

lemma : assumesin| X" shows "(Id SET X) |@| x = x"
proof-
  have " Obj SET" by (simp a
  hence "isZFfun(Id      fixassume" |\inHm<^sbC<esb cd<bsuub
g)(do\^bC<eu>f)
  moreover have "(Id SET X) = ZFfun X X (show(\lambdam2zsubesub ((z2mh) ;;f)) o (λ  d
  ultimately show ?thesis usingfunAppp
qed

lemma SETCompE[elim]: "[>g ; [
by (auto simp add: SET_def SET'_def MakeCat_def)

lemma SETmapsTo: "f maps>ET<esubLongrightarrow isZFfun f  ><bsub>g 
by(auto simp add: MapsTo_defI

lemma SETComp "f \approx\^>SET
SET

proof-
  have a: "> SET' g" using assms by (simp add: SET_def)
  have "f ;;g = f ;;java.lang.NullPointerException
  alsoso..= f;<bsub'

  finally show ?thesis by (simppDef2\approx\>
C

qed

lemma SETCompAt:
  assumes "f > mor and "codg = dom(z2mCMapsTo1 by auto
proof
  have "f ;; g = f |o| g" using assms by (simp add: SETComp)
  also .=ZFfunundom)||g<ambda  @f| x using by(utoadd ZFfunCompApp
  finally show ?thesis using assms by (simp add: ZFfunApp)
qed

lemma SETZFfun: 
  assumes "f mapshave c2:"g ;\>C
C
 < Mor C" using assms CompDef2 by (simp add: Category.MapsToMorDomCod)
proof-
  have "isZFfun f" using assms by (auto simp add: SETmor)
  hence "f = ZFfun.=g;<^>CCCgory
  moreover have "|d als h... = (z2\<>CCCCC
 timatelyshw?tei y sp
qed

lemma SETfunDomAppCod:
  assumes "mapsSET | X"
  shows " |@|x |n
proof-
  have 1"isZFfun f" and "|dom| f = X" and 2"|cod| f = Y" using assms
  hence "x | by s
  hence "f |@| x || |cod| f" using 1 by (simp add: ZFfunDomAppCod)
  thus ?t using 2 by simp
qed

(*Locally Small Category has an injective map from the morphisms to ZF*)
record ('o,'m) LSCategory = "('o,'m) Category\>,)<bsub'<esubHom^bsub<^esubXdombsub\^esubfto<^>C\^esubXcod<sub>fjava.lang.StringIndexOutOfBoundsException: Index 156 out of bounds for length 156
  mor2ZF :: "'m ==>m2z🍋_7]70

definition
  ZF2mor (
  "ZF2mor C f \<equiv> THE m . m \<in> mor\<^bsub>C\<^esub> \<and> m2z\<bsubb<esub f

definition
  "HOMCollection C X Y \<equiv> {m2z\    mpDefinedInedI

definition
  HomSet (\<open>Hom\<index> _ _\<close> [65, 65] 65)  where
  "HomSet C X Y \<equiv> implode (HOMCollectionC Y

locale LSCategory = Category +
  assumes mor2ZFInjshow?hesis
  and HOMSetIsSet: "\<lbrakk>X \<in> obj ; Y \<in> obj\<rbrakk> \<Longrightarrow> HOMCollection Cjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  and m2zExt: "mor2ZF C \<in> extensional (Mor C)"

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

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

definition 
  HomFtor' :: "('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
  "HomFtor' C X \<equiv> \<lparr>
        CatDom = C, 
        CatCod = SET ,
        MapM   = \<lambda> g . Hom\<^bsub>C\<^esub>[X,g]
  \<rparr>"

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

lemma [simp]: "LSCategory C \<Longrightarrow> Category C"
  by (simp add: LSCategory_def)

lemma (in LSCategory) m2zz2m: 
  assumes "f maps X to Y" shows "(m2z f) |\<in>| (Hom X Y)"
proof-
  have "X \<in> Obj C" and "Y \<in> Obj C" using assms by (simp add: MapsToObj)+
  hence "HOMCollection C X Y \<in> range explode" using assms by (simp add: HOMSetIsSet)
  moreover have "(m2z f) \<in> HOMCollection C X Y" using assms by (auto simp add: HOMCollection_def)
  ultimately have "(m2z f) |\<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) = f"
proof-
  have 1: "f \<in> mor \<and> m2z f = m2z f" using assms by simp
  moreover have "\<exists>! m . m \<in> mor \<and> m2z m = (m2z f)" 
  proof(rule ex_ex1I)
    show "\<exists> m . m \<in> mor \<and> m2z m = (m2z f)" 
      by(rule exI[of _ f], insert 1, simp)
    {
      fix m y assume "m \<in> mor \<and> m2z m = (m2z f)" and "y \<in> mor \<and> m2z y = (m2z f)"
      thus "m = y" by(simp add: mor2ZFInj)
    }
  qed
  ultimately show ?thesis by(simp add: ZF2mor_def the1_equality)
qed

lemma (in LSCategory) z2mm2z: 
  assumes "X \<in> obj" and "Y \<in> obj" and "f |\<in>| (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>    have ".  ZFfun? C ?go?)" 
  java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    have "HOMCollection C X Y \<in> range explode" using assms by (simp add: HOMSetIsSet)
    moreover have "f |\<in>| implode (HOMCollection C X Y)" using assms(3) by (simp add: HomSet_def)
    ultimately have "f \<in> HOMCollection C X Y" by (simp add: HOLZF.Elem_implode)
    thus ?thesis by (auto simp add: HOMCollection_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 m = f"
    proof-
      from 1 obtain m where "m \<in> mor \<and> m2z m = f" by auto
      thus ?thesis by auto
    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: mor2ZFInj)
    }
  qed
  thus ?thesis
  proof-
    from 1 obtain a where 3: "a maps X to Y \<and> m2z a = f" by auto
    have 4: "a \<in> mor" using 3 by auto
    have "z2m f = a" 
      apply (auto simp add: 3 ZF2mor_def[of _ f])
      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 |\<in>| (Hom\<^bsub>C\<^esub> X (dom\<^bsub>C\<^esub> f))"
  shows "(m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>x) ;;\<^bsub>C\<^esub> f)) |\<in>| (Hom\<^bsub>C\<^esub> X (cod\<^bsub>C\<^esub> f))"
proof-
  have 1: "dom\<^bsub>C\<^esub> f \<in> obj\<^bsub>C\<^esub>" and 2: "cod\<^bsub>C\<^esub> f \<in> obj\<^bsub>C\<^esub>" using a c by (simp add: Category.Simps)+
  have "z2m\<^bsub>C\<^esub> x maps\<^bsub>C\<^esub> X to (dom\<^bsub>C\<^esub> f)"  using a b d 1 by (auto simp add: LSCategory.z2mm2z)
  hence "(z2m\<^bsub>C\<^esub> x) ;;\<^bsub>C\<^esub> f maps\<^bsub>C\<^esub> X to (cod\<^bsub>C\<^esub> f)" using a c by (auto intro: Category.Ccompt)
  hence "(m2z\<^bsub>C\<^esub> ((z2m\<^bsub>C\<^esub> x) ;;\<^bsub>C\<^esub> f)) |\<in>| (Hom\<^bsub>C\<^esub> X (cod\<^bsub>C\<^esub> f))" using a b d 2 
    by (auto simp add: LSCategory.m2zz2m)
  thus ?thesis using c by (simp add: Category.Simps)
qed

lemma HomFtorInMor':
  assumes "LSCategory C" and "X \<in> obj\<^bsub>C\<^esub>" and "f \<in> mor\<^bsub>C\<^esub>"
  shows "Hom\<^bsub>C\<^esub>[X,f] \<in> mor\<^bsub>SET'\<^esub>" 
proof(simp add: HomFtorMap_def)
  {
    fix x assume "x |\<in>| (Hom\<^bsub>C\<^esub> X dom\<^bsub>C\<^esub> f)" 
    hence "m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>x) ;;\<^bsub>C\<^esub> f) |\<in>| (Hom\<^bsub>C\<^esub> X cod\<^bsub>C\<^esub> f)" using assms by (blast intro: HomFtorMapLemma1)
  }
  hence "\<forall> x . x |\<in>| (Hom\<^bsub>C\<^esub> X dom\<^bsub>C\<^esub> f) \<longrightarrow> (m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>x) ;;\<^bsub>C\<^esub> f)) |\<in>| (Hom\<^bsub>C\<^esub> X cod\<^bsub>C\<^esub> f)" by (simp)
  hence "isZFfun (ZFfun (Hom\<^bsub>C\<^esub> X dom\<^bsub>C\<^esub> f) (Hom\<^bsub>C\<^esub> X cod\<^bsub>C\<^esub> f) (\<lambda> x . m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>x) ;;\<^bsub>C\<^esub> f)))"
    by (simp add: SETfun)
 " (\^sub>\^>Xdom\^bsub>C<^sub>f (Hom^>\<esub>Xcod<^><esub f)\lambdax.m2z<bsubC\^>(\^> <>x);\bsub>\^esub ) <>mor^>SET\<esub>
    by (simp add: SET'_def)
qed

lemma HomFtorMor':
  assumes "LSCategory C" and "X \<in> obj\<^bsub>C\<^esub>" and "f \<in> mor\<^bsub>C\<^esub>"
  shows   "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)"  
proof-
  have "Hom\<^bsub>C\<^esub>[X,f] \<in> mor\<^bsub>SET'\<^esub>" using assms by (simp add: HomFtorInMor')
  moreover have "dom\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,f]) = Hom\<^bsub>C \<^esub>X (dom\<^bsub>C\<^esub> f)"
    by(simp add: HomFtorMap_def SET'_def ZFfunDom)
  moreover have "cod\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[X,f]) = Hom\<^bsub>C \<^esub>X (cod\<^bsub>C\<^esub> f)"
    by(simp add: HomFtorMap_def SET'_def ZFfunCod)
  ultimately show ?thesis by (auto simp add: SET_def)
qed

lemma HomFtorMapsTo:
  "\<lbrakk>LSCategory C ; X \<in> obj\<^bsub>C \<^esub>; f \<in> mor\<^bsub>C \<^esub>\<rbrakk> \<Longrightarrow> 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)"
by (simp add: HomFtorMor' SET_def MakeCatMapsTo)

lemma HomFtorMor:
  assumes "LSCategory C" and "X \<in> obj\<^bsub>C\<^esub>" and "f \<in> mor\<^bsub>C\<^esub>" 
  shows "Hom\<^bsub>C\<^esub>[X,f] \<in> Mor SET" and "dom\<^bsub>SET\<^esub> (Hom\<^bsub>C\<^esub>[X,f]) = Hom\<^bsub>C \<^esub>X (dom\<^bsub>C\<^esub> f)" 
  and "cod\<^bsub>SET\<^esub> (Hom\<^bsub>C\<^esub>[X,f]) = Hom\<^bsub>C \<^esub>X (cod\<^bsub>C\<^esub> f)"
proof-
  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 by (simp add: HomFtorMapsTo)
  thus "Hom\<^bsub>C\<^esub>[X,f] \<in> Mor SET" and "dom\<^bsub>SET\<^esub> (Hom\<^bsub>C\<^esub>[X,f]) = Hom\<^bsub>C \<^esub>X (dom\<^bsub>C\<^esub> f)" and "cod\<^bsub>SET\<^esub> (Hom\<^bsub>C\<^esub>[X,f]) = Hom\<^bsub>C \<^esub>X (cod\<^bsub>C\<^esub> f)"
    by auto
qed

lemma HomFtorCompDef':
  assumes "LSCategory C" and "X \<in> obj\<^bsub>C\<^esub>" and "f \<approx>>\<^bsub>C\<^esub> g" 
  shows   "(Hom\<^bsub>C\<^esub>[X,f]) \<approx>>\<^bsub>SET' \<^esub>(Hom\<^bsub>C\<^esub>[X,g])"
proof(rule CompDefinedI)
  have a: "f \<in> mor\<^bsub>C\<^esub>" and b: "g \<in> mor\<^bsub>C\<^esub>" using assms(3) by auto 
thusHom<bsubC\<^esub[,] \in mor<bsubSET\^> and"\<bsub>\^>Xg <in \^>SET'<esub"using  by( :HomFtorInMor'+
  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"
    and "(Hom\<^bsub>C\<^esub>[X,g]) maps\<^bsub>SET'\<^esub> Hom\<^bsub>C\<^esub> X dom\<^bsub>C\<^esub> g to Hom\<^bsub>C\<^esub> X cod\<^bsub>C\<^esub> g" using assms a b by (simp add: HomFtorMor')+
  hence "cod\<^bsub>SET'\<^esub> (Hom\<^bsub>C\<^esub>[  assumes a: "LSCategory C"
    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
    "cod\<^bsub>SET'<esub (\<bsubC\^esub>X,f] =dom<bsubSET<esub (\^bsub>C<esub>Xg) 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>  ultimately show thesisusingb( :PreFunctor[?  \^C\> 
  let ?f = "(\<lambda>h. m2z\<^bsub>C \<^esub>((z2m\<^bsub>C \<^esub>h) ;;\<^bsub>C\<^esub> f))"
  let ?g = "(\<lambda>f. m2z\<^bsub>C
  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)" 
    (addHomFtorMap_defSET'defjava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
  also have "... = (ZFfun ?A ?B ?f) |o| (ZFfun ?B ?C ?g)" using 1 by simp
  also have "... = ZFfun ?A ?C (?g o ?f)" 
  proof(rule ZFfunComp, rule allI, rule impI)
    {
      fix h assume aa: "h |\<in>| ?A" show "?f h |\<in>| ?B"
      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        and "HomP<>\^sub>[\midarrow])@Y=Hom<^>\^> " usingassmsbbcc  simpadd: HomFtorObj+
    {
      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))"

        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>        : "PreFunctor (\<bsubC\^>X\midarrow>"  simpaddFunctorM_def
        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
   "..  Hom\<bsubC\^esub[,f ;;<bsub>C\^> ]"  simp :  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-
  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> g]" using assms by (simp add: HomFtorDist')
  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> HomFtorContraDom  Hom^>\esub\>,) Op "
    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)+
         "(z2m\<^bsub>\<^esub> ) ;\<bsub>C<^esub> (id<^bsub>C\^esub>Y)  z2m\<bsub>C\<esub h)"  a by (autosimp add Category.imps)
        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 \<^esub>X Y)"
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':
  assumes a: "LSCategory C"
  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-
  let ?F = "(HomFtor' C X)"
  have "?F ## (id\<^bsub>CatDom
  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 show ?thesis using b by(simp add: PreFunctor.FmToFo[of ?F Y "Hom\<^bsub>C \<^esub>X Y"])
qed

lemma HomFtorFtor': 
  assumes a: "LSCategory C"
  and     b: "X \<in> obj\<^bsub>C\<^esub>"
  shows   "FunctorM (HomP\<^bsub>C\<^esub>[X,\<midarrow>])"
proof(intro_locales)
  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
  {
    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" 
        assumes LSCategory "and " <in>obj<>C\^sub> andf \in mor<^><esub> 
      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>[X,\<midarrow>])"
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 \> bsub>C\<^esub>" and "Y \<in>\<^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')
  hence 1: "PreFunctor (HomP\<^bsub>C\<^esub>[X,\<midarrow>])" by (simp add: 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
  "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 |\<in>| (Hom\<^bsub>C \<^esub>(cod\<^bsub>C\<^esub> f) X) \<Longrightarrow> (HomC\<^bsub>C\<^esub>[f,X]) |@| x = m2z\<^bsub>C\<^esub> (f ;;\<^bsub>C\<^esub> (z2m\<^bsub>C\<^esub> x))"
  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)

lemmaZF2mor_Op: "ZF2mor ( C   ZF2mor C f"
by (simp add: ZF2mor_def mor2ZF_Op mor_Op)

lemma: faps<bsub>C^>Y to X = f maps\<^bsub>C\<^esub> X to Y"
by (auto simp add: OppositeCategory_def mor_Op         ultimately show "g;;<^bsub>C\<^(\<^>C ^>x) maps\<^bsub>C\<^esub> (dom\<^bsub>C\<^esub>  (dom\bsub>\^> f" assms()

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 HomFtorContrashowf\<in \bsub><ub usingassmsby simp
by (auto simp add: HomFtorContra' HomFtorContra_def HomFtor_def)

lemma HomFtorContraDom: "CatDom (Hom\<^bsub>C\<^esub>[\<midarrow>,X]) = Op C"
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 )
proof(auto mply Category_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     thus?esis ymp
  sFtor (om\^bsub>C\<^esub[<>,X]) :(p  <>SET"
proof(auto simp only: functor_abbrev_def)
  show "Functor (Hom\<^bsub>C\<^esub><>,]
  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\^><b using assmsbysimp: OppositeCategory_def)
    ultimatelywhesisingsysimp :mFtorFtortor
  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\<^b andY <> obj<>\<^esub>"
  shows   "(Hom\<bsubC\esub>[\<midarrow>,X) @ =Hom\<^bsub>C ^>Y X"
proof-
  X<> Obj (Op C) 2Y\in>Obj (OpC" assms by ( add:OppositeCategory_def)+
  have "(Hom\<^bsub>C\<^esub>[\<midarrow>,X]) @@ Y = (Hom\<^bsub>Op C\<^esub    qed
  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 "LSCategory C" and "X \<in> obj\<^bsub>C\<^esub>" and "f \<in> mor\<^bsub>C\<^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> Hom\<^bsub>C \<^esub>(cod\<^bsub>C\<^esub> f) X  to Hom\<^bsub>C \<^esub>(dom\<^bsub>C\<^esub> f) X" using assms by (simp add: HomFtorContraMapsTo)
  thus "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"
    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 g,f]) ;; (HomC[g,cod f])"
proof-
  have ObjDf: "dom f obj" and ObjDg: "dom g obj" using assms by (simp add: Category.Cdom)+
  have ObjCg: "cod g obj" and ObjCf: "cod f obj" using assms by (simp add: Category.Ccod)+
  have "(HomC[g,dom f]) ;; (Hom[dom g,f]) = (HomC[g,dom f]) |o| (Hom[dom g,f])" 
  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 (cod g) (dom f)) (Hom (dom g) (cod f))
              ((λ h . m2z ((z2m h) ;; f)) o (λ h . m2z (g ;; (z2m h))))" 
  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))"
      proof(rule LSCategory.m2zz2m, simp_all add: assms(1) ObjDg ObjDf)
        have "g maps (dom g) to (cod g)" using assms by auto
        moreover have "(z2m x) maps (cod g) to (dom f)" using aa ObjCg ObjDf assms(1
          by (simp add: LSCategory.z2mm2z)
        ultimately show "g ;; (z2m x) maps (dom g) to (dom f)" using assms(1)
          by (simp add: Category.Ccompt)
      qed
    }
  qed
  also have "... = ZFfun (Hom (cod g) (dom f)) (Hom (dom g) (cod f))
              ((λ 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 "((λ h . m2z ((z2m h) ;; f)) o (λ h . m2z (g ;; (z2m h)))) h =
        ((λ 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)
          show "f mor" using assms by simp
          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 Mor C" using assms CompDef1 by (simp add: Category.MapsToMorDomCod)
        have c2: "g ;; (z2m h) Mor C" using assms CompDef2 by (simp add: Category.MapsToMorDomCod)
        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)))) ;; f" using assms(1) c2
          by (simp add: LSCategory.m2zz2mInv)
        finally have "g ;; (z2m (m2z ((z2m h) ;; f))) = (z2m (m2z (g ;; (z2m h)))) ;; f" .
        thus ?thesis by simp
      qed
    }
  qed
  also have "... = (Hom[cod g,f]) |o| (HomC[g,cod f])"
  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 (dom f) to (cod f)" using assms by auto
        moreover have "(z2m x) maps (cod g) to (dom f)" using aa ObjCg ObjDf assms(1
          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]) ;; (HomC[g,cod f])"
  proof-
    have "(Hom[cod g,f]) > (HomC[g,cod f])"
    proof(rule CompDefinedI)
      show "Hom[cod g,f] Mor SET" using assms ObjCg by (simp add: HomFtorMor)
      show "HomC[g,cod f] Mor SET" using assms ObjCf by (simp add: HomFtorContraMor)
      show "cod (Hom[cod g,f]) = dom (HomC[g,cod f])" using assms ObjCg ObjCf
        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.44 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© 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.