NICTA Advanced Course Theorem Proving Principles, Techniques, Applications locales 1
C ONTENT ➜ Intro & motivation, getting started with Isabelle ➜ Foundations & Principles • Lambda Calculus • Higher Order Logic, natural deduction • Term rewriting ➜ Proof & Specification Techniques • Inductively defined sets, rule induction • Datatypes, recursion, induction • More recursion, Calculational reasoning • Hoare logic, proofs about programs • Locales, Presentation C ONTENT 2
L AST T IME ➜ Syntax and semantics of IMP ➜ Hoare logic rules ➜ Soundness of Hoare logic ➜ Verification conditions ➜ Example program proofs L AST T IME 3
I SAR I S B ASED O N C ONTEXTS theorem � x. A = ⇒ C proof - fix x assume Ass : A . . . from Ass show C . . . qed I SAR I S B ASED O N C ONTEXTS 4
I SAR I S B ASED O N C ONTEXTS theorem � x. A = ⇒ C proof - fix x assume Ass : A . . . x and Ass are visible from Ass show C . . . inside this context qed I SAR I S B ASED O N C ONTEXTS 4- A
B EYOND I SAR C ONTEXTS Locales are extended contexts B EYOND I SAR C ONTEXTS 5
B EYOND I SAR C ONTEXTS Locales are extended contexts ➜ Locales are named B EYOND I SAR C ONTEXTS 5- A
B EYOND I SAR C ONTEXTS Locales are extended contexts ➜ Locales are named ➜ Fixed variables may have syntax B EYOND I SAR C ONTEXTS 5- B
B EYOND I SAR C ONTEXTS Locales are extended contexts ➜ Locales are named ➜ Fixed variables may have syntax ➜ It is possible to add and export theorems B EYOND I SAR C ONTEXTS 5- C
B EYOND I SAR C ONTEXTS Locales are extended contexts ➜ Locales are named ➜ Fixed variables may have syntax ➜ It is possible to add and export theorems ➜ Locale expression: combine and modify locales B EYOND I SAR C ONTEXTS 5- D
C ONTEXT E LEMENTS Locales consist of context elements . C ONTEXT E LEMENTS 6
C ONTEXT E LEMENTS Locales consist of context elements . fixes Parameter, with syntax C ONTEXT E LEMENTS 6- A
C ONTEXT E LEMENTS Locales consist of context elements . fixes Parameter, with syntax assumes Assumption C ONTEXT E LEMENTS 6- B
C ONTEXT E LEMENTS Locales consist of context elements . fixes Parameter, with syntax assumes Assumption defines Definition C ONTEXT E LEMENTS 6- C
C ONTEXT E LEMENTS Locales consist of context elements . fixes Parameter, with syntax assumes Assumption defines Definition notes Record a theorem C ONTEXT E LEMENTS 6- D
C ONTEXT E LEMENTS Locales consist of context elements . fixes Parameter, with syntax assumes Assumption defines Definition notes Record a theorem includes Import other locales (locale expressions) C ONTEXT E LEMENTS 6- E
D ECLARING L OCALES Declaring locale (named context) loc : locale loc = D ECLARING L OCALES 7
D ECLARING L OCALES Declaring locale (named context) loc : locale loc = loc 1 + Import D ECLARING L OCALES 7- A
D ECLARING L OCALES Declaring locale (named context) loc : locale loc = loc 1 + Import fixes . . . Context elements assumes . . . D ECLARING L OCALES 7- B
D ECLARING L OCALES Theorems may be stated relative to a named locale. lemma ( in loc ) P [simp]: proposition proof D ECLARING L OCALES 8
D ECLARING L OCALES Theorems may be stated relative to a named locale. lemma ( in loc ) P [simp]: proposition proof ➜ Adds theorem P to context loc . D ECLARING L OCALES 8- A
D ECLARING L OCALES Theorems may be stated relative to a named locale. lemma ( in loc ) P [simp]: proposition proof ➜ Adds theorem P to context loc . ➜ Theorem P is in the simpset in context loc . D ECLARING L OCALES 8- B
D ECLARING L OCALES Theorems may be stated relative to a named locale. lemma ( in loc ) P [simp]: proposition proof ➜ Adds theorem P to context loc . ➜ Theorem P is in the simpset in context loc . ➜ Exported theorem loc.P visible in the entire theory. D ECLARING L OCALES 8- C
D EMO : L OCALES 1 9
P ARAMETERS M UST B E C ONSISTENT ! ➜ Parameters in fixes are distinct. P ARAMETERS M UST B E C ONSISTENT ! 10
P ARAMETERS M UST B E C ONSISTENT ! ➜ Parameters in fixes are distinct. ➜ Free variables in assumes and defines occur in preceding fixes . P ARAMETERS M UST B E C ONSISTENT ! 10- A
P ARAMETERS M UST B E C ONSISTENT ! ➜ Parameters in fixes are distinct. ➜ Free variables in assumes and defines occur in preceding fixes . ➜ Defined parameters cannot occur in preceding assumes nor defines . P ARAMETERS M UST B E C ONSISTENT ! 10- B
L OCALE E XPRESSIONS Locale name: n L OCALE E XPRESSIONS 11
L OCALE E XPRESSIONS Locale name: n Rename: e q 1 . . . q n Change names of parameters in e . L OCALE E XPRESSIONS 11- A
L OCALE E XPRESSIONS Locale name: n Rename: e q 1 . . . q n Change names of parameters in e . Merge: e 1 + e 2 Context elements of e 1 , then e 2 . L OCALE E XPRESSIONS 11- B
L OCALE E XPRESSIONS Locale name: n Rename: e q 1 . . . q n Change names of parameters in e . Merge: e 1 + e 2 Context elements of e 1 , then e 2 . ➜ Syntax is lost after rename ( currently ). L OCALE E XPRESSIONS 11- C
D EMO : L OCALES 2 12
N ORMAL F ORM OF L OCALE E XPRESSIONS Locale expressions are converted to flattened lists of locale names. N ORMAL F ORM OF L OCALE E XPRESSIONS 13
N ORMAL F ORM OF L OCALE E XPRESSIONS Locale expressions are converted to flattened lists of locale names. ➜ With full parameter lists N ORMAL F ORM OF L OCALE E XPRESSIONS 13- A
N ORMAL F ORM OF L OCALE E XPRESSIONS Locale expressions are converted to flattened lists of locale names. ➜ With full parameter lists ➜ Duplicates removed N ORMAL F ORM OF L OCALE E XPRESSIONS 13- B
N ORMAL F ORM OF L OCALE E XPRESSIONS Locale expressions are converted to flattened lists of locale names. ➜ With full parameter lists ➜ Duplicates removed Allows for multiple inheritance ! N ORMAL F ORM OF L OCALE E XPRESSIONS 13- C
I NSTANTIATION Move from abstract to concrete . I NSTANTIATION 14
I NSTANTIATION Move from abstract to concrete . instantiate label : loc I NSTANTIATION 14- A
I NSTANTIATION Move from abstract to concrete . instantiate label : loc ➜ From chained fact loc t 1 . . . t n instantiate locale loc . I NSTANTIATION 14- B
I NSTANTIATION Move from abstract to concrete . instantiate label : loc ➜ From chained fact loc t 1 . . . t n instantiate locale loc . ➜ Imports all theorems of loc into current context. I NSTANTIATION 14- C
I NSTANTIATION Move from abstract to concrete . instantiate label : loc ➜ From chained fact loc t 1 . . . t n instantiate locale loc . ➜ Imports all theorems of loc into current context. • Instantiates the parameters with t 1 . . . t n . • Interprets attributes of theorems. • Prefixes theorem names with label I NSTANTIATION 14- D
I NSTANTIATION Move from abstract to concrete . instantiate label : loc ➜ From chained fact loc t 1 . . . t n instantiate locale loc . ➜ Imports all theorems of loc into current context. • Instantiates the parameters with t 1 . . . t n . • Interprets attributes of theorems. • Prefixes theorem names with label ➜ Currently only works inside Isar contexts. I NSTANTIATION 14- E
D EMO : L OCALES 3 15
P RESENTATION 16
I SABELLE ’ S B ATCH M ODE ➜ used to process and check larger number of theories I SABELLE ’ S B ATCH M ODE 17
I SABELLE ’ S B ATCH M ODE ➜ used to process and check larger number of theories ➜ no interactive niceties (no sorry, no quick and dirty) I SABELLE ’ S B ATCH M ODE 17- A
I SABELLE ’ S B ATCH M ODE ➜ used to process and check larger number of theories ➜ no interactive niceties (no sorry, no quick and dirty) ➜ controlled by file ROOT.ML and script set isatool I SABELLE ’ S B ATCH M ODE 17- B
I SABELLE ’ S B ATCH M ODE ➜ used to process and check larger number of theories ➜ no interactive niceties (no sorry, no quick and dirty) ➜ controlled by file ROOT.ML and script set isatool ➜ can save state for later use (images) I SABELLE ’ S B ATCH M ODE 17- C
I SABELLE ’ S B ATCH M ODE ➜ used to process and check larger number of theories ➜ no interactive niceties (no sorry, no quick and dirty) ➜ controlled by file ROOT.ML and script set isatool ➜ can save state for later use (images) ➜ can generate HTML and L A T EX documentation I SABELLE ’ S B ATCH M ODE 17- D
I SATOOL isatool <tool> <options> I SATOOL 18
I SATOOL isatool <tool> <options> Get help with: shows available tools isatool shows options for <tool> isatool <tool> -? I SATOOL 18- A
I SATOOL isatool <tool> <options> Get help with: shows available tools isatool shows options for <tool> isatool <tool> -? Interesting tools: create session directory isatool mkdir run make for directory/all logics make/makeall batch session usedir (documents, HTML, session graph) run L A T EX for generated sources document/latex I SATOOL 18- B
G ENERATING L A TEX FROM I SABELLE <..>/isatool usedir -d pdf HOL <session> <..>/<session>/ROOT.ML <..>/<session>/MyTheory.thy <..>/<session>/document/root.tex G ENERATING L A TEX FROM I SABELLE 19
Recommend
More recommend