Module primitives

Module primitives 

Source
Expand description

§Chapter 0.1: Primitive Concepts

We begin by defining the most basic mathematical objects needed for our construction. No prior knowledge is assumed beyond elementary set theory and basic programming concepts.

This chapter establishes:

  • What is a graph?
  • What is exact arithmetic?
  • What is a group?
  • What are vectors and inner products?

Each concept is accompanied by minimal Rust implementations that serve as executable definitions.

§0.1.1 Graphs

A graph is one of the most fundamental structures in mathematics and computer science.

§Definition 0.1.1 (Graph)

A graph G = (V, E) consists of:

  • A finite set V of vertices (also called nodes)
  • A set E ⊆ V × V of edges (pairs of vertices)

We write v ~ w when (v,w) ∈ E, read “v is adjacent to w”.

§Properties

  • Undirected: If v ~ w, then w ~ v (edges have no direction)
  • Simple: No self-loops (v ≁ v) and no multiple edges
  • Finite: Both V and E are finite sets

§Example 0.1.1: Triangle Graph

The triangle graph has 3 vertices {A, B, C} with edges forming a cycle:

    A
   / \
  B---C

In set notation: V = {A, B, C}, E = {(A,B), (B,C), (C,A)}.

§Computational Representation

We represent graphs using adjacency lists: for each vertex, store its neighbors.

Re-exports§

pub use crate::arithmetic::HalfInteger;
pub use crate::arithmetic::Rational;
pub use crate::arithmetic::Vector8;

Structs§

SimpleGraph
A simple undirected graph with vertices labeled by generic type V.

Enums§

KleinElement
Klein four-group: V₄ = {e, a, b, c} with every element its own inverse.