Skip to content

yusdesign/rift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

rift

RIFT is for Resolutive Intuition Fixed Point formal method

Here's the content converted to well-structured Markdown:

πŸ“ Resolutive Coinduction Method: Complete Documentation

Table of Contents

  1. Foundations
  2. Parametric Guardedness
  3. Computational Interpretation
  4. Implementation Architecture
  5. Method Tree
  6. Quick Reference

Foundations

Core Principle

The Resolutive Coinduction Method treats infinite streams as coinductive data where:


Ξ½X.F(X) β€” Greatest Fixed Point

A stream is defined by its seed S and a step function:

const stream = {
    seed: initialValue,
    step: (s) => [value, nextSeed]
};

Key Insight

Different guardedness parameters produce different productivity inferences for the same stream definition:

Stream Strict Moderate Lax Minimal
powersOf2 βœ— (50) βœ“ (80) βœ“ (75) βœ“ (60)
squareWave βœ— (50) βœ“ (80) βœ“ (75) βœ“ (60)

The score threshold determines productivity:

Β· Strict (80): Requires thunk () => wrapper
Β· Moderate (60): Accepts any lambda =>
Β· Lax (40): Any tail call allowed
Β· Minimal (20): Bounded exploration only


Parametric Guardedness

Guard Levels

Level Threshold Requirements Use Case
πŸ”’ Strict 80 () => stream() wrapper Total functions, always productive
βš–οΈ Moderate 60 => expression Lazy evaluation, standard corecursion
πŸŒ€ Lax 40 Any tail call Process calculi, possibly productive
πŸ”“ Minimal 20 Bounded steps Debugging, finite exploration

Scoring System

Each stream receives a score based on:

Β· Array return (+25): return [value, next]
Β· Guard type (+10-45): Thunk > Lambda > Tail call
Β· Value production (+25): Value before recursion
Β· Runtime simulation (+0-15): Actual step execution

// Example: powersOf2 scores
// - Array return: +25
// - Lambda guard (n) =>: +30 (Moderate)
// - Value production: +25
// Total: 80 β†’ βœ“ Productive

Computational Interpretation

Curry–Howard Correspondence

Logic Computation
Ξ½X.F(X) (coinductive type) Stream data structure
Step function Producer of values
Guardedness proof Productivity certificate
Bisimulation Seed equality witness

Monadic Structure

The resolutive pattern forms a state monad:

M(A) = S β†’ A Γ— T(S) Γ— S

Where:

Β· S is the seed type (bisimulation witness)
Β· A is the value type
Β· T(S) is the thunked continuation

Guarded Operators

Operators preserve productivity when applied to guarded streams:

Operator Description Productivity
map(f) Transform values Preserved if source guarded
zip(s2) Pair values Preserved if both guarded
filter(p) Select values May need thunk for safety
take(n) Finite prefix Always productive
interleave(s2) Merge streams Preserved if both guarded
scale(k) Multiply values Preserved if source guarded

Implementation Architecture

Directory Structure

docs/
β”œβ”€β”€ index.html              # Main application
β”œβ”€β”€ guardo.html            # Backup/alternative
└── oeis/                  # OEIS data (optional)
    β”œβ”€β”€ oeis_index_min.json
    β”œβ”€β”€ oeis_manifest.json
    └── oeis_chunks/
        └── chunk_*.json

Core Classes

class ResStream {
    constructor(name, seed, stepFn)  // Core stream
    take(n)                          // Finite prefix
    map(f) / zip(s2) / filter(p)     // Guarded operators
}

class ParametricGuardednessChecker {
    setLevel(level)                  // STRICT/MODERATE/LAX/MINIMAL
    checkStream(stream)              // Returns {productive, score}
    compareLevels(stream)            // All levels at once
}

class StaticOEISLoader {
    loadIndex()                      // Load sequence index
    loadSequence(id)                 // Fetch by ID
    search(query)                    // Find sequences
}

Waveform Visualization

Canvas-based rendering with:

Β· Real-time plotting of stream values Β· Color-coded comparison (blue vs green) Β· Step slider for time-travel exploration


Method Tree

πŸ“ Resolutive Coinduction Method
β”‚
β”œβ”€β”€ Layer 1: Foundations
β”‚   β”œβ”€β”€ Ξ½X.F(X) β€” Greatest Fixed Point
β”‚   β”œβ”€β”€ ΞΌX.F(X) β€” Least Fixed Point (dual)
β”‚   └── Seed as bisimulation witness
β”‚
β”œβ”€β”€ Layer 2: Parametric Guardedness
β”‚   β”œβ”€β”€ Strict (80) β€” Thunk-wrapped recursion
β”‚   β”œβ”€β”€ Moderate (60) β€” Lambda guard
β”‚   β”œβ”€β”€ Lax (40) β€” Any tail call
β”‚   └── Minimal (20) β€” Bounded exploration
β”‚
β”œβ”€β”€ Layer 3: Computational Interpretation
β”‚   β”œβ”€β”€ Curry–Howard: Corecursion as program
β”‚   β”œβ”€β”€ Monad: S β†’ A Γ— T(S) Γ— S
β”‚   └── Seed equality = bisimulation
β”‚
β”œβ”€β”€ Layer 4: Guarded Operators
β”‚   β”œβ”€β”€ map, zip, filter, interleave, scale, take
β”‚   └── Productivity preservation proofs
β”‚
β”œβ”€β”€ Layer 5: Implementation
β”‚   β”œβ”€β”€ Waveform visualization (Canvas)
β”‚   β”œβ”€β”€ OEIS integration (static JSON + LFS)
β”‚   β”œβ”€β”€ Certificate export (JSON/Agda)
β”‚   └── Interactive bisimulation checking
β”‚
└── Layer 6: Applications
    β”œβ”€β”€ Stream equivalence
    β”œβ”€β”€ Process calculus bisimulations
    β”œβ”€β”€ Liveness properties
    └── Guarded recursive types

Quick Reference

Try These Streams in the Explorer

// Powers of 2 (geometric growth)
const powersOf2 = {
    seed: 1,
    step: (n) => [n, n * 2]
};

// Square wave (periodic 0,1)
const squareWave = {
    seed: 0,
    step: (n) => [n % 2, n + 1]
};

// Fibonacci (classic)
const fibonacci = {
    seed: [0, 1],
    step: ([a, b]) => [a, [b, a + b]]
};

// Triangle wave (sawtooth)
const triangleWave = {
    seed: { pos: 0, dir: 1 },
    step: (s) => {
        let val = s.pos;
        let newPos = s.pos + s.dir;
        let newDir = s.dir;
        if (newPos >= 10) { newPos = 8; newDir = -1; }
        if (newPos <= 0) { newPos = 1; newDir = 1; }
        return [val, { pos: newPos, dir: newDir }];
    }
};

OEIS Sequences Available

ID Name First Terms
A000027 Natural numbers 1,2,3,4,5...
A000045 Fibonacci 0,1,1,2,3,5,8...
A000079 Powers of 2 1,2,4,8,16,32...
A000142 Factorials 1,1,2,6,24...
A000217 Triangular 0,1,3,6,10,15...
A000290 Squares 0,1,4,9,16...
A000040 Primes 2,3,5,7,11...

Keyboard Shortcuts

Action Shortcut
Run streams Ctrl+Enter
Compare streams Ctrl+Shift+C
Clear all Ctrl+Shift+X
Load example Ctrl+Shift+E

Next Steps & Roadmap

Status Feature Description
βœ… Parametric Guardedness 4-level productivity checking
βœ… Waveform Visualization Canvas-based stream plotting
βœ… Guarded Operators map, zip, filter, interleave, scale
βœ… OEIS Integration Static JSON + fallback built-ins
πŸ”œ Coq/Agda Export Formal proof generation
πŸ”œ ML Inference Automatic bisimulation discovery
πŸ”œ Temporal Logic β–‘ (always), β—‡ (eventually) operators
πŸ”œ Vercel Backend Live OEIS fetching service

Citation

If you use this method in research, please cite:

@misc{resolutive2026,
    title = {Resolutive Coinduction Method},
    author = {Resolutive Explorer Contributors},
    year = {2026},
    url = {https://yusdesign.github.io/rift/}
}

Live Demo: https://yusdesign.github.io/rift/

The tool demonstrates that different guardedness parameters produce different productivity inferences β€” a key insight for reasoning about infinite data structures in constructive type theory

About

RIFT is for Resolutive Intuition Fixed Point formal method (RM)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors