Math/이산수학

[이산수학] 배타적 논리합 XOR |논리 연산자 XOR Exclusive OR(5/107)

토마토. 2021. 7. 20. 09:53

Logical Operators

- Exclusive OR XOR - 

 

0.

논리합disjunction을 앞 장에서 살펴보았다.

논리합은 교집합과 유사한 개념으로,

명제 p, q가 모두 false일 때만 논리합 p∨q가 false가 된다.

이들의 진리표는 다음과 같다.

p q p∨q
T T T
T F T
F T T
F F F

 

이와 같이, p∨q가 참인 경우에는

- p가 참이고 q가 참이 아닐 때

- p가 참이 아니고 q가 참일 때

- p, q가 모두 참일 때

세 가지 경우가 있다.

이는 inclusive OR에 해당한다.

 

1.

배타적 논리합

Exclusive OR operator

명제 p, q의 배타적 논리합은

p, q 둘중 하나가 참일 수는 있지만, 둘다 참일 수 없는 경우를 나타낸다.

 

배타적 논리합은 

⊕ 기호를 사용하여 표현하는데, 

명제 p와 q의 배타적 논리합 p⊕q는

p가 T, q가 F일 때 True

p가 F, q가 T일 때 True이지만,

p, q 가 모두 T일 때는 False이다.

 

4.

Homework Problem on logical operator

 

1)

coffee or Tea comes with dinner

-> XOR

 

2)

you can pay using US dollars or euros.

-> XOR

 

3)

dinner for two includes two items from column A or three items from column B

-> XOR

 

4)

a password must have at least three digits or be at least eight characters long.

-> Inclusive

 

5)

to take discrete mathmatics, you must have taken calculus or a course in computer science

-> Inclusive

 

<참고>

Logical Operators − Exclusive OR - YouTube