Skip to content

Add semiprime-window procedural heuristic and expanded-meta instrumentation#25

Merged
GISMO-1 merged 1 commit into
mainfrom
gismo/add-semiprime-window-procedural-heuristic
Mar 2, 2026
Merged

Add semiprime-window procedural heuristic and expanded-meta instrumentation#25
GISMO-1 merged 1 commit into
mainfrom
gismo/add-semiprime-window-procedural-heuristic

Conversation

@GISMO-1

@GISMO-1 GISMO-1 commented Mar 2, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Reduce residual expanded-case pressure caused by semiprimes that the existing prime/square heuristics miss by deterministically widening the procedural window for semiprime candidates.
  • Use a cheap, deterministic gating test (residue + bounded SPF) so the heuristic is cheap and auditable.
  • Provide instrumentation in exported expanded-meta so coverage and trigger behavior can be measured precisely.

Description

  • Add semiprime_window_trigger(n, bound) helper that checks n % 48 in {1,25}, computes a bounded SPF, and returns (triggered, spf, bound_used) in src/strausforge/factor_meta.py.
  • Introduce new procedural heuristic option semiprime-window and wire it through the code paths and CLI choices (PROC_HEURISTIC_CHOICES, help text, and default heuristic selection).
  • Make procedural evaluation accept a semiprime_factor_bound and, when semiprime-window triggers, widen the initial procedural window deterministically (currently 8 -> 128) in src/strausforge/identities.py.
  • Default the SPF trial bound used for expanded metadata to 5000 (was 20000) while keeping the CLI --expanded-factor-bound override, and pass that bound into procedural evaluation in src/strausforge/hardness_core.py.
  • Enrich --export-expanded-meta records with semiprime_triggered: bool and spf_bound_used: int so trigger coverage is explicit in exported JSONL.
  • Update CLI defaults/help and README.md documentation to describe the heuristic and the new default bound.
  • Add unit/integration tests covering the trigger helper, metadata fields, and heuristic behavior in tests/test_factor_meta.py and tests/test_identities_verify.py.

Testing

  • Installed dev deps and ran python -m pip install -e '.[dev]' successfully.
  • Ran focused unit tests with python -m pytest tests/test_factor_meta.py tests/test_identities_verify.py -q and python -m pytest tests/test_cli.py -q -k "proc_heuristic or expanded_meta"; the new and affected tests passed.
  • Ran additional focused suite python -m pytest tests/test_factor_meta.py tests/test_identities_verify.py tests/test_cli.py -q -k "proc_heuristic or factor_meta or identities_verify" and linters with python -m ruff check ...; all invoked tests and ruff checks passed.
  • Committed the changes after tests/linting succeeded.

Codex Task

@GISMO-1 GISMO-1 merged commit 7137313 into main Mar 2, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant