FSharp.Azure.Quantum.Topological 0.3.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package FSharp.Azure.Quantum.Topological --version 0.3.6
                    
NuGet\Install-Package FSharp.Azure.Quantum.Topological -Version 0.3.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FSharp.Azure.Quantum.Topological" Version="0.3.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FSharp.Azure.Quantum.Topological" Version="0.3.6" />
                    
Directory.Packages.props
<PackageReference Include="FSharp.Azure.Quantum.Topological" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FSharp.Azure.Quantum.Topological --version 0.3.6
                    
#r "nuget: FSharp.Azure.Quantum.Topological, 0.3.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FSharp.Azure.Quantum.Topological@0.3.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FSharp.Azure.Quantum.Topological&version=0.3.6
                    
Install as a Cake Addin
#tool nuget:?package=FSharp.Azure.Quantum.Topological&version=0.3.6
                    
Install as a Cake Tool

FSharp.Azure.Quantum.Topological

Topological Quantum Computing Library for F#

A standalone library for topological quantum computing, implementing anyon models, fusion rules, and braiding operators. This project is architecturally independent from the gate-based quantum computing library (FSharp.Azure.Quantum), as topological quantum computing is fundamentally different - like combining airplanes and submarines.

๐ŸŽฏ Features

Anyon Species (AnyonSpecies.fs)

  • Particle Types: Vacuum, Sigma (Ising), Psi (Ising), Tau (Fibonacci)
  • Anyon Theories: Ising (Microsoft Majorana), Fibonacci, SU(2)_k
  • Quantum Dimensions: ฯ† (golden ratio) for Fibonacci, โˆš2 for Sigma
  • Anti-particles & Frobenius-Schur Indicators

Fusion Rules (FusionRules.fs)

  • Ising Fusion: ฯƒ ร— ฯƒ = 1 + ฯˆ (non-abelian, qubit encoding)
  • Fibonacci Fusion: ฯ„ ร— ฯ„ = 1 + ฯ„ (universal braiding)
  • Fusion Algebra: Multiplicity, channels, tensor representation
  • Axiom Verification: Identity, commutativity, anti-particle

Braiding Operators (BraidingOperators.fs)

  • R-matrices: Braiding phases (e.g., e^(iฯ€/8) for Ising)
  • F-matrices: Fusion basis transformations
  • Unitarity: All operators preserve quantum information
  • Pentagon & Hexagon Equations: Mathematical consistency

๐Ÿ“ฆ Installation

# Build the library
dotnet build src/FSharp.Azure.Quantum.Topological/FSharp.Azure.Quantum.Topological.fsproj

# Run tests
dotnet test tests/FSharp.Azure.Quantum.Topological.Tests/FSharp.Azure.Quantum.Topological.Tests.fsproj

๐Ÿš€ Quick Start

open FSharp.Azure.Quantum.Topological

// Define Ising anyons
let sigma = AnyonSpecies.Particle.Sigma
let ising = AnyonSpecies.AnyonType.Ising

// Fuse two sigma anyons (non-abelian!)
let outcomes = FusionRules.fuse sigma sigma ising
// Result: [Vacuum; Psi] - two possible outcomes!

// Get braiding phase
let R = BraidingOperators.element sigma sigma AnyonSpecies.Particle.Vacuum ising
// Result: e^(iฯ€/8) - topological phase from braiding

// Check quantum dimension
let d = AnyonSpecies.quantumDimension sigma
// Result: โˆš2 โ‰ˆ 1.414

๐Ÿงช Test Coverage

166 unit tests covering:

  • โœ… Quantum dimension calculations (AnyonSpecies - 30 tests)
  • โœ… Fusion algebra axioms (FusionRules - 28 tests)
  • โœ… R-matrix unitarity (BraidingOperators - 24 tests)
  • โœ… F-matrix Pentagon equation (FusionTree - 22 tests)
  • โœ… Braiding operations (TopologicalOperations - 18 tests)
  • โœ… Backend execution (TopologicalBackend - 27 tests)
  • โœ… Computation expressions (TopologicalBuilder - 3 tests)
  • โœ… Format parsing/serialization (TopologicalFormat - 14 tests)
  • โœ… Mathematical consistency across all modules
# Run tests
dotnet test tests/FSharp.Azure.Quantum.Topological.Tests/

# Expected output:
# Passed!  - Failed:     0, Passed:   166, Skipped:     0, Total:   166

๐Ÿ—๏ธ Architecture

System Overview

graph TB
    subgraph "User Layer"
        User["๐Ÿ‘ค User Code"]
        Builder["TopologicalBuilder<br/>(Computation Expression)"]
        Format["TopologicalFormat<br/>(.tqp Parser/Serializer)"]
    end
    
    subgraph "Execution Layer"
        Backend["ITopologicalBackend<br/>(Interface)"]
        Simulator["SimulatorBackend<br/>(Implementation)"]
        Future["Future Backends<br/>(Azure Quantum Majorana)"]
    end
    
    subgraph "Operations Layer"
        Operations["TopologicalOperations<br/>(Braiding, Measurement, F-moves)"]
        FusionTree["FusionTree<br/>(State Representation)"]
    end
    
    subgraph "Mathematical Foundation"
        Anyon["AnyonSpecies<br/>(Ising, Fibonacci, SU(2)_k)"]
        Fusion["FusionRules<br/>(ฯƒร—ฯƒ = 1+ฯˆ, ฯ„ร—ฯ„ = 1+ฯ„)"]
        Braiding["BraidingOperators<br/>(R-matrices, F-matrices)"]
    end
    
    subgraph "Error Handling"
        Result["TopologicalResult<T><br/>(Result<T, TopologicalError>)"]
        Error["TopologicalError<br/>(Categorized Errors)"]
    end
    
    User --> Builder
    User --> Format
    Builder --> Backend
    Format --> Backend
    Backend --> Simulator
    Backend -.-> Future
    Simulator --> Operations
    Operations --> FusionTree
    FusionTree --> Fusion
    FusionTree --> Anyon
    Operations --> Braiding
    Fusion --> Anyon
    Braiding --> Anyon
    Backend --> Result
    Result --> Error
    
    style User fill:#e1f5ff
    style Builder fill:#fff4e1
    style Format fill:#fff4e1
    style Backend fill:#ffe1f5
    style Simulator fill:#f5e1ff
    style Operations fill:#e1ffe1
    style FusionTree fill:#e1ffe1
    style Anyon fill:#ffe1e1
    style Fusion fill:#ffe1e1
    style Braiding fill:#ffe1e1
    style Result fill:#f0f0f0
    style Error fill:#f0f0f0

Architecture Layers Explained

1. User Layer (How users interact)

  • TopologicalBuilder: F# computation expression for readable quantum programs
  • TopologicalFormat: Import/export .tqp files (human-readable format)

2. Execution Layer (Backends)

  • ITopologicalBackend: Interface with Initialize, Braid, Measure, Execute methods
  • SimulatorBackend: Classical simulator for Ising/Fibonacci anyons
  • Future Backends: Azure Quantum Majorana hardware (when available)

3. Operations Layer (Quantum operations)

  • TopologicalOperations: High-level operations (braiding, measurement, F-moves)
  • FusionTree: Quantum state representation as fusion tree structures

4. Mathematical Foundation (Theory)

  • AnyonSpecies: Particle types and quantum dimensions
  • FusionRules: Fusion algebra (ฯƒร—ฯƒ = 1+ฯˆ, ฯ„ร—ฯ„ = 1+ฯ„)
  • BraidingOperators: R-matrices (phases) and F-matrices (basis changes)

5. Error Handling (Type-safe errors)

  • TopologicalResult<T>: Railway-oriented programming with Result<T, TopologicalError>
  • TopologicalError: Categorized errors (Validation, Backend, Simulation, NotImplemented)

Data Flow Example: Bell State Creation

sequenceDiagram
    participant User
    participant Builder as TopologicalBuilder
    participant Backend as SimulatorBackend
    participant Operations as TopologicalOperations
    participant FusionTree
    participant Fusion as FusionRules
    
    User->>Builder: topological { ... }
    Builder->>Backend: Initialize(Ising, 4)
    Backend->>FusionTree: create(4 sigma anyons)
    FusionTree->>Fusion: validate fusion rules
    Fusion-->>FusionTree: Ok(valid)
    FusionTree-->>Backend: Ok(initialState)
    Backend-->>Builder: Ok(state)
    
    Builder->>Backend: Braid(0)
    Backend->>Operations: braidAdjacentAnyons(0, state)  // returns Superposition
    Operations->>Fusion: get fusion channels
    Fusion-->>Operations: [Vacuum, Psi]
    Operations-->>Backend: Ok(braidedState)
    Backend-->>Builder: Ok(state)
    
    Builder->>Backend: Measure(1)
    Backend->>Operations: measureFusion(1, state)
    Operations->>Fusion: fuse sigma ร— sigma
    Fusion-->>Operations: [(Vacuum, 0.5), (Psi, 0.5)]
    Operations-->>Backend: Ok(outcome, collapsedState)
    Backend-->>Builder: Ok(result)
    Builder-->>User: Bell state created!

Why a Separate Project?

Topological quantum computing is fundamentally different from gate-based quantum computing:

Gate-Based (FSharp.Azure.Quantum) Topological (This Library)
Qubits, gates, circuits Anyons, braiding, fusion
Hamiltonian evolution Topological invariants
Error-prone (needs QEC) Topologically protected
Azure Quantum integration Standalone mathematical foundation

Namespace Structure

FSharp.Azure.Quantum.Topological
โ”œโ”€โ”€ AnyonSpecies           (RequireQualifiedAccess)
โ”œโ”€โ”€ FusionRules            (RequireQualifiedAccess)
โ”œโ”€โ”€ BraidingOperators      (public module)
โ”œโ”€โ”€ FusionTree             (RequireQualifiedAccess)
โ”œโ”€โ”€ TopologicalOperations  (RequireQualifiedAccess)
โ”œโ”€โ”€ TopologicalBackend     (ITopologicalBackend + SimulatorBackend)
โ”œโ”€โ”€ TopologicalBuilder     (Computation Expression)
โ””โ”€โ”€ TopologicalFormat      (Parser/Serializer)

No name conflicts with gate-based library - clean separation of concerns.

๐Ÿ“š Background: Topological Quantum Computing

What are Anyons?

Anyons are quasiparticles in 2D systems with exotic exchange statistics - neither bosonic nor fermionic. When you braid anyons around each other, the quantum state accumulates a topological phase that depends only on the braid pattern, not the specific path.

Key Theories Implemented

  1. Ising Anyons (SU(2)โ‚‚)

    • Microsoft's Majorana zero mode approach
    • Particles: {1, ฯƒ, ฯˆ}
    • Clifford gates only (needs magic states for universality)
    • Physically realizable!
  2. Fibonacci Anyons

    • Universal for quantum computation
    • Particles: {1, ฯ„}
    • Golden ratio ฯ† appears everywhere
    • Not yet physically realized

Fusion vs. Measurement

In topological QC:

  • Fusion โ‰ˆ Measurement (collapses superposition)
  • Braiding โ‰ˆ Gate operation (unitary evolution)
  • Topological protection โ‰ˆ Natural error correction

โœ… Implemented Features

Core Functionality (Complete)

  • โœ… Fusion Trees: State representation for topological qubits
  • โœ… Topological Backend: ITopologicalBackend interface with SimulatorBackend
  • โœ… Computation Expression: topological { ... } builder for readable programs
  • โœ… Import/Export: .tqp file format (Parser/Serializer)
  • โœ… Error Handling: Railway-oriented programming with TopologicalResult<T>
  • โœ… Examples: 4 working examples (BasicFusion, BellState, BackendComparison, FormatDemo)

Documentation (Complete)

  • โœ… Format Specification: docs/topological-format-spec.md
  • โœ… Examples README: examples/TopologicalSimulator/README.md
  • โœ… Test Suite: 166 comprehensive unit tests

๐Ÿ”ฌ Future Work

Next Implementations

  • Magic State Distillation: Achieve universality for Ising anyons
  • Azure Quantum Majorana: Hardware integration (when available)
  • Circuit Optimization: Braiding sequence optimization
  • Visualization: Braiding diagram generation
  • JSON Format: Machine-to-machine .tqp alternative

Research Extensions

  • SU(2)_k for k > 2 (currently supports k=2 Ising only)
  • Metaplectic anyons
  • Doubled theories (Drinfeld center)
  • Modular tensor categories
  • Quantum algorithm library (Shor's, Grover's in topological form)

๐Ÿ“– References

  1. Topological Quantum by Steven H. Simon (Chapters 9-10)
  2. Anyons in an exactly solved model and beyond - Kitaev (2006)
  3. Non-Abelian Anyons and Topological Quantum Computation - Nayak et al. (2008)
  4. Microsoft Quantum Documentation - Majorana-based quantum computing

๐Ÿ“„ License

Same as parent project (FSharp.Azure.Quantum)

๐Ÿค Contributing

Since this is a separate project with isolated tests:

  • Fast iteration (no need to rebuild entire Azure Quantum library)
  • Independent versioning
  • Clear architectural boundaries
  • Easy to test in isolation

Run tests frequently:

dotnet test tests/FSharp.Azure.Quantum.Topological.Tests/ --verbosity minimal

Built with F# for mathematical elegance and type safety in quantum computing โš›๏ธ

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.10 88 2/22/2026
0.3.9 89 2/19/2026
0.3.8 85 2/18/2026
0.3.7 86 2/17/2026
0.3.6 94 2/13/2026
0.3.5 93 2/10/2026
0.3.4 107 1/25/2026
0.3.3 187 12/20/2025
0.3.2 168 12/13/2025
0.3.1 428 12/11/2025
0.2.9 431 12/8/2025
0.2.1 320 12/7/2025

v0.3.6: Feature Release
- UPDATED: Compatibility with FSharp.Azure.Quantum v1.3.6
- IMPROVED: TopologicalHelpers module added with shared utility functions
- IMPROVED: BraidingOperators, FusionRules, and FusionTree modules refactored
- IMPROVED: BraidingConsistency enhanced with additional validation
- IMPROVED: FMatrix, RMatrix, and ModularData computation improvements
- IMPROVED: NoiseModels refined with expanded error model support
- IMPROVED: GateToBraid and BraidToGate conversion accuracy improvements
- IMPROVED: CircuitOptimization and SolovayKitaev decomposition updates
- Status: 535+ tests passing, ready for Azure Quantum Majorana hardware (when API available)