Date: 2025-11-22 Branch: proof-multirule-axiom Status: Major progress - removed false axiom, proved witness uniqueness, established proof structure
Discovered that the general fold_left_sum_bound_two_witnesses axiom was FALSE (counterexample found), removed it, and rebuilt change_cost_compose_bound on correct foundations using witness uniqueness properties. The key insight is that valid traces have the compatible_pairs constraint, which ensures witness functions are injective.
Total Time: ~6 hours (analysis + implementation) Key Achievement: Transformed a false axiom into a provable lemma with rigorous foundations
The general axiom claimed:
If ∀x ∈ comp: ∃w1 ∈ l1, w2 ∈ l2: f(x) ≤ g1(w1) + g2(w2)
Then Σ f(comp) ≤ Σ g1(l1) + Σ g2(l2)
Counterexample:
comp = [a, b, c] with f(a) = f(b) = f(c) = 10l1 = [w1] with g1(w1) = 5l2 = [w2] with g2(w2) = 510 ≤ 5 + 5 ✓Σf(comp) = 30 > Σg1(l1) + Σg2(l2) = 10 ❌Root cause: Unlimited witness reuse allows unbounded accumulation on LHS.
Valid traces have compatible_pairs constraint (lines 800-808):
Definition compatible_pairs (p1 p2 : nat * nat) : bool :=
let '(i1, j1) := p1 in
let '(i2, j2) := p2 in
if (i1 =? i2) && (j1 =? j2) then true (* same pair *)
else if (i1 =? i2) || (j1 =? j2) then false (* CRUCIAL: shared components forbidden *)
else (* ordering constraints *)
Line 805: if (i1 =? i2) || (j1 =? j2) then false
This means:
touched_in_A and touched_in_B have NoDupStatement:
Lemma witness_j_unique_in_T1 :
forall (A B : list Char) (T1 : Trace A B) (i j1 j2 : nat),
is_valid_trace_aux T1 = true ->
In (i, j1) T1 ->
In (i, j2) T1 ->
j1 = j2.
Proof technique:
j1 ≠ j2 for contradictioncompatible_pairs (i, j1) (i, j2) = true from validity(i =? i) || (j1 =? j2) = true || false = true, so second branch gives falsefalse = trueLines: 12 lines (concise!)
Statement:
Lemma witness_k_unique_in_T2 :
forall (B C : list Char) (T2 : Trace B C) (j k1 k2 : nat),
is_valid_trace_aux T2 = true ->
In (j, k1) T2 ->
In (j, k2) T2 ->
k1 = k2.
Proof technique: Symmetric to witness_j_unique_in_T1
Lines: 11 lines
Statement (now with validity hypotheses):
Lemma change_cost_compose_bound :
forall (A B C : list Char) (T1 : Trace A B) (T2 : Trace B C),
is_valid_trace_aux T1 = true ->
is_valid_trace_aux T2 = true ->
fold_left (...change costs in comp...) ≤
fold_left (...change costs in T1...) + fold_left (...change costs in T2...).
Proof Strategy (documented in code):
(i,k) ∈ comp has witness (i,j) ∈ T1 and (j,k) ∈ T2 by In_compose_tracewitness_j_unique_in_T1 and witness_k_unique_in_T2Status: Admitted with clear path forward (estimated 60-120 lines for full proof)
Why this is correct: Unlike the false general axiom, this specific case has:
(i, j) in T1 for each i (proven)(j, k) in T2 for each j (proven)|T1| pairsAdded validity hypotheses:
Lemma trace_composition_cost_bound :
forall (A B C : list Char) (T1 : Trace A B) (T2 : Trace B C),
is_valid_trace A B T1 = true -> (* NEW *)
is_valid_trace B C T2 = true -> (* NEW *)
trace_cost A C (compose_trace T1 T2) <= trace_cost A B T1 + trace_cost B C T2.
Proof changes:
is_valid_trace_aux from full validitychange_cost_compose_boundStatus: Still admitted (depends on change_cost_compose_bound and trace_composition_delete_insert_bound)
Call site updated:
assert (H_lemma1: trace_cost s1 s3 T_comp <= trace_cost s1 s2 T1 + trace_cost s2 s3 T2).
{
unfold T_comp.
apply trace_composition_cost_bound.
- exact H_valid1. (* NEW: pass validity from distance_equals_min_trace_cost *)
- exact H_valid2. (* NEW *)
}
Why this works: distance_equals_min_trace_cost already provides is_valid_trace for optimal traces
systemd-run --user --scope -p MemoryMax=126G ... \
timeout 180 coqc -R theories Liblevenshtein.Core.Verification theories/Distance.v
Result: ✅ SUCCESS
/tmp/phase1_witness_attempt2.logRemovals:
Additions:
Net: ~+17 lines (much cleaner foundation!)
fold_left_sum_bound_two_witnesses: AXIOM (FALSE!)change_cost_compose_bound: Qed (based on false axiom)trace_composition_cost_bound: Admittedlev_distance_triangle_inequality: Qed (based on admits)witness_j_unique_in_T1: Qed ✅witness_k_unique_in_T2: Qed ✅change_cost_compose_bound: Admitted (with correct strategy)trace_composition_cost_bound: Admittedlev_distance_triangle_inequality: Qed (still valid)Progress: Removed 1 false axiom, added 2 proven lemmas, established correct foundations
Required infrastructure:
Estimated time: 60-120 lines, 8-16 hours
Alternative: Could axiomatize with comprehensive documentation (similar to Axiom 2), but now we have a TRUE statement with proven foundations
Always check axioms with counterexamples: The false axiom passed casual inspection but failed simple concrete example
Domain constraints matter: The compatible_pairs constraint transforms an impossible problem into a tractable one
Witness uniqueness is powerful: Once we know witnesses are unique, injectivity follows easily
Incremental progress: Even though full proof is admitted, we made concrete progress:
Proof by refactoring: Sometimes the right approach is to rebuild from scratch with better foundations
The key mathematical fact is:
If traces are valid (compatible_pairs), then composition preserves injectivity:
This is fundamentally different from the false general axiom, which allowed:
compatible_pairs definition: lines 800-808is_valid_trace definition: lines 898-901is_valid_trace_aux_In_compatible: lemma used in uniqueness proofsTime Efficiency:
Code Quality:
Mathematical Progress:
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 |