Functions and Sequences

Total Page:16

File Type:pdf, Size:1020Kb

Functions and Sequences Functions and Sequences Dr. Rong Qu [email protected] http://www.cs.nott.ac.uk/ rxq/#g53fsp ∼ G53FSP Formal Specification 1 Functions A function as used in Z Is a discrete function Acts on a discrete element from a particular set (its domain) as its argument Delivers a corresponding element from the same or another set as its result For this purpose it is defined to be a relation with its left-hand elements unique G53FSP Formal Specification 2 Functions The condition for a relation to be a function is that #R = #dom R Mapping We talk of the function mapping elements from its domain into elements of its range G53FSP Formal Specification 3 Examples The following relations will be functions Mapping bank customers to sets of account numbers (but not mapping customers to single account numbers, since one customer may have several accounts) Mapping file-names to areas on disc (if each file occupies a unique and distinct area) Mapping car number-plates to model names (all number plates should be distinct) G53FSP Formal Specification 4 Partial Function A partial function is one where the domain is a proper subset of the possible left-hand elements of the relation symbol: + instead of ! $ G53FSP Formal Specification 5 Total Function A total function is one in which the domain is the complete set If a relation acted on bank account numbers and delivered the amount in that account, it would be a partial function from the set of all possible account numbers (perhaps a 10 digit numbers). So we would declare it in a Z schema as balance : account number+ cash amount ! G53FSP Formal Specification 6 Injective Function An injective function is one whose inverse is also a function Concepts of partial and total functions still apply. Partial injective functions: >+ ! Total injective functions: > ! An injective function is a one-one relation G53FSP Formal Specification 7 Surjective Function A function is surjective if its range is the total set of possible objects Similarly it can be both partial and total The adjectives partial and total still refer to the domain A function is bijective if it is both injective and surjective G53FSP Formal Specification 8 Note Functions are a particular type of relation All the operations described in the previous section also apply to functions When writing explicit entries in a function, we shall normally use the symbol instead of a comma 7! G53FSP Formal Specification 9 Sequences The concept of an ordered collection of elements is very important in computing A queue is a collection of objects in which the ordering is important, and will occur in many real life situations G53FSP Formal Specification 10 Sequences In declarations we use the type seq, as waiting : seq people file : seq blocks people is the type of object in waiting blocks is the type of objects occupied by a file G53FSP Formal Specification 11 Example If people is the set F red; John; Sue f g We may write it explicitly as queue = (1; F red); (2; John); (3; Sue) f g Or for more clarity as queue = 1 F red; 2 John; 3 Sue f 7! 7! 7! g G53FSP Formal Specification 12 Example To specify a particular sequence directly, the notation can be simplified as < F red; John; Sue > Empty sequence as <> G53FSP Formal Specification 13 Concatenation the concatenation operator ^ Acts between sequences Gives a sequence as a result With the left-hand operand as the first set of elements in the sequence Followed by the elements from the right-hand operand G53FSP Formal Specification 14 Squash squash: monadic operator Takes as argument any function whose domain is a subset of N Results a sequence, in which The range elements of the original function have been ordered by the numeric values in the domain Domain elements have been replaced by consecutive integer values starting at 1 G53FSP Formal Specification 15 Squash Thus squash 9 e; 5 f; 7 r; 11 d =< f; r; e; d > f 7! 7! 7! 7! g It is often used as in new seq = squash( 5 ¡old seq)^another seq f g− G53FSP Formal Specification 16 Head and Tail head; tail: monadic operators Operate on a sequence head delivers the first object (a single element) tail delivers the sequence with the head removed (a sequence may be empty) Total injective functions: G53FSP Formal Specification 17 Summary Functions Partial and total (+ , ) ! ! Partial and total injective (>+ , > ) ! ! Surjective and bijective Sequences Concatenation ^ Squash (order), Head and tail (remove) G53FSP Formal Specification 18.
Recommended publications
  • I0 and Rank-Into-Rank Axioms
    I0 and rank-into-rank axioms Vincenzo Dimonte∗ July 11, 2017 Abstract Just a survey on I0. Keywords: Large cardinals; Axiom I0; rank-into-rank axioms; elemen- tary embeddings; relative constructibility; embedding lifting; singular car- dinals combinatorics. 2010 Mathematics Subject Classifications: 03E55 (03E05 03E35 03E45) 1 Informal Introduction to the Introduction Ok, that’s it. People who know me also know that it is years that I am ranting about a book about I0, how it is important to write it and publish it, etc. I realized that this particular moment is still right for me to write it, for two reasons: time is scarce, and probably there are still not enough results (or anyway not enough different lines of research). This has the potential of being a very nasty vicious circle: there are not enough results about I0 to write a book, but if nobody writes a book the diffusion of I0 is too limited, and so the number of results does not increase much. To avoid this deadlock, I decided to divulge a first draft of such a hypothetical book, hoping to start a “conversation” with that. It is literally a first draft, so it is full of errors and in a liquid state. For example, I still haven’t decided whether to call it I0 or I0, both notations are used in literature. I feel like it still lacks a vision of the future, a map on where the research could and should going about I0. Many proofs are old but never published, and therefore reconstructed by me, so maybe they are wrong.
    [Show full text]
  • Elementary Functions Part 1, Functions Lecture 1.6D, Function Inverses: One-To-One and Onto Functions
    Elementary Functions Part 1, Functions Lecture 1.6d, Function Inverses: One-to-one and onto functions Dr. Ken W. Smith Sam Houston State University 2013 Smith (SHSU) Elementary Functions 2013 26 / 33 Function Inverses When does a function f have an inverse? It turns out that there are two critical properties necessary for a function f to be invertible. The function needs to be \one-to-one" and \onto". Smith (SHSU) Elementary Functions 2013 27 / 33 Function Inverses When does a function f have an inverse? It turns out that there are two critical properties necessary for a function f to be invertible. The function needs to be \one-to-one" and \onto". Smith (SHSU) Elementary Functions 2013 27 / 33 Function Inverses When does a function f have an inverse? It turns out that there are two critical properties necessary for a function f to be invertible. The function needs to be \one-to-one" and \onto". Smith (SHSU) Elementary Functions 2013 27 / 33 Function Inverses When does a function f have an inverse? It turns out that there are two critical properties necessary for a function f to be invertible. The function needs to be \one-to-one" and \onto". Smith (SHSU) Elementary Functions 2013 27 / 33 One-to-one functions* A function like f(x) = x2 maps two different inputs, x = −5 and x = 5, to the same output, y = 25. But with a one-to-one function no pair of inputs give the same output. Here is a function we saw earlier. This function is not one-to-one since both the inputs x = 2 and x = 3 give the output y = C: Smith (SHSU) Elementary Functions 2013 28 / 33 One-to-one functions* A function like f(x) = x2 maps two different inputs, x = −5 and x = 5, to the same output, y = 25.
    [Show full text]
  • Monomorphism - Wikipedia, the Free Encyclopedia
    Monomorphism - Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Monomorphism Monomorphism From Wikipedia, the free encyclopedia In the context of abstract algebra or universal algebra, a monomorphism is an injective homomorphism. A monomorphism from X to Y is often denoted with the notation . In the more general setting of category theory, a monomorphism (also called a monic morphism or a mono) is a left-cancellative morphism, that is, an arrow f : X → Y such that, for all morphisms g1, g2 : Z → X, Monomorphisms are a categorical generalization of injective functions (also called "one-to-one functions"); in some categories the notions coincide, but monomorphisms are more general, as in the examples below. The categorical dual of a monomorphism is an epimorphism, i.e. a monomorphism in a category C is an epimorphism in the dual category Cop. Every section is a monomorphism, and every retraction is an epimorphism. Contents 1 Relation to invertibility 2 Examples 3 Properties 4 Related concepts 5 Terminology 6 See also 7 References Relation to invertibility Left invertible morphisms are necessarily monic: if l is a left inverse for f (meaning l is a morphism and ), then f is monic, as A left invertible morphism is called a split mono. However, a monomorphism need not be left-invertible. For example, in the category Group of all groups and group morphisms among them, if H is a subgroup of G then the inclusion f : H → G is always a monomorphism; but f has a left inverse in the category if and only if H has a normal complement in G.
    [Show full text]
  • Solutions to Homework Set 5
    MAT320/640, Fall 2020 Renato Ghini Bettiol Solutions to Homework Set 5 1. Decide if each of the statements below is true or false. If it is true, give a complete proof; if it is false, give an explicit counter-example. (Recall that a function f : X ! Y is called surjective, or onto, if every point of Y belongs to its image, that is, if f(X) = Y .) (a) There exists a continuous function f : R n f0g ! R. (b) There exists a continuous surjective function f : R n f0g ! R. (c) There exists a continuous function f : [0; 1] ! R. (d) There exists a continuous surjective function f : [0; 1] ! R. (e) The function f : R ! R, f(x) = x2, is uniformly continuous. (f) The function f : [0; 1] ! R, f(x) = x2, uniformly continuous. Solution: (a) TRUE: For example, any constant function f : R n f0g ! R is continuous; e.g., f(x) = 0 for all x 2 R n f0g. (b) TRUE: For example, consider the function f : R n f0g ! R given by ( x; if x < 0; f(x) = x − 1; if x > 0: Since the domain of f is R n f0g, it is continuous on its domain. Moreover, f is clearly surjective (draw its graph). (c) TRUE: For example, any constant function f : [0; 1] ! R is continuous; e.g., f(x) = 0 for all x 2 [0; 1]. (d) FALSE: Suppose, by contradiction, that such a function f : [0; 1] ! R exists. Since [0; 1] is compact and f : [0; 1] ! R is continuous, its image f([0; 1]) is compact.
    [Show full text]
  • Logic and Proof Release 3.18.4
    Logic and Proof Release 3.18.4 Jeremy Avigad, Robert Y. Lewis, and Floris van Doorn Sep 10, 2021 CONTENTS 1 Introduction 1 1.1 Mathematical Proof ............................................ 1 1.2 Symbolic Logic .............................................. 2 1.3 Interactive Theorem Proving ....................................... 4 1.4 The Semantic Point of View ....................................... 5 1.5 Goals Summarized ............................................ 6 1.6 About this Textbook ........................................... 6 2 Propositional Logic 7 2.1 A Puzzle ................................................. 7 2.2 A Solution ................................................ 7 2.3 Rules of Inference ............................................ 8 2.4 The Language of Propositional Logic ................................... 15 2.5 Exercises ................................................. 16 3 Natural Deduction for Propositional Logic 17 3.1 Derivations in Natural Deduction ..................................... 17 3.2 Examples ................................................. 19 3.3 Forward and Backward Reasoning .................................... 20 3.4 Reasoning by Cases ............................................ 22 3.5 Some Logical Identities .......................................... 23 3.6 Exercises ................................................. 24 4 Propositional Logic in Lean 25 4.1 Expressions for Propositions and Proofs ................................. 25 4.2 More commands ............................................
    [Show full text]
  • A New Characterization of Injective and Surjective Functions and Group Homomorphisms
    A new characterization of injective and surjective functions and group homomorphisms ANDREI TIBERIU PANTEA* Abstract. A model of a function f between two non-empty sets is defined to be a factorization f ¼ i, where ¼ is a surjective function and i is an injective Æ ± function. In this note we shall prove that a function f is injective (respectively surjective) if and only if it has a final (respectively initial) model. A similar result, for groups, is also proven. Keywords: factorization of morphisms, injective/surjective maps, initial/final objects MSC: Primary 03E20; Secondary 20A99 1 Introduction and preliminary remarks In this paper we consider the sets taken into account to be non-empty and groups denoted differently to be disjoint. For basic concepts on sets and functions see [1]. It is a well known fact that any function f : A B can be written as the composition of a surjective function ! followed by an injective function. Indeed, f f 0 id , where f 0 : A Im(f ) is the restriction Æ ± B ! of f to Im(f ) is one such factorization. Moreover, it is an elementary exercise to prove that this factorization is unique up to an isomorphism: i.e. if f i ¼, i : A X , ¼: X B is 1 ¡ Æ ±¢ ! 1 ! another factorization for f , then we easily see that X i ¡ Im(f ) and that ¼ i ¡ f 0. The Æ Æ ± purpose of this note is to study the dual problem. Let f : A B be a function. We shall define ! a model of the function f to be a triple (X ,i,¼) made up of a set X , an injective function i : A X and a surjective function ¼: X B such that f ¼ i, that is, the following diagram ! ! Æ ± is commutative.
    [Show full text]
  • Proofs and Mathematical Reasoning
    Proofs and Mathematical Reasoning University of Birmingham Author: Supervisors: Agata Stefanowicz Joe Kyle Michael Grove September 2014 c University of Birmingham 2014 Contents 1 Introduction 6 2 Mathematical language and symbols 6 2.1 Mathematics is a language . .6 2.2 Greek alphabet . .6 2.3 Symbols . .6 2.4 Words in mathematics . .7 3 What is a proof? 9 3.1 Writer versus reader . .9 3.2 Methods of proofs . .9 3.3 Implications and if and only if statements . 10 4 Direct proof 11 4.1 Description of method . 11 4.2 Hard parts? . 11 4.3 Examples . 11 4.4 Fallacious \proofs" . 15 4.5 Counterexamples . 16 5 Proof by cases 17 5.1 Method . 17 5.2 Hard parts? . 17 5.3 Examples of proof by cases . 17 6 Mathematical Induction 19 6.1 Method . 19 6.2 Versions of induction. 19 6.3 Hard parts? . 20 6.4 Examples of mathematical induction . 20 7 Contradiction 26 7.1 Method . 26 7.2 Hard parts? . 26 7.3 Examples of proof by contradiction . 26 8 Contrapositive 29 8.1 Method . 29 8.2 Hard parts? . 29 8.3 Examples . 29 9 Tips 31 9.1 What common mistakes do students make when trying to present the proofs? . 31 9.2 What are the reasons for mistakes? . 32 9.3 Advice to students for writing good proofs . 32 9.4 Friendly reminder . 32 c University of Birmingham 2014 10 Sets 34 10.1 Basics . 34 10.2 Subsets and power sets . 34 10.3 Cardinality and equality .
    [Show full text]
  • Foundations of Abstract Mathematics Paul L. Bailey
    Foundations of Abstract Mathematics Paul L. Bailey Department of Mathematics, Southern Arkansas University E-mail address: [email protected] Date: January 21, 2009 i Contents Preface vii 1. Purpose vii 2. Description of the Blocks vii 2.1. Commentary vii 2.2. Developmental Blocks vii 2.3. Orientation Blocks viii 3. Description of the Volumes viii 3.1. Foundations of Abstract Mathematics viii 3.2. Objects of Abstract Mathematics viii 3.3. Categories of Abstract Mathematics viii 4. Description of this Volume viii 4.1. Goals viii 4.2. Similar Treatments ix Chapter 1. Sets 1 1. Orientation 1 2. Axioms of Set Theory 2 3. Subsets 3 4. Set Operations 4 5. Cartesian Product 7 6. Relations 9 7. Numbers 10 8. Problems and Exercises 11 Chapter 2. Functions 13 1. Mappings 13 2. Functions 14 3. Images and Preimages 15 4. Injective and Surjective Functions 15 5. Restrictions and Constrictions 16 6. Composition of Functions 17 7. Identities and Inverses 17 8. Retractions and Sections 18 9. Monos and Epis 19 10. Inclusions and Projections 20 11. Problems and Exercises 21 Chapter 3. Collections 23 1. Collections 23 2. Power Sets 23 iii iv CONTENTS 3. Mapping Sets 24 4. Function Sets 24 5. Characteristic Functions 25 6. Products 26 7. Coproducts 27 8. Families 28 9. Partitions 29 10. Problems and Exercises 30 Chapter 4. Relations 31 1. Relations 31 2. Properties of Relations 31 3. Order Relations 32 4. Equivalence Relations 34 5. Equivalence Classes 35 6. Equivalence Relations and Partitions 35 7. Equivalence Relations and Functions 37 8.
    [Show full text]
  • Midterm 2 Review the Exam Will Cover Chapters 4 (Functions
    Midterm 2 Review The exam will cover Chapters 4 (Functions, injections, surjections, bijections, cardinality of sets etc.) and 13 (sequences, convergence, bounded, monotone etc.). 1 As I stated in class, the first problem on the test will be to state the definition of a sequence (an)n=1 converging to a limit L 2 R. You should also be able to state the other definitions in these chapters, and the exam will also ask for some of these definitions. Here is a list of definitions you should be able to state: • injective function • surjective function • bijective function • cardinality of a finite set • countable set • composition of two functions • convergent sequence • bounded sequence • monotone sequence • supremum and infimum of a set/sequence You should also be able to produce examples of each of these objects, and also examples which have various combinations of these properties (e.g. a function which is injective but not surjective, or a sequence which is bounded but not monotone), as well as when there exist no examples (e.g. an unbounded convergent sequence, which cannot exist because every convergent sequence is bounded). For example, if X = f1; 2; 3g and Y = f4; 5; 6; 7g, then an example of a function f : X ! Y which is injective and not surjective would be to define f as follows: f(1) = 5, f(2) = 4, f(3) = 7. n For example, a sequence which is bounded but not monotone is an = (−1) . You should be able to prove that a given sequence converges, and good practice for this would be (−1)n 1 1 1 p1 showing that sequences like n , n2 , n3 , n , n all converge.
    [Show full text]
  • Consider the “Function” F(X) = 1 X − 4 . in Fact, This Is Not a Function Until I Have Told You It's Domain and Codomain
    Consider the “function” 1 f(x) = . x − 4 In fact, this is not a function until I have told you it’s domain and codomain. More accurately we have to talk about the function 1 f : R \{4} → R, f(x) = . x − 4 It’s important to get in the habit of specifying the domain and codomain. In fact the definition of function f : A → B specifies it as a subset of the cartesian produce A × B. From this point of view, our function is the set {(x, 1/(x − 4) : x ∈ R \{4}} ⊂ R \{4} × R 1 Note: my definition of function is different from that of the book. Book does not require that the function be defined everywhere in A. Range The range of a function f : A → B is the subset of B consisting of values of the function. A function is surjective (or onto) if the range equals the codomain. The function f : R \{4} → R given by f(x) = 1/(x − 4) is not surjective because it misses the value 0. That is, the equation g(x) = 0 has no solution in R \{4}. 2 However, if we define a new function g : R \{4} → R \{0}, using the same formula g(x) = 1/(x−4), then g is a surjective function. Note that although the formula is the same, this is a different function from f because we have changed the codomain. To prove g is surjective, we must show that if y ∈ R \{0}, then the equation g(x) = y has a solution x ∈ R\{4}.
    [Show full text]
  • Notes for MATH 582
    Notes for MATH 582 David J. Fern´andez-Bret´on (based on the handwritten notes from January-April 2016, typed in January-April 2017, polished in January-April 2018) Table of Contents Chapter 1 Basic set theory 3 1.1 What is a Set? . 3 1.2 Axiomatizing set theory . 3 1.3 The Language of set theory . 4 1.4 Cantor's set theory . 6 1.5 Patching up Cantor's set theory . 8 1.6 Other ways of dodging Russell's Paradox . 14 1.7 The last few words about the axiomatic method . 15 Chapter 2 Relations, functions, and objects of that ilk 17 2.1 Ordered pairs, relations and functions . 17 2.2 Equivalence relations . 23 2.3 Partial orders . 26 2.4 Well-orders . 28 Chapter 3 The natural numbers, the integers, the rationals, the reals... and more 32 3.1 Peano Systems . 32 3.1.1 Arithmetic in a Peano system . 34 3.1.2 The order relation in a Peano system . 35 3.1.3 There exists one Peano system . 37 3.2 The integers . 38 3.3 The rational numbers . 38 3.4 The real numbers . 39 3.4.1 Dedekind cuts . 39 3.4.2 Cauchy sequences . 39 3.5 Other mathematical objects . 44 Chapter 4 Ordinal numbers 45 4.1 Definition and basic facts . 45 4.2 Classes . 48 4.3 A few words about NBG ............................................... 50 4.4 The Axiom of Replacement . 50 4.5 Ordinal numbers as representatives of well-ordered sets . 53 4.6 Sets and their ranks .
    [Show full text]
  • Injective, Surjective, and Bijective Functions
    Module A-5: Injective, Surjective, and Bijective Functions Math-270: Discrete Mathematics November 10, 2019 Motivation You’re surely familiar with the idea of an inverse function: a function that undoes some other function. For example, f(x)=x3 and g(x)=p3 x are inverses of each other. Whether thinking mathematically or coding this in software, things get compli- cated. The theory of injective, surjective, and bijective functions is a very compact and mostly straightforward theory. Yet it completely untangles all the potential pitfalls of inverting a function. Terminology If a function f maps a set to a set , we are accustomed to calling the domain (which is fine) but we are also accustomed to callingX the range,Y and that is sloppy. The rangeX of f is the set of values actually hit by f. In other words, y isY in the range of f(x) if and only if there is some x in the domain such that f(x)=y. Without this restriction, we refer to as the co-domain of f(x). You have probably heard the phrase “y is theY image of x”whenf(x)=y. Likewise, we can say “x is a pre-image of y.” Notice that we say “a pre-image” and not “the pre-image.” That’s because y might have multiple pre-images. For example, if f(x)=x2 as a function of the real line, then y = 4 has two pre-images: x = 2 and x = 2. Meanwhile, y = 0 has only one pre-image, x = 0. In contrast, y = 1 has no pre-images.
    [Show full text]