Skip to content

feat(ffi): C-ABI / Zig bridge specification for embedding ParadisEO metaheuristics engine with Idris2 contracts #424

Open

Description

@hyperpolymath

ID: ECH-04
Target Repository: hyperpolymath/echidna
Area: ABI / FFI / Multi-Language
Labels: enhancement, area:abi, zig, idris2, ffi
Status: Open
Roadmap: ParadisEO Metaheuristic Integration


Context & Motivation

To utilize ParadisEO's battle-tested C++17 metaheuristic engine (including mo, moeo, and edo) within ECHIDNA's Rust core without compromising memory safety or high-assurance trust guarantees, we need a formally specified and hardened FFI boundary.

ECHIDNA maintains strict type contracts using an Idris2 ABI layer (src/abi/EchidnaABI/) and Zig FFI glue.

Proposed Changes

  • Zig C-ABI Shim (ffi/zig/paradiseo_bridge.zig): Provide extern "C" abstraction wrapping ParadisEO's core C++ template instantiations (paradiseo_moeo_nsga2_rank, paradiseo_edo_cmaes_step, paradiseo_mo_tabu_search) with clean allocation/deallocation lifetimes and zero memory leaks across the C++/Rust boundary
  • Idris2 ABI Specification & Proofs: Formalize parameter bounds, return value structs, and status codes in src/abi/EchidnaABI/OptimizationABI.idr with totality and non-divergence properties under %default total with 0 postulate / 0 believe_me
  • Rust Safe Bindings (crates/echidna-metaheuristics): Expose idiomatic, memory-safe Rust wrapper structs implementing the OptimizerBackend trait, guarded behind feature flags (--features paradiseo-opt) with safe fallbacks in pure Rust

Acceptance Criteria

  • zig build test passes all FFI memory leak and lifetime checks (using Zig's GPA / GeneralPurposeAllocator)
  • idris2 --build src/abi/echidnaabi.ipkg compiles and verifies totality without warnings
  • cargo clippy --workspace --all-targets -D warnings and cargo test pass cleanly

References

Related Issues


See Also: Full ParadisEO Roadmap
Repository: hyperpolymath/echidna

Activity

  1. added
    enhancement
    on Oct 9, 2026
  2. added
    area:abi
    ffi
    idris2
    zig
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:abienhancementffiidris2zig

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions