CIS 500: Software Foundations
|
|
- Toby Carpenter
- 5 years ago
- Views:
Transcription
1 CIS 500: Software Foundations Midterm I October 4, 2016 Name (printed): Username (PennKey login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in completing this examination. Signature: Date: Directions: This exam booklet contains both the standard and advanced track questions. Questions with no annotation are for both tracks. Other questions are marked Standard Only or Advanced Only. Do not waste time answering questions intended for the other track. Mark the box of the track you are following. (If you are following one track but want to move to the other now, please mark the box for the track you want to be on and write a note on this page telling us that we should switch you to this track.) Standard Advanced
2 1. (9 points) Circle or for each statement. (a) If the term (In 3 [1;2;3]) is the goal of your proof state, using the tactic simpl will simplify it to. (The definition of In is given in the appendix.) (b) In Coq all functions terminate (i.e. they cannot go into an infinite loop on any input). (c) The proposition cannot be proved in Coq, no matter what axioms we add. (d) if H : S (S x) = S y is a current assumption, then inversion H will solve any goal. (e) The axiom of functional extensionality states that forall (A B:Type) (f g: A -> B), (exists x : A, f x = g x) -> f = g (f) [] =~ Star re is provable for every re. (The definition of =~ is given in the appendix.) (g) If we assume s =~ EmptySet in Coq, then we can prove s =~ EmptyStr. (h) A boolean function f : nat -> bool reflects a property P of numbers (P : nat -> Prop) exactly when forall (n:nat), (f n = true) <-> P n. (i) For every property of numbers P : nat -> Prop, we can construct a boolean function testp : nat -> bool such that testp reflects P. 1
3 2. (10 points) Write the type of each of the following Coq expressions, or write ill-typed if it does not have one. (a) 3 = 4 (b) beq_nat 3 4 (c) forall (x:nat), beq_nat x x (d) fun (n : nat) => ev n (e) fun n => forall m, leb m n = true (f) if beq_nat 0 1 then (fun n => plus n 5) else plus 6 (g) fun (X:Type) (x:x) => x :: nil 2
4 (h) (fun n => plus n) 3 (i) fun P => (P \/ ) (j) ev_ss 3
5 3. [Standard Only] (16 points) For each of the types below, write a Coq expression that has that type or write Empty if there are no such expressions. (a) forall (X Y : Type), option X -> option Y (b) nat -> nat -> nat (c) bool -> Prop (d) forall (X : Type), (X -> X) -> X (e) 3 <= 2 (f) 1 <= 2 (g) [2] =~ (Char 2) (h) [20, 10] =~ (App (Char 20) (Char 10)) 4
6 4. (11 points) For each of the following propositions, write not provable if it is not provable (in Coq s core logic, without additional axioms), needs induction if it is provable only using induction, or easy if it is provable without using induction and without additional lemmas. (a) In 3 [1;2;3;4;5] (b) forall s, In 3 ([1;2;3] ++ s) (c) forall s, In 3 (s ++ [1;2;3]) (d) exists s, In 3 (s ++ [1;2;3]) (e) exists (x y : list nat), x ++ y = y ++ x (f) forall n, n+5 <= n+6 (g) forall f g, (forall x, f x = g x) -> f = g 5
7 (h) forall x y, x * y = y * x (i) forall P : Prop, P \/ ~P (j) forall P : Prop, P -> ~~P (k) forall P : Prop, P 6
8 5. This problem asks you to translate mathematical ideas from English into Coq. (a) (3 points) In class, we saw how to define the relation In using a Fixpoint (the definition is repeated in the appendix). Give an alternative definition of In as an Inductive relation IndIn, such that IndIn x l holds exactly when In x l holds. Do not use In in your solution. Inductive IndIn {X:Type} : X -> list X -> Prop := (b) (4 points) Define an inductive relation that holds exactly when every element of a list appears at most once that is, there are no duplicate elements in the list. This time, you may use the definition of In in your solution. Inductive Unique {X : Type} : list X -> Prop := 7
9 (c) (5 points) Consider the following inductively defined relation Doubles, which holds exactly when each element in the list is immediately repeated (e.g., Doubles holds for the lists [], [1;1], [1;1;2;2;1;1], [1;1;1;1], but not for the lists [1] or [1;1;1]). Inductive Doubles {X:Type} : list X -> Prop := DoublesNil: Doubles [] DoublesCons: forall x l, Doubles l -> Doubles (x :: x :: l). Give an alternative definition of Doubles as a Fixpoint DoublesP, such that DoublesP l holds exactly when Doubles l holds. Do not use Doubles in your solution. Fixpoint DoublesP {X:Type} (l: list X) : Prop := 8
10 (d) (8 points) Give an inductively defined property that specifies whether a regular expression re is nullable that is, when it can match the empty string. For example, the regular expressions EmptyStr Star (Char 10) Union (Union (Char 20) EmptyStr) (Char 10) are all nullable, while Char 10 App (Char 10) (Star (Char 20)) Union (Char 10) (Char 20) are not nullable. Inductive Nullable {X:Type} : reg_exp X -> Prop := 9
11 6. An alternate way to encode lists in Coq is the dlist ( doubly-ended list ) type, which has a third constructor corresponding to a cons at the end (snoc) operation on regular lists, as shown below: Inductive dlist (X:Type) : Type := d_nil : dlist X d_cons : X -> dlist X -> dlist X d_snoc : dlist X -> X -> dlist X. (* Make the type parameter implicit. *) Arguments d_nil {X}. Arguments d_cons {X}. Arguments d_snoc {X}. We can convert any dlist to a regular list using the following function (the definition of snoc is given in the references). Fixpoint to_list {X} (dl: dlist X) : list X := match dl with d_nil => [] d_cons x l => x::(to_list l) d_snoc l x => snoc (to_list l) x (a) (2 points) As we saw in the homework with the alternate binary encoding of natural numbers, there may be multiple dlists that represent the same list. Demonstrate this by giving definitions of example1 and example2 such that the lemma distinct_dlists_but_same_list below is provable (there is no need to prove it). Definition example1 : dlist nat := Definition example2 : dlist nat := Lemma distinct_dlists_but_same_list : example1 <> example2 /\ (to_list example1) = (to_list example2). 10
12 (b) (6 points) We can define list operations directly on the dlist representation. Complete the following function for appending two dlists. (Your function should work by recursion on l1.) Fixpoint dapp {X} (l1 l2: dlist X) : dlist X := (c) (6 points) The dapp function from part (b) should satisfy the following correctness lemma stating that it agrees with the list append operation ++ (whose definition is given in the appendix). Lemma dapp_correct : forall (X:Type) (l1 l2:dlist X), to_list (dapp l1 l2) = (to_list l1) ++ (to_list l2). Proof. intros X l1. induction l1 as [ x l l x]. Case "d_nil".... Case "d_cons".... Case "d_snoc".... Qed. What induction hypothesis is available in the d_cons case of the proof? (Circle one.) i. to_list (dapp (d_cons x l) l2) = (to_list (d_cons x l)) ++ (to_list l2) ii. to_list (dapp l l2) = (to_list l) ++ (to_list l2) iii. forall l2 : dlist X, to_list (dapp l l2) = to_list l ++ to_list l2 iv. forall l2 : dlist X, to_list (dapp (d_cons x l) l2) = to_list (d_cons x l) ++ to_list l2 What induction hypothesis is available in the d_snoc case of the proof? (Circle one.) i. to_list (dapp (d_snoc l x) l2) = (to_list (d_snoc l x)) ++ (to_list l2) ii. to_list (dapp l l2) = (to_list l) ++ (to_list l2) iii. forall l2 : dlist X, to_list (dapp l l2) = to_list l ++ to_list l2 iv. forall l2 : dlist X, to_list (dapp (d_snoc l x) l2) = to_list (d_snoc l x) ++ to_list l2 11
13 7. [Advanced Only] (16 points) Fill in the indicated cases of a careful informal proof of the following theorem from Software Foundations: Theorem: For all strings s, regular expressions re, and characters x, if s =~ re and In x s, then In x (re chars re). Your proof may use the following lemma: Lemma in_app_iff: In a (l++l ) if and only if In a l or In a l, for all lists l and l and elements a. Proof: Proceed by induction on the evidence that s =~ re. Cases MEmpty, MApp, MUnionL, MUnionR: (Omitted. Do not worry about these cases.) Case MChar: If the rule used to prove s =~ re is MChar, we know that re is Char x and s is the singleton list [x ]. (Fill in the rest of this case and the two cases below...) Case MStar0: Case MStarApp: 12
14 For Reference Numbers Inductive nat : Type := O : nat S : nat -> nat. Fixpoint plus (n : nat) (m : nat) : nat := match n with O => m S n => S (plus n m) Notation "x + y" := (plus x y)(at level 50, left associativity) : nat_scope. Fixpoint mult (n : nat) (m : nat) : nat := match n with 0 => 0 S n => m + (mult n m) Notation "x * y" := (mult x y)(at level 40, left associativity) : nat_scope. Inductive le : nat -> nat -> Prop := le_n : forall n, le n n le_s : forall n m, (le n m) -> (le n (S m)). Notation "m <= n" := (le m n). Fixpoint beq_nat (n m : nat) : bool := match n, m with O, O => true S n, S m => beq_nat n m _, _ => false Fixpoint leb (n m : nat) : bool := match n with O => true S n => match m with O => false S m => leb n m end Inductive ev : nat -> Prop := ev_0 : ev 0 ev_ss : forall n : nat, ev n -> ev (S (S n)). 1
15 Options Inductive option (X:Type) : Type := Some : X -> option X None : option X. Arguments Some {X} _. Arguments None {X}. Lists Inductive list (X:Type) : Type := nil : list X cons : X -> list X -> list X. Definition snoc (X:Type) (l:list X) (x:x) := app l (cons x nil). Fixpoint In {A : Type} (x : A) (l : list A) : Prop := match l with [] => x :: l => x = x \/ In x l Fixpoint length (X:Type) (l:list X) : nat := match l with [] => 0 h :: t => S (length X t) Fixpoint index {X : Type} (n : nat) (l : list X) : option X := match l with [] => None h :: t => if beq_nat n O then Some h else index (pred n) t Fixpoint app {X : Type} (l1 l2 : list X) : (list X) := match l1 with [] => l2 h :: t => h :: (app t l2) Notation "x ++ y" := (app x y) (at level 60, right associativity). Fixpoint map {X Y:Type} (f:x->y) (l:list X) : (list Y) := match l with [] => [] h :: t => (f h) :: (map f t) 2
16 Fixpoint filter {X:Type} (test: X->bool) (l:list X) : (list X) := match l with [] => [] h :: t => if test h then h :: (filter test t) else filter test t Regular Expressions Inductive reg_exp (T : Type) : Type := EmptySet : reg_exp T EmptyStr : reg_exp T Char : T -> reg_exp T App : reg_exp T -> reg_exp T -> reg_exp T Union : reg_exp T -> reg_exp T -> reg_exp T Star : reg_exp T -> reg_exp T. Inductive exp_match {X: Type} : list X -> reg_exp X -> Prop := MEmpty : exp_match [] EmptyStr MChar : forall x, exp_match [x] (Char x) MApp : forall s1 re1 s2 re2, exp_match s1 re1 -> exp_match s2 re2 -> exp_match (s1 ++ s2) (App re1 re2) MUnionL : forall s1 re1 re2, exp_match s1 re1 -> exp_match s1 (Union re1 re2) MUnionR : forall re1 s2 re2, exp_match s2 re2 -> exp_match s2 (Union re1 re2) MStar0 : forall re, exp_match [] (Star re) MStarApp : forall s1 s2 re, exp_match s1 re -> exp_match s2 (Star re) -> exp_match (s1 ++ s2) (Star re). Notation "s =~ re" := (exp_match s re) (at level 80). Fixpoint re_chars {T} (re : reg_exp T) : list T := match re with EmptySet => [] EmptyStr => [] Char x => [x] App re1 re2 => re_chars re1 ++ re_chars re2 Union re1 re2 => re_chars re1 ++ re_chars re2 Star re => re_chars re 3
CIS 500: Software Foundations
CIS 500: Software Foundations Midterm I October 3, 2017 Name (printed): Username (PennKey login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic
More informationCIS 500: Software Foundations
CIS 500: Software Foundations Midterm I October 2, 2018 Name (printed): Username (PennKey login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic
More informationCIS 500 Software Foundations. Midterm I. (Standard and advanced versions together) October 1, 2013 Answer key
CIS 500 Software Foundations Midterm I (Standard and advanced versions together) October 1, 2013 Answer key 1. (12 points) Write the type of each of the following Coq expressions, or write ill-typed if
More informationInfinite Objects and Proofs 1
Infinite Objects and Proofs 1 Pierre Castéran Beijing, August 2009 1 This lecture corresponds to the chapter 13 : Infinite Objects and Proofs of the book. In this lecture, we shall see how to represent
More informationInduction in Coq. Nate Foster Spring 2018
Induction in Coq Nate Foster Spring 2018 Review Previously in 3110: Functional programming in Coq Logic in Coq Curry-Howard correspondence (proofs are programs) Today: Induction in Coq REVIEW: INDUCTION
More informationCS 456 (Fall 2018) Scribe Notes: 2
CS 456 (Fall 2018) Scribe Notes: 2 Albert Yu, Adam Johnston Lists Bags Maps Inductive data type that has an infinite collection of elements Not through enumeration but inductive type definition allowing
More informationInductive data types
Inductive data types Assia Mahboubi 9 juin 2010 In this class, we shall present how Coq s type system allows us to define data types using inductive declarations. Generalities Inductive declarations An
More information3 Pairs and Lists. 3.1 Formal vs. Informal Proofs
3 Pairs and Lists 3.1 Formal vs. Informal Proofs The question of what, exactly, constitutes a proof of a mathematical claim has challenged philosophers throughout the ages. A rough and ready definition,
More informationCoq Summer School, Session 2 : Basic programming with numbers and lists. Pierre Letouzey
Coq Summer School, Session 2 : Basic programming with numbers and lists Pierre Letouzey Predened data structures Predened types are actually declared to Coq at load time 1 : Inductive bool := true false.
More informationMoreIntro_annotated.v. MoreIntro_annotated.v. Printed by Zach Tatlock. Oct 04, 16 21:55 Page 1/10
Oct 04, 16 21:55 Page 1/10 * Lecture 02 Infer some type arguments automatically. Set Implicit Arguments. Note that the type constructor for functions (arrow " >") associates to the right: A > B > C = A
More information4 Programming with Types
4 Programming with Types 4.1 Polymorphism We ve been working a lot with lists of numbers, but clearly programs also need to be able to manipulate lists whose elements are drawn from other types lists of
More informationExpr_annotated.v. Expr_annotated.v. Printed by Zach Tatlock
Oct 05, 16 8:02 Page 1/14 * Lecture 03 Include some useful libraries. Require Import Bool. Require Import List. Require Import String. Require Import ZArith. Require Import Omega. List provides the cons
More informationCIS 120 Midterm I October 2, Name (printed): Username (login id):
CIS 120 Midterm I October 2, 2015 Name (printed): Username (login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in completing this
More informationMoreIntro.v. MoreIntro.v. Printed by Zach Tatlock. Oct 07, 16 18:11 Page 1/10. Oct 07, 16 18:11 Page 2/10. Monday October 10, 2016 lec02/moreintro.
Oct 07, 16 18:11 Page 1/10 * Lecture 02 Set Implicit Arguments. Inductive list (A: Type) : Type := nil : list A cons : A > list A > list A. Fixpoint length (A: Type) (l: list A) : nat := nil _ => O cons
More informationAugust 5-10, 2013, Tsinghua University, Beijing, China. Polymorphic types
5th Asian-Pacific Summer School on Formal Methods August 5-10, 2013, Tsinghua University, Beijing, China Polymorphic types jean-jacques.levy@inria.fr 2013-8-8 http://sts.thss.tsinghua.edu.cn/coqschool2013
More informationProgramming with (co-)inductive types in Coq
Programming with (co-)inductive types in Coq Matthieu Sozeau February 3rd 2014 Programming with (co-)inductive types in Coq Matthieu Sozeau February 3rd 2014 Last time 1. Record Types 2. Mathematical Structures
More informationIntroduction to Co-Induction in Coq
August 2005 Motivation Reason about infinite data-structures, Reason about lazy computation strategies, Reason about infinite processes, abstracting away from dates. Finite state automata, Temporal logic,
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 informationCIS 500 Software Foundations. Final Exam. May 3, Answer key
CIS 500 Software Foundations Final Exam May 3, 2012 Answer key This exam includes material on the Imp language and the simply-typed lambda calculus. Some of the key definitions are repeated, for easy reference,
More informationCIS 500: Software Foundations
CIS 500: Software Foundations Midterm II November 9, 2017 Name (printed): Username (PennKey login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic
More informationCertified Programming with Dependent Types
1/30 Certified Programming with Dependent Types Inductive Predicates Niels van der Weide March 7, 2017 2/30 Last Time We discussed inductive types Print nat. (* Inductive nat : Set := O : nat S : nat nat*)
More informationCIS 500 Software Foundations Midterm II
CIS 500 Software Foundations Midterm II March 31, 2010 Name: PennKey: Score 1 2 3 4 5 6 7 8 Total Instructions This is a closed-book exam: you may not use any books or notes. You have 80 minutes to answer
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 informationc constructor P, Q terms used as propositions G, H hypotheses scope identifier for a notation scope M, module identifiers t, u arbitrary terms
Coq quick reference Meta variables Usage Meta variables Usage c constructor P, Q terms used as propositions db identifier for a hint database s string G, H hypotheses scope identifier for a notation scope
More informationCoq quick reference. Category Example Description. Inductive type with instances defined by constructors, including y of type Y. Inductive X : Univ :=
Coq quick reference Category Example Description Meta variables Usage Meta variables Usage c constructor P, Q terms used as propositions db identifier for a hint database s string G, H hypotheses scope
More informationMathematics for Computer Scientists 2 (G52MC2)
Mathematics for Computer Scientists 2 (G52MC2) L03 : More Coq, Classical Logic School of Computer Science University of Nottingham October 8, 2009 The cut rule Sometimes we want to prove a goal Q via an
More informationCIS 500 Software Foundations Midterm I
CIS 500 Software Foundations Midterm I October 11, 2006 Name: Student ID: Email: Status: Section: registered for the course not registered: sitting in to improve a previous grade not registered: just taking
More informationInductive data types (I)
5th Asian-Pacific Summer School on Formal Methods August 5-10, 2013, Tsinghua University, Beijing, China Inductive data types (I) jean-jacques.levy@inria.fr 2013-8-6 http://sts.thss.tsinghua.edu.cn/coqschool2013
More informationAnalysis of dependent types in Coq through the deletion of the largest node of a binary search tree
Analysis of dependent types in Coq through the deletion of the largest node of a binary search tree Sneha Popley and Stephanie Weirich August 14, 2008 Abstract Coq reflects some significant differences
More informationCIS 120 Midterm II November 8, Name (printed): Pennkey (login id):
CIS 120 Midterm II November 8, 2013 Name (printed): Pennkey (login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in completing
More informationTheorem Proving Principles, Techniques, Applications Recursion
NICTA Advanced Course Theorem Proving Principles, Techniques, Applications Recursion 1 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic,
More informationCoq in a Hurry. Yves Bertot
Coq in a Hurry Yves Bertot To cite this version: Yves Bertot. Coq in a Hurry. Types Summer School, also used at the University of Nice Goteborg, Nice, 2006. HAL Id: inria-00001173 https://cel.archives-ouvertes.fr/inria-00001173v2
More informationCoq Summer School. Yves Bertot
Coq Summer School Yves Bertot Introduction Welcome! Coq from the practical side But Theory has practical benets, too. Start from what we expect you know: programming Need to learn a new programming language!
More informationA Coq tutorial for confirmed Proof system users
August 2008 Presentation Get it at http://coq.inria.fr pre-compiled binaries for Linux, Windows, Mac OS, commands: coqtop or coqide (user interface), Also user interface based on Proof General, Historical
More informationA Simple Supercompiler Formally Verified in Coq
A Simple Supercompiler Formally Verified in Coq IGE+XAO Balkan 4 July 2010 / META 2010 Outline 1 Introduction 2 3 Test Generation, Extensional Equivalence More Realistic Language Use Information Propagation
More informationCoq in a Hurry. Yves Bertot. HAL Id: inria https://cel.archives-ouvertes.fr/inria v5
Coq in a Hurry Yves Bertot To cite this version: Yves Bertot. Coq in a Hurry. 3rd cycle. Types Summer School, also used at the University of Goteborg, Nice,Ecole Jeunes Chercheurs en Programmation,Universite
More informationCIS 500 Software Foundations Midterm II. Review questions
CIS 500 Software Foundations Midterm II Review questions November 11, 2007 The following problems should give you a general idea of the style and coverage of the exam questions. Note that this is not a
More informationInductive prod (A B : Set) : Set := pair : A -> B -> prod A B. Inductive sum (A B : Set) : Set := inl : A -> sum A B inr : B -> sum A B.
Jacques Garrigue, 2013 5 10 1 Coq Inductive nat : Set := O S -> nat. Coq 1 Inductive prod (A B : Set) : Set := pair : A -> B -> prod A B. Inductive sum (A B : Set) : Set := inl : A -> sum A B inr : B ->
More informationMathematics for Computer Scientists 2 (G52MC2)
Mathematics for Computer Scientists 2 (G52MC2) L07 : Operations on sets School of Computer Science University of Nottingham October 29, 2009 Enumerations We construct finite sets by enumerating a list
More informationCoq. LASER 2011 Summerschool Elba Island, Italy. Christine Paulin-Mohring
Coq LASER 2011 Summerschool Elba Island, Italy Christine Paulin-Mohring http://www.lri.fr/~paulin/laser Université Paris Sud & INRIA Saclay - Île-de-France September 2011 Lecture 4 : Advanced functional
More informationCoq in a Hurry. Yves Bertot. To cite this version: HAL Id: inria https://cel.archives-ouvertes.fr/inria v6
Coq in a Hurry Yves Bertot To cite this version: Yves Bertot. Coq in a Hurry. 3rd cycle. Types Summer School, also used at the University of Goteborg, Nice,Ecole Jeunes Chercheurs en Programmation,Universite
More informationCoq in a Hurry. Yves Bertot. October 2008
Coq in a Hurry Yves Bertot October 2008 arxiv:cs/0603118v3 [cs.lo] 7 Nov 2008 These notes provide a quick introduction to the Coq system and show how it can be used to define logical concepts and functions
More informationSOFTWARE VERIFICATION AND COMPUTER PROOF (lesson 1) Enrico Tassi Inria Sophia-Antipolis
SOFTWARE VERIFICATION AND COMPUTER PROOF (lesson 1) Enrico Tassi Inria Sophia-Antipolis Who am I? 1. I'm a researcher at Inria 2. I work on proof assistants, the kind of tools that we will be using for
More informationProgramming with dependent types: passing fad or useful tool?
Programming with dependent types: passing fad or useful tool? Xavier Leroy INRIA Paris-Rocquencourt IFIP WG 2.8, 2009-06 X. Leroy (INRIA) Dependently-typed programming 2009-06 1 / 22 Dependent types In
More informationVerification in Coq. Prof. Clarkson Fall Today s music: Check Yo Self by Ice Cube
Verification in Coq Prof. Clarkson Fall 2017 Today s music: Check Yo Self by Ice Cube Review Previously in 3110: Functional programming in Coq Logic in Coq Curry-Howard correspondence (proofs are programs)
More informationCIS 120 Midterm I February 16, 2015 SOLUTIONS
CIS 120 Midterm I February 16, 2015 SOLUTIONS 1 1. Substitution semantics (18 points) Circle the final result of simplifying the following OCaml expressions, or Infinite loop if there is no final answer.
More informationVector Clocks in Coq
Vector Clocks in Coq An Experience Report Christopher Meiklejohn Basho Technologies, Inc. Cambridge, MA 02139 cmeiklejohn@basho.com March 6, 2014 Outline of the talk Introduction Background Implementation
More informationCSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections p.
CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Sections 10.1-10.3 p. 1/106 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer
More informationNow that we have keys defined for the maps, we can start talking about maps. The first of these are Total Maps. Total Maps are defined as follows:
Ian Renfro and Peter Xeros CS 456 : Notes 1: Maps Strings: Before we can talk about maps we need to define strings and ids. These will the keys for our maps. We will also need to define comparison functions
More informationLecture Notes on Induction and Recursion
Lecture Notes on Induction and Recursion 15-317: Constructive Logic Frank Pfenning Lecture 7 September 19, 2017 1 Introduction At this point in the course we have developed a good formal understanding
More informationProgramming Languages Fall 2014
Programming Languages Fall 2014 Lecture 7: Simple Types and Simply-Typed Lambda Calculus Prof. Liang Huang huang@qc.cs.cuny.edu 1 Types stuck terms? how to fix it? 2 Plan First I For today, we ll go back
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 informationFall 2013 Midterm Exam 10/22/13. This is a closed-book, closed-notes exam. Problem Points Score. Various definitions are provided in the exam.
Programming Languages Fall 2013 Midterm Exam 10/22/13 Time Limit: 100 Minutes Name (Print): Graduate Center I.D. This is a closed-book, closed-notes exam. Various definitions are provided in the exam.
More informationCIS 194: Homework 8. Due Wednesday, 8 April. Propositional Logic. Implication
CIS 194: Homework 8 Due Wednesday, 8 April Propositional Logic In this section, you will prove some theorems in Propositional Logic, using the Haskell compiler to verify your proofs. The Curry-Howard isomorphism
More informationLesson 4 Typed Arithmetic Typed Lambda Calculus
Lesson 4 Typed Arithmetic Typed Lambda 1/28/03 Chapters 8, 9, 10 Outline Types for Arithmetic types the typing relation safety = progress + preservation The simply typed lambda calculus Function types
More informationIntroduction to the Coq proof assistant First part
Introduction to the Coq proof assistant First part A user point of view Catherine Dubois 1 1 ENSIIE - CEDRIC, Évry, France TOOLS 2011 Most examples used in the slides can be downloaded from the TOOLS web
More informationAXIOMS FOR THE INTEGERS
AXIOMS FOR THE INTEGERS BRIAN OSSERMAN We describe the set of axioms for the integers which we will use in the class. The axioms are almost the same as what is presented in Appendix A of the textbook,
More informationHeq: a Coq library for Heterogeneous Equality
Heq: a Coq library for Heterogeneous Equality Chung-Kil Hur PPS, Université Paris Diderot Abstract. We give an introduction to the library Heq, which provides a set of tactics to manipulate heterogeneous
More informationThe University of Nottingham
The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER 2013-2014 G54FOP FOUNDATIONS OF PROGRAMMING Time allowed 2 hours Candidates may complete the front cover of their
More informationtype classes & locales
Content Rough timeline Intro & motivation, getting started [1] COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray type classes & locales
More informationName: Entry: Gp: 1. CSL 102: Introduction to Computer Science. Minor 2 Mon 21 Mar 2005 VI 301(Gps 1-6)& VI 401(Gps 7-8) 9:30-10:30 Max Marks 40
Name: Entry: Gp: 1 CSL 102: Introduction to Computer Science Minor 2 Mon 21 Mar 2005 VI 301(Gps 1-6)& VI 401(Gps 7-8) 9:30-10:30 Max Marks 40 1. Answer in the space provided on the question paper. 2. The
More informationFormalizing inference systems in Coq by means of type systems for Curry
Formalizing inference systems in Coq by means of type systems for Curry Niels Bunkenburg Bachelor s Thesis Programming Languages and Compiler Construction Department of Computer Science Christian-Albrechts-University
More informationProvably Correct Software
Provably Correct Software Max Schäfer Institute of Information Science/Academia Sinica September 17, 2007 1 / 48 The Need for Provably Correct Software BUT bugs are annoying, embarrassing, and cost gazillions
More informationGADTs. Wouter Swierstra. Advanced functional programming - Lecture 7. Faculty of Science Information and Computing Sciences
GADTs Advanced functional programming - Lecture 7 Wouter Swierstra 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces:
More informationPrinted by Zachary Tatlock Nov 04, 16 8:59 Page 1/9. (** Call By Value << v ::= \ x. e e1 > e1 e1 e2 > e1 e2 e2 > e2 v e2 > v e2
Nov 04, 16 8:59 Page 1/9 Require Import List. Require Import String. Import ListNotations. Open Scope string_scope. Require Import StructTactics. Inductive expr : Set := Var : string > expr Lam : string
More informationGADTs. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 7. [Faculty of Science Information and Computing Sciences]
GADTs Advanced functional programming - Lecture 7 Wouter Swierstra and Alejandro Serrano 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree
More informationGADTs. Alejandro Serrano. AFP Summer School. [Faculty of Science Information and Computing Sciences]
GADTs AFP Summer School Alejandro Serrano 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces: 3 A datatype data
More informationCoq, a formal proof development environment combining logic and programming. Hugo Herbelin
Coq, a formal proof development environment combining logic and programming Hugo Herbelin 1 Coq in a nutshell (http://coq.inria.fr) A logical formalism that embeds an executable typed programming language:
More informationCoq projects for type theory 2018
Coq projects for type theory 2018 Herman Geuvers, James McKinna, Freek Wiedijk February 6, 2018 Here are five projects for the type theory course to choose from. Each student has to choose one of these
More informationStructures in Coq January 27th 2014
MPRI 2-7-2 Proof assistants ~sozeau/teaching/mpri-2-7-2-270114.pdf! Structures in Coq January 27th 2014 Matthieu Sozeau! "r² project team! Inria Paris & PPS! matthieu.sozeau@inria.fr! www.pps /~sozeau
More informationMidterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama
Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all of
More informationProving Properties on Programs From the Coq Tutorial at ITP 2015
Proving Properties on Programs From the Coq Tutorial at ITP 2015 Reynald Affeldt August 29, 2015 Hoare logic is a proof system to verify imperative programs. It consists of a language of Hoare triples
More informationTypes Summer School Gothenburg Sweden August Dogma oftype Theory. Everything has a type
Types Summer School Gothenburg Sweden August 2005 Formalising Mathematics in Type Theory Herman Geuvers Radboud University Nijmegen, NL Dogma oftype Theory Everything has a type M:A Types are a bit like
More informationCIS 500 Software Foundations Fall October 2
CIS 500 Software Foundations Fall 2006 October 2 Preliminaries Homework Results of my email survey: There was one badly misdesigned (PhD) problem and a couple of others that were less well thought through
More informationIA014: Advanced Functional Programming
IA014: Advanced Functional Programming 8. GADT Generalized Algebraic Data Types (and type extensions) Jan Obdržálek obdrzalek@fi.muni.cz Faculty of Informatics, Masaryk University, Brno Motivation IA014
More informationCIS 120 Midterm II November 7, Name (printed): Pennkey (login id):
CIS 120 Midterm II November 7, 2014 Name (printed): Pennkey (login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in completing
More informationIntroduction to Homotopy Type Theory
Introduction to Homotopy Type Theory Lecture notes for a course at EWSCS 2017 Thorsten Altenkirch March 5, 2017 1 What is this course about? To explain what Homotopy Type Theory is, I will first talk about
More informationCIS 110 Introduction To Computer Programming. February 29, 2012 Midterm
CIS 110 Introduction To Computer Programming February 29, 2012 Midterm Name: Recitation # (e.g. 201): Pennkey (e.g. bjbrown): My signature below certifies that I have complied with the University of Pennsylvania
More informationLASER 2011 Summerschool Elba Island, Italy Basics of COQ
LASER 2011 Summerschool Elba Island, Italy Basics of COQ Christine Paulin-Mohring September 2, 2011 Contents 1 First steps in COQ 2 1.1 Launching COQ....................................... 2 1.2 Syntax
More informationIdeas over terms generalization in Coq
Ideas over terms generalization in Coq Vincent Siles 1,2 LIX/INRIA/Ecole Polytechnique Palaiseau, France Abstract Coq is a tool that allows writing formal proofs and check their correctness in its underlying
More informationLecture 8: Summary of Haskell course + Type Level Programming
Lecture 8: Summary of Haskell course + Type Level Programming Søren Haagerup Department of Mathematics and Computer Science University of Southern Denmark, Odense October 31, 2017 Principles from Haskell
More informationCS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011
CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e
More information10 Years of Partiality and General Recursion in Type Theory
10 Years of Partiality and General Recursion in Type Theory Ana Bove Chalmers University of Technology DTP 10 July 9th 2010 Claims and Disclaims I know that I know nothing Socrates Ana Bove DTP 10 July
More informationAdvanced Features: Type Classes and Relations
Advanced Features: Type Classes and Relations Pierre Castéran Suzhou, Paris, 2011 1 / 1 In this lecture, we present shortly two quite new and useful features of the Coq system : Type classes are a nice
More informationCIS 120 Final Exam 15 December 2017
CIS 120 Final Exam 15 December 2017 Name (printed): Pennkey (login id): My signature below certifies that I have complied with the University of Pennsylvania s Code of Academic Integrity in completing
More informationInduction Schemes. Math Foundations of Computer Science
Induction Schemes Math Foundations of Computer Science Topics Induction Example Induction scheme over the naturals Termination Reduction to equational reasoning ACL2 proof General Induction Schemes Induction
More informationBuilt-in Module BOOL. Lecture Note 01a
Built-in Module BOOL Lecture Note 01a Topics! Built-in Boolean Algebra module BOOL and the equivalence of two boolean expressions (or SAT problems)! Study important concepts about CafeOBJ system through
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 informationReview. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals
Review CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics e ::= λx. e x ee c v ::= λx. e c (λx. e) v e[v/x] e 1 e 2 e 1 e 2 τ ::= int τ τ Γ ::= Γ,x : τ e 2 e 2 ve 2 ve 2 e[e /x]:
More informationCSE505, Fall 2012, Midterm Examination October 30, 2012
CSE505, Fall 2012, Midterm Examination October 30, 2012 Rules: The exam is closed-book, closed-notes, except for one side of one 8.5x11in piece of paper. Please stop promptly at Noon. You can rip apart
More informationType-directed Syntax Transformations for ATS-style Programs with Proofs
Type-directed Syntax Transformations for ATS-style Programs with Proofs Andrei Lapets August 14, 2007 1 Introduction In their work on ATS [CX05] and ATS LF [CX04], the authors present an ML-like language
More informationL04_in_class.v. L04_in_class.v. Printed by Zach Tatlock
Oct 12, 15 10:51 Page 1/11 * Lecture 04 Require Import ZArith. Require Import String. Open Scope string_scope. Open Scope Z_scope. Check Z. SYNTAX Inductive binop : Set := Add Sub Mul Div Mod Lt Lte Conj
More informationIsabelle s meta-logic. p.1
Isabelle s meta-logic p.1 Basic constructs Implication = (==>) For separating premises and conclusion of theorems p.2 Basic constructs Implication = (==>) For separating premises and conclusion of theorems
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 informationCIS 110 Introduction to Computer Programming. February 29, 2012 Midterm
CIS 110 Introduction to Computer Programming February 29, 2012 Midterm Name: Recitation # (e.g. 201): Pennkey (e.g. bjbrown): My signature below certifies that I have complied with the University of Pennsylvania
More informationProgramming Languages Lecture 14: Sum, Product, Recursive Types
CSE 230: Winter 200 Principles of Programming Languages Lecture 4: Sum, Product, Recursive Types The end is nigh HW 3 No HW 4 (= Final) Project (Meeting + Talk) Ranjit Jhala UC San Diego Recap Goal: Relate
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 information(a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are rational they can be written as the ratio of integers a 1
CS 70 Discrete Mathematics for CS Fall 2000 Wagner MT1 Sol Solutions to Midterm 1 1. (16 pts.) Theorems and proofs (a) (4 pts) Prove that if a and b are rational, then ab is rational. Since a and b are
More informationCS3110 Spring 2017 Lecture 9 Inductive proofs of specifications
CS3110 Spring 2017 Lecture 9 Inductive proofs of specifications Robert Constable 1 Lecture Plan 1. Repeating schedule of remaining five problem sets and prelim. 2. Comments on tautologies and the Coq logic.
More informationCSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 11 p. 1/38
CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 11 p. 1/38 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science
More information