EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

8
EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN

Transcript of EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

Page 1: EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

EVALUATING BASIC LOGIC STATEMENTS

INTRO TO SYSTEM DESIGN

Page 2: EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

What is a Statement? • – a meaningful, declarative sentence that can

only be either true or false. Examples of sentences that are (or make) statements:

STATEMENT EVALUATES AS:"Socrates is a man." TRUE"A triangle has three sides." TRUE"Paris is the capital of Spain." FALSEx = 6 TRUE (only if there are 6 ‘x’s)

The first two (make statements that) are true, the third is (or makes a statement that is) false, the fourth is an evaluative statement (assigns a value).

Page 3: EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

There are only 2 possible logic states:

True = ON, HI, YES, CLOSED, NOT FALSE, any integer greater than 0

False = OFF, LO, NO, OPEN, NOT TRUE, zero

Page 4: EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

Not all sentences are statements…

Examples of sentences that are not (or do not make) statements:

"Who are you?""Run!""Greenness walks slowly.""I had one cucumber but the eggplant over there.""The King of France is wise.""Pegasus exists."

Page 5: EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

EXPRESSIONS:• Evaluating logical statements always occurs by

comparing 2 statements in an EXPRESSION:AND – the expression evaluates to TRUE only if both statements are TRUEOR – the expression evaluates to TRUE only if either statement is

TRUENAND – the expression evaluates to TRUE only if neither statement is TRUE (This is called an inverse statement)NOR – the expression evaluates to TRUE only if neither statement

is TRUENOT – the expression always evaluates as the OPPOSITE of the statement. This is not an evaluative or comparative statement. It is called a LOGIC INVERTER.

Page 6: EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

Truth Table

• A truth table is composed of one column for each input variable (for example, A and B), and one final column for all of the possible results of the logical operation that the table is meant to represent.

• Each row of the truth table contains one possible configuration of the input variables (for instance, A=true B=false), and the result of the operation for those values.

Page 7: EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

AND OR NANDINPUT OUTPUT INPUT OUTPUT INPUT OUTPUT

A B A AND B A B A AND B A B A AND B0 0 0 0 0 0 0 0 11 0 0 1 0 1 1 0 00 1 0 0 1 1 0 1 01 1 1 1 1 1 1 1 0

NOR NOTINPUT OUTPUT INPUT OUTPUT

A B A AND B A A0 0 1 0 11 0 0 1 00 1 01 1 0

Page 8: EVALUATING BASIC LOGIC STATEMENTS INTRO TO SYSTEM DESIGN.

Conditional Expressions

• the input conditions in the expression must be either TRUE or FALSE (depending on the expression) in order for the output condition to be evaluated as either TRUE or FALSE.

Conditional expressions are always written as IF (STATEMENT A) LOGICAL OPERATOR (STATEMENT B) THEN (OUTPUT)

REMEMBER: Statement A and Statement B can only be evaluated to TRUE or FALSE and the OUTPUT will only evaluate to TRUE or FALSE, depending on the operator.