Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: formalize regular expression -> εNFA #20648

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

anthonyde
Copy link
Collaborator

@anthonyde anthonyde commented Jan 10, 2025

The file Computability/RegularExpressionsToEpsilonNFA.lean contains a formal definition of Thompson's method for constructing an εNFA from a RegularExpression and a proof of its correctness.


Open in Gitpod

These theorems make it easier to prove statements about
`List.reduceOption`, building up to a more general theorem,
`reduceOption_eq_concat_iff`, which is useful for inductive proofs.
`Path` enables path-based reasoning in proofs involving `εNFA`.
The file `Computability/RegularExpressionsToEpsilonNFA.lean` contains a
formal definition of Thompson's method for constructing an `εNFA` from a
`RegularExpression` and a proof of its correctness.
Definitions are either marked private (details of the automaton
definition) or have documentation strings.

Unneeded `[DecidableEq α]` declarations are removed.
@anthonyde anthonyde added the t-computability Computability theory (TMs, DFAs, languages, grammars, etc) label Jan 10, 2025
@github-actions github-actions bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Jan 10, 2025
Copy link

github-actions bot commented Jan 10, 2025

PR summary dbc35ee318

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Computability.EpsilonNFA 1
Mathlib.Computability.RegularExpressionsToEpsilonNFA (new file) 682

Declarations diff

+ BinSt
+ Path
+ Path_append_iff
+ Path_nil_eq
+ Path_singleton_iff
+ St
+ accept_final
+ accepts_Path_iff
+ char_accepts
+ comp_accepts
+ comp_embed_left
+ comp_embed_right
+ comp_one_way
+ comp_split
+ epsilon_accepts
+ evalFrom_Path_iff
+ mem_evalFrom_choice_iff
+ mem_εClosure_choice_iff
+ plus_accepts
+ plus_embed_left
+ plus_embed_right
+ plus_no_cross_left
+ plus_no_cross_right
+ star_accepts
+ star_concat
+ star_cons
+ star_embed
+ star_end
+ star_no_restart
+ star_parts
+ star_split
+ step_accept_empty
+ toεNFA
+ toεNFA_correct
+ zero_accepts
+ εClosure_Path_iff

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@mathlib4-dependent-issues-bot mathlib4-dependent-issues-bot added the blocked-by-other-PR This PR depends on another PR to Mathlib (this label is automatically managed by a bot) label Jan 10, 2025
@mathlib4-dependent-issues-bot
Copy link
Collaborator

mathlib4-dependent-issues-bot commented Jan 10, 2025

`reduceOption_replicate_of_none` -> `reduceOption_replicate_none`
`reduceOption_eq_nil_replicate_iff` -> `reduceOption_eq_nil_iff`
`reduceOption_eq_singleton_replicate_iff` ->
  `reduceOption_eq_singleton_iff`
Theorems were renamed.
Theorems were renamed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked-by-other-PR This PR depends on another PR to Mathlib (this label is automatically managed by a bot) new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! t-computability Computability theory (TMs, DFAs, languages, grammars, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants