CS383 Programming Languages Quiz 2. 1. Which one of the following is NOT a part of doing an inductive proof? a.Clearly state the induction hypothesis.

Slides:



Advertisements
Similar presentations
Types and Programming Languages Lecture 4 Simon Gay Department of Computing Science University of Glasgow 2006/07.
Advertisements

Substitution & Evaluation Order cos 441 David Walker.
First-Order Logic (and beyond)
The lambda calculus David Walker CS 441. the (untyped) lambda calculus a language of functions e ::= x | \x.e | e1 e2 v ::= \x.e there are several different.
The lambda calculus David Walker CS 441. the lambda calculus Originally, the lambda calculus was developed as a logic by Alonzo Church in 1932 –Church.
Elements of Lambda Calculus Functional Programming Academic Year Alessandro Cimatti
Formal Semantics of Programming Languages 虞慧群 Topic 5: Axiomatic Semantics.
Example 1 Solve ax b c for x. Then use the solution to solve Solve a literal equation + = += 2x SOLUTION STEP 1 Solve ax b c for x. += ax b c Write.
CS 355 – Programming Languages
School of Computing and Mathematics, University of Huddersfield CAS810: WEEK 3 LECTURE: LAMBDA CALCULUS PRACTICAL/TUTORIAL: (i) Do exercises given out.
Sets Definition of a Set: NAME = {list of elements or description of elements} i.e. B = {1,2,3} or C = {x  Z + | -4 < x < 4} Axiom of Extension: A set.
מבנה המחשב + מבוא למחשבים ספרתיים תרגול 1#
The lambda calculus David Walker CS 441. the lambda calculus Originally, the lambda calculus was developed as a logic by Alonzo Church in 1932 –Church.
Comp 205: Comparative Programming Languages Semantics of Functional Languages Term- and Graph-Rewriting The λ-calculus Lecture notes, exercises, etc.,
Tim Sheard Oregon Graduate Institute Lecture 11: A Reduction Semantics for MetaML CS510 Section FSC Winter 2005 Winter 2005.
CSE 20 DISCRETE MATH Prof. Shachar Lovett Clicker frequency: CA.
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
Concept.
1.1 Lesson – Evaluating Algebraic Expressions
1 440 Midterm 2012 fall. Given the following two classes: public class A { void doSomething () { System.out.println("A"); } public class B extends A{
Lambda Calculus And its graphic representation. Brief Explanation of LC  What:  A series of expressions, constants, and variables written in prefix.
Functional Languages. Why? Referential Transparency Functions as first class objects Higher level of abstraction Potential for parallel execution.
1 Homework #7 (Models of Computation, Spring, 2001) Due: Section 1; April 16 (Monday) Section 2; April 17 (Tuesday) 2. Covert the following context-free.
Lambda Calculus1 The Untyped Lambda-Calculus Hossein Hojjat University of Tehran Formal Methods Laboratory.
CS 363 Comparative Programming Languages Semantics.
9.4 Mathematical Induction
Type Safety Kangwon National University 임현승 Programming Languages.
Introduction to Data Structures and Algorithms CS 110: Data Structures and Algorithms First Semester,
Splash Screen. Lesson Menu Five-Minute Check (over Lesson 8–3) Then/Now New Vocabulary Example 1: Solve a Logarithmic Equation Key Concept: Property of.
CS 611: Lecture 6 Rule Induction September 8, 1999 Cornell University Computer Science Department Andrew Myers.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
© Kenneth C. Louden, Chapter 11 - Functional Programming, Part III: Theory Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
Chapter 3 Part II Describing Syntax and Semantics.
Types and Programming Languages Lecture 6 Simon Gay Department of Computing Science University of Glasgow 2006/07.
1 Formal Semantics. 2 Why formalize? ML is tricky, particularly in corner cases generalizable type variables? polymorphic references? exceptions? Some.
Principles of programming languages 9: Lambda calculus Isao Sasano Department of Information Science and Engineering.
Types and Programming Languages Lecture 12 Simon Gay Department of Computing Science University of Glasgow 2006/07.
Lesson2 Lambda Calculus Basics 1/10/02 Chapter 5.1, 5.2.
Concept. Example 1 Use Corresponding Angles Postulate A. In the figure, m  11 = 51. Find m  15. Tell which postulates (or theorems) you used. Answer:
Lambda Calculus CSE 340 – Principles of Programming Languages Fall 2015 Adam Doupé Arizona State University
Λ-Calculus & Intuitionistic Logic Project Aims Cartesian Closed Categories Correspondence between CCC & λ unit, →, × 1© CHUANGJIE XU 2010.
1/32 This Lecture Substitution model An example using the substitution model Designing recursive procedures Designing iterative procedures Proving that.
CMSC 330: Organization of Programming Languages Operational Semantics a.k.a. “WTF is Project 4, Part 3?”
Multiplying Powers Dividing Powers Zero ExponentsNegative.
1 Section 6.2 Propositional Calculus Propositional calculus is the language of propositions (statements that are true or false). We represent propositions.
CMSC 330: Organization of Programming Languages Operational Semantics.
Type soundness In a more formal way. Proving Soundness of Type Systems Goal of a sound type system: –if the program type checks, then it never “crashes”
2/26/ : Using Proof in Algebra1 Expectation: L3.3.1: Know the basic structure for a proof of an “if, then” statement.
Arvind Computer Science and Artificial Intelligence Laboratory M.I.T. L04Ext-1 September 21, 2006http:// Some more thoughts.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Bell Quiz. Objectives Simplify and evaluate expressions containing variables.
CSE-321 Programming Languages Abstract Machine E POSTECH May 1, 2006 박성우.
Seminář 51 Seminář 5. seminář 52 The system λμ It is the system of recursive types. The recursive types come together with an equivalence relation. The.
 To find the numerical value of the expression, simply substitute the variables in the expression with the given number. Evaluate: 2x + 7, if x = 4 Substitute.
Comp 205: Comparative Programming Languages The Untyped λ-calculus representing values Lecture notes, exercises, etc., can be found at:
Algebra 2cc Section 2.10 Identify and evaluate polynomials A polynomial function is an expression in the form: f(x) = ax n + bx n-1 + cx n-2 + … dx + e.
SAT/ACT MATH UNIT 10 Equation with More Than One Variable.
11.7 – Proof by Mathematical Induction
CS 550 Programming Languages Jeremy Johnson
Two-Column Proofs Given: 2x - 3 = 23 Prove: x = 116 Statements
September 4, 1997 Programming Languages (CS 550) Lecture 6 Summary Operational Semantics of Scheme using Substitution Jeremy R. Johnson TexPoint fonts.
Proving Properties of Recursive List Functions
Programming Misconceptions
Typed Arithmetic Expressions
Lesson2 Lambda Calculus Basics
Function notation & evaluating functions
Computer Security: Art and Science, 2nd Edition
Evaluating Expressions
Key Answers for Homework #7
Language semantics Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Presentation transcript:

CS383 Programming Languages Quiz 2

1. Which one of the following is NOT a part of doing an inductive proof? a.Clearly state the induction hypothesis. b.Make a proper inductive definition. c.Clearly state what you are doing induction on. d.Show one case for each rule in the inductive definition.

2. If the structure of your induction hypothesis is “If X and Y then A”, which of the following things is proper for you to assume and prove? a.Assume X or Y, prove A b.Assume X and Y, prove A c.Assume X prove A, or Assume Y prove A d.Assume X prove A, and Assume Y prove A

3. If the structure of your induction hypothesis is “If X or Y then A”, which of the following things is proper for you to assume and prove? a.Assume X or Y, prove A b.Assume X and Y, prove A c.Assume X prove A, or Assume Y prove A d.Assume X prove A, and Assume Y prove A

4. Which one of the following is not essential in lambda calculus? a.Variable: x b.Conditional: if e1 then e2 else e3 c.Abstraction: λ x. E d.Abstraction: λ x. e

5. Which one of the following is incorrect about the semantics of if- then-else? a. a b. c. d.

6. Which one of the following statements is incorrect? a.a name and the object it denote are not the same thing. b.an object can have only one name. c.a name can denote different objects at different times. d.binding is an association between a name and the object it represents.

7. Which one of the following is different from the other three after evaluation? a. λx. x x b. (λx. x x) (λy. y y) c. (λy. λx. y x) (λx. x x) (λy. y y) d. (λx. (λx. x x) x) (λx. x x)

8. What are the free variables in the following lambda expression? x (λy · y z x) (λm · λn · l m n) a.x, z, l b.x, y, z, l, m, n c.x, z, n d.y, l, m

9. For the following substitutions, which is incorrect? a. x[x/y] = y b. λ x · z w[x/y] = λy · z w c. (λx · (z x))[x/y] = (λu · (z u)) d. x z w[x/y] = y z w

10. What’s the result of the following lambda expression, under full beta- reduction? (λx · x)((λx · x)(λz · (λx · x)z)) a. λ z · z b. x c. z d. λ z · λz · z z