# Introduction to Computer Science

### About

**Module:**Introduction to Computer Science (CH-232)**Semester:**Fall 2020**Instructor:**Jürgen Schönwälder**TA:**Chhetri, Maulik**TA:**Gjoni, Petri**TA:**Karki, Aabishkar**TA:**Paudel, Subigya**TA:**Pham, Tuan**TA:**Sota, Henri**Class:**Tuesday, 11:15-12:30 (ICC East Wing)**Class:**Friday, 08:15-09:30 (ICC East Wing)**Class:**Friday, 09:45-11:00 (ICC East Wing)**Tutorial:**Tuesday, 19:30-21:30 (Group A, Petri)**Tutorial:**Tuesday, 19:00-21:00 (Group B, Henri)**Tutorial:**Wednesday, 19:00-21:00 (Group C, Maulik)**Tutorial:**Monday, 19:00-21:00 (Group D, Subigya)**Tutorial:**Tuesday, 19:00-21:00 (Group E, Tuan)**Tutorial:**Wednesday, 20:00-22:00 (Group F, Aabishkar)**1st Module Exam:**Friday, 2020-12-18, 09:00-11:00 (SCC Hall 1-3)**2nd Module Exam:**Wednesday, 2021-01-27, 17:00-19:00 (ICC East Wing)**Office Hours:**Monday, 11:15-12:30 (Research I, Room 87)

### Content and Educational Aims

The module introduces fundamental concepts and techniques of computer science in a bottom-up manner. Based on clear mathematical foundations (which are developed as needed), the course discusses abstract and concrete notions of computing machines, information, and algorithms, focusing on the question of representation versus meaning in Computer Science.

The module introduces basic concepts of discrete mathematics with a focus on inductively defined structures, to develop a theoretical notion of computation. Students will learn the basics of the functional programming language Haskell because it treats computation as the evaluation of pure and typically inductively defined functions. The module covers a basic subset of Haskell that includes types, recursion, tuples, lists, strings, higher-order functions, and finally monads. Back on the theoretical side, the module covers the syntax and semantics of Boolean expressions and it explains how Boolean algebra relates to logic gates and digital circuits. On the technical side, the course introduces the representation of basic data types such as numbers, characters, and strings as well as the von Neuman computer architecture. On the algorithmic side, the course introduces the notion of correctness and elementary concepts of complexity theory (big O notation).

### Intended Learning Outcomes

By the end of this module, students will be able to

- explain basic concepts such as the correctness and complexity of algorithms (including the big O notation);
- illustrate basic concepts of discrete math (sets, relations, functions);
- recall basic proof techniques and use them to prove properties of algorithms;
- explain the representation of numbers (integers, floats), characters and strings, and date and time;
- summarize basic principles of Boolean algebra and Boolean logic;
- describe how Boolean logic relates to logic gates and digital circuits;
- outline the basic structure of a von Neumann computer;
- explain the execution of machine instructions on a von Neumann computer;
- describe the difference between assembler languages and higher-level programming languages;
- define the differences between interpretation and compilation;
- illustrate how an operating system kernel supports the execution of programs;
- determine the correctness of simple programs;
- write simple programs in a pure functional programming language.

### Resources

### Books

- Eric Lehmann, F. Thomson Leighton, Albert R. Meyer: "Mathematics for Computer Science", 2018
- David A. Patterson, John L Hennessy: "Computer Organization and Design: The Hardware/Software Interface", 4th edition, Morgan Kaufmann, 2011
- Miran Lipovaca: "Learn You a Haskell for Great Good!: A Beginner's Guide", 1st edition, No Starch Press, 2011

### Links

- Glasgow Haskell Compiler (download ghc from here or use your package manager)
- Learn You a Haskell for Great Good! (a book that is also available online)
- Haskell: An advanced purely functional programming language (web site about Haskell)
- Real World Haskell (a book that is also available online)
- Haskell Tutorial (a relatively concise online tutorial)
- UNIX Tutorial for Beginners (a tutorial that can be downloaded and done offline)
- Background reading on Hoare Logic

### Schedule

Tue 11:15 | Fri 08:15 | Topics |
---|---|---|

2020-09-01 | 2020-09-04 | Introduction and maze generation algorithms |

2020-09-08 | 2020-09-11 | String search algorithms, complexity and correctness |

2020-09-15 | 2020-09-18 | Mathematical notations and proof techniques |

2020-09-22 | 2020-09-25 | Sets, relations, and functions |

2020-09-29 | 2020-10-02 | Representation of integer and floating point numbers |

2020-10-06 | 2020-10-09 | Representation of characters, strings, date and time |

2020-10-13 | 2020-10-16 | Boolean functions, expressions, laws |

2020-10-20 | 2020-10-23 | Normal forms, minimization of Boolean functions |

2020-10-27 | 2020-10-30 | Boolean logic, logic gates |

2020-11-03 | 2020-11-06 | Combinational and sequential digital circuits |

2020-11-10 | 2020-11-13 | von Neuman computer architecture, assembly programming |

2020-11-17 | 2020-11-20 | Interpreter, compiler, operating systems |

2020-11-24 | 2020-11-27 | Software specification and verification |

2020-12-01 | 2020-12-04 | Automated generation of proof goals and termination proofs |

### Functional Programming (Haskell)

Fri 09:45 | Topics |
---|---|

2020-09-04 | Haskell (ghc, expressions) |

2020-09-11 | Haskell (lists) |

2020-09-18 | Haskell (characters, strings, tuples, types) |

2020-09-25 | Haskell (functions, pattern matching, recursion) |

2020-10-02 | Haskell (guards, bindings, case expressions) |

2020-10-09 | Haskell (Lambda functions, composition, currying) |

2020-10-16 | Haskell (higher order functions) |

2020-10-23 | Haskell (higher order functions) |

2020-10-30 | Haskell (datatypes) |

2020-11-06 | Haskell (datatypes) |

2020-11-13 | Haskell (typeclasses) |

2020-11-20 | Haskell (functors, applicative, monads) |

2020-11-27 | Haskell (IO monad) |

2020-12-04 | Summary and Outlook |

### Assignments

Date/Due | Name | Topics |
---|---|---|

2020-09-18 | Sheet #01 | Kruskal and Boyer-Moore algorithms, Haskell operators |

2020-09-25 | Sheet #02 | landau sets, proof by induction, Haskell list comprehensions |

2020-10-02 | Sheet #03 | cartesian products, relations, proof by induction, Haskell rotate and circle |

2020-10-09 | Sheet #04 | order relations, function composition, Haskell prime twins, cousins, sexies |

2020-10-16 | Sheet #05 | b-complement, floating point numbers, utf8, Haskell evil and odious numbers |

2020-10-23 | Sheet #06 | universal operations, boolean equivalence laws, conjunctive and disjunctive normal form |

2020-10-30 | Sheet #07 | Quine-McCluskey algorithm |

2020-11-06 | Sheet #08 | combinatorial digital circuits, Haskell fizzbuzz and folds |

2020-11-13 | Sheet #09 | JK flip-flops, ripple counter, Haskell BoolExpr type |

2020-11-20 | Sheet #10 | assembler programming, Haskell Email typeclass |

2020-11-27 | Sheet #11 | fork system call, Haskell tail recursion, Haskell arithmetic expression evaluation |

2020-12-04 | Sheet #12 | correctness of an exponentiation algorithm |

2021-01-15 | Sheet #13 | extra sheet for students who did not manage to obtain 50/120 points |

### Results

### Rules

The final grade is determined by the final exam (100%). In order to sit for the final exam, it is necessary to have 50% of the assignments correctly solved. There are 10 regular assignments and 2-3 bonus assignments.

Electronic submission is the preferred way to hand in homework solutions. Please submit documents (plain ASCII/UTF-8 text or PDF, no Word) and your source code (packed into a zip archive after removing all binaries and temporary files) via the online submission system. If you have problems, please contact one of the TAs.

Late submissions will not be accepted. Assignments may need to be defended in an oral interview. In case you are ill, you have to follow the procedures defined in the university policies to obtain an official excuse. If you obtain an excuse, the new deadline will be calculated as follows:

- Determine the number of days you were excused until the deadline day, not counting excused weekend days.
- Determine the day of the end of your excuse and add the number of day you obtained in first step. This gives you the initial new deadline.
- If the period between the end of your excuse and the new deadline calculated in the second step includes weekend days, add them as well to the new deadline. (Iterate this step if necessary.)

For any questions stated on assignment sheets or exam sheets, we by default expect a reasoning for the answer given, unless explicitly stated otherwise.

Students must submit solutions individually. If you copy material verbatim from the Internet (or other sources), you have to provide a proper reference. If we find your solution text on the Internet without a proper reference, you risk to lose your points. Any cheating cases will be reported to the registrar. In addition, you will lose the points (of course).

Any programs, which have to be written, will be evaluated based on the following criteria:

- correctness including proper handling of error conditions
- proper use of programming language constructs
- clarity of the program organization and design
- readability of the source code and any output produced

Source code must be accompanied by a README file providing an overview of the source files and giving instructions how to build the programs. A suitable Makefile is required if the build process involves more than a single source file.

If you are unhappy with the grading, please report immediately (within one week) to the TAs. If you can't resolve things, contact the instructor. Problem reports which come late, that is after the one-week period, are not considered anymore.