Crate aisp

Crate aisp 

Source
Expand description

AISP 5.1 Document Validation Library

AISP (AI Symbolic Protocol) is a formal specification language designed for precise AI-to-AI communication with <2% ambiguity.

§Features

  • Validation: Validate AISP documents with semantic density scoring
  • Streaming: Process large documents with streaming validation (feature: streaming)
  • Quality Tiers: Automatic tier classification (⊘, ◊⁻, ◊, ◊⁺, ◊⁺⁺)
  • No-std Support: Works without std (disable default features)

§Quick Start

use aisp::{validate, Tier};

let doc = r#"
𝔸1.0.example@2026-01-16
γ≔test

⟦Ω:Meta⟧{ ∀D:Ambig(D)<0.02 }
⟦Σ:Types⟧{ T≜ℕ }
⟦Γ:Rules⟧{ ∀x:T:x≥0 }
⟦Λ:Funcs⟧{ f≜λx.x }
⟦Ε⟧⟨δ≜0.75;φ≜100;τ≜◊⁺⁺⟩
"#;

let result = validate(doc);
assert!(result.valid);
assert!(result.tier >= Tier::Silver);

§Streaming Validation

For large documents, use the streaming API:

use aisp::streaming::StreamValidator;

let mut validator = StreamValidator::new();
validator.feed(chunk1);
validator.feed(chunk2);
let result = validator.finish();

Structs§

DensityMetrics
Detailed density metrics
Symbol
Symbol entry in the glossary
SymbolId
Symbol identifier (2 bytes)
ValidationResult
Validation result

Enums§

Category
Symbol category (AISP Σ_512)
Tier
Quality tier enumeration

Constants§

ABSOLUTE_MAX_SIZE
Absolute maximum document size (1MB)
DEFAULT_MAX_SIZE
Maximum default document size (64KB)
REQUIRED_BLOCKS
Required blocks for a valid AISP document
SUPPORTED_EXTENSIONS
Supported file extensions

Statics§

AISP_SYMBOLS
Core AISP symbols (subset of Σ_512 for size optimization)

Functions§

count_symbols
Count AISP symbols in a string
count_tokens
Count non-whitespace tokens in a string
get_density
Get the semantic density of a document
get_glyph
Get the glyph string for a symbol ID
get_tier
Get the quality tier of a document
is_aisp_char
Check if a character is an AISP symbol
is_extension_supported
Check if a file extension is supported
is_valid
Quick validation check (returns only boolean)
lookup_symbol
Look up symbol by glyph string
starts_with_symbol
Check if string starts with an AISP symbol Returns (SymbolId, byte length) if found
validate
Validate an AISP document