General Computer Science 320201 GenCS I & II Lecture Notes

3y ago
45 Views
2 Downloads
3.51 MB
179 Pages
Last View : 6d ago
Last Download : 3m ago
Upload by : Brenna Zink
Transcription

iGeneral Computer Science320201 GenCS I & II Lecture NotesMichael KohlhaseSchool of Engineering & ScienceJacobs University, Bremen Germanym.kohlhase@jacobs-university.deDecember 1, 2014

iiPrefaceThis DocumentThis document contains the course notes for the course General Computer Science I & II held atJacobs University Bremen1 in the academic years 2003-2014.Contents: The document mixes the slides presented in class with comments of the instructor togive students a more complete background reference.Caveat: This document is made available for the students of this course only. It is still a draftand will develop over the course of the current course and in coming academic years.Licensing: This document is licensed under a Creative Commons license that requires attribution,allows commercial use, and allows derivative works as long as these are licensed under the samelicense.Knowledge Representation Experiment: This document is also an experiment in knowledge representation. Under the hood, it uses the STEX package [Koh08, Koh14], a TEX/LATEX extension forsemantic markup, which allows to export the contents into the eLearning platform PantaRhei.Comments and extensions are always welcome, please send them to the author.Other Resources: The course notes are complemented by a selection of problems (with and withoutsolutions) that can be used for self-study. [Koh11a, Koh11b]Course ConceptAims: The course 320101/2 “General Computer Science I/II” (GenCS) is a two-semester coursethat is taught as a mandatory component of the “Computer Science” and “Electrical Engineering& Computer Science” majors (EECS) at Jacobs University. The course aims to give these studentsa solid (and somewhat theoretically oriented) foundation of the basic concepts and practices ofcomputer science without becoming inaccessible to ambitious students of other majors.Context: As part of the EECS curriculum GenCS is complemented with a programming lab thatteaches the basics of C and C from a practical perspective and a “Computer Architecture”course in the first semester. As the programming lab is taught in three five-week blocks over thefirst semester, we cannot make use of it in GenCS.In the second year, GenCS, will be followed by a standard “Algorithms & Data structures”course and a “Formal Languages & Logics” course, which it must prepare.Prerequisites: The student body of Jacobs University is extremely diverse — in 2011, we havestudents from 110 nations on campus. In particular, GenCS students come from both sides ofthe “digital divide”: Previous CS exposure ranges “almost computer-illiterate” to “professionalJava programmer” on the practical level, and from “only calculus” to solid foundations in discrete Mathematics for the theoretical foundations. An important commonality of Jacobs studentshowever is that they are bright, resourceful, and very motivated.As a consequence, the GenCS course does not make any assumptions about prior knowledge,and introduces all the necessary material, developing it from first principles. To compensatefor this, the course progresses very rapidly and leaves much of the actual learning experience tohomework problems and student-run tutorials.Course ContentsGoal: To give students a solid foundation of the basic concepts and practices of Computer Sciencewe try to raise awareness for the three basic concepts of CS: “data/information”, “algorithms/programs” and “machines/computational devices” by studying various instances, exposing more andmore characteristics as we go along.1 InternationalUniversity Bremen until Fall 2006

iiiComputer Science: In accordance to the goal of teaching students to “think first” and to bringout the Science of CS, the general style of the exposition is rather theoretical; practical aspectsare largely relegated to the homework exercises and tutorials. In particular, almost all relevantstatements are proven mathematically to expose the underlying structures.GenCS is not a programming course: even though it covers all three major programming paradigms(imperative, functional, and declarative programming). The course uses SML as its primary programming language as it offers a clean conceptualization of the fundamental concepts of recursion,and types. An added benefit is that SML is new to virtually all incoming Jacobs students and helpsequalize opportunities.GenCS I (the first semester): is somewhat oriented towards computation and representation. Inthe first half of the semester the course introduces the dual concepts of induction and recursion,first on unary natural numbers, and then on arbitrary abstract data types, and legitimizes themby the Peano Axioms. The introduction and of the functional core of SML contrasts and explainsthis rather abstract development. To highlight the role of representation, we turn to Booleanexpressions, propositional logic, and logical calculi in the second half of the semester. This givesthe students a first glimpse at the syntax/semantics distinction at the heart of CS.GenCS II (the second semester): is more oriented towards exposing students to the realization ofcomputational devices. The main part of the semester is taken up by a “building an abstract computer”, starting from combinational circuits, via a register machine which can be programmed ina simple assembler language, to a stack-based machine with a compiler for a bare-bones functionalprogramming language. In contrast to the “computer architecture” course in the first semester,the GenCS exposition abstracts away from all physical and timing issues and considers circuitsas labeled graphs. This reinforces the students’ grasp of the fundamental concepts and highlightscomplexity issues. The course then progresses to a brief introduction of Turing machines anddiscusses the fundamental limits of computation at a rather superficial level, which completesan introductory “tour de force” through the landscape of Computer Science. As a contrast tothese foundational issues, we then turn practical introduce the architecture of the Internet andthe World-Wide Web.The remaining time, is spent on studying one class algorithms (search algorithms) in more detailand introducing the notition of declarative programming that uses search and logical representationas a model of computation.AcknowledgmentsMaterials: Some of the material in this course is based on course notes prepared by Andreas Birk,who held the course 320101/2 “General Computer Science” at IUB in the years 2001-03. Partsof his course and the current course materials were based on the book “Hardware Design” (inGerman) [KP95]. The section on search algorithms is based on materials obtained from BernhardBeckert (Uni Koblenz), which in turn are based on Stuart Russell and Peter Norvig’s lecture slidesthat go with their book “Artificial Intelligence: A Modern Approach” [RN95].The presentation of the programming language Standard ML, which serves as the primaryprogramming tool of this course is in part based on the course notes of Gert Smolka’s excellentcourse “Programming” at Saarland University [Smo08].Contributors: The preparation of the course notes has been greatly helped by Ioan Sucan, whohas done much of the initial editing needed for semantic preloading in STEX. Herbert Jaeger,Christoph Lange, and Normen Müller have given advice on the contents.GenCS Students: The following students have submitted corrections and suggestions to this andearlier versions of the notes: Saksham Raj Gautam, Anton Kirilov, Philipp Meerkamp, PaulNgana, Darko Pesikan, Stojanco Stamkov, Nikolaus Rath, Evans Bekoe, Marek Laska, MoritzBeber, Andrei Aiordachioaie, Magdalena Golden, Andrei Eugeniu Ioniţă, Semir Elezović, Dimitar Asenov, Alen Stojanov, Felix Schlesinger, Ştefan Anca, Dante Stroe, Irina Calciu, NemanjaIvanovski, Abdulaziz Kivaza, Anca Dragan, Razvan Turtoi, Catalin Duta, Andrei Dragan, Dimitar

ivMisev, Vladislav Perelman, Milen Paskov, Kestutis Cesnavicius, Mohammad Faisal, Janis Beckert,Karolis Uziela, Josip Djolonga, Flavia Grosan, Aleksandar Siljanovski, Iurie Tap, Barbara Khalibinzwa, Darko Velinov, Anton Lyubomirov Antonov, Christopher Purnell, Maxim Rauwald, JanBrennstein, Irhad Elezovikj, Naomi Pentrel, Jana Kohlhase, Victoria Beleuta, Dominik Kundel,Daniel Hasegan, Mengyuan Zhang, Georgi Gyurchev, Timo Lücke, Sudhashree Sayenju, LukasKohlhase, Dmitrii Cucleschin, Aleksandar Gyorev, Tyler Buchmann, Bidesh Thapaliya, DanDaniel Erdmann-Pham, Petre Munteanu, Utkrist Adhikari, Kim Philipp Jablonski, AleksandarGyorev, Tom Wiesing, Sourabh Lal, Nikhil Shakya, Otar Bichiashvili, Cornel Amariei, EnxhellLuzhnica, Rubin Deliallisi, Mariia Gladkova.

vRecorded Syllabus for 2014/15In this document, we record the progress of the course in the academic year 2014/2015 in the formof a “recorded syllabus”, i.e. a syllabus that is created after the fact rather than before.Recorded Syllabus Fall Semester 2013:#dateuntil1Sep 1.through with admin2Sep 2.at end of motivation3Sep 8.proofs with Peano axioms4Sep 9.operators on unary natural numbers5Sep 15. operations on sets6Sep 16. Functions7Sep 22. operations on functions8Sep 23. SML function by cases8Sep 29. higher-order functions9Sep 30. SML data types10 Oct 6.constructor terms & substitutions11 Oct 7.recursion/computation on ADTs12 Oct 13. I/O and exceptions13 Oct 14. Codes, up to string codesOct 27Midterm14 Oct 28UTF encodings15 Nov 3.Truth Tables16 Nov 4.Landau Sets17 Nov 10. Cost Bounds for Boolean Expressions18 Nov 11. Quine McCluskey19 Nov 17. Intro to Propositional Logic20 Nov 18. The miracle of logics21 Nov 24. Properties of the Hilbert-Calculus22 Nov 25. Natural Deduction for Mathtalk23 Dec 1.Tableaux & Resolution24 Dec 2.Intellectual Property, Copyright, & Information 4293100104107115122126130136148160Here the syllabus of of the last academic year for reference, the current year should be similar; seethe course notes of last year available for reference at .Recorded Syllabus Fall Semester 2013:

vi#12345678891011121314151617181920212223dateSep 2.Sep 3.Sep 9.Sep 10.Sep 16.Sep 17.Sep 23.Sep 24.Sep 30.Oct 1.Oct 7.Oct 8.Oct 14Oct 15.Oct 28.Oct 29.Nov 4.Nov 5.Nov 11.Nov 12.Nov 18.Nov 19.Nov 25.Nov 26.Dec 2.Dec 3.untilthrough with adminat end of motivationrecap of the first weekintroduced proofs with Peano axiomscovered mathtalk & AlphabetsRelationsproperties of functionsSML component selectionhigher-order functionsdatatypescomputation on ADTsconstructor terms & substitutionsMidtermfinal Abstract Interpreterrecursion relation & FibonacciI/O and exceptionsCodes, up to Morse CodeUTF encodingsBoolean ExpressionsMidterm 2Boolean FunctionsElementary Complexity TheoryQuine McCluskeyIntro to Propositional LogicThe miracle of logicsNatural Deduction for Mathtalk

viiRecorded Syllabus Spring Semester 2014:# dateuntil1Feb 3.Graph Paths2Feb 4.Balanced Binary Trees3Feb 10.Universality of NAND and NOR4Feb 11.Carry Chain adder5Feb 17.Two’s complement numbers6Feb 18.RAM7Feb 24.Basic Assembler8Feb 25.Virtual machine basics9Mar 3.Implementing VM arithmetics10 Mar 4.Compiling SW into VM11 Mar 10. Realizing Call Frames12 Mar 11. Compiling µML13 Mar 17. Universal Turing Machine/Halting Problem14 Mar 18. Network Interface Controllers15 Mar 24. SMTP over telnet16 Mar 25. URIs, URLs, URNs17 Mar 31. CSS18 Apr 1.Dynamic HTML19 Apr 7.Web Search: Queries19 Apr 22. public key encryption20 Apr 28. XPath21 Apr 29. Breadth-first search22 May 5.A search23 May 12. PROLOG ideas24 May 13. PROLOG & Look Back

viii

ContentsPreface . . . . . . . . . . . . .This Document . . . . . .Course Concept . . . . . .Course Contents . . . . .Acknowledgments . . . . .Recorded Syllabus for 2014/15.iiiiiiiiiiiv1 Getting Started with “General Computer Science”1.1 Overview over the Course . . . . . . . . . . . . . . .1.2 Administrativa . . . . . . . . . . . . . . . . . . . . .1.2.1 Grades, Credits, Retaking . . . . . . . . . . .1.2.2 Homeworks, Submission, and Cheating . . . .1.2.3 Resources . . . . . . . . . . . . . . . . . . . .1133582 Motivation and Introduction2.1 What is Computer Science? . . . .2.2 Computer Science by Example . .2.3 Other Topics in Computer Science2.4 Summary . . . . . . . . . . . . . .1111121819I.Representation and Computation3 Elementary Discrete Math3.1 Mathematical Foundations: Natural Numbers . . . . .3.2 Reasoning about Natural Numbers . . . . . . . . . . .3.3 Defining Operations on Natural Numbers . . . . . . .3.4 Talking (and writing) about Mathematics . . . . . . .3.5 Naive Set Theory . . . . . . . . . . . . . . . . . . . . .3.6 Relations and Functions . . . . . . . . . . . . . . . . .3.7 Standard ML: Functions as First-Class Objects . . . .3.8 Inductively Defined Sets and Computation . . . . . . .3.9 Inductively Defined Sets in SML . . . . . . . . . . . .3.10 Abstract Data Types and Ground Constructor Terms3.11 A First Abstract Interpreter . . . . . . . . . . . . . . .3.12 Substitutions . . . . . . . . . . . . . . . . . . . . . . .3.13 Terms in Abstract Data Types . . . . . . . . . . . . .3.14 A Second Abstract Interpreter . . . . . . . . . . . . .3.15 Evaluation Order and Termination . . . . . . . . . . .ix21.23232629313437435256626467697173

xCONTENTS4 More SML4.1 Recursion in the Real World . . . . . .4.2 Programming with Effects: Imperative4.2.1 Input and Output . . . . . . .4.2.2 Programming with Exceptions. . . . .Features. . . . . . . . . . . . .in SML. . . . . . . . .77777980815 Encoding Programs as Strings5.1 Formal Languages . . . . . . . . .5.2 Elementary Codes . . . . . . . . .5.3 Character Codes in the Real World5.4 Formal Languages and Meaning . .85858790946 Boolean Algebra6.1 Boolean Expressions and their Meaning . . . . . . . . . . . .6.2 Boolean Functions . . . . . . . . . . . . . . . . . . . . . . . .6.3 Complexity Analysis for Boolean Expressions . . . . . . . . .6.3.1 The Mathematics of Complexity . . . . . . . . . . . .6.3.2 Asymptotic Bounds for Costs of Boolean Expressions6.4 The Quine-McCluskey Algorithm . . . . . . . . . . . . . . . .6.5 A simpler Method for finding Minimal Polynomials . . . . . .97971011031031051091167 Propositional Logic7.1 Boolean Expressions and Propositional Logic . .7.2 A digression on Names and Logics . . . . . . . .7.3 Calculi for Propositional Logic . . . . . . . . . .7.4 Proof Theory for the Hilbert Calculus . . . . . .7.5 A Calculus for Mathtalk . . . . . . . . . . . . . .7.5.1 Propositional Natural Deduction Calculus.1191191231241271331338 Machine-Oriented Calculi8.1 Calculi for Automated Theorem Proving: Analytical Tableaux8.1.1 Analytical Tableaux . . . . . . . . . . . . . . . . . . . .8.1.2 Practical Enhancements for Tableaux . . . . . . . . . .8.1.3 Soundness and Termination of Tableaux . . . . . . . . .8.2 Resolution for Propositional Logic . . . . . . . . . . . . . . . .139139139143145146II.Interlude for the Semester Change9 Legal Foundations of Information Technology9.1 Intellectual Property, Copyright, and Licensing9.1.1 Copyright . . . . . . . . . . . . . . . . .9.1.2 Licensing . . . . . . . . . . . . . . . . .9.2 Information Privacy . . . . . . . . . . . . . . .149.151151153156159

Chapter 1Getting Started with “GeneralComputer Science”Jacobs University offers a unique CS curriculum to a special student body. Our CS curriculumis optimized to make the students successful computer scientists in only three years (as opposedto most US programs that have four years for this). In particular, we aim to enable students topass the GRE subject test in their fifth semester, so that they can use it in their graduate schoolapplications.The Course 320101/2 “General Computer Science I/II” is a one-year introductory course thatprovides an overview over many of the areas in Computer Science with a focus on the foundationalaspects and concepts. The intended audience for this course are students of Computer Science,and motivated students from the Engineering and Science disciplines that want to understandmore about the “why” rather than only the “how” of Computer Science, i.e. the “science part”.1.1Overview over the CourseOverview: The purpose of this two-semester course is to give you an introduction to what theScience in “Computer Science” might be. We will touch on a lot of subjects, techniques andarguments that are of importance. Most of them, we will not be able to cover in the depth thatyou will (eventually) need. That will happen in your second year, where you will see most of themagain, with much more thorough treatment.Computer Science: We are using the term “Computer Science” in this course, because it is thetraditional anglo-saxon term for our field. It is a bit of a misnomer, as it emphasizes the computeralone as a computational device, which is only one of the aspects of the field. Other names that arebecoming increasingly popular are “Information Science”, “Informatics” or “Computing”, whichare broader, since they concentrate on the notion of information (irrespective of the machine e) or on computation.Definition 1.1.1 What we mean with Computer Science here is perhaps best represented by thefollowing quote:The body of knowledge of computing is frequently described as the systematic study ofalgorithmic processes that describe and transform information: their theory, analysis, design, efficiency, implementation, and application. The fundamental question underlying allof computing is, What can be (efficiently) automated?[Den00]1

2CHAPTER 1. GETTING STARTED WITH “GENERAL COMPUTER SCIENCE”Plot of “General Computer Science” Today: Motivation, Admin, and find out what you already know What is Computer Science? a (very) quick walk through the topics Information, Data, Computation, Machines Get a feeling for the math involved learn mathematical language elementary complexity analysis (not a programming course!!!)(so we can talk rigorously)inductively defined sets, functions on them Various machine models(as models of computation) (primitive) recursive functions on inductive sets Programming Language: Standard ML (great equalizer/thought provoker) combinational circuits and computer architecture Turing machines and the limits of computability Fundamental Algorithms and Data structures : Michael Kohlhase1Not a Programming Course: Note “General CS” is not a programming course, but an attemptto give you an idea about the “Science” of computation. Learning how to write correct, efficient,and maintainable, programs is an important part of any education in Computer Science, but wewill not focus on that in this course (we have the Labs for that). As a consequence, we will notconcentrate on teaching how to program in “General CS” but introduce the SML lan

General Computer Science 320201 GenCS I & II Lecture Notes Michael Kohlhase School of Engineering & Science Jacobs University, Bremen Germany m.kohlhase@jacobs-university.de December 1, 2014. ii Preface This Document This document contains the course notes for the course General Computer Science I & II held at Jacobs University Bremen1 in the academic years 2003-2014. Contents: The document .

Related Documents:

This handbook supplement applies to students entering the fourth year of their degree in Computer Science, Mathematics & Computer Science or Computer Science . Undergraduate Course Handbook 1.2 Mathematics & Computer Science The Department of Computer Science offers the following joint degrees with the Department of Mathematics: BA .

Trends in the State of Computer Science in U.S. K-12 Schools 2016 Table of Contents Executive Summary 3 Introduction 5 Value of Computer Science in Schools 6 Opportunities to Learn Computer Science 9 Perceptions of Computer Science 14 Challenges and Opportunities for Computer Science in K-12

Introduction to Computer Science I Course Overview Computer Science 111 Boston University Welcome to CS 111! Computer science is not so much the science of computers as it is the science of solving pro

Computer Science Teachers Association, Cyber Innovation Center, and National Math and Science Initiative have answered the call by organizing states, districts, and the computer science education community to develop conceptual guidelines for computer science education. The K-12 Computer Science Framework was developed for -12 Computer Science

Metacafe General Medio General MediaFLO General Martha Stewart Living Omnimedia General Lexico General Internet Broadcasting (IBSYS) General Hearst-Argyle General Harvard Business Review General Greystripe General Friendster General Facebook General Enpocket General Emmis Interactive General Cellfish Media General Company Member Type .

Computer Science as a discipline 8.1 The role and sub-disciplines of computer science 8.2 Artificial intelligence, data science and computer science 8.3 Ethical aspects of computer science 8.4 The ACM Code of

Science Color & Light Delta Science Module (DSM) 4 Science Mixtures & Solutions Kit Full Option Science System (FOSS) 5 Science Landforms Kit Full Option Science System (FOSS) 5 Science Variables Kit Full Option Science System (FOSS) 5 Science Environments Full Option Science System (FOSS) 5 Science Oceans Delta Science Module (DSM) 5

API and DNV codes describe slightly different approaches to assess the axial bearing capacity of a pile. These codes provide guidline for the calculation of pile length in common soil conditions such as clay (cohesive) or sand (cohesionless). The assessment also depends on the type of soil information available i.e. laboratory test results showing soil properties such as undrained shear .