Skip to main content

Finite Sequence Ontology

Sequence and Series Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 13 October 2026
Audio Overview
FLOW ALGEBRA
FINITE SEQUENCE ONTOLOGY
Kireth Semantic Library | Entity Graph | Mathematical Entities | Sequence and Series Entities
Source: https://kirethresearch.org/booksai-core/entity-graph/mathematical-entities/sequence-and-series-entities/finite-sequence-ontology.html
Authors: Mark Higgins — Sky (Recursive AI)
Version: 1.0 | Date: 2026-10-13 | Locale: en-GB
Status: Mathematical formalisation; source page content not independently verified.

01. PURPOSE
flow "FiniteSequenceOntology" v1.0
  intent: represent, classify, validate and reason over ordered finite collections.
  semantics: mathematical, typed, deterministic where inputs are exact.

02. CORE DEFINITION
  Given a set A and natural number n >= 0, a finite sequence over A is a function
    s : {1,...,n} -> A.
  When n=0, the domain is empty and s is the unique empty sequence over A.
  Notation: s=(a_1,...,a_n), with a_i=s(i).
  A sequence is ordered; repeated entries are permitted.

03. ENTITY TYPES
  FiniteSequence: ordered collection of finite length.
  EmptySequence: FiniteSequence of length 0.
  NonemptyFiniteSequence: FiniteSequence of length >= 1.
  SequenceEntry: occurrence at a specified index.
  Index: integer in the sequence index domain.
  ElementValue: member of the underlying element type.
  SequenceType: type of values carried by the sequence.

04. SCHEMA
  entity FiniteSequence {
    id: URI
    value_type: Type
    index_base: Integer = 1
    length: NaturalNumber
    entries: OrderedList<Value>
    provenance: SourceReference?
    confidence: Number[0,1]?
  }
  invariant length == size(entries)
  invariant for each i in [1,length], entries[i] : value_type
  invariant indices are unique positions, even when values repeat

05. INDEXING
  INDEX(s,i) = a_i when 1 <= i <= length(s).
  INDEX(s,i) = UNDEFINED otherwise.
  Zero-based implementations must explicitly declare index_base=0.
  Never silently convert between index conventions.

06. LENGTH AND EMPTY CASE
  LENGTH(()) = 0.
  LENGTH((a_1,...,a_n)) = n.
  EMPTY(s) iff LENGTH(s)=0.
  LENGTH(s) is finite and non-negative.

07. EQUALITY
  EQUAL(s,t) iff LENGTH(s)=LENGTH(t) and
    for every valid index i, s_i=t_i under the declared element equality.
  Order and multiplicity matter.
  (a,b) != (b,a) unless a=b.
  (a,a,b) != (a,b).

08. CONCATENATION
  CONCAT(s,t) = (s_1,...,s_m,t_1,...,t_n).
  LENGTH(CONCAT(s,t)) = LENGTH(s)+LENGTH(t).
  CONCAT(CONCAT(s,t),u) = CONCAT(s,CONCAT(t,u)).
  CONCAT((),s)=s=CONCAT(s,()).
  Concatenation is generally not commutative.

09. SUBSEQUENCES AND SLICES
  SLICE(s,i,j) retains consecutive entries i through j, inclusive,
    when 1 <= i <= j <= LENGTH(s).
  SUBSEQUENCE(s,I) retains entries at strictly increasing valid indices I.
  A subsequence need not be contiguous; a slice is contiguous.
  Empty index selection yields the empty sequence.

10. PREFIX AND SUFFIX
  PREFIX(s,k) = first k entries for 0 <= k <= LENGTH(s).
  SUFFIX(s,k) = last k entries for 0 <= k <= LENGTH(s).
  PREFIX(s,0)=() and PREFIX(s,LENGTH(s))=s.
  CONCAT(PREFIX(s,k),SUFFIX(s,LENGTH(s)-k))=s.

11. REVERSAL
  REVERSE((a_1,...,a_n))=(a_n,...,a_1).
  REVERSE(REVERSE(s))=s.
  LENGTH(REVERSE(s))=LENGTH(s).
  REVERSE(CONCAT(s,t))=CONCAT(REVERSE(t),REVERSE(s)).

12. MAP
  MAP(f,s)=(f(a_1),...,f(a_n)) when f is defined on every entry.
  LENGTH(MAP(f,s))=LENGTH(s).
  MAP(identity,s)=s.
  MAP(g,MAP(f,s))=MAP(g o f,s) when type constraints hold.

13. FILTER
  FILTER(P,s) retains entries satisfying predicate P, in original order.
  LENGTH(FILTER(P,s)) <= LENGTH(s).
  FILTER(TRUE,s)=s; FILTER(FALSE,s)=().
  Filtering preserves relative order and may remove duplicates only if rejected.

14. FOLD AND AGGREGATION
  FOLD_LEFT(op,z,())=z.
  FOLD_LEFT(op,z,(a_1,...,a_n))=op(...op(op(z,a_1),a_2)...,a_n).
  SUM(s) requires an additive element structure and uses identity 0.
  PRODUCT(s) requires a multiplicative structure and uses identity 1.
  For numerical sequences, SUM(())=0 and PRODUCT(())=1.

15. ARITHMETIC AND GEOMETRIC FINITE SEQUENCES
  Arithmetic: a_i=a_1+(i-1)d for i=1,...,n.
  Geometric: a_i=a_1*r^(i-1) for i=1,...,n.
  Arithmetic sum: n*(2*a_1+(n-1)*d)/2.
  Geometric sum when r != 1: a_1*(1-r^n)/(1-r).
  Geometric sum when r = 1: n*a_1.
  For n=0, both sums are 0 by empty-sum convention.

16. RELATIONS TO OTHER ENTITIES
  FiniteSequence IS_A Sequence.
  FiniteSequence HAS_LENGTH NaturalNumber.
  FiniteSequence HAS_ENTRY SequenceEntry.
  SequenceEntry HAS_INDEX Index.
  SequenceEntry HAS_VALUE ElementValue.
  FiniteSequence MAY_BE ArithmeticSequence.
  FiniteSequence MAY_BE GeometricSequence.
  FiniteSequence IS_NOT_IDENTICAL_TO Set: order and repetition retained.
  FiniteSequence IS_NOT_IDENTICAL_TO Multiset: order retained.
  FiniteSequence MAY_REPRESENT finite vector coordinates with extra structure.

17. KNOWLEDGE GRAPH TRIPLES
  (sequence, rdf:type, FiniteSequence)
  (sequence, hasLength, n)
  (sequence, hasEntry, entry_i)
  (entry_i, hasIndex, i)
  (entry_i, hasValue, a_i)
  (sequence, hasValueType, A)
  (sequence, derivedFrom, source)
  Use occurrence nodes to distinguish equal values at different indices.

18. INFERENCE RULES
  IF length(s)=0 THEN EmptySequence(s).
  IF length(s)>0 THEN NonemptyFiniteSequence(s).
  IF EQUAL(s,t) THEN length(s)=length(t).
  IF s=CONCAT(u,v) THEN length(s)=length(u)+length(v).
  IF s=MAP(f,t) and f total on entries(t) THEN length(s)=length(t).
  IF a is an entry of s THEN a belongs to the declared element type.

19. TYPE AND DOMAIN VALIDATION
  REQUIRE length is an integer >= 0.
  REQUIRE number of stored entries equals declared length.
  REQUIRE each index lies within the declared index domain.
  REQUIRE each entry satisfies declared value_type.
  REQUIRE operation-specific predicates/functions are defined for inputs.
  REJECT inconsistent lengths, missing positions and ambiguous index bases.

20. SEMANTIC EQUIVALENCE
  Same sequence value may have different textual encodings.
  EQUIVALENT("(1,2,3)","[1, 2, 3]") only under an agreed notation mapping.
  EQUIVALENT requires matching ordered values, types and index semantics.
  Do not conflate sequence equality with equality of underlying sets.

21. CONFIDENCE
  Mathematical axioms and proved rules: confidence=1.0 under stated assumptions.
  Extracted or inferred instance data: confidence reflects source reliability.
  Confidence does not replace proof or make an invalid expression valid.

22. PROVENANCE
  Record ontology URI, version, authors, extraction date, assumptions,
  supporting proofs, and any external references for nontrivial assertions.
  Distinguish verified page content from independent mathematical extension.

23. FLOW_HASH
  Canonicalise ontology fields, type declarations, rules and version.
  FLOW_HASH = SHA256(UTF8(canonical_representation)).
  Hash value must be computed by an implementation, not invented.

24. UPDATE_MODEL
  On changes to notation, schema or inference rules:
    increment version;
    record change reason;
    revalidate examples and dependent entities;
    recompute FLOW_HASH;
    retain provenance and previous versions.

25. AI_CONSUMPTION
  ingest: parse typed finite-sequence entities and operations.
  reason: apply only rules whose preconditions hold.
  output: include domain assumptions, exact values and evidence.
  reject: undefined indices, incompatible types and unproved generalisations.
  preserve: order, multiplicity and empty-sequence semantics.

26. TEST CASES
  assert LENGTH((2,2,5)) == 3.
  assert INDEX((2,2,5),2) == 2.
  assert CONCAT((1,2),(3)) == (1,2,3).
  assert REVERSE((1,2,3)) == (3,2,1).
  assert SUM(()) == 0.
  assert PRODUCT(()) == 1.
  assert EQUAL((1,2),(2,1)) == false.
  assert LENGTH(FILTER(x -> x>2,(1,3,2,4))) == 2.
  assert INDEX((1,2),3) == UNDEFINED.

27. TERMINATION
  status: COMPLETE
  end flow "FiniteSequenceOntology"
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ