NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

Size: px
Start display at page:

Download "NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications"

Transcription

1 NICTA Advanced Course Theorem Proving Principles, Techniques, Applications λ 1

2 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic, natural deduction Term rewriting Proof & Specification Techniques Datatypes, recursion, induction Inductively defined sets, rule induction Calculational reasoning, mathematics style proofs Hoare logic, proofs about programs CONTENT 2

3 λ CALCULUS IS INCONSISTENT From last lecture: Can find term R such that R R = β not(r R) There are more terms that do not make sense: 1 2, true false, etc. λ CALCULUS IS INCONSISTENT 3

4 λ CALCULUS IS INCONSISTENT From last lecture: Can find term R such that R R = β not(r R) There are more terms that do not make sense: 1 2, true false, etc. Solution: rule out ill-formed terms by using types. (Church 1940) λ CALCULUS IS INCONSISTENT 3-A

5 INTRODUCING TYPES Idea: assign a type to each sensible λ term. Examples: INTRODUCING TYPES 4

6 INTRODUCING TYPES Idea: assign a type to each sensible λ term. Examples: for term t has type α write t :: α INTRODUCING TYPES 4-A

7 INTRODUCING TYPES Idea: assign a type to each sensible λ term. Examples: for term t has type α write t :: α if x has type α then λx. x is a function from α to α Write: (λx. x) :: α a INTRODUCING TYPES 4-B

8 INTRODUCING TYPES Idea: assign a type to each sensible λ term. Examples: for term t has type α write t :: α if x has type α then λx. x is a function from α to α Write: (λx. x) :: α a for s t to be sensible: s must be function t must be right type for parameter If s :: α β and t :: α then (s t) :: β INTRODUCING TYPES 4-C

9 THAT S ABOUT IT 5

10 NOW FORMALLY, AGAIN 6

11 SYNTAX FOR λ Terms: t ::= v c (t t) (λx. t) v, x V, c C, V, C sets of names Types: τ ::= b ν τ τ b {bool, int,...} base types ν {α, β,...} type variables α β γ = α (β γ) SYNTAX FOR λ 7

12 SYNTAX FOR λ Terms: t ::= v c (t t) (λx. t) v, x V, c C, V, C sets of names Types: τ ::= b ν τ τ b {bool, int,...} base types ν {α, β,...} type variables α β γ = α (β γ) Contexts Γ: Γ: function from variable and constant names to types. SYNTAX FOR λ 7-A

13 SYNTAX FOR λ Terms: t ::= v c (t t) (λx. t) v, x V, c C, V, C sets of names Types: τ ::= b ν τ τ b {bool, int,...} base types ν {α, β,...} type variables α β γ = α (β γ) Contexts Γ: Γ: function from variable and constant names to types. Term t has type τ in context Γ: Γ t :: τ SYNTAX FOR λ 7-B

14 EXAMPLES Γ (λx. x) :: α α EXAMPLES 8

15 EXAMPLES Γ (λx. x) :: α α [y int] y :: int EXAMPLES 8-A

16 EXAMPLES Γ (λx. x) :: α α [y int] y :: int [z bool] (λy. y) z :: bool EXAMPLES 8-B

17 EXAMPLES Γ (λx. x) :: α α [y int] y :: int [z bool] (λy. y) z :: bool [] λf x. f x :: (α β) α β EXAMPLES 8-C

18 EXAMPLES Γ (λx. x) :: α α [y int] y :: int [z bool] (λy. y) z :: bool [] λf x. f x :: (α β) α β A term t is well typed or type correct if there are Γ and τ such that Γ t :: τ EXAMPLES 8-D

19 TYPE CHECKING RULES Variables: Γ x :: Γ(x) TYPE CHECKING RULES 9

20 TYPE CHECKING RULES Variables: Γ x :: Γ(x) Application: Γ (t 1 t 2 ) :: τ 1 TYPE CHECKING RULES 9-A

21 TYPE CHECKING RULES Variables: Γ x :: Γ(x) Application: Γ t 1 :: τ 2 τ 1 Γ t 2 :: τ 2 Γ (t 1 t 2 ) :: τ 1 TYPE CHECKING RULES 9-B

22 TYPE CHECKING RULES Variables: Γ x :: Γ(x) Application: Γ t 1 :: τ 2 τ 1 Γ t 2 :: τ 2 Γ (t 1 t 2 ) :: τ 1 Abstraction: Γ (λx. t) :: τ 1 τ 2 TYPE CHECKING RULES 9-C

23 TYPE CHECKING RULES Variables: Γ x :: Γ(x) Application: Γ t 1 :: τ 2 τ 1 Γ t 2 :: τ 2 Γ (t 1 t 2 ) :: τ 1 Abstraction: Γ[x τ 1 ] t :: τ 2 Γ (λx. t) :: τ 1 τ 2 TYPE CHECKING RULES 9-D

24 EXAMPLE TYPE DERIVATION: [] λx y. x :: α β α EXAMPLE TYPE DERIVATION: 10

25 EXAMPLE TYPE DERIVATION: [x α] λy. x :: β α [] λx y. x :: α β α EXAMPLE TYPE DERIVATION: 10-A

26 EXAMPLE TYPE DERIVATION: [x α, y β] x :: α [x α] λy. x :: β α [] λx y. x :: α β α EXAMPLE TYPE DERIVATION: 10-B

27 EXAMPLE TYPE DERIVATION: [x α, y β] x :: α [x α] λy. x :: β α [] λx y. x :: α β α EXAMPLE TYPE DERIVATION: 10-C

28 MORE COMPLEX EXAMPLE [] λf x. f x x :: MORE COMPLEX EXAMPLE 11

29 MORE COMPLEX EXAMPLE [] λf x. f x x :: (α α β) α β MORE COMPLEX EXAMPLE 11-A

30 MORE COMPLEX EXAMPLE [f α α β] λx. f x x :: α β [] λf x. f x x :: (α α β) α β MORE COMPLEX EXAMPLE 11-B

31 MORE COMPLEX EXAMPLE Γ f x x :: β [f α α β] λx. f x x :: α β [] λf x. f x x :: (α α β) α β Γ = [f α α β, x α] MORE COMPLEX EXAMPLE 11-C

32 MORE COMPLEX EXAMPLE Γ f x :: α β Γ f x x :: β [f α α β] λx. f x x :: α β [] λf x. f x x :: (α α β) α β Γ = [f α α β, x α] MORE COMPLEX EXAMPLE 11-D

33 MORE COMPLEX EXAMPLE Γ f x :: α β Γ x :: α Γ f x x :: β [f α α β] λx. f x x :: α β [] λf x. f x x :: (α α β) α β Γ = [f α α β, x α] MORE COMPLEX EXAMPLE 11-E

34 MORE COMPLEX EXAMPLE Γ f :: α (α β) Γ f x :: α β Γ x :: α Γ f x x :: β [f α α β] λx. f x x :: α β [] λf x. f x x :: (α α β) α β Γ = [f α α β, x α] MORE COMPLEX EXAMPLE 11-F

35 MORE COMPLEX EXAMPLE Γ f :: α (α β) Γ x :: α Γ f x :: α β Γ x :: α Γ f x x :: β [f α α β] λx. f x x :: α β [] λf x. f x x :: (α α β) α β Γ = [f α α β, x α] MORE COMPLEX EXAMPLE 11-G

36 MORE GENERAL TYPES A term can have more than one type. MORE GENERAL TYPES 12

37 MORE GENERAL TYPES A term can have more than one type. Example: [] λx. x :: bool bool [] λx. x :: α α MORE GENERAL TYPES 12-A

38 MORE GENERAL TYPES A term can have more than one type. Example: [] λx. x :: bool bool [] λx. x :: α α Some types are more general than others: τ σ if there is a substitution S such that τ = S(σ) MORE GENERAL TYPES 12-B

39 MORE GENERAL TYPES A term can have more than one type. Example: [] λx. x :: bool bool [] λx. x :: α α Some types are more general than others: τ σ if there is a substitution S such that τ = S(σ) Examples: int bool α β MORE GENERAL TYPES 12-C

40 MORE GENERAL TYPES A term can have more than one type. Example: [] λx. x :: bool bool [] λx. x :: α α Some types are more general than others: τ σ if there is a substitution S such that τ = S(σ) Examples: int bool α β β α MORE GENERAL TYPES 12-D

41 MORE GENERAL TYPES A term can have more than one type. Example: [] λx. x :: bool bool [] λx. x :: α α Some types are more general than others: τ σ if there is a substitution S such that τ = S(σ) Examples: int bool α β β α α α MORE GENERAL TYPES 12-E

42 MOST GENERAL TYPES Fact: each type correct term has a most general type MOST GENERAL TYPES 13

43 MOST GENERAL TYPES Fact: each type correct term has a most general type Formally: Γ t :: τ = σ. Γ t :: σ ( σ. Γ t :: σ = σ σ) MOST GENERAL TYPES 13-A

44 MOST GENERAL TYPES Fact: each type correct term has a most general type Formally: Γ t :: τ = σ. Γ t :: σ ( σ. Γ t :: σ = σ σ) It can be found by executing the typing rules backwards. MOST GENERAL TYPES 13-B

45 MOST GENERAL TYPES Fact: each type correct term has a most general type Formally: Γ t :: τ = σ. Γ t :: σ ( σ. Γ t :: σ = σ σ) It can be found by executing the typing rules backwards. type checking: checking if Γ t :: τ for given Γ and τ MOST GENERAL TYPES 13-C

46 MOST GENERAL TYPES Fact: each type correct term has a most general type Formally: Γ t :: τ = σ. Γ t :: σ ( σ. Γ t :: σ = σ σ) It can be found by executing the typing rules backwards. type checking: checking if Γ t :: τ for given Γ and τ type inference: computing Γ and τ such that Γ t :: τ MOST GENERAL TYPES 13-D

47 MOST GENERAL TYPES Fact: each type correct term has a most general type Formally: Γ t :: τ = σ. Γ t :: σ ( σ. Γ t :: σ = σ σ) It can be found by executing the typing rules backwards. type checking: checking if Γ t :: τ for given Γ and τ type inference: computing Γ and τ such that Γ t :: τ Type checking and type inference on λ are decidable. MOST GENERAL TYPES 13-E

48 WHAT ABOUT β REDUCTION? WHAT ABOUT β REDUCTION? 14

49 WHAT ABOUT β REDUCTION? Definition of β reduction stays the same. WHAT ABOUT β REDUCTION? 14-A

50 WHAT ABOUT β REDUCTION? Definition of β reduction stays the same. Fact: Well typed terms stay well typed during β reduction Formally: Γ s :: τ s β t = Γ t :: τ WHAT ABOUT β REDUCTION? 14-B

51 WHAT ABOUT β REDUCTION? Definition of β reduction stays the same. Fact: Well typed terms stay well typed during β reduction Formally: Γ s :: τ s β t = Γ t :: τ This property is called subject reduction WHAT ABOUT β REDUCTION? 14-C

52 WHAT ABOUT TERMINATION? WHAT ABOUT TERMINATION? 15

53 WHAT ABOUT TERMINATION? β reduction in λ always terminates. (Alan Turing, 1942) WHAT ABOUT TERMINATION? 15-A

54 WHAT ABOUT TERMINATION? β reduction in λ always terminates. (Alan Turing, 1942) = β is decidable To decide if s = β t, reduce s and t to normal form (always exists, because β terminates), and compare result. WHAT ABOUT TERMINATION? 15-B

55 WHAT ABOUT TERMINATION? β reduction in λ always terminates. (Alan Turing, 1942) = β is decidable To decide if s = β t, reduce s and t to normal form (always exists, because β terminates), and compare result. = αβη is decidable This is why Isabelle can automatically reduce each term to βη normal form. WHAT ABOUT TERMINATION? 15-C

56 WHAT DOES THIS MEAN FOR EXPRESSIVENESS? WHAT DOES THIS MEAN FOR EXPRESSIVENESS? 16

57 WHAT DOES THIS MEAN FOR EXPRESSIVENESS? Not all computable functions can be expressed in λ! WHAT DOES THIS MEAN FOR EXPRESSIVENESS? 16-A

58 WHAT DOES THIS MEAN FOR EXPRESSIVENESS? Not all computable functions can be expressed in λ! How can typed functional languages then be turing complete? WHAT DOES THIS MEAN FOR EXPRESSIVENESS? 16-B

59 WHAT DOES THIS MEAN FOR EXPRESSIVENESS? Not all computable functions can be expressed in λ! How can typed functional languages then be turing complete? Fact: Each computable function can be encoded as closed, type correct λ term using Y :: (τ τ) τ with Y t β t (Y t) as only constant. WHAT DOES THIS MEAN FOR EXPRESSIVENESS? 16-C

60 WHAT DOES THIS MEAN FOR EXPRESSIVENESS? Not all computable functions can be expressed in λ! How can typed functional languages then be turing complete? Fact: Each computable function can be encoded as closed, type correct λ term using Y :: (τ τ) τ with Y t β t (Y t) as only constant. Y is called fix point operator used for recursion WHAT DOES THIS MEAN FOR EXPRESSIVENESS? 16-D

61 TYPES AND TERMS IN ISABELLE Types: τ ::= b ν ν :: C τ τ (τ,..., τ) K b {bool, int,...} base types ν {α, β,...} type variables K {set, list,...} type constructors C {order, linord,...} type classes Terms: t ::= v c?v (t t) (λx. t) v, x V, c C, V, C sets of names TYPES AND TERMS IN ISABELLE 17

62 TYPES AND TERMS IN ISABELLE Types: τ ::= b ν ν :: C τ τ (τ,..., τ) K b {bool, int,...} base types ν {α, β,...} type variables K {set, list,...} type constructors C {order, linord,...} type classes Terms: t ::= v c?v (t t) (λx. t) v, x V, c C, V, C sets of names type constructors: construct a new type out of a parameter type. Example: int list TYPES AND TERMS IN ISABELLE 17-A

63 TYPES AND TERMS IN ISABELLE Types: τ ::= b ν ν :: C τ τ (τ,..., τ) K b {bool, int,...} base types ν {α, β,...} type variables K {set, list,...} type constructors C {order, linord,...} type classes Terms: t ::= v c?v (t t) (λx. t) v, x V, c C, V, C sets of names type constructors: construct a new type out of a parameter type. Example: int list type classes: restrict type variables to a class defined by axioms. Example: α :: order TYPES AND TERMS IN ISABELLE 17-B

64 TYPES AND TERMS IN ISABELLE Types: τ ::= b ν ν :: C τ τ (τ,..., τ) K b {bool, int,...} base types ν {α, β,...} type variables K {set, list,...} type constructors C {order, linord,...} type classes Terms: t ::= v c?v (t t) (λx. t) v, x V, c C, V, C sets of names type constructors: construct a new type out of a parameter type. Example: int list type classes: restrict type variables to a class defined by axioms. Example: α :: order schematic variables: variables that can be instantiated. TYPES AND TERMS IN ISABELLE 17-C

65 TYPE CLASSES similar to Haskell s type classes, but with semantic properties axclass order < ord order refl: x x order trans: [x y; y z ] = x z... TYPE CLASSES 18

66 TYPE CLASSES similar to Haskell s type classes, but with semantic properties axclass order < ord order refl: x x order trans: [x y; y z ] = x z... theorems can be proved in the abstract lemma order less trans: V x :: a :: order. [x < y; y < z ] = x < z TYPE CLASSES 18-A

67 TYPE CLASSES similar to Haskell s type classes, but with semantic properties axclass order < ord order refl: x x order trans: [x y; y z ] = x z... theorems can be proved in the abstract lemma order less trans: V x :: a :: order. [x < y; y < z ] = x < z can be used for subtyping axclass linorder < order linorder linear: x y y x TYPE CLASSES 18-B

68 TYPE CLASSES similar to Haskell s type classes, but with semantic properties axclass order < ord order refl: x x order trans: [x y; y z ] = x z... theorems can be proved in the abstract lemma order less trans: V x :: a :: order. [x < y; y < z ] = x < z can be used for subtyping axclass linorder < order linorder linear: x y y x can be instantiated instance nat :: {order, linorder} by... TYPE CLASSES 18-C

69 SCHEMATIC VARIABLES X Y X Y X and Y must be instantiated to apply the rule SCHEMATIC VARIABLES 19

70 SCHEMATIC VARIABLES X Y X Y X and Y must be instantiated to apply the rule But: lemma x + 0 = 0 + x x is free convention: lemma must be true for all x during the proof, x must not be instantiated SCHEMATIC VARIABLES 19-A

71 SCHEMATIC VARIABLES X Y X Y X and Y must be instantiated to apply the rule But: lemma x + 0 = 0 + x x is free convention: lemma must be true for all x during the proof, x must not be instantiated Solution: Isabelle has free (x), bound (x), and schematic (?X) variables. Only schematic variables can be instantiated. Free converted into schematic after proof is finished. SCHEMATIC VARIABLES 19-B

72 HIGHER ORDER UNIFICATION Unification: Find substitution σ on variables for terms s, t such that σ(s) = σ(t) HIGHER ORDER UNIFICATION 20

73 HIGHER ORDER UNIFICATION Unification: Find substitution σ on variables for terms s, t such that σ(s) = σ(t) In Isabelle: Find substitution σ on schematic variables such that σ(s) = αβη σ(t) HIGHER ORDER UNIFICATION 20-A

74 HIGHER ORDER UNIFICATION Unification: Find substitution σ on variables for terms s, t such that σ(s) = σ(t) In Isabelle: Find substitution σ on schematic variables such that σ(s) = αβη σ(t) Examples:?X?Y = αβη x x?p x = αβη x x P (?f x) = αβη?y x HIGHER ORDER UNIFICATION 20-B

75 HIGHER ORDER UNIFICATION Unification: Find substitution σ on variables for terms s, t such that σ(s) = σ(t) In Isabelle: Find substitution σ on schematic variables such that σ(s) = αβη σ(t) Examples:?X?Y = αβη x x [?X x,?y x]?p x = αβη x x [?P λx. x x] P (?f x) = αβη?y x [?f λx. x,?y P ] Higher Order: schematic variables can be functions. HIGHER ORDER UNIFICATION 20-C

76 HIGHER ORDER UNIFICATION Unification modulo αβ (Higher Order Unification) is semi-decidable HIGHER ORDER UNIFICATION 21

77 HIGHER ORDER UNIFICATION Unification modulo αβ (Higher Order Unification) is semi-decidable Unification modulo αβη is undecidable HIGHER ORDER UNIFICATION 21-A

78 HIGHER ORDER UNIFICATION Unification modulo αβ (Higher Order Unification) is semi-decidable Unification modulo αβη is undecidable Higher Order Unification has possibly infinitely many solutions HIGHER ORDER UNIFICATION 21-B

79 HIGHER ORDER UNIFICATION Unification modulo αβ (Higher Order Unification) is semi-decidable Unification modulo αβη is undecidable Higher Order Unification has possibly infinitely many solutions But: Most cases are well-behaved HIGHER ORDER UNIFICATION 21-C

80 HIGHER ORDER UNIFICATION Unification modulo αβ (Higher Order Unification) is semi-decidable Unification modulo αβη is undecidable Higher Order Unification has possibly infinitely many solutions But: Most cases are well-behaved Important fragments (like Higher Order Patterns) are decidable HIGHER ORDER UNIFICATION 21-D

81 HIGHER ORDER UNIFICATION Unification modulo αβ (Higher Order Unification) is semi-decidable Unification modulo αβη is undecidable Higher Order Unification has possibly infinitely many solutions But: Most cases are well-behaved Important fragments (like Higher Order Patterns) are decidable Higher Order Pattern: is a term in β normal form where each occurrence of a schematic variable is of the from?f t 1... t n and the t 1... t n are η-convertible into n distinct bound variables HIGHER ORDER UNIFICATION 21-E

82 WE HAVE LEARNED SO FAR... Simply typed lambda calculus: λ WE HAVE LEARNED SO FAR... 22

83 WE HAVE LEARNED SO FAR... Simply typed lambda calculus: λ Typing rules for λ, type variables, type contexts WE HAVE LEARNED SO FAR A

84 WE HAVE LEARNED SO FAR... Simply typed lambda calculus: λ Typing rules for λ, type variables, type contexts β-reduction in λ satisfies subject reduction WE HAVE LEARNED SO FAR B

85 WE HAVE LEARNED SO FAR... Simply typed lambda calculus: λ Typing rules for λ, type variables, type contexts β-reduction in λ satisfies subject reduction β-reduction in λ always terminates WE HAVE LEARNED SO FAR C

86 WE HAVE LEARNED SO FAR... Simply typed lambda calculus: λ Typing rules for λ, type variables, type contexts β-reduction in λ satisfies subject reduction β-reduction in λ always terminates Types and terms in Isabelle WE HAVE LEARNED SO FAR D

87 PREVIEW: PROOFS IN ISABELLE 23

88 PROOFS IN ISABELLE General schema: lemma name: <goal> apply <method> apply <method>... done PROOFS IN ISABELLE 24

89 PROOFS IN ISABELLE General schema: lemma name: <goal> apply <method> apply <method>... done Sequential application of methods until all subgoals are solved. PROOFS IN ISABELLE 24-A

90 THE PROOF STATE 1. x 1... x p.[a 1 ;... ; A n ] = B 2. y 1... y q.[c 1 ;... ; C m ] = D THE PROOF STATE 25

91 THE PROOF STATE 1. x 1... x p.[a 1 ;... ; A n ] = B 2. y 1... y q.[c 1 ;... ; C m ] = D x 1... x p A 1... A n B Parameters Local assumptions Actual (sub)goal THE PROOF STATE 25-A

92 ISABELLE THEORIES Syntax: theory MyT h = ImpT h ImpT h n : (declarations, definitions, theorems, proofs,...) end MyT h: name of theory. Must live in file MyT h.thy ImpT h i : name of imported theories. Import transitive. ISABELLE THEORIES 26

93 ISABELLE THEORIES Syntax: theory MyT h = ImpT h ImpT h n : (declarations, definitions, theorems, proofs,...) end MyT h: name of theory. Must live in file MyT h.thy ImpT h i : name of imported theories. Import transitive. Unless you need something special: theory M yt h = Main: ISABELLE THEORIES 26-A

94 NATURAL DEDUCTION RULES A B conji A B C conje A B A B disji1/2 A B C disje A B impi A B C impe For each connective (,, etc): introduction and elemination rules NATURAL DEDUCTION RULES 27

95 NATURAL DEDUCTION RULES A B A B conji A B C conje A B A B disji1/2 A B C disje A B impi A B C impe For each connective (,, etc): introduction and elemination rules NATURAL DEDUCTION RULES 27-A

96 NATURAL DEDUCTION RULES A B A B conji A B [A; B ] = C C conje A B A B disji1/2 A B C disje A B impi A B C impe For each connective (,, etc): introduction and elemination rules NATURAL DEDUCTION RULES 27-B

97 NATURAL DEDUCTION RULES A B A B conji A B [A; B ] = C C conje A A B B A B disji1/2 A B C disje A B impi A B C impe For each connective (,, etc): introduction and elemination rules NATURAL DEDUCTION RULES 27-C

98 NATURAL DEDUCTION RULES A B A B conji A B [A; B ] = C C conje A A B B A B disji1/2 A B A = C B = C C disje A B impi A B C impe For each connective (,, etc): introduction and elemination rules NATURAL DEDUCTION RULES 27-D

99 NATURAL DEDUCTION RULES A B A B conji A B [A; B ] = C C conje A A B B A B disji1/2 A B A = C B = C C disje A = B A B impi A B C impe For each connective (,, etc): introduction and elemination rules NATURAL DEDUCTION RULES 27-E

100 NATURAL DEDUCTION RULES A B A B conji A B [A; B ] = C C conje A A B B A B disji1/2 A B A = C B = C C disje A = B A B impi A B A B = C C impe For each connective (,, etc): introduction and elemination rules NATURAL DEDUCTION RULES 27-F

101 PROOF BY ASSUMPTION apply assumption proves 1. [B 1 ;... ; B m ] = C by unifying C with one of the B i PROOF BY ASSUMPTION 28

102 PROOF BY ASSUMPTION apply assumption proves 1. [B 1 ;... ; B m ] = C by unifying C with one of the B i There may be more than one matching B i and multiple unifiers. Backtracking! Explicit backtracking command: back PROOF BY ASSUMPTION 28-A

103 INTRO RULES Intro rules decompose formulae to the right of =. apply (rule <intro-rule>) INTRO RULES 29

104 INTRO RULES Intro rules decompose formulae to the right of =. apply (rule <intro-rule>) Intro rule [A 1 ;... ; A n ] = A means To prove A it suffices to show A 1... A n INTRO RULES 29-A

105 INTRO RULES Intro rules decompose formulae to the right of =. apply (rule <intro-rule>) Intro rule [A 1 ;... ; A n ] = A means To prove A it suffices to show A 1... A n Applying rule [A 1 ;... ; A n ] = A to subgoal C: unify A and C replace C with n new subgoals A 1... A n INTRO RULES 29-B

106 ELIM RULES Elim rules decompose formulae on the left of =. apply (erule <elim-rule>) ELIM RULES 30

107 ELIM RULES Elim rules decompose formulae on the left of =. apply (erule <elim-rule>) Elim rule [A 1 ;... ; A n ] = A means If I know A 1 and want to prove A it suffices to show A 2... A n ELIM RULES 30-A

108 ELIM RULES Elim rules decompose formulae on the left of =. apply (erule <elim-rule>) Elim rule [A 1 ;... ; A n ] = A means If I know A 1 and want to prove A it suffices to show A 2... A n Applying rule [A 1 ;... ; A n ] = A to subgoal C: Like rule but also unifies first premise of rule with an assumption eliminates that assumption ELIM RULES 30-B

109 DEMO 31

110 EXERCISES what are the types of λx y. y x and λx y z. x y (y z) construct a type derivation tree on paper for λx y z. x y (y z) find a unifier (substitution) such that λx y.?f x = λx y. c (?G y x) prove (A B C) = (A B C) in Isabelle prove (A B) = A B in Isabelle (tricky!) EXERCISES 32

λ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification

λ Slide 1 Content Exercises from last time λ-calculus COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Content COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ Slide 1 Intro & motivation, getting started [1] Foundations & Principles Lambda

More information

Introduction to Isabelle/HOL

Introduction to Isabelle/HOL Introduction to Isabelle/HOL 1 Notes on Isabelle/HOL Notation In Isabelle/HOL: [ A 1 ;A 2 ; ;A n ]G can be read as if A 1 and A 2 and and A n then G 3 Note: -Px (P x) stands for P (x) (P(x)) -P(x, y) can

More information

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications. Gerwin Klein Formal Methods

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications. Gerwin Klein Formal Methods NICTA Advanced Course Theorem Proving Principles, Techniques, Applications Gerwin Klein Formal Methods 1 ORGANISATORIALS When Mon 14:00 15:30 Wed 10:30 12:00 7 weeks ends Mon, 20.9.2004 Exceptions Mon

More information

COMP6463: λ-calculus

COMP6463: λ-calculus COMP6463: λ-calculus 1. Basics Michael Norrish Michael.Norrish@nicta.com.au Canberra Research Lab., NICTA Semester 2, 2015 Outline Introduction Lambda Calculus Terms Alpha Equivalence Substitution Dynamics

More information

CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008

CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008 CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008 Contents 1 Polymorphism 1 2 Polymorphic λ-calculus: Syntax 1 3 Static Semantics 2 4 Dynamic Semantics

More information

Gerwin Klein, June Andronick, Ramana Kumar S2/2016

Gerwin Klein, June Andronick, Ramana Kumar S2/2016 COMP4161: Advanced Topics in Software Verification {} Gerwin Klein, June Andronick, Ramana Kumar S2/2016 data61.csiro.au Content Intro & motivation, getting started [1] Foundations & Principles Lambda

More information

Automated Reasoning Lecture 5: First-Order Logic

Automated Reasoning Lecture 5: First-Order Logic Automated Reasoning Lecture 5: First-Order Logic Jacques Fleuriot jdf@inf.ac.uk Recap Over the last three lectures, we have looked at: Propositional logic, semantics and proof systems Doing propositional

More information

Beyond First-Order Logic

Beyond First-Order Logic Beyond First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Beyond First-Order Logic MFES 2008/09 1 / 37 FOL

More information

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus CS 4110 Programming Languages & Logics Lecture 16 Programming in the λ-calculus 30 September 2016 Review: Church Booleans 2 We can encode TRUE, FALSE, and IF, as: TRUE λx. λy. x FALSE λx. λy. y IF λb.

More information

Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction

Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction Automated Reasoning Lecture 2: Propositional Logic and Natural Deduction Jacques Fleuriot jdf@inf.ed.ac.uk Logic Puzzles 1. Tomorrow will be sunny or rainy. Tomorrow will not be sunny. What will the weather

More information

Simply Typed λ-calculus

Simply Typed λ-calculus Simply Typed λ-calculus Lecture 1 Jeremy Dawson The Australian National University Semester 2, 2017 Jeremy Dawson (ANU) COMP4630,Lecture 1 Semester 2, 2017 1 / 23 A Brief History of Type Theory First developed

More information

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus

More information

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types

More information

Categories, Proofs and Programs

Categories, Proofs and Programs Categories, Proofs and Programs Samson Abramsky and Nikos Tzevelekos Lecture 4: Curry-Howard Correspondence and Cartesian Closed Categories In A Nutshell Logic Computation 555555555555555555 5 Categories

More information

CSE 505, Fall 2005, Midterm Examination 8 November Please do not turn the page until everyone is ready.

CSE 505, Fall 2005, Midterm Examination 8 November Please do not turn the page until everyone is ready. CSE 505, Fall 2005, Midterm Examination 8 November 2005 Please do not turn the page until everyone is ready. Rules: The exam is closed-book, closed-note, except for one side of one 8.5x11in piece of paper.

More information

Introduction to lambda calculus Part 6

Introduction to lambda calculus Part 6 Introduction to lambda calculus Part 6 Antti-Juhani Kaijanaho 2017-02-16 1 Untyped lambda calculus 2 Typed lambda calculi 2.1 Dynamically typed lambda calculus with integers 2.2 A model of Lisp 2.3 Simply

More information

Lecture Notes on Heyting Arithmetic

Lecture Notes on Heyting Arithmetic Lecture Notes on Heyting Arithmetic 15-317: Constructive Logic Frank Pfenning Lecture 8 September 21, 2017 1 Introduction In this lecture we discuss the data type of natural numbers. They serve as a prototype

More information

Isabelle/FOL First-Order Logic

Isabelle/FOL First-Order Logic Isabelle/FOL First-Order Logic Larry Paulson and Markus Wenzel August 15, 2018 Contents 1 Intuitionistic first-order logic 2 1.1 Syntax and axiomatic basis................... 2 1.1.1 Equality..........................

More information

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007 CSE 230: Winter 2007 Principles of Programming Languages Lecture 12: The λ-calculus Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2 Several evaluation

More information

Automated Reasoning Lecture 17: Inductive Proof (in Isabelle)

Automated Reasoning Lecture 17: Inductive Proof (in Isabelle) Automated Reasoning Lecture 17: Inductive Proof (in Isabelle) Jacques Fleuriot jdf@inf.ed.ac.uk Recap Previously: Unification and Rewriting This time: Proof by Induction (in Isabelle) Proof by Mathematical

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

More information

Programming Languages

Programming Languages CSE 230: Winter 2010 Principles of Programming Languages Lecture 10: Programming in λ-calculusc l l Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2

More information

Propositional Logic: Deductive Proof & Natural Deduction Part 1

Propositional Logic: Deductive Proof & Natural Deduction Part 1 Propositional Logic: Deductive Proof & Natural Deduction Part 1 CS402, Spring 2016 Shin Yoo Deductive Proof In propositional logic, a valid formula is a tautology. So far, we could show the validity of

More information

07 Equational Logic and Algebraic Reasoning

07 Equational Logic and Algebraic Reasoning CAS 701 Fall 2004 07 Equational Logic and Algebraic Reasoning Instructor: W. M. Farmer Revised: 17 November 2004 1 What is Equational Logic? Equational logic is first-order logic restricted to languages

More information

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig

First-Order Logic First-Order Theories. Roopsha Samanta. Partly based on slides by Aaron Bradley and Isil Dillig First-Order Logic First-Order Theories Roopsha Samanta Partly based on slides by Aaron Bradley and Isil Dillig Roadmap Review: propositional logic Syntax and semantics of first-order logic (FOL) Semantic

More information

CSE 505, Fall 2009, Midterm Examination 5 November Please do not turn the page until everyone is ready.

CSE 505, Fall 2009, Midterm Examination 5 November Please do not turn the page until everyone is ready. CSE 505, Fall 2009, Midterm Examination 5 November 2009 Please do not turn the page until everyone is ready Rules: The exam is closed-book, closed-note, except for one side of one 85x11in piece of paper

More information

Focusing on Binding and Computation

Focusing on Binding and Computation Focusing on Binding and Computation Dan Licata Joint work with Noam Zeilberger and Robert Harper Carnegie Mellon University 1 Programming with Proofs Represent syntax, judgements, and proofs Reason about

More information

Learning Goals of CS245 Logic and Computation

Learning Goals of CS245 Logic and Computation Learning Goals of CS245 Logic and Computation Alice Gao April 27, 2018 Contents 1 Propositional Logic 2 2 Predicate Logic 4 3 Program Verification 6 4 Undecidability 7 1 1 Propositional Logic Introduction

More information

Propositional Logic. CS 3234: Logic and Formal Systems. Martin Henz and Aquinas Hobor. August 26, Generated on Tuesday 31 August, 2010, 16:54

Propositional Logic. CS 3234: Logic and Formal Systems. Martin Henz and Aquinas Hobor. August 26, Generated on Tuesday 31 August, 2010, 16:54 Propositional Logic CS 3234: Logic and Formal Systems Martin Henz and Aquinas Hobor August 26, 2010 Generated on Tuesday 31 August, 2010, 16:54 1 Motivation In traditional logic, terms represent sets,

More information

Inductive Definitions with Inference Rules 1 / 27

Inductive Definitions with Inference Rules 1 / 27 Inductive Definitions with Inference Rules 1 / 27 Outline Introduction Specifying inductive definitions Inference rules in action Judgments, axioms, and rules Reasoning about inductive definitions Direct

More information

Non-Idempotent Typing Operators, beyond the λ-calculus

Non-Idempotent Typing Operators, beyond the λ-calculus Non-Idempotent Typing Operators, beyond the λ-calculus Soutenance de thèse Pierre VIAL IRIF (Univ. Paris Diderot and CNRS) December 7, 2017 Non-idempotent typing operators P. Vial 0 1 /46 Certification

More information

Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. Radboud University Nijmegen. March 5, 2012

Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky. Radboud University Nijmegen. March 5, 2012 1 λ Henk Barendregt and Freek Wiedijk assisted by Andrew Polonsky Radboud University Nijmegen March 5, 2012 2 reading Femke van Raamsdonk Logical Verification Course Notes Herman Geuvers Introduction to

More information

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE

Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 CSE 6341 1 Outline Introduction What are axiomatic semantics? First-order logic & assertions about states Results (triples)

More information

MP 5 Program Transition Systems and Linear Temporal Logic

MP 5 Program Transition Systems and Linear Temporal Logic MP 5 Program Transition Systems and Linear Temporal Logic CS 477 Spring 2018 Revision 1.0 Assigned April 10, 2018 Due April 17, 2018, 9:00 PM Extension extend48 hours (penalty 20% of total points possible)

More information

Depending on equations

Depending on equations Depending on equations A proof-relevant framework for unification in dependent type theory Jesper Cockx DistriNet KU Leuven 3 September 2017 Unification for dependent types Unification is used for many

More information

Discrete Mathematics

Discrete Mathematics Discrete Mathematics Jeremy Siek Spring 2010 Jeremy Siek Discrete Mathematics 1 / 24 Outline of Lecture 3 1. Proofs and Isabelle 2. Proof Strategy, Forward and Backwards Reasoning 3. Making Mistakes Jeremy

More information

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 17 Tuesday, April 2, 2013 1 There is a strong connection between types in programming languages and propositions

More information

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1) COSE212: Programming Languages Lecture 1 Inductive Definitions (1) Hakjoo Oh 2017 Fall Hakjoo Oh COSE212 2017 Fall, Lecture 1 September 4, 2017 1 / 9 Inductive Definitions Inductive definition (induction)

More information

Simply Typed Lambda-Calculi (II)

Simply Typed Lambda-Calculi (II) THEORY AND PRACTICE OF FUNCTIONAL PROGRAMMING Simply Typed Lambda-Calculi (II) Dr. ZHANG Yu Institute of Software, Chinese Academy of Sciences Fall term, 2011 GUCAS, Beijing Introduction PCF Programming

More information

Supplementary Notes on Inductive Definitions

Supplementary Notes on Inductive Definitions Supplementary Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 29, 2002 These supplementary notes review the notion of an inductive definition

More information

Program Analysis Part I : Sequential Programs

Program Analysis Part I : Sequential Programs Program Analysis Part I : Sequential Programs IN5170/IN9170 Models of concurrency Program Analysis, lecture 5 Fall 2018 26. 9. 2018 2 / 44 Program correctness Is my program correct? Central question for

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

Program-ing in Coq. Matthieu Sozeau under the direction of Christine Paulin-Mohring

Program-ing in Coq. Matthieu Sozeau under the direction of Christine Paulin-Mohring Program-ing in Coq Matthieu Sozeau under the direction of Christine Paulin-Mohring LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project Foundations of Programming seminar February 15th 2008

More information

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11.

CSC 7101: Programming Language Structures 1. Axiomatic Semantics. Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11. Axiomatic Semantics Stansifer Ch 2.4, Ch. 9 Winskel Ch.6 Slonneger and Kurtz Ch. 11 1 Overview We ll develop proof rules, such as: { I b } S { I } { I } while b do S end { I b } That allow us to verify

More information

M a s t e r r e s e a rc h I n t e r n s h i p. Formalisation of Ground Inference Systems in a Proof Assistant

M a s t e r r e s e a rc h I n t e r n s h i p. Formalisation of Ground Inference Systems in a Proof Assistant M a s t e r r e s e a rc h I n t e r n s h i p Master Thesis Formalisation of Ground Inference Systems in a Proof Assistant Domain: Data Structures and Algorithms - Logic in Computer Science Author: Mathias

More information

HOAS by example What is a Formal System? A Simply Typed Framework What Does it Mean? Canonical LF References HOAS. Randy Pollack

HOAS by example What is a Formal System? A Simply Typed Framework What Does it Mean? Canonical LF References HOAS. Randy Pollack HOAS Randy Pollack Version of November 2, 2011 Outline 1 HOAS by example 2 What is a Formal System? 3 A Simply Typed Framework 4 What Does it Mean? 5 Canonical LF Judgement Forms and Rules Hereditary Substitution

More information

Extending the Lambda Calculus: An Eager Functional Language

Extending the Lambda Calculus: An Eager Functional Language Syntax of the basic constructs: Extending the Lambda Calculus: An Eager Functional Language canonical forms z cfm ::= intcfm boolcfm funcfm tuplecfm altcfm intcfm ::= 0 1-1... boolcfm ::= boolconst funcfm

More information

HORSes: format, termination and confluence

HORSes: format, termination and confluence HORSes: format, termination and confluence Jean-Pierre Jouannaud INRIA-LIAMA and singhua Software Chair Joint on-going work with Jianqi Li School of Software, singhua University Project CoqLF NList Cross-discipline

More information

On the Complexity of the Reflected Logic of Proofs

On the Complexity of the Reflected Logic of Proofs On the Complexity of the Reflected Logic of Proofs Nikolai V. Krupski Department of Math. Logic and the Theory of Algorithms, Faculty of Mechanics and Mathematics, Moscow State University, Moscow 119899,

More information

Logic. Knowledge Representation & Reasoning Mechanisms. Logic. Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning

Logic. Knowledge Representation & Reasoning Mechanisms. Logic. Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning Logic Knowledge Representation & Reasoning Mechanisms Logic Logic as KR Propositional Logic Predicate Logic (predicate Calculus) Automated Reasoning Logical inferences Resolution and Theorem-proving Logic

More information

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering First-Order Logic Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel, Reiner Hähnle (Chalmers

More information

Programming Languages and Types

Programming Languages and Types Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Subtyping Motivation With our usual typing rule for applications the term is not well typed. ` t 1 : T 11!T 12 ` t

More information

Modeling and Analysis of Communicating Systems

Modeling and Analysis of Communicating Systems Modeling and Analysis of Communicating Systems Lecture 5: Sequential Processes Jeroen Keiren and Mohammad Mousavi j.j.a.keiren@vu.nl and m.r.mousavi@hh.se Halmstad University March 2015 Outline Motivation

More information

Notes from Yesterday s Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons.

Notes from Yesterday s  Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons. CIS 500 Software Foundations Fall 2006 Notes from Yesterday s Email Discussion November 1 Some lessons This is generally a crunch-time in the semester Slow down a little and give people a chance to catch

More information

Fundamentals of Software Engineering

Fundamentals of Software Engineering Fundamentals of Software Engineering First-Order Logic Ina Schaefer Institute for Software Systems Engineering TU Braunschweig, Germany Slides by Wolfgang Ahrendt, Richard Bubel, Reiner Hähnle (Chalmers

More information

Simply Typed Lambda Calculus

Simply Typed Lambda Calculus Simply Typed Lambda Calculus Language (ver1) Lambda calculus with boolean values t ::= x variable x : T.t abstraction tt application true false boolean values if ttt conditional expression Values v ::=

More information

Classical Propositional Logic

Classical Propositional Logic The Language of A Henkin-style Proof for Natural Deduction January 16, 2013 The Language of A Henkin-style Proof for Natural Deduction Logic Logic is the science of inference. Given a body of information,

More information

Normalization by Evaluation

Normalization by Evaluation Normalization by Evaluation Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University PhD Seminar in Mathematical Engineering EAFIT University, Medellin, Colombia 9

More information

Software Engineering using Formal Methods

Software Engineering using Formal Methods Software Engineering using Formal Methods First-Order Logic Wolfgang Ahrendt 26th September 2013 SEFM: First-Order Logic 130926 1 / 53 Install the KeY-Tool... KeY used in Friday s exercise Requires: Java

More information

Hoare Logic: Reasoning About Imperative Programs

Hoare Logic: Reasoning About Imperative Programs Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Programming Paradigms Functional. (Haskell, SML, OCaml,... ) main paradigm:

More information

Element x is R-minimal in X if y X. R(y, x).

Element x is R-minimal in X if y X. R(y, x). CMSC 22100/32100: Programming Languages Final Exam M. Blume December 11, 2008 1. (Well-founded sets and induction principles) (a) State the mathematical induction principle and justify it informally. 1

More information

The Assignment Axiom (Hoare)

The Assignment Axiom (Hoare) The Assignment Axiom (Hoare) Syntax: V := E Semantics: value of V in final state is value of E in initial state Example: X:=X+ (adds one to the value of the variable X) The Assignment Axiom {Q[E/V ]} V

More information

Type Inference. For the Simply-Typed Lambda Calculus. Peter Thiemann, Manuel Geffken. Albert-Ludwigs-Universität Freiburg. University of Freiburg

Type Inference. For the Simply-Typed Lambda Calculus. Peter Thiemann, Manuel Geffken. Albert-Ludwigs-Universität Freiburg. University of Freiburg Type Inference For the Simply-Typed Lambda Calculus Albert-Ludwigs-Universität Freiburg Peter Thiemann, Manuel Geffken University of Freiburg 24. Januar 2013 Outline 1 Introduction 2 Applied Lambda Calculus

More information

Introduction. Pedro Cabalar. Department of Computer Science University of Corunna, SPAIN 2013/2014

Introduction. Pedro Cabalar. Department of Computer Science University of Corunna, SPAIN 2013/2014 Introduction Pedro Cabalar Department of Computer Science University of Corunna, SPAIN cabalar@udc.es 2013/2014 P. Cabalar ( Department Introduction of Computer Science University of Corunna, SPAIN2013/2014

More information

Lambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT

Lambda Calculus. Andrés Sicard-Ramírez. Semester Universidad EAFIT Lambda Calculus Andrés Sicard-Ramírez Universidad EAFIT Semester 2010-2 Bibliography Textbook: Hindley, J. R. and Seldin, J. (2008). Lambda-Calculus and Combinators. An Introduction. Cambridge University

More information

Programming with Dependent Types in Coq

Programming with Dependent Types in Coq Programming with Dependent Types in Coq Matthieu Sozeau LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project PPS Seminar February 26th 2009 Paris, France Coq A higher-order, polymorphic logic:

More information

Hoare Logic and Model Checking

Hoare Logic and Model Checking Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Introduction In the

More information

Isabelle/FOL Proof Assistant

Isabelle/FOL Proof Assistant Dec 2014 Isabelle/FOL Proof Assistant In a glance Mohamed Abouelwafa University Of Ottawa OCICS Supervised by Professor: Amy Felty Prepared by Mohamed Abouelwafa Mabou069@uottawa.ca 1 Abstract This tutorial

More information

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw

Applied Logic. Lecture 1 - Propositional logic. Marcin Szczuka. Institute of Informatics, The University of Warsaw Applied Logic Lecture 1 - Propositional logic Marcin Szczuka Institute of Informatics, The University of Warsaw Monographic lecture, Spring semester 2017/2018 Marcin Szczuka (MIMUW) Applied Logic 2018

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 September 2, 2004 These supplementary notes review the notion of an inductive definition and

More information

Type Theory and Constructive Mathematics. Type Theory and Constructive Mathematics Thierry Coquand. University of Gothenburg

Type Theory and Constructive Mathematics. Type Theory and Constructive Mathematics Thierry Coquand. University of Gothenburg Type Theory and Constructive Mathematics Type Theory and Constructive Mathematics Thierry Coquand University of Gothenburg Content An introduction to Voevodsky s Univalent Foundations of Mathematics The

More information

Lecture Notes on Data Abstraction

Lecture Notes on Data Abstraction Lecture Notes on Data Abstraction 15-814: Types and Programming Languages Frank Pfenning Lecture 14 October 23, 2018 1 Introduction Since we have moved from the pure λ-calculus to functional programming

More information

Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison

Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison 1 Reasoning with Higher-Order Abstract Syntax and Contexts: A Comparison Amy Felty University of Ottawa July 13, 2010 Joint work with Brigitte Pientka, McGill University 2 Comparing Systems We focus on

More information

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

Axiomatic Semantics. Lecture 9 CS 565 2/12/08 Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics

More information

Uniform Schemata for Proof Rules

Uniform Schemata for Proof Rules Uniform Schemata for Proof Rules Ulrich Berger and Tie Hou Department of omputer Science, Swansea University, UK {u.berger,cshou}@swansea.ac.uk Abstract. Motivated by the desire to facilitate the implementation

More information

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program

Program verification. Hoare triples. Assertional semantics (cont) Example: Semantics of assignment. Assertional semantics of a program Program verification Assertional semantics of a program Meaning of a program: relation between its inputs and outputs; specified by input assertions (pre-conditions) and output assertions (post-conditions)

More information

3 Propositional Logic

3 Propositional Logic 3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists

More information

A proof checking kernel for the λπ-calculus modulo

A proof checking kernel for the λπ-calculus modulo A proof checking kernel for the λπ-calculus modulo Mathieu Boespflug, École Polytechnique PhD defense, 18 january 2011 Funded by Pythia of Delphi Pythia of Delphi True False Proof implies truth. 1 1 For

More information

Recursion Theory. Joost J. Joosten

Recursion Theory. Joost J. Joosten Recursion Theory Joost J. Joosten Institute for Logic Language and Computation University of Amsterdam Plantage Muidergracht 24 1018 TV Amsterdam Room P 3.26, +31 20 5256095 jjoosten@phil.uu.nl www.phil.uu.nl/

More information

Models of computation

Models of computation Lambda-Calculus (I) jean-jacques.levy@inria.fr 2nd Asian-Pacific Summer School on Formal ethods Tsinghua University, August 23, 2010 Plan computation models lambda-notation bound variables odels of computation

More information

Last Time. Inference Rules

Last Time. Inference Rules Last Time When program S executes it switches to a different state We need to express assertions on the states of the program S before and after its execution We can do it using a Hoare triple written

More information

Theories of Programming Languages Assignment 5

Theories of Programming Languages Assignment 5 Theories of Programming Languages Assignment 5 December 17, 2012 1. Lambda-Calculus (see Fig. 1 for initions of = β, normal order evaluation and eager evaluation). (a) Let Ω = ((λx. x x) (λx. x x)), and

More information

Computer-supported. Modeling and Reasoning. Computer-supported. Exercises and Solutions (Isabelle 2004)

Computer-supported. Modeling and Reasoning. Computer-supported. Exercises and Solutions (Isabelle 2004) Dipl.-Inf. Achim D. Brucker Dr. Burkhart Wolff Computer-supported Modeling and Reasoning http://www.infsec.ethz.ch/ education/permanent/csmr/ (rev. 16826) Computer-supported Modeling and Reasoning Exercises

More information

Natural Deduction for Propositional Logic

Natural Deduction for Propositional Logic Natural Deduction for Propositional Logic Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 10, 2018 Bow-Yaw Wang (Academia Sinica) Natural Deduction for Propositional Logic

More information

Type Systems Winter Semester 2006

Type Systems Winter Semester 2006 Type Systems Winter Semester 2006 Week 7 November 29 November 29, 2006 - version 1.0 Plan PREVIOUSLY: 1. type safety as progress and preservation 2. typed arithmetic expressions 3. simply typed lambda

More information

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures CS 6110 S18 Lecture 21 Products, Sums, and Other Datatypes 1 Introduction In this lecture, we add constructs to the typed λ-calculus that allow working with more complicated data structures, such as pairs,

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 28, 2003 These supplementary notes review the notion of an inductive definition and give

More information

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either Introduction to Temporal Logic The purpose of temporal logics is to specify properties of dynamic systems. These can be either Desired properites. Often liveness properties like In every infinite run action

More information

The Curry-Howard Isomorphism

The Curry-Howard Isomorphism The Curry-Howard Isomorphism Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) The Curry-Howard Isomorphism MFES 2008/09

More information

Miscellaneous Isabelle/Isar examples

Miscellaneous Isabelle/Isar examples Miscellaneous Isabelle/Isar examples Makarius Wenzel With contributions by Gertrud Bauer and Tobias Nipkow October 8, 2017 Abstract Isar offers a high-level proof (and theory) language for Isabelle. We

More information

Which simple types have a unique inhabitant?

Which simple types have a unique inhabitant? Under consideration for publication in J. Functional Programming 1 Which simple types have a unique inhabitant? Gabriel Scherer Northeastern University Didier Rémy INRIA Paris Abstract Some programming

More information

Classical First-Order Logic

Classical First-Order Logic Classical First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) First-Order Logic (Classical) MFES 2008/09

More information

Computational Logic for Computer Science

Computational Logic for Computer Science Motivation: formalization - proofs & deduction Computational proofs - logic & deduction Formal proofs Pr Computational Logic for Computer Science Mauricio Ayala-Rinco n & Fla vio L.C. de Moura Grupo de

More information

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning About Imperative Programs. COS 441 Slides 10b Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program

More information

Topics in Model-Based Reasoning

Topics in Model-Based Reasoning Towards Integration of Proving and Solving Dipartimento di Informatica Università degli Studi di Verona Verona, Italy March, 2014 Automated reasoning Artificial Intelligence Automated Reasoning Computational

More information

5. The Logical Framework

5. The Logical Framework 5. The Logical Framework (a) Judgements. (b) Basic form of rules. (c) The non-dependent function type and product. (d) Structural rules. (Omitted 2008). (e) The dependent function set and -quantification.

More information

Program verification using Hoare Logic¹

Program verification using Hoare Logic¹ Program verification using Hoare Logic¹ Automated Reasoning - Guest Lecture Petros Papapanagiotou Part 2 of 2 ¹Contains material from Mike Gordon s slides: Previously on Hoare Logic A simple while language

More information

23.1 Gödel Numberings and Diagonalization

23.1 Gödel Numberings and Diagonalization Applied Logic Lecture 23: Unsolvable Problems in Logic CS 4860 Spring 2009 Tuesday, April 14, 2009 The fact that Peano Arithmetic is expressive enough to represent all computable functions means that some

More information

Lecture 11: Gödel s Second Incompleteness Theorem, and Tarski s Theorem

Lecture 11: Gödel s Second Incompleteness Theorem, and Tarski s Theorem Lecture 11: Gödel s Second Incompleteness Theorem, and Tarski s Theorem Valentine Kabanets October 27, 2016 1 Gödel s Second Incompleteness Theorem 1.1 Consistency We say that a proof system P is consistent

More information