# Introduction to Computer Science

### About

**Module:**Introduction to Computer Science (CH-232)**Semester:**Fall 2023**Prerequisites:**None**Instructor:**Jürgen Schönwälder**Office Hours:**Monday, 11:15-12:30 (Research I, Room 87)**TA (Group A):**Aksay, Enes Yusuf**TA (Group B):**Borsos, Matheas-Roland**TA (Group C):**Dobrescu, Ana-Maria**TA (Group D):**Konstantinovikj, Darko**TA (Group E):**Madriaga, Ivanna Judea**TA (Group F):**Shopov, Georgi Krasimirov**Class:**Tuesday, 11:15-12:30 (RLH 172)**Class:**Friday, 08:15-09:30 (RLH 172)**Class:**Friday, 09:45-11:00 (RLH 172)**General Tutorial:**Tuesday, 20:00-21:00 (West Hall 2)**Haskell Tutorial:**Wednesday, 21:00-22:00 (West Hall 2)**General Tutorial:**Thursday, 20:00-21:00 (West Hall 2)**1st Module Exam:**Wednesday, 2023-12-20 09:00-11:00 (SCC Halls 1-2 and 3-4)**2nd Module Exam:**Tuesday, 2024-01-23 09:00-11:00 (ICC East Wing)

### 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

### Literature

- Eric Lehmann, F. Thomson Leighton, Albert R. Meyer: "Mathematics for Computer Science", 2018
- Richard Hammack: "Book of Proof", 3rd edition, 2020
- 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)
- Haskell: An advanced purely functional programming language (web site about Haskell)
- Learn You a Haskell for Great Good! (a book also available online)
- Real World Haskell (a book also available online)
- What I Wish I Knew When Learning Haskell (an open source book by Stephen Diehl)
- Haskell Tutorial (a relatively concise online tutorial)
- Haskell to Core: Understanding Haskell Features Through Their Desugaring
- 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 |
---|---|---|

2023-09-05 | 2023-09-08 | Introduction and maze generation algorithms |

2023-09-12 | 2023-09-15 | String search algorithms, complexity and correctness |

2023-09-19 | 2023-09-22 | Mathematical notations and proof techniques |

2023-09-26 | 2023-09-29 | Sets, relations, functions, algebraic structures |

2023-10-06 | Representation of integer and floating point numbers | |

2023-10-10 | 2023-10-13 | Representation of characters, strings, date and time |

2023-10-17 | 2023-10-20 | Boolean functions, expressions, laws |

2023-10-24 | 2023-10-27 | Normal forms, minimization of Boolean functions |

2023-11-03 | Boolean logic, logic gates | |

2023-11-07 | 2023-11-10 | Combinational and sequential digital circuits |

2023-11-14 | 2023-11-17 | von Neuman computer architecture, assembler programming |

2023-11-21 | 2023-11-24 | Interpreter, compiler, operating systems |

2023-11-28 | 2023-12-01 | Software specification and verification |

2023-12-05 | Automated generation of proof goals and termination proofs |

### Functional Programming (Haskell)

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

2023-09-08 | 01 Introduction | Haskell Interpreter (ghci), Haskell Compiler (ghc) |

2023-09-15 | 02 Expressions | Expressions, Boolean Expressions |

2023-09-22 | 03 Lists | Basic Lists, Advanced Lists |

2023-09-29 | 04 Types | Characters and Strings, Tuples, Types and Type Signatures |

2023-10-06 | 05 Defining Functions I | Pattern Matching, Recursion |

2023-10-13 | 06 Defining Functions II | Guards, Let Expressions, Where Bindings, Case Expressions |

2023-10-20 | 07 Defining Functions III | Lambda Expressions, Partial Application, Currying, Composition, Application |

2023-10-27 | 08 Higher Order Functions | Mapping, Filtering, Zipping, Folding |

2023-11-03 | 09 Algebraic Data Types | Product types, sum types, record syntax, deriving |

2023-11-10 | 10 Basic Collections | Binary Trees, Sets, Maps |

2023-11-17 | 11 Typeclasses | Typeclasses, Functors, Applicatives |

2023-11-24 | 12 Monads | Monads, IO Monad |

2023-12-01 | 13 Applications | Guess Word Game |

### Assignments

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

2023-09-15 | Sheet 01 | Kruskal and Boyer-Moore algorithms, Haskell expressions |

2023-09-22 | Sheet 02 | Proof by contrapositive, proof by induction, Haskell list comprehensions |

2023-09-29 | Sheet 03 | Distributivity laws, cartesian products, relations, Haskell types |

2023-10-06 | Sheet 04 | Relations, functions, function properties, Haskell characters and types |

2023-10-13 | Sheet 05 | B-complement, floating point numbers, Haskell decimal to binary conversion |

2023-10-20 | Sheet 06 | Unicode characters, long life diet, Haskell long life diet |

2023-10-27 | Sheet 07 | Universal nor, boolean algebra derivation , Haskell munged strings |

2023-11-04 | Sheet 08 | Quine-McCluskey algorithm |

2023-11-11 | Sheet 09 | Triangle display digital circuit, Haskell map equivalence, Haskell folds |

2023-11-18 | Sheet 10 | JK flip-flops, assembler programming (scpu) |

2023-11-25 | Sheet 11 | assembler programming (rv32i), Haskell expression rendering and simplication |

2023-12-02 | Sheet 12 | BNF grammar, system calls (rv32i), pre- and postconditions |

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

### Rules

The grade is determined by the final exam (100%). To attend the final exam, it is necessary to collect 50 points in weekly assignments. There are ten regular assignments and two bonus assignments during the semester and there is another bonous assignment before the second module exam. Each assignment is worth 10 points. Hence, students have to obtain 50/120 points during the semester to qualify for the first module exam or 50/130 points to qualify for the second module exam. Once a module achievement has been obtained, it remains valid for all subsequent module exams.

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. Solutions for assignments may need to be defended in an oral interview.

Late submissions will not be accepted. 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 individual solutions. 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). These rules also apply to any generative AI tool, such as ChatGPT.

- You are discouraged from using AI tools UNLESS under direct instruction from your instructor to do so.
- If AI is permitted to be used, you must clearly state how AI was used in completing the assignments. No more than 25% of an assignment should be created with AI if the instructor gives permission for its use.
- Note that the material generated by these programs may be inaccurate, incomplete, or otherwise problematic. Their use may also stifle your own independent thinking and creativity. Accordingly, reduction in the grade is likely when using AI. Rather use your own brain.

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 any part of these rules are confusing or uncertain, please reach out to your instructor for a conversation before submitting your work.

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.