Reference · Finite sums
rainbow.math.sums.of-nat
The bridge between a natural-number count written as the signed literal of-nat n = n/1 (the form the checkers use, e.g. A m = sum p) and a sum of n equal terms: nnrat/of-nat-successor : (k + 1)/1 ~ k/1 + 1 (nnrat equivalence) signed/of-nat-successor : of-nat (k + 1) ~ of-nat k + 1 signed/expr-sum-constant-of-nat : sum_{i<n} c ~ c * of-nat n The nnrat step unfolds to succ (k 1) = (k 1 + 1) 1 in nat, closed by multiply-one-right, add-successor-right and nat-add-zero-right (k 1 does not reduce: multiplication recurses on the left).
nnrat/of-nat-successor
nnrat/of-nat-successor : (k : ℕ) → nnrat/make (data/succ k) 0 = nnrat/make k 0 + 1
+ = nnrat/add1 = nnrat/one= = nnrat/equivalent: equality of rational valuesℕ = data/Nat
signed/of-nat-successor
signed/of-nat-successor : (k : ℕ) → signed/from-nnrat (nnrat/make (data/succ k) 0) = signed/from-nnrat (nnrat/make k 0) + 1
+ = signed/add1 = signed/one= = signed/equivalent: equality of rational valuesℕ = data/Nat
signed/expr-sum-constant-of-nat
signed/expr-sum-constant-of-nat : (c : ℚ) (n : ℕ) → signed/expr-sum-value (fun x₂ => c) n = c · signed/from-nnrat (nnrat/make n 0)
= = signed/equivalent: equality of rational values· = signed/multiplyℕ = data/Natℚ = signed/SignedRational