Skip to content

Repository cleanup: stray files, dead code and duplicated logic - #63

Merged
alan23273850 merged 9 commits into
fmlab-iis:mainfrom
ondrik:repo-cleanup
Oct 21, 2026
Merged

alan23273850 merged 9 commits into
fmlab-iis:mainfrom
ondrik:repo-cleanup

Conversation

@ondrik

@ondrik ondrik commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Addresses most of #57 (the remaining item is listed below).

A cleanup of the repository with no change in behaviour: stray and obsolete files, and the items of #57 that are pure cleanups. Each commit covers one topic, so the PR is easiest to review commit by commit.

Files

  • Remove .DS_Store (now ignored), .travis.yml (Travis configuration for GCC 4.8; CI runs on GitHub Actions) and .vscode/settings.json.
  • Remove unit_tests/reference_answers/. No test or script uses it. Its .aut files use a header the current parser rejects, and artifact_evaluation.sh calls a command-line syntax that no longer exists.
  • .gitignore: drop entries for directories that no longer exist (python_interface, backup, equivalence_or_not, dyadic, revlib, POPL24).

Code (#57)

Dead code

  • Remove AUTOQ::Constraint and AUTOQ::check_validity, which have no callers.
  • Remove the CLI's SIGALRM timeout handler and its globals; it was never armed. Remove the unused Aut alias.
  • Remove -DCACHE_AC -DCACHE_OPT_CONGR from cli/CMakeLists.txt; no source file reads them.
  • Remove the no-op || find("Predicates") clause in ReadTwoAutomata.
  • Delete the old hand-written parser headers (predicate_parser.hh, complex_parser.hh, constraint_parser.hh, symboliccomplex_parser.hh) and qualify the three uses of Complex that relied on their global using.
  • Remove switch_symbol_to_second and the unused second symbol type of EvaluationVisitor/TimbukParser: TimbukParser<Symbol, Symbol> is now TimbukParser<Symbol>. Also remove the commented-out childStateMap code in CX, CZ and CCX.

Duplicated logic

  • The inclusion search shared by Concrete and Symbolic automata now lives in include/autoq/inclusion_bfs.hh. Each variant supplies a small leaf policy:

    • Concrete checks that B's amplitudes are a common nonzero multiple of A's;
    • Symbolic collects a vertex's leaf pairs and asks the SMT solver.

    The inclusion-time statistics are recorded as before. The Index variant enumerates B's transitions differently and stays separate; only its unused possible_colors_for_qA map is removed.

  • Keep one duration formatter, Convert::ToString. The only visible difference is in the per-gate debug log: a gate taking between 1 h and 1 day is logged as 1h5m5s instead of 0d1h5m5s.

  • Merge the two identical branches of ConstrainedComplex::operator* and of the unit-test helper run_single_folder_benchmark.

  • Move the Extended Dirac header scan and the constraints-to-SMT loop, which were each written twice, into helpers.

Small inefficiencies

  • The ratio check in the concrete inclusion ran four times per leaf pair; it now runs once.
  • mapped_vector comparisons no longer copy both maps.
  • run_verification reuses the parsed precondition instead of parsing pre.hsl again.

Not in this PR

  • Merging the four tree-duplication loops (CX with c < t, CZ, CCX with c < c2 < t, diagonal_gate). They differ in details that change the resulting automata:

    • diagonal_gate creates an empty transition entry for every copied state;
    • the loop bounds differ by the hasLoop level;
    • CX swaps children at the target, while diagonal_gate rescales leaves;
    • CZ and CCX keep three copies.

    Merging them is a rewrite of the gate algorithms and deserves its own PR.

  • run_execution parsing pre twice through ReadTwoAutomata(pre, pre, circuit). That call also computes the joint qubit order, so it is not a pure cleanup.

  • docs/old_README.md (the AutoQ 1.0 README) is kept. It may still serve as the CAV'23 artifact's documentation.

Testing

  • Native Release build: compiles, and ctest passes (2/2).
  • Output comparison against main: I ran 648 benchmark instances with both ver and ex. They are drawn from every family in benchmarks/ and unit_tests/testcase: all instances of the smaller families and of the per-paper folders, and for the 1000-instance families the first 15 and every 50th. Each run had a 20 s limit.
    • 645 runs finished on main, and all 645 outputs are identical with this branch, ignoring time and memory figures:
      • 498 ver verdicts: 462 [OK], 36 [failed];
      • 147 ex runs, each printing the full resulting set of states.
    • The other 645 runs hit the time limit and were not compared.

🤖 Generated with Claude Code

https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY

ondrik and others added 8 commits October 20, 2026 09:44
- .DS_Store: macOS folder metadata (now ignored).
- .travis.yml: Travis CI configuration for GCC 4.8; CI runs on GitHub
  Actions.
- .vscode/settings.json: editor-specific file associations.
- unit_tests/reference_answers/: not used by any test or script. The
  .aut files use a header the current parser rejects, and
  artifact_evaluation.sh calls a command-line syntax that no longer
  exists.
- .gitignore: drop entries for directories that no longer exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
- AUTOQ::Constraint and AUTOQ::check_validity: no callers since the
  commented-out SymbolicAutomata <= PredicateAutomata operator was
  deleted. inclusion_symbolic.cc now includes <regex> itself.
- CLI: the SIGALRM timeout handler, set_timeout() and their globals and
  constants were never armed (both calls were commented out); also
  drop the unused `Aut` alias in run_verification_impl, and reuse the
  already parsed precondition in run_verification instead of parsing
  pre.hsl again.
- cli/CMakeLists.txt: -DCACHE_AC -DCACHE_OPT_CONGR are not referenced by
  any source file.
- ReadTwoAutomata: the `|| find("Predicates")` clause had no effect,
  because parse_constants_section returns at once without a Constants
  section. The condition now matches ReadAutomaton.
- Remove the old hand-written parser headers (predicate_parser.hh,
  complex_parser.hh, constraint_parser.hh, symboliccomplex_parser.hh).
  Three were only includes, commented-out code and global
  using-declarations; qualify the three uses of Complex that relied on
  those.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
…ser (fmlab-iis#57)

EvaluationVisitor::switch_symbol_to_second started as false and was
never set, so the operator()<Symbol2>() branches could not run. Remove
the flag and the Symbol2/SymbolType2 template parameter;
TimbukParser<Symbol, Symbol> is now written TimbukParser<Symbol>, and
the TimbukParser<Symbolic, Predicate> instantiation goes away.

In the unit tests, run_single_folder_benchmark had two identical
branches (TimbukParser<Symbolic> and TimbukParser<Symbolic, Symbolic>
were the same type); merge them and drop the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
Util::print_duration and Convert::ToString(duration) had drifted apart. Keep Convert::ToString and use it for the per-gate log too; the only visible difference is that a gate taking between one hour and one day is logged as 1h5m5s instead of 0d1h5m5s. Also drop the ss.fill('0') calls, which had no effect without a field width.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
- ConstrainedComplex::operator*: the two size branches had identical bodies. The merge is symmetric, so bind the smaller and the larger operand and keep a single loop (and fix the comment on the local-constraint loop).
- ConcreteAutomata inclusion: the ratio-consistency check ran four times per leaf pair inside a loop whose index was never used; run it once.
- mapped_vector: compare through const references instead of copying both maps on every comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
…mlab-iis#57)

Both loops were written twice: the header scan in the single and the n-ary *_from_istream parsers, the constraints loop in ReadAutomaton and ReadTwoAutomata. Move each into an inline helper (read_extended_dirac_body, append_constraints_as_smt) next to its callers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
…lab-iis#57)

The graph search in ConcreteAutomata::operator<<= and in the symbolic scaled inclusion was the same code twice (about 190 identical lines). Move it into include/autoq/inclusion_bfs.hh as a template; each variant now supplies a small leaf policy: Concrete checks that B's amplitudes are a common nonzero multiple of A's for each combination of transitions, Symbolic collects the leaf pairs of a vertex and asks the SMT solver at a leaf vertex. The inclusion-time statistics are recorded exactly as before.

The Index variant enumerates B's transitions differently and stays separate. All three copies filled a possible_colors_for_qA map that was never read; it is gone, along with the commented-out code that used it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
…s#57)

These blocks belonged to an earlier way of numbering the copied states and have been commented out since. Only comments are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013gtFQRPe1eSSpmA7EJ2KNY
@ondrik
ondrik marked this pull request as draft October 20, 2026 10:17
@alan23273850
alan23273850 marked this pull request as ready for review October 21, 2026 07:16
@alan23273850
alan23273850 merged commit 9cf0c8a into fmlab-iis:main Oct 21, 2026
12 checks passed
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.

2 participants