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 • Term rewriting ➜ Proof & Specification Techniques • Datatypes, recursion, induction • Inductively defined sets, rule induction • Calculational reasoning, mathematics style proofs • Hoare logic, proofs about programs C ONTENT 2
L AST T IME ON HOL ➜ Proof rules for propositional and predicate logic L AST T IME ON HOL 3
L AST T IME ON HOL ➜ Proof rules for propositional and predicate logic ➜ Safe and unsafe rules L AST T IME ON HOL 3- A
L AST T IME ON HOL ➜ Proof rules for propositional and predicate logic ➜ Safe and unsafe rules ➜ Forward Proof L AST T IME ON HOL 3- B
L AST T IME ON HOL ➜ Proof rules for propositional and predicate logic ➜ Safe and unsafe rules ➜ Forward Proof ➜ The Epsilon Operator L AST T IME ON HOL 3- C
L AST T IME ON HOL ➜ Proof rules for propositional and predicate logic ➜ Safe and unsafe rules ➜ Forward Proof ➜ The Epsilon Operator ➜ Some automation L AST T IME ON HOL 3- D
D EFINING H IGHER O RDER L OGIC 4
W HAT IS H IGHER O RDER L OGIC ? ➜ Propositional Logic: • no quantifiers • all variables have type bool W HAT IS H IGHER O RDER L OGIC ? 5
W HAT IS H IGHER O RDER L OGIC ? ➜ 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 W HAT IS H IGHER O RDER L OGIC ? 5- A
W HAT IS H IGHER O RDER L OGIC ? ➜ 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 W HAT IS H IGHER O RDER L OGIC ? 5- B
D EFINING H IGHER O RDER L OGIC Default types: bool D EFINING H IGHER O RDER L OGIC 6
D EFINING H IGHER O RDER L OGIC Default types: bool ⇒ D EFINING H IGHER O RDER L OGIC 6- B
D EFINING H IGHER O RDER L OGIC Default types: bool ind ⇒ D EFINING H IGHER O RDER L OGIC 6- C
D EFINING H IGHER O RDER L OGIC Default types: bool ind ⇒ ➜ bool sometimes called o ➜ ⇒ sometimes called fun D EFINING H IGHER O RDER L OGIC 6- D
D EFINING H IGHER O RDER L OGIC Default types: bool ind ⇒ ➜ bool sometimes called o ➜ ⇒ sometimes called fun Default Constants: D EFINING H IGHER O RDER L OGIC 6- E
D EFINING H IGHER O RDER L OGIC Default types: bool ind ⇒ ➜ bool sometimes called o ➜ ⇒ sometimes called fun Default Constants: :: bool ⇒ bool ⇒ bool − → D EFINING H IGHER O RDER L OGIC 6- F
D EFINING H IGHER O RDER L OGIC Default types: bool ind ⇒ ➜ bool sometimes called o ➜ ⇒ sometimes called fun Default Constants: :: bool ⇒ bool ⇒ bool − → = :: α ⇒ α ⇒ bool D EFINING H IGHER O RDER L OGIC 6- G
D EFINING H IGHER O RDER L OGIC Default types: bool ind ⇒ ➜ bool sometimes called o ➜ ⇒ sometimes called fun Default Constants: :: bool ⇒ bool ⇒ bool − → = :: α ⇒ α ⇒ bool :: ( α ⇒ bool ) ⇒ α ǫ D EFINING H IGHER O RDER L OGIC 6- H
H IGHER O RDER A BSTRACT S YNTAX Problem: Define syntax for binders like ∀ , ∃ , ε H IGHER O RDER A BSTRACT S YNTAX 7
H IGHER O RDER A BSTRACT S YNTAX Problem: Define syntax for binders like ∀ , ∃ , ε One approach: ∀ :: var ⇒ term ⇒ bool Drawback: need to think about substitution, α conversion again. H IGHER O RDER A BSTRACT S YNTAX 7- A
H IGHER O RDER A BSTRACT S YNTAX 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 λ H IGHER O RDER A BSTRACT S YNTAX 7- B
H IGHER O RDER A BSTRACT S YNTAX 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. H IGHER O RDER A BSTRACT S YNTAX 7- C
H IGHER O RDER A BSTRACT S YNTAX Example: ALL :: ( α ⇒ bool ) ⇒ bool HOAS usual syntax H IGHER O RDER A BSTRACT S YNTAX 8
H IGHER O RDER A BSTRACT S YNTAX Example: ALL :: ( α ⇒ bool ) ⇒ bool HOAS usual syntax ALL ( λx. x = 2) H IGHER O RDER A BSTRACT S YNTAX 8- A
H IGHER O RDER A BSTRACT S YNTAX Example: ALL :: ( α ⇒ bool ) ⇒ bool HOAS usual syntax ALL ( λx. x = 2) ∀ x. x = 2 H IGHER O RDER A BSTRACT S YNTAX 8- B
H IGHER O RDER A BSTRACT S YNTAX Example: ALL :: ( α ⇒ bool ) ⇒ bool HOAS usual syntax ALL ( λx. x = 2) ∀ x. x = 2 ALL P H IGHER O RDER A BSTRACT S YNTAX 8- C
H IGHER O RDER A BSTRACT S YNTAX Example: ALL :: ( α ⇒ bool ) ⇒ bool HOAS usual syntax ALL ( λx. x = 2) ∀ x. x = 2 ALL P ∀ x. P x H IGHER O RDER A BSTRACT S YNTAX 8- D
H IGHER O RDER A BSTRACT S YNTAX 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. H IGHER O RDER A BSTRACT S YNTAX 8- E
S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE ➜ mixfix: consts drvbl :: ct ⇒ ct ⇒ fm ⇒ bool (” , ”) ⊢ Legal syntax now: Γ , Π ⊢ F S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE 9
S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE ➜ 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) ⊢ S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE 9- A
S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE ➜ 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) S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE 9- B
S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE ➜ 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) S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE 9- C
S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE ➜ 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) S IDE T RACK : S YNTAX D ECLARATIONS IN I SABELLE 9- D
B ACK TO HOL Base: bool , ⇒ , ind = , − → , ε And the rest is B ACK TO HOL 10
B ACK TO HOL Base: bool , ⇒ , ind = , − → , ε And the rest is definitions: ≡ ( λx :: bool. x ) = ( λx. x ) True 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 ≡ ∀ R. ( P − → R ) − → ( Q − → R ) − P ∨ Q → 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 ≡ ∀ y. ∃ x. y = f x surj f B ACK TO HOL 10- A
T HE A XIOMS OF HOL � x. f x = g x s = t P s ( λx. f x ) = ( λx. g x ) ext subst t = t refl P t T HE A XIOMS OF HOL 11
T HE A XIOMS OF HOL � x. f x = g x s = t P s ( λx. f x ) = ( λx. g x ) ext subst t = t refl P t P = ⇒ Q P − → Q P mp → Q impI P − Q T HE A XIOMS OF HOL 11- A
T HE A XIOMS OF HOL � x. f x = g x s = t P s ( λx. f x ) = ( λx. g x ) ext subst t = t refl P t P = ⇒ Q P − → Q P mp → Q impI P − Q → ( P = Q ) iff ( P − → Q ) − → ( Q − → P ) − T HE A XIOMS OF HOL 11- B
Recommend
More recommend