Title: Computing Fundamentals 1 Lecture 8 Functions
1Computing Fundamentals 1 Lecture 8Functions
- Lecturer Patrick Browne
- http//www.comp.dit.ie/pbrowne/
- Room K308
- Based on Chapter 14.
- A Logical approach to Discrete Math
- By David Gries and Fred B. Schneider
2- Given two countries Aland and Bland. We can
travel from Aland to Bland using AtoB airways.
Cities in Aland are called ai and cities in Bland
are called bi .
b4
a1 a2 a3
AtoB
b1 b2 b3
Aland
Bland
3- From any given city ai in Aland AtoB airways
provide one and only one flight to one city bi in
Bland. In other words, you can travel from every
city in Aland but cannot travel to more than one
city in Bland from that Aland city. We can
consider the flights offered by AtoB as function
called FAtoB.
b4
a1 a2 a3
FAtoB
b1 b2 b3
Aland
Bland
4- There are some cities in Bland, such as b4, that
are not served by AtoB airways, therefore they
cannot be reached from Aland. Obviously, if you
cannot get to b4 then you cannot come back to
Aland from b4 . (no return tickets)
b4
a1 a2 a3
AtoB
b1 b2 b3
Aland
Bland
5- If for every city that AtoB airways flies into
in Bland they supply a return ticket, then AtoB
supply a pair of functions, FAtoB and FBtoA. We
call FAtoB an injective function because it has a
left inverse (a return ticket).
b4
a1 a2 a3
FAtoB
b1 b2 b3
Aland
Bland
6- If AtoB airways flies into every city in Bland,
still using the original rule that only one
flight can leave an Aland city, then there may be
more than one way back to Aland. For example,
from b2 you can fly to a1 or a3. Then FAtoB is
called a surjective function. It has a right
inverse (but you may not get back to where you
started).
a1 a2 a3
FAtoB
b1 b2
Aland
Bland
7- If a function is both injective and surjective it
is then called bijective, it has both a left and
right inverse.
a1 a2 a3
FAtoB
b1 b2 b3
Aland
Bland
8http//en.wikipedia.org/wiki/Inverse_functionLeft
_and_right_inverses
9Functions
- We apply function to argument (function
application) - Function definition g.x 3 ? x 6
- g(5)
- Gives the value of 3?56
- To reduce brackets we can write
function.argument. - We evaluate this function
- g.5
- lt Apply functiongt
- 3 ? 5 6
- lt Arithmeticgt
- 21
10Functions
- Functions can be considered as a restricted form
of relation. This is useful because the
terminology and theory of relations carries over
to function. - In programming languages like C or CafeOBJ a
function can have a signature, which includes its
name, type of argument and the type of the
expected return value.
11Fibonacci Function in C and CafeOBJ
Signature of a function consists of a name,
argument(s) type, and return type Function Name
Argument type p is a
predecessor function
mod FIBO-NAT pr(NAT) op fib Nat -gt Nat
var N Nat eq fib(0) 0 . eq fib(1) 1 .
ceq fib(N) fib(p(N)) fib(p(p(N)))
if N gt 1 .
int fib(int n) if (n lt 1) return n else
return fib(n-1) fib(n-2)
Argument variable
12Fibonacci Function in C and CafeOBJ
Signature of a function consists of a name,
argument(s) type, and return type.
Return type
mod FIBO-NAT pr(NAT) op fib Nat -gt Nat
var N Nat eq fib(0) 0 . eq fib(1) 1 .
ceq fib(N) fib(p(N)) fib(p(p(N)))
if N gt 1 .
int fib(int n) if (n lt 1) return n else
return fib(n-1) fib(n-2)
Argument constraints
13Functions
- A function f is a rule for computing a value v
from another value w, so that the application
f(w) or f.w denotes a value vf.w v. The
fundamental property of function application,
stated in terms of inference rule Leibniz is
- This property allows us to conclude theorems like
f(bb) f(2?b) and f.b f.b 2?f.b.
14Functions and programming
- In programming functions can have side effects
i.e. they can change a parameter or a global
variable. For example, if b is changed by the
function f then - f.b f.b 2 ? f.b
- no longer holds. This makes it difficult to
reason or prove properties about a program. By
prohibiting side-effects we can use mathematical
laws for reasoning about programs involving
function application.
15Functions as relations
- While we can consider functions as a rule we can
also think of functions as a binary relation B ?
C, that contains all pairs ltb,cgt such that f.bc.
A relation can have distinct values c and c that
satisfy bfc and bfc, but a function cannot.
c
Allowed for relations but not allowed for
functions
b
c
16Functions Textual Substitution
- Function application can be defined as textual
substitution. If - g.zE
- Defines a function g then function application
g.X for any argument X is defined by - g.X Ez X
17Function Def. Types
- A binary relation f on B ? C, is called a
function iff it is determinate. - Determinate
- (?b,c,c b f c ? b f c cc)
- A function f on B ? C is total if
- Total B Dom.f
- Otherwise it is partial. We write fB?C for the
type of f if f is total and fB?C if f is
partial.
18Functions
- This close correspondence between function
application and textual substitution suggests
that Leibniz (1.5) links equality and function
application. So, we can reformulate Leibniz for
functions.
19Functions Types
- In Computer Science many types are needed.
- Simple types like integers and natural numbers
- Complex types like sets, lists, sequences.
- Each function has a type which describes the
types of its parameters and the type of its
result - (8.1) f t1 ? t1 ...? t1? r
20Functions their types
- plus????? (plus(1,3)or 13)
- not ??? (not(true) or ?true)
- less????? (less(1,3)or 1lt3)
21Functions Types
22Functions Types
- Certain restrictions are need to insure
expression are type correct. - During textual substitution Ex F, x and F
must have the same type. - Equality bc is defined only if b and c have the
same type. Treating equality as an infix
function - __ t?t? ?
- For any type t.
2314.41 Theorem
- Total function fB?C is surjective (or onto ) if
Ran.f C. - Total function fB?C is injective (or one-to-one)
if - (?b,bB,cC bfc ? bfc ? bb)
- A function is bijective if it is injective and
surjective.
2414.41 Theorem
- Total function f is injective,one-to-one if
- (?b,bB,cC bfc ? bfc ? bb)
- Total function fB?C is surjective, onto if
- Ran.f C.
- A function is bijective if it is injective and
surjective.
25- An Injective function can
- f A -gtB fA -gtB f-1 ? B -gtA f (have
inverse) - f A-gtB fA -gtB dom f A f (be
total) -
Target
Source
f
a1 a2 a3
b1 b4 b2 b3
A
B
dom f
ran f
26Injective function in CafeOBJ()
- module INJ
- A B
- op f_ A -gt B
- op g_ B -gt A
- var a A
- vars a b' B
- eq linv g f a a .
- ceq inj b b' if g b g b' .
27Injective function in CafeOBJ()
- eq linv g f A A .
- linv represents an axiom for a left inverse
taking an A to a B and back to the same A. The
linv equation says that g is a left inverse of
f (i.e. g(f(a)) a). - ceq inj B B' if g B g B' .
- The conditional equation inj represents the
injective property, that two Bs are the same if
they map to the same A. The inj equation
expresses the injective (or one-to-one) property.
28- CafeOBJ Injective Function left inverse
- mod INJ A B
- op f_ A -gt B op g_ B -gt A
- var a A
- vars b0 b1 B
- eq linv g f a a .
- ceq inj b0 b1 if g b0 g b1 .
Not in range of f.
b4
a1 a2 a3
f
b1 b2 b3
A
B
dom f
ran f
29- Surjective Function
- Total function fA?B is surjective, onto if
- Ran.f B.
a1 a2 a3
f
b1 b2
A
B
dom f
ran f
3014.42 Theorem
- Let fB?C be a total function, and let f-1 is
its relational inverse. If f is not injective
(one-to-one) then f-1 is not a determinate
function.
?
?
?
B
C
?
C
B
?
?
Function f not injective
The inverse (f-1) is not determinate
3114.42 Theorem
- Let fB?C be a total function, and let f-1 be its
relational inverse. Then f-1 is a (i.e.
determinate) function iff f is injective
(one-to-one). And, f-1 is total if f is
surjective (onto).
?
?
?
?
B
B
C
C
?
?
Inverse not surjective (onto)
Function not total
3214.42 Theorem
- Let fB?C be a total function, and let f-1 be its
relational inverse. Then f-1 is total iff f is
surjective (onto).
?
?
?
?
B
B
C
C
?
?
Inverse not surjective (onto)
Function not total
33Total Partial functions
- Dealing with partial functions can be difficult.
Whats the value of (f.bf.b) if b?Dom.f ? - The choice of value must be such that the rules
of manipulations that we use in the propositional
and predicate calculus hold even in the presence
of undefined values, and this is not easy to
achieve. However, for partial function fB?C one
can always restrict attention to its total
counterpart, fDom.f? C
34Functions
- Binary relation lt is not a function because 1
lt 2 and 1 lt 3 both hold. - Identity relation iB over B is a total function,
iBB?B ibb for all b in B. - Total function f??? is defined by f(n)n1 is
the relation lt0,1gt,lt1,2gt,. - Partial function f??? is defined by f(n) 1/n
is the relation lt1,1/1gt,lt2,1/2gt,lt3,1/3gt. It is
partial because f.0 is not defined. - Note ? is a natural number, ? is a rational
number.
35Functions
- ? is an integer, ? is a positive integer, ?- is
a negative integer. - Function f??? is defined by f(b)1/b is total,
since f.b is defined for all elements of ?.
However, g??? is defined by g.b 1/b is partial
because g.0 is not defined.
36Functions
- The partial function f takes each lower case
character to the next character can be defined by
a finite number of pairs lta,bgt,ltb,cgt,..,lt
y,zgt - It is partial because there is no component whose
first component is z.
37Functions
- When partial and total functions are viewed as
binary relations, functions can inherit
operations and properties of binary relations. - Two functions are equal when their sets of pairs
are equal. - Similar to relations, we can have the product and
powers (or composition see later) of functions.
38Inverses of Total Functions
- Every relation has an inverse relation.
- However, the inverse of a function does not have
to be a function. For example - f??? defined as f(b)b2.
- f(-2)4 and f(2)4
- f-1(4)?2, two values.
39Inverse of Total Functions
- Partial functions
- Total functions
- Injective or on-to-one
- Surjective or onto
- Bijective has inverse
40Functions Products
- We can have the product of two relations.
- We now look at the product (f ? g) of two total
functions. - (f ? g).b d
- lt viewing as relation gt
- b(f ? g)b
- lt product of relation 14.20gt
- (? bfc ? cgd)
- lt relation as function application gt
- (? f.bc ? g.cd)
- ltTrading 9.19gt
- (? c f.b g.cd)
- lt one point rule 8.14gt
- g(f.b) d
41Functions Products
- (f ? g).b d
- lt viewing as relation gt
- b(f ? g)b
- lt product of relation 14.20gt
- (? bfc ? cgd)
- lt relation as function application gt
- (? f.bc ? g.cd)
- ltTrading 9.19gt
- (? c f.b g.cd)
- lt one point rule 8.14gt
- g(f.b) d
- Hence (f ? g).b g(f.b). This illustrates the
difference between relational notation and
functional notation.
42Functions Products
- Hence (f?g).b g(f.b). This illustrates the
difference between relational notation and
functional notation, particularly for products.
Functions possess an asymmetry between input and
output. Expression f(arg) stands for the value of
the function for the argument. On the other hand
a relational expression r(a,b) is a statement
that may be true or false. The product operation
for relations is legal when the range of the
first relation is the same as the domain of the
second relation.
43Functions Products
- We would prefer f(g.b) instead of g(f.b). So we
have the new symbol ? for composition of
functions, defined as - f ? g ? g ? f
44Composition of Functions1
g o f, the composition of f and g
45Composition of Functions1
- The functions fX?Y and gY?Z can be composed by
first applying f to an argument x and then
applying g to the result. Thus one obtains a
function - gof X ? Z
- defined by (gof)(x)Â g(f(x)) for all x in X.
- The notation gof is read as "g circle f" or "g
composed with f. - The composition of functions is always
associative. That is, if f, g, and h are three
functions with suitably chosen domains and
codomains, then f o (g o h)  (f o g) o h.
46A function in C
- int addTwo(int arg) Example of
usage - return (arg2) y addTwo(7)
-
addTwo(arg1)
arg1 arg2
return1 return2
addTwo(arg2)
Return valueint
Argumentint
47- A function is a relation
- A function is a special case of a relation in
which there is at most one value in the range for
each value in the domain. A function with a
finite domain is also known as a mapping. Note in
diagram no diverging lines from left to right.
f
x5
x1 x2 x4 x6
y1 y2
X
Y
x3
Dom.f
Ran.f
48- A function is a relation
- The function fX?Y the function f, from X to
Y - Is equivalent to relation XfY with the
restriction that for each x in the domain of f, f
relates x to at most one y
f
x5
x1 x2 x4 x6
y1 y2
X
Y
x3
Dom.f
Ran.f
49Functions
- The relation between persons and their identity
numbers - identityNo ? lt Person, ?gt or
- Person identityNo ?
- is a function if there is a rule that a person
may only have one identity number . It could be
defined - identityNo Person ? ?
- Perhaps there should also be a rule that only one
identity number may be associated with any one
person, but that is not indicated here.
50Functions
- A functions source and target can be the same
domain or type - hasMother Person ? Person
- any person can have only one mother and several
people could have the same mother.
51Function Application
- All the concepts which pertain to relations apply
to functions. - In addition a function may be applied.
- Since there will be at most only one value in the
range for a given x it is possible to designate
that value directly. - The value of f applied to x is the value in the
range of function of the function f corresponding
to the value of x in its domain.
52Function Application
- The application is undefined if the value of x is
not in the domain of f. - It is important to check that the value of x is
in the domain of the function f before
attempting to apply f to x. - The application of the function to the value x
(the argument) is written f.x or f(x)
53Function Application
- We can check the applicability of f by writing
- x ? dom f
- f.x y
- These predicates must be true if f(x)y is a
function.
54Partial and Total Functions
- If the identyNo function is a partial function
there may be values in the source that are not in
the domain (some people may have no identity
number). - A total function is one where there is a is a
value for every possible value of x, so f.x is
always defined. It is written - f X ?Y
- Because
- Dom f X (or source)
- function application can always be used with a
total function.
55Total Functions
- The function age, from Person to natural number,
is total since every person has an age - age Person ? ?
- The function hasMother, is total since every
person has one mother (including a mother!) - hasMother Person ? Person
56Injective Function
- An injective function may be partial or total.
- The functions identityNo and MonogamousMarriage
are injective.
57Isomorphism
- Given two functions
- fA-gtB, gB-gtA
- f is isomorphism or invertible map iif gfIA and
fgIB . - Where IA, IB are the identity functions of A and
B respectively. - A left inverse of f is a function g such that
- g(f(x)) x.
- or using alternative notation
- g f x x
58Isomorphism
- Let fA-gtA and gB-gtB be two functions on A and B
respectively. If there is a mapping t that
converts all x in A to some ut(x) in B such that
g(t(x))t(f(x)), then the two functions f and g
are homomorphic and t is a homomorphism - If also if t is bijective, then the two
functions are isomorphic and t is an isomorphism
with respect to f and g.
59Isomorphism
x t u
Arabic f
g Roman
y t z
60 Two injective functions
A non-injective
function.
61Injective Function f
- Using the INJ module and the CafeOBJ apply
command we will prove that an injective function
with a right inverse is an isomorphism. - For fA-gtB, gB-gtA is isomorphism or invertible
map iif gfIA and fgIB - A function f has at least one left inverse if it
is an injection. - A left inverse is a function g such that
- g f a a
- or
- g(f(a)) a
- See lab 6 for details
62Injective Function f
- module INJ -- module name
- A B -- two sorts
- op f_ A -gt B -- a function from A to B
- op g_ B -gt A -- a function from B to A
- var a A -- variables
- vars b b' B
- -- equation for left inverse equation of f
- eq linv g f a a .
- -- conditional equation for injective property
- ceq inj b b' if g b g b' .
-
- The Linv equation says that g(f(x)) x, i.e. g
is a left inverse of f. - The inj equation expresses the injective (or
one-to-one) property. - A function f has at least one "left inverse" if
and only if it is an injection.
63Injective Function f
- open INJ .
- op b gt B . -- make a constant b
- -- make a right inverse as the term to which the
equation(s) will be applied to. - start f g b .
- -- substitute B f g b (our term) and B' b
in inj - apply .inj with B' b at term .
- -- normal evaluation will execute linv
- apply red at term .
- result b B
64Injective Function f
- In CafeOBJ equations are written declaratively
and interpreted operationally as rewrite rules,
which replace substitution instances of the LHS
by the corresponding substitutions instances of
the RHS. The operational semantics normally
require that the least sort of the LHS is greater
that or equal to the least sort of the RHS. The
Linv equation says that g(f(x)) x (or g is a
left inverse of f). The inj equation expresses
the injective (or one-to-one) property.
65Right Inverse
- module GROUP
- G
- op 0 -gt G
- op __ G G -gt G assoc
- op -_ G -gt G
- var X G
- eq EQ1 0 X X .
- eq EQ2 (-X) X 0 .
66Right Inverse manual Proof
- We want to prove that X is a right inverse of .
- A standard proof goes as follows
- X ( X)
- 0 X ( X)
- ( ( X)) ( X) X ( X)
- ( ( X)) 0 ( X)
- ( ( X)) ( X)
- 0
67Right inverse CafeOBJ proof
- open GROUP
- op a gt G . -- a constant
- start a ( a) . the term
- apply .1 at (1) .
- apply .2 with X a at 1 .
- apply reduce at term .
68 69- An Surjective functions1.
Two surjective functions
A non-surjective
function
70- An Surjective Composition1.
- Surjective composition the first function need
not be surjective
71A bijective function
Composition gof of two functions is bijective, we
can only say that f is injective and g is
surjective.
72Some examples, range on the left domain on the
right
A function is called a bijection , if it is onto
and one-to-one. A bijective function has an
inverse
Function Application
A function f from X to Y is a relation from X to
Y having the properties 1. The domain of f is
in X. 2. If (x,y),(x,y)?f, then yy (no fan out
from domain). A total function from X to Y is
denoted f X? Y.
73A Function
- Given
- Side left ? right
- the function
- driveON Country ? Side
- Representing the side of the road vehicles drive
on is a surjection, because the range includes
all the values of the type Side. It would usually
be considered total because driveOn should be
defined in all countries.
74What is a Hash Function?
- A hash function takes a data item to be stored or
retrieved (say to/from disk) and computes the
first choice for a storage location for the item.
For example assume StudentNumber is the key
field of a student record, and one record is
stored on one disk block. To store or retrieve
the record for student number n in a choice of
11 disk locations numbered 0 to 10 we might use
the hash function. - h(n) n mod 11
75Describe the steps needed to store a record for
student number 257 using in locations disk 0-10
using h(n) n mod 11
558
32
132
5
15
102
0 1 2 3 4 5 6
7 8 9 10
Steps to store 257 using h(n)n mod 11 into
locations 0-10 1. Calculate h(257) giving 4. 2.
Note location is already occupied, a collision
has occurred. 3. Search for next free space ,
with 0 assumed to follow 10. 4. If no free space
then array is full, otherwise store 257 in next
free space
558
32
132
5
15
102
257
0 1 2 3 4 5 6
7 8 9 10
76Exercise 1
- Only one person can book a room. A system records
the booking of hotel rooms on one night. Given
the domain of discourse consists of - Rooms the set of all rooms in hotel
- Person the set of all possible persons
- The state of the hotels bookings can be
represented by the following - bookedTo Room ? Person
77Exercise 1 Solution
- (a) Explain why bookedTo is a function.
- bookedTo is a function since it maps rooms to
persons and for any given room(domain) at most
one person (range) can book it. A person can book
any number of rooms. - b) Explain why bookedTo is partial.
- The function is partial since not all rooms have
been booked.
78Example()
- Which of the following sets P, Q, and R
represents a partial, surjective, injective or
bijective function from X1,2,3,4 to
Ya,b,c,d? In each case explain your reasoning.
- P lt1,agt,lt2,agt,lt3,cgt,lt4,bgt
- Q lt1,cgt,lt2,agt,lt3,bgt,lt4,cgt,lt2,dgt
- R lt1,cgt ,lt2,dgt,lt3,agt,lt4,bgt
79Example()
- Which of the following sets P, Q, and R
represents a partial, surjective, injective or
bijective function from X1,2,3,4 to
Ya,b,c,d? In each case explain your reasoning.
- P lt1,agt,lt2,agt,lt3,cgt,lt4,bgt
- P is a total function from X to Y.
- Domain X, rangea,b,c. The function neither
injective (both 1 and 2 map to a) nor surjective
(nothing maps to d).
80Example()
- Which of the following sets P, Q, and R
represents a partial, surjective, injective or
bijective function from X1,2,3,4 to
Ya,b,c,d? In each case explain your reasoning.
- Q lt1,cgt,lt2,agt,lt3,bgt,lt4,cgt,lt2,dgt
- Q is not a function from X to Y, because 2 maps
to both a and d.
81Example()
- Which of the following sets P, Q, and R
represents a partial, surjective, injective or
bijective function from X1,2,3,4 to
Ya,b,c,d? In each case explain your reasoning.
- R lt1,cgt ,lt2,dgt,lt3,agt,lt4,bgt
- R is a total function from X to Y.
- Domain X, range Y. The function both injective
and surjective.
82Exercise
- Which of the following sets represents a
functions from 1,2,3 to 4,5,6? If it is a
functions, what type of function is it?. - P lt1, 4gt ,lt2,5gt, lt3, 4gt
- Q lt1, 4gt ,lt2, 6gt
- R lt1, 4gt ,lt2, 1gt,lt3,3gt
83Exercise
- Which of the following sets represents a
functions from X 1,2,3,4 to Ya,b,c,d? If
it is a functions, what type of function is it? - P lt1,agt,lt2,agt,lt3,cgt,lt4,bgt
- Q lt1,cgt,lt2,agt,lt3,bgt,lt4,cgt,lt2,dgt
- R lt1,cgt ,lt2,dgt,lt3,agt,lt4,bgt
- R lt1,dgt ,lt2,dgt,lt4,agt
- R lt1,bgt ,lt2,bgt,lt3,bgt,lt4,bgt
84Exercise-Solution 1
- Does P represents a functions from X 1,2,3,4
to Ya,b,c,d? If it is a functions, what type
of function is it? - P lt1,agt,lt2,agt,lt3,cgt,lt4,bgt
- It is a function from X to Y.
- Domain X, range a,b,c. The function neither
injective nor surjective.
85Exercise-Solution 2
- Does Q represents a functions from X 1,2,3,4
to Ya,b,c,d? If it is a functions, what type
of function is it? - Q lt1,cgt,lt2,agt,lt3,bgt,lt4,cgt,lt2,dgt
- It is not a function from X to Y.
86Exercise-Solution 3
- Does R represents a functions from X 1,2,3,4
to Ya,b,c,d? If it is a functions, what type
of function is it? - R lt1,cgt ,lt2,dgt,lt3,agt,lt4,bgt
- It is a function from X to Y.
- Domain X, range Y. The function both injective
and surjective, therefore bijective.
87Function on Sets
- Determine whether the set P represents a function
from Xe,f,g,h to Ya,b,c,d. - P lte,agt,ltf,agt,ltg,cgt,lth,bgt
- It is a function from X to Y.
- Domain X, range a,b,c.
- The function neither injective nor surjective.
Why?
88Function on Sets
- Determine whether the set Q represents a function
from Xe,f,g,h to Ya,b,c,d. - Qlte,cgt,ltf,agt,ltg,bgt,lth,cgt,ltf,dgt
- It is not a function from X to Y.
- Why?
89Function on Sets
- Determine whether the set R represents a function
from Xe,f,g,h to Ya,b,c,d. - R lte,agt ,ltf,bgt,ltg,cgt,lth,dgt
- It is a function from X to Y.
- Domain X, range Y. The function both injective
and surjective, therefore bijective.
90Identifying Functions
- Which of the following are functions?
- Explain why they are or are not functions?
- parent(childPerson)-gtparentPerson
- mother(childPerson) -gt parentPerson
- oldestChild(parentPerson) -gt childPerson
- allChilderenOf(parentPerson) -gt ?(Person)
91Identifying Functions()
- Let the sort Person represent the set of all
people and the sort PPerson represent the power
set of Person. Person lt PPerson - Which of the following are total functions
- 1) Returns the parents of the argument
- op parentOf Person -gt Person
- 2) Returns the oldest child of the argument
- op oldestChildOf Person -gt Person
- 3) Returns all the children of the argument
- op allChildrenOf Person -gt PPerson
92INJ Explained
- eq linv g f a a .
- ceq inj b0 b1 if g b0 g b1 .
- open INJ .
- op b gt B .
- start f g b . right inverse
- apply .inj with b1 b at term
- apply red at term .
- Print out notes section slides 90-95, run slide
show 90-95. Try to relate notes to slide show.
93INJ Explained
- eq linv g f a a
- ceq inj b0 b1 if g b0 g b1
- open INJ .
- op b gt B .
- start f g b . right inverse
- apply .inj with b1 b at term
- apply red at term .
Substitutions are f g b
b f g b
b
94INJ Explained
- eq linv g f a a
- ceq inj b0 b1 if g b0 g b1
- open INJ .
- op b gt B .
- start f g b . right inverse
- apply .inj with b1 b at term
- apply red at term .
giving ceq injNew f g b b if g f g b
g b
95INJ Explained
- eq linv g f a a
- ceq inj b0 b1 if g b0 g b1
- open INJ .
- op b gt B .
- start f g b . right inverse
- apply .inj with b1 b at term
- apply red at term .
Eval ceq injNew f g b b if g f g b
g b
evaluate
96INJ Explained
Substitutions g b g b
- eq linv g f a a
- ceq inj b0 b1 if g b0 g b1
- open INJ .
- op b gt B .
- start f g b . right inverse
- apply .inj with b1 b at term
- apply red at term .
giving ceq injNew f g b b if g f g b
g b
97INJ Explained
Giving new equation eq linvNew
g f g b g b
- eq linv g f a a
- ceq inj b0 b1 if g b0 g b1
- open INJ .
- op b gt B .
- start f g b . right inverse
- apply .inj with b1 b at term
- apply red at term .
giving ceq injNew f g b b if g f g b
g b