Skip to content

feat(Foundations/Automata): add Machine closed symmetric monoidal category#478

Open
matthunz wants to merge 5 commits intoleanprover:mainfrom
matthunz:machine
Open

feat(Foundations/Automata): add Machine closed symmetric monoidal category#478
matthunz wants to merge 5 commits intoleanprover:mainfrom
matthunz:machine

Conversation

@matthunz
Copy link
Copy Markdown

@matthunz matthunz commented Apr 8, 2026

Adds a new Foundations.Automata.Machine module following Minimal realization of machines in closed categories.

This new Machine category can act as a building block for automata in category theory (like digital circuits) by providing the foundational instances of a MonoidalClosed SymmetricCategory.

/-- Category of machines with objects as types and morphisms as stream functions. -/
def Machine := Type u

/-- Homomorphism as a stream function. -/
def Hom (X Y : Machine.{u}) := Stream' X → Stream' Y

@chenson2018 chenson2018 self-assigned this Apr 8, 2026
Copy link
Copy Markdown
Collaborator

@ctchou ctchou left a comment

Choose a reason for hiding this comment

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

I don't know anything about monoidal category. But I noticed that this PR adds code to the namespace Cslib.Automata, which is currently used by (traditional) automata theory. I'm just wondering whether this new code would cause confusion.

@matthunz
Copy link
Copy Markdown
Author

matthunz commented Apr 9, 2026

That makes sense 👍 I was trying to match what I saw here like CsLib.Logic being used in CsLib/Foundations/Logic and CsLib/Logics but I definitely wouldn't be opposed to moving things around, maybe it'd be better under something like CsLib.CategoryTheory.Automata so everything related to category theory is in one spot?

@chenson2018
Copy link
Copy Markdown
Collaborator

Maybe we'd try to make it match #391 and be in a subdirectory in Automata? I'd wait to move things around until after the PR is initially reviewed.

@ctchou
Copy link
Copy Markdown
Collaborator

ctchou commented Apr 9, 2026

BTW, I noticed that mathlib's Stream' is used in this PR. Although mathlib's Stream' looks like infinite sequences, it is actually not intended as infinite sequences; see this very long discussion:
#mathlib4 > Why is Stream' called Stream'?
If you really want infinite sequences, you should use cslib's ωSequence in Cslib/Foundations/Data/OmegaSequence.

@matthunz
Copy link
Copy Markdown
Author

Huh alright I read through some of that discussion and I still don't totally understand the difference but I'll defer to your thinking.

Changed in 3c90e9f (which helped me catch that I actually had this under CsLib instead of Cslib 😅)

@ctchou
Copy link
Copy Markdown
Collaborator

ctchou commented Apr 10, 2026

I think the upshot is that if all you want is infinite sequences in the naive sense (namely, basically Nat → T for some type T), you should use ωSequence, which now also has more API than Stream'.

@matthunz
Copy link
Copy Markdown
Author

Oh good to know 👍I didn't notice the extra API in ωSequence which I definitely think I can make use of in some other stuff

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