INFO-231: Introduction to Mathematical Foundations of Security
Transcript of INFO-231: Introduction to Mathematical Foundations of Security
![Page 2: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/2.jpg)
YanHuang
ResearchInterests:SecurityAlgorithmsFunctionalProgrammingSystemsCryptography
Iamlookingformotivated undergraduateresearchers.
![Page 3: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/3.jpg)
CourseAdministrivia
• Website:http://homes.soic.indiana.edu/yh33/Teaching/I231-2016/syllabus.html
• TA:Ruiyu Zhu([email protected])
OfficeHours:Tuesday1-2.GA1stfloorLobby
![Page 4: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/4.jpg)
• Textbooks:(bothfromCambridgeUniversityPress)-[required]ProgramminginHaskell,GrahamHutton-[required]ACryptographyPrimer:SecretsandPromises,PhilipKlein-[recommended]AnIntroductiontoMathematicalCryptography,J.Hoffstein,J.Pipher,J.H.Silverman
![Page 5: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/5.jpg)
Goalsofthiscourse
• Stimulateyourinterestsin-Mathematics-Computerprogramming
• SomeusefulMathideas-Prepareforlatercourses-Benefityourfuturecareer
![Page 6: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/6.jpg)
Componentsofthiscourse
Haskellprogramming Algebra Probability
ComputationalComplexity Applications
![Page 7: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/7.jpg)
Grades
Homework 40%Quiz 20%Final 40%
ü Everyhomeworkassignmentcounts.ü Nolatehomeworkwillbeaccepted.ü Finalgradesarecurvedattheendofthesemester.
![Page 8: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/8.jpg)
HomeworkPolicy
• Youcandiscusstheproblemswithotherstudentsintheclass,buteveryoneshouldtypeuptheanswersindependently.•Onyoursubmittedpaper-Creditwhoyouhaveobtainedhelpfrom-Writedownwhoyouhaveofferedhelpto
•Plagiarism willalwaysbereportedandcauseafailureofthiscourse.
![Page 9: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/9.jpg)
Morepolicies
• Quizzes- Closedbook,Closednotes- Canhappenduringanylecture- Zeropointonquizzesinlecturesofyourabsence- Threeworstscoresautomaticallydropped(e.g.,duetomissingattendance)- Classattendanceisrequiredunlessyoudemonstratetomethatyoumasteredthelecturecontentsinadvance.Mustobtainpermissiontoskiplectures.
• Final- Openbook,takehome- Nocollaboration- Musttypeupandsubmitelectronically
![Page 10: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/10.jpg)
HowtogetanA+?
• Factorizethefollowingnumber18972103309983185422070079784284135489247092848422646286183818473249588683594416952182594240975017401464914844829644057472091352613798743747335777323090555389223730308478401116881894745108157937909744782288166743288290437938219276578533448462609296449172456761389565857363582344032070416444543015461461122896482189610796592683838338989940716029100970716520372844169319105436448070434656299302954568678624394202272254732416359831107671563742819816642703632813340191086021800655300132599105525940099006490449928844475189704589770072655514199831106264576993649173200857755181189779752280025089963275809434722408052661993
• Finishyourassignmentsreasonablywellanddemonstrateyourabilityofproactivelearning- Studyrelevantmaterialsnotcovered/requiredinclass- Implementchallengingstuff- Solveoptionalproblems Dotalktomeinadvanceto
settledownyourspecificplans
![Page 11: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/11.jpg)
EnvironmentSetup
![Page 12: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/12.jpg)
Bringyourlaptoptoclass-Quizzes- Tryoutideasonthefly.
![Page 13: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/13.jpg)
Madoko• https://www.madoko.net/- ConnectswellwithDropbox,Github,Onedrive etc.
• Detailedreferencemanual:http://research.microsoft.com/en-us/um/people/daan/madoko/doc/reference.html
• YouarerequiredtotypeupyourassignmentsusingeitherMadoko orLaTeX.
Daan Leijen,creatorofMadoko.
![Page 14: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/14.jpg)
Madoko
• Italic*important* =>important
• Boldface**important** =>important
• Inlinemath$ f(x) = x^2 + 1 $
•Displayedmath~ Equation { #eqn-label }W = F \cdot s~
![Page 15: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/15.jpg)
Madoko
• Superscripts(^)andSubscripts(~)- E.g.,Black_pit_, Ball~sky~
• Strikeout(~~,twotildes)- E.g.,There is a ~~strike out~~ here.
• Links- E.g.,[Google](http://www.google.com).
• Images![bfly][bfly]: images/butterfly-200.png "A Monarch" { width: 100px }
![Page 16: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/16.jpg)
Madoko Blocks
• Equivalently~ Begin Equation
W = F \cdot s~
•BlockforDisplayedmath~ Equation W = F \cdot s~
• Nestedblocks~ EquationF=ma
~~ EquationAn nested equation distinguished by double tildes
~~~
![Page 17: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/17.jpg)
Madoko 1𝑛
\frac{1}{n}
𝑥$ x_1
Lim \lim
mod \mod
→ \rightarrow
∞ \infty
• $...$markstheregionwhere
LaTeXmath-mode applies
• LaTeX symbollookup:
http://detexify.kirelabs.org/cl
assify.html
![Page 18: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/18.jpg)
Madoko
• Embeddingprogramcode
``` haskellmain = print “Hello World!”```
![Page 19: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/19.jpg)
WhyHaskell?
•Presentmathideas-Precise-Succinct-Easytoexperiment
•Abonusskilltoyouradventurousfuture§Functionalprogramming:thebasicmethodofcomputationis applicationoffunctionstoarguments
![Page 20: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/20.jpg)
WhyHaskell?Alanguagethatdoesn'taffectthewayyouthinkaboutprogrammingisnotworthknowing.
Agoodprogramminglanguageisaconceptualuniverseforthinkingaboutprogramming.
-- AlanPerlisProfessorofYale
ThefirstTuringAwardLaureate
![Page 21: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/21.jpg)
HistoricalBackground
1930s:
AlonzoChurchdevelopsthelambdacalculus,asimplebutpowerfultheoryoffunctions.
![Page 22: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/22.jpg)
HistoricalBackground
1950s:
JohnMcCarthydevelopsLisp,thefirstfunctionallanguage,withsomeinfluencesfromthelambdacalculus,butretainingvariableassignments.
![Page 23: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/23.jpg)
HistoricalBackground
1970s:
JohnBackusdevelopsFP,afunctionallanguagethatemphasizeshigher-orderfunctions andreasoningaboutprograms.
![Page 24: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/24.jpg)
HistoricalBackground
1970s:
RobinMilnerandothersdevelopML,thefirstmodernfunctionallanguage,whichintroducedtypeinference andpolymorphictypes.
![Page 25: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/25.jpg)
HistoricalBackground
1987:
AninternationalcommitteeofresearchersinitiatesthedevelopmentofHaskell,astandardlazyfunctionallanguage.
![Page 26: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/26.jpg)
HistoricalBackground
1990s:
PhilWadler andothersdeveloptypeclasses andmonads,twoofthemaininnovationsofHaskell.
![Page 27: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/27.jpg)
HistoricalBackground
2003:
ThecommitteepublishestheHaskellReport,definingastableversionofthelanguage;anupdatedversionwaspublishedin2010.
![Page 28: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/28.jpg)
HistoricalBackground
2010-date:
Standarddistribution,librarysupport,newlanguagefeatures,developmenttools,useinindustry,influenceonotherlanguages,etc.
![Page 29: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/29.jpg)
ExamplePracticalUses
• Haxl — Facebook'santi-spamprogram• Cryptol — Alanguageandtoolchainfordevelopingandverifyingcryptographyalgorithms• seL4 — Thefirstformallyverifiedmicrokernel…
![Page 30: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/30.jpg)
ExampleHaskellCode
• Summingtheintegers1to10inJava:
• InHaskell,thisissimplyaone-liner
int total = 0;for (int i = 1; i <= 10; i++)total = total + i;
sum [1..10]
Themethodofcomputationis variableassignment.
![Page 31: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/31.jpg)
InstallingHaskell
GLASGOWHASKELLCOMPILER(GHC)• Freelyavailable
https://www.haskell.org/platform/• AleadingimplementationofHaskellcomprisingacompilerghc andaninterpreter ghci• Theinteractivenatureoftheinterpretermakesitwell-suitedforteachingandprototyping
![Page 32: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/32.jpg)
StartingGHCi
“Prelude λ:” promptsforHaskellexpressionstoevaluate.
$ ghci
GHCi, version X: http://www.haskell.org/ghc/ :? for help
Prelude λ:
![Page 33: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/33.jpg)
GHCi asadesktopcalculator
Prelude λ: 2+3*4
14
Prelude λ: (4+1)*5
25
Prelude λ: 3^2
9
Prelude λ: sqrt (3^2 + 4^2)
5.0
![Page 34: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/34.jpg)
TheStandardPrelude
Haskellcomeswithalargenumberofstandardlibraryfunctions.E.g.,thelibraryalsoprovidesmanyusefulfunctionsonlists.
z Selectthefirstelementofalist:
Prelude λ: head [1,2,3,4,5]1
![Page 35: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/35.jpg)
z Removethefirstelementfromalist:
Prelude λ: tail [1,2,3,4,5][2,3,4,5]
z Selectthenthelementofalist:(listindexstartsfrom0)
Prelude λ: [1,2,3,4,5] !! 23
z Selectthefirstnelementsofalist:
Prelude λ: take 3 [1,2,3,4,5][1,2,3]
![Page 36: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/36.jpg)
z Removethefirstnelementsfromalist:
Prelude λ: drop 3 [1,2,3,4,5][4,5]
z Calculatethelengthofalist:
Prelude λ: length [1,2,3,4,5]5
z Calculatethesumofalistofnumbers:
Prelude λ: sum [1,2,3,4,5]15
![Page 37: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/37.jpg)
z Calculatetheproductofalistofnumbers:
Prelude λ: product [1,2,3,4,5]120
z Appendtwolists:
Prelude λ: [1,2,3] ++ [4,5][1,2,3,4,5]
z Reversealist:
Prelude λ: reverse [1,2,3,4,5][5,4,3,2,1]
![Page 38: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/38.jpg)
FunctionApplication
Inmathematics,functionapplicationisdenotedusingparentheses,andmultiplicationisoftendenotedusingjuxtapositionorspace.
f(a,b) + c d
Applythefunctionf toa andb,andaddtheresulttotheproductofc andd.
![Page 39: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/39.jpg)
InHaskell,functionapplicationisdenotedusingspace,andmultiplicationisdenotedusing*.
f a b + c*d
Aspreviously,butinHaskellsyntax.
![Page 40: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/40.jpg)
Moreover,functionapplicationisassumedtohavehigherpriority thanallotheroperators.
f a + b
Means(f a) + b,ratherthanf (a + b).
![Page 41: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/41.jpg)
ExamplesMathematics Haskell
f(x)
f(x,y)
f(g(x))
f(x,g(y))
f(x)g(y)
f x
f x y
f (g x)
f x (g y)
f x * g y
f(-1) f (-1)
![Page 42: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/42.jpg)
UsefulGHCiCommandsCommand Meaning
:load name load script name:reload reload current script:set editor name set editor to name:edit name edit script name:edit edit current script:type expr show type of expr:? show all commands:quit quit GHCi
![Page 43: INFO-231: Introduction to Mathematical Foundations of Security](https://reader030.fdocuments.us/reader030/viewer/2022020314/58a2fd871a28ab2e3b8c004b/html5/thumbnails/43.jpg)
Charge
• Haskell- InstallHaskellPlatformonyourcomputer.- TryouttheGHCi evaluationscoveredinthislecture.
• Madoko- ReadthroughMadoko’s referencemanual- TryoutMadoko tricksasyoureadthemanual.
• Homework0announced- Startearly!- SubmitthroughCanvas