nicta advanced course theorem proving principles ...kleing/teaching/thprv-04/slides/lectur… ·...

93
NICTA Advanced Course Theorem Proving Principles, Techniques, Applications Gerwin Klein Formal Methods 1

Upload: others

Post on 19-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

NICTA Advanced Course

Theorem ProvingPrinciples, Techniques, Applications

Gerwin KleinFormal Methods

1

Page 2: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

ORGANISATORIALS

When Mon 14:00 – 15:30

Wed 10:30 – 12:00

7 weeks ends Mon, 20.9.2004

Exceptions Mon 6.9., 13.9., 20.9. at 15:00 – 16:30

Web page:http://www.cse.unsw.edu.au/˜kleing/teaching/thprv-04/

free – no credits – no assigments

ORGANISATORIALS 2

Page 3: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT YOU WILL LEARN

➜ how to use a theorem prover

➜ background, how it works

➜ how to prove and specify

Health Warning

Theorem Proving is addictive

WHAT YOU WILL LEARN 3

Page 4: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT YOU WILL LEARN

➜ how to use a theorem prover

➜ background, how it works

➜ how to prove and specify

Health Warning

Theorem Proving is addictive

WHAT YOU WILL LEARN 3-A

Page 5: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT YOU WILL LEARN

➜ how to use a theorem prover

➜ background, how it works

➜ how to prove and specify

Health Warning

Theorem Proving is addictive

WHAT YOU WILL LEARN 3-B

Page 6: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT YOU WILL LEARN

➜ how to use a theorem prover

➜ background, how it works

➜ how to prove and specify

Health Warning

Theorem Proving is addictive

WHAT YOU WILL LEARN 3-C

Page 7: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT YOU WILL NOT LEARN

➜ semantics / model theory

➜ soundness / completeness proofs

➜ decision procedures

WHAT YOU WILL NOT LEARN 4

Page 8: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT YOU WILL NOT LEARN

➜ semantics / model theory

➜ soundness / completeness proofs

➜ decision procedures

WHAT YOU WILL NOT LEARN 4-A

Page 9: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT YOU WILL NOT LEARN

➜ semantics / model theory

➜ soundness / completeness proofs

➜ decision procedures

WHAT YOU WILL NOT LEARN 4-B

Page 10: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

CONTENT

➜ Intro & motivation, getting started with Isabelle (today)

➜ 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 5

Page 11: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

CONTENT

➜ Intro & motivation, getting started with Isabelle (today)

➜ 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 5-A

Page 12: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

CONTENT

➜ Intro & motivation, getting started with Isabelle (today)

➜ 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 5-B

Page 13: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

CREDITS

material (in part) shamelessly stolen from

Tobias Nipkow, Larry Paulson, Markus Wenzel

David Basin, Burkhardt Wolff

Don’t blame them, errors are mine

CREDITS 6

Page 14: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A PROOF?

to prove

(Marriam-Webster)

➜ from Latin probare (test, approve, prove)

➜ to learn or find out by experience (archaic)

➜ to establish the existence, truth, or validity of(by evidence or logic)prove a theorem, the charges were never proved in court

pops up everywhere

➜ politics (weapons of mass destruction)

➜ courts (beyond reasonable doubt)

➜ religion (god exists)

➜ science (cold fusion works)

WHAT IS A PROOF? 7

Page 15: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A PROOF?

to prove (Marriam-Webster)

➜ from Latin probare (test, approve, prove)

➜ to learn or find out by experience (archaic)

➜ to establish the existence, truth, or validity of(by evidence or logic)prove a theorem, the charges were never proved in court

pops up everywhere

➜ politics (weapons of mass destruction)

➜ courts (beyond reasonable doubt)

➜ religion (god exists)

➜ science (cold fusion works)

WHAT IS A PROOF? 7-A

Page 16: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A PROOF?

to prove (Marriam-Webster)

➜ from Latin probare (test, approve, prove)

➜ to learn or find out by experience (archaic)

➜ to establish the existence, truth, or validity of(by evidence or logic)prove a theorem, the charges were never proved in court

pops up everywhere

➜ politics (weapons of mass destruction)

➜ courts (beyond reasonable doubt)

➜ religion (god exists)

➜ science (cold fusion works)

WHAT IS A PROOF? 7-B

Page 17: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A PROOF?

to prove (Marriam-Webster)

➜ from Latin probare (test, approve, prove)

➜ to learn or find out by experience (archaic)

➜ to establish the existence, truth, or validity of(by evidence or logic)prove a theorem, the charges were never proved in court

pops up everywhere

➜ politics (weapons of mass destruction)

➜ courts (beyond reasonable doubt)

➜ religion (god exists)

➜ science (cold fusion works)

WHAT IS A PROOF? 7-C

Page 18: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A PROOF?

to prove (Marriam-Webster)

➜ from Latin probare (test, approve, prove)

➜ to learn or find out by experience (archaic)

➜ to establish the existence, truth, or validity of(by evidence or logic)prove a theorem, the charges were never proved in court

pops up everywhere

➜ politics (weapons of mass destruction)

➜ courts (beyond reasonable doubt)

➜ religion (god exists)

➜ science (cold fusion works)

WHAT IS A PROOF? 7-D

Page 19: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A MATHEMATICAL PROOF?

In mathematics, a proof is a demonstration that, given certainaxioms, some statement of interest is necessarily true.(Wikipedia)

Example:√

2 is not rational.

Proof:

assume there is r ∈ Q such that r2 = 2.

Hence there are mutually prime p and q with r = p

q.

Thus 2q2 = p2, i.e. p2 is divisible by 2.

2 is prime, hence it also divides p, i.e. p = 2s.

Substituting this into 2q2 = p2 and dividing by 2 gives q2 = 2s2.Hence, q is also divisible by 2. Contradiction. Qed.

WHAT IS A MATHEMATICAL PROOF? 8

Page 20: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A MATHEMATICAL PROOF?

In mathematics, a proof is a demonstration that, given certainaxioms, some statement of interest is necessarily true.(Wikipedia)

Example:√

2 is not rational.

Proof: assume there is r ∈ Q such that r2 = 2.

Hence there are mutually prime p and q with r = p

q.

Thus 2q2 = p2, i.e. p2 is divisible by 2.

2 is prime, hence it also divides p, i.e. p = 2s.

Substituting this into 2q2 = p2 and dividing by 2 gives q2 = 2s2.Hence, q is also divisible by 2. Contradiction. Qed.

WHAT IS A MATHEMATICAL PROOF? 8-A

Page 21: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

NICE, BUT..

➜ still not rigorous enough for some

• what are the rules?

• what are the axioms?

• how big can the steps be?

• what is obvious or trivial?

➜ informal language, easy to get wrong

➜ easy to miss something, easy to cheat

Theorem. A cat has nine tails.Proof. No cat has eight tails. Since one cat has one more tail thanno cat, it must have nine tails.

NICE, BUT.. 9

Page 22: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

NICE, BUT..

➜ still not rigorous enough for some

• what are the rules?

• what are the axioms?

• how big can the steps be?

• what is obvious or trivial?

➜ informal language, easy to get wrong

➜ easy to miss something, easy to cheat

Theorem. A cat has nine tails.Proof. No cat has eight tails. Since one cat has one more tail thanno cat, it must have nine tails.

NICE, BUT.. 9-A

Page 23: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A FORMAL PROOF?

A derivation in a formal calculus

Example: A ∧ B −→ B ∧ A derivable in the following system

Rules:X ∈ S

S ` X(assumption)

S ∪ {X} ` Y

S ` X −→ Y(impI)

S ` X S ` YS ` X ∧ Y

(conjI)S ∪ {X, Y } ` Z

S ∪ {X ∧ Y } ` Z(conjE)

Proof:

1. {A, B} ` B (by assumption)

2. {A, B} ` A (by assumption)

3. {A, B} ` B ∧ A (by conjI with 1 and 2)

4. {A ∧ B} ` B ∧ A (by conjE with 3)

5. {} ` A ∧ B −→ B ∧ A (by impI with 4)

WHAT IS A FORMAL PROOF? 10

Page 24: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A FORMAL PROOF?

A derivation in a formal calculus

Example: A ∧ B −→ B ∧ A derivable in the following system

Rules:X ∈ S

S ` X(assumption)

S ∪ {X} ` Y

S ` X −→ Y(impI)

S ` X S ` YS ` X ∧ Y

(conjI)S ∪ {X, Y } ` Z

S ∪ {X ∧ Y } ` Z(conjE)

Proof:

1. {A, B} ` B (by assumption)

2. {A, B} ` A (by assumption)

3. {A, B} ` B ∧ A (by conjI with 1 and 2)

4. {A ∧ B} ` B ∧ A (by conjE with 3)

5. {} ` A ∧ B −→ B ∧ A (by impI with 4)

WHAT IS A FORMAL PROOF? 10-A

Page 25: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A FORMAL PROOF?

A derivation in a formal calculus

Example: A ∧ B −→ B ∧ A derivable in the following system

Rules:X ∈ S

S ` X(assumption)

S ∪ {X} ` Y

S ` X −→ Y(impI)

S ` X S ` YS ` X ∧ Y

(conjI)S ∪ {X, Y } ` Z

S ∪ {X ∧ Y } ` Z(conjE)

Proof:

1. {A, B} ` B (by assumption)

2. {A, B} ` A (by assumption)

3. {A, B} ` B ∧ A (by conjI with 1 and 2)

4. {A ∧ B} ` B ∧ A (by conjE with 3)

5. {} ` A ∧ B −→ B ∧ A (by impI with 4)

WHAT IS A FORMAL PROOF? 10-B

Page 26: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A THEOREM PROVER?

Implementation of a formal logic on a computer.

➜ fully automated (propositional logic)

➜ automated, but not necessarily terminating (first order logic)

➜ with automation, but mainly interactive (higher order logic)

➜ based on rules and axioms

➜ can deliver proofs

There are other (algorithmic) verification tools:

➜ model checking, static analysis, ...

➜ usually do not deliver proofs

WHAT IS A THEOREM PROVER? 11

Page 27: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A THEOREM PROVER?

Implementation of a formal logic on a computer.

➜ fully automated (propositional logic)

➜ automated, but not necessarily terminating (first order logic)

➜ with automation, but mainly interactive (higher order logic)

➜ based on rules and axioms

➜ can deliver proofs

There are other (algorithmic) verification tools:

➜ model checking, static analysis, ...

➜ usually do not deliver proofs

WHAT IS A THEOREM PROVER? 11-A

Page 28: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS A THEOREM PROVER?

Implementation of a formal logic on a computer.

➜ fully automated (propositional logic)

➜ automated, but not necessarily terminating (first order logic)

➜ with automation, but mainly interactive (higher order logic)

➜ based on rules and axioms

➜ can deliver proofs

There are other (algorithmic) verification tools:

➜ model checking, static analysis, ...

➜ usually do not deliver proofs

WHAT IS A THEOREM PROVER? 11-B

Page 29: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHY THEOREM PROVING?

➜ Analysing systems/programs thoroughly

➜ Finding design and specification errors early

➜ High assurance (mathematical, machine checked proof)

➜ it’s not always easy

➜ it’s fun

WHY THEOREM PROVING? 12

Page 30: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHY THEOREM PROVING?

➜ Analysing systems/programs thoroughly

➜ Finding design and specification errors early

➜ High assurance (mathematical, machine checked proof)

➜ it’s not always easy

➜ it’s fun

WHY THEOREM PROVING? 12-A

Page 31: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHY THEOREM PROVING?

➜ Analysing systems/programs thoroughly

➜ Finding design and specification errors early

➜ High assurance (mathematical, machine checked proof)

➜ it’s not always easy

➜ it’s fun

WHY THEOREM PROVING? 12-B

Page 32: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHY THEOREM PROVING?

➜ Analysing systems/programs thoroughly

➜ Finding design and specification errors early

➜ High assurance (mathematical, machine checked proof)

➜ it’s not always easy

➜ it’s fun

WHY THEOREM PROVING? 12-C

Page 33: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

Main theorem proving system for this course:

λ →

∀=Isa

belle

βα

13

Page 34: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS ISABELLE?

A generic interactive proof assistant

➜ generic:not specialised to one particular logic

(two large developments: HOL and ZF, will mainly use HOL)

➜ interactive:more than just yes/no, you can interactively guide the system

➜ proof assistant:helps to explore, find, and maintain proofs

WHAT IS ISABELLE? 14

Page 35: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS ISABELLE?

A generic interactive proof assistant

➜ generic:not specialised to one particular logic

(two large developments: HOL and ZF, will mainly use HOL)

➜ interactive:more than just yes/no, you can interactively guide the system

➜ proof assistant:helps to explore, find, and maintain proofs

WHAT IS ISABELLE? 14-A

Page 36: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS ISABELLE?

A generic interactive proof assistant

➜ generic:not specialised to one particular logic

(two large developments: HOL and ZF, will mainly use HOL)

➜ interactive:more than just yes/no, you can interactively guide the system

➜ proof assistant:helps to explore, find, and maintain proofs

WHAT IS ISABELLE? 14-B

Page 37: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHAT IS ISABELLE?

A generic interactive proof assistant

➜ generic:not specialised to one particular logic

(two large developments: HOL and ZF, will mainly use HOL)

➜ interactive:more than just yes/no, you can interactively guide the system

➜ proof assistant:helps to explore, find, and maintain proofs

WHAT IS ISABELLE? 14-C

Page 38: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHY ISABELLE?

➜ free

➜ widely used system

➜ active development

➜ high expressiveness and automation

➜ reasonably easy to use

➜ (and because I know it best ;-))

We will see other systems, too: HOL4, Coq, Waldmeister

WHY ISABELLE? 15

Page 39: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHY ISABELLE?

➜ free

➜ widely used system

➜ active development

➜ high expressiveness and automation

➜ reasonably easy to use

➜ (and because I know it best ;-))

We will see other systems, too: HOL4, Coq, Waldmeister

WHY ISABELLE? 15-A

Page 40: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

WHY ISABELLE?

➜ free

➜ widely used system

➜ active development

➜ high expressiveness and automation

➜ reasonably easy to use

➜ (and because I know it best ;-))

We will see other systems, too: HOL4, Coq, Waldmeister

WHY ISABELLE? 15-B

Page 41: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

If I prove it on the computer, it is correct, right?

16

Page 42: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, because:

➀ hardware could be faulty

➁ operating system could be faulty

➂ implementation runtime system could be faulty

➃ compiler could be faulty

➄ implementation could be faulty

➅ logic could be inconsistent

➆ theorem could mean something else

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 17

Page 43: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, because:

➀ hardware could be faulty

➁ operating system could be faulty

➂ implementation runtime system could be faulty

➃ compiler could be faulty

➄ implementation could be faulty

➅ logic could be inconsistent

➆ theorem could mean something else

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 17-A

Page 44: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, because:

➀ hardware could be faulty

➁ operating system could be faulty

➂ implementation runtime system could be faulty

➃ compiler could be faulty

➄ implementation could be faulty

➅ logic could be inconsistent

➆ theorem could mean something else

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 17-B

Page 45: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, because:

➀ hardware could be faulty

➁ operating system could be faulty

➂ implementation runtime system could be faulty

➃ compiler could be faulty

➄ implementation could be faulty

➅ logic could be inconsistent

➆ theorem could mean something else

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 17-C

Page 46: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, because:

➀ hardware could be faulty

➁ operating system could be faulty

➂ implementation runtime system could be faulty

➃ compiler could be faulty

➄ implementation could be faulty

➅ logic could be inconsistent

➆ theorem could mean something else

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 17-D

Page 47: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, because:

➀ hardware could be faulty

➁ operating system could be faulty

➂ implementation runtime system could be faulty

➃ compiler could be faulty

➄ implementation could be faulty

➅ logic could be inconsistent

➆ theorem could mean something else

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 17-E

Page 48: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, because:

➀ hardware could be faulty

➁ operating system could be faulty

➂ implementation runtime system could be faulty

➃ compiler could be faulty

➄ implementation could be faulty

➅ logic could be inconsistent

➆ theorem could mean something else

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 17-F

Page 49: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, because:

➀ hardware could be faulty

➁ operating system could be faulty

➂ implementation runtime system could be faulty

➃ compiler could be faulty

➄ implementation could be faulty

➅ logic could be inconsistent

➆ theorem could mean something else

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 17-G

Page 50: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, but:

probability for

➜ 1 and 2 reduced by using different systems

➜ 3 and 4 reduced by using different compilers

➜ faulty implementation reduced by right architecture

➜ inconsistent logic reduced by implementing and analysing it

➜ wrong theorem reduced by expressive/intuitive logics

No guarantees, but assurance way higher than manual proof

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 18

Page 51: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, but:

probability for

➜ 1 and 2 reduced by using different systems

➜ 3 and 4 reduced by using different compilers

➜ faulty implementation reduced by right architecture

➜ inconsistent logic reduced by implementing and analysing it

➜ wrong theorem reduced by expressive/intuitive logics

No guarantees, but assurance way higher than manual proof

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 18-A

Page 52: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, but:

probability for

➜ 1 and 2 reduced by using different systems

➜ 3 and 4 reduced by using different compilers

➜ faulty implementation reduced by right architecture

➜ inconsistent logic reduced by implementing and analysing it

➜ wrong theorem reduced by expressive/intuitive logics

No guarantees, but assurance way higher than manual proof

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 18-B

Page 53: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, but:

probability for

➜ 1 and 2 reduced by using different systems

➜ 3 and 4 reduced by using different compilers

➜ faulty implementation reduced by right architecture

➜ inconsistent logic reduced by implementing and analysing it

➜ wrong theorem reduced by expressive/intuitive logics

No guarantees, but assurance way higher than manual proof

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 18-C

Page 54: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, but:

probability for

➜ 1 and 2 reduced by using different systems

➜ 3 and 4 reduced by using different compilers

➜ faulty implementation reduced by right architecture

➜ inconsistent logic reduced by implementing and analysing it

➜ wrong theorem reduced by expressive/intuitive logics

No guarantees, but assurance way higher than manual proof

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 18-D

Page 55: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, but:

probability for

➜ 1 and 2 reduced by using different systems

➜ 3 and 4 reduced by using different compilers

➜ faulty implementation reduced by right architecture

➜ inconsistent logic reduced by implementing and analysing it

➜ wrong theorem reduced by expressive/intuitive logics

No guarantees, but assurance way higher than manual proof

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 18-E

Page 56: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

No, but:

probability for

➜ 1 and 2 reduced by using different systems

➜ 3 and 4 reduced by using different compilers

➜ faulty implementation reduced by right architecture

➜ inconsistent logic reduced by implementing and analysing it

➜ wrong theorem reduced by expressive/intuitive logics

No guarantees, but assurance way higher than manual proof

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 18-F

Page 57: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

Soundness architectures

careful implementation PVS

LCF approach, small proof kernel HOL4

Isabelle

explicit proofs + proof checker Coq

Twelf

Isabelle

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 19

Page 58: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

Soundness architectures

careful implementation PVS

LCF approach, small proof kernel HOL4

Isabelle

explicit proofs + proof checker Coq

Twelf

Isabelle

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 19-A

Page 59: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT?

Soundness architectures

careful implementation PVS

LCF approach, small proof kernel HOL4

Isabelle

explicit proofs + proof checker Coq

Twelf

Isabelle

IF I PROVE IT ON THE COMPUTER, IT IS CORRECT, RIGHT? 19-B

Page 60: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

META LOGIC

Meta language:The language used to talk about another language.

Examples:English in a Spanish class, English in an English class

Meta logic:The logic used to formalize another logic

Example:Mathematics used to formalize derivations in formal logic

META LOGIC 20

Page 61: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

META LOGIC

Meta language:The language used to talk about another language.

Examples:English in a Spanish class, English in an English class

Meta logic:The logic used to formalize another logic

Example:Mathematics used to formalize derivations in formal logic

META LOGIC 20-A

Page 62: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

META LOGIC

Meta language:The language used to talk about another language.

Examples:English in a Spanish class, English in an English class

Meta logic:The logic used to formalize another logic

Example:Mathematics used to formalize derivations in formal logic

META LOGIC 20-B

Page 63: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

META LOGIC – EXAMPLE

Syntax:

Formulae: F ::= V | F −→ F | F ∧ F | False

V ::= [A − Z]

Derivable: S ` X X a formula, S a set of formulae

logic / meta logic

X ∈ S

S ` X

S ∪ {X} ` Y

S ` X −→ Y

S ` X S ` YS ` X ∧ Y

S ∪ {X, Y } ` Z

S ∪ {X ∧ Y } ` Z

META LOGIC – EXAMPLE 21

Page 64: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

META LOGIC – EXAMPLE

Syntax:

Formulae: F ::= V | F −→ F | F ∧ F | False

V ::= [A − Z]

Derivable: S ` X X a formula, S a set of formulae

logic / meta logic

X ∈ S

S ` X

S ∪ {X} ` Y

S ` X −→ Y

S ` X S ` YS ` X ∧ Y

S ∪ {X, Y } ` Z

S ∪ {X ∧ Y } ` Z

META LOGIC – EXAMPLE 21-A

Page 65: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

ISABELLE’S META LOGIC

∧=⇒ λ

ISABELLE’S META LOGIC 22

Page 66: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

Syntax:∧

x. F (F another meta level formula)

in ASCII: !!x. F

➜ universial quantifier on the meta level

➜ used to denote parameters

➜ example and more later

∧23

Page 67: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

Syntax:∧

x. F (F another meta level formula)

in ASCII: !!x. F

➜ universial quantifier on the meta level

➜ used to denote parameters

➜ example and more later

∧23-A

Page 68: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

=⇒

Syntax: A =⇒ B (A, B other meta level formulae)

in ASCII: A ==> B

Binds to the right:

A =⇒ B =⇒ C = A =⇒ (B =⇒ C)

Abbreviation:

[[A; B]] =⇒ C = A =⇒ B =⇒ C

➜ read: A and B implies C

➜ used to write down rules, theorems, and proof states

=⇒ 24

Page 69: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

=⇒

Syntax: A =⇒ B (A, B other meta level formulae)

in ASCII: A ==> B

Binds to the right:

A =⇒ B =⇒ C = A =⇒ (B =⇒ C)

Abbreviation:

[[A; B]] =⇒ C = A =⇒ B =⇒ C

➜ read: A and B implies C

➜ used to write down rules, theorems, and proof states

=⇒ 24-A

Page 70: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A THEOREM

mathematics: if x < 0 and y < 0, then x + y < 0

formal logic: ` x < 0 ∧ y < 0 −→ x + y < 0

variation: x < 0; y < 0 ` x + y < 0

Isabelle: lemma ”x < 0 ∧ y < 0 −→ x + y < 0”

variation: lemma ”[[x < 0; y < 0]] =⇒ x + y < 0”

variation: lemma

assumes ”x < 0” and ”y < 0” shows ”x + y < 0”

EXAMPLE: A THEOREM 25

Page 71: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A THEOREM

mathematics: if x < 0 and y < 0, then x + y < 0

formal logic: ` x < 0 ∧ y < 0 −→ x + y < 0

variation: x < 0; y < 0 ` x + y < 0

Isabelle: lemma ”x < 0 ∧ y < 0 −→ x + y < 0”

variation: lemma ”[[x < 0; y < 0]] =⇒ x + y < 0”

variation: lemma

assumes ”x < 0” and ”y < 0” shows ”x + y < 0”

EXAMPLE: A THEOREM 25-A

Page 72: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A THEOREM

mathematics: if x < 0 and y < 0, then x + y < 0

formal logic: ` x < 0 ∧ y < 0 −→ x + y < 0

variation: x < 0; y < 0 ` x + y < 0

Isabelle: lemma ”x < 0 ∧ y < 0 −→ x + y < 0”

variation: lemma ”[[x < 0; y < 0]] =⇒ x + y < 0”

variation: lemma

assumes ”x < 0” and ”y < 0” shows ”x + y < 0”

EXAMPLE: A THEOREM 25-B

Page 73: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A THEOREM

mathematics: if x < 0 and y < 0, then x + y < 0

formal logic: ` x < 0 ∧ y < 0 −→ x + y < 0

variation: x < 0; y < 0 ` x + y < 0

Isabelle: lemma ”x < 0 ∧ y < 0 −→ x + y < 0”

variation: lemma ”[[x < 0; y < 0]] =⇒ x + y < 0”

variation: lemma

assumes ”x < 0” and ”y < 0” shows ”x + y < 0”

EXAMPLE: A THEOREM 25-C

Page 74: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A RULE

logic:X YX ∧ Y

variation:S ` X S ` Y

S ` X ∧ Y

Isabelle: [[X; Y ]] =⇒ X ∧ Y

EXAMPLE: A RULE 26

Page 75: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A RULE

logic:X YX ∧ Y

variation:S ` X S ` Y

S ` X ∧ Y

Isabelle: [[X; Y ]] =⇒ X ∧ Y

EXAMPLE: A RULE 26-A

Page 76: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A RULE

logic:X YX ∧ Y

variation:S ` X S ` Y

S ` X ∧ Y

Isabelle: [[X; Y ]] =⇒ X ∧ Y

EXAMPLE: A RULE 26-B

Page 77: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A RULE WITH NESTED IMPLICATION

logic:X ∨ Y

X....Z

Y....Z

Z

variation:S ∪ {X} ` Z S ∪ {Y } ` Z

S ∪ {X ∨ Y } ` Z

Isabelle: [[X ∨ Y ; X =⇒ Z; Y =⇒ Z]] =⇒ Z

EXAMPLE: A RULE WITH NESTED IMPLICATION 27

Page 78: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A RULE WITH NESTED IMPLICATION

logic:X ∨ Y

X....Z

Y....Z

Z

variation:S ∪ {X} ` Z S ∪ {Y } ` Z

S ∪ {X ∨ Y } ` Z

Isabelle: [[X ∨ Y ; X =⇒ Z; Y =⇒ Z]] =⇒ Z

EXAMPLE: A RULE WITH NESTED IMPLICATION 27-A

Page 79: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXAMPLE: A RULE WITH NESTED IMPLICATION

logic:X ∨ Y

X....Z

Y....Z

Z

variation:S ∪ {X} ` Z S ∪ {Y } ` Z

S ∪ {X ∨ Y } ` Z

Isabelle: [[X ∨ Y ; X =⇒ Z; Y =⇒ Z]] =⇒ Z

EXAMPLE: A RULE WITH NESTED IMPLICATION 27-B

Page 80: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

λ

Syntax: λx. F (F another meta level formula)

in ASCII: %x. F

➜ lambda abstraction

➜ used to for functions in object logics

➜ used to encode bound variables in object logics

➜ more about this in the next lecture

λ 28

Page 81: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

λ

Syntax: λx. F (F another meta level formula)

in ASCII: %x. F

➜ lambda abstraction

➜ used to for functions in object logics

➜ used to encode bound variables in object logics

➜ more about this in the next lecture

λ 28-A

Page 82: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

ENOUGH THEORY!

GETTING STARTED WITH ISABELLE

29

Page 83: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

SYSTEM ARCHITECTURE

Proof General – user interface

HOL, ZF – object-logics

Isabelle – generic, interactive theorem prover

Standard ML – logic implemented as ADT

User can access all layers!

SYSTEM ARCHITECTURE 30

Page 84: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

SYSTEM ARCHITECTURE

Proof General – user interface

HOL, ZF – object-logics

Isabelle – generic, interactive theorem prover

Standard ML – logic implemented as ADT

User can access all layers!

SYSTEM ARCHITECTURE 30-A

Page 85: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

SYSTEM ARCHITECTURE

Proof General – user interface

HOL, ZF – object-logics

Isabelle – generic, interactive theorem prover

Standard ML – logic implemented as ADT

User can access all layers!

SYSTEM ARCHITECTURE 30-B

Page 86: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

SYSTEM ARCHITECTURE

Proof General – user interface

HOL, ZF – object-logics

Isabelle – generic, interactive theorem prover

Standard ML – logic implemented as ADT

User can access all layers!

SYSTEM ARCHITECTURE 30-C

Page 87: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

SYSTEM ARCHITECTURE

Proof General – user interface

HOL, ZF – object-logics

Isabelle – generic, interactive theorem prover

Standard ML – logic implemented as ADT

User can access all layers!

SYSTEM ARCHITECTURE 30-D

Page 88: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

SYSTEM REQUIREMENTS

➜ Linux, MacOS X or Solaris

➜ Standard ML(PolyML fastest, SML/NJ supports more platforms)

➜ XEmacs or Emacs(for ProofGeneral)

If you do not have Linux, MacOS X or Solaris, try IsaMorph:http://www.brucker.ch/projects/isamorph/

SYSTEM REQUIREMENTS 31

Page 89: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

DOCUMENTATION

Available from http://isabelle.in.tum.de

➜ Learning Isabelle

• Tutorial on Isabelle/HOL (LNCS 2283)

• Tutorial on Isar

• Tutorial on Locales

➜ Reference Manuals

• Isabelle/Isar Reference Manual

• Isabelle Reference Manual

• Isabelle System Manual

➜ Reference Manuals for Object-Logics

DOCUMENTATION 32

Page 90: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

PROOFGENERAL

➜ User interface for Isabelle

➜ Runs under XEmacs or Emacs

➜ Isabelle process in background

Interaction via

➜ Basic editing in XEmacs (with highlighting etc)

➜ Buttons (tool bar)

➜ Key bindings

➜ ProofGeneral Menu (lots of options, try them)

PROOFGENERAL 33

Page 91: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

X-SYMBOL CHEAT SHEET

Input of funny symbols in ProofGeneral

➜ via menu (“X-Symbol”)

➜ via ASCII encoding (similar to LATEX): \<and>, \<or>, . . .

➜ via abbreviation: /\, \/, -->, . . .

➜ via rotate: l C-. = λ (cycles through variations of letter)

∀ ∃ λ ¬ ∧ ∨ −→ ⇒

➀ \<forall> \<exists> \<lambda> \<not> /\ \/ --> =>

➁ ALL EX % ˜ & |

➀ converted to X-Symbol

➁ stays ASCII

X-SYMBOL CHEAT SHEET 34

Page 92: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

DEMO

35

Page 93: NICTA Advanced Course Theorem Proving Principles ...kleing/teaching/thprv-04/slides/lectur… · Formal Methods 1. ORGANISATORIALS When Mon 14:00 – 15:30 Wed 10:30 – 12:00

EXERCISES

➜ Download and install Isabelle fromhttp://isabelle.in.tum.de or

http://mirror.cse.unsw.edu.au/pub/isabelle/

➜ Switch on X-Symbol in ProofGeneral

➜ Step through the demo file from the lecture web page

➜ Write an own theory file, look at some theorems, try ’find theorem’

EXERCISES 36