# An Agda Tutorial. Makoto Takeyama

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 An Agda Tutorial Misao Nagayama Hideaki Nishihara Makoto Takeyama Research Center for Verification and Semantics (CVS) National Institute of Advanced Industrial Science and Technology (AIST) Japan May 12, 2006 Contents 1 Introduction What is agda? A brief history of agda Who reads this document? Notations Acknowledgement New Features Syntax Commands Libraries A minimal set of commands Start, load, and quit 10 3 Introduction to the Agda language Data types Examples Typecheck Syntax Type notations Identifiers Exercises Functions Examples Application Typecheck Computation Definitions

2 3.2.6 Syntax Exercises Case expressions Examples Indentation Typecheck and Computations Syntax Exercises Recursive functions Examples Termination check Mutual recursive definitions Operators Exercises Functions(lambda expressions) Examples Syntax Exercises Record types Examples Syntax Local definitions Examples Syntax Exercises Short summary Types Examples Typing rules General expressions of functions Data type definitions Examples and description Syntax Exercises Inductive data definitions Syntax Hidden arguments Examples Syntax Example program Packages Reviewing standard packages Package location Directory Tree SET.alfa Typical example Package Definition How to use a package Including a file

3 4.3.2 Open expression Packages with arguments Basic operations for programming Making a code interactively The function sublist Editing a code Templates, solving Other useful commands Go to an error Show an unfolded type of a goal Show contexts Theorem-proving in Agda Introduction to dependent type theory From informal proofs to formal proofs in type theory From formal proofs to agda expressions The first example: Implication Predicates Universal quantification The second example Other logical connectives Conjunction Disjunction Falsity Truth Negation Existential quantification Logical equivalence Equality Relations Equivalence relation Equality Identity Examples Intuitionistic Propositional logic Exercises Classical propositional logic Exercises Intuitionistic first-order predicate logic Exercises Classical first-order predicate logic Exercises First-order arithmetic Exercises A List of commands 89 A.1 Agda menu A.2 Goal commands

4 B Sample programs in New Syntax 94 B.1 Intro.agda (Section 3) B.2 IntroLib.agda (Section 4) B.3 sublist.agda(section 5) B.4 LogicLib.agda(Section 6)

5 1 Introduction. 1.1 What is agda? [To be written.] 1.2 A brief history of agda [To be written.] 1.3 Who reads this document? With this document we will know how to use Agda: operations, its language, and typical ways to define functions. One of important goals of this document is to write proofs. Features and functions listed above and many examples will help readers to implement a formal system and to prove theorems on the formal system. This tutorial is for the people who have some interests in Agda but who have not used Agda. They may be interested in pure/applied logics, programming with types, differences with other theorem-provers/proof-assistants, Agda itself, and so on. Readers are supposed to have some knowledge and experiences on: Classical logic and intuitionist logic, and natural deduction; Simple Type Theory; Typed lambda calculi; The Emacs editor. Moreover they will progress more efficiently with the following knowledge and experiences: Functional programming languages, especially Haskell; Dependent type theory, especially Martin Löf Type theory; Curry-Haward correspondence or Propositions as sets paradigm. There are still some features of Agda we do not deal with in this document, and detailed explanations are often omitted in this document. When readers want advanced informations, reference manual will help them. (But in preparation.) 1.4 Notations In this tutorial, Agda denotes the system consisting of a typechecker, standard libraries, and interfaces on Emacs editor. Descriptions in this tutorial are based on the version released on 2005 April 1. It is remarked that Agda is now a developing system. Different behaviors, and different message outputs may be seen in case different versions of Agda are used. Especially specifications on hidden arguments (Section 3.13) may change

6 Typefaces. Strings in special typefaces have special meanings. Words and lines in the teletype typeface are filenames, parts of codes, strings to input, or ones about the computer environment 2. A string in angle brackets like as foo is to be replaced with appropriate expressions in a code. What expression is fit for a foo is shown each time. Keywords and Agda commands are printed in the bold face. An abstract expression and its implementation are distinguished by their typefaces in this document. For example, consider the following identifiers in the mathematical world: a set A, a function f : A A, and an element a of A. When discussing about their implementations on Agda, they are referred to: a set(type) A, a function f of type A -> A, and an element(object) a of A. Key inputs. As in many documents on Emacs, C-, M-, and RET mean Control-, Meta-, and Enter respectively. For example, C-c means to input c with Control key. Key binding for Agda commands are printed in a box like as C-c C-q. It is a sequence of inputs: C-q following C-c. 1.5 Acknowledgement The authors are grateful to the developers of Agda, in particular the people who joined the 2nd Agda Meeting: Andreas Abel, Marcin Benke, Ana Bove, Catarina Coquand, Thierry Coquand, Peter Dybjer, Bengt Nordström, and Ulf Norell. Discussions with them helped us to learn the theoretical background, implementations and applications of Agda. Also with their comments, the authors could improve this tutorial on exactness and on readability. The authors are grateful to members in CVS/AIST, in particular who participated in the 2nd Agda Meeting and who joined to an internal seminar of Agda. They gave us valuable comments for this tutorial. This tutorial is supported in part by Core Research for Evolutional Science and Technology (CREST) Program New High-performance Information Processing Technology Supporting Information-oriented Society of Japan Science and Technology Agency(JST). 2 There is an exception. We use the teletype typeface for referring the system Agda. 6

7 1.6 New Features In the summer of 2005, Agda is modified in several points. Here we introduce differeces between descriptions in this tutorial and the new version of Agda. If the reader uses the latest versions of Agda (including release versions ), (s)he should visit this section frequently and modify example codes in the later sections. Translations of programs appearing in this tutorial into the new syntax are placed Appendix B Syntax New data type definition. [C.f. Sect. 3.1, Sect. 3.11] A data type definition ONLY allows data at the beginning of the definition. data Bool ::Set = true false data List (X::Set) = nil con (x::x) (xs::list X) symbols for the constructors. [C.f. Sect. 3.11, Sect. 4] Constructor expressions ( Constructor e 1 e 2...) are now prohibited. Corresponding functions (automatically defined by data declarations) must be used. For example, x in the OLD syntax should be written as con (con x nil) nil in the new syntax. Remarks. As a consequence, distinct data types in a same scope must have distinct constructor names. Moreover, we must open EXPLICITLY functions corresponding constructors in a package. Agda s outputs may be old expression. That is, the appears in computation results. Left parameters are hidden. [C.f. Sect. 3.2, Sect. 3.13] In a definition, the parameters that are declared between the identifier and the double colon are treated as hidden arguments. The following definition (under the assumption the type Nat is defined) succ (n::nat)::nat = suc n is equivalent to the following definition in the OLD syntax. succ (n::nat)::nat = suc n Hence when the function succ is applied to an expression, the vertical bar must be placed: succ one is to be modified to 7

8 succ one In order to switch a hidden parameter explicit, we must place the symbol! on the left of the parameter. The following definition succ (!n::nat)::nat = suc n is equivalent to the following definition in the OLD syntax. succ (n::nat)::nat = suc n Explicit declaration for an equational definition. [C.f. Sect ] An equational definition should be accompanied with explcit type declaration. For example (the types List and Bool are defined above) foo :: List Bool foo = con Bool true (nil Bool) New idata definition. [C.f. Sect. 3.12] In the new syntax, ListN, the type of lists of fixed length, is defined as follows: idata ListN (A::Set) :: Nat -> Set where{ nil :: ListN A zero; con(n::nat)(a::a)(as::listn A n):: ListN A (succ n); } The differences from the old syntax are as follows: idata definitions are already not right hand side values. Definitions including the string :: _ are not allowed. The type identifier following a constructor and a double colon ( ListN in the 2nd/3rd line) must be written explicitly. The type of inductive family of types being defined must be annoted as a function type explicitly. The following code Rel (X::Set)::Type = X -> X -> Set idata Id (A::Set) :: Rel A where{ ref (x::a) :: Id A x x } occurs an error. We must modify like as Rel (X::Set)::Type = X -> X -> Set idata Id (A::Set) :: A -> A -> Set where{ ref (x::a) :: Id A x x } 8

9 1.6.2 Commands Compute Command. [C.f. Sect , Appendix A] The command Compute ( C-c C-x > ) is added to Agda menu. Different from old commands like Compute to depth, it doesn t need any goal. Just it prompts an expression to compute, and prints the result. However this command works only in top-level. Constants defined locally and variables declared inside a definitions are not recognized. Disabled Commands. are disabled. [C.f. Sect. Appendix A] The following commands Chase-import Solve, Solve Constraint Unfold constraint Auto Compute to depth, Compute to depth 100, Compute WHNF, Compute WHNF strict Continue one step, Continue several steps Unfold one Libraries [C.f. Section 4] Standard libraries for the new syntax have NOT been released yet. Standard libraries are not bundled with Agda by default. We can obtain them with CVS (Concurrent Versions System). In detail, check Cover Project site: Note that the project name is Agdalib, and thus we should use the command cvs get Agdalib instead of cvs get Agda. 9

10 2 A minimal set of commands Start, load, and quit First we learn several basic commands. They let us communicate with Agda in babble, that is, we can get Agda to typecheck a program, and to memorize it. Although a few Agda codes are shown here, their meanings are not explained in this section. We should concentrate on operations and commands here. Start Start up Emacs editor. We can start Agda by opening 3 a file with suffix.agda or.alfa in an Emacs buffer. Here we open a new buffer named first.agda. When Agda starts, we can see two windows in a Emacs frame and the Agda menu in the Emacs menu bar (Figure 1). The larger window is called main window, in which we edit Agda codes. The smaller window is called sub window, in which informations on Agda programs are displayed. File Edit Option Buffers Tools Agda Help -EEE:---F1 Emacs: first.agda (Agda:run Ind)--L1--All Agda idata --- the version info brought to you by Ilya. [ghc602; built Apr :43:28] -EEE:**-F1 Emacs: * Agda version * (Agda:run Ind)--L1--All---- Figure 1: Starting Agda Quit and restart To quit Agda, we should use the Quit command C-c C-q 4. It quits the proof engine, and tries closing all buffers Agda can control, including a buffer to display outputs from Agda, like as contents in the sub window a buffer consisting of Agda codes 5. If we want Agda to restart without escaping from agda-mode, then we should invoke the Restart command with C-c C-x C-c. Load Start Agda again (if needed), and try writing the following line in the main window: data Bool = true false 3 There is another way: changing Emacs major mode to agda-mode by the command M-x followed by agda-mode. 4 We can invoke Quit command in Agda menu. Each command in this tutorial can be invoked by the same manner, but we do not mention it at each time. 5 More precisely, every buffer whose major mode is Agda. 10

12 Exercises. 1. Try operations introduced in this section several times. (a) Open first.agda to a Emacs buffer. (b) Typecheck first.agda with Chase-Load command. (c) Restart Agda. (d) Quit Agda. 2. Typecheck the program shown at the last of this section. (Hint:Indentation is a part of the syntax in Agda.(See Section )) 12

13 3 Introduction to the Agda language Here we learn how to build an Agda program, in particular how to build a function. First, we define data types. Data types are not necessary to define functions for example to define an identity function identity (A::Set)::A->A = \(x::a)->x does not need any data types. However data types and their objects make examples concrete. In this section we deal with elementary data types: Bool consisting of boolean values and Nat consisting of natural numbers. Next we deal with functions on those types. We introduce how to define functions and how to get a function value. Case expressions are powerful tools to define functions in Agda. We study about case expressions, including recursive functions. After the above basic expressions, we deal with expressions related to Dependent type theory. Typing rules, families of types, and how to hide arguments trivially inferred are explained. 3.1 Data types In Agda, not so many data types are prepared as built-in types. Hence we need to define data types on scratch. They will be used in the whole of this section. Summary Examples of data type definitions. Typechecking examples. Explanation. Syntax of data type definitions. We start with examples. We review that examples and check they are typechecked by Agda. Do not stop if we have some questions in examples, and answers may be given in Explanation parts Examples To define a data type, it is enough to show all objects that belong to that type. Here is the first example. data Bool = true false This line is interpreted as the constant named Bool is a data type consisting of two objects named true and false respectively. The identifiers true and false are called constructors of Bool type, since they form objects of type Bool. In the next example, the type Nat is defined. It has objects with an argument: data Nat = zer suc (m::nat) 13

14 File Edit Option Buffers Tools Agda Help data Bool = true false data Nat = zer suc (m::nat) -EEE:---F1 Proof: Intro.agda (Agda:run Ind)--L1--All Agda idata --- the version info brought to you by Ilya. [ghc602; built Apr :43:28] -EEE:**-F1 Emacs: * Agda version * (Agda:run Ind)--L1--All---- marking goals: Intro.agda... done Figure 2: Typecheking succeeds This line means that the constant named Nat is a data type with exactly two ways to construct its objects: zer is an object of Nat, and, for any object m of Nat, suc m is an object of Nat. Thus objects of Nat are zer, suc zer, suc (suc zer), suc (suc (suc zer)),... Here the constructors of the type Nat are zer and suc Typecheck Let us check that the examples above are accepted by Agda. Start Emacs and start Agda (See the previous section). We will write all example codes in this section in the same file Its file name is Intro.agda. Open a new file, input and save the following code, and at last invoke Chase-Load command by C-c C-x RET. data Bool = true false data Nat = zer suc (m::nat) We can see that typechecking succeeds by the message in the minibuffer. (Figure 2) Syntax The syntactical structure for a data type definition is as follows: data Tid = Cons 1 Cons 2... Cons k Tid is the identifier of the type and each Cons i is a constructor (with arguments): 14

15 Cons i is Id i, or Id i Args i and Args i is ( V i1 :: T i1 ) ( V i2 :: T i2 )... ( V in :: T in ) Here each Id i [resp. V i j and T i j ] is the identifier of the corresponding constructor [resp. argument and its type ]. Remark. When adjacent arguments are of the same type, the notations like as (x,y::nat) are allowed Type notations Here we leave the main topic in this subsection and introduce general syntactical notations in Agda. A declaration that an expression (an identifier, a variable, etc.) Expr is of type Type is written in Agda as follows: Expr :: Type Identifiers Identifiers are lexically sequences of letters, digits, and single quote ( ), where the first characters of them must be letters. There are remarks: Single quote has no special role. The identifiers m and m are independent of each other (unless we bind m to an expression depending on m). Agda distinguishes between upper/lower cases, and letters in each case have no special role Exercises 1. Define a data type Int consisting of pairs of two natural number, with the constructor I. (The type Int represents a type of integers. We will define operations and an equality on the type, and it will be natural to regard Int as a type of integers. This exercise is the first step.) 2. A list of Nat is either the empty list, denoted by niln, or a pair consisting of an object of Nat and a list of Nat with the constructor conn. Define the type ListNat consisting of lists of Nat. 7 C.f. In Haskell, foo must be an identifier of a function and Foo must be an identifier of a type or a module. 15

16 3.2 Functions There are two ways to define a function (but they are equivalent) in Agda. The first way, introduced here, is used in ordinary mathematics. For example: f(x) = 3x + 5, sgn(x) = x x, The arguments (the variable x) appear in the left hand side as well as the right hand side, namely they do not need lambda notations. The second way to define functions is introduced in Section 3.5. There we will introduce lambda notations. Summary Examples of function definition/function application. Typechecking examples. Computing Agda expressions. Type inferring. Syntax Examples Let us start with constant functions that have no arguments. In the examples below, the function zero and the function one always return the constant values respectively. zero::nat = zer one::nat = suc zer The next example is a definition of the function on Nat, which increases its argument by one or two: succ (n::nat)::nat = suc n plus2 (n::nat)::nat = suc (suc n) The meaning of the line above is clear: it tells for a given object n of type Nat, the expression plus2 n is an object in Nat, and plus2 n is bound to the expression suc (suc n) explicitly. Remark. It may not be clear that plus2 is of a function type, since in its definition it is typed to Nat. However Nat is not the type of the constant plus2 itself, but the type of the expression plus2 n. General explanations of function types are shown in Section 3.10, and here we just see the type of plus2: it is of type (n::nat)->nat. 16

17 data Nat = zer suc (m::nat) zero::nat = zer one::nat = suc zer plus2 (n::nat)::nat = suc (suc n) three::nat = plus2 one -EEE:---F1 Proof: Intro.agda (Agda:run Ind)--L1--All Agda idata --- the version info brought to you by Ilya. [ghc602; built Apr :43:28] -EEE:**-F1 Emacs: * Agda version * (Agda:run Ind)--L1--All---- marking goals: Intro.agda... done Figure 3: Typecheking succeeds Application A function application is presented by an juxtaposition: for example, plus2 one plus2 (plus2 one) The expression plus2 one is an application of the function plus2 to the expression one of type Nat. The expression in the second line is an application of the function plus2 to the expression plus2 one of type Nat Typecheck Let us check the examples above are accepted by Agda. Input the following code at the end of Intro.agda, and invoke Chase-Load command. zero::nat = zer one::nat = suc zer plus2 (n::nat)::nat = suc (suc n) three::nat = plus2 one We can see that typechecking succeeds by the message in the minibuffer. (Figure 3) Computation We can infer that the expression plus2 one is reduced to the expression suc (suc (suc zer)) Let us check it on Agda. But direct interfaces to display reduced forms of expressions are not prepared in Agda. Hence we use a trick. 17

18 plus2 (n::nat)::nat = suc (suc n) three::nat = plus2 one foo::nat = {}0 -EEE:---F1 Proof: Intro.agda (Agda:run Ind)--L1--All Close to: Position "c:/home/program/agda/intro.agda" 13 11?0 :: Nat -EEE:**-F1 Emacs: * Agda version * (Agda:run Ind)--L1--All---- marking goals: Intro.agda... done Figure 4: Computation Append the following line at the tail of Intro.agda and make Agda typecheck the program again: foo::nat =? Then the character? must change to the string {}0 (Figure 4). This string is called a goal which is a place we can make a code interactively (See Section 5). Place the cursor on the goal (on the character } precisely) and invoke Compute to depth 100 command 8 by C-c C-x +. Then we can see a prompt in the minibuffer: -EEE:**-F1 Emacs: * Agda version * (Agda:run Ind)--L1--All---- expression: Give this prompt the expression plus2 one (and RET) and we obtain the result in the subwindow: -EEE:---F1 Proof: Intro.agda (Agda:run Ind)--L1--All EEE:**-F1 Emacs: * Agda version * (Agda:run Ind)--L1--All---- The expressions and are the most reduced expressions of suc and zer respectively. The meaning will be explained in Section 3.11, and now we can ignore it. Thus the result can be understood as suc (suc (suc zer)). That is the expression we have inferred. 8 If we can operate with mouse, we can invoke the command by right-clicking on the goal and selecting Compute to depth

19 Type inferences Let us introduce another feature of Agda: displaying types of expressions. Agda does not have any interface to do it, and thus we use a trick same as computations. Again place the cursor on the goal and invoke Infer type by C-c :. Similar to the case of computation, the prompt expression: appears. We give it the string one with RET and we can see its type in the subwindow: -EEE:---F1 Proof: Intro.agda (Agda:run Ind)--L1--All Nat -EEE:**-F1 Emacs: * Agda version * (Agda:run Ind)--L1--All---- Again invoke Infer type on the goal and give the string plus2 to the prompt. We can see plus2 is of a function type: -EEE:---F1 Proof: Intro.agda (Agda:run Ind)--L1--All (n::nat) -> Nat -EEE:**-F1 Emacs: * Agda version * (Agda:run Ind)--L1--All Definitions A definition binds an Agda expression to an identifier. The simplest definition has the following syntax: Id :: Type = Expr which means that the identifier Id is bound to the expression Expr. Notice that the order of definitions is important in Agda programs. A definition in a program has, as its context, all constants defined in the earlier part 9 of the program. Therefore, a constants appearing in a definition must have been defined at that time. Remark. omitted. In case Type is inferred from Expr, the type notation can be zer = zer As the right hand side is typed to Nat, the left hand side is of type Nat, too. Other types of definitions are introduced in Section 4. 9 Except for mutual recursive definitions (See Section 3.4.3), and except for locally defined constants (See Section 3.7). 19

20 3.2.6 Syntax The syntactical structure for a function definition is as follows: Id Args :: Type = Expr where Id is the identifier, Type is the type of the codomain, Expr is the function body, and Args is the arguments: ( V 1 :: T 1 ) ( V 2 :: T 2 )... ( V k :: T k ) The syntactical structure for a function application is as follows: Id Exp1 Exp2... Exp k where Id is the identifier of a function, and each Exp i is an expression Exercises 1. Make a function with two arguments: it receives two expression of Nat, and returns the second argument. 2. Make a function named emb representing an embedding of Nat into Int: 3.3 Case expressions Nat x I x zer Int Case expressions are one of basic tools for making functions. It makes possible that a function returns an expression according to the structure of an argument. Summary Examples. Meanings of indentations in Agda Typechecking. Syntax Examples The first example is a function to flip boolean values. A case expression appears in the right hand side. flip (x::bool )::Bool = case x of (true )-> false (false)-> true The meaning of the case expression in the above example is clear. If the argument x is the object true, then the expression flip x is reduced to false, and if the argument x is false, then flip x is reduced to true. It is necessary and sufficient for the above case expression to have two branches, since an object of type Bool is either true or false. We emphasize 20

### Chapter 7: Functional Programming Languages

Chapter 7: Functional Programming Languages Aarne Ranta Slides for the book Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, 2012. Fun: a language

### Termination Checking: Comparing Structural Recursion and Sized Types by Examples

Termination Checking: Comparing Structural Recursion and Sized Types by Examples David Thibodeau Decemer 3, 2011 Abstract Termination is an important property for programs and is necessary for formal proofs

### The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University (revised October 8, 2004) 1 Introduction The PCAT language (Pascal Clone

### ML for the Working Programmer

ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming

### Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

### Higher-Order Logic. Specification and Verification with Higher-Order Logic

Higher-Order Logic Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter Software Technology Group Fachbereich Informatik Technische Universität Kaiserslautern Sommersemester 2010

### Magit-Popup User Manual

Magit-Popup User Manual for version 2.5 Jonas Bernoulli Copyright (C) 2015-2016 Jonas Bernoulli You can redistribute this document and/or modify it under the terms of the GNU General

### Dependent Types at Work

Dependent Types at Work Ana Bove and Peter Dybjer Chalmers University of Technology, Göteborg, Sweden {bove,peterd}@chalmers.se Abstract. In these lecture notes we give an introduction to functional programming

### + addition - subtraction and unary minus * multiplication / division mod modulo

Chapter 4 Basic types We examine in this chapter the Caml basic types. 4.1 Numbers Caml Light provides two numeric types: integers (type int) and floating-point numbers (type float). Integers are limited

### Bitrix Site Manager 4.1. User Guide

Bitrix Site Manager 4.1 User Guide 2 Contents REGISTRATION AND AUTHORISATION...3 SITE SECTIONS...5 Creating a section...6 Changing the section properties...8 SITE PAGES...9 Creating a page...10 Editing

### User-defined Functions (UDFs)

User-defined Functions (UDFs) In this lecture I will be introducing the programmation language Visual Basic for Applications (VBA) and explaining one particular use of it: creating UDFs. VBA is a powerful

### Rigorous Software Development CSCI-GA 3033-009

Rigorous Software Development CSCI-GA 3033-009 Instructor: Thomas Wies Spring 2013 Lecture 11 Semantics of Programming Languages Denotational Semantics Meaning of a program is defined as the mathematical

### Chapter 1. Logic and Proof

Chapter 1. Logic and Proof 1.1 Remark: A little over 100 years ago, it was found that some mathematical proofs contained paradoxes, and these paradoxes could be used to prove statements that were known

### Vim, Emacs, and JUnit Testing. Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor

Vim, Emacs, and JUnit Testing Audience: Students in CS 331 Written by: Kathleen Lockhart, CS Tutor Overview Vim and Emacs are the two code editors available within the Dijkstra environment. While both

### Exercise 1: Python Language Basics

Exercise 1: Python Language Basics In this exercise we will cover the basic principles of the Python language. All languages have a standard set of functionality including the ability to comment code,

### Chapter 2 Mathematical Background

Chapter 2 Mathematical Background We start this chapter with a summary of basic concepts and notations for sets and first-order logic formulas, which will be used in the rest of the book. Our aim is to

### RIT Installation Instructions

RIT User Guide Build 1.00 RIT Installation Instructions Table of Contents Introduction... 2 Introduction to Excel VBA (Developer)... 3 API Commands for RIT... 11 RIT API Initialization... 12 Algorithmic

### Induction and Recursion

Induction and Recursion Jan van Eijck June 3, 2003 Abstract A very important proof method that is not covered by the recipes from Chapter 3 is the method of proof by Mathematical Induction. Roughly speaking,

### Verifying Specifications with Proof Scores in CafeOBJ

Verifying Specifications with Proof Scores in CafeOBJ FUTATSUGI, Kokichi 二 木 厚 吉 Chair of Language Design Graduate School of Information Science Japan Advanced Institute of Science and Technology (JAIST)

### MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

MyOra 3.0 SQL Tool for Oracle User Guide Jayam Systems, LLC Contents Features... 4 Connecting to the Database... 5 Login... 5 Login History... 6 Connection Indicator... 6 Closing the Connection... 7 SQL

### Deterministic Discrete Modeling

Deterministic Discrete Modeling Formal Semantics of Firewalls in Isabelle/HOL Cornelius Diekmann, M.Sc. Dr. Heiko Niedermayer Prof. Dr.-Ing. Georg Carle Lehrstuhl für Netzarchitekturen und Netzdienste

### Avaya Network Configuration Manager User Guide

Avaya Network Configuration Manager User Guide May 2004 Avaya Network Configuration Manager User Guide Copyright Avaya Inc. 2004 ALL RIGHTS RESERVED The products, specifications, and other technical information

### Part 1 Foundations of object orientation

OFWJ_C01.QXD 2/3/06 2:14 pm Page 1 Part 1 Foundations of object orientation OFWJ_C01.QXD 2/3/06 2:14 pm Page 2 1 OFWJ_C01.QXD 2/3/06 2:14 pm Page 3 CHAPTER 1 Objects and classes Main concepts discussed

### 2. Compressing data to reduce the amount of transmitted data (e.g., to save money).

Presentation Layer The presentation layer is concerned with preserving the meaning of information sent across a network. The presentation layer may represent (encode) the data in various ways (e.g., data

### Regular Expressions and Automata using Haskell

Regular Expressions and Automata using Haskell Simon Thompson Computing Laboratory University of Kent at Canterbury January 2000 Contents 1 Introduction 2 2 Regular Expressions 2 3 Matching regular expressions

### The countdown problem

JFP 12 (6): 609 616, November 2002. c 2002 Cambridge University Press DOI: 10.1017/S0956796801004300 Printed in the United Kingdom 609 F U N C T I O N A L P E A R L The countdown problem GRAHAM HUTTON

### Functional Programming. Functional Programming Languages. Chapter 14. Introduction

Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The

### Building and Using Web Services With JDeveloper 11g

Building and Using Web Services With JDeveloper 11g Purpose In this tutorial, you create a series of simple web service scenarios in JDeveloper. This is intended as a light introduction to some of the

### Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick Reference Guide

Open Crystal Reports From the Windows Start menu choose Programs and then Crystal Reports. Creating a Blank Report Ohio University Computer Services Center August, 2002 Crystal Reports Introduction Quick

### Database Studio is the new tool to administrate SAP MaxDB database instances as of version 7.5.

1 2 3 4 Database Studio is the new tool to administrate SAP MaxDB database instances as of version 7.5. It replaces the previous tools Database Manager GUI and SQL Studio from SAP MaxDB version 7.7 onwards

### CHAPTER 7 GENERAL PROOF SYSTEMS

CHAPTER 7 GENERAL PROOF SYSTEMS 1 Introduction Proof systems are built to prove statements. They can be thought as an inference machine with special statements, called provable statements, or sometimes

### The IC Language Specification. Spring 2006 Cornell University

The IC Language Specification Spring 2006 Cornell University The IC language is a simple object-oriented language that we will use in the CS413 project. The goal is to build a complete optimizing compiler

### Exercise 4 Learning Python language fundamentals

Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also

### Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

### Configuration Manager

After you have installed Unified Intelligent Contact Management (Unified ICM) and have it running, use the to view and update the configuration information in the Unified ICM database. The configuration

### An Innocent Investigation

An Innocent Investigation D. Joyce, Clark University January 2006 The beginning. Have you ever wondered why every number is either even or odd? I don t mean to ask if you ever wondered whether every number

### Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic

Parametric Domain-theoretic models of Linear Abadi & Plotkin Logic Lars Birkedal Rasmus Ejlers Møgelberg Rasmus Lerchedahl Petersen IT University Technical Report Series TR-00-7 ISSN 600 600 February 00

### Chapter 15 Functional Programming Languages

Chapter 15 Functional Programming Languages Introduction - The design of the imperative languages is based directly on the von Neumann architecture Efficiency (at least at first) is the primary concern,

### We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

### FILESURF 7.5 SR3/WORKSITE INTEGRATION INSTALLATION MANUAL 1 PRELIMINARIES...3 STEP 1 - PLAN THE FIELD MAPPING...3 STEP 2 - WORKSITE CONFIGURATION...

FILESURF 7.5 SR3/WORKSITE INTEGRATION 1 PRELIMINARIES...3 Prerequisites... 3 The FILESURFAdmin User Domain Account Required... 3 STEP 1 - PLAN THE FIELD MAPPING...3 Plan Which WorkSite Fields Will Carry

### Access Queries (Office 2003)

Access Queries (Office 2003) Technical Support Services Office of Information Technology, West Virginia University OIT Help Desk 293-4444 x 1 oit.wvu.edu/support/training/classmat/db/ Instructor: Kathy

### Mathematical Induction

Mathematical Induction In logic, we often want to prove that every member of an infinite set has some feature. E.g., we would like to show: N 1 : is a number 1 : has the feature Φ ( x)(n 1 x! 1 x) How

### Code::Blocks Student Manual

Code::Blocks Student Manual Lawrence Goetz, Network Administrator Yedidyah Langsam, Professor and Theodore Raphan, Distinguished Professor Dept. of Computer and Information Science Brooklyn College of

### Detecting Pattern-Match Failures in Haskell. Neil Mitchell and Colin Runciman York University www.cs.york.ac.uk/~ndm/catch

Detecting Pattern-Match Failures in Haskell Neil Mitchell and Colin Runciman York University www.cs.york.ac.uk/~ndm/catch Does this code crash? risers [] = [] risers [x] = [[x]] risers (x:y:etc) = if x

### User Management Resource Administrator. UMRA Example Projects. Service Management

User Management Resource Administrator UMRA Example Projects UMRA example projects Copyright 2005, Tools4Ever B.V. All rights reserved. No part of the contents of this user guide may be reproduced or transmitted

### [Refer Slide Time: 05:10]

Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

### Programming for MSc Part I

Herbert Martin Dietze University of Buckingham herbert@the-little-red-haired-girl.org July 24, 2001 Abstract The course introduces the C programming language and fundamental software development techniques.

### Editors Comparison (NetBeans IDE, Eclipse, IntelliJ IDEA)

České vysoké učení technické v Praze Fakulta elektrotechnická Návrh Uživatelského Rozhraní X36NUR Editors Comparison (NetBeans IDE, Eclipse, ) May 5, 2008 Goal and purpose of test Purpose of this test

### Chapter I Logic and Proofs

MATH 1130 1 Discrete Structures Chapter I Logic and Proofs Propositions A proposition is a statement that is either true (T) or false (F), but or both. s Propositions: 1. I am a man.. I am taller than

### Magic Tutorial #S-1: The scheme command-line interpreter

Magic Tutorial #S-1: The scheme command-line interpreter Rajit Manohar Department of Computer Science California Institute of Technology Pasadena, CA 91125 This tutorial corresponds to Magic version 7.

### 3. Mathematical Induction

3. MATHEMATICAL INDUCTION 83 3. Mathematical Induction 3.1. First Principle of Mathematical Induction. Let P (n) be a predicate with domain of discourse (over) the natural numbers N = {0, 1,,...}. If (1)

### DiskPulse DISK CHANGE MONITOR

DiskPulse DISK CHANGE MONITOR User Manual Version 7.9 Oct 2015 www.diskpulse.com info@flexense.com 1 1 DiskPulse Overview...3 2 DiskPulse Product Versions...5 3 Using Desktop Product Version...6 3.1 Product

### Maple Quick Start. Introduction. Talking to Maple. Using [ENTER] 3 (2.1)

Introduction Maple Quick Start In this introductory course, you will become familiar with and comfortable in the Maple environment. You will learn how to use context menus, task assistants, and palettes

### Software Engineering

Software Engineering Lecture 04: The B Specification Method Peter Thiemann University of Freiburg, Germany SS 2013 Peter Thiemann (Univ. Freiburg) Software Engineering SWT 1 / 50 The B specification method

JetBrains ReSharper 2.0 Overview Introduction ReSharper is undoubtedly the most intelligent add-in to Visual Studio.NET 2003 and 2005. It greatly increases the productivity of C# and ASP.NET developers,

### Microsoft Access 3: Understanding and Creating Queries

Microsoft Access 3: Understanding and Creating Queries In Access Level 2, we learned how to perform basic data retrievals by using Search & Replace functions and Sort & Filter functions. For more complex

### Chapter 1 LOGIC AND PROOF

Chapter 1 LOGIC AND PROOF To be able to understand mathematics and mathematical arguments, it is necessary to have a solid understanding of logic and the way in which known facts can be combined to prove

### BF Survey Plus User Guide

BF Survey Plus User Guide August 2011 v1.0 1 of 23 www.tamlyncreative.com.au/software/ Contents Introduction... 3 Support... 3 Documentation... 3 Installation New Install... 3 Setting up categories...

### Programming Languages in Artificial Intelligence

Programming Languages in Artificial Intelligence Günter Neumann, German Research Center for Artificial Intelligence (LT Lab, DFKI) I. AI programming languages II. Functional programming III. Functional

### 2. Methods of Proof Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try.

2. METHODS OF PROOF 69 2. Methods of Proof 2.1. Types of Proofs. Suppose we wish to prove an implication p q. Here are some strategies we have available to try. Trivial Proof: If we know q is true then

### Understand for FORTRAN

Understand Your Software... Understand for FORTRAN User Guide and Reference Manual Version 1.4 Scientific Toolworks, Inc. Scientific Toolworks, Inc. 1579 Broad Brook Road South Royalton, VT 05068 Copyright

### Simulation Tools. Python for MATLAB Users I. Claus Führer. Automn 2009. Claus Führer Simulation Tools Automn 2009 1 / 65

Simulation Tools Python for MATLAB Users I Claus Führer Automn 2009 Claus Führer Simulation Tools Automn 2009 1 / 65 1 Preface 2 Python vs Other Languages 3 Examples and Demo 4 Python Basics Basic Operations

### Chapter 2: Problem Solving Using C++

Chapter 2: Problem Solving Using C++ 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common

### Recording Supervisor Manual Presence Software

Presence Software Version 9.2 Date: 09/2014 2 Contents... 3 1. Introduction... 4 2. Installation and configuration... 5 3. Presence Recording architectures Operating modes... 5 Integrated... with Presence

### 3. Populating the Student Table (data entry) Click the View icon again to switch to the Datasheet View. Enter sample data as follows:

1. Getting Started Creating a new, empty database called SCHOOL. a. Insert your removable media. b. Load Access 2010. Click Blank Database under Available Templates c. In the right panel, click the Open

### POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful

POLYTYPIC PROGRAMMING OR: Programming Language Theory is Helpful RALF HINZE Institute of Information and Computing Sciences Utrecht University Email: ralf@cs.uu.nl Homepage: http://www.cs.uu.nl/~ralf/

### Virtual CD v10. Network Management Server Manual. H+H Software GmbH

Virtual CD v10 Network Management Server Manual H+H Software GmbH Table of Contents Table of Contents Introduction 1 Legal Notices... 2 What Virtual CD NMS can do for you... 3 New Features in Virtual

1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

### Installing and Sending with DocuSign for NetSuite v2.2

DocuSign Quick Start Guide Installing and Sending with DocuSign for NetSuite v2.2 This guide provides information on installing and sending documents for signature with DocuSign for NetSuite. It also includes

### Introduction to Python

Caltech/LEAD Summer 2012 Computer Science Lecture 2: July 10, 2012 Introduction to Python The Python shell Outline Python as a calculator Arithmetic expressions Operator precedence Variables and assignment

### Load testing with. WAPT Cloud. Quick Start Guide

Load testing with WAPT Cloud Quick Start Guide This document describes step by step how to create a simple typical test for a web application, execute it and interpret the results. 2007-2015 SoftLogica

### Fundamentals of Mathematics Lecture 6: Propositional Logic

Fundamentals of Mathematics Lecture 6: Propositional Logic Guan-Shieng Huang National Chi Nan University, Taiwan Spring, 2008 1 / 39 Connectives Propositional Connectives I 1 Negation: (not A) A A T F

### Software Verification and Testing. Lecture Notes: Z I

Software Verification and Testing Lecture Notes: Z I Motivation so far: we have seen that properties of software systems can be specified using first-order logic, set theory and the relational calculus

### VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 UX Software - 2009 TABLE OF CONTENTS INTRODUCTION... ii What is this book about?... iii How to use this book... iii Time to start...

### Data Tool Platform SQL Development Tools

Data Tool Platform SQL Development Tools ekapner Contents Setting SQL Development Preferences...5 Execution Plan View Options Preferences...5 General Preferences...5 Label Decorations Preferences...6

### Foundations of Artificial Intelligence

Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Wolfram Burgard, Bernhard Nebel and Martin Riedmiller Albert-Ludwigs-Universität Freiburg Contents 1 Agents

### Tips and Tricks SAGE ACCPAC INTELLIGENCE

Tips and Tricks SAGE ACCPAC INTELLIGENCE 1 Table of Contents Auto e-mailing reports... 4 Automatically Running Macros... 7 Creating new Macros from Excel... 8 Compact Metadata Functionality... 9 Copying,

Checking Access to Protected Members in the Java Virtual Machine Alessandro Coglio Kestrel Institute 3260 Hillview Avenue, Palo Alto, CA 94304, USA Ph. +1-650-493-6871 Fax +1-650-424-1807 http://www.kestrel.edu/

### Manual English KOI Desktop App 2.0.x

Manual English KOI Desktop App 2.0.x KOI Kommunikation, Organisation, Information Comm-Unity EDV GmbH 2010 Contents Introduction... 3 Information on how to use the documentation... 3 System requirements:...

### Microsoft Access 2010 handout

Microsoft Access 2010 handout Access 2010 is a relational database program you can use to create and manage large quantities of data. You can use Access to manage anything from a home inventory to a giant

### MAS 500 Intelligence Tips and Tricks Booklet Vol. 1

MAS 500 Intelligence Tips and Tricks Booklet Vol. 1 1 Contents Accessing the Sage MAS Intelligence Reports... 3 Copying, Pasting and Renaming Reports... 4 To create a new report from an existing report...

### PTC Integrity Eclipse and IBM Rational Development Platform Guide

PTC Integrity Eclipse and IBM Rational Development Platform Guide The PTC Integrity integration with Eclipse Platform and the IBM Rational Software Development Platform series allows you to access Integrity

### CIS 500 Software Foundations Midterm I. Answer key. October 10, 2007

CIS 500 Software Foundations Midterm I Answer key October 10, 2007 Functional Programming 1. (2 points) Consider the following Fixpoint definition in Coq. Fixpoint zip (X Y : Set) (lx : list X) (ly : list

### Managing users. Account sources. Chapter 1

Chapter 1 Managing users The Users page in Cloud Manager lists all of the user accounts in the Centrify identity platform. This includes all of the users you create in the Centrify for Mobile user service

### BreezingForms Guide. 18 Forms: BreezingForms

BreezingForms 8/3/2009 1 BreezingForms Guide GOOGLE TRANSLATE FROM: http://openbook.galileocomputing.de/joomla15/jooml a_18_formulare_neu_001.htm#t2t32 18.1 BreezingForms 18.1.1 Installation and configuration

### COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing

COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing The scanner (or lexical analyzer) of a compiler processes the source program, recognizing

### Predicate Calculus. There are certain arguments that seem to be perfectly logical, yet they cannot be expressed by using propositional calculus.

Predicate Calculus (Alternative names: predicate logic, first order logic, elementary logic, restricted predicate calculus, restricted functional calculus, relational calculus, theory of quantification,

### Windows PowerShell Essentials

Windows PowerShell Essentials Windows PowerShell Essentials Edition 1.0. This ebook is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights

### Introducing Formal Methods. Software Engineering and Formal Methods

Introducing Formal Methods Formal Methods for Software Specification and Analysis: An Overview 1 Software Engineering and Formal Methods Every Software engineering methodology is based on a recommended

### 2. Basic Relational Data Model

2. Basic Relational Data Model 2.1 Introduction Basic concepts of information models, their realisation in databases comprising data objects and object relationships, and their management by DBMS s that

### VIP Quick Reference Card

VIP Quick Reference Card Loading VIP (Based on VIP 3.5 in GNU Emacs 18) Just type M-x vip-mode followed by RET VIP Modes VIP has three modes: emacs mode, vi mode and insert mode. Mode line tells you which

### Desktop, Web and Mobile Testing Tutorials

Desktop, Web and Mobile Testing Tutorials * Windows and the Windows logo are trademarks of the Microsoft group of companies. 2 About the Tutorial With TestComplete, you can test applications of three major

### Writer Guide. Chapter 15 Using Forms in Writer

Writer Guide Chapter 15 Using Forms in Writer Copyright This document is Copyright 2005 2008 by its contributors as listed in the section titled Authors. You may distribute it and/or modify it under the

### Basic Excel Handbook

2 5 2 7 1 1 0 4 3 9 8 1 Basic Excel Handbook Version 3.6 May 6, 2008 Contents Contents... 1 Part I: Background Information...3 About This Handbook... 4 Excel Terminology... 5 Excel Terminology (cont.)...

### 3. Recurrence Recursive Definitions. To construct a recursively defined function:

3. RECURRENCE 10 3. Recurrence 3.1. Recursive Definitions. To construct a recursively defined function: 1. Initial Condition(s) (or basis): Prescribe initial value(s) of the function.. Recursion: Use a

### USER CONVERSION P3, SURETRAK AND MICROSOFT PROJECT ASTA POWERPROJECT PAUL E HARRIS EASTWOOD HARRIS

P.O. Box 4032 EASTWOOD HARRIS PTY LTD Tel 61 (0)4 1118 7701 Doncaster Heights ACN 085 065 872 Fax 61 (0)3 9846 7700 Victoria 3109 Project Management Systems Email: harrispe@eh.com.au Australia Software

### Introduction to Predicate Calculus

Introduction to Predicate Calculus 1 Motivation Last time, we discuss the need for a representation language that was declarative, expressively adequate, unambiguous, context-independent, and compositional.