Liking cljdoc? Tell your friends :D

Levenshtein Verification Proof Index

Generated: 2025-12-01 Status: Historical index. For current trusted scope and proof-gap status, use FORMAL_VERIFICATION_MANIFEST.tsv and README_FORMAL_GATES.md.

Quick Statistics

CategoryCore (Modular)Core (Distance.v.bak)PhoneticTotal
Modules311 (deprecated backup)1446
Theorems63413
Lemmas~220~80~95~395
Definitions~45~10~15~70
Axioms0022

Note: Distance.v.bak is a deprecated backup. All proofs have been extracted into the modular structure.


1. Main Theorems (Top-Level Results)

Generic elastic walker

TheoremLocationDescription
tree_bound_lower_bounds_every_terminalelastic/theories/WalkerSoundness.vLocal K1 terminal bounds and K2 child inflation lift to every terminal in a recursive dictionary subtree.
rejected_subtree_contains_no_qualifying_terminalelastic/theories/WalkerSoundness.vA subtree rejected above the inclusive cutoff contains no qualifying exact result.
k1_k2_imply_no_false_negativeselastic/theories/WalkerSoundness.vThe complete recursive DFS walker retains every exact terminal whose distance is inside the cutoff.
walk_tree_soundelastic/theories/WalkerSoundness.vEvery emitted value belongs to the source tree and satisfies the cutoff.

Representation-preserving subsumption fallback

TheoremLocationDescription
shared_subsumes_is_legacy_subsumescore/theories/Conformance/SubsumptionFallback.vFor every carrier predicate, factoring the shared cost guard out of the three legacy mode branches is extensionally exact.
transposition_mixed_continuations_never_subsumecore/theories/Conformance/SubsumptionFallback.vNormal and in-progress OSA states remain incomparable in both directions.
merge_split_requires_same_index_and_kindcore/theories/Conformance/SubsumptionFallback.vEvery shared merge/split dominance result preserves index and continuation kind.

Ordered costs and binary64 roundoff

TheoremLocationDescription
weighted_l1_associativecore/theories/Conformance/CostMonoid.vMathematical non-negative real addition with explicit top is associative; this is not a bitwise f64 claim.
binary64_round_error_componentscore/theories/Conformance/WeightedCostFloat.vFlocq decomposes round-to-nearest-even binary64 error into bounded relative and gradual-underflow components.
binary64_round_absolute_errorcore/theories/Conformance/WeightedCostFloat.vThe component theorem implies a one-round absolute-plus-relative bound.
two_rounded_additions_reassociation_envelopecore/theories/Conformance/WeightedCostFloat.vAny rounder satisfying the one-round contract has a proved symbolic three-term reassociation envelope.
binary64_three_term_reassociation_envelopecore/theories/Conformance/WeightedCostFloat.vInstantiating the composition theorem with Flocq's binary64 rounder bounds finite three-term regrouping error without asserting exact associativity.

Exact multi-kind Dyck correction and binary persistence

TheoremLocationDescription
correction_target_is_dyckcore/theories/Conformance/DyckCorrection.vEvery reconstruction branch produces a kind-sensitive balanced target.
zero_cost_correction_is_balanced_identitycore/theories/Conformance/DyckCorrection.vA zero-cost witness preserves the source exactly and proves it is Dyck.
every_source_has_a_correctioncore/theories/Conformance/DyckCorrection.vDeleting every token supplies a total upper-bound witness.
interval_recurrence_is_globally_exactcore/theories/Conformance/DyckCorrection.vWith strict subinterval minima already filled, the least runtime branch cost is equivalent to the global minimum over all correction trees.
finite_functional_minimumcore/theories/Conformance/DyckCorrection.vA nonempty finite family with one natural cost per descriptor has a constructively selected least cost; no classical choice is used.
every_source_has_an_exact_minimumcore/theories/Conformance/DyckCorrection.vStrong interval-length induction establishes an attained exact correction minimum for every source.
strict_subintervals_always_minimizedcore/theories/Conformance/DyckCorrection.vThe runtime fill-order premise follows for every interval rather than remaining a caller assumption.
correction_target_length_is_boundedcore/theories/Conformance/DyckCorrection.vEvery reconstructed target has length at most twice the source length, justifying the exhaustive-oracle cutoff.
nonempty_dyck_first_pair_decompositioncore/theories/Conformance/DyckCorrection.vEvery nonempty typed-Dyck word has the first-pair decomposition enumerated by the interval recurrence.
correction_tree_is_standard_alignmentcore/theories/Conformance/DyckCorrection.vEvery reconstruction tree denotes an ordinary unit-cost Levenshtein alignment with exactly the same cost.
standard_alignment_normalizes_to_correction_treecore/theories/Conformance/DyckCorrection.vEvery standard alignment to a typed-Dyck target normalizes to a reconstruction tree at no greater cost.
correction_minimum_equals_dyck_levenshtein_minimumcore/theories/Conformance/DyckCorrection.vThe algorithm-shaped minimum is extensionally equal to the independent standard-Levenshtein minimum over the typed Dyck language.
interval_recurrence_is_exact_standard_dyck_distancecore/theories/Conformance/DyckCorrection.vThe increasing-interval invariant refines the runtime recurrence directly to the independent language-distance specification.
interval_recurrence_is_unconditionally_exact_standard_dyck_distancecore/theories/Conformance/DyckCorrection.vFinite descriptor enumeration and strong induction discharge the interval premise and prove end-to-end exactness against ordinary Levenshtein semantics.
every_source_has_an_exact_standard_dyck_distancecore/theories/Conformance/DyckCorrection.vEvery source has an attained minimum distance to the complete typed-Dyck language.
diagnostic_rename_is_semantics_preservingcore/theories/Conformance/OperationSetSerialization.vOperation behavior depends on its applicability tag, never its diagnostic name.
accepted_envelope_is_exact_and_boundedcore/theories/Conformance/OperationSetSerialization.vAcceptance implies the magic/version/flags contract, exact consumption, semantic validation, and resource bounds.
trailing_payload_bytes_are_rejectedcore/theories/Conformance/OperationSetSerialization.vAn envelope with bytes beyond its declared payload cannot be accepted.
accepted_protobuf_is_preflight_boundedcore/theories/Conformance/OperationSetSerialization.vEvery allocation-bearing protobuf count is within policy before semantic admission.
protobuf_over_limit_never_reaches_prostcore/theories/Conformance/OperationSetSerialization.vAn operation, pair, or text count above policy cannot pass the pre-allocation gate.
protobuf_weight_bits_round_trip_exactlycore/theories/Conformance/OperationSetSerialization.vThe protobuf fixed64 weight field preserves all 64 IEEE-754 bits.
trailing_compressed_data_is_rejectedcore/theories/Conformance/OperationSetSerialization.vA gzip wrapper that does not consume the complete supplied input cannot be accepted.
decompression_over_limit_is_rejectedcore/theories/Conformance/OperationSetSerialization.vInflated bytes above the inner-format ceiling are rejected before semantic decode.
accepted_bincode_bytes_have_the_exact_runtime_envelopecore/theories/Conformance/OperationSetByteParsers.vSuccessful executable parsing derives magic, little-endian version and flags, exact declared payload consumption, and the payload ceiling from concrete bytes.
parsed_varint_is_bounded_and_consumes_one_prefixcore/theories/Conformance/OperationSetByteParsers.vEvery successful protobuf varint consumes one prefix of at most ten bytes and fits uint64.
parsed_length_delimited_field_consumes_exactly_its_prefix_and_bodycore/theories/Conformance/OperationSetByteParsers.vA successful length-delimited parse partitions the input exactly into length prefix, body, and unconsumed suffix.
accepted_protobuf_bytes_are_wire_parsed_before_allocationcore/theories/Conformance/OperationSetByteParsers.vSuccessful nested wire preflight implies concrete parse evidence and every payload, operation, name, pair, and text bound.
accepted_gzip_adapter_observation_is_complete_bounded_and_inner_validcore/theories/Conformance/OperationSetByteParsers.vGiven the explicit flate2 observation boundary, admission implies gzip identity, complete input consumption, bounded output, valid checksum observation, and inner acceptance.
concrete_bincode_and_validated_payload_refine_abstract_admissioncore/theories/Conformance/OperationSetByteParsers.vConcrete header parsing composed with bounded semantic payload validation satisfies the abstract bincode admission contract.
concrete_protobuf_and_validated_message_refine_abstract_admissioncore/theories/Conformance/OperationSetByteParsers.vConcrete nested wire preflight composed with supported-format and semantic validation satisfies the abstract protobuf admission contract.
concrete_gzip_adapter_refines_abstract_admissioncore/theories/Conformance/OperationSetByteParsers.vThe crate-owned checks on a trusted decompressor observation refine the abstract single-member gzip admission contract.

Class-A alignment presets

TheoremLocationDescription
hamming_trianglecore/theories/Conformance/ClassAPresets.vCoordinate mismatch triangle inequalities lift inductively to equal-length sequences.
reverse_script_preserves_costcore/theories/Conformance/ClassAPresets.vReversing an indel script and swapping insert/delete preserves cost.
reverse_script_swaps_consumptioncore/theories/Conformance/ClassAPresets.vThe inverse script exchanges source and target consumption.
indel_length_lower_boundscore/theories/Conformance/ClassAPresets.vEither directional length difference is bounded by script cost.
bounded_skip_exact_length_differencecore/theories/Conformance/ClassAPresets.vA match/source-delete path costs exactly source length minus target length.
validated_total_bounds_every_prefixcore/theories/Conformance/ClassAPresets.vA complete aggregate below the resource ceiling bounds every operation prefix.

PositionKind and monomorphized variants

TheoremLocationDescription
full_key_injectivecore/theories/Conformance/PositionKindVariant.vEquality of (term_index, num_errors, kind, aux) implies equality of positions, justifying binary-search uniqueness.
dispatch_equivalencecore/theories/Conformance/PositionKindVariant.vRuntime per-position and selected static variant policies are extensionally equal for every built-in algorithm.
osa_mixed_continuations_do_not_subsumecore/theories/Conformance/PositionKindVariant.vA normal OSA position cannot prune a pending adjacent-transposition continuation.
merge_split_requires_strictly_fewer_errorscore/theories/Conformance/PositionKindVariant.vEvery successful merge/split dominance decision has strict accumulated-cost improvement.
standard_subsumption_never_reverses_error_ordercore/theories/Conformance/PositionKindVariant.vStandard dominance cannot hold when the alleged dominator has greater accumulated cost.

Unrestricted Damerau streaming refinement

TheoremLocationDescription
entry_preserves_budgetdamerau/theories/DamerauStreaming.vEvery guarded macro entry remains inside the configured edit budget.
entry_creates_valid_pendingdamerau/theories/DamerauStreaming.vEntry creates a pending continuation whose positive delta fits the one-byte payload.
extend_preserves_delta_and_adds_onedamerau/theories/DamerauStreaming.vAn interior dictionary unit preserves origin/delta and charges exactly one insertion.
pending_has_no_epsilon_successordamerau/theories/DamerauStreaming.vA pending macro cannot double-charge prepaid query-interior deletions.
resolve_advances_exact_endpointdamerau/theories/DamerauStreaming.vResolution advances from the stored origin by exactly $\delta+1$ and preserves cost.
macro_cost_equivalentdamerau/theories/DamerauStreaming.vThe streaming charge equals the Lowrance–Wagner macro term.
mixed_continuations_never_subsumedamerau/theories/DamerauStreaming.vNormal and pending residual languages are incomparable in both directions.
pending_subsumption_requires_same_keydamerau/theories/DamerauStreaming.vPending dominance exposes non-greater cost and equality of origin and delta.
frontier_quadratic_bounddamerau/theories/DamerauStreaming.vAt most $k$ diagonals times $k$ deltas yields the $k^2$ frontier envelope.

Discrete Fréchet kernel and bottleneck properties

TheoremLocationDescription
interval_frechet_step_admissiblefrechet/theories/Metric/FrechetProperties.vExact point-to-bin minima and monotone min/max recurrence lower-bound every represented scalar cell.
point_interval_frechet_step_exactfrechet/theories/Metric/FrechetProperties.vA point bin reproduces the scalar bottleneck recurrence exactly.
endpoint_bound_admissiblefrechet/theories/Metric/FrechetProperties.vThe maximum of the two coupling-pinned endpoint links is a candidate lower bound.
one_sided_hausdorff_admissiblefrechet/theories/Metric/FrechetProperties.vCoverage of every source point by a bounded coupling implies the one-sided Hausdorff bound.
bottleneck_triangle_composition_stepfrechet/theories/Metric/FrechetProperties.vPointwise triangle bounds survive one minimax coupling-composition step.
bottleneck_zero_identifies_each_linkfrechet/theories/Metric/FrechetProperties.vA non-negative zero bottleneck forces both prefix and current link to zero.

ERP kernel and quotient properties

TheoremLocationDescription
interval_dist_admissibleerp/theories/Metric/ErpProperties.vScalar-to-bin distance lower-bounds every concrete realization.
interval_dist_degenerateerp/theories/Metric/ErpProperties.vA point bin reproduces scalar absolute distance exactly.
script_gap_mass_bounderp/theories/Metric/ErpProperties.vGap-mass potential difference is bounded by the cost of any ERP edit script.
erp_candidate_lower_bounderp/theories/Metric/ErpProperties.vK4 candidate bound for the source and target projected from any alignment.
zero_cost_alignment_has_quotient_identityerp/theories/Metric/ErpProperties.vEvery zero-cost alignment has equal normal forms after removing the fixed gap value.

Core Verification - Levenshtein Distance Properties

TheoremLocationDescription
trace_cost_lower_boundLowerBound/MainTheorem.v:42Any valid trace with NoDup and monotonicity has cost >= lev_distance. The fundamental lower bound theorem.
lev_distance_identityCore/MetricProperties.v:21d(A, A) = 0. A string has zero distance to itself.
lev_distance_symmetryCore/MetricProperties.v:41d(A, B) = d(B, A). Edit distance is symmetric.
lev_distance_triangle_inequalityTriangle/TriangleInequality.v:145$d(A, C) \le d(A, B) + d(B, C).$ Triangle inequality for edit distance.
lev_distance_upper_boundCore/MetricProperties.v:92d(A, B) <= max(|A|, |B|). Distance bounded by longer string.
trace_composition_cost_boundComposition/CostBounds.v:1313$\mathrm{cost}(T_1 \circ T_2) \le \mathrm{cost}(T_1) + \mathrm{cost}(T_2)$. Key lemma for triangle inequality.
distance_equals_min_trace_costDistance.v.bak:7876Distance equals minimum trace cost over all valid traces.

Phonetic Verification - Position Skipping Optimization

TheoremLocationDescription
position_skipping_conditionally_safePosition_Skipping_Proof.v:518Position skipping is safe for restricted rule sets with position-independent contexts.
position_skip_safe_for_local_contextsPosition_Skipping_Proof.v:365Position skipping preserves semantics when contexts don't depend on absolute position.
apply_rules_seq_opt_terminatesCore/Rules.v:75The optimized algorithm always terminates with sufficient fuel.
pattern_overlap_preservationPatterns/PatternOverlap.vWhen a pattern overlaps a transformation region and fails to match originally, it fails after transformation. (612-line proof)

2. Supporting Theorems & Key Lemmas

Tier 1: Metric Space Foundations

NameTypeLocationDescription
lev_distance_length_diff_lowerLemmaCore/MetricProperties.v:199Distance is at least the difference in lengths
abs_diff_succ_boundLemmaCore/MetricProperties.v:155Bound on abs_diff with successor

Tier 2: Algorithm Correctness

NameTypeLocationDescription
lev_distance_unfoldLemmaCore/LevDistance.v:61Unfolding lemma matching recursive definition
lev_distance_empty_leftLemmaCore/LevDistance.v:81Base case: distance from empty string on left
lev_distance_empty_rightLemmaCore/LevDistance.v:89Base case: distance from empty string on right
lev_distance_consLemmaCore/LevDistance.v:98Recursive case for cons patterns
lev_distance_nil_nilLemmaLowerBound/Definitions.v:22Base: empty to empty is 0
lev_distance_nil_lLemmaLowerBound/Definitions.v:25Base: empty to any on left
lev_distance_nil_rLemmaLowerBound/Definitions.v:28Base: any to empty on right
lev_distance_cons_consLemmaLowerBound/Definitions.v:31Cons case for both strings

Tier 3: Min Function Properties

NameTypeLocationDescription
min3_lower_boundLemmaCore/MinLemmas.v:19min3 returns value <= all inputs
min3_comm_12LemmaCore/MinLemmas.v:37min3 commutative in first two args
subst_cost_eqLemmaCore/MinLemmas.v:78subst_cost is 0 for identical chars
subst_cost_neqLemmaCore/MinLemmas.v:93subst_cost is 1 for different chars
subst_cost_boundLemmaCore/MinLemmas.v:107subst_cost bounded by 1

Tier 4: Trace Validity

NameTypeLocationDescription
is_valid_trace_aux_implies_monotonicLemmaTrace/TraceBasics.v:126BRIDGE: is_valid_trace_aux implies monotonicity
is_valid_trace_implies_NoDupLemmaTrace/TraceBasics.v:225Valid traces have NoDup
is_valid_trace_implies_monotonicLemmaTrace/TraceBasics.v:237Valid traces are monotonic
compatible_pairs_monotonic_helperLemmaTrace/TraceBasics.v:55Compatible pairs enforce order
forallb_compatible_monotonicLemmaTrace/TraceBasics.v:73forallb compatible implies monotonicity

Tier 5: Touched Positions

NameTypeLocationDescription
touched_in_A_lengthLemmaTrace/TouchedPositions.v:36Length of touched_in_A equals trace length
touched_in_B_lengthLemmaTrace/TouchedPositions.v:47Length of touched_in_B equals trace length
In_touched_in_A_exists_pairLemmaTrace/TouchedPositions.v:58If i in touched_in_A, exists j with (i,j) in T
In_pair_implies_touched_ALemmaTrace/TouchedPositions.v:84If (i,j) in T, then i in touched_in_A
In_pair_implies_touched_BLemmaTrace/TouchedPositions.v:97If (i,j) in T, then j in touched_in_B

Tier 6: Cardinality & NoDup

NameTypeLocationDescription
NoDup_splitLemmaCardinality/NoDupInclusion.v:18Split list with NoDup at element
incl_length_NoDupLemmaCardinality/NoDupInclusion.v:50Inclusion with NoDup implies length ordering
NoDup_list_interLemmaCardinality/NoDupInclusion.v:132NoDup preserved by list_inter
list_inter_length_boundLemmaCardinality/NoDupInclusion.v:143Length of intersection is bounded
NoDup_incl_exclusionLemmaCardinality/NoDupInclusion.v:155Inclusion-exclusion: $\lvert l1\rvert + \lvert l2\rvert \le n + \lvert l1 \cap l2\rvert$

Tier 6.5: Trace Composition Infrastructure

NameTypeLocationDescription
fold_left_triangle_boundLemmaComposition/CostBounds.v:728Pointwise bound implies fold_left bound
fold_left_sum_map_eqLemmaComposition/CostBounds.v:752Fold over composed function equals fold over map
fold_left_sum_bound_subsetLemmaComposition/CostBounds.v:766Sum over subset is bounded by superset sum
fold_left_pair_let_body_eqLemmaComposition/CostBounds.v:789Equivalence of let-pattern forms in fold_left
witness_to_T1_injectiveLemmaComposition/CostBounds.v:426witness_to_T1 is injective on composed trace
witness_to_T2_injectiveLemmaComposition/CostBounds.v:477witness_to_T2 is injective on composed trace
map_injective_on_list_NoDupLemmaComposition/CostBounds.v:528Injective map preserves NoDup
touched_comp_A_length_leLemmaComposition/CostBounds.v:847touched_in_A of composition bounded by T1
touched_comp_C_length_leLemmaComposition/CostBounds.v:862touched_in_C of composition bounded by T2
composition_size_pigeonholeLemmaComposition/CostBounds.v:1072Pigeonhole bound on composition size
trace_composition_delete_insert_boundLemmaComposition/CostBounds.v:1089Delete/insert cost bound for composition
change_cost_compose_boundLemmaComposition/CostBounds.v:1170Change cost triangle inequality for composition

Tier 7: Has Predicates

NameTypeLocationDescription
monotonicity_eliminates_cross_matchingLemmaLowerBound/HasPredicates.v:33Monotonicity eliminates cross-matching
monotonic_cross_matching_impossibleLemmaLowerBound/HasPredicates.v:98Cross-matching impossible with monotonicity
touched_in_A_1_implies_pairLemmaLowerBound/HasPredicates.v:53Extract (1, j) from touched_in_A containing 1
valid_trace_indices_ge1LemmaLowerBound/HasPredicates.v:79Pairs in valid trace have indices >= 1

Tier 8: Shift Operations

NameTypeLocationDescription
shift_trace_11_lengthLemmaLowerBound/ShiftTrace11Lemmas.v:21Length of shift_trace_11 when (1,1) present
shift_trace_A_length_no_A1LemmaLowerBound/ShiftTraceA.v:46shift_trace_A preserves length when has_A1=false
shift_trace_B_length_no_B1LemmaLowerBound/ShiftTraceB.v:39shift_trace_B preserves length when has_B1=false
shift_trace_11_validLemmaLowerBound/ShiftTrace11Lemmas.v:86Validity of shift_trace_11
shift_trace_A_validLemmaLowerBound/ShiftTraceA.v:156Validity of shift_trace_A
shift_trace_B_validLemmaLowerBound/ShiftTraceB.v:104Validity of shift_trace_B

Tier 9: NoDup Preservation

NameTypeLocationDescription
shift_trace_A_NoDup_ALemmaLowerBound/NoDupPreservation.v:95NoDup preserved for A under shift_trace_A
shift_trace_B_NoDup_BLemmaLowerBound/NoDupPreservation.v:184NoDup preserved for B under shift_trace_B
shift_trace_11_NoDup_ALemmaLowerBound/ShiftTrace11Lemmas.v:266NoDup preserved for shift_trace_11 on A
shift_trace_11_NoDup_BLemmaLowerBound/ShiftTrace11Lemmas.v:306NoDup preserved for shift_trace_11 on B

Tier 10: Monotonicity Preservation

NameTypeLocationDescription
shift_trace_A_monotonicLemmaLowerBound/MonotonicityLemmas.v:89Monotonicity preserved for shift_trace_A
shift_trace_B_monotonicLemmaLowerBound/MonotonicityLemmas.v:106Monotonicity preserved for shift_trace_B
shift_trace_11_monotonicLemmaLowerBound/MonotonicityLemmas.v:123Monotonicity preserved for shift_trace_11

Tier 11: Pigeonhole Bounds

NameTypeLocationDescription
NoDup_length_le_rangeLemmaLowerBound/PigeonholeBounds.v:116Pigeonhole: NoDup list in [a,b] has length <= b-a+1
NoDup_A_boundLemmaLowerBound/PigeonholeBounds.v:135NoDup + validity + no A1 implies |T| <= |s1'|
NoDup_B_boundLemmaLowerBound/PigeonholeBounds.v:160NoDup + validity + no B1 implies |T| <= |s2'|

Tier 12: Cost Analysis

NameTypeLocationDescription
trace_cost_fold_consLemmaLowerBound/TraceCostFold.v:29Accumulator property for fold_left
trace_cost_fold_shift_all_ge2LemmaLowerBound/TraceCostFold.v:50Cost equality after shift when indices >= 2
change_cost_shift_11LemmaLowerBound/TraceCostFold.v:79Cost decomposition for shift_trace_11
change_cost_shift_ALemmaLowerBound/ShiftTraceA.v:142Cost equality for shift_trace_A
change_cost_shift_BLemmaLowerBound/ShiftTraceB.v:90Cost equality for shift_trace_B

3. Core Definitions

Foundation Types

NameTypeLocationDescription
CharDefinitionCore/Definitions.v:18Characters as Coq's ascii type
MatrixDefinitionCore/Definitions.v:24DP matrix: nested list for 2D array
TraceDefinitionTrace/TraceBasics.v:20List of pairs (i, j) representing alignment
SearchInvariantInductiveAuxiliary/Types.v:82Execution state of sequential search
AlgoStateInductiveAuxiliary/Types.v:95Execution state of search algorithm

Core Functions

NameTypeLocationDescription
min3DefinitionCore/Definitions.v:29Minimum of three natural numbers
subst_costDefinitionCore/Definitions.v:41Substitution cost: 0 if match, 1 otherwise
lev_distance_pairFunctionCore/LevDistance.v:36Levenshtein distance with well-founded recursion
lev_distanceDefinitionCore/LevDistance.v:55Wrapper with standard signature
optimal_trace_pairFunctionOptimalTrace/Construction.v:28Optimal trace via DP backtracking

Trace Operations

NameTypeLocationDescription
touched_in_ADefinitionTrace/TouchedPositions.v:20Positions in A touched by trace
touched_in_BDefinitionTrace/TouchedPositions.v:27Positions in B touched by trace
trace_costDefinitionTrace/TraceCost.v:22Cost according to Wagner-Fischer
valid_pairDefinitionTrace/TraceBasics.v:25Check if pair valid for lengths
trace_monotonicDefinitionTrace/TraceBasics.v:48Trace preserves order

Shift Operations

NameTypeLocationDescription
shift_trace_11DefinitionLowerBound/ShiftTrace11.v:20Filter out (1,1) and shift indices
shift_trace_ADefinitionLowerBound/ShiftTraceA.v:28Filter pairs with i>1 and shift
shift_trace_BDefinitionLowerBound/ShiftTraceB.v:21Filter pairs with j>1 and shift

Predicates

NameTypeLocationDescription
has_pair_11DefinitionLowerBound/HasPredicates.v:19Check if (1,1) in trace
has_A1DefinitionLowerBound/HasPredicates.v:23Check if 1 in touched_in_A
has_B1DefinitionLowerBound/HasPredicates.v:27Check if 1 in touched_in_B
simple_valid_traceDefinitionLowerBound/Definitions.v:66Simple validity check
can_apply_atDefinitionAuxiliary/Types.v:20Check if rule can apply at position
no_rules_match_beforeDefinitionAuxiliary/Types.v:31No rules match before position

4. Phonetic Verification - Supporting Lemmas

Find First Match Lemmas

NameTypeLocationDescription
find_first_match_from_lower_boundLemmaAuxiliary/Lib.v:44Search only from start_pos onward
find_first_match_some_implies_can_applyLemmaAuxiliary/Lib.v:287Some result implies can_apply_at true
find_first_match_is_firstLemmaAuxiliary/Lib.v:376Found position has no earlier match
find_first_match_from_skip_oneLemmaPosition_Skipping_Proof.v:42Skip single non-matching position
find_first_match_from_skip_rangeLemmaPosition_Skipping_Proof.v:55Skip range of non-matching positions

Context Preservation

NameTypeLocationDescription
apply_rule_at_preserves_prefixLemmaPatterns/PatternHelpers_Basic.v:19Preserves phones before match position
initial_context_preservedLemmaPatterns/PatternHelpers_Basic.v:71Initial context preserved at earlier positions
before_vowel_context_preservedLemmaPatterns/PatternHelpers_Basic.v:85BeforeVowel context preserved
after_consonant_context_preservedLemmaPatterns/PatternHelpers_Basic.v:138AfterConsonant context preserved

Pattern Matching

NameTypeLocationDescription
pattern_matches_at_has_mismatchLemmaPatterns/PatternMatching_Induction.v:25False match implies mismatch position exists
pattern_has_leftmost_mismatchLemmaPatterns/PatternMatching_Positioning.v:25Mismatch has leftmost (first) position
leftmost_mismatch_before_transformationLemmaPatterns/PatternOverlap.v:44Leftmost mismatch before transformation

Invariant Maintenance

NameTypeLocationDescription
algo_state_maintains_invariantTheoremInvariants/AlgoState.v:61AlgoState maintains no_rules_match_before
search_invariant_initLemmaInvariants/InvariantProperties.v:125Search invariant holds at position 0
search_invariant_step_all_rulesLemmaInvariants/InvariantProperties.v:179Invariant extends when all rules don't match
no_rules_match_before_first_match_preservedTheoremPosition_Skipping_Proof.v:111Multi-rule invariant for position-independent contexts

5. Axioms & Semantic Gaps

NameStatusLocationDescription
rule_id_uniqueAxiomAuxiliary/Types.v:127rule_id uniquely identifies rules in Zompist phonetic system. Closed-world semantics for finite rule set.
find_first_match_in_algorithm_implies_no_earlier_matchesAxiomAuxiliary/Types.v:142If find_first_match finds position for rule, no rules matched before. Semantic bridge.
find_first_match_implies_algo_stateAdmittedInvariants/AlgoState.v:100SEMANTIC GAP: Connects find_first_match result to AlgoState existence.

6. Module-by-Module Reference

Core Theories (docs/verification/core/theories/)

Core/

  • Definitions.v - Base types: Char, Matrix, min3, subst_cost
  • LevDistance.v - Main lev_distance function with well-founded recursion
  • MinLemmas.v - Properties of min3 and subst_cost
  • MetricProperties.v - Metric space: identity, symmetry, upper bound

Trace/

  • TraceBasics.v - Trace type, validity, monotonicity
  • TouchedPositions.v - touched_in_A, touched_in_B projections
  • TraceCost.v - trace_cost function and bounds
  • TraceComposition.v - compose_trace operation

Cardinality/

  • NoDupInclusion.v - NoDup lemmas, list_inter, inclusion-exclusion
  • NoDupPreservation.v - NoDup preservation under trace operations

Triangle/

  • SubstCostTriangle.v - Substitution cost triangle inequality
  • TriangleInequality.v - lev_distance_triangle_inequality theorem

Composition/

  • WitnessLemmas.v - Witness construction for trace composition
  • CompositionNoDup.v - NoDup preservation for composed traces
  • CompositionValidity.v - Validity preservation for composed traces
  • CostBounds.v - trace_composition_cost_bound theorem and helper lemmas

OptimalTrace/

  • Construction.v - optimal_trace_pair construction via DP
  • Validity.v - Validity proof for optimal traces
  • CostEquality.v - trace_cost(optimal_trace) = lev_distance

DPMatrix/

  • MatrixOps.v - Matrix initialization and update operations
  • SnocLemmas.v - Suffix (snoc) lemmas for lev_distance
  • Correctness.v - Wagner-Fischer DP matrix correctness

MainTheorems.v

  • Consolidated exports of all main theorems

LowerBound/ (12 modules)

  • Definitions.v - Trace types and base lemmas
  • HasPredicates.v - has_A1, has_B1, has_pair_11
  • ShiftTrace11.v - shift_trace_11 operation
  • ShiftTraceA.v - shift_trace_A operation
  • ShiftTraceB.v - shift_trace_B operation
  • BoundHelpers.v - Validity bound helpers
  • PigeonholeBounds.v - Pigeonhole principle bounds
  • NoDupPreservation.v - NoDup preservation under shifts
  • ShiftTrace11Lemmas.v - shift_trace_11 validity and NoDup
  • MonotonicityLemmas.v - Monotonicity preservation
  • TraceCostFold.v - trace_cost_fold and cost decomposition
  • MainTheorem.v - trace_cost_lower_bound theorem

Phonetic Theories (docs/verification/phonetic/theories/)

Auxiliary/

  • Types.v - can_apply_at, SearchInvariant, AlgoState, axioms
  • Lib.v - find_first_match_from, arithmetic helpers, search lemmas

Core/

  • Rules.v - apply_rules_seq_opt, termination theorem

Invariants/

  • AlgoState.v - algo_state_maintains_invariant
  • InvariantProperties.v - Invariant initialization and stepping
  • NoMatch.v - No-match preservation lemmas
  • SearchInvariant.v - SearchInvariant lemmas

Patterns/

  • PatternHelpers_Basic.v - Prefix preservation, context preservation
  • PatternMatching_Properties.v - Pattern matching properties
  • PatternMatching_Induction.v - Nested induction for mismatch
  • PatternMatching_Positioning.v - Leftmost mismatch analysis
  • PatternOverlap.v - pattern_overlap_preservation theorem
  • Preservation.v - Context preservation definitions

Main Entry Point

  • Position_Skipping_Proof.v - position_skipping_conditionally_safe theorem

7. Dependency Graph (Simplified)

                     trace_cost_lower_bound
                              |
            +-----------------+------------------+
            |                 |                  |
    change_cost_shift_*   NoDup_*_bound    shift_trace_*_monotonic
            |                 |                  |
    trace_cost_fold     pigeonhole         shift_trace_*_valid
            |                 |                  |
        subst_cost      touched_in_*       trace_monotonic
            |                 |                  |
         min3              Trace            valid_pair
            |                 |                  |
          Char          list (nat*nat)         nat
              position_skipping_conditionally_safe
                              |
            +-----------------+------------------+
            |                 |                  |
    no_rules_match_*   pattern_overlap_*   apply_rules_seq_opt
            |                 |                  |
    search_invariant    leftmost_mismatch   find_first_match_from
            |                 |                  |
    algo_state          context_preserved    can_apply_at
            |                 |                  |
    AlgoState           apply_rule_at       RewriteRule

8. Extraction Status (Distance.v.bak → Modular)

Distance.v.bak is now a deprecated backup. All key theorems have been extracted into the modular structure.

✅ Fully Extracted (Now in Modular Files)

Original (Distance.v.bak)Extracted ToStatus
compose_traceTrace/TraceComposition.v✅ Complete
compose_trace_validComposition/CompositionValidity.v✅ Complete
compose_trace_costComposition/CostBounds.v:trace_composition_cost_bound✅ Complete
subst_cost_triangleTriangle/SubstCostTriangle.v✅ Complete
lev_distance_triangle_inequalityTriangle/TriangleInequality.v:145✅ Complete
witness_injectivityComposition/CostBounds.v:witness_to_T1/T2_injective✅ Complete
fold_left_triangle_boundComposition/CostBounds.v:728✅ Complete
change_cost_compose_boundComposition/CostBounds.v:1170✅ Complete
composition_size_pigeonholeComposition/CostBounds.v:1072✅ Complete

Remaining Items in Distance.v.bak

These items remain in the backup file but are not critical for the modular build:

NameTypeLineDescription
distance_equals_min_trace_costTheorem7876Distance equals minimum cost (verified via optimal trace)
dp_matrix_correctnessTheorem8349DP matrix correctness (in DPMatrix/Correctness.v)

Decomposition Summary

  • 31 modular files now compile with no Admitted lemmas
  • Distance.v.bak kept as reference but not used in build
  • All metric space properties proven in modular structure
  • Triangle inequality chain: trace_cost_lower_boundtrace_composition_cost_boundlev_distance_triangle_inequality

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close