Product
Before introducing the product
Product in CT is somewhat related to products from arithmetic. So, in arithmetic, e.g. 6 = 2 3, means that 2 and 3 are factors of 6, either 2 or 3 factorizes 6. Similarly, in 6 = x 3 and with x restricted to β domain, there may be a nat that factorizes 6, or there may not be. If it exists, then it must satisfy the given equation.
If we know that a category C has a product object, P, then we know there will be two crucial arrows, both emerging from the product object but each going to some other, distinct, object, f: P -> A and g: P -> B in the category.
So, in the entire category, which may have a gazillion objects and arrows, we are looking for a pattern involving 3 objects and 2 arrows; such that two arrows emerge from the same object, P, and then one arrow goes to an object A and the other arrows goes to an object B (and all 3 objects are distinct).
P'
o
/β\
/ | \
/ | \
f'/ | \g'
/ | \
/ | \
/ | \
β f | g β
o <----- o -----> o
A P BProducts
The concepts of product corresponds to Cartesian products.
(Definition) A product of objects a and b in a category π consists of a product object a Γ b, and projection morphisms Οβ βΆ a Γ b β a and Οβ βΆ a Γ b β b, such that, for all objects c, and morphisms f βΆ c β a and g βΆ c β b, there is a unique morphism β¨f, gβ© βΆ c β a Γ b such that Οβ β β¨f, gβ© = f and Οβ β β¨f, gβ© = g.
In Hask, tuples are products and the two projection functions are fst and snd:
data (,) a b = (,) a b
fst :: (a,b) -> a
fst (a,b) = a
snd :: (a,b) -> b
snd (a,b) = b
fork :: (c -> a) -> (c -> b) -> c -> (a, b)
fork f g z = (f z, g z)The fork function is required to show that tuples are indeed products.
In Set, the product of two sets π΄ and π΅ consists of the Cartesian product π΄ Γ π΅ = {(π₯, π¦) β£ π₯ β π΄ and π¦ β π΅} and two projection functions Οβ βΆ π΄ Γ π΅ β π΄ and Οβ βΆ π΄ Γ π΅ β π΅ such that, for all (π₯, π¦) β π΄ Γ π΅, Οβ(π₯, π¦) = π₯ and Οβ(π₯, π¦) = π¦.
Given a set πΆ, and two functions π βΆ πΆ β π΄ and π βΆ πΆ β π΅, there is a unique function β¨π, πβ© βΆ πΆ β π΄ Γ π΅ defined by β¨π, πβ©(π§) = (π(π§), π(π§)) for all π§ β πΆ.
Last updated
Was this helpful?