2013 Logic & proofs BY:Nauf Almarwani Chapter 1 Introduction to Discrete Mathematics #Discrete Mathematics: is the part of mathematics devoted to the study of discrete objects. . هو الجزء من الرياضيات المكرسة لدراسة الكائنات منفصلة:الرياضيات المتقطعة #Mathematical Logic: is a tool for working with elaborate compound statements. .المنطق الرياضي هو أداة للعمل مع وضع البيانات المركبه #Propositional Logic: is the logic of compound statements built from simpler statements using so-called Boolean connectives. . هو منطق من البيانات المركبه بنيت من بيانات أبسط باستخدام ما يسمى أدوات الوصل المنطقية:منطق اقتراحي 1.1 Propositional Logic: A proposition: is a declarative sentence (that is, a sentence that declares a fact) that is either true or false, but not both. . ولكن ليس االثنين معا، هو الجملة البيانيه (الجملة التي تعلن حقيقة) التي هي إما صحيحة أو خاطئة:االقتراح EXAMPLE 1: All the following declarative sentences are propositions. 1 . Washington, D.C., is the capital of the United States of America. (T) 2 . Toronto is the capital of Canada. (F) 3 . 1 + 1 = 2 . (T) 4. 2 + 2 = 3 . (F) Command and questions are not propositions .االوامر واألسئلة ليست مقترحات EXAMPLE 2: Consider the following sentences. 1 . What time is it? 2 . Read this carefully. 3.x+1=2. 4 . x + y = Z. في المثال االول اعطانا جمل بيانيه فحددنا هي صائبه ام خاطئه . وهي صح2=1+1 -3 مثال رقم في المثال الثاني اعطانا اسئله و اوامر وليس جمل بيانيه . فما نقدر نحدد هيا صح او غلط we use letters to denote propositional variables (or statement variables) .نستخدم الحروف للداللة على متغيرات اقتراحيه او متغيرات بيانيه A proposition: (denoted p, q, r, …) is simply:a statement (i.s., a declarative sentence) .) وهي جمله بيانيهp,q.,r( نرمز لالقتراح بالرمز The area of logic that deals with propositions is called the propositional calculus or propositional logic. وتسمى منطقة المنطق الذي تتعامل مع المقترحات حساب التفاضل والتكامل االقتراحيه أو المنطق االقتراحي *Some Popular Boolean Operators. Formal Name Negation operator Conjunction operator Disjunction operator Exclusive-OR operator Implication operator Biconditional operator Nickname NOT AND OR XOR IMPLIES IFF Arity Unary Binary Binary Binary Binary Binary Symbol ¬ ↔ DEFINITION 1 Let p be a proposition. The negation of p, denoted by⌐p (also denoted by −p), is the statement. "It is not the case that p." The proposition ⌐p is read "not p" The truth value of the negation of p, ⌐p, is the opposite of the truth value of p. . اقتراحp لنجعل –p ⌐ او نرمز له بالرمزp هوp نفي p ويقرا ليس p هي عكس القيمه الحقيقيه لp القيمه الحقيقيه للنفي EXAMPLE 3 Find the negation of the proposition "Today is Friday." Solution: "Today is not Friday," or "It is not Friday today." المثال الثالث اليوم الجمعه:طلب نفي الجمله "ببساطه الحل "اليوم ليس الجمعه The truth table p T F p F T DEFINITION 2 Let p and q be propositions. The conjunction of p and q, denoted by pq, is the proposition "p and q" The conjunction p q is true when both p and q are true and is false otherwise.. q وp لنجعل مقترحين لجمع المقترحين معا نرمز له بالرمز اذا كان جميعهما صائب فيكون الناتج صائب لو كان واحد منهم خاطئ جميعها خاطئ The truth table p F F T T EXAMPLE 5: Find the conjunction of the propositions p and q where p is the proposition "Today is Friday" and q is the proposition "It is raining today." p T T F F q T F T F pq T F F F p F F T T q F T F T q F T F T pq F F F T pq F F F T The truth table DEFINITION 3 Let p and q be propositions. The disjunction of p and q, denoted by p V q, is the proposition "p or q ." The disjunction p V q is false when both p and q are false and is true otherwise. مقترحينq وp لنجعل لنفصل المقترحين لو كان واحد من القيم صائب كلها صائب لو كانت كلها خاطئه اذن خاطئ EXAMPLE 6: Find the Disjunction of the propositions p and q where p is the proposition "Today is Friday" and q is the proposition "It is raining today." p T q T pq T p F F T T q F T F T pq F T T T T F F F T F T T F The truth table DEFINITION 4 Let p and q be propositions. The exclusive or of p and q, denoted by pq, is the proposition that is true when exactly one of p and q is true and is false otherwise. مقترحينq وp لنجعل االستثناء للمقترحين اذا كان فقط واحد منهم صائب لو كان االثنين خاطئ او صائب اذا خاطئ Conditional Statements: p F F T T q pq F F T T F T T F The truth table DEFINITION 5 Let p and q be propositions. مقترحينq وp لنجعل The conditional statement p العباره الشرطيه لهم q is the proposition "if p, q اذاp اذا then q ." العباره الشرطيه تكون خاطئه فقط اذا The conditional statement p خاطئ والبقية صائبp كان q is false when p is true and تسمى فرضيهp في العباره الشرطيه q is false, and true otherwise. . تسمى النتيجهqو In the conditional statement p q , p is called the hypothesis (or antecedent or premise) and q is called the conclusion (or consequence). p F F T T q pq F T T T F F T T EXAMPLE 7: Let p be the statement "Maria learns discrete mathematics" and q the statement "Maria will find a good job." Express the statement p q as a statement in English. p q pq T T T 7 مثال T F T F T F يطلب العباره الشرطيه F F T الجمل هي اذا "ماري تعلمت الرياضيات المنفصله" اذا ""بتالقي وظيفه جيده كل االحتماالت صحيحه لكن لو ماتعلمت الرياضيات م "بتالقي اي وظيفه جيده EXAMPLE 8 What is the value of the variable x after the statement if 2 + 2 = 4 then x := x + 1 Solution: Because 2 + 2 = 4 is true, the assignment statement x := x + 1 is executed. Hence, x has the value 0 + 1 = 1 after this statement is encountered. 8 في المثال #English Phrases Meaning p q اعطانا قيمة االول صحيحه والثانيه نعوض طبعا • “p implies q” م بنقول القيمه خاطئه الن االولى صائبه اذا • “if p, then q” الجميع صائب • “if p, q” • “when p, q” • “whenever p, q” • “q if p” • “q when p” • “q whenever p” • “p only if q” • “p is sufficient for q” • “q is necessary for p” • “q follows from p” • “q is implied by p” We will see some equivalent logic expressions later. Converse, Inverse, Contrapositive Its converse Its inverse Its contrapositive q p ¬p ¬q ¬q ¬ p EXAMPLE 9 What are the contrapositive, the converse, and the inverse of the conditional statement "The home team wins whenever it is raining."? Whenever = pq So "If it is raining, then the home team wins." are the contrapositive the converse the inverse "If the home team "If the home team "If it is not raining, does not win, then wins, then it is then the home team it is not raining." raining." does not win." The truth table DEFINITION 6 Let p and q be propositions. The biconditional statement p ↔ مقترحين عبارتينq وp لنجعل q is the proposition "p if and شرطيتين only if q ." The biconditional اذا واذا فقط تكون صائبه statement p ↔ q is true when p اذا جميعهما صائب او جميعهما and q have the same truth .خاطئ values, and is false otherwise. Biconditional statements are also called bi-implications. p F F T T q F T F T EXAMPLE 10 Let p be the statement "You can take the flight" and let q be the statement "You buy a ticket." p q T F F T Then p ↔ q is the statement P q "You can take "You buy a the flight" ticket." T T T F F T F F p ↔ q T F F T Truth Tables of Compound Propositions: البيانات المركبه من الجداول مقترحه Construct the truth table of the compound proposition (p ⌐q) (p q). p Q ⌐q p ⌐q p q (p ⌐q) (p q) T T F T T T T F T T F F F T F F F T F F T T F F Precedence of Logical Operators : أسبقية العوامل المنطقية Operator Precedence ⌐ ↔ 1 2 3 4 5 Translating English Sentences: EXAMPLE 12 How can this English sentence be translated into a logical expression? "You can access the Internet from campus only if you are a computer science major or you are not a freshman." نقسم الكالم اول شي You can access the Internet from P (q⌐r) campus= P يعني يمكنك الوصول الى االنترنت من الجامعه only if you= you are a computer science major= q اذا كنت عالم كمبيوتر Or = are not a freshman= ⌐r اذا كنت غير مبتدئ EXAMPLE 13 How can this English sentence be translated into a logical expression? "You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old." p ⌐q⌐r System Specifications: EXAMPLE 14 Express the specification "The automated reply cannot be sent when the file system is full" using logical connectives. p⌐q Boolean Searches: p q pq pq pq pq p↔q ⌐p T T T T F T T F T F F T T F F F F T F T T T F T F F F F F T T T Logic and Bit Operations Truth Value Bit 1 T 0 F A bit string is a sequence of zero or more bits. The length of this string is the number of bits in the string. طول هذه السلسلة هو عدد.سلسلة بت هو سلسلة من صفر أو أكثر من البتات .البتات في السلسلة EXAMPLE 21 Find the bitwise OR, bitwise AND, and bitwise XOR of the bit strings 0 1 1 0 1 1 0 1 1 0 and 1 1 000 1 1 1 0 1 . (Here, and throughout this book, bit strings will be split into blocks of four bits to make them easier to read.) 0110110110 1100011101 OR 1110111111 AND 0100010100 XOR 1010101011 1.2 Propositional Equivalence: اقتراح التكافؤ A compound proposition that is always true, no matter what the truth values of the propositions that occur in it, is called a tautology. A compound proposition that is always false is called a contradiction. A compound proposition that is neither a tautology nor a contradiction is called a contingency. التقرير المركب هو دائما صحيح بغض النظر عن القيم الحقيقة من المقترحات التي تحدث فيه يسمى تكرار الكلمه ويطلق . ويطلق على اقتراح المركب الذي ليس تكرار وال تناقض احتمال.على اقتراح المركب الذي هو دائما كاذب تناقض 1- tautology: p ⌐p كل قيمه صائبه وقانونه P T F ⌐p F T p ⌐p T T 2- contradiction: P⌐P كل قيمه خاطئه وقانونه P T F 3- Contingency: pq # De Morgan's Laws ⌐ (pq) ⌐p ⌐q ⌐(pq) ⌐p⌐q ⌐p F T p ⌐p F F #Logical Equivalences: The compound propositions p and q are called logically equivalent if p ↔ q is a tautology. The notation p q denotes that p and q are logically equivalent. التقرير المنطقي يسمى التكافئ المنطقي اذا واذا فقط كان صائب The symbol is not a logical connective and p q is not a compound proposition ليس تقرير مركبp q ليس رابط منطقي الرمز but rather is the statement that p ↔ q is a tautology صائبp ↔ qالتقرير The symbol ↔ is sometimes used instead of to denote logical equivalence. .. للدالله على التكافؤ المنطقي الرمز↔ احيانا يستخدم بدل EXAMPLE 2 Show that ⌐(pq ) and ⌐p⌐q are logically equivalent. في السؤال اعطانا رمزين وبيقول هل هما متكافئين منطقيا؟ نرسم جدول p q pq ⌐(pq ) ⌐p ⌐q ⌐p⌐q T T F F T F T F T T T F F F F T F F T T F T F T F F F T EXAMPLE 3: Show that p q and ⌐p q are logically equivalent ? p T T F F Q T F T F pq T F T T ⌐p F F T T ⌐pq T F T T EXAMPLE 4: Show that p(qr) and (p q) (p r) are logically equivalent. This is the distributive law of disjunction over conjunction? 8=23 =هنا اعطانا ثالث قيم p q r qr p(qr) (p q) (p r) (p q) (p r) T T T T T T T T T T F F T T T T T F T F T T T T T F F F F F T T F F F T F T F F T F F F T T F F F T T T F F T T F T F T T F F F Logical Equivalences: المكافئات المنطقية name Identity laws Domination Idempotent Double laws negation laws law Commutative laws equivalence p T p p F p p p p p q q p p F p p T p p p p name Associative Distributive laws laws equivalence (p q) r p(q r) (p q) r p (q r) p (q r) (p q) (p r) p (q r) (p q) (p r) De Morgan's laws ⌐(p q) ⌐p ⌐q ⌐(p q) ⌐p ⌐q ⌐(⌐p) p p q q p Absorption Negation laws laws P (p q) p p (p q) p p ⌐p T p ⌐p F Logical Equivalences Involving Conditional Statements المكافئات المنطقية التي تنطوي على البيانات الشرطيه p q ⌐p q p q ⌐q ⌐p p q ⌐p q p q ⌐(p ⌐ q) ⌐ (p q) P ⌐q (p q) (p r) p (q r) (p r ) (q r) (p q) r (p q) (p r) p (q r ) (p r) (q r) (p q) r Logical Equivalences Involving Biconditionals: P ↔ q (p q) (q p) P ↔ q ⌐p ↔ ⌐q P ↔ q (p q) (⌐p ⌐q) ⌐ (p ↔ q) P ↔ ⌐q Using De Morgan's Laws: EXAMPLE 5 Use De Morgan's laws to express the negations of "Migue1 has a cellphone and he has a laptop computer" and "Heather will go to the concert or Steve will go to the concert." p= "Migue1 has a cellphone" q=" has a laptop computer" اول شيء طالب النفي (pq)=⌐ (pq) = ⌐p ⌐q (De Morgan's laws) r ="Heather will go to the concert" s= "Steve will go to the concert." OR بينهم (rs)=⌐ (rs)= ⌐r ⌐s (De Morgan's laws) #Constructing New Logical Equivalences: انشاء متكافئات منطقية جديده هنا ممكن ننشئ قوانين من قوانين EXAMPLE 6 Show that ⌐ ( p q) and p ⌐q are logically equivalent. طالب مننا دليل على انها متساويه منطقيا نأخذ الطرف االول ⌐ ( p q) ⌐(⌐pq) اثبتنا انها متساويه في التمرين الثالث ⌐(⌐p)⌐q (De Morgan's laws) p ⌐q Double negation law EXAMPLE 7 Show that ⌐(p ( ⌐ p q)) and ⌐p ⌐q are logically equivalent by developing a series of logical equivalences. ⌐(p ( ⌐ p q)) ⌐p⌐(⌐pq) by the second De Morgan law ⌐p [ ⌐ ( ⌐ p ) ⌐ q ] by the first De Morgan law ⌐p(p⌐q) by the double negation law (⌐pp) (⌐p ⌐q) by the second distributive law F (⌐p ⌐q) because (⌐pp) F (⌐p ⌐q) F by the commutative law for disjunction (⌐p ⌐q) by the identity law for F ⌐(p ( ⌐ p q)) ⌐p ⌐q EXAMPLE 8 Show that (p q) (p q) is a tautology? (p q) (p q) ⌐(p q) (p q) (⌐p ⌐q) (p q) by the first De Morgan law (⌐p p) (⌐q q) by the associative and commutative laws for disjunction T T by Example I and the commutative law for disjunction T by the domination law 1.3 Predicates and Quantifiers الخبر والكميه 1- Predicates: Statements involving variables, such as "x > 3 , " "x = y + 3," "x + y = z," "computer x is under attack by an intruder," and "computer x is functioning properly," These statements are neither true nor false when the values of the variables are not specified. EXAMPLE 1: Let P(x) denote the statement "x > 3." What are the truth values of P (4) and P (2)? صحيحه في المعادلهX المطلوب هنا متى تكون قيمة X>3 4 ,2 وهماX طبعا اعطانا قيمتين ل : نعوض 4>3…..TRUE 2>3…..FALSE : بيانات تشمل متغيرات مثل: الخبر X>3 )variable( متغيرX )Predicates( > الخبر3 : مثال . تعرض لفايروس من قبل متسللx الكمبيوتر . يعمل بشكل صحيحx و الكمبيوتر هذه البيانات ليست صحيحه وال خاطئه لماذا؟ بسبب انه اليوجد له قيمه محدده ) مجهولx( يعني : عرفنا ان X is a variable > 3 is a Predicates نقول أن "x is greater than 3" by P (x) the value of the propositional function P at x هو الخبر3 و اكبر منX باختصار عندنا متغير 3 اكبر من الX لمن نقول ان ال X فيP تعني قيمه الداله المقترحهP (X) نختصرها ب P = Predicates EXAMPLE 2: Let A (x) denote the statement "Computer x is under attack by an intruder." Suppose that of the computers on campus, only CS2 and MATH 1 are currently under attack by intruders. What are truth values of A (CS l), A(CS2), and A(MATH l )? : شرح السؤال تعرض للهجوم من قبل متسللX = الكمبيوترA (x) ( فقطMATH 1) ( وCS2) االجهزه التي تعرضت للهجوم في الجامعه هي ؟؟A(CS l), A(CS2), A(MATH l ) ما هي القيم الحقيقة: المطلوب : الحل A (CS2) and A (MATH l ) are true ... طبعا هما جهازين تعرضو للهجوم A (CS I ) is false .... الجهاز الثالث ليس مذكور انه تعرض للجوم EXAMPLE 3: Let Q (x , y) denote the statement "x = y + 3 ." What are the truth values of the propositions Q(1 , 2) and Q(3, O)? x = y + 3 : اول شي عندنا المعادله X , Y نعوض بقيمة Q(1 , 2) مرا بـ Q(3, O) ومرا بـ x = y +3 1 = 2+3 >>> FALSE .. x = y +3 3 = 0 + 3>>> TRUE A statement of the form P (XI, X2, • • . , Xn) is the value of the propositional function P at the n-tuple (Xl, X2, . • • , xn), and P is also called a n -place predicate or a n-ary predicate. the n-tuple (Xl, X2, . • • , xn), فيP هو قيمة الدالة المقترحهP (XI, X2, • • . , Xn) البيانات التي بصورة a n-ary predicate اوn -place predicate ويسمى أيضا 2- Quantifiers When the variables in a propositional function are assigned values, the resulting statement becomes a proposition with a certain truth value. . عندما تكون المتغيرات بقيم حقيقيه تكون النتيجه مقترحه مع بعض القيم الصحيحه quantification, to create a proposition from a propositional function. Quantification expresses the extent to which a predicate is true over a range of elements. In English, the words all, some, many, none, and few are used in quantifications . انشاء مقترح من داله مقترحه: التقدير الكمي .. التقدير الكمي يعبر عن مدى صحة الخبر من مجموعة العناصر .. وقليلة تستخدم لتقدير الكميه، ال شيء، كثير، بعض، كل.. الكلمات،في اللغة اإلنجليزية two types of quantification نوعين من التقدير الكمي universal quantification existential quantification تقدير عالمي تقدير وجودي which tells us that a predicate is which tells us that there is one or true for every element under more element under consideration consideration for which the predicate is true. يعني انه يوجد واحد او اكثر من العناصر صحيح يعني ان جميع خبر العناصر هو صحيح The area of logic that deals with predicates and quantifiers is called the predicate calculus منطقة المنطق التي تتعامل مع الخبر والتقدير الكمي تسمى حساب التفاضل والتكامل ---------------------------------------------------------------------------------------------------------------: معلومه مهمه X محدد قيمDOMAIN الزم نعرف انه البد من وجود مجالuniversal quantificationفي ال 1- The universal quantification of P (x) is the statement "P(x) for all values of x in the domain." . في المجالx لجميع قيمP(x) The notation x P (x) denotes the universal quantification of P(x). داللة على التقدير الكمي العالميx P (x) الرمز is called the universal quantifier.. . يسمى محدد الكمية العالمي We read x P(x) as "for all x P(x)" or "for every x P(x )." لكل... نقرأ An element for which P(x) is false is called a counterexample of x P (x). خاطئ نسميه ب العنصر المضاد لكل عناصر المجالP(x) عندما يكون عنصر EXAMPLE 8: Let P (x) be the statement "x + 1 > x." What i s the truth value of the quantification x P(x), where the domain consists of all real numbers? Because P (x) is true for all real numbers x, the quantification x P (x) is true. بجميع االرقام الحقيقه ستكون القيمه صحيحهx + 1 > x يعني لو عوضنا Quantifiers 9 مثال لو اخذنا الرقم 9 وهي اكبر من10=1+9 اذا9 + 1 > 9 اذا صحيحه Statement x P(x) When True? P(x) is true for every x. ᴟx P(x) There is an x for which P(x) is true. When False? There is an x for which P(x) is false. P (x) is false for every x. EXAMPLE 9 Let Q(x) be the statement "x < 2." What is the truth value of the quantification x Q (x), where the domain consists of all real numbers? لو عوضنا هنا بجميع االرقام الحقيقه نبدأ مثال من الصفر x<2 0<2….true 1<2…true 2<2…false 3<2….false x Q(x) اذا is false. DEFINITION 2 The existential quantification of P(x) is the proposition "There exists an element x in the domain such that P (x )." P(x) هو مقترح "يوجد عنصر في المجالP(x) العنصر الوجودي ل We use the notation ᴲx P(x) for the existential quantification of P(x). Here ᴲ is called the existential quantifier. . ويسمى محدد الكمية الوجوديP(x) للتقدير الوجودي للᴲ نستخدم الرمز EXAMPLE 14 Let P (x) denote the statement "x > 3 ." What is the truth value of the quantification ᴲx P (x), where the domain consists of all real numbers? EXAMPLE 15: هنا طال مننا نطلع العنصر الوجودي x > 3 اعطانا x=4 لو عوضنا صحيحهx > 4 اذن وبما ان عنصر واحد صحيح نقول ᴲx P (x), is true. Let Q(x) denote the statement "x = x + 1 ." What is the truth value of the quantification ᴲx Q(x), where the domain consists of all real numbers? هنا طلب مننا نعوض بجميع االرقام الحقيقه x=x+1 خطأ0 = 0 + 1 لو قلنا ولو عوضنا بجميع االرقام تكون جميعها خاطئه ᴲx Q(x), is false اذا نقول . Translating from English into Logical Expressions Express the statement "Every student in this class has studied calculus" using predicates and quantifiers? Page 42
© Copyright 2025 Paperzz