Introduction to logic

Logic કામ કરે છે ફક્ત propositions સાથે, એટલે એવા વાક્યો જે ચોક્કસ true કે false હોય, અને 5 connectives (NOT, AND, OR, if-then, if-and-only-if) એમાંથી દરેક complex statement બનાવે છે.

10 min read · 11 cards · 3 checks

Read in: English · हिन्दी · ગુજરાતી


Theory

એ વાક્ય જેને computer judge કરી શકે

આ 4 વાક્યો વાંચો:

1. "2 + 3 = 5"

2. "Close the door."

3. "Is it raining?"

4. "Maths is beautiful."

આમાંથી ફક્ત એક જ વાક્યને computer પૂરી ખાતરી સાથે TRUE કે FALSE કહી શકે: પહેલું. Command, question અને opinion, એમને કોઈ truth value જ નથી હોતી.

Logic એટલે પહેલા પ્રકારના વાક્યોનું mathematics, અને તમારો code જે પણ decision લેશે એ બધું આના પર જ ચાલે છે.

Theory

Reasoning માટેની grammar

ભાષામાં grammar હોય છે જેથી વાક્યોનો અર્થ સાચો બને; એવી જ રીતે reasoning માં logic હોય છે જેથી argument ટકે. જેમ grammar કહી દે કે "went I home" ખોટું છે ભલે એમાં બધા શબ્દો સાચા હોય, એમ logic કહી દે કે argument ખોટો છે ભલે એ સાંભળવામાં convincing લાગતો હોય. એ તો વિચારવાની quality control છે.

Theory

Propositions: logic ના atoms

Proposition એટલે એક declarative વાક્ય જે true હોય કે false, પણ બંને એકસાથે નહીં.

Propositions છે: "Delhi is the capital of India" (T), "7 is even" (F).

Proposition નથી: "What time is it?" (question), "Please sit down" (command), "Biryani is tasty" (opinion), "x + 1 = 5" (x પર આધાર રાખે છે, એટલે એની કોઈ fixed truth value નથી).

Proposition ને આપણે letters થી નામ આપીએ છીએ: P, Q, R.

Quiz

આમાંથી proposition કયું છે?

  1. "Solve question 5."
  2. "Every even number greater than 2 is not prime."
  3. "How difficult is this exam?"
  4. "x is greater than 10."
Show the answer

"Every even number greater than 2 is not prime."

Option B declarative છે અને ચોક્કસ true કે false છે (અહીં એ true છે). Command અને question ને કોઈ truth value જ નથી, અને "x > 10" ને ત્યાં સુધી fixed truth value નથી જ્યાં સુધી x ખબર ના પડે, અને મોટા ભાગના students આ જ trap માં ફસાય છે. Exam માં variable-વાળા વાક્યનો distractor ખૂબ પૂછાય છે.

Theory

3 basic connectives

Compound statements simple statements માંથી connectives વાપરીને બને છે:

  • NOT (negation) ¬P: P ની truth value ને ઊંધી કરી નાખે
  • AND (conjunction) P ∧ Q: true ત્યારે જ જ્યારે બંને true હોય
  • OR (disjunction) P ∨ Q: true જ્યારે ઓછામાં ઓછું એક true હોય

Logic નું OR inclusive હોય છે: logic માં "tea or coffee" કહો તો બંને પણ ચાલે. બસ આ એક convention સમજી લો તો શરૂઆતની મોટા ભાગની confusion દૂર થઈ જાય.

Think first

P = "7 is odd" (true). Q = "7 is prime" (true). R = "7 is even" (false).

હવે આના truth values કાઢો: ¬R, P ∧ R, P ∨ R. પછી tap કરો.

Show the answer

¬R = T (false ને ઊંધું કરો તો true).

P ∧ R = F (AND ને બંને જોઈએ; R અહીં fail થાય છે).

P ∨ R = T (OR ને ફક્ત એક જોઈએ; P એ કામ કરી આપ્યું).

જુઓ કેટલું mechanical છે આ: કોઈ opinion નહીં, કોઈ context નહીં, ફક્ત truth values પર rules લગાવવાના. બસ આ mechanical nature ને લીધે જ computers logic કરી શકે છે.

Theory

બીજા 2: if-then, if-and-only-if

  • Implication P → Q: "if P then Q", દરેક rule ની અને દરેક if statement ની ભાષા આ જ છે. એ false ત્યારે જ થાય જ્યારે P થાય પણ Q ના થાય.
  • Biconditional P ↔ Q: "P if and only if Q", true ત્યારે જ જ્યારે P અને Q ની truth value સરખી હોય.

Example: "If it rains, the ground gets wet" એ implication છે; "you pass if and only if you score 40 or more" એ biconditional છે.

Quiz

"If you top the exam, I will buy you a phone." તમે exam માં top નથી કરતા, અને phone પણ નથી અપાયો. તો શું promise તૂટ્યું?

  1. હા, phone નથી આવ્યો
  2. ના, promise ફક્ત top કરવાના case ને લાગુ પડે છે
  3. નક્કી ના કરી શકાય
  4. આ વાક્ય proposition જ નથી
Show the answer

ના, promise ફક્ત top કરવાના case ને લાગુ પડે છે

Implication P → Q ત્યારે જ તૂટે જ્યારે P true હોય અને Q false હોય. અહીં P ("you top") false છે, એટલે પછી ગમે તે થાય, promise અકબંધ જ રહે છે. બરાબર આ જ વાત આગળના topic માં implication ના truth table ની એક row બની જાય છે, જ્યાં ઘણા students ગોથું ખાય છે.

Watch out

Classification ના traps

3 વાક્યો છે જે exam માં students ને છેતરી નાખે છે: "x + 1 = 5" (x fix ના થાય ત્યાં સુધી proposition નથી), "This statement is false" (એ તો paradox છે, ના true ના false, એટલે proposition નથી), અને fact ના રૂપમાં આવેલા opinions ("C is the best language"). જ્યારે classify કરવાનું કહે ત્યારે reason હંમેશા આપો: એની definite truth value છે, કે નથી.

Theory

આ ફરી ક્યાં મળશે

તમે જે પણ condition લખશો, જેમ કે if (marks >= 40 && attendance >= 75), એ P ∧ Q જ છે બસ C ના કપડાં પહેરીને, અને databases પણ WHERE clauses થી filter કરે છે જે AND, OR, NOT થી જ બને છે. આગળનો topic, truth tables, આજના connectives ને એક systematic calculation tool બનાવી દેશે, અને પછી Boolean algebra આ જ T અને F ને 1 અને 0 નું નામ આપી દેશે.

Summary

Key takeaways

  • Proposition એટલે એવું declarative વાક્ય જે true કે false, બેમાંથી બરાબર એક જ હોય.
  • Questions, commands, opinions, paradoxes અને variable વાળા open sentences, આ proposition નથી.
  • NOT ઊંધું કરે, AND ને બંને જોઈએ, OR (inclusive) ને ઓછામાં ઓછું એક જોઈએ.
  • P → Q ત્યારે જ fail થાય જ્યારે P true હોય અને Q false; P ↔ Q ત્યારે true જ્યારે બંને match થાય.
  • યાદ રાખવાની trick: truth value નહીં, તો proposition નહીં.

Study this properly

This page is the lesson to read. In Gri-Learn the same topic is a graded deck: the self-checks are scored and your weak topics are tracked. Free to start.

Start this topic

Already have an account? Sign in

More from Mathematical Logic

Gri-Learn · syllabus-mapped B.C.A. lessons in English, Hindi and Gujarati

Introduction to logic · Mathematics (Multi-Disciplinary Course) · Gri-Learn