1. Trang chủ
  2. » Giáo án - Bài giảng

101_Lecture 7 CS 1813 – Discrete Mathematics

12 148 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 12
Dung lượng 0,98 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Lecture 7CS 1813 – Discrete Mathematics Equational Reasoning Back to the Future: High-School Algebra... Laws of Boolean Algebrapage 1... Laws of Boolean Algebrapage 2... Equations the Pr

Trang 1

Lecture 7

CS 1813 – Discrete Mathematics

Equational Reasoning

Back to the Future: High-School Algebra

Trang 2

Some Laws of Algebra

 a + 0 = a {+ identity}

 (-a) + a = 0 {+ complement}

 a × 1 = a {× identity}

 a × 0 = 0 {× null}

 a + b = b + a {+ commutative}

 a + (b+c) = (a+b) + c {+ associative}

 a× (b+c) = a× b + a× c {distributive law}

Equations go both ways

Trang 3

Theorem (-1) × (-1) = 1

(-1) × (-1)

= ((-1) × (-1)) + 0 {+ id}

= ((-1) × (-1)) + ((-1) + 1) {+ comp}

= ( ((-1) × (-1)) + (-1) ) + 1 {+ assoc}

= (((-1) × (-1)) + (-1) × 1 ) + 1 { × id}

= ( (-1) × ((-1) + 1)) + 1 {dist law}

= ((-1) × 0 ) + 1 {+ comp}

= 0 + 1 { × null}

= 1 {+ id}

QED

proof by equational reasoning

Trang 4

Laws of Boolean Algebra

page 1

Trang 5

Laws of Boolean Algebra

page 2

Trang 6

Theorem (a False) (b True) =

b

equations {rule} substitution

[formula in eqn / variable in

rule]

(p ∧ False) ∨ (q ∧ True) names changed to clarify

substitutions

= False ∨ (q ∧ True) {∧ null} [p /a]

= (q ∧ True) ∨ False {∨ comm} [False /a] [q∧True /b]

= q ∧ True {∨ id} [q ∧ True /a]

Trang 7

Using Equational Proof Checker

import Stdm

th7 = (P `And` FALSE) `Or`

( Q `And` TRUE)

`thmEq` Q

pr7 =

startProof ((P `And` FALSE) `Or`

(Q `And` TRUE))

<-> (FALSE `Or` (Q `And` TRUE),

andNull)

<-> ((Q `And` TRUE) `Or` FALSE,

orComm) <-> (Q `And` TRUE, orID)

<-> (Q, andID)

Notepad window

Prelude> :cd DMf00

Prelude> :cd Lectures

Prelude> :load lecture07.hs

Reading file "lecture07.hs": Reading file "Stdm.lhs":

Reading file "lecture07.hs":

Hugs session for:

C:\HUGS98\lib\Prelude.hs Stdm.lhs

lecture07.hs Main> check_equation th7 pr7

The proof is correct

Hugs Session

Imp ortin

g

en

indic ate

s cm

d from

use r

Trang 8

Equations the Proof Checker

Knows

andNull

orNull

andID

orID

andIdempotent

orIdempotent

andComm

orComm

andAssoc

orAssoc

andDistOverOr

orDistOverAnd

deMorgansLawAnd deMorgansLawOr

negTrue negFalse andCompl orCompl dblNeg

currying implication contrapositive absurdity

Trang 9

Theorem (a b) b = b

absorption

equations {rule} substitution

[formula in eqn / variable in

rule]

(p ∧ q) ∨ q names changed to clarify

substitutions

= (p ∧ q) ∨ (q ∧ True ) {∧ id} [q /a]

= ( q ∧ p ) ∨ (q ∧ True) {∧ comm} [p /a] [q /b]

= q ∧ (p ∨ True) {∧ dist over ∨} [q /a] [True /b] [p /c]

= q ∧ True {∨ null} [p /a]

QED

Trang 10

Theorem (a b) b = b

absorption

equations {rule} substitution

[formula in eqn / variable in

rule]

(p ∨ q) ∧ q names changed to clarify

substitutions

… exercise …

= q

Trang 11

Consistent, But Not Minimal

redundancy among laws of Boolean

algebra

equations {rule} substitution

[formula in eqn / variable in rule]

p → q

= (¬p) ∨ q {imp} [p /a] [q /b]

= ¬(¬((¬p) ∨ q)) {dbl neg} [( ¬ p) ∨ q /a]

= ¬((¬(¬p)) ∧ (¬q)) {DeMorgan ∨ } [ ¬ p /a] [q /b]

= ¬(p ∧ (¬q)) {dbl neg} [p /a]

= (¬p) ∨ (¬(¬q)) {DeMorgan ∧} [p /a] [ ¬ q /b]

= (¬(¬q)) ∨ (¬p) { ∨ comm} [ ¬ p /a] [ ¬ ( ¬ (q)) /b]

= (¬q) → (¬p) {imp} [ ¬ q /a] [ ¬ p /b]

Deriving the contrapositive law

Theorem (contrapositive): a → b = ¬ b → ¬ a

A proof using laws other than the contrapositive law

t?

Trang 12

End of Lecture 7

Ngày đăng: 18/07/2017, 10:06

TỪ KHÓA LIÊN QUAN