info-231: introduction to mathematical foundations of security

Post on 14-Feb-2017

218 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

INFO-231:IntroductiontoMathematicalFoundationsof

SecurityYanHuang

yh33@indiana.edu

YanHuang

ResearchInterests:SecurityAlgorithmsFunctionalProgrammingSystemsCryptography

Iamlookingformotivated undergraduateresearchers.

CourseAdministrivia

• Website:http://homes.soic.indiana.edu/yh33/Teaching/I231-2016/syllabus.html

• TA:Ruiyu Zhu(zhu52@indiana.edu)

OfficeHours:Tuesday1-2.GA1stfloorLobby

• Textbooks:(bothfromCambridgeUniversityPress)-[required]ProgramminginHaskell,GrahamHutton-[required]ACryptographyPrimer:SecretsandPromises,PhilipKlein-[recommended]AnIntroductiontoMathematicalCryptography,J.Hoffstein,J.Pipher,J.H.Silverman

Goalsofthiscourse

• Stimulateyourinterestsin-Mathematics-Computerprogramming

• SomeusefulMathideas-Prepareforlatercourses-Benefityourfuturecareer

Componentsofthiscourse

Haskellprogramming Algebra Probability

ComputationalComplexity Applications

Grades

Homework 40%Quiz 20%Final 40%

ü Everyhomeworkassignmentcounts.ü Nolatehomeworkwillbeaccepted.ü Finalgradesarecurvedattheendofthesemester.

HomeworkPolicy

• Youcandiscusstheproblemswithotherstudentsintheclass,buteveryoneshouldtypeuptheanswersindependently.•Onyoursubmittedpaper-Creditwhoyouhaveobtainedhelpfrom-Writedownwhoyouhaveofferedhelpto

•Plagiarism willalwaysbereportedandcauseafailureofthiscourse.

Morepolicies

• Quizzes- Closedbook,Closednotes- Canhappenduringanylecture- Zeropointonquizzesinlecturesofyourabsence- Threeworstscoresautomaticallydropped(e.g.,duetomissingattendance)- Classattendanceisrequiredunlessyoudemonstratetomethatyoumasteredthelecturecontentsinadvance.Mustobtainpermissiontoskiplectures.

• Final- Openbook,takehome- Nocollaboration- Musttypeupandsubmitelectronically

HowtogetanA+?

• Factorizethefollowingnumber18972103309983185422070079784284135489247092848422646286183818473249588683594416952182594240975017401464914844829644057472091352613798743747335777323090555389223730308478401116881894745108157937909744782288166743288290437938219276578533448462609296449172456761389565857363582344032070416444543015461461122896482189610796592683838338989940716029100970716520372844169319105436448070434656299302954568678624394202272254732416359831107671563742819816642703632813340191086021800655300132599105525940099006490449928844475189704589770072655514199831106264576993649173200857755181189779752280025089963275809434722408052661993

• Finishyourassignmentsreasonablywellanddemonstrateyourabilityofproactivelearning- Studyrelevantmaterialsnotcovered/requiredinclass- Implementchallengingstuff- Solveoptionalproblems Dotalktomeinadvanceto

settledownyourspecificplans

EnvironmentSetup

Bringyourlaptoptoclass-Quizzes- Tryoutideasonthefly.

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.

Madoko

• Italic*important* =>important

• Boldface**important** =>important

• Inlinemath$ f(x) = x^2 + 1 $

•Displayedmath~ Equation { #eqn-label }W = F \cdot s~

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 }

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

~~~

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

Madoko

• Embeddingprogramcode

``` haskellmain = print “Hello World!”```

WhyHaskell?

•Presentmathideas-Precise-Succinct-Easytoexperiment

•Abonusskilltoyouradventurousfuture§Functionalprogramming:thebasicmethodofcomputationis applicationoffunctionstoarguments

WhyHaskell?Alanguagethatdoesn'taffectthewayyouthinkaboutprogrammingisnotworthknowing.

Agoodprogramminglanguageisaconceptualuniverseforthinkingaboutprogramming.

-- AlanPerlisProfessorofYale

ThefirstTuringAwardLaureate

HistoricalBackground

1930s:

AlonzoChurchdevelopsthelambdacalculus,asimplebutpowerfultheoryoffunctions.

HistoricalBackground

1950s:

JohnMcCarthydevelopsLisp,thefirstfunctionallanguage,withsomeinfluencesfromthelambdacalculus,butretainingvariableassignments.

HistoricalBackground

1970s:

JohnBackusdevelopsFP,afunctionallanguagethatemphasizeshigher-orderfunctions andreasoningaboutprograms.

HistoricalBackground

1970s:

RobinMilnerandothersdevelopML,thefirstmodernfunctionallanguage,whichintroducedtypeinference andpolymorphictypes.

HistoricalBackground

1987:

AninternationalcommitteeofresearchersinitiatesthedevelopmentofHaskell,astandardlazyfunctionallanguage.

HistoricalBackground

1990s:

PhilWadler andothersdeveloptypeclasses andmonads,twoofthemaininnovationsofHaskell.

HistoricalBackground

2003:

ThecommitteepublishestheHaskellReport,definingastableversionofthelanguage;anupdatedversionwaspublishedin2010.

HistoricalBackground

2010-date:

Standarddistribution,librarysupport,newlanguagefeatures,developmenttools,useinindustry,influenceonotherlanguages,etc.

ExamplePracticalUses

• Haxl — Facebook'santi-spamprogram• Cryptol — Alanguageandtoolchainfordevelopingandverifyingcryptographyalgorithms• seL4 — Thefirstformallyverifiedmicrokernel…

ExampleHaskellCode

• Summingtheintegers1to10inJava:

• InHaskell,thisissimplyaone-liner

int total = 0;for (int i = 1; i <= 10; i++)total = total + i;

sum [1..10]

Themethodofcomputationis variableassignment.

InstallingHaskell

GLASGOWHASKELLCOMPILER(GHC)• Freelyavailable

https://www.haskell.org/platform/• AleadingimplementationofHaskellcomprisingacompilerghc andaninterpreter ghci• Theinteractivenatureoftheinterpretermakesitwell-suitedforteachingandprototyping

StartingGHCi

“Prelude λ:” promptsforHaskellexpressionstoevaluate.

$ ghci

GHCi, version X: http://www.haskell.org/ghc/ :? for help

Prelude λ:

GHCi asadesktopcalculator

Prelude λ: 2+3*4

14

Prelude λ: (4+1)*5

25

Prelude λ: 3^2

9

Prelude λ: sqrt (3^2 + 4^2)

5.0

TheStandardPrelude

Haskellcomeswithalargenumberofstandardlibraryfunctions.E.g.,thelibraryalsoprovidesmanyusefulfunctionsonlists.

z Selectthefirstelementofalist:

Prelude λ: head [1,2,3,4,5]1

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]

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

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]

FunctionApplication

Inmathematics,functionapplicationisdenotedusingparentheses,andmultiplicationisoftendenotedusingjuxtapositionorspace.

f(a,b) + c d

Applythefunctionf toa andb,andaddtheresulttotheproductofc andd.

InHaskell,functionapplicationisdenotedusingspace,andmultiplicationisdenotedusing*.

f a b + c*d

Aspreviously,butinHaskellsyntax.

Moreover,functionapplicationisassumedtohavehigherpriority thanallotheroperators.

f a + b

Means(f a) + b,ratherthanf (a + b).

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)

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

Charge

• Haskell- InstallHaskellPlatformonyourcomputer.- TryouttheGHCi evaluationscoveredinthislecture.

• Madoko- ReadthroughMadoko’s referencemanual- TryoutMadoko tricksasyoureadthemanual.

• Homework0announced- Startearly!- SubmitthroughCanvas

top related