|
| 1 | +# Proven Integration |
| 2 | + |
| 3 | +WokeLang uses [proven](https://github.com/hyperpolymath/proven) for formally verified operations where safety is critical. |
| 4 | + |
| 5 | +## What is proven? |
| 6 | + |
| 7 | +proven is an Idris2 library providing mathematically proven safe operations: |
| 8 | +- **Cannot crash** - Dependent types prove correctness |
| 9 | +- **Totality checking** - All code paths guaranteed to terminate |
| 10 | +- **90+ modules** - Comprehensive formally verified functionality |
| 11 | +- **89 language bindings** - FFI via Zig C ABI |
| 12 | + |
| 13 | +## Architecture |
| 14 | + |
| 15 | +``` |
| 16 | +WokeLang (Rust) |
| 17 | + ↓ |
| 18 | +Rust Bindings |
| 19 | + ↓ |
| 20 | +Zig FFI Bridge |
| 21 | + ↓ |
| 22 | +Idris2 proven Library ← MATHEMATICAL PROOFS |
| 23 | +``` |
| 24 | + |
| 25 | +## Integration Points |
| 26 | + |
| 27 | +### Current |
| 28 | + |
| 29 | +WokeLang currently uses proven for: |
| 30 | +- (To be determined based on safety-critical needs) |
| 31 | + |
| 32 | +### Planned |
| 33 | + |
| 34 | +Potential proven integration for: |
| 35 | +- **File I/O** - Proven-safe file operations with capability checks |
| 36 | +- **String operations** - Bounds-checked string manipulation |
| 37 | +- **Collection operations** - Verified data structure operations |
| 38 | +- **Parser combinators** - Provably correct parsing |
| 39 | + |
| 40 | +## Using proven in WokeLang |
| 41 | + |
| 42 | +### Setup |
| 43 | + |
| 44 | +1. Ensure Idris2 is installed (see `.tool-versions`) |
| 45 | +2. Clone proven: |
| 46 | + ```bash |
| 47 | + git clone https://github.com/hyperpolymath/proven |
| 48 | + cd proven |
| 49 | + make install |
| 50 | + ``` |
| 51 | + |
| 52 | +3. Link WokeLang to proven bindings: |
| 53 | + ```bash |
| 54 | + cd wokelang |
| 55 | + # Add proven-rust bindings to Cargo.toml |
| 56 | + ``` |
| 57 | + |
| 58 | +### Example |
| 59 | + |
| 60 | +```rust |
| 61 | +// Use proven-safe string operations |
| 62 | +use proven_rust::string::SafeString; |
| 63 | + |
| 64 | +let s = SafeString::new("Hello").unwrap(); |
| 65 | +let sub = s.substring(0, 5); // Mathematically proven not to panic |
| 66 | +``` |
| 67 | + |
| 68 | +## Badge |
| 69 | + |
| 70 | +When WokeLang uses proven modules, add the "Idris Inside" badge to README: |
| 71 | + |
| 72 | +```adoc |
| 73 | +image:https://img.shields.io/badge/Idris-Inside-blueviolet?style=flat[Idris Inside] |
| 74 | +``` |
| 75 | + |
| 76 | +## Performance Note |
| 77 | + |
| 78 | +proven adds FFI overhead for maximum safety. Use for: |
| 79 | +- ✓ Safety-critical operations (file I/O, parsing user input) |
| 80 | +- ✓ Security boundaries (capability checks, permission validation) |
| 81 | +- ✗ Hot loops or performance-critical paths |
| 82 | + |
| 83 | +## References |
| 84 | + |
| 85 | +- proven repo: https://github.com/hyperpolymath/proven |
| 86 | +- Idris2 docs: https://idris2.readthedocs.io |
| 87 | +- Zig FFI: /var/mnt/eclipse/repos/proven/ffi/zig/ |
0 commit comments