Lecture notes for CSC 173, Tues. Sept. 4, 2001 How many declared (provisional) majors? intended majors? others? How many freshmen/sophomores/juniors/seniors? How many actually took 172? Who knows Java/C/C++? What is Computer Science? The study of algorithms, their properties, and their application. In Europe, "Algorithmics" It's not just programming! ======================== Administrivia Instructors MLS Thanos Bob UGs Web site -- all the administrative stuff I'm covering today is on-line www.cs.rochester.edu/~scott/173/ News: ur.cs173 Resources Computers CSUG machines remote access encouraged; learn to use X stick around at end of class for an account textbook lecture notes on-line Grading calculation Course attendance and participation Please arrive on time PLEASE PARTICIPATE IN CLASS ask questions interrupt me if I go too fast or too slow if you're confused, so are the people around you *** talent != confidence *** Assignments tentatively: five programs and one written homework trivia assignments NO LATE ASSIGNMENTS Academic honesty Subjects to be covered Relations and relational algebra C and Unix Finite automata and regular expressions CFGs and parsing some more graph theory some more logic ======================== Assignment -- Before Thursday - explore the web site - subscribe to the newsgroup (use web browser) - read chapter 1 of the text - pending HW availability: - get an account - log in and explore - learn commands man cd pwd mkdir rm rmdir chmod jobs (csh) emacs c-x c-c c-g x info m emacs ... m texinfo - remote access eXodus, WebTermX ======================== Formal Systems CLAIM: World-class programming skills require: * programming language skills for creating programs that work * abstractions, data structures, and analysis of algorithms for building correct and efficient programs * formal systems for managing complexity with formal models *** Make sure you know the distinction between an abstract data type and a data structure *** -------- Isn't competence in a programming language enough? Imagine trying to implement * recursion without a stack. * a sorting routine, without knowing the difference between the n^2, n lg n, and linear algorithms. * an efficient search routine or dictionary, without knowing about balanced search trees, binary search, or hashing. * insertion and deletion on a list, without using double links. * shortest paths in a graph, without knowing Dijkstra's or Floyd's algorithms. Knowing a programming language (at the level of CSC 171 or a high school AP course) is only the first step in solving problems on a computer. Knowledge of data structures and analysis of algorithms is essential to all of the above problems. -------- Aren't data structures enough? Consider how you might implement: * a database that accepts -- and efficiently answers -- complex queries like "find the name and address of all CS majors at UR that have taken CSC 173 and also received an A in MTH 162." * a compiler that reads in statements in a high-level programming language, checks the correctness of each statement, and translates the high-level statement into machine code. * a speech system that takes in spoken words and creates an unambiguous representation of the meaning of the words. * a compact digital circuit that computes an arbitrarily complex mathematical function, using only 1's and 0's as input, and the boolean operations AND, OR, and NOT. * an expert system that assists a physician in the diagnosis of disease based on exhibited symptoms. * a student program checker that reads in a C program and its input, and determines whether the program enters an infinite loop on that input. Programming language skills and knowledge of data structures are necessary for solving these problems, but not sufficient. Solving these complex problems in an ad hoc fashion would be a laborious and error-prone task. Formal models and systems can provide the tools to help solve these, and other similar, problems. -------- What is a formal system? Formal systems are abstract models of complex phenomena. Outside CS: * algebra of natural numbers (N,+,-,*,/) for HS "word problems" * calculus and differential equations to model continuous physical phenomena (e.g. motion of the planets) * linear algebra for systems of linear inequalities (e.g. to minimize manufacturing or transportation costs) * probability and statistics to model games, population dynamics, quantum physics Good models (or abstractions) of real-world phenomena or problems are useful because * models capture important features, and ignore irrelevant details * the same model can be applied to a wide variety of problems * mathematical tools can be applied to formal systems to prove useful theorems or generate working code -------- But are formal systems really practical? You bet! Formal systems are used in a variety of practical CS applications, to manage complexity, facilitate analysis, and provide a framework for optimizations. In CS: * databases: relational algebra * communication protocols: finite automata * routing and connectivity: graph theory * security, fault tolerance, and concurrent systems: temporal logic, petri nets, queueing theory, adversary arguments, number theory * compilers: regular expressions, context-free grammars, automata, data flow analysis, systems of affine functions and convex sets, denotational semantics * circuit design: propositional logic, boolean algebra, and computational geometry * speech understanding and reasoning: formal languages and predicate logic * undecidability: formal models of computation (e.g. Turing machines and lambda calculus) * heuristic search: genetic algorithms We will cover: relational algebra finite automata context-free grammars graph theory propositional logic predicate logic