Skip to content

Extend Mata with counter automata support#548

Draft
hiraethese wants to merge 84 commits intoVeriFIT:develfrom
hiraethese:devel
Draft

Extend Mata with counter automata support#548
hiraethese wants to merge 84 commits intoVeriFIT:develfrom
hiraethese:devel

Conversation

@hiraethese
Copy link

This PR extends the Mata automata library with support for GCFAs, a generalization of NFAs that includes counter guards/updates on transitions. It introduces efficient data structures, polymorphic annotation handling, and a LISP-like format for specifying automata. Core operations such as union, intersection, and membership testing are implemented for GCFAs. Benchmarks show improved performance and reduced state explosion compared to standard NFAs. This lays the foundation for advanced applications like integration with the Z3-Noodler string solver.

hiraethese and others added 24 commits May 11, 2025 04:34
@codecov
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

❌ Patch coverage is 62.43465% with 1006 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.04%. Comparing base (c71302d) to head (6fd65d3).
⚠️ Report is 142 commits behind head on devel.

Files with missing lines Patch % Lines
src/cntnfa/operations.cc 66.77% 201 Missing and 93 partials ⚠️
src/cntnfa/cntnfa.cc 74.12% 75 Missing and 29 partials ⚠️
src/cntnfa/annotations.cc 13.59% 88 Missing and 1 partial ⚠️
src/cntnfa/delta.cc 78.51% 55 Missing and 29 partials ⚠️
src/cntnfa/builder.cc 61.21% 53 Missing and 30 partials ⚠️
src/cntnfa/product.cc 54.97% 53 Missing and 24 partials ⚠️
src/cntnfa/concatenation.cc 0.00% 68 Missing ⚠️
src/cntnfa/universal.cc 0.00% 66 Missing ⚠️
src/cntnfa/inclusion.cc 52.50% 45 Missing and 12 partials ⚠️
src/cntnfa/registers.cc 41.07% 31 Missing and 2 partials ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##            devel     #548      +/-   ##
==========================================
- Coverage   75.88%   71.04%   -4.84%     
==========================================
  Files          43       61      +18     
  Lines        6476     9253    +2777     
  Branches     1437     2074     +637     
==========================================
+ Hits         4914     6574    +1660     
- Misses       1031     1918     +887     
- Partials      531      761     +230     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@koniksedy
Copy link
Collaborator

The naming convention should be changed, especially in the builder. A lot of functions/methods operating on Cntnfa contain the word nfa instead of cntfna (Cntnfa create_single_word_nfa(...), Cntnfa construct_counter_nfa(...)...). Also, the documentation should talk about CNTNFA, not NFA, for better understandability.

@Adda0
Copy link
Collaborator

Adda0 commented Jul 30, 2025

I agree that the naming needs to change. Primarily, Since the type of the automaton will be used repeatedly, I would opt for as the shortest name as possible. Maybe CNFA? And RNFA can then be general register NFA? So, the class name should be CNfa with this precise capitalization, and RNfa? Alternatively, Reg and Cnt are good enough, but should adhere to the naming convention, so RegNfa and CntNfa.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed.

@hiraethese hiraethese marked this pull request as draft August 16, 2025 14:26
@Adda0 Adda0 added the Status:stale The PR's progress has stalled. label Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status:stale The PR's progress has stalled.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants