locales
play

locales C ONTENT I SAR I S B ASED O N C ONTEXTS Intro & - PowerPoint PPT Presentation

L AST T IME Syntax and semantics of IMP Hoare logic rules Soundness of Hoare logic NICTA Advanced Course Verification conditions Slide 1 Theorem Proving Slide 3 Principles, Techniques, Applications Example program proofs


  1. L AST T IME ➜ Syntax and semantics of IMP ➜ Hoare logic rules ➜ Soundness of Hoare logic NICTA Advanced Course ➜ Verification conditions Slide 1 Theorem Proving Slide 3 Principles, Techniques, Applications ➜ Example program proofs locales C ONTENT I SAR I S B ASED O N C ONTEXTS ➜ Intro & motivation, getting started with Isabelle theorem � x. A = ⇒ C ➜ Foundations & Principles proof - • Lambda Calculus fix x • Higher Order Logic, natural deduction assume Ass : A • Term rewriting Slide 2 Slide 4 . . . x and Ass are visible ➜ Proof & Specification Techniques from Ass show C . . . inside this context • Inductively defined sets, rule induction qed • Datatypes, recursion, induction • More recursion, Calculational reasoning • Hoare logic, proofs about programs • Locales, Presentation L AST T IME 1 B EYOND I SAR C ONTEXTS 2

  2. D ECLARING L OCALES B EYOND I SAR C ONTEXTS Locales are extended contexts Declaring locale (named context) loc : ➜ Locales are named locale loc = ➜ Fixed variables may have syntax loc 1 + Import ➜ It is possible to add and export theorems Slide 5 Slide 7 fixes . . . Context elements ➜ Locale expression: combine and modify locales assumes . . . D ECLARING L OCALES C ONTEXT E LEMENTS Theorems may be stated relative to a named locale. Locales consist of context elements . fixes Parameter, with syntax lemma ( in loc ) P [simp]: proposition assumes Assumption proof defines Definition Slide 6 Slide 8 notes Record a theorem ➜ Adds theorem P to context loc . includes Import other locales (locale expressions) ➜ Theorem P is in the simpset in context loc . ➜ Exported theorem loc.P visible in the entire theory. D ECLARING L OCALES 3 4

  3. 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 . Slide 9 Slide 11 D EMO : L OCALES 1 ➜ Syntax is lost after rename ( currently ). 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 . Slide 10 Slide 12 D EMO : L OCALES 2 L OCALE E XPRESSIONS 5 N ORMAL F ORM OF L OCALE E XPRESSIONS 6

  4. 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 ! Slide 13 Slide 15 D EMO : L OCALES 3 I NSTANTIATION Move from abstract to concrete . instantiate label : loc ➜ From chained fact loc t 1 . . . t n instantiate locale loc . Slide 14 Slide 16 P RESENTATION ➜ 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. 7 I SABELLE ’ S B ATCH M ODE 8

  5. I SABELLE ’ S B ATCH M ODE G ENERATING L A TEX FROM I SABELLE <..>/isatool usedir -d pdf HOL <session> ➜ used to process and check larger number of theories <..>/<session>/ROOT.ML ➜ no interactive niceties (no sorry, no quick and dirty) <..>/<session>/MyTheory.thy <..>/<session>/document/root.tex ➜ controlled by file ROOT.ML and script set isatool ➜ can save state for later use (images) ➜ In ROOT.ML : Slide 17 Slide 19 no\_document use_thy "MyLibrary"; ➜ can generate HTML and L A T EX documentation use_thy "MyTheory"; ➜ In document/root.tex : • include Isabelle style packages (isabelle.sty, isabellesym.sty) • include generated files session.tex (for all theories) or MyTheory.tex I SATOOL isatool <tool> <options> Get help with: shows available tools isatool shows options for <tool> isatool <tool> -? Slide 18 Slide 20 D EMO : E XAMPLE Interesting tools: isatool mkdir create session directory 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 G ENERATING L A TEX FROM I SABELLE 9 L ARGE D EVELOPMENTS 10

  6. L ARGE D EVELOPMENTS A NTIQUOTATIONS Inside L A T EX you can go back to Isabelle commands and syntax. Creating Images: Useful Antiquotations: <..>/<session>/isatool usedir -b HOL <session> @ { typ τ } print type τ <..>/<session>/ROOT.ML @ { term t } print term t <..>/<session>/MyLibrary.thy Slide 21 Slide 23 @ { prop φ } print proposition φ @ { prop [display] φ } print proposition φ with linebreaks ➜ Processes ROOT.ML @ { prop [source] φ } check proposition φ , print its input ➜ Saves state after processing in @ { thm a } print fact a ˜/isabelle/heaps/<ML-system>/HOL-<session> @ { thm a [no vars] } print fact a , fixing schematic variables ➜ Makes HOL-<session> available as logic in menu Isabelle → Logics @ { thm [source] a } check availability of a , print its name ➜ Direct start of Isabelle with new logic: @ { text s } print uninterpreted text s Isabelle -l HOL-<session> W RITING ABOUT I SABELLE T HEORIES M ARKUP C OMMANDS ➜ document structure commands: To document definitions and proofs: header section subsection subsubsection ➜ put comments explanations directly in original theory (meaning defined in isabelle.sty ) ➜ keep explanations short and to the point ➜ normal text ➜ formal definitions, lemmas, syntax should speak for themself text {∗ . . . ∗} text raw {∗ . . . ∗} Slide 22 Slide 24 To write a paper/thesis about a formal development ➜ text inside proofs ➜ use a separate theory/document on top of the development txt {∗ . . . ∗} txt raw {∗ . . . ∗} ➜ only talk about the interesting parts ➜ formal comments -- {∗ . . . ∗} ➜ use antiquoations for theorems and definitions ➜ make text invisible: ➜ use extra locales, definitions, syntax for polish ( ∗ < ∗ ) . . . ( ∗ > ∗ ) ➜ make full proof document available separately A NTIQUOTATIONS 11 P OLISH 12

  7. P OLISH Know your audience. Use the right notation. ➜ Change L A T EX symbol interpretations \renewcommand{\isasymLongrightarrow} {\isamath{\longrightarrow}} Slide 25 Slide 27 ➜ Declare special L D EMO A T EX output syntax: syntax (latex) Cons :: ”’a ⇒ ’a list ⇒ ’a list” (” · / ” [66,65] 65) ➜ Use translations to change output syntax: syntax (latex) notEx :: ”(’a ⇒ bool) ⇒ bool” (binder ” \ < notex > ” 10) < = ” ¬ ( ∃ x. P ) ” translations ” \ < notex > x. P” in document/root.tex: \newcommand{\isasymnotex}{\isamath{\neg\exists}} U SING L OCALES W E HAVE SEEN TODAY ... making large developments more accessible Math textbook: ➜ Locale Declarations + Theorems in Locales Let ( A, · , 0) in the following be a group with x · y = y · x ➜ Locale Expressions + Inheritance Isabelle: ➜ Locale Instantiation ➜ Generating L ➜ Use locales to formalize contexts A T EX Slide 26 Slide 28 ➜ Antiquotations are sensitive to current locale context ➜ Writing a thesis/paper in Isabelle ➜ Example: locale agroup = group + assumes com: ” x · y = y · x ” . . . ( ∗ < ∗ ) lemma (in agroup) True ( ∗ > ∗ ) txt {∗ . . . ∗} ( ∗ < ∗ ) oops ( ∗ > ∗ ) 13 E XERCISES 14

  8. E XERCISES ➜ No Exercise Today Theorem Proving Slide 29 Principles, Techniques, Applications The End E XERCISES 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend