Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Software as Math Ryan Luna Javier Garcia (or why you should be paying attention in this class)"— Presentation transcript:

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

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 myTree; BSTree strTree; Operators: The functions written for the tree. void BSTree insert (ADT element) void BSTree remove (ADT element) void BSTree retrieve (ADT element)

7 Heap ADT Sort: Any elementary or user defined data type. Heap myTbl; Heap 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=MC 2

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 Homomorphisms A homomorphism exists between two specifications if every thing true in A is true in B. A ≠ B, but A  B. B A Homomorphism between A and B. A is more abstract than B. B is more general than A. B C A Homomorphism between C, A and B B 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 A Good Example… Consider two data structures: a stack and a list. A homomorphism exists between the stack and the list. Stack  List List Stack

13 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 List Queue Stack 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?


Download ppt "Software as Math Ryan Luna Javier Garcia (or why you should be paying attention in this class)"

Similar presentations


Ads by Google