Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

#2: Post edited by user avatar clemens‭ · 2026-02-20T22:11:11Z (7 months ago)
Added information about why the question as stated in the title is the same as the question as stated in the text
  • In [Worrell's lecture notes](https://www.cs.ox.ac.uk/people/james.worrell/lecture09.pdf) I happened to find a very interesting remark:
  • > Recall that a regular language is a language accepted by a nondeterministic finite automaton (NFA). _Recall also that the class of regular languages is closed under intersection and complementation._ (emphasis mine)
  • This fact hardly seems trivial---in fact, it came as a surprise to me since the "regexes" in computer programming (with which I'm more familiar) often don't permit the use of intersection and complementation operators.
  • (Note that, as any user of "regexes" knows, unions/disjunctions of regular languages are regular (this is basically because we're working with *nondeterministic* finite automata, hence they can "try out" all alternatives in a union/disjunction at once). So really all that's needed to answer this question is to show how complements of regular languages are regular, since intersections can be built out of unions and complements by de Morgan's laws.)
  • Thus, to restate my question: why, precisely, is it true that the complement of a regular language is itself a regular language?
  • In [Worrell's lecture notes](https://www.cs.ox.ac.uk/people/james.worrell/lecture09.pdf) I happened to find a very interesting remark:
  • > Recall that a regular language is a language accepted by a nondeterministic finite automaton (NFA). _Recall also that the class of regular languages is closed under intersection and complementation._ (emphasis mine)
  • This fact hardly seems trivial---in fact, it came as a surprise to me since the "regexes" in computer programming (with which I'm more familiar) often don't permit the use of intersection and complementation operators.
  • (Note that, as any user of "regexes" knows, unions/disjunctions of regular languages are regular (this is basically because we're working with *nondeterministic* finite automata, hence they can "try out" all alternatives in a union/disjunction at once). So really all that's needed to answer this question is to show how complements of regular languages are regular, since intersections can be built out of unions and complements by de Morgan's laws.)
  • ---
  • Thus, to restate my question: _why, precisely, is it true that the complement of a regular language is itself a regular language?_
  • (Again, intersections can be made out of unions and complements, so as long as the question about complements is answered, the result about intersections follows automatically.)
#1: Initial revision by user avatar clemens‭ · 2026-02-20T22:08:31Z (7 months ago)
Why are regular languages closed under intersection and complementation?
In [Worrell's lecture notes](https://www.cs.ox.ac.uk/people/james.worrell/lecture09.pdf) I happened to find a very interesting remark:

 > Recall that a regular language is a language accepted by a nondeterministic finite automaton (NFA). _Recall also that the class of regular languages is closed under intersection and complementation._ (emphasis mine)

This fact hardly seems trivial---in fact, it came as a surprise to me since the "regexes" in computer programming (with which I'm more familiar) often don't permit the use of intersection and complementation operators.

(Note that, as any user of "regexes" knows, unions/disjunctions of regular languages are regular (this is basically because we're working with *nondeterministic* finite automata, hence they can "try out" all alternatives in a union/disjunction at once). So really all that's needed to answer this question is to show how complements of regular languages are regular, since intersections can be built out of unions and complements by de Morgan's laws.) 

Thus, to restate my question: why, precisely, is it true that the complement of a regular language is itself a regular language?