Skip to content

feat(L-S37): PhiPriorQuantCorrect — Coq formal proof of phi-prior quantizer#794

Open
gHashTag wants to merge 1 commit into
mainfrom
feat/phd-phi-prior-quant-proof
Open

feat(L-S37): PhiPriorQuantCorrect — Coq formal proof of phi-prior quantizer#794
gHashTag wants to merge 1 commit into
mainfrom
feat/phd-phi-prior-quant-proof

Conversation

@gHashTag
Copy link
Copy Markdown
Owner

Closes #793

L-S37: φ-prior Weight Quantizer — Coq Formal Proof

Summary

Adds docs/phd/theorems/igla/PhiPriorQuantCorrect.v: a self-contained Coq 8.20.1 formal proof of correctness for the L-S37 φ-prior on-chip weight quantizer.

Quantizer Rule

if |w| >= phi_inv_sq (12533 Q1.15):  output = sign(w)  → TPos/TNeg
else:                                 output = 0         → TZero

Theorems Proved (all Qed, zero Admitted)

Theorem Statement
quantize_ternary forall w, quantize w = TPos \/ TZero \/ TNeg
quantize_zero_region forall w, Z.abs w < phi_inv_sq -> quantize w = TZero
quantize_positive_region phi_inv_sq <= w -> quantize w = TPos
quantize_negative_region w <= -phi_inv_sq -> quantize w = TNeg
quantize_at_pos_boundary quantize phi_inv_sq = TPos
quantize_just_below_pos_boundary quantize (phi_inv_sq - 1) = TZero
quantize_at_neg_boundary quantize (- phi_inv_sq) = TNeg
quantize_just_below_neg_boundary quantize (-(phi_inv_sq-1)) = TZero
quantize_zero quantize 0 = TZero
quantize_q115_complete Q1.15 range completeness
quantize_symmetric_pos/neg/zero Anti-symmetry theorems

Verification

coqc docs/phd/theorems/igla/PhiPriorQuantCorrect.v
# exit code: 0

Coq version: 8.20.1

Anchor

φ² + φ⁻² = 3 ; phi_inv_sq = 12533 ; DOI: 10.5281/zenodo.19227877
Apache-2.0, no vendor IP, Author: Dmitrii Vasilev admin@t27.ai

…correctness

Closes #793

Adds formal Coq proof for L-S37 φ-prior on-chip weight quantizer correctness.

Theorems proved (all Qed, no Admitted):
- quantize_ternary: forall w, quantize w = TPos \/ TZero \/ TNeg
- quantize_zero_region: forall w, |w| < phi_inv_sq -> quantize w = TZero
- quantize_positive_region: phi_inv_sq <= w -> quantize w = TPos
- quantize_negative_region: w <= -phi_inv_sq -> quantize w = TNeg
- quantize_at_pos_boundary, quantize_just_below_pos_boundary
- quantize_at_neg_boundary, quantize_just_below_neg_boundary
- quantize_zero: quantize 0 = TZero
- quantize_q115_complete: Q1.15 range completeness
- quantize_symmetric_pos/neg/zero: anti-symmetry
- phi_inv_sq_positive, phi_inv_sq_in_range, ternary_encoding_smaller

Verification: coqc 8.20.1 exit 0
phi_inv_sq = 12533 (Q1.15 threshold)
DOI: 10.5281/zenodo.19227877
Apache-2.0, no vendor IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[L-S37] PhiPriorQuantCorrect: Coq formal proof of phi-prior weight quantizer correctness

1 participant