Inclusion-Exclusion Principle 3 sets A,B,C C A*C A |A ˘ B ˘ C| = |A| + |B| + |C| -|A*B|-|A*C|-|B*C| +|A*B*C| *: intersection B*C A*B +2 -1 -1 |A ˘ B ˘ C| = |A|
Download ReportTranscript Inclusion-Exclusion Principle 3 sets A,B,C C A*C A |A ˘ B ˘ C| = |A| + |B| + |C| -|A*B|-|A*C|-|B*C| +|A*B*C| *: intersection B*C A*B +2 -1 -1 |A ˘ B ˘ C| = |A|
Inclusion-Exclusion Principle 3 sets A,B,C C A*C A |A ˘ B ˘ C| = |A| + |B| + |C| -|A*B|-|A*C|-|B*C| +|A*B*C| *: intersection B*C A*B +2 -1 -1 |A ˘ B ˘ C| = |A| + |B| + |C| -|A*B|-|A*C|-|B*C| +|A*B*C| B +3 -3 +1 -1 |A ˘ B ˘ C| = |A| + |B| + |C| -|A*B|-|A*C|-|B*C| +|A*B*C| Your Programming Assignments • Input f in F satisfying precondition • Output g in G satisfying postcondition • Claims about your program p: F -> G: – Correctness – Resource consumption • Time: <= |F|*log(|F|) for |F|>100. • Space: <= 10 • Energy – Quality of G: 0.6 Programming Assignments • Further claims about your program p: F -> G: – Well designed • Follows well accepted design guidelines Evaluating Programming Assignments • Run them on a benchmark provided by the teaching assistant / professor. • Run them on all test cases provided by other students. Reward students whose test cases find bugs in programs of other students. Good idea! Increases interaction. • What about checking resource consumption and quality claims? Require that they are stated explicitly as part of the submission. Claims • I claim that my program p:F->G is correct for all inputs satisfying the precondition and it operates with resource consumption R and achieves quality Q. • I claim that my sorting program is correct for all inputs of size n < 10^6 and it makes at most n*log(log(n)) comparisons.