Formal models and scripts: study-topk-pruning-proof
Tools: SMT-LIB (Z3/cvc5), Dafny, Python
These are the working models and scripts this part of the hunt used. Some encode the code as it is (a counterexample is the expected result), others a fixed or correct variant; read the header comment of each file. Paths inside them were replaced by placeholders such as $LUCENE (a Lucene checkout) and $WORK.
Findings
- MaxScoreBulkScorer can skip a document whose score equals the minimum competitive score (1-ulp rank inversion) (finding LFV-060; repro ยท finding page)
Files
dafny/FpModel.dfydafny/Pruning.dfydafny/RequiredClauseUnsound.dfydafny/Smoke.dfydafny/TopK.dfysmt/dump_o4.pysmt/fpcommon.pysmt/o1_sum_upper_bound.pysmt/o3_e2e.pysmt/o3_nice.pysmt/o3_required_clause.pysmt/o4_monotone_sameorder.pysmt/o6_wand_scaled.pysmt/o8_dismax.pysmt2/o4_double_n2.smt2smt2/o4_double_n3.smt2
How to run
- SMT-LIB:
z3 <file>.smt2orcvc5 <file>.smt2(satwith a model is a counterexample where the query asks for one). - Dafny:
dafny verify <file>.dfy(a failed obligation marks where the code's contract breaks). - Python:
python3 <file>.py; scripts that importz3need thez3-solverpackage.
Snapshot of 2026-11-03. AI-assisted; not yet triaged by a human Lucene committer. Feedback: open an issue in lucene-ai-bug-hunt.