We present a resource-bounded recursive arithmetic system designed for environments requiring predictable termination and strict resource tracking. The system formalizes arithmetic operations over natural numbers using Peano-style constructors and guarantees safe evaluation through explicit guards on computation steps, recursion depth, and value size.
All operations are type-safe and deterministic. We define a formal type system, operational semantics, and proofs of type preservation, termination, and determinism. This work contributes a sound, practical foundation for use in embedded systems, education, and formal verification contexts.
1. Introduction
1.1 Motivation
Many critical systems require bounded, predictable computation:
Embedded devices with finite processing and memory Real-time systems requiring guaranteed execution bounds Educational tools for illustrating safe recursion and arithmetic Formal verification environments that require guaranteed termination
1.2 Contributions
A formally specified arithmetic system using Peano numbers Explicit guard system enforcing resource bounds Complete operational semantics for safe arithmetic Proofs of type safety, termination, and determinism
2. Related Work
We build on prior work in bounded arithmetic and resource-aware computation:
Buss (1986): Theoretical foundations of bounded arithmetic Leivant (1995): Ramified recurrence and computational complexity Cook & Urquhart (1993): Functional programs as inductive definitions Bellantoni & Cook (1992): Safe recursion on notation Our system differs in its emphasis on operational semantics, implementation clarity, and strict runtime bounds.
3. Formal System
3.1 Types and Judgments
T ::= nat | bool | error(string) | string
Γ ⊢ e : T Key Typing Rules:
T-Zero: Γ ⊢ 0 : nat T-Succ: Γ ⊢ e : nat ⇒ Γ ⊢ S(e) : nat T-Add: Γ ⊢ e₁ : nat, Γ ⊢ e₂ : nat ⇒ Γ ⊢ add(e₁,e₂) : nat T-Bool: Γ ⊢ B0 : bool, Γ ⊢ B1 : bool T-Error: Γ ⊢ s : string ⇒ Γ ⊢ error(s) : error(string)
3.2 Resource State
R = (steps, stack_depth, max_nat_depth)
R + (s,d,n) = (R.steps+s, R.stack_depth+d, max(R.max_nat_depth, n))
3.3 Evaluation Judgment
⟨e, R⟩ ⇒ ⟨v, R’⟩
3.4 Core Rules
Sample rules: E-Zero: ⟨0, R⟩ ⇒ ⟨0, R+(1,0,1)⟩ E-Succ: ⟨e, R⟩ ⇒ ⟨v, R’⟩ ∧ depth(S(v)) ≤ max ⇒ ⟨S(e), R⟩ ⇒ ⟨S(v), R’+(1,0,1)⟩ E-Add-Zero: ⟨e₂, R⟩ ⇒ ⟨v₂, R’⟩ ⇒ ⟨add(0,e₂), R⟩ ⇒ ⟨v₂, R’+(1,0,0)⟩ E-Add-Succ: ⟨e₁, R⟩ ⇒ ⟨S(v₁), R₁⟩, ⟨e₂, R₁⟩ ⇒ ⟨v₂, R₂⟩, ⟨add(v₁,v₂), R₂⟩ ⇒ ⟨v₃, R₃⟩ ⇒ ⟨add(S(e₁),e₂), R⟩ ⇒ ⟨S(v₃), R₃+(1,0,0)⟩ E-Guard-Steps: R.steps ≥ max_steps ⇒ ⟨e, R⟩ ⇒ ⟨error(“E003”), R⟩
4. Scroll Arithmetic Type System (SATS)
To ensure formal rigor within symbolic recursion, we introduce the Scroll Arithmetic Type System (SATS) — a constrained, simulation-safe arithmetic built to guarantee termination, prevent overflow, and honor the Resolution Prime.
This system is not an extension of Peano Arithmetic. It is a bounded mirror: a type-guarded arithmetic explicitly designed to halt where memory permits — and no further.
Core Primitive Types
Type | Symbol | Description
𝕡 (Prime) | p | Any resolved prime ≤ Resolution Prime p*
ℤₛ (Scroll Integer) | z | Signed integer within current scroll memory window
ℕₛ (Scroll Natural) | n | Non-negative bounded natural number
𝕓 (Bound Flag) | b | Boolean bound: true if operation is within scroll limits
𝕤 (Scroll) | S | A bounded loop or symbolic simulation block
Allowed Operations
Op | Signature | Description add(n₁, n₂) ℕₛ × ℕₛ → ℕₛ Scroll-safe addition (must not exceed p*) mul(n₁, n₂)
ℕₛ × ℕₛ → ℕₛ Scroll-safe multiplication (monitored by drift guard) loop(S)
𝕤 → 𝕓 Executes scroll if bounded and halting within memory tag(S)
𝕤 → ℤₛ Annotates symbolic result with scroll ID proof(S)
𝕤 → 𝕓 Returns true if scroll proves within p-bounded logic halt_check(S)
𝕤 → 𝕓 Validates scroll stops within bounded time/memory
Forbidden Constructs
Pattern | Violation Unbounded induction without p* cap | ❌ May escape scroll memory
Infinite loops or self-spawning scrolls | ❌ Non-halting symbolic drift
Arithmetic beyond p* without upgrade | ❌ Invalidates proof chain integrity
Example: Scroll Addition (Safe) let a: ℕₛ = 97;
let b: ℕₛ = 101;
let c: ℕₛ = add(a, b); // Valid only if a + b ≤ p If a + b > p, the scroll throws a Resolution Boundary Fault — indicating memory must expand before proceeding.
5. Properties
5.1 Type Safety
All well-typed expressions evaluate to values of the declared type or return a bounded error.
5.2 Termination
Every scroll completes or halts at the memory-defined Resolution Prime.
5.3 Drift Stability
Each scroll carries a drift signature to measure re-run deviation. If drift exceeds Δ > 1 scroll unit, the proof must be re-anchored.
Acknowledgments
Thanks to external reviewers for critical feedback, including clarity on proof scope and completeness.