MAT2033 · 2. hafta · nested quantifiers and introduction to proofs

İç içe niceleyiciler ve çıkarım kuralları

∀x∃y ile ∃y∀x farkı, iç içe niceleyicilerin doğruluk değeri, olumsuzlaması ve bir argümanın geçerli olup olmadığını kurallarla gösterme.

nested quantifiersorder of quantifiersnegationargumentpremiseconclusionvalid argumentrule of inferencemodus ponensmodus tollenshypothetical syllogismdisjunctive syllogismresolutionfallacyuniversal instantiationexistential generalization

Geçen hafta tek niceleyicili ifadeleri gördün. Gerçek matematik cümleleri ise genelde iki ya da üç niceleyici içerir: “her sayının bir tersi vardır”, “herkesten büyük bir sayı yoktur”. Bu sayfanın ilk yarısı bu ifadelerin nasıl okunacağını, doğruluk değerinin nasıl bulunacağını ve nasıl olumsuzlanacağını anlatıyor. İkinci yarısı çıkarım kurallarını (rules of inference) anlatıyor: öncüllerden sonuca adım adım, her adıma kural adı yazarak gitmek. Vizede ikisi de çıkar; niceleyici doğruluk değeri neredeyse kesin, “argüman geçerli mi” de sık gelir.

Altın kurallar:

  1. Niceleyiciler soldan sağa okunur ve seçilir. Önce gelen önce seçilir; sonraki ona bakarak seçilebilir.
  2. ∀x ∃y\forall x\,\exists y‘de yy, xx‘e bağlı olabilir. ∃y ∀x\exists y\,\forall x‘te olamaz.
  3. Olumsuzlarken her niceleyici döner, sıra değişmez.
  4. Geçerli argüman = öncüller doğruysa sonuç kesin doğru. Geçersizliği göstermek için öncüller T, sonuç F olan tek satır yeter.

İç içe niceleyiciler

P(x,y)P(x, y) iki değişkenli bir yüklem olsun. ∀x ∃y P(x,y)\forall x\,\exists y\, P(x,y) ifadesini iç içe iki döngü gibi düşün:

∀x ∃y P(x,y):   for each x:              (dış döngü, hepsi geçmeli)
                    search some y        (iç döngü, bir tane bulsan yeter)
                    with P(x,y) true
∃y ∀x P(x,y):   find ONE y such that
                    for each x: P(x,y)   (aynı y bütün x'lerle çalışmalı)

Yazılımcı gözüyle: ∀\forall bir for döngüsü içinde hepsinin true dönmesi, ∃\exists ise döngüde bir tane true bulunca break. Sıranın değişmesi döngülerin yer değiştirmesi demektir ve sonucu değiştirir.

Günlük dil örneği. Domain: takımdaki oyuncular ve antrenörler. C(y,x)C(y, x): ”yy, xx‘in antrenörü”.

  • ∀x ∃y C(y,x)\forall x\,\exists y\, C(y, x): “Her oyuncunun bir antrenörü var.” Forvetin antrenörü bir kişi, defansınki başka biri olabilir.
  • ∃y ∀x C(y,x)\exists y\,\forall x\, C(y, x): “Herkesin antrenörü olan tek bir kişi var.” Çok daha güçlü bir iddia.

İkincisi doğruysa birincisi de doğrudur (o tek kişiyi herkes için seçersin). Tersi genelde doğru değil.

İki değişkenli dört temel ifade

Domain tam sayılar, P(x,y)P(x, y): "x<yx < y".

İfadeOkunuşuDoğrulukNeden
∀x ∀y (x<y)\forall x\,\forall y\,(x < y)her ikili için x<yx < yFx=y=0x = y = 0 bozar
∀x ∃y (x<y)\forall x\,\exists y\,(x < y)her sayıdan büyük bir sayı varTy=x+1y = x + 1
∃y ∀x (x<y)\exists y\,\forall x\,(x < y)herkesten büyük bir sayı varFyy seçilince x=yx = y bozar
∃x ∃y (x<y)\exists x\,\exists y\,(x < y)bir ikili varT0<10 < 1

Sınavda bir ifadenin doğruluk değerini şöyle yazarsın:

  • True diyorsan: ∃\exists için somut değeri ver (“take y=x+1y = x + 1”), ∀\forall için keyfi elemanla göster (“for any integer xx …”).
  • False diyorsan: ∀\forall için somut karşı örnek ver, ∃\exists için hiçbir elemanın sağlamadığını göster.

Çözümlü örnekler

Domain tam sayılar.

∀x ∃y (x=2y)\forall x\,\exists y\,(x = 2y). False. Counterexample x=1x = 1: 1=2y1 = 2y ise y=12∉Zy = \tfrac12 \notin \mathbb{Z}. (Domain reel sayılar olsaydı y=x/2y = x/2 ile doğru olurdu.)

∃x ∀y (x+y=y)\exists x\,\forall y\,(x + y = y). True. Take x=0x = 0: 0+y=y0 + y = y for every integer yy.

∀x ∃y (xy=1)\forall x\,\exists y\,(xy = 1). False. Counterexample x=2x = 2: 2y=12y = 1 tam sayı çözüm vermez. x=0x = 0 da bozar.

TUZAK · “Sıra fark etmez” sanmak. ∀x ∃y\forall x\,\exists y ile ∃y ∀x\exists y\,\forall x sadece niceleyiciler aynı türdense (∀∀\forall\forall ya da ∃∃\exists\exists) yer değiştirebilir. Karışık niceleyicilerde sıra anlamı değiştirir.

Çeviri

Domain bir sınıftaki öğrenciler, F(x,y)F(x, y): ”xx ve yy arkadaş”.

CümleMantık
Everyone has a friend.∀x ∃y F(x,y)\forall x\,\exists y\, F(x, y)
Someone is a friend of everyone.∃x ∀y F(x,y)\exists x\,\forall y\, F(x, y)
Nobody is friends with everyone.¬∃x ∀y F(x,y)≡∀x ∃y ¬F(x,y)\lnot\exists x\,\forall y\, F(x, y) \equiv \forall x\,\exists y\,\lnot F(x, y)
Every student has a friend other than themselves.∀x ∃y (x≠y∧F(x,y))\forall x\,\exists y\,(x \ne y \land F(x, y))

Kalıp: “every” ve “all” için ∀\forall, “some”, “a”, “at least one” için ∃\exists. İçteki bağlaç yine geçen haftanın kuralına uyar: ∀\forall altında koşul varsa →\to, ∃\exists altında ∧\land.

İç içe niceleyiciyi olumsuzlama

Kural geçen haftanınkiyle aynı, sadece birden fazla kez uygulanır: ¬\lnot‘yi soldan sağa iterken her niceleyiciyi çevirirsin.

¬ ∀x ∃y (P(x,y) ∧ Q(x))
≡ ∃x ¬∃y (P(x,y) ∧ Q(x))
≡ ∃x ∀y ¬(P(x,y) ∧ Q(x))
≡ ∃x ∀y (¬P(x,y) ∨ ¬Q(x))        De Morgan

Kısıtlı niceleyicilerde kısıt olduğu gibi kalır: ¬ ∀x>0  P(x)≡∃x>0  ¬P(x)\lnot\,\forall x > 0\; P(x) \equiv \exists x > 0\; \lnot P(x). “Her pozitif sayı sağlar” yanlışsa, sağlamayan bir pozitif sayı vardır.

Çıkarım kuralları (rules of inference)

Bir argüman (argument) öncüller (premises) ve bir sonuçtan (conclusion) oluşur. Argüman geçerli (valid) ise öncüllerin hepsi doğru olduğunda sonuç kesinlikle doğrudur. Yani (p1∧p2∧⋯∧pn)→q(p_1 \land p_2 \land \dots \land p_n) \to q bir tautology’dir. Geçerlilik içerikle değil, kalıpla ilgilidir.

Uzun doğruluk tablosu kurmak yerine bilinen geçerli kalıpları zincirlersin:

KuralÖncüllerSonuç
Modus ponenspp, p→qp \to qqq
Modus tollens¬q\lnot q, p→qp \to q¬p\lnot p
Hypothetical syllogismp→qp \to q, q→rq \to rp→rp \to r
Disjunctive syllogismp∨qp \lor q, ¬p\lnot pqq
Additionppp∨qp \lor q
Simplificationp∧qp \land qpp
Conjunctionpp, qqp∧qp \land q
Resolutionp∨qp \lor q, ¬p∨r\lnot p \lor rq∨rq \lor r

Niceleyicili kurallar:

KuralÖncülSonuç
Universal instantiation∀x P(x)\forall x\, P(x)P(c)P(c), herhangi bir cc için
Universal generalizationkeyfi cc için P(c)P(c)∀x P(x)\forall x\, P(x)
Existential instantiation∃x P(x)\exists x\, P(x)bazı (adı konmamış) cc için P(c)P(c)
Existential generalizationbelirli bir cc için P(c)P(c)∃x P(x)\exists x\, P(x)
Universal modus ponens∀x (P(x)→Q(x))\forall x\,(P(x) \to Q(x)), P(a)P(a)Q(a)Q(a)

İki klasik hata (fallacy)

  • Affirming the conclusion: p→qp \to q, qq ∴p\therefore p. Geçersiz. “Çok çalışan geçer. Ali geçti. O halde Ali çok çalıştı.” Belki şanslıydı.
  • Denying the hypothesis: p→qp \to q, ¬p\lnot p ∴¬q\therefore \lnot q. Geçersiz. “Çok çalışan geçer. Ali çalışmadı. O halde Ali kaldı.” Belki yine de geçti.

İkisinde de bozan satır p=Fp = F, q=Tq = T: öncüller doğru, sonuç yanlış.

Çözümlü örnek: argümanı kurallarla çözmek

Premises: “If I wake up early and I am not tired, I go to the gym.” “I did not go to the gym.” “I woke up early.” Conclusion: “I was tired.”

Önce harf ver: ww: wake up early, hh: tired, gg: go to the gym. Öncüller (w∧¬h)→g(w \land \lnot h) \to g, ¬g\lnot g, ww. Sonuç hh.

1. (w ∧ ¬h) → g      premise
2. ¬g                premise
3. ¬(w ∧ ¬h)         modus tollens, 1, 2
4. ¬w ∨ h            De Morgan + double negation, 3
5. w                 premise
6. h                 disjunctive syllogism, 4, 5   (¬w yanlış, kalan h)

Argüman geçerli. 4. adım bir çıkarım kuralı değil, denklik kanunu; bunu da adıyla yazman yeterli.

Çözümlü örnek: resolution

Premises p∨qp \lor q, ¬p∨r\lnot p \lor r, ¬q∨r\lnot q \lor r. Conclusion rr.

1. p ∨ q        premise
2. ¬p ∨ r       premise
3. q ∨ r        resolution, 1, 2
4. ¬q ∨ r       premise
5. r ∨ r        resolution, 3, 4
6. r            idempotent law, 5

Gündelik okuması: “Ya otobüsle (pp) ya trenle (qq) gideceğim. Otobüsle gidersem geç kalırım. Trenle gidersem de geç kalırım. O halde geç kalacağım.” Bu kalıba proof by cases da denir; ispat sayfasında tekrar göreceksin.

İPUCU · Önce harfleri yaz. “Let pp: …, qq: …” satırı sınavda puanın bir kısmıdır. Sonra numaralı satırlarla ilerle; her satırın sağına “premise” ya da kural adı ve kullandığın satır numaraları.

Sık yapılan hatalar

Yanlış düşünceDoğrusu
∀x ∃y\forall x\,\exists y ile ∃y ∀x\exists y\,\forall x aynıKarışık niceleyicide sıra anlamı değiştirir
∃y ∀x\exists y\,\forall x için her xx için ayrı yy seçmekTek yy seçilir, bütün xx‘lerle çalışmalı
Olumsuzlamada sadece ilk niceleyiciyi çevirmekHepsi çevrilir, sıra korunur
¬ ∀x>0 P(x)≡∃x≤0 ¬P(x)\lnot\,\forall x > 0\, P(x) \equiv \exists x \le 0\,\lnot P(x)Kısıt kalır: ∃x>0 ¬P(x)\exists x > 0\,\lnot P(x)
“other” kelimesini atlamakx≠yx \ne y şartı gerekir
p→qp \to q, qq ∴p\therefore p geçerliAffirming the conclusion, geçersiz
p→qp \to q, ¬p\lnot p ∴¬q\therefore \lnot q geçerliDenying the hypothesis, geçersiz
Geçersizliği “bence olmaz” diye açıklamakÖncüller T, sonuç F olan satırı somut yaz
Kural adını yazmadan satır eklemekHer satırın gerekçesi puandır

Kendini test et

Sınavdaki gibi İngilizce sorular. Önce kâğıt kalemle çöz, sonra cevabı aç.

Soru 1kolay

The domain of all variables is the integers. Determine the truth values of (a) ∀x ∃y (x+y=5)\forall x\,\exists y\,(x + y = 5) and (b) ∃y ∀x (x+y=5)\exists y\,\forall x\,(x + y = 5).

Cevabı göster
(a) true, (b) false

(a) Her xx için y=5−xy = 5 - x seç; bu bir tam sayı ve x+y=5x + y = 5. yy, xx'e göre değişebiliyor, sorun yok.
(b) Bütün xx'ler için çalışan TEK bir yy lazım. yy sabitlenince x+y=5x + y = 5 sadece x=5−yx = 5 - y için doğru; mesela x=6−yx = 6 - y bozar. Yanlış.

Soru 2kolay

The domain is the integers. Is ∃x ∀y (xy=0)\exists x\,\forall y\,(xy = 0) true? Justify.

Cevabı göster
True, take x = 0

∃x\exists x önde: önce tek bir xx seçeceksin, sonra o xx bütün yy'lerle çalışmalı. x=0x = 0 seçersen her yy için 0⋅y=00 \cdot y = 0. Doğru.

Soru 3orta

The domain is the real numbers. Determine the truth values of (a) ∀x ∃y (y2=x)\forall x\,\exists y\,(y^2 = x) and (b) ∀x ∃y (x=y3)\forall x\,\exists y\,(x = y^3).

Cevabı göster
(a) false, (b) true

(a) Karşı örnek x=−1x = -1: hiçbir reel yy için y2=−1y^2 = -1 olmaz, çünkü y2≥0y^2 \ge 0.
(b) Her reel xx için y=x3y = \sqrt[3]{x} reel bir sayı ve y3=xy^3 = x. Küp kök negatiflerde de tanımlı. Doğru.

Soru 4orta

The domain is the positive integers. Is ∀x ∃y (y<x)\forall x\,\exists y\,(y < x) true?

Cevabı göster
False, counterexample x = 1

∀x\forall x için bir karşı örnek yeter. x=1x = 1 alınca y<1y < 1 olan pozitif tam sayı yok. Domain tam sayılar olsaydı (y=x−1y = x - 1) doğru olurdu.

Soru 5orta

Let the domain of xx and yy be {1,2,3}\{1, 2, 3\}. Find the truth values of (a) ∀x ∃y (x+y=4)\forall x\,\exists y\,(x + y = 4), (b) ∃y ∀x (x≤y)\exists y\,\forall x\,(x \le y), (c) ∀x ∀y (x+y≤5)\forall x\,\forall y\,(x + y \le 5).

Cevabı göster
(a) T, (b) T, (c) F

(a) x=1⇒y=3x=1 \Rightarrow y=3, x=2⇒y=2x=2 \Rightarrow y=2, x=3⇒y=1x=3 \Rightarrow y=1. Her xx'in eşi var: T.
(b) y=3y = 3 herkesten büyük-eşit: T.
(c) x=y=3x = y = 3 için 6≤56 \le 5 yanlış: F. ∀∀\forall\forall'da her ikiliyi kontrol edersin, bir tanesi bozuyor.

Soru 6orta

Let C(x,y)C(x, y) mean "xx has chatted with yy", the domain being the students in a class. Express in logic: "Every student has chatted with at least one other student in the class."

Cevabı göster
∀x ∃y (x ≠ y ∧ C(x, y))

"Every student" dış ∀x\forall x. "At least one" iç ∃y\exists y. "Other" kelimesi x≠yx \ne y şartını getirir; unutursan bir öğrencinin kendisiyle konuşması da sayılır. ∃\exists olduğu için bağlaç ∧\land.

Soru 7orta

Write the negation of ∀x ∃y (P(x,y)→Q(y))\forall x\,\exists y\,(P(x, y) \to Q(y)) so that no negation sign is in front of a quantifier.

Cevabı göster
∃x ∀y (P(x, y) ∧ ¬Q(y))

Soldan sağa her niceleyiciyi çevir: ∀x→∃x\forall x \to \exists x, ∃y→∀y\exists y \to \forall y. Sıra aynı kalır. Sonra içerisi: ¬(P→Q)≡P∧¬Q\lnot(P \to Q) \equiv P \land \lnot Q.

Soru 8zor

Negate the statement ∀ε>0  ∃N  ∀n>N  (∣an∣<ε)\forall \varepsilon > 0\; \exists N\; \forall n > N\; (\lvert a_n \rvert < \varepsilon) so that no negation sign is in front of a quantifier.

Cevabı göster
∃ε > 0 ∀N ∃n > N (|a_n| ≥ ε)

Üç niceleyici sırayla döner: ∀ε→∃ε\forall\varepsilon \to \exists\varepsilon, ∃N→∀N\exists N \to \forall N, ∀n→∃n\forall n \to \exists n. Kısıtlar (ε>0\varepsilon > 0, n>Nn > N) olduğu gibi kalır, çünkü onlar niceleyicinin tanım aralığını söyler. En içte ¬(∣an∣<ε)≡∣an∣≥ε\lnot(\lvert a_n \rvert < \varepsilon) \equiv \lvert a_n \rvert \ge \varepsilon.

Soru 9kolay

Which rule of inference is used? "If the code compiles, the tests run. The tests did not run. Therefore the code did not compile."

Cevabı göster
Modus tollens

pp: compiles, qq: tests run. Öncüller p→qp \to q ve ¬q\lnot q, sonuç ¬p\lnot p. Bu kalıbın adı modus tollens. Geçerlidir, çünkü ((p→q)∧¬q)→¬p((p \to q) \land \lnot q) \to \lnot p bir tautology.

Soru 10orta

Is the following argument valid? "If the server is down, the website is offline. The website is offline. Therefore the server is down." Justify.

Cevabı göster
Invalid (fallacy of affirming the conclusion); row p = F, q = T

pp: server down, qq: website offline. Kalıp p→qp \to q, qq ∴p\therefore p. Geçersizliği göstermek için öncüllerin hepsi T, sonuç F olan bir satır bul: p=Fp = F, q=Tq = T. Bu satırda p→q=Tp \to q = T ve q=Tq = T ama p=Fp = F. Site başka bir sebeple de kapalı olabilir.

Soru 11orta

Show that the premises "If it rains, practice is cancelled", "If practice is cancelled, I study", "It rains or I am injured" and "I am not injured" imply "I study". Name each rule.

Cevabı göster
Valid: disjunctive syllogism gives r, hypothetical syllogism gives r → s, modus ponens gives s.

rr: rains, cc: cancelled, ss: I study, ii: injured. Öncüller r→cr \to c, c→sc \to s, r∨ir \lor i, ¬i\lnot i.
1. r∨ir \lor i (premise), 2. ¬i\lnot i (premise), 3. rr (disjunctive syllogism, 1, 2)
4. r→cr \to c, 5. c→sc \to s (premises), 6. r→sr \to s (hypothetical syllogism, 4, 5)
7. ss (modus ponens, 3, 6). Her satıra numara ve kural adı yaz.

Soru 12zor

"Every computer engineering student takes MAT2033. Selin is a computer engineering student. Therefore Selin takes MAT2033." Write the argument in logic and name the rule that justifies it.

Cevabı göster
∀x (E(x) → M(x)), E(Selin) ∴ M(Selin); universal modus ponens

E(x)E(x): computer engineering student, M(x)M(x): takes MAT2033. Önce universal instantiation ile E(Selin)→M(Selin)E(\text{Selin}) \to M(\text{Selin}) elde edilir, sonra modus ponens ile M(Selin)M(\text{Selin}). İkisinin birleşimine universal modus ponens denir.

Doğrulama: Niceleyici doğruluk değerleri sonlu tanım kümelerinde ve -200..200 tam sayı penceresinde kaba kuvvetle, iç içe olumsuzlama rastgele sonlu modellerde, bütün argümanlar doğruluk tablosuyla (öncüller T iken sonuç T mi) node ile kontrol edildi (verify/MAT2033/02.mjs).

Deftere not kartı

∀x∃y: y, x'e göre değişebilir (her x için ayrı y). ∃y∀x: TEK y herkese yeter. ∃y∀x P doğruysa ∀x∃y P de doğru; tersi genelde DEĞİL. ∀x∀y: bir bozan ikili yanlış yapar. ∃x∃y: bir sağlayan ikili doğru yapar. Olumsuzla: soldan sağa her niceleyiciyi çevir, sıra aynı, en son içi olumsuzla. ¬∀x∃y P(x,y) ≡ ∃x∀y ¬P(x,y) ¬(P→Q) ≡ P∧¬Q ¬(a<b) ≡ a≥b "other" → x≠y şartı. Kısıt (ε>0, n>N) olumsuzlamada aynen kalır. Modus ponens p, p→q ∴ q Modus tollens ¬q, p→q ∴ ¬p Hyp. syllogism p→q, q→r ∴ p→r Disj. syllogism p∨q, ¬p ∴ q Addition p ∴ p∨q Simplification p∧q ∴ p Conjunction p, q ∴ p∧q Resolution p∨q, ¬p∨r ∴ q∨r GEÇERSİZ: p→q, q ∴ p (affirming conclusion); p→q, ¬p ∴ ¬q (denying hypothesis) Geçersiz göster: öncüller T, sonuç F olan tek satır ∀x(A(x)→B(x)), A(c) ∴ B(c): universal modus ponens