CS154 Formal Languages and Computability

CS154
Formal Languages
and
Computability
Thaddeus Aid
Department of Computer Science
San Jose State University
Spring 2016
Creative Commons Attribution-ShareAlike 4.0 International License
1
Apple and the FBI
• The Fourth Amendment of the U.S. Constitution provides, "[t]he right
of the people to be secure in their persons, houses, papers, and
effects, against unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon probable cause,
supported by Oath or affirmation, and particularly describing the
place to be searched, and the persons or things to be seized.“
• San Bernardino Shooting - December 2, 2015, 14 people were killed
and 22 were seriously injured.
• The FBI recovered an encrypted cell phone belonging to the shooter.
Creative Commons Attribution-ShareAlike 4.0 International
License
2
Apple and the FBI (cont.)
• The FBI has a valid reason for wanting to get into the phone.
• Owned by a domestic terrorist and could contain information to stop future
shootings.
• The FBI does not have the technical capability to hack the phone.
• Well known bias against counter culture hackers and “criminals”
• Apple made the phone
• Apple has spent years improving the security on the iPhone in order to
protect users, businesses, and the government.
• The FBI wants Apple to create a backdoor into the iPhone.
Creative Commons Attribution-ShareAlike 4.0 International
License
3
Apple and the FBI (cont)
• A Judge has issued a warrant to tell Apple to cooperate.
• What does that mean?
• Apple is being forced to create a tool that will break their own
encryption.
•
•
•
•
This will be a “master key”, you have to defeat the algorithm.
Once it is invented it cannot be uninvented.
Hackers are really good at getting things they want.
It will be a matter of time before the master key is released into the wild.
Creative Commons Attribution-ShareAlike 4.0 International
License
4
Apple and the FBI
• Apple is refusing.
• CEO is willing to take it to the Supreme Court
• What does this mean for the rest of us.
• Security vs Privacy?
• Ecommerce?
Creative Commons Attribution-ShareAlike 4.0 International
License
5
Citation
• Lecture developed in conjunction with:
• Introduction to Theory of Computation
• Anil Maheshwari
• Michiel Smid
• http://cglab.ca/~michiel/TheoryOfComputation/TheoryOfComputation.pdf
Creative Commons Attribution-ShareAlike 4.0 International
License
6
Finite Automata - Review
• DFA – 5-tuple
Creative Commons Attribution-ShareAlike 4.0 International
License
7
Finite Automata - Review
• Non-deterministic Finite Automata
• Adds ε-transitions to the DFA in order to get different results from the same
input.
• For any NFA there exists a more complicated DFA.
Creative Commons Attribution-ShareAlike 4.0 International
License
8
Closure
• Closure is a concept that often comes up when discussion sets of
things.
•
•
•
•
Closure is the idea that you can take some member of a set
Change it by doing [some operation] to it
Because the set is closed under [some operation]
The new thing must still be in the set.
• Source: http://cseweb.ucsd.edu/~clbailey/ClosureOverview.htm
Creative Commons Attribution-ShareAlike 4.0 International
License
9
Closure Example
• The set “Candy”
• The set Candy contains all individual pieces of candy.
• If you take a piece of candy, and drop it on the ground, is it still candy?
• According to the 5-second rule, I would still eat it, so it's still candy.
• That means that our set Candy is closed under the operation "drop.“
• What if I take two pieces of candy, x and y, and stick them together?
•
•
•
•
stick(x,y)--to make a new piece of candy.
Since what comes out of stick(x.y) is a piece of candy,
Candy is closed under stick.
Note: it only works if both operands are candy.
• Source: http://cseweb.ucsd.edu/~clbailey/ClosureOverview.htm
Creative Commons Attribution-ShareAlike 4.0 International
License
10
Closure Example (Cont.)
• I take a piece of candy, x, and feed it to a bird.
• Then later, after digesting the candy, the bird leaves some droppings on my
car
• Assume the droppings came from the candy, and we'll call this bird(x)
• Is bird(x) candy?
• No way.
• So Candy is not closed under bird.
• Source: http://cseweb.ucsd.edu/~clbailey/ClosureOverview.htm
Creative Commons Attribution-ShareAlike 4.0 International
License
11
Closure Example (Final)
• An important part of closure is that when we say that the set is
"closed under" an operation.
• It has to be true for everything in the set.
• So even if all kinds of candies--except for one--were still candy after the bird()
operation.
• Candy would still not be closed under bird().
• Source: http://cseweb.ucsd.edu/~clbailey/ClosureOverview.htm
Creative Commons Attribution-ShareAlike 4.0 International
License
12
Closed Operators
• Union – Or - ∪
• Concatenate - Join - ∙
• Star – Supersets – A*
• Intersection – And - ∩
• Complement – Not - 𝐴
Creative Commons Attribution-ShareAlike 4.0 International
License
13
Regular Expressions - Review
• * - 0 or more of the preceding symbol
• 1* - 0 or more “1”s
• 0* - 0 or more “0”s
• 11* - 1 or more “1”s
• (0∪1) – The symbol can be either 0 or 1
• (0∪1)1 – Matches “01” and “11”
Creative Commons Attribution-ShareAlike 4.0 International
License
14
Regular Expressions – Review (Cont)
Creative Commons Attribution-ShareAlike 4.0 International
License
15
Languages - Review
Creative Commons Attribution-ShareAlike 4.0 International
License
16
Regular Expression Identities
Creative Commons Attribution-ShareAlike 4.0 International
License
17
Regular Expression Identities
Creative Commons Attribution-ShareAlike 4.0 International
License
18
The Equivalence of Regular Expressions and
Languages
• Let L be a language.
• Then L is regular
• if and only if
• there exists a regular expression that describes L.
Creative Commons Attribution-ShareAlike 4.0 International
License
19
Converting a DFA to a Regular Expression
• To the board!
Creative Commons Attribution-ShareAlike 4.0 International
License
20