Claude/add academic proofs g3z zu#12
Merged
Merged
Conversation
This commit adds exhaustive academic documentation covering the theoretical foundations of the Anvomidav DSL for figure skating choreography notation. ## Formal Specification - grammar.adoc: Complete EBNF grammar, lexical specification, parsing complexity - semantics.adoc: Operational, denotational, and axiomatic semantics - automata-theory.adoc: DFAs, PDAs, timed automata, tree automata ## Type Theory - type-system.adoc: Dependent types, refinement types, effect system, linear types - category-theory-foundations.adoc: CCCs, monads, adjunctions, fibred categories ## Domain Mathematics - rink-geometry.adoc: Coordinate systems, paths, collision detection, topology - temporal-specification.adoc: LTL, MTL, duration calculus, timed CSP - skating-physics.adoc: Mechanics, dynamics, biomechanics - numerical-analysis.adoc: Integration, error analysis, constraint handling ## Verification - rules-specification.adoc: Formal ISU rule encoding - verification-methodology.adoc: Theorem proving, model checking, runtime verification - abstract-interpretation.adoc: Abstract domains, Galois connections, static analysis - computational-complexity.adoc: Time/space bounds, decision problems, FPT ## Proofs - soundness-completeness.adoc: Type soundness, semantic correctness, compiler correctness ## White Papers - anvomidav-overview.adoc: Technical white paper summarizing the language Each document includes theorems, proofs (or proof sketches), definitions, and clearly marked TODO sections for areas requiring further development.
Comprehensive architecture document covering: - 14 crate workspace structure - Dependency graph between crates - Key Rust crate selections (logos, chumsky, z3, tower-lsp, etc.) - API sketches for each component - 6-phase development roadmap - Testing strategy (unit, property-based, snapshot, integration) - Error handling approach with miette
Add complete workspace structure with four crates: - anv-core: Domain types (Time, Position, Edge, JumpKind, Rotations, SpinPosition, Level, Diagnostics) for figure skating semantics - anv-syntax: Lexer using logos with figure skating-specific tokens (edges, jumps, spins, levels) and parser using chumsky producing a typed AST - anv-types: Hindley-Milner type checker with domain-specific types (Jump, Spin, StepSequence, etc.) and skating rule validation - anv-cli: Command-line interface with check, parse, lex, fmt, and new commands using clap and miette for error reporting The language supports: - Program structure with segments (short/free/pattern) - Element sequences with jumps, spins, step sequences - Timing constraints and position tracking - ISU-compliant element validation
- Add 22 new tests covering parser and type checker (68 total) - Fix clippy warnings (enum_variant_names, while_let_on_iterator, etc.) - Use #[default] derive macro for RotationDirection and Level enums - Document safety invariant in switch_foot with expect() - Box recursive expression parser components to reduce stack usage - Use is_some_and instead of deprecated map_or pattern - Fix token naming consistency (toe_loop not toe) - Update ignored test message with accurate chumsky 0.9 limitation note All 68 tests pass with 2 ignored for known issues: - Function definition requires chumsky 0.10+ upgrade - Doc-test skipped due to expression parsing
- Add anv-semantics crate with ISU rules validation engine - Discipline-specific rules (singles, pairs, ice dance) - Element count validation per segment type - Constraint checking (no pairs elements in singles, etc.) - Extend parser for pairs and ice dance elements: - Lifts (Gr1-Gr5) with levels - Throws with rotation counts - Twists with rotation and level - Death spirals with edge and level - Choreographic elements (spiral, spread, ina, hydroblading, pivot) - Add rhythm and exhibition segment types - Update README.adoc with: - Architecture diagram - Complete syntax documentation - CLI command reference - Examples for all disciplines - Current implementation status - Update ROADMAP.adoc with: - Visual progress indicator - Detailed task completion tracking - Test coverage summary (90+ tests) - Technical debt section
Replace manual Default impl with #[derive(Default)] for cleaner code.
New crate providing a flat, timeline-based IR for skating programs: - types.rs: TimeCode and Duration types with arithmetic - rink.rs: Position, RinkDimensions, Heading for rink geometry - ISU Olympic rink dimensions (60m x 30m) - Named positions (center, corners, judges side) - timeline.rs: Event-based timeline with ISU code generation - All element types (jumps, spins, steps, pairs, dance) - JSON export support - Event filtering and querying - lower.rs: AST to IR lowering with position estimation 14 new tests, all passing. Total test count now 104+.
New crate for generating visual representations of skating programs: - rink_svg.rs: SVG rink diagram renderer - Olympic rink dimensions with ice markings - Element position markers with ISU codes - Color-coded element types (jumps=red, spins=blue, etc.) - Skating path traces - Configurable options (size, labels, markings) - timeline_svg.rs: SVG timeline chart renderer - Horizontal timeline with time axis - Segment markers - Element bars with duration - Color-coded by element type Rendering functions: - render_to_svg(timeline) -> String - render_to_file(timeline, path) -> Result 4 new tests, all passing. Total test count now 108+.
- Add viz, export, and info commands to CLI with full pipeline integration - Create 5 example .anv programs: men's short, ladies free, pairs short, ice dance rhythm, and exhibition/gala - Wire up Parse → Check → Lower → Viz/Export workflow in CLI - Fix clippy derivable_impls warning in StepPattern enum CLI now supports: - anv viz: Generate SVG rink diagrams and timeline charts - anv export: Export to JSON format with IR timeline data - anv info: Display program details and ISU rule validation
- Fix doc comment (///) parsing at program level
- Add contextual help to parse error messages
- Improve error display with proper message/label/help fields
- Add comprehensive --help examples to all CLI commands
- Update CONTRIBUTING.md with Anvomidav-specific guidelines
- Add TextMate grammar for GitHub syntax highlighting
- Add .anv linguist configuration in .gitattributes
Parser now properly handles:
/// Documentation comments
/// before program declarations
program name { ... }
Error messages now include:
- Clear expected/found information
- Contextual help suggestions
- Source location with labeled spans
Complete tree-sitter grammar with: - Full syntax support for programs, segments, sequences, elements - All skating-specific constructs (jumps, spins, steps, pairs elements) - Timing expressions and levels - Doc comments and line comments - Expressions and functions Includes: - grammar.js: Full grammar definition - queries/highlights.scm: Syntax highlighting queries - test/corpus/: Test cases for parser validation - package.json: Build configuration The grammar enables: - Precise syntax highlighting in editors - Structural navigation (go to definition, references) - Code folding - Incremental parsing for IDE performance
LSP Server (anv-lsp crate): - Full Language Server Protocol implementation using tower-lsp - Real-time diagnostics from parser, type checker, and ISU validation - Hover information for skating elements - Context-aware completions - Document symbols for program structure - Semantic tokens for enhanced highlighting Editor Extensions: - VS Code: Full extension with LSP client, syntax highlighting - Zed: Extension configuration with tree-sitter integration - Neovim: Lua plugin with lspconfig integration - Helix: Language configuration and grammar setup All editors support: - Syntax highlighting via tree-sitter - LSP features (diagnostics, hover, completion) - ISU rule validation feedback
- Implement full Anvomidav source code formatter in anv-syntax - Add --watch flag to 'anv check' and 'anv fmt' commands - Formatter handles all AST node types with proper indentation - Watch mode uses notify-debouncer-mini for file system events
Add extensive parser enhancements to support the complete Anvomidav DSL:
Expression parsing:
- Lambda expressions: |x, y| body
- Match expressions with pattern matching
- Record literals: { field: value }
- Function calls, field access, index access (postfix ops)
- Complete binary/unary operators
Type definitions:
- Type aliases: type Speed = Float
- Record types: type Point { x: Float, y: Float }
- Enum types: type Direction = North | South
- Generic type parameters with bounds: type Container<T: Ord>
Element parsing:
- Transition elements with movement qualities
- Pattern elements for ice dance
- Parallel and sync elements for pairs
- Annotations: @highlight, @color("blue", 1.0)
- Jump combinations: jump triple lutz + double toe_loop
- After timing: element after 1:00
- Range timing: element 0:30..1:00
Bug fixes:
- Fix Token::At vs Token::At_ for annotation parsing
- Fix type_expr_parser infinite recursion (postfix ? operator)
- Fix type definition parsing order (record, enum, alias)
- Fix TypeParam struct creation with bounds support
Tests:
- Add 36 new comprehensive parser tests
- Cover type definitions, functions, expressions
- Cover all element types and timing options
- Cover annotations and complex program structures
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
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
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.