HOL 1 C ONTENT Intro & motivation, getting started with - - PowerPoint PPT Presentation

hol
SMART_READER_LITE
LIVE PREVIEW

HOL 1 C ONTENT Intro & motivation, getting started with - - PowerPoint PPT Presentation

NICTA Advanced Course Theorem Proving Principles, Techniques, Applications HOL 1 C ONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic, natural deduction


slide-1
SLIDE 1

NICTA Advanced Course Theorem Proving Principles, Techniques, Applications

HOL

1

slide-2
SLIDE 2

CONTENT

➜ Intro & motivation, getting started with Isabelle ➜ Foundations & Principles

  • Lambda Calculus
  • Higher Order Logic, natural deduction
  • Term rewriting

➜ Proof & Specification Techniques

  • Datatypes, recursion, induction
  • Inductively defined sets, rule induction
  • Calculational reasoning, mathematics style proofs
  • Hoare logic, proofs about programs

CONTENT 2

slide-3
SLIDE 3

LAST TIME ON HOL

➜ Proof rules for propositional and predicate logic

LAST TIME ON HOL 3

slide-4
SLIDE 4

LAST TIME ON HOL

➜ Proof rules for propositional and predicate logic ➜ Safe and unsafe rules

LAST TIME ON HOL 3-A

slide-5
SLIDE 5

LAST TIME ON HOL

➜ Proof rules for propositional and predicate logic ➜ Safe and unsafe rules ➜ Forward Proof

LAST TIME ON HOL 3-B

slide-6
SLIDE 6

LAST TIME ON HOL

➜ Proof rules for propositional and predicate logic ➜ Safe and unsafe rules ➜ Forward Proof ➜ The Epsilon Operator

LAST TIME ON HOL 3-C

slide-7
SLIDE 7

LAST TIME ON HOL

➜ Proof rules for propositional and predicate logic ➜ Safe and unsafe rules ➜ Forward Proof ➜ The Epsilon Operator ➜ Some automation

LAST TIME ON HOL 3-D

slide-8
SLIDE 8

DEFINING HIGHER ORDER LOGIC

4

slide-9
SLIDE 9

WHAT IS HIGHER ORDER LOGIC?

➜ Propositional Logic:

  • no quantifiers
  • all variables have type bool

WHAT IS HIGHER ORDER LOGIC? 5

slide-10
SLIDE 10

WHAT IS HIGHER ORDER LOGIC?

➜ Propositional Logic:

  • no quantifiers
  • all variables have type bool

➜ First Order Logic:

  • quantification over values, but not over functions and predicates,
  • terms and formulas syntactically distinct

WHAT IS HIGHER ORDER LOGIC? 5-A

slide-11
SLIDE 11

WHAT IS HIGHER ORDER LOGIC?

➜ Propositional Logic:

  • no quantifiers
  • all variables have type bool

➜ First Order Logic:

  • quantification over values, but not over functions and predicates,
  • terms and formulas syntactically distinct

➜ Higher Order Logic:

  • quantification over everything, including predicates
  • consistency by types
  • formula = term of type bool
  • definition built on λ→ with certain default types and constants

WHAT IS HIGHER ORDER LOGIC? 5-B

slide-12
SLIDE 12

DEFINING HIGHER ORDER LOGIC

Default types:

bool

DEFINING HIGHER ORDER LOGIC 6

slide-13
SLIDE 13

DEFINING HIGHER ORDER LOGIC

Default types:

bool ⇒

DEFINING HIGHER ORDER LOGIC 6-B

slide-14
SLIDE 14

DEFINING HIGHER ORDER LOGIC

Default types:

bool ⇒ ind

DEFINING HIGHER ORDER LOGIC 6-C

slide-15
SLIDE 15

DEFINING HIGHER ORDER LOGIC

Default types:

bool ⇒ ind

➜ bool sometimes called o ➜ ⇒ sometimes called fun

DEFINING HIGHER ORDER LOGIC 6-D

slide-16
SLIDE 16

DEFINING HIGHER ORDER LOGIC

Default types:

bool ⇒ ind

➜ bool sometimes called o ➜ ⇒ sometimes called fun

Default Constants:

DEFINING HIGHER ORDER LOGIC 6-E

slide-17
SLIDE 17

DEFINING HIGHER ORDER LOGIC

Default types:

bool ⇒ ind

➜ bool sometimes called o ➜ ⇒ sometimes called fun

Default Constants:

− → :: bool ⇒ bool ⇒ bool

DEFINING HIGHER ORDER LOGIC 6-F

slide-18
SLIDE 18

DEFINING HIGHER ORDER LOGIC

Default types:

bool ⇒ ind

➜ bool sometimes called o ➜ ⇒ sometimes called fun

Default Constants:

− → :: bool ⇒ bool ⇒ bool = :: α ⇒ α ⇒ bool

DEFINING HIGHER ORDER LOGIC 6-G

slide-19
SLIDE 19

DEFINING HIGHER ORDER LOGIC

Default types:

bool ⇒ ind

➜ bool sometimes called o ➜ ⇒ sometimes called fun

Default Constants:

− → :: bool ⇒ bool ⇒ bool = :: α ⇒ α ⇒ bool ǫ :: (α ⇒ bool) ⇒ α

DEFINING HIGHER ORDER LOGIC 6-H

slide-20
SLIDE 20

HIGHER ORDER ABSTRACT SYNTAX

Problem: Define syntax for binders like ∀, ∃, ε

HIGHER ORDER ABSTRACT SYNTAX 7

slide-21
SLIDE 21

HIGHER ORDER ABSTRACT SYNTAX

Problem: Define syntax for binders like ∀, ∃, ε One approach: ∀ :: var ⇒ term ⇒ bool Drawback: need to think about substitution, α conversion again.

HIGHER ORDER ABSTRACT SYNTAX 7-A

slide-22
SLIDE 22

HIGHER ORDER ABSTRACT SYNTAX

Problem: Define syntax for binders like ∀, ∃, ε One approach: ∀ :: var ⇒ term ⇒ bool Drawback: need to think about substitution, α conversion again. But: Already have binder, substitution, α conversion in meta logic

λ

HIGHER ORDER ABSTRACT SYNTAX 7-B

slide-23
SLIDE 23

HIGHER ORDER ABSTRACT SYNTAX

Problem: Define syntax for binders like ∀, ∃, ε One approach: ∀ :: var ⇒ term ⇒ bool Drawback: need to think about substitution, α conversion again. But: Already have binder, substitution, α conversion in meta logic

λ

So: Use λ to encode all other binders.

HIGHER ORDER ABSTRACT SYNTAX 7-C

slide-24
SLIDE 24

HIGHER ORDER ABSTRACT SYNTAX

Example: ALL :: (α ⇒ bool) ⇒ bool HOAS usual syntax

HIGHER ORDER ABSTRACT SYNTAX 8

slide-25
SLIDE 25

HIGHER ORDER ABSTRACT SYNTAX

Example: ALL :: (α ⇒ bool) ⇒ bool HOAS usual syntax ALL (λx. x = 2)

HIGHER ORDER ABSTRACT SYNTAX 8-A

slide-26
SLIDE 26

HIGHER ORDER ABSTRACT SYNTAX

Example: ALL :: (α ⇒ bool) ⇒ bool HOAS usual syntax ALL (λx. x = 2) ∀x. x = 2

HIGHER ORDER ABSTRACT SYNTAX 8-B

slide-27
SLIDE 27

HIGHER ORDER ABSTRACT SYNTAX

Example: ALL :: (α ⇒ bool) ⇒ bool HOAS usual syntax ALL (λx. x = 2) ∀x. x = 2 ALL P

HIGHER ORDER ABSTRACT SYNTAX 8-C

slide-28
SLIDE 28

HIGHER ORDER ABSTRACT SYNTAX

Example: ALL :: (α ⇒ bool) ⇒ bool HOAS usual syntax ALL (λx. x = 2) ∀x. x = 2 ALL P ∀x. P x

HIGHER ORDER ABSTRACT SYNTAX 8-D

slide-29
SLIDE 29

HIGHER ORDER ABSTRACT SYNTAX

Example: ALL :: (α ⇒ bool) ⇒ bool HOAS usual syntax ALL (λx. x = 2) ∀x. x = 2 ALL P ∀x. P x Isabelle can translate usual binder syntax into HOAS.

HIGHER ORDER ABSTRACT SYNTAX 8-E

slide-30
SLIDE 30

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE

➜ mixfix: consts drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ”) Legal syntax now: Γ, Π ⊢ F

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE 9

slide-31
SLIDE 31

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE

➜ mixfix: consts drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ”) Legal syntax now: Γ, Π ⊢ F ➜ priorities: pattern can be annotated with priorities to indicate binding strength Example: drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ” [30, 0, 20] 60)

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE 9-A

slide-32
SLIDE 32

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE

➜ mixfix: consts drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ”) Legal syntax now: Γ, Π ⊢ F ➜ priorities: pattern can be annotated with priorities to indicate binding strength Example: drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ” [30, 0, 20] 60) ➜ infixl/infixr: short form for left/right associative binary operators Example: or :: bool ⇒ bool ⇒ bool (infixr ” ∨ ” 30)

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE 9-B

slide-33
SLIDE 33

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE

➜ mixfix: consts drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ”) Legal syntax now: Γ, Π ⊢ F ➜ priorities: pattern can be annotated with priorities to indicate binding strength Example: drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ” [30, 0, 20] 60) ➜ infixl/infixr: short form for left/right associative binary operators Example: or :: bool ⇒ bool ⇒ bool (infixr ” ∨ ” 30) ➜ binders: declaration must be of the form c :: (τ1 ⇒ τ2) ⇒ τ3 (binder ”B” < p >) B x. P x translated into c P (and vice versa) Example ALL :: (α ⇒ bool) ⇒ bool (binder ”∀” 10)

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE 9-C

slide-34
SLIDE 34

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE

➜ mixfix: consts drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ”) Legal syntax now: Γ, Π ⊢ F ➜ priorities: pattern can be annotated with priorities to indicate binding strength Example: drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ⊢ ” [30, 0, 20] 60) ➜ infixl/infixr: short form for left/right associative binary operators Example: or :: bool ⇒ bool ⇒ bool (infixr ” ∨ ” 30) ➜ binders: declaration must be of the form c :: (τ1 ⇒ τ2) ⇒ τ3 (binder ”B” < p >) B x. P x translated into c P (and vice versa) Example ALL :: (α ⇒ bool) ⇒ bool (binder ”∀” 10)

More (including pretty printing) in Isabelle Reference Manual (7.3)

SIDE TRACK: SYNTAX DECLARATIONS IN ISABELLE 9-D

slide-35
SLIDE 35

BACK TO HOL

Base: bool, ⇒, ind =, − →, ε And the rest is

BACK TO HOL 10

slide-36
SLIDE 36

BACK TO HOL

Base: bool, ⇒, ind =, − →, ε And the rest is definitions: True ≡ (λx :: bool. x) = (λx. x) All P ≡ P = (λx. True) Ex P ≡ ∀Q. (∀x. P x − → Q) − → Q False ≡ ∀P. P ¬P ≡ P − → False P ∧ Q ≡ ∀R. (P − → Q − → R) − → R P ∨ Q ≡ ∀R. (P − → R) − → (Q − → R) − → R If P x y ≡ SOME z. (P = True − → z = x) ∧ (P = False − → z = y) inj f ≡ ∀x y. f x = f y − → x = y surj f ≡ ∀y. ∃x. y = f x

BACK TO HOL 10-A

slide-37
SLIDE 37

THE AXIOMS OF HOL

t = t refl s = t P s P t subst

  • x. f x = g x

(λx. f x) = (λx. g x) ext

THE AXIOMS OF HOL 11

slide-38
SLIDE 38

THE AXIOMS OF HOL

t = t refl s = t P s P t subst

  • x. f x = g x

(λx. f x) = (λx. g x) ext P = ⇒ Q P − → Q impI P − → Q P Q mp

THE AXIOMS OF HOL 11-A

slide-39
SLIDE 39

THE AXIOMS OF HOL

t = t refl s = t P s P t subst

  • x. f x = g x

(λx. f x) = (λx. g x) ext P = ⇒ Q P − → Q impI P − → Q P Q mp (P − → Q) − → (Q − → P) − → (P = Q) iff

THE AXIOMS OF HOL 11-B

slide-40
SLIDE 40

THE AXIOMS OF HOL

t = t refl s = t P s P t subst

  • x. f x = g x

(λx. f x) = (λx. g x) ext P = ⇒ Q P − → Q impI P − → Q P Q mp (P − → Q) − → (Q − → P) − → (P = Q) iff P = True ∨ P = False True or False

THE AXIOMS OF HOL 11-C

slide-41
SLIDE 41

THE AXIOMS OF HOL

t = t refl s = t P s P t subst

  • x. f x = g x

(λx. f x) = (λx. g x) ext P = ⇒ Q P − → Q impI P − → Q P Q mp (P − → Q) − → (Q − → P) − → (P = Q) iff P = True ∨ P = False True or False P ?x P (SOME x. P x) someI

THE AXIOMS OF HOL 11-D

slide-42
SLIDE 42

THE AXIOMS OF HOL

t = t refl s = t P s P t subst

  • x. f x = g x

(λx. f x) = (λx. g x) ext P = ⇒ Q P − → Q impI P − → Q P Q mp (P − → Q) − → (Q − → P) − → (P = Q) iff P = True ∨ P = False True or False P ?x P (SOME x. P x) someI ∃f :: ind ⇒ ind. inj f ∧ ¬surj f infty

THE AXIOMS OF HOL 11-E

slide-43
SLIDE 43

THAT’S IT.

➜ 3 basic constants ➜ 3 basic types ➜ 9 axioms

THAT’S IT. 12

slide-44
SLIDE 44

THAT’S IT.

➜ 3 basic constants ➜ 3 basic types ➜ 9 axioms

With this you can define and derive all the rest.

THAT’S IT. 12-A

slide-45
SLIDE 45

THAT’S IT.

➜ 3 basic constants ➜ 3 basic types ➜ 9 axioms

With this you can define and derive all the rest. Isabelle knows 2 more axioms: x = y x ≡ y eq reflection (THE x. x = a) = a the eq trivial

THAT’S IT. 12-B

slide-46
SLIDE 46

DEMO: THE DEFINITIONS IN ISABELLE

13

slide-47
SLIDE 47

DERIVING PROOF RULES

In the following, we will

DERIVING PROOF RULES 14

slide-48
SLIDE 48

DERIVING PROOF RULES

In the following, we will

➜ look at the definitions in more detail

DERIVING PROOF RULES 14-A

slide-49
SLIDE 49

DERIVING PROOF RULES

In the following, we will

➜ look at the definitions in more detail ➜ derive the traditional proof rules from the axioms in Isabelle

DERIVING PROOF RULES 14-B

slide-50
SLIDE 50

DERIVING PROOF RULES

In the following, we will

➜ look at the definitions in more detail ➜ derive the traditional proof rules from the axioms in Isabelle

Convenient for deriving rules: named assumptions in lemmas lemma [name :] assumes [name1 :] ”< prop >1” assumes [name2 :] ”< prop >2” . . . shows ” < prop > ” < proof >

DERIVING PROOF RULES 14-C

slide-51
SLIDE 51

DERIVING PROOF RULES

In the following, we will

➜ look at the definitions in more detail ➜ derive the traditional proof rules from the axioms in Isabelle

Convenient for deriving rules: named assumptions in lemmas lemma [name :] assumes [name1 :] ”< prop >1” assumes [name2 :] ”< prop >2” . . . shows ” < prop > ” < proof > proves: [ [ < prop >1; < prop >2; . . . ] ] = ⇒< prop >

DERIVING PROOF RULES 14-D

slide-52
SLIDE 52

TRUE

consts True :: bool True ≡ (λx :: bool. x) = (λx. x) Intuition: right hand side is always true

TRUE 15

slide-53
SLIDE 53

TRUE

consts True :: bool True ≡ (λx :: bool. x) = (λx. x) Intuition: right hand side is always true Proof Rules: True TrueI Proof: (λx :: bool. x) = (λx. x) refl True unfold True def

TRUE 15-A

slide-54
SLIDE 54

DEMO

16

slide-55
SLIDE 55

UNIVERSIAL QUANTIFIER

consts ALL :: (α ⇒ bool) ⇒ bool ALL P ≡ P = (λx. True)

UNIVERSIAL QUANTIFIER 17

slide-56
SLIDE 56

UNIVERSIAL QUANTIFIER

consts ALL :: (α ⇒ bool) ⇒ bool ALL P ≡ P = (λx. True) Intuition:

➜ ALL P is Higher Order Abstract Syntax for ∀x. P x.

UNIVERSIAL QUANTIFIER 17-A

slide-57
SLIDE 57

UNIVERSIAL QUANTIFIER

consts ALL :: (α ⇒ bool) ⇒ bool ALL P ≡ P = (λx. True) Intuition:

➜ ALL P is Higher Order Abstract Syntax for ∀x. P x. ➜ P is a function that takes an x and yields a truth values.

UNIVERSIAL QUANTIFIER 17-B

slide-58
SLIDE 58

UNIVERSIAL QUANTIFIER

consts ALL :: (α ⇒ bool) ⇒ bool ALL P ≡ P = (λx. True) Intuition:

➜ ALL P is Higher Order Abstract Syntax for ∀x. P x. ➜ P is a function that takes an x and yields a truth values. ➜ ALL P should be true iff P yields true for all x, i.e. if it is equivalent to the function λx. True.

UNIVERSIAL QUANTIFIER 17-C

slide-59
SLIDE 59

UNIVERSIAL QUANTIFIER

consts ALL :: (α ⇒ bool) ⇒ bool ALL P ≡ P = (λx. True) Intuition:

➜ ALL P is Higher Order Abstract Syntax for ∀x. P x. ➜ P is a function that takes an x and yields a truth values. ➜ ALL P should be true iff P yields true for all x, i.e. if it is equivalent to the function λx. True.

Proof Rules:

  • x. P x

∀x. P x allI ∀x. P x P ?x = ⇒ R R allE Proof: Isabelle Demo

UNIVERSIAL QUANTIFIER 17-D

slide-60
SLIDE 60

FALSE

consts False :: bool False ≡ ∀P.P

FALSE 18

slide-61
SLIDE 61

FALSE

consts False :: bool False ≡ ∀P.P Intuition: Everything can be derived from False.

FALSE 18-A

slide-62
SLIDE 62

FALSE

consts False :: bool False ≡ ∀P.P Intuition: Everything can be derived from False. Proof Rules: False P FalseE True = False Proof: Isabelle Demo

FALSE 18-B

slide-63
SLIDE 63

NEGATION

consts Not :: bool ⇒ bool (¬ ) ¬P ≡ P − → False

NEGATION 19

slide-64
SLIDE 64

NEGATION

consts Not :: bool ⇒ bool (¬ ) ¬P ≡ P − → False Intuition: Try P = True and P = False and the traditional truth table for − →.

NEGATION 19-A

slide-65
SLIDE 65

NEGATION

consts Not :: bool ⇒ bool (¬ ) ¬P ≡ P − → False Intuition: Try P = True and P = False and the traditional truth table for − →. Proof Rules: A = ⇒ False ¬A notI ¬A A P notE Proof: Isabelle Demo

NEGATION 19-B

slide-66
SLIDE 66

EXISTENTIAL QUANTIFIER

consts EX :: (α ⇒ bool) ⇒ bool EX P ≡ ∀Q. (∀x. P x − → Q) − → Q

EXISTENTIAL QUANTIFIER 20

slide-67
SLIDE 67

EXISTENTIAL QUANTIFIER

consts EX :: (α ⇒ bool) ⇒ bool EX P ≡ ∀Q. (∀x. P x − → Q) − → Q Intuition:

➜ EX P is HOAS for ∃x. P x. (like ∀)

EXISTENTIAL QUANTIFIER 20-A

slide-68
SLIDE 68

EXISTENTIAL QUANTIFIER

consts EX :: (α ⇒ bool) ⇒ bool EX P ≡ ∀Q. (∀x. P x − → Q) − → Q Intuition:

➜ EX P is HOAS for ∃x. P x. (like ∀) ➜ Right hand side is characterization of ∃ with ∀ and − →

EXISTENTIAL QUANTIFIER 20-B

slide-69
SLIDE 69

EXISTENTIAL QUANTIFIER

consts EX :: (α ⇒ bool) ⇒ bool EX P ≡ ∀Q. (∀x. P x − → Q) − → Q Intuition:

➜ EX P is HOAS for ∃x. P x. (like ∀) ➜ Right hand side is characterization of ∃ with ∀ and − → ➜ Note that inner ∀ binds wide: (∀x. P x − → Q)

EXISTENTIAL QUANTIFIER 20-C

slide-70
SLIDE 70

EXISTENTIAL QUANTIFIER

consts EX :: (α ⇒ bool) ⇒ bool EX P ≡ ∀Q. (∀x. P x − → Q) − → Q Intuition:

➜ EX P is HOAS for ∃x. P x. (like ∀) ➜ Right hand side is characterization of ∃ with ∀ and − → ➜ Note that inner ∀ binds wide: (∀x. P x − → Q) ➜ Remember lemma from last time: (∀x. P x − → Q) = ((∃x. P x) − → Q)

EXISTENTIAL QUANTIFIER 20-D

slide-71
SLIDE 71

EXISTENTIAL QUANTIFIER

consts EX :: (α ⇒ bool) ⇒ bool EX P ≡ ∀Q. (∀x. P x − → Q) − → Q Intuition:

➜ EX P is HOAS for ∃x. P x. (like ∀) ➜ Right hand side is characterization of ∃ with ∀ and − → ➜ Note that inner ∀ binds wide: (∀x. P x − → Q) ➜ Remember lemma from last time: (∀x. P x − → Q) = ((∃x. P x) − → Q)

Proof Rules: P ?x ∃x. P x exI ∃x. P x

  • x. P x =

⇒ R R exE Proof: Isabelle Demo

EXISTENTIAL QUANTIFIER 20-E

slide-72
SLIDE 72

CONJUNCTION

consts And :: bool ⇒ bool ⇒ bool ( ∧ ) P ∧ Q ≡ ∀R. (P − → Q − → R) − → R

CONJUNCTION 21

slide-73
SLIDE 73

CONJUNCTION

consts And :: bool ⇒ bool ⇒ bool ( ∧ ) P ∧ Q ≡ ∀R. (P − → Q − → R) − → R Intuition:

➜ Mirrors proof rules for ∧

CONJUNCTION 21-A

slide-74
SLIDE 74

CONJUNCTION

consts And :: bool ⇒ bool ⇒ bool ( ∧ ) P ∧ Q ≡ ∀R. (P − → Q − → R) − → R Intuition:

➜ Mirrors proof rules for ∧ ➜ Try truth table for P, Q, and R

CONJUNCTION 21-B

slide-75
SLIDE 75

CONJUNCTION

consts And :: bool ⇒ bool ⇒ bool ( ∧ ) P ∧ Q ≡ ∀R. (P − → Q − → R) − → R Intuition:

➜ Mirrors proof rules for ∧ ➜ Try truth table for P, Q, and R

Proof Rules: A B A ∧ B conjI A ∧ B [ [A; B] ] = ⇒ C C conjE Proof: Isabelle Demo

CONJUNCTION 21-C

slide-76
SLIDE 76

DISJUNCTION

consts Or :: bool ⇒ bool ⇒ bool ( ∨ ) P ∨ Q ≡ ∀R. (P − → R) − → (Q − → R) − → R

DISJUNCTION 22

slide-77
SLIDE 77

DISJUNCTION

consts Or :: bool ⇒ bool ⇒ bool ( ∨ ) P ∨ Q ≡ ∀R. (P − → R) − → (Q − → R) − → R Intuition:

➜ Mirrors proof rules for ∨ (case distinction)

DISJUNCTION 22-A

slide-78
SLIDE 78

DISJUNCTION

consts Or :: bool ⇒ bool ⇒ bool ( ∨ ) P ∨ Q ≡ ∀R. (P − → R) − → (Q − → R) − → R Intuition:

➜ Mirrors proof rules for ∨ (case distinction) ➜ Try truth table for P, Q, and R

DISJUNCTION 22-B

slide-79
SLIDE 79

DISJUNCTION

consts Or :: bool ⇒ bool ⇒ bool ( ∨ ) P ∨ Q ≡ ∀R. (P − → R) − → (Q − → R) − → R Intuition:

➜ Mirrors proof rules for ∨ (case distinction) ➜ Try truth table for P, Q, and R

Proof Rules: A A ∨ B B A ∨ B disjI1/2 A ∨ B A = ⇒ C B = ⇒ C C disjE Proof: Isabelle Demo

DISJUNCTION 22-C

slide-80
SLIDE 80

IF-THEN-ELSE

consts If :: bool ⇒ α ⇒ α ⇒ α (if then else ) If P x y ≡ SOME z. (P = True − → z = x) ∧ (P = False − → z = y)

IF-THEN-ELSE 23

slide-81
SLIDE 81

IF-THEN-ELSE

consts If :: bool ⇒ α ⇒ α ⇒ α (if then else ) If P x y ≡ SOME z. (P = True − → z = x) ∧ (P = False − → z = y) Intuition:

➜ for P = True, right hand side collapses to SOME z. z = x

IF-THEN-ELSE 23-A

slide-82
SLIDE 82

IF-THEN-ELSE

consts If :: bool ⇒ α ⇒ α ⇒ α (if then else ) If P x y ≡ SOME z. (P = True − → z = x) ∧ (P = False − → z = y) Intuition:

➜ for P = True, right hand side collapses to SOME z. z = x ➜ for P = False, right hand side collapses to SOME z. z = y

IF-THEN-ELSE 23-B

slide-83
SLIDE 83

IF-THEN-ELSE

consts If :: bool ⇒ α ⇒ α ⇒ α (if then else ) If P x y ≡ SOME z. (P = True − → z = x) ∧ (P = False − → z = y) Intuition:

➜ for P = True, right hand side collapses to SOME z. z = x ➜ for P = False, right hand side collapses to SOME z. z = y

Proof Rules: if True then s else t = s ifTrue if False then s else t = t ifFalse Proof: Isabelle Demo

IF-THEN-ELSE 23-C

slide-84
SLIDE 84

THAT WAS HOL

24

slide-85
SLIDE 85

MORE ON AUTOMATION

Last time: safe and unsafe rule, heuristics: use safe before unsafe

MORE ON AUTOMATION 25

slide-86
SLIDE 86

MORE ON AUTOMATION

Last time: safe and unsafe rule, heuristics: use safe before unsafe This can be automated

MORE ON AUTOMATION 25-A

slide-87
SLIDE 87

MORE ON AUTOMATION

Last time: safe and unsafe rule, heuristics: use safe before unsafe This can be automated Syntax: [<kind>!] for safe rules (<kind> one of intro, elim, dest) [<kind>] for unsafe rules

MORE ON AUTOMATION 25-C

slide-88
SLIDE 88

MORE ON AUTOMATION

Last time: safe and unsafe rule, heuristics: use safe before unsafe This can be automated Syntax: [<kind>!] for safe rules (<kind> one of intro, elim, dest) [<kind>] for unsafe rules Application (roughly): do safe rules first, search/backtrack on unsafe rules only

MORE ON AUTOMATION 25-D

slide-89
SLIDE 89

MORE ON AUTOMATION

Last time: safe and unsafe rule, heuristics: use safe before unsafe This can be automated Syntax: [<kind>!] for safe rules (<kind> one of intro, elim, dest) [<kind>] for unsafe rules Application (roughly): do safe rules first, search/backtrack on unsafe rules only Example: declare attribute globally declare conjI [intro!] allE [elim] remove attribute gloabllay declare allE [rule del] use locally apply (blast intro: someI) delete locally apply (blast del: conjI)

MORE ON AUTOMATION 25-E

slide-90
SLIDE 90

DEMO: AUTOMATION

26

slide-91
SLIDE 91

WE HAVE LEARNED TODAY ...

➜ Defining HOL

WE HAVE LEARNED TODAY ... 27

slide-92
SLIDE 92

WE HAVE LEARNED TODAY ...

➜ Defining HOL ➜ Higher Order Abstract Syntax

WE HAVE LEARNED TODAY ... 27-A

slide-93
SLIDE 93

WE HAVE LEARNED TODAY ...

➜ Defining HOL ➜ Higher Order Abstract Syntax ➜ Deriving proof rules

WE HAVE LEARNED TODAY ... 27-B

slide-94
SLIDE 94

WE HAVE LEARNED TODAY ...

➜ Defining HOL ➜ Higher Order Abstract Syntax ➜ Deriving proof rules ➜ More automation

WE HAVE LEARNED TODAY ... 27-C

slide-95
SLIDE 95

EXERCISES

➜ derive the classical contradiction rule (¬P = ⇒ False) = ⇒ P in Isabelle ➜ define nor and nand in Isabelle ➜ show nor x x = nand x x ➜ derive safe intro and elim rules for them ➜ use these in an automated proof of nor x x = nand x x

EXERCISES 28