Foundations of Programming Languages and Software Engineering

Size: px
Start display at page:

Download "Foundations of Programming Languages and Software Engineering"

Transcription

1 Foundations of Programming Languages and Software Engineering Jan-Georg Smaus (Peter Thiemann) Universität Freiburg July 2011 Abstract Data Types Foundations of Programming Languages and Software Engineering 1 / 27

2 Abstract Data Types We have learned about different datastructures, e.g. for dictionaries: Search trees Lists Tables with hashing Implementations of these concepts may have different characteristics: Memory usage Efficiency Implementations should be exchangeable Abstract over the concepts, use ADTs! Functional specification Implementation independent Different implementations of a single ADT are possible Foundations of Programming Languages and Software Engineering 2 / 27

3 ADTs are Special Signatures Definition Let Σ be a signature. A Σ-identity is a pair (s, t) T (Σ, X) T (Σ, X). We write a Σ-identity as s t for emphasis. An ADT is a pair (Σ, E) where Σ is a signature, E T (Σ, X) T (Σ, X) is a set of Σ-identities. Foundations of Programming Languages and Software Engineering 3 / 27

4 Examples An ADT for natural numbers Σ nat = {zero (0), succ (1) } E nat = Foundations of Programming Languages and Software Engineering 4 / 27

5 Examples An ADT for natural numbers Σ nat = {zero (0), succ (1) } E nat = An ADT for integers Σ int = {zero (0), pred (1), succ (1) } E int = {pred(succ(x)) x, succ(pred(x)) x} Foundations of Programming Languages and Software Engineering 4 / 27

6 Datatypes are Σ-Algebras Definition An identity s t is valid in a Σ-algebra A = (A, J ) iff J α (s) = J α (t) for all variable assignments α : X A. Foundations of Programming Languages and Software Engineering 5 / 27

7 Datatypes are Σ-Algebras Definition An identity s t is valid in a Σ-algebra A = (A, J ) iff J α (s) = J α (t) for all variable assignments α : X A. A datatype is a Σ-algebra D. A datatype D implements the ADT (Σ, E) iff every identity s t E is valid in D. (Note: We shall refine this definition later.) Foundations of Programming Languages and Software Engineering 5 / 27

8 Implementations of the ADT for Naturals Implementation 1 Dnat = (N, J ), J (zero) = 0, J (succ)(x) = x + 1 (note that x is meta-notation!). No identities, so all are valid. The function J is bijective. Foundations of Programming Languages and Software Engineering 6 / 27

9 Implementations of the ADT for Naturals Implementation 1 Dnat = (N, J ), J (zero) = 0, J (succ)(x) = x + 1 (note that x is meta-notation!). No identities, so all are valid. The function J is bijective. Implementation 2 Dnat = ({0, 1, 2, 3}, J ), J (zero) = 0, J (succ)(x) = (x + 1) mod 4. No identities, so all are valid. The function J is not injective (but surjective). J (zero) = 0 = J (succ(succ(succ(succ(zero))))) Foundations of Programming Languages and Software Engineering 6 / 27

10 Implementations of the ADT for Integers (1) Implementation 1 Dint = (Z, J ), J (zero)() = 0 J (succ)(x) = x + 1 J (pred)(x) = x 1 For arbitrary α : {x} Z we have J α(pred(succ(x))) = (α(x) + 1) 1 = J α(x) J α(succ(pred(x))) = (α(x) 1) + 1 = J α(x) J is surjective but not injective. Consider J (zero) = 0 = J (succ(pred(zero))). Foundations of Programming Languages and Software Engineering 7 / 27

11 Implementations of the ADT for Integers (2) Implementation 2 Dint = ({0, 1, 2, 3}, J ), J (zero)() = 0 J (succ)(x) = x + 1 mod 4 J (pred)(x) = x 1 mod 4 For arbitrary α : {x} Z we have J α (pred(succ(x))) = J α (x) J α (succ(pred(x))) = J α (x) J is surjective but not injective. Foundations of Programming Languages and Software Engineering 8 / 27

12 Implementations of the ADT for Integers (3) A Non-implementation Dint = (N, J ) J (zero)() = 0 J (succ)(x) = { x + 1 J x 1 x > 0 (pred)(x) = 0 x = 0 Not an implementation: For α : X N with α(x) = 0 we have J α (succ(pred(x))) = 1 0 = J α (x) Foundations of Programming Languages and Software Engineering 9 / 27

13 Fixing the Problems Want to rule out implementations such as Dnat and Dint Definition of implementation is too weak Needed: restriction on function J J is not necessarily injective (see Dint ) Idea: J must be injective on the equivalence classes induced by the identities of an ADT. In other words: J should make those terms equal that are equal according to the identities of the ADT, but not more! Foundations of Programming Languages and Software Engineering 10 / 27

14 Equivalence Classes Definition Suppose R is an equivalence relation on some set M. The set [x] R := {y M x R y} is called the equivalence class of x. y [x] R is called a representative of [x] R. The quotient of M with respect to R is the set of equivalence classes induced by R, written M/ R := {[x] R x M}. Note: For equivalence classes [x] R and [y] R we have either [x] R = [y] R or [x] R [y] R =. Foundations of Programming Languages and Software Engineering 11 / 27

15 Congruence Relations Definition Suppose Σ is a signature and let R be an equivalence relation on T (Σ, X). R is a congruence relation iff R is closed under Σ-operations, i.e. t i R t i implies f (t 1,..., t i,..., t n ) R f (t 1,..., t i,..., t n ) for any n 0, f Σ (n), and t 1,..., t n, t i T (Σ, X). Foundations of Programming Languages and Software Engineering 12 / 27

16 Syntactic Quotient Algebras Definition Let Σ be a signature and R be a congruence on T (Σ, X). For all n 0, f Σ (n), and t 1,..., t n T (Σ, X), define J R as follows: Note J R (f )([t 1 ] R,..., [t n ] R ) = [f (t 1,..., t n )] R (T (Σ, X)/ R, J R ) is a Σ-algebra. Its carrier elements are sets of terms. The representatives are arbitrary: Let n 0, f Σ (n), and s 1, t 1,..., s n, t n T (Σ, X). If s 1 R t 1,..., s n R t n then f (s 1,..., s n ) R f (t 1,..., t n ). Hence, [f (s 1,..., s n )] R = [f (t 1,..., t n )] R, as R is a congruence. Foundations of Programming Languages and Software Engineering 13 / 27

17 Equational Theory Definition Let (Σ, E) be an ADT. We define a relation E on T (Σ, X) as the smallest relation such that E is a congruence relation; E contains E, i.e. s t E implies s E t; E is closed under substitutions, i.e. s E t implies σ(s) E σ(t) for any substitution σ and all s, t T (Σ, X). Foundations of Programming Languages and Software Engineering 14 / 27

18 Example Congruence classes of Eint Σ int = {zero (0), pred (1), succ (1) } E int = {pred(succ(x)) x, succ(pred(x)) x} [zero] Eint = {zero, } succ(pred(zero)), pred(succ(zero)), succ(succ(pred(pred(zero)))),... Foundations of Programming Languages and Software Engineering 15 / 27

19 Revised Definition for ADT Implementations Definition A datatype D = (M, J ) implements ADT (Σ, E) with constructors Γ Σ if (M, J ) is a Σ-algebra (as before) All identities from E are valid in M (as before) For all s, t T (Γ, ): s E t iff J (s) = J (t) (new!) Foundations of Programming Languages and Software Engineering 16 / 27

20 Syntactic Implementations of ADTs Theorem Let (Σ, E) be an ADT with constructors Γ Σ. Then D = (T (Σ, )/ E, J E ) is an implementation of (Σ, E). Proof. Omitted Foundations of Programming Languages and Software Engineering 17 / 27

21 Example Nat as a constructor-based ADT (CADT) CADT: Σ = {zero, succ}, E = {}, Γ = Σ Implementation: (N, J 1 ) with J 1 (zero)() = 0 and J 1 (succ)(x) = x + 1 (N, J 1 ) is Σ-algebra No identities to check Since E =, E is =. Suppose s, t T (Γ, ). If s = t then J 1 (s) = J 1 (t) Suppose s t. Then s = succ n (t) with n > 0. Hence, J 1 (s) = J 1 (t) + n J 1 (t). Foundations of Programming Languages and Software Engineering 18 / 27

22 Example Dint is not an implementation of the natural numbers CADT: Σ = {zero, succ}, E = {}, Γ = Σ ({0, 1, 2, 3}, J ) with J (zero)() = 0, J (succ)(x) = (x + 1) mod 4 is not an implementation. ({0, 1, 2, 3}, J ) is Σ-algebra No identities to check Since E =, E is =. We have zero succ 4 (zero) but J (zero) = 0 = J (succ 4 (zero)). Foundations of Programming Languages and Software Engineering 19 / 27

23 Example Alternative implementation of the natural numbers CADT: Σ = {zero, succ}, E = {}, Γ = Σ Implementation: ({a}, J ) with J (zero)() = ɛ, J (succ)(w) = aw ({a}, J ) is Σ-algebra No identities to check Since E =, E is =. If s = t then J (s) = J (t) Suppose s t. Then s = succ n (t) with n > 0. Hence, J (s) = J (t) } a. {{.. a } J (t). n Foundations of Programming Languages and Software Engineering 20 / 27

24 Equivalence Classes for Terms Representing Integers Suppose Γ = Σ = {zero, succ, pred}, E = {succ(pred(x)) = x, pred(succ(x)) = x} Question: What is T (Σ, )/ E? Answer: Give a representative for every equivalence class. Lemma For every term t T (Σ, ), exactly one of the following propositions holds A There exists n > 0 such that t [succ n (zero)] E. B t [zero] E. C There exists n > 0 such that t [pred n (zero)] E. Foundations of Programming Languages and Software Engineering 21 / 27

25 Proof The proof is by term induction over t. Base case: t = zero. Then B holds. Foundations of Programming Languages and Software Engineering 22 / 27

26 Proof (cont.) Induction Step for t = succ(t ). By the IH, one of the following holds for t : A t E succ (n) (zero) for n > 0: then succ(t ) E succ(succ (n) (zero)) = succ (n+1) (zero). Since n + 1 > 0 we have case A. B t E zero: then succ(t ) E succ(zero). We have case A with n = 1. C t E pred (n) (zero) for n > 0: Then succ(t ) E succ(pred (n) (zero)). If n = 1 then succ(pred(zero)) E zero so case B holds. If n > 1 then succ(pred(pred (n 1) (zero))) E pred (n 1) (zero), so case C holds. Foundations of Programming Languages and Software Engineering 23 / 27

27 Proof (cont.) Induction step for pred(t) analogous. Foundations of Programming Languages and Software Engineering 24 / 27

28 Equivalence Classes for Terms Representing Integers Lemma Suppose n > 0, m > 0. Then we have zero E succ n (zero), zero E pred n (zero), succ n (zero) E pred m (zero), succ n (zero) E succ m (zero) provided n m, and pred n (zero) E pred m (zero) provided n m. If follows that {succ n (zero) n > 0} {zero} {pred n (zero) n > 0} is a set of representatives for T (Σ, )/ E. Foundations of Programming Languages and Software Engineering 25 / 27

29 Example Integers as a CADT CADT: Γ = Σ = {zero, succ, pred}, E = {succ(pred(x)) = x, pred(succ(x)) = x} Implementation: (Z, J ) with J (z) = 0, J (succ)(x) = x + 1, J (pred)(x) = x 1 (Z, J ) is a Σ-algebra All identities are valid (as seen before) An easy term induction shows for all t T (Σ, ) that if t E zero then J (t) = 0, if t E succ n (zero) then J (t) = n, and if t E pred n (zero) then J (t) = n. Hence, if s E t then J (s) = J (t). Conversely, if s E t then J (s) J (t) because J maps different representatives to different integers. Foundations of Programming Languages and Software Engineering 26 / 27

30 Summary Slogan Calculating with ADT = applying term operations + determining set of representatives. Foundations of Programming Languages and Software Engineering 27 / 27

Completeness of Star-Continuity

Completeness of Star-Continuity Introduction to Kleene Algebra Lecture 5 CS786 Spring 2004 February 9, 2004 Completeness of Star-Continuity We argued in the previous lecture that the equational theory of each of the following classes

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP Recap: Logic, Sets, Relations, Functions

Finite Automata Theory and Formal Languages TMV027/DIT321 LP Recap: Logic, Sets, Relations, Functions Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2017 Formal proofs; Simple/strong induction; Mutual induction; Inductively defined sets; Recursively defined functions. Lecture 3 Ana Bove

More information

Order Sorted Algebra. Japan Advanced Institute of Science and Technology. March 8, 2008

Order Sorted Algebra. Japan Advanced Institute of Science and Technology. March 8, 2008 Order Sorted Algebra Daniel Găină Japan Advanced Institute of Science and Technology March 8, 2008 Introduction There are many examples where all items of one sort are necessarily also items of some other

More information

Automatic Deduction for Theories of. Algebraic Data Types. Igor A. Chikanian

Automatic Deduction for Theories of. Algebraic Data Types. Igor A. Chikanian Automatic Deduction for Theories of Algebraic Data Types by Igor A. Chikanian A dissertation submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy Department of Computer

More information

Inductive Definitions

Inductive Definitions University of Science and Technology of China (USTC) 09/26/2011 Judgments A judgment states that one or more syntactic objects have a property or stand in some relation to one another. The property or

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

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF Copyright Cengage Learning. All rights reserved. SECTION 4.5 Direct Proof and Counterexample V: Floor and Ceiling Copyright Cengage Learning. All

More information

Equational Logic. Chapter Syntax Terms and Term Algebras

Equational Logic. Chapter Syntax Terms and Term Algebras Chapter 2 Equational Logic 2.1 Syntax 2.1.1 Terms and Term Algebras The natural logic of algebra is equational logic, whose propositions are universally quantified identities between terms built up from

More information

Principles of Real Analysis I Fall I. The Real Number System

Principles of Real Analysis I Fall I. The Real Number System 21-355 Principles of Real Analysis I Fall 2004 I. The Real Number System The main goal of this course is to develop the theory of real-valued functions of one real variable in a systematic and rigorous

More information

1 Take-home exam and final exam study guide

1 Take-home exam and final exam study guide Math 215 - Introduction to Advanced Mathematics Fall 2013 1 Take-home exam and final exam study guide 1.1 Problems The following are some problems, some of which will appear on the final exam. 1.1.1 Number

More information

Contribution of Problems

Contribution of Problems Exam topics 1. Basic structures: sets, lists, functions (a) Sets { }: write all elements, or define by condition (b) Set operations: A B, A B, A\B, A c (c) Lists ( ): Cartesian product A B (d) Functions

More information

Congruence Boolean Lifting Property

Congruence Boolean Lifting Property Congruence Boolean Lifting Property George GEORGESCU and Claudia MUREŞAN University of Bucharest Faculty of Mathematics and Computer Science Academiei 14, RO 010014, Bucharest, Romania Emails: georgescu.capreni@yahoo.com;

More information

An Abstract Decision Procedure for Satisfiability in the Theory of Recursive Data Types

An Abstract Decision Procedure for Satisfiability in the Theory of Recursive Data Types An Abstract Decision Procedure for Satisfiability in the Theory of Recursive Data Types Clark Barrett 1 Igor Shikanian 1 Cesare Tinelli 2 1 New York University, barrett igor@cs.nyu.edu 2 The University

More information

Programming Languages and Types

Programming Languages and Types Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Where we re going Type Systems... Type systems are one of the most fascinating and powerful aspects of programming

More information

Chapter 5. Modular arithmetic. 5.1 The modular ring

Chapter 5. Modular arithmetic. 5.1 The modular ring Chapter 5 Modular arithmetic 5.1 The modular ring Definition 5.1. Suppose n N and x, y Z. Then we say that x, y are equivalent modulo n, and we write x y mod n if n x y. It is evident that equivalence

More information

Chapter 1 : The language of mathematics.

Chapter 1 : The language of mathematics. MAT 200, Logic, Language and Proof, Fall 2015 Summary Chapter 1 : The language of mathematics. Definition. A proposition is a sentence which is either true or false. Truth table for the connective or :

More information

5 Set Operations, Functions, and Counting

5 Set Operations, Functions, and Counting 5 Set Operations, Functions, and Counting Let N denote the positive integers, N 0 := N {0} be the non-negative integers and Z = N 0 ( N) the positive and negative integers including 0, Q the rational numbers,

More information

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X.

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X. MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X. Notation 2 A set can be described using set-builder notation. That is, a set can be described

More information

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations

Definitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations Page 1 Definitions Tuesday, May 8, 2018 12:23 AM Notations " " means "equals, by definition" the set of all real numbers the set of integers Denote a function from a set to a set by Denote the image of

More information

10 van Emde Boas Trees

10 van Emde Boas Trees Dynamic Set Data Structure S: S. insert(x) S. delete(x) S. search(x) S. min() S. max() S. succ(x) S. pred(x) Ernst Mayr, Harald Räcke 389 For this chapter we ignore the problem of storing satellite data:

More information

Structure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts

Structure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts Introduction 3 Background functionals factor out common behaviour map applies a function to every element of a list fun map [ ] = [ ] map f ( x : : xs ) = f x : : map f xs filter keeps only those elements

More information

Section 4.4 Functions. CS 130 Discrete Structures

Section 4.4 Functions. CS 130 Discrete Structures Section 4.4 Functions CS 130 Discrete Structures Function Definitions Let S and T be sets. A function f from S to T, f: S T, is a subset of S x T where each member of S appears exactly once as the first

More information

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS 1. Cardinal number of a set The cardinal number (or simply cardinal) of a set is a generalization of the concept of the number of elements

More information

Interpolation in Logics with Constructors

Interpolation in Logics with Constructors Interpolation in Logics with Constructors Daniel Găină Japan Advanced Institute of Science and Technology School of Information Science Abstract We present a generic method for establishing the interpolation

More information

Matching Logic: A Logic for Structural Reasoning

Matching Logic: A Logic for Structural Reasoning Matching Logic: A Logic for Structural Reasoning Grigore Roşu University of Illinois at Urbana-Champaign grosu@illinois.edu Abstract Matching logic is a first-order logic (FOL) variant to reason about

More information

An Abstract Decision Procedure for a Theory of Inductive Data Types

An Abstract Decision Procedure for a Theory of Inductive Data Types An Abstract Decision Procedure for a Theory of Inductive Data Types lark Barrett Igor Shikanian Department of omputer Science ourant Institute of Mathematical Sciences New York University esare Tinelli

More information

Jan A. Bergstra and Alban Ponse. Informatics Institute, section Theory of Computer Science University of Amsterdam

Jan A. Bergstra and Alban Ponse. Informatics Institute, section Theory of Computer Science University of Amsterdam Datatype defining rewrite systems for the ring of integers, and for natural and integer arithmetic in unary view arxiv:1608.06212v1 [cs.lo] 22 Aug 2016 Jan A. Bergstra and Alban Ponse Informatics Institute,

More information

III.2 (b) Higher level programming concepts for URMs Anton Setzer

III.2 (b) Higher level programming concepts for URMs Anton Setzer CS 275 Automata and Formal Language Theory Course Notes Additional Material Part III: Limits of Computation Chapt. III.2: The URM III.2 (a) Definition of the URM III.2 (b) Higher level programming concepts

More information

Groups of Prime Power Order with Derived Subgroup of Prime Order

Groups of Prime Power Order with Derived Subgroup of Prime Order Journal of Algebra 219, 625 657 (1999) Article ID jabr.1998.7909, available online at http://www.idealibrary.com on Groups of Prime Power Order with Derived Subgroup of Prime Order Simon R. Blackburn*

More information

Algebraic Abstract Data Types

Algebraic Abstract Data Types Introduction AADT Proofs Theories Hierarchies Rewriting in Algebraic Specifications Université de Genève 16 mars 2009 1/79 Introduction AADT Proofs Theories Hierarchies Rewriting in Algebraic Specifications

More information

Universal Algebra for Logics

Universal Algebra for Logics Universal Algebra for Logics Joanna GRYGIEL University of Czestochowa Poland j.grygiel@ajd.czest.pl 2005 These notes form Lecture Notes of a short course which I will give at 1st School on Universal Logic

More information

12. Hilbert Polynomials and Bézout s Theorem

12. Hilbert Polynomials and Bézout s Theorem 12. Hilbert Polynomials and Bézout s Theorem 95 12. Hilbert Polynomials and Bézout s Theorem After our study of smooth cubic surfaces in the last chapter, let us now come back to the general theory of

More information

Injectivity of Composite Functions

Injectivity of Composite Functions Injectivity of Composite Functions Kim S. Larsen Michael I. Schwartzbach Computer Science Department, Aarhus University Ny Munkegade, 8000 Aarhus C, Denmark Present address: Department of Mathematics and

More information

The Many Faces of Modal Logic Day 3: Algebraic Semantics

The Many Faces of Modal Logic Day 3: Algebraic Semantics The Many Faces of Modal Logic Day 3: Algebraic Semantics Dirk Pattinson Australian National University, Canberra (Slides based on a NASSLLI 2014 Tutorial and are joint work with Lutz Schröder) LAC 2018

More information

Rings and Fields Theorems

Rings and Fields Theorems Rings and Fields Theorems Rajesh Kumar PMATH 334 Intro to Rings and Fields Fall 2009 October 25, 2009 12 Rings and Fields 12.1 Definition Groups and Abelian Groups Let R be a non-empty set. Let + and (multiplication)

More information

FREE STEINER LOOPS. Smile Markovski, Ana Sokolova Faculty of Sciences and Mathematics, Republic of Macedonia

FREE STEINER LOOPS. Smile Markovski, Ana Sokolova Faculty of Sciences and Mathematics, Republic of Macedonia GLASNIK MATEMATIČKI Vol. 36(56)(2001), 85 93 FREE STEINER LOOPS Smile Markovski, Ana Sokolova Faculty of Sciences and Mathematics, Republic of Macedonia Abstract. A Steiner loop, or a sloop, is a groupoid

More information

Synthetic Geometry. 1.4 Quotient Geometries

Synthetic Geometry. 1.4 Quotient Geometries Synthetic Geometry 1.4 Quotient Geometries Quotient Geometries Def: Let Q be a point of P. The rank 2 geometry P/Q whose "points" are the lines of P through Q and whose "lines" are the hyperplanes of of

More information

CMSC250 Homework 9 Due: Wednesday, December 3, Question: Total Points: Score:

CMSC250 Homework 9 Due: Wednesday, December 3, Question: Total Points: Score: Name & UID: Circle Your Section! 0101 (10am: 3120, Ladan) 0102 (11am: 3120, Ladan) 0103 (Noon: 3120, Peter) 0201 (2pm: 3120, Yi) 0202 (10am: 1121, Vikas) 0203 (11am: 1121, Vikas) 0204 (9am: 2117, Karthik)

More information

Formal power series rings, inverse limits, and I-adic completions of rings

Formal power series rings, inverse limits, and I-adic completions of rings Formal power series rings, inverse limits, and I-adic completions of rings Formal semigroup rings and formal power series rings We next want to explore the notion of a (formal) power series ring in finitely

More information

Modeling and reasoning with I-polynomial data types

Modeling and reasoning with I-polynomial data types Modeling and reasoning with I-polynomial data types Peter Padawitz, TU Dortmund, Germany September 1, 2017 (actual version: http://fldit-www.cs.uni-dortmund.de/ peter/ifip2016.pdf) 1 Road map Some examples

More information

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC) University of Science and Technology of China (USTC) 09/26/2011 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?

More information

Foundations of Mathematics

Foundations of Mathematics Foundations of Mathematics L. Pedro Poitevin 1. Preliminaries 1.1. Sets We will naively think of a set as a collection of mathematical objects, called its elements or members. To indicate that an object

More information

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability

Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability Harvard CS 121 and CSCI E-207 Lecture 6: Regular Languages and Countability Salil Vadhan September 20, 2012 Reading: Sipser, 1.3 and The Diagonalization Method, pages 174 178 (from just before Definition

More information

Rohit Garg Roll no Dr. Deepak Gumber

Rohit Garg Roll no Dr. Deepak Gumber FINITE -GROUPS IN WHICH EACH CENTRAL AUTOMORPHISM FIXES THE CENTER ELEMENTWISE Thesis submitted in partial fulfillment of the requirement for the award of the degree of Masters of Science In Mathematics

More information

INVERSE LIMITS AND PROFINITE GROUPS

INVERSE LIMITS AND PROFINITE GROUPS INVERSE LIMITS AND PROFINITE GROUPS BRIAN OSSERMAN We discuss the inverse limit construction, and consider the special case of inverse limits of finite groups, which should best be considered as topological

More information

The Chinese Remainder Theorem

The Chinese Remainder Theorem Chapter 5 The Chinese Remainder Theorem 5.1 Coprime moduli Theorem 5.1. Suppose m, n N, and gcd(m, n) = 1. Given any remainders r mod m and s mod n we can find N such that N r mod m and N s mod n. Moreover,

More information

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati

CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati CS 514, Mathematics for Computer Science Mid-semester Exam, Autumn 2017 Department of Computer Science and Engineering IIT Guwahati Important 1. No questions about the paper will be entertained during

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 CORONA FACTORIZATION PROPERTY AND REFINEMENT MONOIDS

THE CORONA FACTORIZATION PROPERTY AND REFINEMENT MONOIDS THE CORONA FACTORIZATION PROPERTY AND REFINEMENT MONOIDS EDUARD ORTEGA, FRANCESC PERERA, AND MIKAEL RØRDAM ABSTRACT. The Corona Factorization Property of a C -algebra, originally defined to study extensions

More information

A Structure of KK-Algebras and its Properties

A Structure of KK-Algebras and its Properties Int. Journal of Math. Analysis, Vol. 6, 2012, no. 21, 1035-1044 A Structure of KK-Algebras and its Properties S. Asawasamrit Department of Mathematics, Faculty of Applied Science, King Mongkut s University

More information

Blame and Coercion: Together Again for the First Time

Blame and Coercion: Together Again for the First Time Blame and Coercion: Together Again for the First Time Supplementary Material Jeremy Siek Indiana University, USA jsiek@indiana.edu Peter Thiemann Universität Freiburg, Germany thiemann@informatik.uni-freiburg.de

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

Types and Programming Languages (15-814), Fall 2018 Assignment 4: Data Representation (Sample Solutions)

Types and Programming Languages (15-814), Fall 2018 Assignment 4: Data Representation (Sample Solutions) Types and Programming Languages (15-814), Fall 2018 Assignment 4: Data Representation (Sample Solutions) Contact: 15-814 Course Staff Due Tuesday, October 16, 2018, 10:30am This assignment is due by 10:30am

More information

10-704: Information Processing and Learning Fall Lecture 10: Oct 3

10-704: Information Processing and Learning Fall Lecture 10: Oct 3 0-704: Information Processing and Learning Fall 206 Lecturer: Aarti Singh Lecture 0: Oct 3 Note: These notes are based on scribed notes from Spring5 offering of this course. LaTeX template courtesy of

More information

Elementary Number Theory in Type Theoretic Foundations

Elementary Number Theory in Type Theoretic Foundations Elementary Number Theory in Type Theoretic Foundations October 19, 2014 1 Introduction One important set in mathematics is that of the natural numbers and number theory is the study of the properties that

More information

Introduction to Automata

Introduction to Automata Introduction to Automata Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr 1 /

More information

Section 0. Sets and Relations

Section 0. Sets and Relations 0. Sets and Relations 1 Section 0. Sets and Relations NOTE. Mathematics is the study of ideas, not of numbers!!! The idea from modern algebra which is the focus of most of this class is that of a group

More information

Lecture three: Automata and the algebra-coalgebra duality

Lecture three: Automata and the algebra-coalgebra duality Lecture three: Automata and the algebra-coalgebra duality Jan Rutten CWI Amsterdam & Radboud University Nijmegen IPM, Tehran - 13 January 2016 This lecture will explain two diagrams: 1 x c ε σ A r x X

More information

Part V. Chapter 19. Congruence of integers

Part V. Chapter 19. Congruence of integers Part V. Chapter 19. Congruence of integers Congruence modulo m Let m be a positive integer. Definition. Integers a and b are congruent modulo m if and only if a b is divisible by m. For example, 1. 277

More information

MATH 102 INTRODUCTION TO MATHEMATICAL ANALYSIS. 1. Some Fundamentals

MATH 102 INTRODUCTION TO MATHEMATICAL ANALYSIS. 1. Some Fundamentals MATH 02 INTRODUCTION TO MATHEMATICAL ANALYSIS Properties of Real Numbers Some Fundamentals The whole course will be based entirely on the study of sequence of numbers and functions defined on the real

More information

BASIC GROUP THEORY : G G G,

BASIC GROUP THEORY : G G G, BASIC GROUP THEORY 18.904 1. Definitions Definition 1.1. A group (G, ) is a set G with a binary operation : G G G, and a unit e G, possessing the following properties. (1) Unital: for g G, we have g e

More information

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS. 4 Functions Before studying functions we will first quickly define a more general idea, namely the notion of a relation. A function turns out to be a special type of relation. Definition: Let S and T be

More information

S = {x 1 2 _< x n, x prime} for any given n 2. (2.1)

S = {x 1 2 _< x n, x prime} for any given n 2. (2.1) An Exercise in Program Explanation JAYADEV MISRA The University of Texas at Austin A combination of program-proving ideas and stepwise refinement is used to develop and explain an algorithm which uses

More information

Math.3336: Discrete Mathematics. Cardinality of Sets

Math.3336: Discrete Mathematics. Cardinality of Sets Math.3336: Discrete Mathematics Cardinality of Sets Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu Fall 2018

More information

Math 762 Spring h Y (Z 1 ) (1) h X (Z 2 ) h X (Z 1 ) Φ Z 1. h Y (Z 2 )

Math 762 Spring h Y (Z 1 ) (1) h X (Z 2 ) h X (Z 1 ) Φ Z 1. h Y (Z 2 ) Math 762 Spring 2016 Homework 3 Drew Armstrong Problem 1. Yoneda s Lemma. We have seen that the bifunctor Hom C (, ) : C C Set is analogous to a bilinear form on a K-vector space, : V V K. Recall that

More information

Math 222A W03 D. Congruence relations

Math 222A W03 D. Congruence relations Math 222A W03 D. 1. The concept Congruence relations Let s start with a familiar case: congruence mod n on the ring Z of integers. Just to be specific, let s use n = 6. This congruence is an equivalence

More information

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes.

INTEGERS. In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes. INTEGERS PETER MAYR (MATH 2001, CU BOULDER) In this section we aim to show the following: Goal. Every natural number can be written uniquely as a product of primes. 1. Divisibility Definition. Let a, b

More information

ON THE RELATIONSHIP BETWEEN SETS AND GROUPS

ON THE RELATIONSHIP BETWEEN SETS AND GROUPS ON THE RELATIONSHIP BETWEEN SETS AND GROUPS ROSE DONG Abstract. This paper is an introduction to basic properties of sets and groups. After introducing the notion of cardinal arithmetic, it proves the

More information

A Foundation for GADTs and Inductive Families. Makoto Hamana Gunma University, Japan

A Foundation for GADTs and Inductive Families. Makoto Hamana Gunma University, Japan 1 A Foundation for GADTs and Inductive Families Dependent Polynomial Functor Approach Makoto Hamana Gunma University, Japan Joint work with Marcelo Fiore, University of Cambridge WGP 11, 18 September,

More information

Generating connected and 2-edge connected graphs

Generating connected and 2-edge connected graphs Journal of Graph Algorithms and Applications http://jgaa.info/ vol. 3, no. 2, pp. 25 28 (2009) Generating ected and 2-edge ected graphs Ângela Mestre Doppler Institute & Department of Mathematics, FNSPE,

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

Minimal multipliers for consecutive Fibonacci numbers

Minimal multipliers for consecutive Fibonacci numbers ACTA ARITHMETICA LXXV3 (1996) Minimal multipliers for consecutive Fibonacci numbers by K R Matthews (Brisbane) 1 Introduction The Fibonacci and Lucas numbers F n, L n (see [2]) are defined by Since F 1

More information

Predicate Logic. x. x + 0 = x. Predicate logic over integer expressions: a language of logical assertions, for example. Why discuss predicate logic?

Predicate Logic. x. x + 0 = x. Predicate logic over integer expressions: a language of logical assertions, for example. Why discuss predicate logic? Predicate Logic Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic? It is an example of a simple language It has simple denotational

More information

Matching Logic Extended Abstract

Matching Logic Extended Abstract Matching Logic Extended Abstract Grigore Roşu University of Illinois at Urbana-Champaign, USA grosu@illinois.edu Abstract This paper presents matching logic, a first-order logic (FOL) variant for specifying

More information

Software Engineering

Software Engineering Software Engineering Lecture 07: Design by Contract Peter Thiemann University of Freiburg, Germany 02.06.2014 Table of Contents Design by Contract Contracts for Procedural Programs Contracts for Object-Oriented

More information

NOTES ON FINITE FIELDS

NOTES ON FINITE FIELDS NOTES ON FINITE FIELDS AARON LANDESMAN CONTENTS 1. Introduction to finite fields 2 2. Definition and constructions of fields 3 2.1. The definition of a field 3 2.2. Constructing field extensions by adjoining

More information

Lecture 7. Logic III. Axiomatic description of properties of relations.

Lecture 7. Logic III. Axiomatic description of properties of relations. V. Borschev and B. Partee, October 11, 2001 p. 1 Lecture 7. Logic III. Axiomatic description of properties of relations. CONTENTS 1. Axiomatic description of properties and classes of relations... 1 1.1.

More information

1 Equivalence Relations

1 Equivalence Relations Mitchell Faulk June 12, 2014 Equivalence Relations and Quotient Spaces 1 Equivalence Relations Recall that a relation on a set X is a subset S of the cartesian product X X. Problem Set 2 has several examples

More information

Arno Schonegge. Universitat Karlsruhe, Karlsruhe, Germany.

Arno Schonegge. Universitat Karlsruhe, Karlsruhe, Germany. The Hidden Function Question Revisited? Arno Schonegge Institut fur Logik, Komplexitat und Deduktionssysteme Universitat Karlsruhe, 76128 Karlsruhe, Germany schoenegge@ira.uka.de Abstract. While some common

More information

Characterizing CTL-like logics on finite trees

Characterizing CTL-like logics on finite trees Theoretical Computer Science 356 (2006) 136 152 www.elsevier.com/locate/tcs Characterizing CTL-like logics on finite trees Zoltán Ésik 1 Department of Computer Science, University of Szeged, Hungary Research

More information

Lectures on The Lambda Calculus (I)

Lectures on The Lambda Calculus (I) Lectures on The Lambda Calculus (I) Masahiko Sato Graduate School of Informatics, Kyoto University Autumn school Proof and Computation Fischbachau, Germany October 4, 2016 Overview In these lectures, I

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

MATH 101: ALGEBRA I WORKSHEET, DAY #1. We review the prerequisites for the course in set theory and beginning a first pass on group. 1.

MATH 101: ALGEBRA I WORKSHEET, DAY #1. We review the prerequisites for the course in set theory and beginning a first pass on group. 1. MATH 101: ALGEBRA I WORKSHEET, DAY #1 We review the prerequisites for the course in set theory and beginning a first pass on group theory. Fill in the blanks as we go along. 1. Sets A set is a collection

More information

Solutions Quiz 9 Nov. 8, Prove: If a, b, m are integers such that 2a + 3b 12m + 1, then a 3m + 1 or b 2m + 1.

Solutions Quiz 9 Nov. 8, Prove: If a, b, m are integers such that 2a + 3b 12m + 1, then a 3m + 1 or b 2m + 1. Solutions Quiz 9 Nov. 8, 2010 1. Prove: If a, b, m are integers such that 2a + 3b 12m + 1, then a 3m + 1 or b 2m + 1. Answer. We prove the contrapositive. Suppose a, b, m are integers such that a < 3m

More information

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions Today s Topics Set identities Methods of proof Relationships to logical equivalences Functions Important definitions Relationships to sets, relations Special functions Set identities help us manipulate

More information

Topological Vector Spaces III: Finite Dimensional Spaces

Topological Vector Spaces III: Finite Dimensional Spaces TVS III c Gabriel Nagy Topological Vector Spaces III: Finite Dimensional Spaces Notes from the Functional Analysis Course (Fall 07 - Spring 08) Convention. Throughout this note K will be one of the fields

More information

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M004: Blue) 6 December Points Possible

CIS 375 Intro to Discrete Mathematics Exam 3 (Section M004: Blue) 6 December Points Possible Name: CIS 375 Intro to Discrete Mathematics Exam 3 (Section M004: Blue) 6 December 2016 Question Points Possible Points Received 1 12 2 14 3 14 4 12 5 16 6 16 7 16 Total 100 Instructions: 1. This exam

More information

Section 7.2: One-to-One, Onto and Inverse Functions

Section 7.2: One-to-One, Onto and Inverse Functions Section 7.2: One-to-One, Onto and Inverse Functions In this section we shall developed the elementary notions of one-to-one, onto and inverse functions, similar to that developed in a basic algebra course.

More information

Integers and Division

Integers and Division Integers and Division Notations Z: set of integers N : set of natural numbers R: set of real numbers Z + : set of positive integers Some elements of number theory are needed in: Data structures, Random

More information

Fall 2015 Lecture 14: Modular congruences. cse 311: foundations of computing

Fall 2015 Lecture 14: Modular congruences. cse 311: foundations of computing Fall 2015 Lecture 14: Modular congruences cse 311: foundations of computing If a and b are positive integers, then gcd a, b = gcd (b, a mod b) Useful GCD Fact Proof: By definition a = a div b b + (a mod

More information

Notes on p-divisible Groups

Notes on p-divisible Groups Notes on p-divisible Groups March 24, 2006 This is a note for the talk in STAGE in MIT. The content is basically following the paper [T]. 1 Preliminaries and Notations Notation 1.1. Let R be a complete

More information

September 14. Fall Software Foundations CIS 500

September 14. Fall Software Foundations CIS 500 CIS 500 Software Foundations Fall 2005 September 14 CIS 500, September 14 1 Announcements I will be away September 19-October 5. I will be reachable by email. Fastest response cis500@cis.upenn.edu No office

More information

CSE 20 DISCRETE MATH WINTER

CSE 20 DISCRETE MATH WINTER CSE 20 DISCRETE MATH WINTER 2016 http://cseweb.ucsd.edu/classes/wi16/cse20-ab/ Today's learning goals Explain the steps in a proof by (strong) mathematical induction Use (strong) mathematical induction

More information

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications NICTA Advanced Course Theorem Proving Principles, Techniques, Applications λ 1 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic, natural

More information

LECTURE IV: PERFECT PRISMS AND PERFECTOID RINGS

LECTURE IV: PERFECT PRISMS AND PERFECTOID RINGS LECTURE IV: PERFECT PRISMS AND PERFECTOID RINGS In this lecture, we study the commutative algebra properties of perfect prisms. These turn out to be equivalent to perfectoid rings, and most of the lecture

More information

EQUATIONAL REASONING WITH SUBTYPES

EQUATIONAL REASONING WITH SUBTYPES EQUATIONAL REASONING WITH SUBTYPES GARY T. LEAVENS AND DON PIGOZZI Abstract. Using equational logic as a specification language, we investigate the proof theory of behavioral subtyping for object-oriented

More information

Functions and cardinality (solutions) sections A and F TA: Clive Newstead 6 th May 2014

Functions and cardinality (solutions) sections A and F TA: Clive Newstead 6 th May 2014 Functions and cardinality (solutions) 21-127 sections A and F TA: Clive Newstead 6 th May 2014 What follows is a somewhat hastily written collection of solutions for my review sheet. I have omitted some

More information

Lecture 7 Cyclic groups and subgroups

Lecture 7 Cyclic groups and subgroups Lecture 7 Cyclic groups and subgroups Review Types of groups we know Numbers: Z, Q, R, C, Q, R, C Matrices: (M n (F ), +), GL n (F ), where F = Q, R, or C. Modular groups: Z/nZ and (Z/nZ) Dihedral groups:

More information

The error elements solution is to add distinct elements to the carrier which will be returned by partial operations. The problem with this solution is

The error elements solution is to add distinct elements to the carrier which will be returned by partial operations. The problem with this solution is Modeling partiality by nondeterminism { from abstract specications to exible error handling Yngve Lamo Micha l Walicki Department of Informatics University of Bergen 5020 Bergen, Norway fyngvel,michalg@ii.uib.no

More information

CATEGORY THEORY. Cats have been around for 70 years. Eilenberg + Mac Lane =. Cats are about building bridges between different parts of maths.

CATEGORY THEORY. Cats have been around for 70 years. Eilenberg + Mac Lane =. Cats are about building bridges between different parts of maths. CATEGORY THEORY PROFESSOR PETER JOHNSTONE Cats have been around for 70 years. Eilenberg + Mac Lane =. Cats are about building bridges between different parts of maths. Definition 1.1. A category C consists

More information