GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - minikin/antifragile: A Rust library, attempting to implement Nassim Nicholas Taleb's antifragility theory.

BranchesTags
Open more actions menu

Latest commit

 

History

38 Commits
38 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
examples
examples
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
rustfmt.toml
rustfmt.toml
 
 

Repository files navigation

Antifragile

Crates.io Documentation License: MIT CI

A Rust library attempting to implement Nassim Nicholas Taleb's antifragility theory.

Overview

This library provides a trait-based system for analyzing how systems respond to stress and volatility, classifying them into three categories:

  • Antifragile: Benefits from volatility (convex response)
  • Fragile: Harmed by volatility (concave response)
  • Robust: Unaffected by volatility (linear response)

Installation

[dependencies]
antifragile = "0.0.1"

Quick Start

use antifragile::{Antifragile, Triad, TriadAnalysis};

// Define a system with convex response (benefits from volatility)
struct ConvexSystem;

impl Antifragile for ConvexSystem {
    type Stressor = f64;
    type Payoff = f64;

    fn payoff(&self, x: Self::Stressor) -> Self::Payoff {
        x * x  // Quadratic: convex response
    }
}

let system = ConvexSystem;
assert_eq!(system.classify(10.0, 1.0), Triad::Antifragile);

Core Concepts

The Antifragile Trait

Implement the Antifragile trait to define how your system responds to stress:

use antifragile::Antifragile;

struct MySystem;

impl Antifragile for MySystem {
    type Stressor = f64;  // The type of stress applied
    type Payoff = f64;    // The outcome produced

    fn payoff(&self, stressor: Self::Stressor) -> Self::Payoff {
        // Define your system's response to stress
        stressor * stressor
    }
}

The Triad Classification

The Triad enum represents the three categories:

use antifragile::Triad;

let classification = Triad::Antifragile;

// Check classification
assert!(classification.is_antifragile());

// Ordering: Fragile < Robust < Antifragile
assert!(Triad::Fragile < Triad::Robust);
assert!(Triad::Robust < Triad::Antifragile);

// Convert to/from strings
let s: &str = classification.into();  // "antifragile"
let parsed: Triad = "robust".parse().unwrap();

// Convert to/from u8 (Fragile=0, Robust=1, Antifragile=2)
let n: u8 = classification.into();  // 2
let from_n = Triad::try_from(1u8).unwrap();  // Triad::Robust

The Verified Wrapper

Use Verified to wrap a system with its verified classification:

use antifragile::{Antifragile, Verified, TriadAnalysis};

struct MySystem;
impl Antifragile for MySystem {
    type Stressor = f64;
    type Payoff = f64;
    fn payoff(&self, x: Self::Stressor) -> Self::Payoff { x * x }
}

let verified = Verified::check(MySystem, 10.0, 1.0);
println!("Classification: {}", verified.classification());

Mathematical Foundation

The classification is based on second-order effects (convexity):

For a payoff function f(x) at operating point x with perturbation δ:

  • Convex (Antifragile): f(x+δ) + f(x-δ) > 2·f(x)
  • Concave (Fragile): f(x+δ) + f(x-δ) < 2·f(x)
  • Linear (Robust): f(x+δ) + f(x-δ) = 2·f(x)

This is Jensen's inequality applied to volatility.

When to Use This Library

Good fit:

  • Analyzing financial instruments (options, insurance)
  • Evaluating system resilience in chaos engineering
  • Comparing algorithms under varying load
  • Educational purposes (demonstrating Taleb's theory)

Not a good fit:

  • Real-time trading decisions (too abstract)
  • Systems where "stress" is not mathematically quantifiable
  • Cases requiring probabilistic analysis (use Monte Carlo instead)

Feature Flags

Feature Default Description
std Yes Enable standard library support. Disable for no_std environments.
serde No Enable serialization/deserialization for Triad and Verified.

Using in no_std environments

[dependencies]
antifragile = { version = "0.0.1", default-features = false }

Enabling serde support

[dependencies]
antifragile = { version = "0.0.1", features = ["serde"] }

Minimum Supported Rust Version

This crate requires Rust 1.85 or later (edition 2024).

License

Licensed under the MIT License. See LICENSE for details.

About

A Rust library, attempting to implement Nassim Nicholas Taleb's antifragility theory.

crates.io/crates/antifragile

Topics

antifragileconvexityfragilerobustrust

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity

Stars

6 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.