<<

Lecture 3 CS 1813 – Discrete Mathematics

Truth Inference and the Logical Way

CS 1813 Discrete Mathematics, Univ Oklahoma 1 Copyright © 2000 by Rex Page Logical Inference

‰Inference (courtesy of Merriam-Webster) ƒ verb - the act of passing from one proposition, statement, or judgment considered as true to another whose truth is believed to follow from that of the former ƒ noun – a proposition arrived at by inferring ‰Formal Inference () ƒ Object Language – notation for stating premises and conclusions 9 WFFs form the object language ƒ Inference Rules – ways to conclude new WFFs from proven WFFs ƒ Metalanguage – notation for proofs of ƒ Formal Inference (Proof) – a set of assumptions together with an ordered collection of inference rules applied to reach a conclusion ƒ () – a set of assumptions and a conclusion for which there is a formal inference (that is, a proof)

CS 1813 Discrete Mathematics, Univ Oklahoma 2 Copyright © 2000 by Rex Page Theorem Theorem – a statement that can be proved

w1, w2, …, wn w

premises (WFFs) conclusion (WFF) turnstile Meaning of turnstile: If the premises are true, then there is a path through the rules of inference that leads to the conclusion Fact – a statement that is true cts (whether provable or not) ⊂ Fa s w , w , …, w w ms orem 1 2 n heore n the T cus o cts ill fo re fa e w n me W r tha rathe CS 1813 Discrete Mathematics, Univ Oklahoma 3 Copyright © 2000 by Rex Page Premises Rules of Inference (already proven) name of rule

Conclusion (inferred) Springer, 2000 Can be uter any WFF p

Proof goes here atics with a Com ll/O’Donnell a ƒ Metavariables in rules stand for WFFs

ƒ in rules stand for proofs Fig 2.1, H Discrete Mathem ƒ Rule says: infer conclusion (bottom) if top (premises) has been proven — applying a rule is proves a theorem CS 1813 Discrete Mathematics, Univ Oklahoma 4 Copyright © 2000 by Rex Page Theorem and Proof ‰Theorem (∧ Commutes) OK to reuse assumption of theorem ƒ ∧ |– ∧ a b b a 2 proofs needed ‰Proof to apply ∧I rule assumption a ∧ b a ∧ b  ∧  ∧ { ER} { EL} proof of a proof of b b a given a ∧ b given a ∧ b  {∧I} b ∧ a ∧ Step uses ER rule Proof(s) above line Natural {rule} Assumption stands Deduction Conclusion below line in place of proof Proofs form tree structure: Leaves = premises (assumptions) Root = conclusion a b ∧ ∧ { I} Inference rule citations = branches a b CS 1813 Discrete Mathematics, Univ Oklahoma 5 Copyright © 2000 by Rex Page Notation for Proof Checker ‰Theorem (∧ Commutes) ƒ a ∧ b |– b ∧ a ‰Proof Theorem [A `And` B] (B `And` A)

AndI (AndER (Assume(A `And` B)) a ∧ b a ∧ b B,  ∧  ∧ { ER} { EL} AndEL (Assume(A `And` B)) b a A  {∧I} ) b ∧ a (B `And` A)

Notation for format Automated Proof Checker

CS 1813 Discrete Mathematics, Univ Oklahoma 6 Copyright © 2000 by Rex Page Some Intrinsic Data Structures in Haskell

‰Sequences (aka lists — in primitive PLs, these are “linked lists”)

ƒ [x1, x2, …] all x’s must have same type ƒ Examples: [t] is the type of a sequence whose elements have type t 9[1, 9, 3, 27] type: [Integer] 9[And A B, Or P Q, B] type: [Prop] ‰Tuples (like structs or records in other programming languages)

ƒ (c1, c2) pair – components may have different types ƒ (c1, c2 , c3) 3-tuple (longer tuples OK—must be at least 2 components)

ƒ Examples: (t1, t2) means a pair where component k has type tk 9(7, And A B) type: (Integer, Prop) 9(AndEL (Assume(A `And` B)) A, Assume B) type: (Proof, Proof) Proof Proof CS 1813 Discrete Mathematics, Univ Oklahoma 7 Copyright © 2000 by Rex Page Type Definitions in Haskell Full definition of Prop type matches structure of WFF definition

ƒ data Prop = A | B | And Prop Prop | Or Prop Prop …

Type names start These constructors require with capital letters two arguments of type Prop Constructor names start (Prop is an inductive type) with capital letters

ƒ data Theorem = Theorem [Prop] Prop Second arg Only one constructor (conclusion) is a for this type First arg (premises) is a value of type Prop sequence whose elements have type Prop

CS 1813 Discrete Mathematics, Univ Oklahoma 8 Copyright © 2000 by Rex Page Another Type Definition

ƒ data Proof = Assume Prop | AndI (Proof, Proof) Prop | AndEL Proof Prop | Proof Proof Proof AndER Proof Prop {∧E } {∧I} . L Prop Prop . . ƒ Conclusion: each Proof constructor has a conclusion of type Prop (this represents the proven proposition) ƒ Premises: Proof constructors have one or more premises ƒ Each premise is a Proof (that is, an entity of type Proof) ƒ Exception: the Assume constructor has no premises ƒ Constructors: the full definition of the type Proof in the proof checker has one constructor for each inference rule

CS 1813 Discrete Mathematics, Univ Oklahoma 9 Copyright © 2000 by Rex Page End of Lecture 3

CS 1813 Discrete Mathematics, Univ Oklahoma 10 Copyright © 2000 by Rex Page