Higher-Order Logic. Specification and Verification with Higher-Order Logic
|
|
- Arnold Tucker
- 5 years ago
- Views:
Transcription
1 Higher-Order Logic Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern Sommersemester 2008 Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
2 Outline Introduction 1 Introduction 2 Types Motivation Polymorphism Sematics 3 Terms Higher-Order Terms Semantics 4 HOL Proof System Formulas and Sequents Axioms and Rules 5 Summary Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
3 Overview Introduction Overview Higher-Order Logic quantification over predicates, functions and sets supports formalisation of arbitrary mathematics Motivation reasoning about hardware and software can require very sophisticated mathematics floating point: real numbers and analysis correctness of randomised algorithms: probability Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
4 Outline Types 1 Introduction 2 Types Motivation Polymorphism Sematics 3 Terms Higher-Order Terms Semantics 4 HOL Proof System Formulas and Sequents Axioms and Rules 5 Summary Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
5 Problem: Russell s Paradox Types Motivation Russel s Paradox Having variables that range over predicates allows to write terms like where P is a variable. By β -reduction: Ω def = λ P. (P P) Ω Ω = (λ P. (P P)) Ω = (Ω Ω) Conclusion To avoid this kind of thing types are needed! Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
6 Types Types of Types type constant: c type variable: α compound type: (σ 1,...,σ n )op Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
7 Types Type Examples Example (Type Constant) bool: Booleans num: natural numbers weekday: some appropriate user defined type Example (Compound Types) (σ 1,σ 2 )fun: functions from σ 1 to σ 2 (σ 1,σ 2 )prod: pairs of values Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
8 Terminology and Notation Types Definition (Type operator) op in (σ 1,...,σ n )op is called a type constructor Conventions The type (σ 1,σ 2 )fun is usually written σ 1 σ 2 and σ 1 σ 2 σ n = (σ 1 (σ 2 ( σ n ))) The type (σ 1,σ 2 )prod is usually written σ 1 σ 2 or σ 1 σ 2 and σ 1 σ 2 σ n = (σ 1 (σ 2 ( σ n ))) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
9 Typing of Terms Types Typing of Terms All terms must be well-typed. t:σ means the term t is well-typed and has type σ. Variables and Constants Variables may have any type: v:σ Constants have a fixed generic type: c:σ Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
10 Assigning Types to Terms Types Rules for the Assignment function application t 1 :σ 1 σ 2 t 2 :σ 1 (t 1 t 2 ):σ 2 abstraction x:σ 1 t:σ 2 λ x. t:σ 1 σ 2 Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
11 Polymorphism Types Polymorphism Example (Polymorphism) Consider the constant I, defined by: I def = λ x. x We may want to apply the function I to things of different types: I 7 = 7 with I : num num I T = T with I : bool bool It seems that I must have two different types. Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
12 Types Polymorphism and Generic Types Polymorphism Polymorphism The types of polymorphic functions such as I contain type variables: I def = (λ x. x):α α where α stands for any type. α α is the generic type of I. The constant I then has every type obtainable by substituting any type for the variable α in its generic type: I : bool bool I : num num I : (α bool) (α bool) I : α α Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
13 Polymorphism Examples Types Polymorphism Example (Function Composition) o def = λ f.λ g.λ x.f(g(x)) where o : (β γ) (α β) (α γ) Example (Equality) Example (Apply a Function and Add) = : α α bool app_add def = λ f.(λ x.f(x) + f(x)) where app_add : (α num) (α num) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
14 Types Church s Simple Theory of Types Sematics Definition (Universe) each element X U is a non-empty set if X U and Y X, then Y U. if X U and Y U, then X Y U if X U, then powerset (X) = {Y : Y X} U U contains a distinguished infinite set I distinguished element ch Π X U X: ch(x) X witnesses non-emptiness Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
15 Model Types Sematics Definition (Model of Type Structure) given: type structure Ω as set of type constants (ν,n) model: M(ν) : U n U Polymorphic Types types containing type variables: polymorphic meaning of polymorphic types not single set, but set-valued function Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
16 Summary of Types Types Sematics Fact (Types) Types are introduced to avoid inconsistency. Types Type constants: bool, num,... Type variables: α, β, γ,... Compound Types: (σ 1,...,σ n )op e.g. σ 1 σ 2, and σ 1 σ 2. Polymorphism twice def = λ f.λ x.f(f(x)) where twice : (α α) (α α) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
17 Outline Terms 1 Introduction 2 Types Motivation Polymorphism Sematics 3 Terms Higher-Order Terms Semantics 4 HOL Proof System Formulas and Sequents Axioms and Rules 5 Summary Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
18 of Terms Terms of Terms constants: c variables : v function applications: T 1 T 2 lambda abstractions λ v. T Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
19 Constants and Variables Terms Fact (Distinction between Constants and Variables) The distinction between a constant and a variable always depends on the context. Identifiers x, y, foo, t, k 2, c_val,... Special Symbols,,,,,, 1, 2, 3,..., +,, =,... Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
20 Function Applications Terms Notation term 1 term 2 denotes the result of applying the function term 1 to the value term 2. Precedence parentheses can be used for grouping f(x), f (g y), (f x) y,... default precedence f x 1 x 2 x n = (((f x 1 ) x 2 ) x n ) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
21 Abstractions Terms Notation λ var. term denotes the function x term[x/var]. Convention λ x 1 x 2 x n. t = λ x 1. λ x 2. λ x n. t Example (Abstraction) λ x. x: the identity function λ x. f(f x): function that applies f twice λ f.λ g.λ x. f(g x): function composition Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
22 Free and Bound Variables Terms Definition (Free Variable) λ x. body A variable x is called free in a term if it does not occur inside the body of an abstraction. Definition (Bound Variables) If an instance of a variable is not free, it is bound. Example (Free and Bound Variables) Consider variable x: (λ x. f x)(λ y. x) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
23 Syntactic Sugar Terms Infix Aplications Certain constants are written in infix position: t 1 + t 2 abbreviates + t 1 t 2 t 1 t 2 abbreviates t 1 t 2 t 1 t 2 abbreviates t 1 t 2 Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
24 Summary of Terms Terms Terms Terms may be Variables: x, y, a, a_var, phi 1,... Constants: T, F, phi,, +,... Applications: t 1 t 2, t 1 t 2 t 3... t n Abstractions: λ x. t, λ x 1 x 2... x n. t Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
25 Higher-Order Terms Terms Higher-Order Terms Fact (Higher-Order Terms) Variables can range over functions or predicates (i. e. boolean-valued functions) Example (Higher-Order Term) in λ f.f 0, the variable f ranges over functions in P. P(n) P(n+1), P ranges over predicates typical assertion x f. g. (g 0 = x) n.g (n+1) = (f (g n)) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
26 Syntactic Sugar Terms Higher-Order Terms Binders The quantifiers and are in fact polymorphic constants with types: : (α B) B : (α B) B They are defined such that for P : (α bool): P means P(x) = T for all x P means P(x) = T for some x Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
27 Hilbert s Choice Function Terms Higher-Order Terms Definition (ε-operator) εx. t[x] with x : σ and t[x] a term involving x binder of type (σ B) σ denotes a value of type σ some value of type σ, v:σ such that t[v] is true no such value exists: arbitrary but fixed value of type σ Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
28 Examples of ε-terms Terms Higher-Order Terms Example (ε-terms) This term denotes the number 1: εx. 0 < x x < 2 This term denotes an even number: εx. y. x = 2 y An unspecified natural number: εx. x + 1 = x The following proposition is true: (εx. x + 3 = 9) = 6 Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
29 Standard Signatures Terms Semantics Standard Signature and Intended Interpretation standard type structure Ω contains the atomic types B of Boolean values and I of individuals of type (B B B) Intended interpretation: implication = of type (α α B) Intended interpretation: equality on the set α ε of type ((α B) α) Intended interpretation: Hilbert s choice function. Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
30 Standard Logical Constants Terms Semantics Definition of Standard Logical Constants EXISTS def = λ P.P(εP) TRUTH def true = ((λ x.x) = (λ x.x)) FORALL def = λ P.(P = (λ x.true)) FALSITY def false = x.x NEGATION def = λ x.x false DISJUNCTION def = λ(x,y). x y CONJUNCTION def = λ(x,y). ( x y) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
31 Outline HOL Proof System 1 Introduction 2 Types Motivation Polymorphism Sematics 3 Terms Higher-Order Terms Semantics 4 HOL Proof System Formulas and Sequents Axioms and Rules 5 Summary Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
32 Formulas HOL Proof System Formulas and Sequents Definition (Formulas in HOL) Formulas in HOL are terms of type B Example (Formulas in HOL) x. x = 0 (x = 0) true (λ x. x)( y. y = y) x. x = true Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
33 Sequents HOL Proof System Formulas and Sequents Definition (Sequents in HOL) A sequent is a pair (Γ,t) where Γ is a set of formulas (assumptions) t is a formula (conclusion) A sequent (Γ, t) essentially means From the formulas in Γ, t can be derived. Example (Sequents in HOL) The sequent ({x = 3, n. n = n},x = 99) means { x = 3, y = 7, n. n = n } x + y = 10 Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
34 Theorems HOL Proof System Formulas and Sequents Definition (Theorems in HOL) A theorem is a sequent that is either an axiom, or can be derived from other theorems Notation Γ t or just t if Γ is empty Example (HOL Theorems) x. x = 0 (x = 0)? true? (λ x. x)( y. y = y)? x. x = true? Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
35 Axioms of the HOL Logic HOL Proof System Axioms and Rules Five Axioms b. (b = true) (b = false) b 1 b 2. (b 1 b 2 ) (b 2 b 1 ) (b 1 = b 2 ) f. (λ x. fx) = f P x. P x P(ε P) f.( x y. fx = fy x = y) ( x. y. x = f y) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
36 Inference Rules HOL Proof System Axioms and Rules Primitive Inference Rules ASSUME {t} t REFL MP t = t Γ 1 t 1 t 2 Γ 2 t 1 Γ 1 Γ 2 t 2 DISCH ABS Γ t 2 Γ {t 1 } t 1 t 2 Γ t 1 = t 2 Γ (λ x. t 1 ) = (λ x. t 2 ) (with x not free in Γ) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
37 Inference Rules HOL Proof System Axioms and Rules Primitive Inference Rules (continued) BETA_CONV SUBST INST_TYPE (λ x. t 1 )t 2 = t 1 [t 2 /x] Γ 1 t 1 = t 2 Γ 2 t[t 1 ] Γ 1 Γ 2 t[t 2 ] Γ t Γ t[σ 1...σ n /α 1...α n ] Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
38 Beta Conversion HOL Proof System Axioms and Rules Rule for Beta-Conversion BETA_CONV (λ x. t 1 )t 2 = t 1 [t 2 /x] t 1 [t 2 /x] denotes the result of substituting t 2 for all free occurrences of x in t 1 bound variables renamed if necessary so that no free variable in t 2 becomes bound Example (Beta Conversion) (λ x. x + 3) 7 = (λ x. ( x. x = true) x) false = ( x. x = true) false) (λ y. x. x = y) x = ( x. x = x) Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
39 HOL Proof System Axioms and Rules Substitution Rule for Substitution SUBST Γ 1 t 1 = t 2 Γ 2 t[t 1 ] Γ 1 Γ 2 t[t 2 ] where t[t 1 ] is a term with selected free occurences of t 1 singled out for t[t 2 ] is the result of replacing those chosen t 1 by t 2 bound variables are renamed so that variables free in t 2 do not become bound in t[t 2 ] Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
40 Type Instantiation HOL Proof System Axioms and Rules Rule for Type Instantiation INST_TYPE Γ t Γ t[σ 1...σ n /α 1...α n ] which effects the parallel substitution of types σ 1...σ n for type variables α 1...α n in t. Restriction: none of α 1...α n occur in Γ. Example (Type Instantiation) I(x : α) = x I(x : num) = x Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
41 Outline Summary 1 Introduction 2 Types Motivation Polymorphism Sematics 3 Terms Higher-Order Terms Semantics 4 HOL Proof System Formulas and Sequents Axioms and Rules 5 Summary Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
42 Summary Summary Higher-Order Logic types and terms quantification over predicates, functions and sets HOL Proof System five axioms and eight primitive inference rules Arnd Poetzsch-Heffter (Slides by Jens Brandt) ( Software Technology Higher-Order Group Fachbereich Logic Informatik Technische Universität Sommersemester Kaiserslautern) / 42
A Brief Introduction to Standard ML
A Brief Introduction to Standard ML Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität
More informationHOL DEFINING HIGHER ORDER LOGIC LAST TIME ON HOL CONTENT. Slide 3. Slide 1. Slide 4. Slide 2 WHAT IS HIGHER ORDER LOGIC? 2 LAST TIME ON HOL 1
LAST TIME ON HOL Proof rules for propositional and predicate logic Safe and unsafe rules NICTA Advanced Course Forward Proof Slide 1 Theorem Proving Principles, Techniques, Applications Slide 3 The Epsilon
More informationProgramming in Standard ML: Continued
Programming in Standard ML: Continued Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität
More informationTyped Lambda Calculus for Syntacticians
Department of Linguistics Ohio State University January 12, 2012 The Two Sides of Typed Lambda Calculus A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a
More informationBasic Foundations of Isabelle/HOL
Basic Foundations of Isabelle/HOL Peter Wullinger May 16th 2007 1 / 29 1 Introduction into Isabelle s HOL Why Type Theory Basic Type Syntax 2 More HOL Typed λ Calculus HOL Rules 3 Example proof 2 / 29
More informationTyped Lambda Calculus
Department of Linguistics Ohio State University Sept. 8, 2016 The Two Sides of A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a system of notation for functions
More informationFunctional Programming
Functional Programming A Brief Introduction to Standard ML Arnd Poetzsch-Heffter Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern Sommersemester 2010 Arnd Poetzsch-Heffter
More informationCSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27
CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 2.1-2.7 p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer
More informationFormal Predicate Calculus. Michael Meyling
Formal Predicate Calculus Michael Meyling May 24, 2013 2 The source for this document can be found here: http://www.qedeq.org/0_04_07/doc/math/qedeq_formal_logic_v1.xml Copyright by the authors. All rights
More informationLambda Calculus. Concepts in Programming Languages Recitation 6:
Concepts in Programming Languages Recitation 6: Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto ) Reference: Types and Programming
More information1.3. Conditional expressions To express case distinctions like
Introduction Much of the theory developed in the underlying course Logic II can be implemented in a proof assistant. In the present setting this is interesting, since we can then machine extract from a
More information15-819M: Data, Code, Decisions
15-819M: Data, Code, Decisions 08: First-Order Logic André Platzer aplatzer@cs.cmu.edu Carnegie Mellon University, Pittsburgh, PA André Platzer (CMU) 15-819M/08: Data, Code, Decisions 1 / 40 Outline 1
More informationThe Typed λ Calculus and Type Inferencing in ML
Notes on Types S. Arun-Kumar Department of Computer Science and Engineering Indian Institute of Technology New Delhi, 110016 email: sak@cse.iitd.ernet.in April 14, 2002 2 Chapter 1 The Typed λ Calculus
More informationFunctional Programming and Modeling
Chapter 2 2. Functional Programming and Modeling 2.0 2. Functional Programming and Modeling 2.0 Overview of Chapter Functional Programming and Modeling 2. Functional Programming and Modeling 2.1 Overview
More informationPure Lambda Calculus. Lecture 17
Pure Lambda Calculus Lecture 17 Lambda Calculus Lambda Calculus (λ-calculus) is a functional notation introduced by Alonzo Church in the early 1930s to formalize the notion of computability. Pure λ-calculus
More informationIntroduction to the Lambda Calculus. Chris Lomont
Introduction to the Lambda Calculus Chris Lomont 2010 2011 2012 www.lomont.org Leibniz (1646-1716) Create a universal language in which all possible problems can be stated Find a decision method to solve
More informationThe Untyped Lambda Calculus
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationAutomated Reasoning. Natural Deduction in First-Order Logic
Automated Reasoning Natural Deduction in First-Order Logic Jacques Fleuriot Automated Reasoning Lecture 4, page 1 Problem Consider the following problem: Every person has a heart. George Bush is a person.
More informationλ calculus is inconsistent
Content Rough timeline COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray λ Intro & motivation, getting started [1] Foundations & Principles
More informationLast class. CS Principles of Programming Languages. Introduction. Outline
Last class CS6848 - Principles of Programming Languages Principles of Programming Languages V. Krishna Nandivada IIT Madras Interpreters A Environment B Cells C Closures D Recursive environments E Interpreting
More informationProofs are Programs. Prof. Clarkson Fall Today s music: Proof by Paul Simon
Proofs are Programs Prof. Clarkson Fall 2017 Today s music: Proof by Paul Simon Review Previously in 3110: Functional programming in Coq Logic in Coq Today: A fundamental idea that goes by many names...
More informationCOMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein
COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ 1 Last time... λ calculus syntax free variables, substitution β reduction α and η conversion
More informationAn Introduction to Programming and Proving in Agda (incomplete draft)
An Introduction to Programming and Proving in Agda (incomplete draft) Peter Dybjer January 29, 2018 1 A first Agda module Your first Agda-file is called BoolModule.agda. Its contents are module BoolModule
More informationLecture slides & distribution files:
Type Theory Lecture slides & distribution files: http://www.cs.rhul.ac.uk/home/zhaohui/ttlectures.html Zhaohui Luo Department of Computer Science Royal Holloway, University of London April 2011 2 Type
More informationLambda Calculus and Type Inference
Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ August 17, 2007 Lambda Calculus and Type
More informationFundamentals and lambda calculus. Deian Stefan (adopted from my & Edward Yang s CSE242 slides)
Fundamentals and lambda calculus Deian Stefan (adopted from my & Edward Yang s CSE242 slides) Logistics Assignments: Programming assignment 1 is out Homework 1 will be released tomorrow night Podcasting:
More informationThis is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS
1 THE FORMALIZATION OF MATHEMATICS by Harvey M. Friedman Ohio State University Department of Mathematics friedman@math.ohio-state.edu www.math.ohio-state.edu/~friedman/ May 21, 1997 Can mathematics be
More informationFoundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution
Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation
More informationLogical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam
Logical Verification Course Notes Femke van Raamsdonk femke@csvunl Vrije Universiteit Amsterdam autumn 2008 Contents 1 1st-order propositional logic 3 11 Formulas 3 12 Natural deduction for intuitionistic
More informationFrom Types to Sets in Isabelle/HOL
From Types to Sets in Isabelle/HOL Extented Abstract Ondřej Kunčar 1 and Andrei Popescu 1,2 1 Fakultät für Informatik, Technische Universität München, Germany 2 Institute of Mathematics Simion Stoilow
More informationPHIL 240, Introduction to Logic, Sections Fall 2011 FINAL EXAM 14 December Name (5 points): Section (5 points):
Section I True / False questions (2 points each) 1. TRUE Any argument that is sound is also valid. 2. FALSE_ If the premises of an argument are all true, then that argument is sound. 3. TRUE Every universal
More informationThe Untyped Lambda Calculus
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationCalculus of Inductive Constructions
Calculus of Inductive Constructions Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Calculus of Inductive Constructions
More informationLambda Calculus. Variables and Functions. cs3723 1
Lambda Calculus Variables and Functions cs3723 1 Lambda Calculus Mathematical system for functions Computation with functions Captures essence of variable binding Function parameters and substitution Can
More informationModule 6. Knowledge Representation and Logic (First Order Logic) Version 2 CSE IIT, Kharagpur
Module 6 Knowledge Representation and Logic (First Order Logic) 6.1 Instructional Objective Students should understand the advantages of first order logic as a knowledge representation language Students
More informationProgramming Language Features. CMSC 330: Organization of Programming Languages. Turing Completeness. Turing Machine.
CMSC 330: Organization of Programming Languages Lambda Calculus Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying or tuples
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Ø Use currying
More informationIntegration of SMT Solvers with ITPs There and Back Again
Integration of SMT Solvers with ITPs There and Back Again Sascha Böhme and University of Sheffield 7 May 2010 1 2 Features: SMT-LIB vs. Yices Translation Techniques Caveats 3 4 Motivation Motivation System
More informationCSC 501 Semantics of Programming Languages
CSC 501 Semantics of Programming Languages Subtitle: An Introduction to Formal Methods. Instructor: Dr. Lutz Hamel Email: hamel@cs.uri.edu Office: Tyler, Rm 251 Books There are no required books in this
More informationCS4215 Programming Language Implementation. Martin Henz
CS4215 Programming Language Implementation Martin Henz Thursday 26 January, 2012 2 Chapter 4 The Language simpl In this chapter, we are exting the language epl in order to provide a more powerful programming
More informationLambda Calculus. Lecture 4 CS /26/10
Lambda Calculus Lecture 4 CS 565 10/26/10 Pure (Untyped) Lambda Calculus The only value is a function Variables denote functions Functions always take functions as arguments Functions always return functions
More informationLexicografie computationala Feb., 2012
Lexicografie computationala Feb., 2012 Anca Dinu University of Bucharest Introduction When we construct meaning representations systematically, we integrate information from two different sources: 1. The
More informationDiscrete Mathematics Lecture 4. Harper Langston New York University
Discrete Mathematics Lecture 4 Harper Langston New York University Sequences Sequence is a set of (usually infinite number of) ordered elements: a 1, a 2,, a n, Each individual element a k is called a
More informationZ Notation. June 21, 2018
Z Notation June 21, 2018 1 Definitions There are many different ways to introduce an object in a Z specification: declarations, abbreviations, axiomatic definitions, and free types. Keep in mind that the
More informationCOMP80 Lambda Calculus Programming Languages Slides Courtesy of Prof. Sam Guyer Tufts University Computer Science History Big ideas Examples:
COMP80 Programming Languages Slides Courtesy of Prof. Sam Guyer Lambda Calculus Formal system with three parts Notation for functions Proof system for equations Calculation rules called reduction Idea:
More informationData types for mcrl2
Data types for mcrl2 Aad Mathijssen April 5, 2018 We provide a syntax for the standard data types of the mcrl2 language. This syntax is intended to be a practical mix between standard mathematical notation
More informationFundamentals and lambda calculus
Fundamentals and lambda calculus Again: JavaScript functions JavaScript functions are first-class Syntax is a bit ugly/terse when you want to use functions as values; recall block scoping: (function ()
More informationProgramming Languages and Compilers (CS 421)
Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC http://courses.engr.illinois.edu/cs421 Based in part on slides by Mattox Beckman, as updated by Vikram Adve and Gul Agha 10/3/17
More informationLambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu,
Lambda Calculus Type Systems, Lectures 3 Jevgeni Kabanov Tartu, 13.02.2006 PREVIOUSLY ON TYPE SYSTEMS Arithmetical expressions and Booleans Evaluation semantics Normal forms & Values Getting stuck Safety
More informationThe Metalanguage λprolog and Its Implementation
The Metalanguage λprolog and Its Implementation Gopalan Nadathur Computer Science Department University of Minnesota (currently visiting INRIA and LIX) 1 The Role of Metalanguages Many computational tasks
More informationM. Snyder, George Mason University LAMBDA CALCULUS. (untyped)
1 LAMBDA CALCULUS (untyped) 2 The Untyped Lambda Calculus (λ) Designed by Alonzo Church (1930s) Turing Complete (Turing was his doctoral student!) Models functions, always as 1-input Definition: terms,
More informationMore Untyped Lambda Calculus & Simply Typed Lambda Calculus
Concepts in Programming Languages Recitation 6: More Untyped Lambda Calculus & Simply Typed Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky,
More informationLecture 5 - Axiomatic semantics
Program Verification March 2014 Lecture 5 - Axiomatic semantics Lecturer: Noam Rinetzky Scribes by: Nir Hemed 1.1 Axiomatic semantics The development of the theory is contributed to Robert Floyd, C.A.R
More information3.7 Denotational Semantics
3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These
More informationUntyped Lambda Calculus
Advanced Topics in Programming Languages Untyped Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto ) Reference: Types and Programming
More informationFirst-Class Type Classes
First-Class Type Classes Matthieu Sozeau Joint work with Nicolas Oury LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project Gallium Seminar November 3rd 2008 INRIA Rocquencourt Solutions for
More informationProgramming Languages Third Edition
Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand
More informationOverview. A Compact Introduction to Isabelle/HOL. Tobias Nipkow. System Architecture. Overview of Isabelle/HOL
Overview A Compact Introduction to Isabelle/HOL Tobias Nipkow TU München 1. Introduction 2. Datatypes 3. Logic 4. Sets p.1 p.2 System Architecture Overview of Isabelle/HOL ProofGeneral Isabelle/HOL Isabelle
More informationIntroduction to dependent types in Coq
October 24, 2008 basic use of the Coq system In Coq, you can play with simple values and functions. The basic command is called Check, to verify if an expression is well-formed and learn what is its type.
More informationImporting HOL-Light into Coq
Outlines Importing HOL-Light into Coq Deep and shallow embeddings of the higher order logic into Coq Work in progress Chantal Keller chantal.keller@ens-lyon.fr Bejamin Werner benjamin.werner@inria.fr 2009
More informationProofs are Programs. Prof. Clarkson Fall Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson
Proofs are Programs Prof. Clarkson Fall 2016 Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson Review Currently in 3110: Advanced topics Futures Monads Today: An idea that goes by
More informationλ calculus Function application Untyped λ-calculus - Basic Idea Terms, Variables, Syntax β reduction Advanced Formal Methods
Course 2D1453, 2006-07 Advanced Formal Methods Lecture 2: Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Alonzo Church, 1903-1995 Church-Turing thesis First
More informationLambda Calculus and Type Inference
Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ October 13, 2004 Lambda Calculus and Type
More informationUntyped Lambda Calculus
Concepts in Programming Languages Recitation 5: Untyped Lambda Calculus Oded Padon & Mooly Sagiv (original slides by Kathleen Fisher, John Mitchell, Shachar Itzhaky, S. Tanimoto ) Reference: Types and
More informationLecture 5. Logic I. Statement Logic
Ling 726: Mathematical Linguistics, Logic. Statement Logic V. Borschev and B. Partee, September 27, 2 p. Lecture 5. Logic I. Statement Logic. Statement Logic...... Goals..... Syntax of Statement Logic....2.
More informationType Checking and Type Inference
Type Checking and Type Inference Principles of Programming Languages CSE 307 1 Types in Programming Languages 2 Static Type Checking 3 Polymorphic Type Inference Version: 1.8 17:20:56 2014/08/25 Compiled
More informationChapter 3: Propositional Languages
Chapter 3: Propositional Languages We define here a general notion of a propositional language. We show how to obtain, as specific cases, various languages for propositional classical logic and some non-classical
More informationIntroductory logic and sets for Computer scientists
Introductory logic and sets for Computer scientists Nimal Nissanke University of Reading ADDISON WESLEY LONGMAN Harlow, England II Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 Summer 2017 1 100 years ago Albert Einstein proposed special theory of relativity in 1905 In the paper On the Electrodynamics of
More informationFormal Systems and their Applications
Formal Systems and their Applications Dave Clarke (Dave.Clarke@cs.kuleuven.be) Acknowledgment: these slides are based in part on slides from Benjamin Pierce and Frank Piessens 1 Course Overview Introduction
More informationCMSC 330: Organization of Programming Languages. Lambda Calculus
CMSC 330: Organization of Programming Languages Lambda Calculus 1 100 years ago Albert Einstein proposed special theory of relativity in 1905 In the paper On the Electrodynamics of Moving Bodies 2 Prioritätsstreit,
More informationLecture 3: Typed Lambda Calculus and Curry-Howard
Lecture 3: Typed Lambda Calculus and Curry-Howard H. Geuvers Radboud University Nijmegen, NL 21st Estonian Winter School in Computer Science Winter 2016 H. Geuvers - Radboud Univ. EWSCS 2016 Typed λ-calculus
More informationCSC Discrete Math I, Spring Sets
CSC 125 - Discrete Math I, Spring 2017 Sets Sets A set is well-defined, unordered collection of objects The objects in a set are called the elements, or members, of the set A set is said to contain its
More information1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.
1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered
More informationLOGIC AND DISCRETE MATHEMATICS
LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University
More informationCSC312 Principles of Programming Languages : Functional Programming Language. Copyright 2006 The McGraw-Hill Companies, Inc.
CSC312 Principles of Programming Languages : Functional Programming Language Overview of Functional Languages They emerged in the 1960 s with Lisp Functional programming mirrors mathematical functions:
More informationPolymorphic lambda calculus Princ. of Progr. Languages (and Extended ) The University of Birmingham. c Uday Reddy
06-02552 Princ. of Progr. Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 6: Polymorphic Type Systems 1. Polymorphic
More informationIntroduction to Type Theory August 2007 Types Summer School Bertinoro, It. Herman Geuvers Nijmegen NL
Introduction to Type Theory August 2007 Types Summer School Bertinoro, It Herman Geuvers Nijmegen NL Lecture 2: Dependent Type Theory, Logical Framework 1 For λ : Direct representation (shallow embedding)
More informationCMSC 330: Organization of Programming Languages. Formal Semantics of a Prog. Lang. Specifying Syntax, Semantics
Recall Architecture of Compilers, Interpreters CMSC 330: Organization of Programming Languages Source Scanner Parser Static Analyzer Operational Semantics Intermediate Representation Front End Back End
More informationAn Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification
An Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification SUBMITTED TO THE FACULTY OF THE GRADUATE SCHOOL OF THE UNIVERSITY OF MINNESOTA BY Xiaochu Qi IN PARTIAL
More informationInductive Definitions, continued
1 / 27 Inductive Definitions, continued Assia Mahboubi Jan 7th, 2016 2 / 27 Last lecture Introduction to Coq s inductive types: Introduction, elimination and computation rules; Twofold implementation :
More informationGoals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1
Natural Semantics Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1 1 Natural deduction is an instance of first-order logic; that is, it is the formal
More informationCSE 20 DISCRETE MATH. Fall
CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Final exam The final exam is Saturday December 16 11:30am-2:30pm. Lecture A will take the exam in Lecture B will take the exam
More informationCMSC 330: Organization of Programming Languages. Lambda Calculus
CMSC 330: Organization of Programming Languages Lambda Calculus 1 Turing Completeness Turing machines are the most powerful description of computation possible They define the Turing-computable functions
More informationMathematically Rigorous Software Design Review of mathematical prerequisites
Mathematically Rigorous Software Design 2002 September 27 Part 1: Boolean algebra 1. Define the Boolean functions and, or, not, implication ( ), equivalence ( ) and equals (=) by truth tables. 2. In an
More informationLogic and its Applications
Logic and its Applications Edmund Burke and Eric Foxley PRENTICE HALL London New York Toronto Sydney Tokyo Singapore Madrid Mexico City Munich Contents Preface xiii Propositional logic 1 1.1 Informal introduction
More informationCSE-321 Programming Languages 2012 Midterm
Name: Hemos ID: CSE-321 Programming Languages 2012 Midterm Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 14 15 29 20 7 15 100 There are six problems on 24 pages in this exam. The maximum score
More informationThe three faces of homotopy type theory. Type theory and category theory. Minicourse plan. Typing judgments. Michael Shulman.
The three faces of homotopy type theory Type theory and category theory Michael Shulman 1 A programming language. 2 A foundation for mathematics based on homotopy theory. 3 A calculus for (, 1)-category
More informationCMSC 330: Organization of Programming Languages
CMSC 330: Organization of Programming Languages Lambda Calculus CMSC 330 1 Programming Language Features Many features exist simply for convenience Multi-argument functions foo ( a, b, c ) Use currying
More informationArbitrary-rank polymorphism in (GHC) Haskell
Arbitrary-rank polymorphism in (GHC) Haskell CAS 743 Stephen Forrest 20 March 2006 Damas-Milner Type System A Damas-Milner type system (also called Hindley-Milner) is a traditional type system for functional
More informationCSE-321 Programming Languages 2010 Midterm
Name: Hemos ID: CSE-321 Programming Languages 2010 Midterm Score Prob 1 Prob 2 Prob 3 Prob 4 Total Max 15 30 35 20 100 1 1 SML Programming [15 pts] Question 1. [5 pts] Give a tail recursive implementation
More informationHIGHER-ORDER ABSTRACT SYNTAX IN TYPE THEORY
HIGHER-ORDER ABSTRACT SYNTAX IN TYPE THEORY VENANZIO CAPRETTA AND AMY P. FELTY Abstract. We develop a general tool to formalize and reason about languages expressed using higher-order abstract syntax in
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts
More informationPart I Logic programming paradigm
Part I Logic programming paradigm 1 Logic programming and pure Prolog 1.1 Introduction 3 1.2 Syntax 4 1.3 The meaning of a program 7 1.4 Computing with equations 9 1.5 Prolog: the first steps 15 1.6 Two
More information1 Introduction. 3 Syntax
CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,
More informationCS 336/CS M36 (part 2)/CS M46 Interactive Theorem Proving
CS 336/CS M36 (part 2)/CS M46 Interactive Theorem Proving Course Notes Lent Term Term 2008 Sect. 4 The λ-calculus with Products and Conjunction Anton Setzer Dept. of Computer Science, Swansea University
More informationProgramming Language Concepts: Lecture 19
Programming Language Concepts: Lecture 19 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 19, 01 April 2009 Adding types
More informationCSE 3302 Programming Languages Lecture 8: Functional Programming
CSE 3302 Programming Languages Lecture 8: Functional Programming (based on the slides by Tim Sheard) Leonidas Fegaras University of Texas at Arlington CSE 3302 L8 Spring 2011 1 Functional Programming Languages
More informationRSL Reference Manual
RSL Reference Manual Part No.: Date: April 6, 1990 Original Authors: Klaus Havelund, Anne Haxthausen Copyright c 1990 Computer Resources International A/S This document is issued on a restricted basis
More informationInductive datatypes in HOL. lessons learned in Formal-Logic Engineering
Inductive datatypes in HOL lessons learned in Formal-Logic Engineering Stefan Berghofer and Markus Wenzel Institut für Informatik TU München = Isabelle λ β HOL α 1 Introduction Applications of inductive
More information