Skip to content
juvix-intents logo

Juvix Intents (+1)

juvix-intents

Juvix intent-centric language for Anoma with Geb compilation and GF(3) typed resources

plurigrid/asi0installs67stars

SKILL.md

Full skill instructions

Juvix Intents (+1)

Intent-centric language compiling to Geb categorical semantics

Trit: +1 (PLUS - generative) Compiles to: Geb → Vampir → ZK proofs

Overview

Juvix is Anoma's intent-centric programming language:

Juvix Source → Core → Geb Morphisms → Vampir IR → ZK Circuit
     ↑            ↑          ↑            ↑
   Types      Normalize   Categorify   Arithmetize

Obstruction Types

module Obstruction;

-- GF(3) trit type
type GF3 := Minus | Ergodic | Plus;

-- Trit arithmetic (mod 3)
add : GF3 -> GF3 -> GF3
add Minus Minus := Plus      -- (-1) + (-1) = +1 (mod 3)
add Minus Ergodic := Minus   -- (-1) + 0 = -1
add Minus Plus := Ergodic    -- (-1) + (+1) = 0
add Ergodic x := x           -- 0 + x = x
add Plus Minus := Ergodic    -- (+1) + (-1) = 0
add Plus Ergodic := Plus     -- (+1) + 0 = +1
add Plus Plus := Minus;      -- (+1) + (+1) = -1 (mod 3)

-- Obstruction from Bumpus decomposition failure
type Obstruction := mkObstruction {
  sexp : ByteArray;          -- S-expression witness
  trit : GF3;                -- Triadic charge
  h1Class : Nat;             -- Cohomology class (>0 = obstruction)
  treewidth : Nat;           -- Exceeded threshold
  color : Word64;            -- Gay.jl deterministic color
  seed : Word64              -- SplitMix64 seed
};

-- Check if decomposition failed
isObstruction : Obstruction -> Bool
isObstruction obs := h1Class obs > 0;

-- VCG externality payment
vcgExternality : Obstruction -> Nat
vcgExternality obs :=
  let baseCost := 1000000    -- 0.001 APT
      multiplier := 10000    -- 100%
  in (h1Class obs) * baseCost * multiplier / 10000;

Intent Types

module Intent;

import Obstruction;

-- Resource type (what can be nullified/​committed)
type Resource :=
  | ObstructionRes Obstruction
  | TokenRes Token
  | ReceiptRes ChainId ByteArray;

-- Intent: preference over state transitions
type Intent := mkIntent {
  owner : Address;
  nullify : List Resource;   -- Resources to consume
  commit : List Resource;    -- Resources to produce
  constraints : List Constraint
};

-- Constraint on intent satisfaction
type Constraint :=
  | VcgPayment Nat           -- Minimum VCG payment
  | GF3Balance               -- Sum of trits must be 0 (mod 3)
  | SpectralGap Float;       -- Minimum spectral gap preserved

-- Cross-chain pass intent
passObstruction : Address -> Obstruction -> ChainId -> Intent
passObstruction owner obs target :=
  mkIntent {
    owner := owner;
    nullify := [ObstructionRes obs];
    commit := [ReceiptRes target (hash obs)];
    constraints := [VcgPayment (vcgExternality obs), GF3Balance]
  };

Compilation to Geb

module GebCompile;

import Intent;
import Geb;

-- Compile intent to Geb morphism
compileIntent : Intent -> Geb.Morphism
compileIntent intent :=
  -- Intent = pair of (nullify, commit)
  -- Nullify: inject-left to void (consume)
  -- Commit: inject-right from void (produce)
  Geb.pair
    (compileNullify (nullify intent))
    (compileCommit (commit intent));

-- Compile nullification
compileNullify : List Resource -> Geb.Morphism
compileNullify [] := Geb.terminal Geb.so1
compileNullify (r :: rs) :=
  Geb.pair
    (Geb.injectLeft (compileResource r) Geb.so0)
    (compileNullify rs);

-- Compile commitment
compileCommit : List Resource -> Geb.Morphism
compileCommit [] := Geb.init Geb.so0
compileCommit (r :: rs) :=
  Geb.pair
    (Geb.injectRight Geb.so0 (compileResource r))
    (compileCommit rs);

-- Resource to Geb type
compileResource : Resource -> Geb.Object
compileResource (ObstructionRes obs) :=
  Geb.prod
    (Geb.prod Geb.so1 Geb.so1)   -- (sexp, trit)
    (Geb.prod Geb.so1 Geb.so1);  -- (h1Class, color)
compileResource (TokenRes tok) := Geb.so1;
compileResource (ReceiptRes _ _) := Geb.so1;

Free Monad for Obstruction Game

module ObstructionMonad;

import Obstruction;

-- Functor for obstruction game
type ObstructionF (a : Type) :=
  | NoObstruction a                    -- Decomposition succeeded
  | WithObstruction Obstruction a;     -- Decomposition failed → H¹ ≠ 0

-- Free monad
type Free (f : Type -> Type) (a : Type) :=
  | Pure a
  | Roll (f (Free f a));

-- Obstruction monad = Free ObstructionF
ObstructionMonad : Type -> Type
ObstructionMonad := Free ObstructionF;

-- Attempt decomposition (creates obstruction if tw > threshold)
attemptDecomposition : ByteArray -> Nat -> Word64 -> ObstructionMonad Unit
attemptDecomposition sexp tw seed :=
  if tw <= 3
  then Pure unit
  else 
    let h1 := tw - 3
        trit := toGF3 ((seed `xor` (natToWord64 tw)) `mod` 3)
        color := gayColor seed tw
        obs := mkObstruction sexp trit h1 tw color seed
    in Roll (WithObstruction obs (Pure unit));

-- Bind preserves spectral gap
bind : ObstructionMonad a -> (a -> ObstructionMonad b) -> ObstructionMonad b
bind (Pure a) k := k a
bind (Roll (NoObstruction rest)) k := Roll (NoObstruction (bind rest k))
bind (Roll (WithObstruction obs rest)) k := 
  Roll (WithObstruction obs (bind rest k));

Spectral Gap Tracking

module SpectralMonad;

-- Monad that tracks spectral gap through composition
type SpectralFree (f : Type -> Type) (a : Type) := mkSpectralFree {
  computation : Free f a;
  spectralGap : Float
};

-- Bind propagates minimum gap
bindSpectral : SpectralFree f a -> (a -> SpectralFree f b) -> SpectralFree f b
bindSpectral sf k :=
  let result := bind (computation sf) (\a -> computation (k a))
      newGap := min (spectralGap sf) (gapOf result)
  in mkSpectralFree result newGap;

-- Ramanujan bound for d=3
ramanujanBound : Float
ramanujanBound := 3.0 - 2.0 * sqrt 2.0;  -- ≈ 0.172

-- Check if spectral gap preserved
gapPreserved : SpectralFree f a -> Bool
gapPreserved sf := spectralGap sf >= ramanujanBound;

GF(3) Type-Level Conservation

module GF3Types;

-- Type-level GF(3) for compile-time conservation
type Trit := T_Minus | T_Ergodic | T_Plus;

-- Type-level addition (mod 3)
type family TritAdd (a : Trit) (b : Trit) : Trit where
  TritAdd T_Minus T_Plus := T_Ergodic
  TritAdd T_Plus T_Minus := T_Ergodic
  TritAdd T_Ergodic x := x
  TritAdd x T_Ergodic := x
  TritAdd T_Plus T_Plus := T_Minus
  TritAdd T_Minus T_Minus := T_Plus;

-- Typed resource with trit charge
type TResource (t : Trit) := mkTResource {
  payload : Resource;
  trit : GF3  -- Runtime trit must match type-level
};

-- Balanced transaction: trits sum to 0
type BalancedTx :=
  forall (a b c : Trit).
  TritAdd a (TritAdd b c) == T_Ergodic =>
  Triple (TResource a) (TResource b) (TResource c);

CLI Commands

# Compile Juvix to Geb
juvix compile intent.juvix --target geb

# Type check with GF(3) verification
juvix typecheck --gf3-check module.juvix

# Generate Vampir circuit
juvix compile intent.juvix --target vampir

# Run obstruction monad
juvix eval "attemptDecomposition sexp 5 0x42"

# Verify spectral gap preservation
juvix verify --spectral-gap intent.juvix

GF(3) Triads

juvix-intents (+1) ⊗ anoma-intents (0) ⊗ solver-fee (-1) = 0 ✓
  └─ Compiles DSL        └─ Routes          └─ Extracts fee

juvix-intents (+1) ⊗ geb (+1) ⊗ sheaf-cohomology (-1) = 1 ✗ (need -1)
  → Add intent-sink (-1): juvix (+1) ⊗ geb (+1) ⊗ intent-sink (-1) ⊗ sheaf (-1) ...

juvix-intents (+1) ⊗ open-games (0) ⊗ ramanujan-expander (-1) = 0 ✓
  └─ Type-level gap      └─ Coordinates     └─ Validates bound

Integration with Obstruction Hot Potato

-- Full hot potato game in Juvix
module HotPotato;

import Obstruction;
import Intent;
import ObstructionMonad;

-- Player state
type Player := mkPlayer {
  address : Address;
  stake : Nat;
  obstructions : List Obstruction;
  alive : Bool
};

-- Game action
type Action :=
  | AttemptDecomposition ByteArray Nat
  | PassObstruction Address Nat
  | EndRound;

-- Game monad: State + Obstruction effects
type GameMonad := StateT (List Player) ObstructionMonad;

-- Execute action
executeAction : Action -> GameMonad Unit
executeAction (AttemptDecomposition sexp tw) := do
  obs <- lift (attemptDecomposition sexp tw (currentSeed ()))
  when (isObstruction obs) (addObstructionToPlayer obs)
executeAction (PassObstruction target idx) := do
  player <- getCurrentPlayer
  obs <- getObstruction player idx
  vcg <- pure (vcgExternality obs)
  transferPayment player target vcg
  moveObstruction player target idx
executeAction EndRound := do
  players <- get
  deadPlayers <- filterM hasNegativeUtility players
  mapM_ slashStake deadPlayers
  verifyGF3Conservation;

References


Trit: +1 (PLUS - generative) Key Property: Intent DSL with type-level GF(3) conservation

Scientific Skill Interleaving

This skill connects to the K-Dense-AI/​claude-scientific-skills ecosystem:

Graph Theory

  • networkx [○] via bicomodule
    • Universal graph hub

Bibliography References

  • general: 734 citations in bib.duckdb

Cat# Integration

This skill maps to Cat# = Comod(P) as a bicomodule in the equipment structure:

Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826

GF(3) Naturality

The skill participates in triads satisfying:

(-1) + (0) + (+1) ≡ 0 (mod 3)

This ensures compositional coherence in the Cat# equipment structure.

More skills from plurigrid

cargo logo
plurigrid/asi

cargo

Rust package manager (36 subcommands).

67 0
View

Translate Figma nodes into production-ready code with 1:1 visual fidelity using the Figma MCP workflow (design context, screenshots, assets, and project-convention translation). Trigger when the user provides Figma URLs or node IDs, or asks to implement designs or components that must match Figma...

67 0
View

**Status**: 🌳 Production Ready (upstream in StringZilla v3+) **Type**: High-Performance String Operations / SIMD-Accelerated Text Processing **Principle**: Zero-copy views, SIMD/SWAR acceleration, deterministic hashing **Frame**: Cross-language interoperability (C, C++, Python, Rust, Go, Swift, ...

67 0
View
conformal-ga logo
plurigrid/asi

conformal-ga

Conformal Geometric Algebra (CGA) for circles, spheres, and Möbius transformations

67 0
View

Verifies code implements exactly what documentation specifies for blockchain audits. Use when comparing code against whitepapers, finding gaps between specs and implementation, or performing compliance checks for protocol implementations.

67 0
View
zig-systems logo
plurigrid/asi

zig-systems

Systems programming and performance optimization using Zig. Provides low-level abstractions, memory-safe compiled code, and performance benchmarking. Use for system-level operations, optimization, and interoperability with C/POSIX APIs.

67 0
View
soliton-detection logo
plurigrid/asi

soliton-detection

Topological soliton detection and agency bridge with anyonic fusion algebra for concept composition

67 0
View
paypal-mcp logo
plurigrid/asi

paypal-mcp

PayPal MCP server integration for invoices, payments, subscriptions, disputes, and transaction reporting via @paypal/mcp.

67 0
View
unison logo
plurigrid/asi

unison

Unison language - content-addressed functional programming with abilities for effects, distributed computing, and structural types. Use for pure functional code, effect management, distributed systems, and refactoring-safe codebases.

67 0
View
tasks-acset logo
plurigrid/asi

tasks-acset

Google Tasks management via TasksACSet. Transforms task operations into GF(3)-typed Interactions, routes to triadic queues, detects saturation for task-zero-as-condensed-state.

67 0
View
c logo
plurigrid/asi

c

World C Skill

67 0
View
syrup logo
plurigrid/asi

syrup

Syrup binary serialization for OCapN/CapTP wire format. Canonical encoding for capability messages.

67 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View