definition example

For a Function and , the fiber of over is the preimage . A function is thus an arrangement of over : different ‘s distribute the same elements into different fibers. Fibers are the pullbacks of along the global elements ; the fiber over a subset is the pullback .

Sources: 7 Sketches §7.3.3 (“Extended example: sections of a function”), Eq. (7.37), Exercise 7.38; DaoFP §11.1 (a dependent type is a family of fibers, “a bundle”); Kittenlab Lecture 13 (typed sets); CTfS Definition 2.5.1.12, Exercise 2.5.1.13, §2.7.6 (multisets, relative sets and indexed sets)

  • In Eq. (7.37) the fibers are over , over , over , over , over (7S Exercise 7.38).
  • Fibers are pullbacks (CTfS Exercise 2.5.1.13): the preimage is the fiber product of . Thinking of as a naming function gives CTfS’s multisets: element instances , names and a surjection whose fibers are the multiplicities (Multiset); dropping surjectivity allows multiplicity . Sets over and -indexed families of sets are two presentations of the same thing (Indexed Set).
  • A section of over picks one element of each fiber over ; these form the Sheaf of Sections .
  • Fibers are the categorical form of a Dependent Type (DaoFP §11): is the Dependent Sum. A Surjection has all fibers nonempty; an Injection has all fibers of size ; a Partition is the set of fibers of its classifying map.

Docs: FinSets — Kittenlab Lecture 13

using Catlab
f = FinFunction([1, 1, 2, 2, 2, 3, 5, 5], 5)    # Eq. (7.37): a,a,b,b,b,c,e,e
fiber(y) = preimage(f, y)
fiber.(1:5)                                     # [[1,2],[3,4,5],[6],[],[7,8]]
import Mathlib
#check @Set.preimage           -- f ⁻¹' {y}
example (f : ℕ → ℕ) (y : ℕ) : Set ℕ := f ⁻¹' {y}
fiber :: Eq y => [x] -> (x -> y) -> y -> [x]
fiber xs f y = [ x | x <- xs, f x == y ]