Skip to content

feat(Computability/Languages): regular languages have matching regular expressions through Kleene’s Algorithm - #887

Open
chiyunhsu wants to merge 95 commits into
leanprover:mainfrom
chiyunhsu:IsRegularIffRegex
Open

chiyunhsu wants to merge 95 commits into
leanprover:mainfrom
chiyunhsu:IsRegularIffRegex

Conversation

@chiyunhsu

@chiyunhsu chiyunhsu commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

We introduce IsRegular.iff_regex, a language is regular if and only if it matches a regular expression. It is a combination of the existing IsRegular.regex, a language matching a regular expression is regular and our new direction. The new direction is proven through Kleene’s algorithm.

It is the result that was anticipated in PR#846 by @ctchou.       

The pull request introduces a new file, KleeneAlgorithm.lean. In it, we proved a language defined by a DFA on Fin n with one accepting state has a matching regular expression. The algorithm applies induction on a bound which restricts which interior states that a run may pass through.  

Implemented collaboratively by Brooke Gill and Chi-Yun Hsu

@ctchou ctchou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is the first batch of my comments. I will have more in the future.

My general point is that by defining FLTS.execution, you can express directly the concepts in the textbook proof, rather than using bespoke recursive definitions. This allows you to leverage the large number of results about lists in mathlib.

Comment thread Cslib/Computability/Languages/KleeneAlgorithm.lean
Comment thread Cslib/Computability/Languages/KleeneAlgorithm.lean Outdated
Comment thread Cslib/Computability/Languages/KleeneAlgorithm.lean
Comment thread Cslib/Computability/Languages/KleeneAlgorithm.lean
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.

3 participants