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

Why are regular languages closed under intersection and complementation?

+3
−0

In Worrell's lecture notes 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.)

History

0 comment threads

1 answer

+3
−0

The key fact here is that regular languages are exactly the languages which can be decided by a computer with constant memory. This is basically the definition of a finite state automaton.

From here it is easy to see these facts. You've already observed this for union, but complementation and intersection are not difficult.

  • Complement: A computer can recognize a regular language with constant memory, and it can negate its output with constant memory.
  • Intersection: If two languages can be recognized with constant memory we can run both those programs (in parallel or serially) and take the logical and of the results. This takes at most constant+constant=constant memory.
History

0 comment threads

Sign up to answer this question »