-
-
Notifications
You must be signed in to change notification settings - Fork 0
Claude/add academic proofs gg vwj #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds complete academic documentation for Eclexia including: - WHITEPAPER.md: Introduction to Economics-as-Code paradigm - PROOFS.md: Mathematical foundations and correctness proofs - Type safety (progress & preservation) - Dimensional correctness - Resource safety - Economic optimality - Termination bounds - SPECIFICATION.md: Formal language specification with EBNF grammar - FORMAL_VERIFICATION.md: Coq/Lean/Agda formalization roadmap - Logical relations proofs - Step-indexed semantics - Separation logic for memory safety - Quantitative type theory - THEORY.md: Type theory and categorical semantics - Dependent resource types - Graded monads for effects - Domain-theoretic semantics - Game semantics - Session types for resources - ALGORITHMS.md: Complexity analysis and optimization algorithms - Solution selection (O(n·m)) - Shadow price computation (O(m³)) - Multi-objective optimization - Carbon-aware scheduling - Online algorithms with competitive analysis - BIBLIOGRAPHY.md: Comprehensive academic references Updated STATE.scm to reflect 75% completion with new documentation.
- Add EXTENDED_PROOFS.md with complete academic proofs for substitution lemma, progress, preservation, strong normalization, logical relations, resource safety, and decidability - Add IMPLEMENTATION_ROADMAP.md with comprehensive technology stack, phased development plan, and dependencies matrix for building Eclexia as a complete language - Update ROADMAP.md to reference implementation roadmap and document completed academic documentation milestone - Update STATE.scm to reflect 80% project completion
This commit implements the foundational compiler infrastructure for Eclexia: Compiler Components: - eclexia-ast: AST definitions with dimensional types, resource annotations, and adaptive block structures - eclexia-lexer: Lexer with support for dimensional literals (100J, 5ms, 10gCO2e), resource keywords, and all Eclexia syntax - eclexia-parser: Recursive descent parser with error recovery for full Eclexia syntax including adaptive functions and constraints - eclexia-typeck: Type checker scaffolding with type variable support - eclexia-hir/mir/codegen: Placeholder crates for future phases Runtime: - eclexia-runtime: Runtime system scaffolding with scheduler, shadow price, profiler, and carbon monitoring modules CLI & Tooling: - eclexia: CLI with build, run, check, fmt, init, test, bench commands - Interactive REPL with :help, :shadow, :resources commands Examples: - hello.ecl: Hello world with energy constraint - fibonacci.ecl: Adaptive fibonacci with memoized/naive solutions - matrix_multiply.ecl: GPU/parallel/naive matrix multiplication - carbon_aware.ecl: Carbon-aware ML training with defer_until All 14 tests passing (5 AST, 7 lexer, 2 parser tests). Phase 1 of IMPLEMENTATION_ROADMAP.md: Minimal Viable Compiler
…election - Add eclexia-interp crate with full interpreter implementation: - Value types for all Eclexia runtime values - Environment with lexical scoping - Expression and statement evaluation - Adaptive function solution selection based on shadow prices - Built-in functions (println, len, range, math functions, etc.) - Integrate interpreter with CLI run command - Add CARBON_APIS.md documenting carbon intensity API options: - UK Carbon Intensity API (free, no key) - WattTime (free tier + paid) - Electricity Maps - Implementation architecture recommendations - Update fibonacci.ecl to demonstrate adaptive function selection: - Two solutions with different resource costs - Runtime selects lowest-cost solution based on shadow prices - fibonacci(10) = 55 works correctly Project completion: 35% -> 45%
Security hardening: - Add MAX_CALL_DEPTH (1000) to prevent stack overflow from unbounded recursion - Add MAX_LOOP_ITERATIONS (10M) to prevent infinite loop DoS - Add MAX_RANGE_SIZE (1M) to prevent memory exhaustion from range() - Add integer overflow checking in power operations with checked_pow() - Add exponent limit (63) for integer power operations Bug fixes: - Fix solution selection to properly error when no solution fits budget Previously returned index 0 even when all solutions exceeded constraints - Now returns ResourceViolation error with current/budget values
Major improvements across the compiler and interpreter: Type Checking: - Implement basic Hindley-Milner type inference with unification - Add proper type checking for functions, expressions, and operators - Support variadic println/print functions Error Reporting: - Add LineCol struct for line:column position tracking - Add format_with_source() to parse/type/runtime errors - Display line:column in all error messages Lambda Support: - Fix lambda body execution by storing ExprId directly - Update FunctionBody to enum with Block and Lambda variants Adaptive Functions: - Implement @when clause evaluation in solution selection - Evaluate @when expressions in call context with bound parameters CLI Improvements: - Add path sanitization to init command (prevent path traversal) - Implement basic fmt command with syntax checking - Implement test command with file discovery and execution - Implement bench command with timing output - Fix REPL to actually evaluate expressions Documentation: - Add GETTING_STARTED.md with installation and usage guide All 14 tests passing.
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.