Sheaf

Struct Sheaf 

Source
pub struct Sheaf<T: Topology, C: Category> {
    pub space: T,
    pub restrictions: HashMap<(T::Item, T::Item), C::Morphism>,
}
Expand description

Represents a sheaf over a topological space T with values in a category C.

A sheaf assigns an object from a category C to each item (e.g., open set, cell) in a topological space T. It also defines restriction morphisms that relate the data assigned to different items, ensuring consistency.

§Type Parameters

  • T: The underlying topological space, which must also implement Poset. Its items (T::Item) must be Hash + Eq + Clone for use in HashMap keys.
  • C: The target Category where the data (stalks/sections) of the sheaf reside. Objects of this category (C) must be Clone + Eq + Debug (if is_global_section is used). Morphisms (C::Morphism) must be Clone + Debug.

Fields§

§space: T

The underlying topological space (e.g., a cell complex, an ordered set of open sets). This space also implements Poset to define relationships (e.g., sub-item/super-item) between its items.

§restrictions: HashMap<(T::Item, T::Item), C::Morphism>

A map defining the restriction morphisms of the sheaf.

For a key (parent_item, child_item) where parent_item <= child_item according to the poset structure of T, the associated value C::Morphism is the restriction map from the data on child_item to the data on parent_item. That is, $\rho_{\text{parent_item}, \text{child_item}}: F(\text{child_item}) \to F(\text{parent_item})$.

Implementations§

Source§

impl<T, C> Sheaf<T, C>
where T: Topology + Poset, T::Item: Hash + Eq + Clone + Debug, C: Category + Clone + PartialEq + Debug, C::Morphism: Clone + Debug,

Source

pub fn new( space: T, restrictions: HashMap<(T::Item, T::Item), C::Morphism>, ) -> Self

Creates a new sheaf from a given topological space and a set of restriction maps.

The provided restrictions map should contain morphisms for all relevant pairs of items $(U, V)$ in the space T where $U \le V$. The constructor asserts that for every key (k.0, k.1) in restrictions, the relation space.leq(&k.0, &k.1) holds. Here, k.0 is treated as the parent (smaller item) and k.1 as the child (larger item). The restriction map is from $F(k.1)$ to $F(k.0)$.

§Arguments
  • space: The topological space T which also implements Poset.
  • restrictions: A HashMap where keys are (parent_item, child_item) tuples from T::Item (such that parent_item <= child_item), and values are the corresponding restriction morphisms $F(\text{child_item}) \to F(\text{parent_item})$ of type C::Morphism.
§Panics
  • Panics if any key (parent, child) in restrictions does not satisfy space.leq(&parent, &child) == Some(true). This includes cases where space.leq returns Some(false) (relation does not hold) or None (incomparable).
§TODO
  • Implement a builder API for more robust construction, ensuring all necessary restrictions are defined (e.g., for all successor relationships in the poset, and identity maps for $U \le U$).
  • Add validation for compatibility of restriction maps (e.g., identity $\text{res}{U,U} = \text{id}{F(U)}$ and composition $\text{res}{W,V} \circ \text{res}{V,U} = \text{res}_{W,U}$ axioms).
  • For specific categories (e.g., matrices as morphisms), check dimensional compatibility of morphisms.
Source

pub fn restrict( &self, parent_target_item: &T::Item, child_source_item: &T::Item, section_data_on_child: C, ) -> C

Restricts data from a larger item to a smaller item using the sheaf’s restriction map.

Given a parent_target_item $U$ and a child_source_item $V$ such that $U \le V$, this function retrieves the restriction morphism $\rho_{UV}: F(V) \to F(U)$ from the sheaf’s definition (stored under the key (parent_target_item, child_source_item)). It then retrieves the data $s_V \in F(V)$ corresponding to child_source_item from the provided section data. Finally, it applies the morphism to compute $s_U = \rho_{UV}(s_V)$, which is the data on $U$ restricted from $V$.

§Arguments
  • parent_target_item: The smaller item $U$ to which data is being restricted.
  • child_source_item: The larger item $V$ from which data is being restricted. Must satisfy parent_target_item <= child_source_item.
  • section_data_on_child: The data object $s_V \in F(V)$ associated with child_source_item.
§Returns

The restricted data $s_U \in F(U)$, result of applying the restriction map.

§Panics
  • Panics if parent_target_item <= child_source_item is false or if they are incomparable, as asserted by self.space.leq.
  • Panics if the restriction map for (parent_target_item, child_source_item) is not found in self.restrictions.
Source

pub fn is_global_section(&self, section: &HashMap<T::Item, C>) -> bool

Checks if a given section is a global section of the sheaf.

A section $s = {s_X}_{X \in T}$ is a global section if for every pair of items (parent_item, child_item) in self.restrictions (which implies parent_item <= child_item), the restriction of the data on child_item to parent_item is equal to the data already on parent_item.

That is, for each stored morphism $\rho_{\text{parent}, \text{child}}: F(\text{child_item}) \to F(\text{parent_item})$, it must hold that $\rho_{\text{parent}, \text{child}}(s_{\text{child_item}}) = s_{\text{parent_item}}$, where $s_{
text{child_item}}$ is section.get(child_item) and $s_{\text{parent_item}}$ is section.get(parent_item).

§Arguments
  • section: A HashMap where keys are items T::Item from the space and values are data objects of type C (from the target category), representing $s_X$ for each $X$.
§Returns
  • true if the section satisfies the global section condition for all defined restrictions.
  • false if any restriction condition is violated, or if data for a required item (involved in a restriction) is missing from the section.
Source§

impl<T, F: Field + Copy> Sheaf<Complex<T>, DynamicVector<F>>
where T: Hash + Eq + Clone + Debug + ComplexElement,

Source

pub fn coboundary(&self, dimension: usize) -> BlockMatrix<F, RowMajor>

Constructs the coboundary matrix δ^k: C^k → C^(k+1) for the sheaf.

The coboundary map is dual to the boundary map of the underlying complex. For dimension k, this maps k-cochains (sections over k-dimensional elements) to (k+1)-cochains (sections over (k+1)-dimensional elements).

The matrix has:

  • Rows indexed by (k+1)-dimensional elements
  • Columns indexed by k-dimensional elements
  • Entry (σ, τ) equals the orientation coefficient of τ in ∂σ where σ is (k+1)-dimensional and τ is k-dimensional
§Arguments
  • dimension: The dimension k of the domain (k-cochains)
§Returns

A block matrix representing δ^k: C^k → C^(k+1)

Auto Trait Implementations§

§

impl<T, C> Freeze for Sheaf<T, C>
where T: Freeze,

§

impl<T, C> RefUnwindSafe for Sheaf<T, C>

§

impl<T, C> Send for Sheaf<T, C>
where T: Send, <C as Category>::Morphism: Send, <T as Collection>::Item: Send,

§

impl<T, C> Sync for Sheaf<T, C>
where T: Sync, <C as Category>::Morphism: Sync, <T as Collection>::Item: Sync,

§

impl<T, C> Unpin for Sheaf<T, C>
where T: Unpin, <C as Category>::Morphism: Unpin, <T as Collection>::Item: Unpin,

§

impl<T, C> UnwindSafe for Sheaf<T, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.