← All comparisons

Fanal vs. D-Hammer

CAV 2025 · C++ / Mathematica

About D-Hammer

Automated decision procedure for labelled Dirac notation equalities. Unverified C++/Mathematica tool. Handles 158 CoqQ examples. From the same research group as Fanal.

Relationship and Origin

AspectD-HammerFanal
Research groupBASICS Lab (Yingte Xu, lead author)BASICS Lab (Yingte Xu, lead developer)
RoleProvides the automation algorithmProvides the foundational semantics and kernel-checked proofs
IntegrationVendored inside Fanal at extern/D-Hammer/Roadmap item B.1: port D-Hammer's algorithm as certified tactics
ComplementarityEfficient but unverified decision procedureVerified foundational framework incorporating D-Hammer's algorithms

Normalization Pipeline

AspectD-HammerFanal
Step 1Rule-based term rewriting (expand definitions, simplify)Certified rewrite rules in Supportive/Dirac/EqAxioms.lean
Step 2Variable expansion (abstract -> element-wise via sum_i)Corresponding expansions with soundness proofs
Step 3Rule-based rewriting modulo axiom set RTerm rewriting framework in Supportive/Dirac/Rewrite.lean
Step 4AC normalization (sorting operands of +, * on scalars)Variadic add/smul with list-based representation
Step 5Swapping successive summations (SUM-SWAP normalization)bigSum handling in dirac_eq tactic
Step 6De Bruijn indices for alpha-equivalenceNamed bound variables; alpha-equivalence handling planned

Type System Correspondence

AspectD-HammerFanal
Index typessigma ::= x | sigma1 x sigma2 (variable or product)DataType inductive: fin n | tuple ts | array n t
Term typesBasis(sigma), S, K(sigma), B(sigma), O(sigma1,sigma2), forall x.TDiracSort: scalar, ket alpha, bra alpha, oper alpha beta
Dependent typesFirst-class forall x : Index. T in object languageLean's native dependent types; no object-level forall needed
Higher-orderLambda abstractions in the object languageLean's native functions; bigSum uses bound variables
AC symbolsADDS, MULS with indefinite arity, flattened/sortedDiracTerm.add (variadic list), DiracTerm.smul (variadic list)
Register typesReg(sigma) with R ::= r | (R, R)LabelTerm with RegAtom atoms; WTLabel for well-typed labels

Semantic Gap

AspectD-HammerFanal
LDirac typingStatic types D(s1, s2) with disjointness as typing side conditionDynamic typing: disjointness checked at evaluation time (Option DynLDiracVal)
Semantics formalizationPaper-level denotational (Hilbert spaces)Machine-checked denotational (Mathlib matrices)
Cylindrical extensioncl(D, s) = D tensor 1_s with SWAP operators for reorderingAccess path model with RegAtom lists and dimValAppendEquiv
Scalar reasoningDelegated to Mathematica engine via WSTPLean-native: ring, field_simp, norm_num, complex number lemmas
Big operator handlingSUM[s, FUN[i, BASIS[sigma], body]] with de Bruijn + sum-swapbigSum x s body with named bound variables

Coverage and Benchmarks

AspectD-HammerFanal
Textbook (QCQI)18/18 solved in 0.82sSubset encoded and verified
CoqQ examples158/162 solved in 9.74s (4 use unsupported projectors)Growing coverage; roadmap target: encode most D-Hammer examples
Labelled Dirac (LDN)6+ solved (0.03s-7.37s)Labelled Dirac examples available
Quantum Circuits5/6 solved (1 timeout on QC-6)Circuit equivalences encoded via labelled Dirac
PerformanceSub-second on most examples (C++ native)Compilation-time checking (slower but certified)

Integration Impact

AspectD-HammerFanal
Push-button proofsAlready achieves this (as unverified tool)dirac_eq and ldirac_eq would close goals automatically with kernel-checked proofs
Program verificationNot in scopeLabelled Dirac reasoning is prerequisite for quantum Hoare logic
Loewner orderNot in scopeBuilds on equational reasoning as foundation
Trust modelUser trusts C++ + Mathematica implementationEvery proof step verified by Lean kernel

Label Elimination

AspectD-HammerFanal
ApproachThree-step: decompose to labelled basis -> rewrite to normal form -> order and eliminate quantum variablesNeeds soundness proofs against LDiracWellTyped.eval semantics
SoundnessProved on paper (Theorem 2)Would be machine-checked in Lean
CompletenessProved on paper for the label elimination reductionWould be machine-checked in Lean
ImplementationC++ with ANTLR4 parsingLean 4 metaprogram or Expr-level tactic

Summary: Key Differences

AspectD-HammerFanal
RelationshipStandalone decision procedureIntegration target for D-Hammer
Trust BaseUnverified C++ / MathematicaLean 4 kernel (fully verified)
ScopeDirac equational reasoning onlyFull program verification
Research GroupSame group (BASICS Lab)Same group (BASICS Lab)
SynergyProvides automation engineProvides kernel-checked proof certificates