This directory contains the modular decomposition of the position skipping optimization proof for phonetic rewrite rules.
# Generate Makefile from _CoqProject
coq_makefile -f _CoqProject -o Makefile
# Compile all modules in parallel
make -j$(nproc)
# Clean build artifacts
make clean
Compile modules in dependency order:
# Layer 1: Base types
coqc Auxiliary/Types.v
# Layer 2: Core library
coqc Auxiliary/Lib.v
# Layer 3: Core operations
coqc Core/Rules.v
# Layer 4: Pattern helpers and Invariants base
coqc Patterns/PatternHelpers.v
coqc Invariants/SearchInvariant.v
# Layer 5: Advanced invariants
coqc Invariants/AlgoState.v
coqc Invariants/NoMatch.v
# Layer 6: Pattern overlap (Axiom 2)
coqc Patterns/PatternOverlap.v
# Layer 7: Main proof
coqc Position_Skipping_Proof.v
theories/
├── Position_Skipping_Proof.v Main entry point (569 lines)
├── Auxiliary/
│ ├── Types.v Type definitions (169 lines)
│ └── Lib.v Core library (969 lines)
├── Core/
│ └── Rules.v Rule operations (105 lines)
├── Invariants/
│ ├── SearchInvariant.v Search invariant (314 lines)
│ ├── NoMatch.v No-match preservation (381 lines)
│ └── AlgoState.v Algorithm state (222 lines)
└── Patterns/
├── PatternHelpers.v Pattern lemmas (472 lines)
└── PatternOverlap.v Axiom 2 - FULLY PROVEN (506 lines)
Main entry point - Ties all modules together
Key theorems:
position_skip_safe_for_local_contexts - Main correctness theoremposition_skipping_conditionally_safe - Conditional safetyfinal_position_can_change - CounterexampleFoundational types - Type definitions and predicates
Defines:
wf_rule - Well-formednessposition_dependent_context - Context classificationSearchInvariant, AlgoState - State predicatesCore library - 969 lines of reusable lemmas
Provides:
find_first_match propertiesRule operations - Core transformation operations
Key lemmas:
apply_rule_at_region_structure - Regional preservationapply_rule_at_preserves_prefix - Prefix preservationcan_apply_at_beyond_length - Bounds checkingSearch invariant - Properties of search state
Establishes:
No-match preservation - Axiom 1 and supporting theorems
Key theorem:
single_rule_no_match_preserved (Axiom 1) - FULLY PROVENAlgorithm state - Execution state model
Key theorem:
algo_state_maintains_invariant - State preservationPattern helpers - Pattern matching analysis
Provides:
pattern_matches_at_has_mismatchpattern_has_leftmost_mismatchAxiom 2 - Pattern overlap preservation (FULLY PROVEN)
Crown jewel theorems:
leftmost_mismatch_before_transformation - 172-line proofpattern_overlap_preservation - Complete Axiom 2100% COMPLETE - All theorems proven with Qed
| Theorem | Status | Module |
|---|---|---|
Axiom 1: single_rule_no_match_preserved | ✅ PROVEN | NoMatch.v |
Axiom 2: pattern_overlap_preservation | ✅ PROVEN | PatternOverlap.v |
Main: position_skip_safe_for_local_contexts | ✅ PROVEN | Position_Skipping_Proof.v |
Conditional: position_skipping_conditionally_safe | ✅ PROVEN | Position_Skipping_Proof.v |
Counterexample: final_position_can_change | ✅ PROVEN | Position_Skipping_Proof.v |
Each module's dependencies are explicit via Require Import statements:
Position_Skipping_Proof.v → [All modules]
Patterns.PatternOverlap → PatternHelpers, Core.Rules, Auxiliary.*
Invariants.NoMatch → PatternHelpers, Core.Rules, Auxiliary.*
Invariants.AlgoState → Core.Rules, Auxiliary.*
Invariants.SearchInvariant → Core.Rules, Auxiliary.*
Patterns.PatternHelpers → Auxiliary.*
Core.Rules → Auxiliary.*
Auxiliary.Lib → Auxiliary.Types
Auxiliary.Types → (stdlib only)
To extract verified OCaml code:
Require Import Liblevenshtein.Phonetic.Verification.Position_Skipping_Proof.
Extraction "position_skipping.ml"
apply_rules_seq
apply_rules_seq_opt
can_apply_at
position_dependent_context.
MODULAR_DECOMPOSITION.md - Detailed module breakdown and statisticsREADME.md - This filePart of the liblevenshtein-rust verification project.
For questions about the proof structure or modules, refer to the inline documentation in each .v file.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |