VelocerOuvrir l'application

Velocer › Flashcards › University of Wisconsin–Madison › comp sci 240 midterm 1

comp sci 240 midterm 1

Intro to discrete math, propositions + predicate logic, sets, proof techniques. · par sunset_point_notes · 153 cartes

University of Wisconsin–Madison

Étudier ce paquet Intégrer

  1. DiscreteOpposite of continuous; values are distinct and separated, not smoothly varying.
  2. Discrete structuresStructures you can count off with integers: element 1, element 2, element 3, and so on. Like the integers 1, 2, 3 or the letters of a word.
  3. RigorousEvery statement is precise; concepts fixed by definitions, claims stated as propositions.
  4. ProofA sound justification that a statement is true, leaving no doubt.
  5. Two steps of inductionBase case plus induction step.
  6. Base case in inductionThe property holds for the first element.
  7. Induction stepFor every positive integer k, property at k implies property at k+1.
  8. Loop invariantA statement that is true each time a loop iteration starts.
  9. Loop invariant baseThe property holds on the first arrival at the loop start.
  10. Loop invariant stepThe property is preserved from the start to the end of an iteration.
  11. What are loop invariants used for?Proving the correctness of iterative programs.
  12. Foundation ruleThe part of a recursive definition giving the simplest instances.
  13. Constructor ruleThe part of a recursive definition that builds complex instances from simpler ones.
  14. Structural inductionInduction where the base covers the foundation rule and the step covers the constructor rule.
  15. Recursive programSplits an instance into simpler instances of the same problem, calls itself, and composes the solutions.
  16. How do you prove a recursive program correct?Induction on recursion depth plus a termination argument showing recursion bottoms out.
  17. What do program analyses lead to?Recurrence relations; you focus on asymptotic behavior for large inputs.
  18. GraphNodes plus edges, where each edge is a pair of nodes.
  19. What do graphs model?Relations, like friendships: nodes are people, edges are friend pairs.
  20. What do trees model?Hierarchical relations.
  21. Equivalence relations correspond to what?Partitions of the universe.
  22. Graph topicsConnectivity, isomorphism, and planarity.
  23. Finite state automataSpecial graphs modeling simple computation; they exactly match the power of regular expressions.
  24. CombinatoricsCounting structures that have a given property.
  25. Classical combinatoricsPermutations, combinations, and selections from finite sets under restrictions.
  26. Uniform-distribution probabilities and countingThey are equivalent: computing a probability is just counting outcomes.
  27. Stable matching setupn students and n professors; each professor hires one student, each student gets one advisor.
  28. Preference ranking in stable matchingEach side submits a strict ranking with no ties.
  29. Matching (definition)A pairing where each student has exactly one advisor, and each professor advises exactly one student. So it's a one-to-one link between the two groups.
  30. Disruptive pair (s, p)Not paired together, and both prefer each other over their current partners.
  31. Stable matchingA matching with no disruptive pair.
  32. Is a matching where everyone gets their top choice always stable?It is stable, but it may not be a valid matching, like when two share a first choice.
  33. Does a stable matching always exist?Yes, and it is shown by giving an algorithm.
  34. Gale–Shapley: what happens in the morning step?Every student sends an application to the highest-ranked school they haven't been rejected by yet. Example: if your top pick already said no, you try your next favorite.
  35. Gale–Shapley afternoon stepEach professor says maybe to the top applicant and no to the others.
  36. Gale–Shapley evening stepRejected students cross that professor off their list.
  37. In Gale–Shapley, who is a student paired with?The professor who most recently said maybe to them.
  38. How many stable matchings can exist?There may be many; the algorithm returns one of them.
  39. p optimal for sThe highest-ranked professor that some stable matching pairs with s.
  40. p pessimal for sThe lowest-ranked professor that some stable matching pairs with s.
  41. Student optimal matchingEvery student gets their optimal professor.
  42. Professor pessimal matchingEvery professor gets their pessimal student.
  43. Optimality theorem for Gale–ShapleyIts output is both student optimal and professor pessimal.
  44. Real-world uses of stable matchingMedical residents to hospitals, students to schools, and organ transplant allocation.
  45. PropositionA claim that's true or false, nothing in between. Like "7 is odd" (true) or "3 > 5" (false). Questions and commands don't count.
  46. Are questions and commands propositions?No, they have no truth value.
  47. What does ¬P mean?Not P; flips the truth value.
  48. When is P ∧ Q true?Only when both P and Q are true.
  49. When is P ∨ Q false?Only when both P and Q are false (inclusive or).
  50. In P ⇒ Q, what are P and Q called?P is the premise, Q is the consequence.
  51. Why is an implication with a false premise true?It's vacuously true; the condition never holds.
  52. What makes an implication false?True premise and false consequence.
  53. Does a true implication alone prove the consequence?No, you must also show the premise holds.
  54. Logically equivalentSame truth value for every variable assignment.
  55. How do you test logical equivalence?Compare truth-table columns row by row.
  56. Contrapositive of P ⇒ Q¬Q ⇒ ¬P; logically equivalent to the original.
  57. Converse of P ⇒ QQ ⇒ P; not equivalent to the original.
  58. P ⇐⇒ Q (iff)(P ⇒ Q) ∧ (Q ⇒ P); true when both sides share truth value.
  59. AxiomA proposition assumed true without proof.
  60. PredicateA mapping from a domain to propositions; a parametrized proposition.
  61. (∀x)P(x)True if P holds for every x in the domain; false if one counterexample exists.
  62. What is (∀x)P(x) on an empty domain?True, because no counterexample is possible.
  63. ¬(∀x)S(x) is equivalent to what?(∃x)¬S(x)
  64. How does ∀ behave like a big AND?It requires P to hold for every element, like conjoining all cases.
  65. How does ∃ behave like a big OR?It requires P to hold for at least one element, like disjoining all cases.
  66. DeMorgan: ¬(P ∧ Q) ≡ ?¬P ∨ ¬Q
  67. How do you prove ∃ is false?Show it's false for every element (harder than a counterexample).
  68. "All A are B" in predicate logic(∀x)(A(x) ⇒ B(x))
  69. "Some A is B" in predicate logic(∃x)(A(x) ∧ B(x))
  70. Why use ⇒ with ∀?So irrelevant elements don't falsify the statement.
  71. Does quantifier order matter?Yes: (∀x)(∃y)P(x,y) is not the same as (∃y)(∀x)P(x,y).
  72. If (∃y)(∀x)P(x,y) is true, what follows?(∀x)(∃y)P(x,y) is true (weaker, loses info).
  73. Does (∀x)(∃y)P(x,y) imply (∃y)(∀x)P(x,y)?No, the reverse does not hold.
  74. Shrinking domain to condition: (∀x ∈ D1)P(x) ≡ ?(∀x ∈ D)(x ∈ D1 ⇒ P(x))
  75. Shrinking domain to condition: (∃y ∈ D2)Q(y) ≡ ?(∃y ∈ D)(y ∈ D2 ∧ Q(y))
  76. Goldbach's conjectureEvery even integer > 2 is a sum of two primes; truth unknown.
  77. Prime numberAn integer > 1 divisible only by 1 and itself.
  78. Does math "or" allow both?Yes, it's inclusive; everyday "or" often excludes both.
  79. P ∨ (¬P ∧ Q) ≡ ?P ∨ Q
  80. How do you prove an implication via its contrapositive?Prove ¬Q ⇒ ¬P, which is logically equivalent to P ⇒ Q.
  81. Why is "any" ambiguous in logic?It can mean "for all" or "there exists"; use explicit quantifiers.
  82. SetA collection of elements drawn from a domain.
  83. Well-defined setFor every element in the domain, you can decide whether it belongs.
  84. What does x ∈ A mean?x is an element of set A.
  85. Subset A ⊆ BEvery element of A is also an element of B.
  86. Strict subset A ⊂ BA ⊆ B and B has at least one element not in A.
  87. Does the order of elements matter in a set?No; {true, false} is the same set as {false, true}.
  88. Set-builder notation{x ∈ N | 100 ≤ x ≤ 1000}: before the | names the element, after gives properties.
  89. What does the symbol | mean in set-builder notation?'Such that' — it separates the element from its properties.
  90. Finite setA set with a finite number of elements, all listable given enough time.
  91. Boolean domain BB = {true, false}.
  92. On B′ = {0, 1}, what operation matches ∧?Multiplication.
  93. When is XOR true?When exactly one of the two values is true.
  94. Cardinality |S|The number of distinct elements in a finite set S.
  95. What is |∅|?0.
  96. Countable setFinite, or infinite with an enumeration that lists exactly all its elements.
  97. Enumeration of a setEach position gives a different element, and every element appears somewhere.
  98. Is N countable?Yes: 0, 1, 2, 3, … lists every natural number.
  99. Is Z countable?Yes: 0, 1, −1, 2, −2, … lists every integer.
  100. When is an ellipsis (...) allowed in a set?Only when the continuation is unambiguous — one logical next step.
  101. Dense setBetween any two elements lies another element; Q is dense since (x+y)/2 works.
  102. Is Q countable?Yes; arrange a/b in a table and traverse it diagonally, skipping duplicates.
  103. Is R countable?No; the reals are uncountable.
  104. Russell's paradox set S = {A | A ∉ A}Whether S ∈ S is undefined, so S is not well-defined.
  105. Union E1 ∪ E2{x | x ∈ E1 ∨ x ∈ E2}; ∪ parallels OR.
  106. Intersection E1 ∩ E2{x | x ∈ E1 ∧ x ∈ E2}; ∩ parallels AND.
  107. What is a Venn diagram the set analog of?A truth table; it gets messy beyond 3 sets.
  108. Distributive law for setsA ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C).
  109. Complement of E2{x | x ∉ E2}; the precise form also requires x ∈ U, the domain.
  110. Set difference E1 − E2{x | x ∈ E1 ∧ x ∉ E2}.
  111. How do you write a complement using set difference?S3 = U − E2, where U is the domain.
  112. Power set P(A)The set of all subsets of A: P(A) = {S | S ⊆ A}.
  113. List P({0, 1}){∅, {0}, {1}, {0, 1}}.
  114. If |A| = k, what is |P(A)|?2^k, since each element is independently in or out.
  115. What is |P({0, 1, 2})|?2³ = 8.
  116. Alternate notation for P(A)2^A.
  117. Is P(N) countable?No; the power set of the naturals is uncountable.
  118. Proof by contradictionAssume the negation of what you want, then derive a false statement.
  119. Why does diagonalization show P(N) is uncountable?The built A differs from every A_k at element k−1, so A is not in the enumeration.
  120. How is R shown to be uncountable?Use binary representation together with diagonalization.
  121. Inference ruleA rule with antecedents (premises) and a conclusion (consequence).
  122. Modus ponensFrom P and P ⇒ Q, you conclude Q.
  123. How is an inference rule written?Antecedents above a horizontal line, conclusion below it.
  124. Direct proof of P ⇒ Q: what's step 1?Assume P is true.
  125. Direct proof of P ⇒ Q: what's step 2?Derive Q logically from P.
  126. Direct proof of P ⇒ Q: what's step 3?State Q, and mark the end with □ or Q.E.D.
  127. What does Q.E.D. mean?"Which was to be shown" — an end-of-proof marker.
  128. How do you prove a universal statement?Prove it for an arbitrary element, not just one example.
  129. If x is odd, how do you write it?x = 2y + 1 for some integer y.
  130. Indirect proof (contrapositive): what do you prove?Prove ¬Q ⇒ ¬P instead, which is logically equivalent to P ⇒ Q.
  131. Contrapositive rule(¬Q ⇒ ¬P) → (P ⇒ Q).
  132. When is contrapositive proof useful?When the statement has negations; the contrapositive strips them away.
  133. Contrapositive vs. converseThe contrapositive is equivalent to the original; the converse is not.
  134. Method A for proving P ⇐⇒ QProve P ⇒ Q and Q ⇒ P separately.
  135. Biconditional rule(P ⇒ Q) ∧ (Q ⇒ P) → (P ⇐⇒ Q).
  136. Method B for proving P ⇐⇒ QBuild a chain P1 ⇐⇒ P2 ⇐⇒ … ⇐⇒ Pk with P1 = P and Pk = Q.
  137. What does a chain of equivalences prove?Both directions at once.
  138. Proof by contradiction: what do you assume?Assume ¬P, derive a falsehood, then conclude P.
  139. Contradiction rule(¬P ⇒ false) → P.
  140. When should you avoid proof by contradiction?When possible — it's less intuitive; prefer direct or indirect proof.
  141. √2 is irrational: what's the first assumption?Assume √2 = a′/b′ with gcd(a′, b′) = 1.
  142. √2 proof: what does squaring give?2(b′)² = (a′)², which forces a′ to be even.
  143. √2 proof: how does the contradiction arise?Both a′ and b′ turn out even, contradicting gcd(a′, b′) = 1.
  144. Why number your equations in a proof?So you can reference them later.
  145. Proof by cases: what must the conditions satisfy?At least one Ci is always true, and each Ci ⇒ P.
  146. Proof by cases rule(C1 ∨ … ∨ Ck) ∧ (C1 ⇒ P) ∧ … ∧ (Ck ⇒ P) → P.
  147. How is a truth table a case proof?Each row is one case.
  148. 6 people: what's always guaranteed?Either 3 mutual acquaintances or 3 mutual strangers.
  149. 6-people proof: how do you split on Alice?Case ≥3 acquaintances vs. ≤2 acquaintances, each splitting into subcases.
  150. Graph model for the 6-people problemPeople are vertices, acquaintance is an edge; the stranger case mirrors the acquaintance case.
  151. Are Venn-diagram set proofs valid proofs?No — they're only an intuition aid.
  152. Proving one instance vs. proving universallyOne example never proves a universally quantified claim.
  153. Contradiction vs. indirect proof: what's assumed?Contradiction assumes ¬P; indirect proof assumes ¬Q, the negation of the conclusion.

Velocer est gratuit : répétition espacée et vos propres cartes à partir de n'importe quel document.

PDF to flashcards · Lecture to flashcards · Practice exam · Syllabus study plan · Anki import

Plus de paquets de University of Wisconsin–Madison