Functions 8–2

Functions 8–2

8–1 Functions 8–2 Partial functions A partial function from X to Y is a relation that maps each element of X to at most one element of Y . X →7 Y == { f : X ↔ Y | ∀ x : X ; y1; y2 : Y • x , y1 ∈ f ∧ x , y2 ∈ f ⇒ y1 = y2 } 8–3 Example where is : Person →7 Location where is ={otto , lobby; peter , meeting; quentin , meeting; rachel , meeting} 8–4 Total functions If each element of the source set is related to some element of the target, then the function is said to be total. X → Y == {f : X →7 Y | dom f = X } 8–5 Example double : N ↔ N ∀ m; n : N • m , n ∈ double a m + m = n 8–6 Application ∃ • : = , ∈ 1 p : f p 1 aab f [app−intro] b = fa provided that b does not appear free in a 8–7 Conversely ∃ • : = = 1 p : f p 1 abfa [app−elim] a , b ∈ f provided that b does not appear free in a 8–8 Examples • where is rachel = meeting • double 7 = 14 • double −1 = 2 ? 8–9 Lambda notation λ declaration | constraint • result The source type of such a function is the Cartesian product of the types in the declaration. 8–10 Example double : N → N double = λ m : N • m + m 8–11 Toolkit functions The operators defined upon relations, such as ‘dom’and‘/’, are all functions. 8–12 Example [X ; Y ] dom : (X ↔ Y ) → P X ran : (X ↔ Y ) → P Y ∀ R : X ↔ Y • dom R ={x : X |∃y : Y • x , y ∈ R } ran R ={y : Y |∃x : X • x , y ∈ R } 8–13 Fixity For convenience, we may decide that function names are to be used as prefix, infix, or suffix symbols. In the definition of infix and suffix symbols, we use underscores to indicate the placement of arguments. 8–14 Example [X ; Y ] / : P X × (X ↔ Y ) → (X ↔ Y ) . : (X ↔ Y ) × P Y → (X ↔ Y ) ∀ R : X ↔ Y ; A : P X ; B : P Y • A / R = { x : X ; y : Y | x ∈ A ∧ x , y ∈ R • x , y } R . B = { x : X ; y : Y | y ∈ B ∧ x , y ∈ R • x , y } 8–15 Example [X ; Y ] ∼ : (X ↔ Y ) → (Y ↔ X ) ∀ R : X ↔ Y • R∼ ={x : X ; y : Y | x , y ∈ R • y , x } 8–16 Question Suppose that f and g are functions. Is it necessarily the case that f ∪ g is a function? 8–17 Overriding If f and g are functions of the same type, then f ⊕ g is a function that agrees with f everywhere outside the domain of g; but agrees with g where g is defined: [X ; Y ] ⊕ : (X ↔ Y ) × (X ↔ Y ) → (X ↔ Y ) ∀ f ; g : X ↔ Y • f ⊕ g = (dom g /− f ) ∪ g 8–18 Original 8–19 Update 8–20 Override 8–21 Properties of functions )7 partial, injective functions ) total, injective functions →→7 partial, surjective functions →→ total, surjective functions )→7 partial, bijective functions )→ total, bijective functions 8–22 Injections, surjections, and bijections If each element of the domain is mapped to a different element of the target, then the function is injective. (1to1) If the range of the function is the whole of the target, then the function is surjective. (onto) A function which is both injective and surjective is said to be bijective. (1 to 1 correspondence) 8–23 Example locate : CallSign )7 Position 8–24 8–25 Example station : Staff →→7 Door 8–26 8–27 8–28 Functionality test Following this slide there are five graphs. Which of the relations illustrated are • functional? • injective? • surjective? • bijective? 8–29 8–30 8–31 8–32 8–33 8–34 Finite sets A finite set is one whose elements are countable up to some natural number n: that is, a set that may be seen as the range of a total bijection from 1; 2;:::;n. F X == { s : P X |∃n : N •∃f :1::n )→ s • true } where :: : N × N → PN ∀ m; n : N • m ::n ={i : N | m ≤ i ≤ n} 8–35 Question Which of the following sets are finite? • Oceans • Jose Felicianos • Rockallers • Primes 8–36 Hash, or cardinality [X ] #:F X → N ∀ s : F X ; n : N • n = #s a ∃ f : (1 ::n) )→ s • true 8–37 Finite functions • finite functions: A →77 B == { f : A →7 B | dom f ∈ F A } • finite injections: A )77 B == A →77 B ∩ A )7 B 8–38 Summary • special relations • partial, total • application • λ notation • overriding • injective, surjective, bijective • finite functions.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    38 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us