{VERSION 4 0 "IBM INTEL NT" "4.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 2" -1 4 1 {CSTYLE "" -1 -1 "Times " 1 14 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 2 1 0 1 0 2 2 0 1 } {PSTYLE "Heading 3" -1 5 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 1 1 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Warning" -1 7 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 2 2 2 2 2 1 1 1 3 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Maple Output" -1 11 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 3 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 1 1 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {PARA 4 "" 0 "" {TEXT -1 31 "Module 7 : Discrete Mathematics" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 3 "" 0 "" {TEXT -1 26 "701 : Logic & Truth Tables" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT -1 17 "O B J E C T I V E" }} {PARA 0 "" 0 "" {TEXT -1 135 "We're going to use Maple to create truth tables for logical expressions. To do this we are going to define som e custom built functions." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT -1 9 "S E T U P" }} {PARA 0 "" 0 "" {TEXT -1 252 "In this project we will use the followin g command packages. Type and execute this line before begining the pro ject below. If you re-enter the worksheet for this project, be sure to re-execute this statement before jumping to any point in the workshee t." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "restart;; with(plots):" }} {PARA 7 "" 1 "" {TEXT -1 50 "Warning, the name changecoords has been r edefined\n" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 83 "_____________________________________________________________________ ______________" }}{PARA 4 "" 0 "" {TEXT -1 26 "A. Propositions and Tab les" }}{PARA 0 "" 0 "" {TEXT -1 83 "__________________________________ _________________________________________________" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 187 "These will be the logical prop ositions. They are essential binary valued functions which will help g enerate the full range of possible coombinations of true and false in \+ our truth tables." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 79 "Here is table of all of the possible permutgations of val ues for p, g, r, and s" }}{PARA 0 "" 0 "" {TEXT -1 54 "A := array( [[ \+ p(k), q(k), r(k), s(k)] $ k = 0..15] );" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "p := x -> irem(x, 2):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "q := x -> irem( iquo(x, 2 ),2 ):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "r := x -> irem( i quo(x, 4),2 ):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "s := x -> irem( iquo(x, 8),2 ):" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 335 "We are using number for logical value - 0 for false and 1 for true. In this way we create a binary table which is equival ent to a truth table. The first column has the values of p, the second column has the values of q, and so forth. Note that each row has a un ique pattern of 0's and 1's that is not exactly the same as any other \+ row." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 53 "A := array( [[ p(k), q(k), r(k), s(k)] $ k = 0..15]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#> %\"AG-%'matrixG6#727&\"\"!F*F*F*7&\"\"\"F*F*F*7&F*F,F*F*7&F,F,F*F*7&F* F*F,F*7&F,F*F,F*7&F*F,F,F*7&F,F,F,F*7&F*F*F*F,7&F,F*F*F,7&F*F,F*F,7&F, F,F*F,7&F*F*F,F,7&F,F*F,F,7&F*F,F,F,7&F,F,F,F," }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 245 "With numbers we can see \+ the patterns easier and its also easier to use numeric functions to co mpute the result. If you would like to see a customary truth table you can copy and paste the following instruction after each binary table \+ is created." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 229 "Truth_Table := A:\nfor i from 1 to linalg[rowdim]( A) do\nfor j from 1 to linalg[coldim](A) do\nif( A[i,j] =1) then Tr uth_Table[i,j] := 'True';\n else Truth_Table[i,j] := ' False';\nfi; od; od; evalm(Truth_Table); " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'matrixG6#727&%&FalseGF(F(F(7&%%TrueGF(F(F(7&F(F*F(F( 7&F*F*F(F(7&F(F(F*F(7&F*F(F*F(7&F(F*F*F(7&F*F*F*F(7&F(F(F(F*7&F*F(F(F* 7&F(F*F(F*7&F*F*F(F*7&F(F(F*F*7&F*F(F*F*7&F(F*F*F*7&F*F*F*F*" }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 365 "This wil l create a table with \"True\" and \"False\" in place of 0's and 1's. \+ If you prefer to see \"T\" and \"F\", you can change True to T and Fal se to F in the commands above. For the remainder of this project we wi ll create binary tables. Again, you can copy and paste the commands ab ove after the creation of any binary table below to convert it to a tr ue Truth Table." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 83 "_______________________________________________________________ ____________________" }}{PARA 4 "" 0 "" {TEXT -1 26 "B. Negations and \+ Connetors" }}{PARA 0 "" 0 "" {TEXT -1 83 "____________________________ _______________________________________________________" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 111 "We will also define thes e special functions to perform logical operations. Make sure to capita lize these names." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "NOT := x -> irem ( x + 1, 2):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "AND := (x,y) -> irem ( x*y, 2):" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "OR := (x,y) -> max( x, y): " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "XOR := (x,y) -> irem( x + y,2):" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 159 "The negation operator, NOT, converts a logical expression to its \+ opposite : true to false, and false to true. Here is a table showing p , q, not(p), and not(q)." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 96 "Note that the first and third columns are opposite and so are the second and the fourth columns." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 63 "A := array( \+ [[p(k), q(k), NOT(p(k)), NOT(q(k)) ] $ k = 0..3] );" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#>%\"AG-%'matrixG6#7&7&\"\"!F*\"\"\"F+7&F+F*F*F+7&F*F+ F+F*7&F+F+F*F*" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 82 "The connectives AND, OR, and XOR combine two logical prop ositions in various ways." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 117 "Note that we are converting these logical stateme nts into a functioin like notatioin to evaluate in the truth tables." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 256 3 "AND" } {TEXT -1 75 " : p and q = AND(p, q) is true only if bot h p and q are true" }}{PARA 0 "" 0 "" {TEXT 258 6 "OR " }{TEXT -1 76 ": p or q = OR(p,q) is true if either p or q or both are true." }}{PARA 0 "" 0 "" {TEXT 257 12 "Exclusive Or" }{TEXT -1 69 ": p xor q = XOR(p, q) is true only if p or q but not both are t rue" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 68 "Lets see what the truth table looks like for these three connectives" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 149 "The first column has the values of p. The seco nd column has the values of q. The next columns have the values of (p \+ and q), (p or q) , and (p xor q)." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 83 "A := array( [[p(k), q(k), AND(p(k),q(k)), OR(p(k)),XO R(p(k), q(k)) ] $ k = 0..3] );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\" AG-%'matrixG6#7&7'\"\"!F*F*F*F*7'\"\"\"F*F*F,F,7'F*F,F*F*F,7'F,F,F,F,F *" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 5 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 83 "_________ ______________________________________________________________________ ____" }}{PARA 4 "" 0 "" {TEXT -1 50 "C. Using Truth Table To Test Logi cal Equivalencies" }}{PARA 0 "" 0 "" {TEXT -1 83 "____________________ _______________________________________________________________" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 90 "One of the main values of truth tables is to test if two logical statements are equiv alent" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 158 "Lets test the proposition : not( p or q) = not(p) and not(q). We conv ert the left and right sides of this equation into the function notati on we defined above" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 " " {TEXT -1 148 "Since the two columns are exactly the same, the propos ition is true. This is the abbreviated from of the truth table just sh owing the final results." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 82 "A := array( [[ NOT( OR(p(k), q(k) ),AND( NOT(p(k)), NOT(q(k)) ) ) ] $ k = 0..3] );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'matrixG6# 7&7#\"\"\"7#\"\"!F+F+" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 149 "You can also include the original propositions and \+ intermediate steps. This makes it easier to see everything which contr ibutes to the final results." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 149 "The columns are p, q, (p or q), not( p or q), \+ not(p) , and not(p)and not(q). To test the equivalency note that the 4 th and 8th columns are identical." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 130 "A := array( [[p(k), q(k), OR(p(k), q(k)), NOT( OR(p(k), q(k) )), \+ NOT(p(k)), NOT(q(k)), AND( NOT(p(k)), NOT(q(k))) ] $ k = 0..3] );" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'matrixG6#7&7)\"\"!F*F*\"\"\"F +F+F+7)F+F*F+F*F*F+F*7)F*F+F+F*F+F*F*7)F+F+F+F*F*F*F*" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 83 "_________________________________________________________ __________________________" }}{PARA 4 "" 0 "" {TEXT -1 50 "D. Using Tr uth Tables To Test Logical Implications" }}{PARA 0 "" 0 "" {TEXT -1 83 "__________________________________________________________________ _________________" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 197 "An implication is writte n either in words : if p then q, or symbolically, p -> q. A biconditio nal is written p if and only if q, or p <-> q. We can define an implic ation and biconditional function." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "IF_THEN := (x,y) -> OR (NOT( x), y):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "IF_ONLYIF := (x, y) -> NOT( XOR(x,y) ):" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 47 "We can create a truth table for the implication" }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 64 "A := array( [ [p(k), q(k), IF_THEN( p(k), q(k)) ] $ k = 0..3] );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'matrixG6#7&7%\"\"!F*\"\"\"7 %F+F*F*7%F*F+F+7%F+F+F+" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT -1 122 "How does the converse (if q then p) compare to th e original implication (if p then q)? Are they the logically equivale nt?" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 79 "Yo u can see they are different! This means they are not logically equi valent." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 75 "A := array( [[ IF_THEN( p(k), q(k) ), IF_THEN( q(k), \+ p(k)) ] $ k = 0..3] );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'mat rixG6#7&7$\"\"\"F*7$\"\"!F*7$F*F,F)" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 113 "How does the contrapositive (if not(a) then not(p)) compare to the origival implication? Are they the equiva lent?" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 29 " These are logically the same." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 80 "A := array( [[ IF_THEN( p(k) , q(k) ), IF_THEN( q(k), NOT(p(k))) ] $ k = 0..3] );" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'matrixG6#7&7$\"\"\"F*7$\"\"!F*F)7$F*F," }}} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 1 " " }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 83 "_________ ______________________________________________________________________ ____" }}{PARA 4 "" 0 "" {TEXT -1 37 "E. Maple's Built - In Logic Funct ions" }}{PARA 0 "" 0 "" {TEXT -1 83 "_________________________________ __________________________________________________" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 105 "Maple also has logic features built in which allow us to test \+ the validity of logical equations directly." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 129 "Here we use logical functions, and define two logical statements A and B. evalb() is used to evaluat e an expression as a Boolean." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "A := not(p or q);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG45%\"pG%\"qG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "B := not(p) and not(q);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"BG45%\"pG%\"qG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "evalb(A = B);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%%tr ueG" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 122 " The evalb() command is used to test if the two statements are equivale nt logically. Here are two more examples from above." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "A := not( \+ p or q);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG45%\"pG%\"qG" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "B := not( p) and not( q);" } }{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"BG45%\"pG%\"qG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalb(A=B);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%%trueG" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "A := p or not(q);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG5%\"pG4%\"qG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "B := not(p) and q;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"BG34%\"pG% \"qG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalb(A=B);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%&falseG" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 30 "A := ( a and b) or ( \+ c and d);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG53%\"aG%\"bG3%\"cG% \"dG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "B := ( a or b) and \+ ( c or d);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"BG35%\"aG%\"bG5%\"cG %\"dG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "evalb(A=B);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#%&falseG" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 5 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 83 "________________________________________ ___________________________________________" }}{PARA 4 "" 0 "" {TEXT -1 29 "F. Built - In Logic Functions" }}{PARA 0 "" 0 "" {TEXT -1 83 "_ ______________________________________________________________________ ____________" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 555 "Above, when we considered logi cal expressions, we are not assuming that the propositions p and q hav e any particular values. In fact we want to make sure that two stateme nts using p and q are the same for all combinations of values of p and q. In other cases, we might have propositions which are assigned valu es and want to be able to work with them. You could make an analogy to algebra where you might work with variables wuch as x and y without h aving any particular value, while at other times you might need to plu g in particular values for x and y," }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 69 "We can d efine variables to have logical values such as true or false." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "a := true; b:= false;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"aG %%trueG" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"bG%&falseG" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 40 "This can also be \+ done in an implied way." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 99 "In this case, 5 is not greater than 9, so a is false , but 5 is indeed greater than 1, so b is true." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "a := (5 > 9) ; b:= (5 > 1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"aG2\"\"*\"\"& " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"bG2\"\"\"\"\"&" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 50 "We can evaluate thre e boolean variables using the " }{TEXT 259 5 "evalb" }{TEXT -1 9 " com mand." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalb(a);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%&falseG " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "evalb(b);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#%%trueG" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 104 "We can also evaluate boolean expressions . We can use the same operators and connectives ( not, or, and)." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 4 "The " } {TEXT 260 5 "evalb" }{TEXT -1 107 " command evaluates the expression a s a boolean (logical) expression and 'computes' a value of true or fal se" }}{PARA 0 "" 0 "" {TEXT -1 1 "." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "evalb( not(a));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%% trueG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "evalf( a or b);" } }{PARA 11 "" 1 "" {XPPMATH 20 "6#%%trueG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "evalf(a and b);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%& falseG" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{MARK "4 0" 1 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }