SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
Formal Methods in
Software
Lecture 6. Elements of Algebra
Vlad Patryshev
SCU
2014
In This Lecture
● monoid
● group
● groupoid
● category
Monoid
An object X (e.g. a set, a type in programming language),
binary operation Op,
nullary operation Zero;
Laws:
● Op is associative
● Zero is neutral re: Op
Monoid: examples
● Real numbers ℝ and multiplication; 1. is neutral element
● Natural numbers ℕ, max, 0
● Sets and union; ∅ is neutral
● Lists, concatenation, empty list
● Predicates, conjunction, TRUE
● Given an X, functions: X → X, their composition, idX
as neutral
Mappings of Monoids
Given monoids (A,opa
,za
) and (B,opb
,zb
), define a mapping f that
preserves structure:
● f: A → B - that is, defined on elements of A, mapping them to B
● f(x opa
y) = f(x) opb
f(y)
● f(za
) = zb
E.g.
● exp: (ℝ,+,0) → (ℝ,*,1)
● sum: List[Int] → (Int,+,0)
Monoid of Endomorphisms
Definition. Endomorphism is a function f:X → X
Endomorphisms form a monoid, ({f:X → X}, ∘, idx
)
If X is a finite set, the size is |X||X|
, so we denote this monoid XX
.
Example: id ā b̄ swap
a a a b b
b b a b a
Group
Group is a monoid (A,op,0) where each element has an inverse:
∀x∈A ∃y∈A ((x op y) = 0) ∧ ((y op x) = 0)
Notation: y = x-1
, or y = inv(x)
E.g.
● (ℤ,+,0); inv(x) = -x
Group of Isomorphisms
In monoid ({f:X → X}, ∘, idx
)
take only such functions that have an inverse
they are called isomorphisms.
f is an isomorphism if ∃g:X→X (f∘g = idx
) ∧ (g∘f = idx
)
It is also known a bijection in the case when X is a set.
Examples:
(_+7):ℝ→ℝ; (-3.4*_):ℝ→ℝ
Group of Permutations
Take a set of n elements, {0,1,2,...,n}, and its isomorphic
endomorphisms
They are called permutations.
The group of all permutations on n elements is called An
.
|An
| = n!
Sorting n elements amounts to finding the right one out of n! elements.
With no extra knowledge, binary search gives an estimate
O(log(n!))=O(n log(n))
0 1 2
po
p1
p2
(p0
,p1
,p2
)
What if there’s more than one X?
Have a bunch of objects, (X1
,X2
,...,Xn
)
take all isomorphisms between them:
invertible functions of kind f:Xi
→Xj
It is not a group, and not a monoid:
1. composition is only allowed between f:Xi
→Xj
and g:Xj
→Xk
2. no common neutral element, but idi
:Xi
→Xi
Still, have associativity, neutrality, inverses.
It is called Groupoid
Examples of Groupoids
● a group is a groupoid
● X and Y are objects. Iso(X,X) ∪ Iso(Y,Y) is a
groupoid
●
● Set A, and an identity on each element - this makes a
discrete groupoid
What If Not Only Isomorphisms
Have a bunch of objects, (X1
,X2
,...,Xn
)
take functions between them, so that:
1. idi
:Xi
→Xi
included, for each i;
2. if f:Xi
→Xj
and g:Xj
→Xk
are present, so is g∘f:Xi
→Xk
Have associativity, have neutrality; inverses optional.
It is called Category
Examples of Categories
● Every monoid is a category (with just one object)
● Every groupoid is a category (all functions invertible)
● Category of all sets and their functions
● Category of all monoids and their functions
● Tiny things, like
○ Category 1 =
○ Category 1+1 =
○ Category 2 =
○ Category 3 =
Java as a Category
Objects (Xi
): all types and classes (Integer, String, java.util.Date, Map<X,Y>)
Functions: all imaginable static functions, plus methods, plus identities
E.g.
toString: Integer → String
It is not an isomorphism: some strings are not results of toString.
But it is an injection; injection is called monomorphism in Category Theory.
Integer.parseInt: String → Integer - not even a function.
Either have to restrict to representations of integers, or redefine “function”.
References
https://docs.google.com/presentation/d/1M0ozs06eLh9GWvi-
RhPvah6YBzQ2lclqbPGUADpg0H4/edit?usp=sharing
http://www.amazon.com/Category-Computer-Scientists-Foundations-Computing/dp/0262660717
Wikipedia
Formal methods   6 - elements of algebra

Weitere ähnliche Inhalte

Was ist angesagt?

Bayesian Methods for Machine Learning
Bayesian Methods for Machine LearningBayesian Methods for Machine Learning
Bayesian Methods for Machine Learningbutest
 
Functional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingFunctional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingDebasish Ghosh
 
Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheoryKnoldus Inc.
 
Application of ordinal logistic to pregnancy outcomes
Application of ordinal logistic to pregnancy outcomesApplication of ordinal logistic to pregnancy outcomes
Application of ordinal logistic to pregnancy outcomesAlexander Decker
 
Architectural Patterns in Building Modular Domain Models
Architectural Patterns in Building Modular Domain ModelsArchitectural Patterns in Building Modular Domain Models
Architectural Patterns in Building Modular Domain ModelsDebasish Ghosh
 
Introduction to Category Theory for software engineers
Introduction to Category Theory for software engineersIntroduction to Category Theory for software engineers
Introduction to Category Theory for software engineersPranav Prakash
 

Was ist angesagt? (10)

Scala Bootcamp 1
Scala Bootcamp 1Scala Bootcamp 1
Scala Bootcamp 1
 
5
55
5
 
Nested loop
Nested loopNested loop
Nested loop
 
Bayesian Methods for Machine Learning
Bayesian Methods for Machine LearningBayesian Methods for Machine Learning
Bayesian Methods for Machine Learning
 
Functional and Algebraic Domain Modeling
Functional and Algebraic Domain ModelingFunctional and Algebraic Domain Modeling
Functional and Algebraic Domain Modeling
 
An introduction to scala
An introduction to scalaAn introduction to scala
An introduction to scala
 
Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheory
 
Application of ordinal logistic to pregnancy outcomes
Application of ordinal logistic to pregnancy outcomesApplication of ordinal logistic to pregnancy outcomes
Application of ordinal logistic to pregnancy outcomes
 
Architectural Patterns in Building Modular Domain Models
Architectural Patterns in Building Modular Domain ModelsArchitectural Patterns in Building Modular Domain Models
Architectural Patterns in Building Modular Domain Models
 
Introduction to Category Theory for software engineers
Introduction to Category Theory for software engineersIntroduction to Category Theory for software engineers
Introduction to Category Theory for software engineers
 

Andere mochten auch

Formal methods 5 - Pi calculus
Formal methods   5 - Pi calculusFormal methods   5 - Pi calculus
Formal methods 5 - Pi calculusVlad Patryshev
 
Formal methods 3 - languages and machines
Formal methods   3 - languages and machinesFormal methods   3 - languages and machines
Formal methods 3 - languages and machinesVlad Patryshev
 
#7 formal methods – loop proof examples
#7 formal methods – loop proof   examples#7 formal methods – loop proof   examples
#7 formal methods – loop proof examplesSharif Omar Salem
 
Formal methods 2 - languages and machines
Formal methods   2 - languages and machinesFormal methods   2 - languages and machines
Formal methods 2 - languages and machinesVlad Patryshev
 
Introduction to formal methods
Introduction to formal methodsIntroduction to formal methods
Introduction to formal methodsInzemamul Haque
 
#2 formal methods – principles of logic
#2 formal methods – principles of logic#2 formal methods – principles of logic
#2 formal methods – principles of logicSharif Omar Salem
 
Software Quality Assurance(Intro)
Software Quality Assurance(Intro)Software Quality Assurance(Intro)
Software Quality Assurance(Intro)Sidra Ashraf
 
Formal methods 1 - introduction
Formal methods   1 - introductionFormal methods   1 - introduction
Formal methods 1 - introductionVlad Patryshev
 
#8 formal methods – pro logic
#8 formal methods – pro logic#8 formal methods – pro logic
#8 formal methods – pro logicSharif Omar Salem
 
Virtualization support by intel
Virtualization support by intelVirtualization support by intel
Virtualization support by intelInzemamul Haque
 
Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)Vlad Patryshev
 
#5 formal methods – hoare logic
#5 formal methods – hoare logic#5 formal methods – hoare logic
#5 formal methods – hoare logicSharif Omar Salem
 
#6 formal methods – loop proof using induction method
#6 formal methods – loop proof using induction method#6 formal methods – loop proof using induction method
#6 formal methods – loop proof using induction methodSharif Omar Salem
 
Truth, deduction, computation lecture 7
Truth, deduction, computation   lecture 7Truth, deduction, computation   lecture 7
Truth, deduction, computation lecture 7Vlad Patryshev
 
Formal Methods lecture 01
Formal Methods lecture 01Formal Methods lecture 01
Formal Methods lecture 01Sidra Ashraf
 
PhD Presentation (Doctorate)
PhD Presentation (Doctorate)PhD Presentation (Doctorate)
PhD Presentation (Doctorate)Sharif Omar Salem
 

Andere mochten auch (20)

Formal meth
Formal methFormal meth
Formal meth
 
Hypervisors
HypervisorsHypervisors
Hypervisors
 
Formal methods 5 - Pi calculus
Formal methods   5 - Pi calculusFormal methods   5 - Pi calculus
Formal methods 5 - Pi calculus
 
Formal methods 3 - languages and machines
Formal methods   3 - languages and machinesFormal methods   3 - languages and machines
Formal methods 3 - languages and machines
 
#7 formal methods – loop proof examples
#7 formal methods – loop proof   examples#7 formal methods – loop proof   examples
#7 formal methods – loop proof examples
 
Formal methods 2 - languages and machines
Formal methods   2 - languages and machinesFormal methods   2 - languages and machines
Formal methods 2 - languages and machines
 
Introduction to formal methods
Introduction to formal methodsIntroduction to formal methods
Introduction to formal methods
 
#2 formal methods – principles of logic
#2 formal methods – principles of logic#2 formal methods – principles of logic
#2 formal methods – principles of logic
 
Software Quality Assurance(Intro)
Software Quality Assurance(Intro)Software Quality Assurance(Intro)
Software Quality Assurance(Intro)
 
Formal methods 1 - introduction
Formal methods   1 - introductionFormal methods   1 - introduction
Formal methods 1 - introduction
 
#8 formal methods – pro logic
#8 formal methods – pro logic#8 formal methods – pro logic
#8 formal methods – pro logic
 
Virtualization support by intel
Virtualization support by intelVirtualization support by intel
Virtualization support by intel
 
Formal methods 8 - category theory (last one)
Formal methods   8 - category theory (last one)Formal methods   8 - category theory (last one)
Formal methods 8 - category theory (last one)
 
#5 formal methods – hoare logic
#5 formal methods – hoare logic#5 formal methods – hoare logic
#5 formal methods – hoare logic
 
#6 formal methods – loop proof using induction method
#6 formal methods – loop proof using induction method#6 formal methods – loop proof using induction method
#6 formal methods – loop proof using induction method
 
Slides chapters 28-32
Slides chapters 28-32Slides chapters 28-32
Slides chapters 28-32
 
Truth, deduction, computation lecture 7
Truth, deduction, computation   lecture 7Truth, deduction, computation   lecture 7
Truth, deduction, computation lecture 7
 
Formal Methods lecture 01
Formal Methods lecture 01Formal Methods lecture 01
Formal Methods lecture 01
 
PhD Presentation (Doctorate)
PhD Presentation (Doctorate)PhD Presentation (Doctorate)
PhD Presentation (Doctorate)
 
Slides chapters 26-27
Slides chapters 26-27Slides chapters 26-27
Slides chapters 26-27
 

Ähnlich wie Formal methods 6 - elements of algebra

UMAP - Mathematics and implementational details
UMAP - Mathematics and implementational detailsUMAP - Mathematics and implementational details
UMAP - Mathematics and implementational detailsUmberto Lupo
 
Discrete mathematics Ch1 sets Theory_Dr.Khaled.Bakro د. خالد بكرو
Discrete mathematics Ch1 sets Theory_Dr.Khaled.Bakro د. خالد بكروDiscrete mathematics Ch1 sets Theory_Dr.Khaled.Bakro د. خالد بكرو
Discrete mathematics Ch1 sets Theory_Dr.Khaled.Bakro د. خالد بكروDr. Khaled Bakro
 
Group Theory and Its Application: Beamer Presentation (PPT)
Group Theory and Its Application:   Beamer Presentation (PPT)Group Theory and Its Application:   Beamer Presentation (PPT)
Group Theory and Its Application: Beamer Presentation (PPT)SIRAJAHMAD36
 
5.3 Basic functions. A handout.
5.3 Basic functions. A handout.5.3 Basic functions. A handout.
5.3 Basic functions. A handout.Jan Plaza
 
Presentation-Alex-20150421
Presentation-Alex-20150421Presentation-Alex-20150421
Presentation-Alex-20150421alexfang2014
 
Truth, deduction, computation lecture f
Truth, deduction, computation   lecture fTruth, deduction, computation   lecture f
Truth, deduction, computation lecture fVlad Patryshev
 
Numerical solution of boundary value problems by piecewise analysis method
Numerical solution of boundary value problems by piecewise analysis methodNumerical solution of boundary value problems by piecewise analysis method
Numerical solution of boundary value problems by piecewise analysis methodAlexander Decker
 
Introduction of predicate logics
Introduction of predicate  logicsIntroduction of predicate  logics
Introduction of predicate logicschauhankapil
 
PaperNo10-KaramiHabibiSafariZarrabi-IJCMS
PaperNo10-KaramiHabibiSafariZarrabi-IJCMSPaperNo10-KaramiHabibiSafariZarrabi-IJCMS
PaperNo10-KaramiHabibiSafariZarrabi-IJCMSMezban Habibi
 
A Coq Library for the Theory of Relational Calculus
A Coq Library for the Theory of Relational CalculusA Coq Library for the Theory of Relational Calculus
A Coq Library for the Theory of Relational CalculusYoshihiro Mizoguchi
 
Function and Recursively defined function
Function and Recursively defined functionFunction and Recursively defined function
Function and Recursively defined functionNANDINI SHARMA
 
S. Duplij, Polyadic integer numbers and finite (m,n)-fields (Journal version,...
S. Duplij, Polyadic integer numbers and finite (m,n)-fields (Journal version,...S. Duplij, Polyadic integer numbers and finite (m,n)-fields (Journal version,...
S. Duplij, Polyadic integer numbers and finite (m,n)-fields (Journal version,...Steven Duplij (Stepan Douplii)
 
5.3 Basic functions. Dynamic slides.
5.3 Basic functions. Dynamic slides.5.3 Basic functions. Dynamic slides.
5.3 Basic functions. Dynamic slides.Jan Plaza
 

Ähnlich wie Formal methods 6 - elements of algebra (15)

UMAP - Mathematics and implementational details
UMAP - Mathematics and implementational detailsUMAP - Mathematics and implementational details
UMAP - Mathematics and implementational details
 
Discrete mathematics Ch1 sets Theory_Dr.Khaled.Bakro د. خالد بكرو
Discrete mathematics Ch1 sets Theory_Dr.Khaled.Bakro د. خالد بكروDiscrete mathematics Ch1 sets Theory_Dr.Khaled.Bakro د. خالد بكرو
Discrete mathematics Ch1 sets Theory_Dr.Khaled.Bakro د. خالد بكرو
 
Sets, functions and groups
Sets, functions and groupsSets, functions and groups
Sets, functions and groups
 
Group Theory and Its Application: Beamer Presentation (PPT)
Group Theory and Its Application:   Beamer Presentation (PPT)Group Theory and Its Application:   Beamer Presentation (PPT)
Group Theory and Its Application: Beamer Presentation (PPT)
 
5.3 Basic functions. A handout.
5.3 Basic functions. A handout.5.3 Basic functions. A handout.
5.3 Basic functions. A handout.
 
Presentation-Alex-20150421
Presentation-Alex-20150421Presentation-Alex-20150421
Presentation-Alex-20150421
 
Truth, deduction, computation lecture f
Truth, deduction, computation   lecture fTruth, deduction, computation   lecture f
Truth, deduction, computation lecture f
 
Numerical solution of boundary value problems by piecewise analysis method
Numerical solution of boundary value problems by piecewise analysis methodNumerical solution of boundary value problems by piecewise analysis method
Numerical solution of boundary value problems by piecewise analysis method
 
Introduction of predicate logics
Introduction of predicate  logicsIntroduction of predicate  logics
Introduction of predicate logics
 
PaperNo10-KaramiHabibiSafariZarrabi-IJCMS
PaperNo10-KaramiHabibiSafariZarrabi-IJCMSPaperNo10-KaramiHabibiSafariZarrabi-IJCMS
PaperNo10-KaramiHabibiSafariZarrabi-IJCMS
 
A Coq Library for the Theory of Relational Calculus
A Coq Library for the Theory of Relational CalculusA Coq Library for the Theory of Relational Calculus
A Coq Library for the Theory of Relational Calculus
 
Function and Recursively defined function
Function and Recursively defined functionFunction and Recursively defined function
Function and Recursively defined function
 
S. Duplij, Polyadic integer numbers and finite (m,n)-fields (Journal version,...
S. Duplij, Polyadic integer numbers and finite (m,n)-fields (Journal version,...S. Duplij, Polyadic integer numbers and finite (m,n)-fields (Journal version,...
S. Duplij, Polyadic integer numbers and finite (m,n)-fields (Journal version,...
 
5.3 Basic functions. Dynamic slides.
5.3 Basic functions. Dynamic slides.5.3 Basic functions. Dynamic slides.
5.3 Basic functions. Dynamic slides.
 
Rouviere
RouviereRouviere
Rouviere
 

Mehr von Vlad Patryshev

Formal methods 4 - Z notation
Formal methods   4 - Z notationFormal methods   4 - Z notation
Formal methods 4 - Z notationVlad Patryshev
 
Truth, deduction, computation lecture i (last one)
Truth, deduction, computation   lecture i (last one)Truth, deduction, computation   lecture i (last one)
Truth, deduction, computation lecture i (last one)Vlad Patryshev
 
Truth, deduction, computation lecture h
Truth, deduction, computation   lecture hTruth, deduction, computation   lecture h
Truth, deduction, computation lecture hVlad Patryshev
 
Truth, deduction, computation lecture g
Truth, deduction, computation   lecture gTruth, deduction, computation   lecture g
Truth, deduction, computation lecture gVlad Patryshev
 
Truth, deduction, computation lecture e
Truth, deduction, computation   lecture eTruth, deduction, computation   lecture e
Truth, deduction, computation lecture eVlad Patryshev
 
Truth, deduction, computation lecture d
Truth, deduction, computation   lecture dTruth, deduction, computation   lecture d
Truth, deduction, computation lecture dVlad Patryshev
 
Truth, deduction, computation lecture c
Truth, deduction, computation   lecture cTruth, deduction, computation   lecture c
Truth, deduction, computation lecture cVlad Patryshev
 
Truth, deduction, computation lecture b
Truth, deduction, computation   lecture bTruth, deduction, computation   lecture b
Truth, deduction, computation lecture bVlad Patryshev
 
Truth, deduction, computation lecture a
Truth, deduction, computation   lecture aTruth, deduction, computation   lecture a
Truth, deduction, computation lecture aVlad Patryshev
 
Truth, deduction, computation lecture 9
Truth, deduction, computation   lecture 9Truth, deduction, computation   lecture 9
Truth, deduction, computation lecture 9Vlad Patryshev
 
Truth, deduction, computation lecture 8
Truth, deduction, computation   lecture 8Truth, deduction, computation   lecture 8
Truth, deduction, computation lecture 8Vlad Patryshev
 
Truth, deduction, computation lecture 6
Truth, deduction, computation   lecture 6Truth, deduction, computation   lecture 6
Truth, deduction, computation lecture 6Vlad Patryshev
 
Truth, deduction, computation; lecture 5
Truth, deduction, computation;  lecture 5Truth, deduction, computation;  lecture 5
Truth, deduction, computation; lecture 5Vlad Patryshev
 
Truth, deduction, computation; lecture 4
Truth, deduction, computation;  lecture 4Truth, deduction, computation;  lecture 4
Truth, deduction, computation; lecture 4Vlad Patryshev
 
Truth, deduction, computation; lecture 3
Truth, deduction, computation;  lecture 3Truth, deduction, computation;  lecture 3
Truth, deduction, computation; lecture 3Vlad Patryshev
 
Truth, deduction, computation; lecture 2
Truth, deduction, computation;   lecture 2Truth, deduction, computation;   lecture 2
Truth, deduction, computation; lecture 2Vlad Patryshev
 
Truth, deduction, computation; lecture 1
Truth, deduction, computation;   lecture 1Truth, deduction, computation;   lecture 1
Truth, deduction, computation; lecture 1Vlad Patryshev
 

Mehr von Vlad Patryshev (20)

Formal methods 4 - Z notation
Formal methods   4 - Z notationFormal methods   4 - Z notation
Formal methods 4 - Z notation
 
Truth, deduction, computation lecture i (last one)
Truth, deduction, computation   lecture i (last one)Truth, deduction, computation   lecture i (last one)
Truth, deduction, computation lecture i (last one)
 
Truth, deduction, computation lecture h
Truth, deduction, computation   lecture hTruth, deduction, computation   lecture h
Truth, deduction, computation lecture h
 
Truth, deduction, computation lecture g
Truth, deduction, computation   lecture gTruth, deduction, computation   lecture g
Truth, deduction, computation lecture g
 
Truth, deduction, computation lecture e
Truth, deduction, computation   lecture eTruth, deduction, computation   lecture e
Truth, deduction, computation lecture e
 
Truth, deduction, computation lecture d
Truth, deduction, computation   lecture dTruth, deduction, computation   lecture d
Truth, deduction, computation lecture d
 
Truth, deduction, computation lecture c
Truth, deduction, computation   lecture cTruth, deduction, computation   lecture c
Truth, deduction, computation lecture c
 
Truth, deduction, computation lecture b
Truth, deduction, computation   lecture bTruth, deduction, computation   lecture b
Truth, deduction, computation lecture b
 
Truth, deduction, computation lecture a
Truth, deduction, computation   lecture aTruth, deduction, computation   lecture a
Truth, deduction, computation lecture a
 
Truth, deduction, computation lecture 9
Truth, deduction, computation   lecture 9Truth, deduction, computation   lecture 9
Truth, deduction, computation lecture 9
 
Truth, deduction, computation lecture 8
Truth, deduction, computation   lecture 8Truth, deduction, computation   lecture 8
Truth, deduction, computation lecture 8
 
Truth, deduction, computation lecture 6
Truth, deduction, computation   lecture 6Truth, deduction, computation   lecture 6
Truth, deduction, computation lecture 6
 
Truth, deduction, computation; lecture 5
Truth, deduction, computation;  lecture 5Truth, deduction, computation;  lecture 5
Truth, deduction, computation; lecture 5
 
Truth, deduction, computation; lecture 4
Truth, deduction, computation;  lecture 4Truth, deduction, computation;  lecture 4
Truth, deduction, computation; lecture 4
 
Truth, deduction, computation; lecture 3
Truth, deduction, computation;  lecture 3Truth, deduction, computation;  lecture 3
Truth, deduction, computation; lecture 3
 
Truth, deduction, computation; lecture 2
Truth, deduction, computation;   lecture 2Truth, deduction, computation;   lecture 2
Truth, deduction, computation; lecture 2
 
Truth, deduction, computation; lecture 1
Truth, deduction, computation;   lecture 1Truth, deduction, computation;   lecture 1
Truth, deduction, computation; lecture 1
 
Woo
WooWoo
Woo
 
Pathela m
Pathela mPathela m
Pathela m
 
Nguyenmaria
NguyenmariaNguyenmaria
Nguyenmaria
 

Kürzlich hochgeladen

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 

Kürzlich hochgeladen (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 

Formal methods 6 - elements of algebra

  • 1. Formal Methods in Software Lecture 6. Elements of Algebra Vlad Patryshev SCU 2014
  • 2. In This Lecture ● monoid ● group ● groupoid ● category
  • 3. Monoid An object X (e.g. a set, a type in programming language), binary operation Op, nullary operation Zero; Laws: ● Op is associative ● Zero is neutral re: Op
  • 4. Monoid: examples ● Real numbers ℝ and multiplication; 1. is neutral element ● Natural numbers ℕ, max, 0 ● Sets and union; ∅ is neutral ● Lists, concatenation, empty list ● Predicates, conjunction, TRUE ● Given an X, functions: X → X, their composition, idX as neutral
  • 5. Mappings of Monoids Given monoids (A,opa ,za ) and (B,opb ,zb ), define a mapping f that preserves structure: ● f: A → B - that is, defined on elements of A, mapping them to B ● f(x opa y) = f(x) opb f(y) ● f(za ) = zb E.g. ● exp: (ℝ,+,0) → (ℝ,*,1) ● sum: List[Int] → (Int,+,0)
  • 6. Monoid of Endomorphisms Definition. Endomorphism is a function f:X → X Endomorphisms form a monoid, ({f:X → X}, ∘, idx ) If X is a finite set, the size is |X||X| , so we denote this monoid XX . Example: id ā b̄ swap a a a b b b b a b a
  • 7. Group Group is a monoid (A,op,0) where each element has an inverse: ∀x∈A ∃y∈A ((x op y) = 0) ∧ ((y op x) = 0) Notation: y = x-1 , or y = inv(x) E.g. ● (ℤ,+,0); inv(x) = -x
  • 8. Group of Isomorphisms In monoid ({f:X → X}, ∘, idx ) take only such functions that have an inverse they are called isomorphisms. f is an isomorphism if ∃g:X→X (f∘g = idx ) ∧ (g∘f = idx ) It is also known a bijection in the case when X is a set. Examples: (_+7):ℝ→ℝ; (-3.4*_):ℝ→ℝ
  • 9. Group of Permutations Take a set of n elements, {0,1,2,...,n}, and its isomorphic endomorphisms They are called permutations. The group of all permutations on n elements is called An . |An | = n! Sorting n elements amounts to finding the right one out of n! elements. With no extra knowledge, binary search gives an estimate O(log(n!))=O(n log(n)) 0 1 2 po p1 p2 (p0 ,p1 ,p2 )
  • 10. What if there’s more than one X? Have a bunch of objects, (X1 ,X2 ,...,Xn ) take all isomorphisms between them: invertible functions of kind f:Xi →Xj It is not a group, and not a monoid: 1. composition is only allowed between f:Xi →Xj and g:Xj →Xk 2. no common neutral element, but idi :Xi →Xi Still, have associativity, neutrality, inverses. It is called Groupoid
  • 11. Examples of Groupoids ● a group is a groupoid ● X and Y are objects. Iso(X,X) ∪ Iso(Y,Y) is a groupoid ● ● Set A, and an identity on each element - this makes a discrete groupoid
  • 12. What If Not Only Isomorphisms Have a bunch of objects, (X1 ,X2 ,...,Xn ) take functions between them, so that: 1. idi :Xi →Xi included, for each i; 2. if f:Xi →Xj and g:Xj →Xk are present, so is g∘f:Xi →Xk Have associativity, have neutrality; inverses optional. It is called Category
  • 13. Examples of Categories ● Every monoid is a category (with just one object) ● Every groupoid is a category (all functions invertible) ● Category of all sets and their functions ● Category of all monoids and their functions ● Tiny things, like ○ Category 1 = ○ Category 1+1 = ○ Category 2 = ○ Category 3 =
  • 14. Java as a Category Objects (Xi ): all types and classes (Integer, String, java.util.Date, Map<X,Y>) Functions: all imaginable static functions, plus methods, plus identities E.g. toString: Integer → String It is not an isomorphism: some strings are not results of toString. But it is an injection; injection is called monomorphism in Category Theory. Integer.parseInt: String → Integer - not even a function. Either have to restrict to representations of integers, or redefine “function”.