This is a huge topic - one of the major subfields of theoretical computer science : Formal Langauges and the Theory of Computation

What is a "formal language"?

- a math definition of what an "algorithm" means
- and what sort of abstract can do different sorts of problems
- and how fast ; its O()

The big ideas are :

Formal expression of the notion of "algorithm"

- each "problem" is reduced to a "set of strings" questions, defining a "formal language"
- so addition for example is reduced to all strings like "1+2=3"
- ... and a computer program that can "do" addition is one that can say "yes" or "no" to whether or not such a string represents a true arithmetic addition expression.

Formal notion of "machine" (i.e. computer)

- mathy description of what it can do ... to a string of symbols, ending with "yes" or "no"
- simple so that the proofs about it can be manageable

For some categories there is 1-to-1 relationship between classes of languages and machines (the "template" link above)

- and how hard they are to describe
- and what sorts of abstract machines can solve them
- and how fast, i.e. what O() those machines take

A few "machines" :

- finite state machine
- which is powerful enough to handle regular expressions
- my old finite automata simulator

- turing machine
- physical model
- my simulation
- TCP/IP RFC - a finite state machine!

- conway's game of life has the power of a turing machine
- ... which like any turing computer can run itself
- "game of life" youtube explanation

An open question : P vs NP

- P : polynomial time for a turing machine
- NP : nondeterministic polynomial (i.e. polynomial for parallel turing machine, also turns out to be "quickly verifiable")
- Broadly speaking, problems in P are "easy" (i.e. computers can solve big N versions), problems in NP are "hard" (i.e. big N can't be done fast enough).
- NP-complete : it turns out that many problems that seem to be in NP can be turned into each other, so if one can be solved fast, then all of those can.

But note that there are problems provably "harder" than NP ... and even some that no turing machine can solve in bounded finite time

- wikipedia: regular expression
- wikipedia: regular language : set of strings defined by a regular language
- wikipedia: finite automata : abstract machine that can recognize (i.e. compute) a regular language
- regex crossword
- in javascript
- in python

Note that in most programming languages, their library for "regular expressions" includes some syntax that is more powerful than the formal mathy definition of "regular expression". The "grouping" constructs, in particular, are not part of the formal mathy notion of a regular expression, but are often used in practical programming code.

This regex_ab.py is an example of the difference. And here's the finite state machine for the first pattern.

One related deep question is how people fit into all this. In other words is (intelligence, consciousness, sentience) computable? What do those things even mean.

- AGI - artificial general intelligence
- turing test
- "the hard problem" of consciousness
- my marlboro philsophy of mind links

What do you think?

And another related topic is the concept of "information", which has to do with patterns in data, randomness, and compressibility. Yet another course sized topic.

- CS fields of study
- hanoi.py - what complexity class is this in? Does this fit into one of "easy" (P) or "hard" (NP) categories?
- last part of Zelle's chap 13 slides (from Intro CS textbook)
- What is a "regular expression"? A "finite state machine"? How are those connected?
- practice at regexcrosswords.com

- What is a turing machine? Why is it so famous?
- Here is my virtual turing machine (in python).

- What is the halting problem? Does that fit into P or NP?
- What is Gödel's incompleteness theorem? Why is it related?
- Can a computer tell if a file is a well-formed python program?
- (See for example its grammar.)
- It can be defined with a context free grammar .
- ... which it turns out can be done with a kind of computer called a "pushdown automata", type-2
- ... smarter than a finite state machine (type-3) not as smart as a turing machine (type-0)

- How do the (sorting, graph, search) algorithms we've been discussing fit into this framework?
- Can a computer be a person? What are your reasons for arguing "yes" or "no"?
- And are we "meat machines", software minds running in hardware brains?
- See for example Scott Aaron's discussion .

(Are we having fun yet?)

https://cs.bennington.college /courses /spring2022 /algorithms /notes /complexity

last modified Mon May 9 2022 1:21 pm

last modified Mon May 9 2022 1:21 pm