1 / 15

Software as Math

Software as Math. (or why you should be paying attention in this class). Ryan Luna Javier Garcia. Overview. What the heck is discrete math? Algebraic Specifications Theories and Models Specification Morphisms Homomorphisms and Isomorphisms Useful applications!! . Discrete Mathematics.

chas
Télécharger la présentation

Software as Math

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Software as Math (or why you should be paying attention in this class) Ryan Luna Javier Garcia

  2. Overview • What the heck is discrete math? • Algebraic Specifications • Theories and Models • Specification Morphisms • Homomorphisms and Isomorphisms • Useful applications!!

  3. Discrete Mathematics • What is discrete mathematics? Discrete mathematics is the part of mathematics devoted to the study of discrete objects where discrete refers to consisting of distinct or unconnected elements. • It could be said that these subjects define the mathematical basis for computing. • A key reason for the growth in importance of discrete mathematics is that information is stored and manipulated by computing machines in a discrete fashion.

  4. Algebraic Specifications • An algebra consists of a set (sort) and a collection of operators defined over this set. • A good example: Natural Numbers: {0,1,2,3,…} Operators: + - x ÷ Each operator is defined over two elements in the sort. • An algebra is multi-sorted if it includes multiple sorts.

  5. How does this relate to me? • A good example of a multi-sorted algebra is the Abstract Data Type programming style. • Remember: When defining an ADT we define: 1) Collection of types 2) Set of functions and procedures for those types

  6. Binary Search Tree ADT • Sort: Any elementary or user defined data type. BSTree <int> myTree; BSTree <string> strTree; • Operators: The functions written for the tree. void BSTree <ADT> insert (ADT element) void BSTree <ADT> remove (ADT element) void BSTree <ADT> retrieve (ADT element)

  7. Heap ADT • Sort: Any elementary or user defined data type. Heap <int> myTbl; Heap<string> strTbl; • Operators: Implementation of the Heap. void insert (ADT element); ADT removeMax (); void clear();

  8. Theories and Models • Suppose a computer program could take an algebraic specification and from it generate all its implications; this set of true statements would be the theory associated with the algebraic specification. • A theory models a system if: 1) Every observable behavior of the system is a theorem in the theory. (Completeness) 2) Every theorem in the theory corresponds to a behavior in the system. (Consistency) • E=MC2

  9. Specification Morphisms • Why do we care, really? • Software development is all about changing models. • Software Design Process • Specification morphism represents the transformation of one specification into another.

  10. B B A C A Homomorphisms • A homomorphism exists between two specifications if every thing true in A is true in B. • A ≠ B, but A  B. Homomorphism between A and B.A is more abstract than B.B is more general than A. Homomorphism between C, A and BB is more general than A or C.B represents both A and C.

  11. Isomorphisms • An isomorphism exists between A and B when the two specifications represent the same theory. • Specifications are “structurally identical.” • Used less often in software engineering because they are “too strong.” • Physical examples: • Big Ben and a wristwatch • Two decks of cards, each a different color

  12. List Stack A Good Example… • Consider two data structures: a stack and a list. • A homomorphism exists between the stack and the list. • Stack  List

  13. List Queue Stack Another Good Example… • Consider several data structures: A queue, a stack, and a list. • We can define a homomorphism between the queue and the list, as well as the stack and the list. • Stack  List and Queue  List No homomorphism exists between a stack and a queue!

  14. Finally… • Algebraic specifications relate well to ADT programming • Knowing homomorphisms between two specifications can make life easier! • Set Theory and Functions can have real applications!

  15. Questions?

More Related