Skip to content
Naso Documentation

Naso Documentation

Naso Language Documentation

This documentation covers the Naso programming language, a systems language integrating Quantitative Type Theory (QTT), Mutable Value Semantics (MVS), automatic uncomputation, and polyhedral cross-hardware compilation with an embedded Z3 SMT prover.

Documentation Structure

SectionDescription
Language SpecificationComplete formal grammar, type rules, and operational semantics
Quantitative Type TheoryDeep dive into QTT quantities, semiring, and typing judgments
Standard LibraryAPI reference for std::quantum, std::poly, std::smt, std::mem, std::io
Formal Verificationnaso-verify SMT engine, error codes, and soundness proofs

Quick Start

1
2
3
4
5
6
7
8
9
# Install Naso toolchain
curl --proto '=https' --tlsv1.2 -sSf https://nasolang.org/install.sh | sh

# Create a new project
naso new hello_naso
cd hello_naso

# Build and run
naso run

Hello World: Bell Pair

fn main() -> [0] Proof {
    let q0 = qalloc();
    let q1 = qalloc();
    hadamard(inout q0);
    cnot(inout q0, inout q1);
    // q0, q1 now form a Bell pair |00⟩ + |11⟩
    // Automatic uncomputation on scope exit
}

Core Concepts at a Glance

ConceptNotationRuntime Behavior
Erased/Proof[0] TFully eliminated during codegen
Linear/Unique[1] TMust be consumed exactly once
Classical/Unbounded[*] TUnlimited copies, implicit drops
Bounded[N] TStatic quantity bounded by polyhedral domain
Mutable Referenceinout x: [1] TExclusive write access, copy-in/copy-out

Next Steps