Welcome and Course Overview
Puzzle
Suppose that you want to run some JavaScript programs—all the cool kids are doing it. However, you are deathy afraid that your mom/significant other/boss will see the curse word “BaNaNa” appear on you screen as the result of running the program. What do you do?
Safe?
- Don’t run any programs. SAFE but USELESS.
- Write a JavaScript interpreter that checks for “BaNaNa” before printing. SAFE but SLOW.
interpreter : Program x Data -> Data
Verifier
- Write a verifier to make sure “BaNaNa” cannot printed and then run a fast interpreter if it passes the verifier.
verifier : Program -> Boolean
How do I write this verifier?
- Always return false. SAFE but USELESS.
- Fail if console.log appears (assuming all code). SAFE? No.
- Fail if console.log(“BaNaNa”) appears. Definitely UNSAFE.
Soundness
Is our verifier sound?
Soundness is a property of a verifier that says if the program is safe, then the program is guaranteed to be safe. In this case, we want to guarantee that the program does not print “BaNaNa”.
Examples
var s = "BaNaNa"
console.log(s)var f = console.log
f("BaNaNa")var s = "B" + "a" + + "a" + "a"
console.log(s)Course Oath
“I promise to support the learning of my fellow classmates, to not make any question feel unwelcome, to recognize our differing backgrounds, to the best of my ability.”