![Page 1: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/1.jpg)
Overview of Isabelle/HOL
– p.1
![Page 2: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/2.jpg)
System Architecture
Isabelle generic theorem prover
– p.2
![Page 3: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/3.jpg)
System Architecture
Isabelle generic theorem prover
Standard ML implementation language
– p.2
![Page 4: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/4.jpg)
System Architecture
Isabelle/HOL Isabelle instance for HOL
Isabelle generic theorem prover
Standard ML implementation language
– p.2
![Page 5: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/5.jpg)
System Architecture
ProofGeneral (X)Emacs based interface
Isabelle/HOL Isabelle instance for HOL
Isabelle generic theorem prover
Standard ML implementation language
– p.2
![Page 6: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/6.jpg)
HOL
HOL = Higher-Order Logic
– p.3
![Page 7: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/7.jpg)
HOL
HOL = Higher-Order LogicHOL = Functional programming + Logic
– p.3
![Page 8: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/8.jpg)
HOL
HOL = Higher-Order LogicHOL = Functional programming + Logic
HOL has• datatypes• recursive functions• logical operators (∧, −→, ∀, ∃, . . . )
– p.3
![Page 9: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/9.jpg)
HOL
HOL = Higher-Order LogicHOL = Functional programming + Logic
HOL has• datatypes• recursive functions• logical operators (∧, −→, ∀, ∃, . . . )
HOL is a programming language!
– p.3
![Page 10: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/10.jpg)
HOL
HOL = Higher-Order LogicHOL = Functional programming + Logic
HOL has• datatypes• recursive functions• logical operators (∧, −→, ∀, ∃, . . . )
HOL is a programming language!
Higher-order = functions are values, too!
– p.3
![Page 11: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/11.jpg)
Formulae
Syntax (in decreasing priority):
form ::= (form) | term = term | ¬form
| form ∧ form | form ∨ form | form −→ form
| ∀x. form | ∃x. form
– p.4
![Page 12: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/12.jpg)
Formulae
Syntax (in decreasing priority):
form ::= (form) | term = term | ¬form
| form ∧ form | form ∨ form | form −→ form
| ∀x. form | ∃x. form
Scope of quantifiers: as far to the right as possible
– p.4
![Page 13: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/13.jpg)
Formulae
Syntax (in decreasing priority):
form ::= (form) | term = term | ¬form
| form ∧ form | form ∨ form | form −→ form
| ∀x. form | ∃x. form
Scope of quantifiers: as far to the right as possible
Examples• ¬ A ∧ B ∨ C ≡ ((¬ A) ∧ B) ∨ C
– p.4
![Page 14: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/14.jpg)
Formulae
Syntax (in decreasing priority):
form ::= (form) | term = term | ¬form
| form ∧ form | form ∨ form | form −→ form
| ∀x. form | ∃x. form
Scope of quantifiers: as far to the right as possible
Examples• ¬ A ∧ B ∨ C ≡ ((¬ A) ∧ B) ∨ C• A = B ∧ C ≡ (A = B) ∧ C
– p.4
![Page 15: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/15.jpg)
Formulae
Syntax (in decreasing priority):
form ::= (form) | term = term | ¬form
| form ∧ form | form ∨ form | form −→ form
| ∀x. form | ∃x. form
Scope of quantifiers: as far to the right as possible
Examples• ¬ A ∧ B ∨ C ≡ ((¬ A) ∧ B) ∨ C• A = B ∧ C ≡ (A = B) ∧ C• ∀ x. P x ∧ Q x ≡ ∀ x. (P x ∧ Q x)
– p.4
![Page 16: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/16.jpg)
Formulae
Syntax (in decreasing priority):
form ::= (form) | term = term | ¬form
| form ∧ form | form ∨ form | form −→ form
| ∀x. form | ∃x. form
Scope of quantifiers: as far to the right as possible
Examples• ¬ A ∧ B ∨ C ≡ ((¬ A) ∧ B) ∨ C• A = B ∧ C ≡ (A = B) ∧ C• ∀ x. P x ∧ Q x ≡ ∀ x. (P x ∧ Q x)• ∀ x. ∃ y. P x y ∧ Q x ≡ ∀ x. (∃ y. (P x y ∧ Q x))
– p.4
![Page 17: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/17.jpg)
Formulae
Abbreviation: ∀ x y. P x y ≡ ∀ x. ∀ y. P x y
– p.5
![Page 18: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/18.jpg)
Formulae
Abbreviation: ∀ x y. P x y ≡ ∀ x. ∀ y. P x y (∀ , ∃ , λ, . . . )
– p.5
![Page 19: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/19.jpg)
Formulae
Abbreviation: ∀ x y. P x y ≡ ∀ x. ∀ y. P x y (∀ , ∃ , λ, . . . )
Hiding and renaming:∀ x y. (∀ x. P x y) ∧ Q x y ≡ ∀ x0 y. (∀ x1. P x1 y) ∧ G x0 y
– p.5
![Page 20: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/20.jpg)
Formulae
Abbreviation: ∀ x y. P x y ≡ ∀ x. ∀ y. P x y (∀ , ∃ , λ, . . . )
Hiding and renaming:∀ x y. (∀ x. P x y) ∧ Q x y ≡ ∀ x0 y. (∀ x1. P x1 y) ∧ G x0 y
Parentheses:• ∧, ∨ and −→ associate to the right:
A ∧ B ∧ C ≡ A ∧ (B ∧ C)
– p.5
![Page 21: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/21.jpg)
Formulae
Abbreviation: ∀ x y. P x y ≡ ∀ x. ∀ y. P x y (∀ , ∃ , λ, . . . )
Hiding and renaming:∀ x y. (∀ x. P x y) ∧ Q x y ≡ ∀ x0 y. (∀ x1. P x1 y) ∧ G x0 y
Parentheses:• ∧, ∨ and −→ associate to the right:
A ∧ B ∧ C ≡ A ∧ (B ∧ C)
• A −→ B −→ C ≡ A −→ (B −→ C) 6≡ (A −→ B) −→ C !
– p.5
![Page 22: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/22.jpg)
Warning
Quantifiers have low priority and need to be parenthesized:
! P ∧ ∀ x. Q x ; P ∧ (∀ x. Q x) !
– p.6
![Page 23: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/23.jpg)
Types and Terms
– p.7
![Page 24: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/24.jpg)
Types
Syntax:
τ ::= (τ)
| bool | nat | . . . base types
– p.8
![Page 25: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/25.jpg)
Types
Syntax:
τ ::= (τ)
| bool | nat | . . . base types| ’a | ’b | . . . type variables
– p.8
![Page 26: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/26.jpg)
Types
Syntax:
τ ::= (τ)
| bool | nat | . . . base types| ’a | ’b | . . . type variables| τ ⇒ τ total functions
– p.8
![Page 27: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/27.jpg)
Types
Syntax:
τ ::= (τ)
| bool | nat | . . . base types| ’a | ’b | . . . type variables| τ ⇒ τ total functions| τ × τ pairs (ascii: * )
– p.8
![Page 28: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/28.jpg)
Types
Syntax:
τ ::= (τ)
| bool | nat | . . . base types| ’a | ’b | . . . type variables| τ ⇒ τ total functions| τ × τ pairs (ascii: * )| τ list lists
– p.8
![Page 29: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/29.jpg)
Types
Syntax:
τ ::= (τ)
| bool | nat | . . . base types| ’a | ’b | . . . type variables| τ ⇒ τ total functions| τ × τ pairs (ascii: * )| τ list lists| . . . user-defined types
– p.8
![Page 30: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/30.jpg)
Types
Syntax:
τ ::= (τ)
| bool | nat | . . . base types| ’a | ’b | . . . type variables| τ ⇒ τ total functions| τ × τ pairs (ascii: * )| τ list lists| . . . user-defined types
Parentheses: T1 ⇒ T2 ⇒ T3 ≡ T1 ⇒ (T2 ⇒ T3)
– p.8
![Page 31: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/31.jpg)
Terms: Basic syntax
Syntax:
term ::= (term)
| a constant or variable (identifier)| term term function application| λx. term function “abstraction”
– p.9
![Page 32: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/32.jpg)
Terms: Basic syntax
Syntax:
term ::= (term)
| a constant or variable (identifier)| term term function application| λx. term function “abstraction”| . . . lots of syntactic sugar
– p.9
![Page 33: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/33.jpg)
Terms: Basic syntax
Syntax:
term ::= (term)
| a constant or variable (identifier)| term term function application| λx. term function “abstraction”| . . . lots of syntactic sugar
Examples: f (g x) y h (λx. f (g x))
– p.9
![Page 34: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/34.jpg)
Terms: Basic syntax
Syntax:
term ::= (term)
| a constant or variable (identifier)| term term function application| λx. term function “abstraction”| . . . lots of syntactic sugar
Examples: f (g x) y h (λx. f (g x))
Parantheses: f a1 a2 a3 ≡ ((f a1) a2) a3
– p.9
![Page 35: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/35.jpg)
λ-calculus on one slide
Informal notation: t[x]
– p.10
![Page 36: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/36.jpg)
λ-calculus on one slide
Informal notation: t[x]
• Function application:f a is the call of function f with argument a
– p.10
![Page 37: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/37.jpg)
λ-calculus on one slide
Informal notation: t[x]
• Function application:f a is the call of function f with argument a
• Function abstraction:λx.t[x] is the function with formal parameter x andbody/result t[x], i.e. x 7→ t[x].
– p.10
![Page 38: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/38.jpg)
λ-calculus on one slide
Informal notation: t[x]
• Function application:f a is the call of function f with argument a
• Function abstraction:λx.t[x] is the function with formal parameter x andbody/result t[x], i.e. x 7→ t[x].
• Computation:Replace formal by actual parameter (“β-reduction”):(λx.t[x]) a −→β t[a]
– p.10
![Page 39: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/39.jpg)
λ-calculus on one slide
Informal notation: t[x]
• Function application:f a is the call of function f with argument a
• Function abstraction:λx.t[x] is the function with formal parameter x andbody/result t[x], i.e. x 7→ t[x].
• Computation:Replace formal by actual parameter (“β-reduction”):(λx.t[x]) a −→β t[a]
Example: (λ x. x + 5) 3 −→β (3 + 5)
– p.10
![Page 40: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/40.jpg)
−→β in Isabelle: Don’t worry, be happy
Isabelle performs β-reduction automatically
Isabelle considers (λx.t[x])a and t[a] equivalent
– p.11
![Page 41: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/41.jpg)
Terms and Types
Terms must be well-typed(the argument of every function call must be of the right type)
– p.12
![Page 42: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/42.jpg)
Terms and Types
Terms must be well-typed(the argument of every function call must be of the right type)
Notation: t :: τ means t is a well-typed term of type τ .
– p.12
![Page 43: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/43.jpg)
Type inference
Isabelle automatically computes (“infers”) the type of eachvariable in a term.
– p.13
![Page 44: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/44.jpg)
Type inference
Isabelle automatically computes (“infers”) the type of eachvariable in a term.
In the presence of overloaded functions (functions withmultiple types) not always possible.
– p.13
![Page 45: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/45.jpg)
Type inference
Isabelle automatically computes (“infers”) the type of eachvariable in a term.
In the presence of overloaded functions (functions withmultiple types) not always possible.
User can help with type annotations inside the term.
Example: f (x::nat)
– p.13
![Page 46: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/46.jpg)
Currying
Thou shalt curry your functions
– p.14
![Page 47: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/47.jpg)
Currying
Thou shalt curry your functions
• Curried: f :: τ1 ⇒ τ2 ⇒ τ
• Tupled: f’ :: τ1 × τ2 ⇒ τ
– p.14
![Page 48: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/48.jpg)
Currying
Thou shalt curry your functions
• Curried: f :: τ1 ⇒ τ2 ⇒ τ
• Tupled: f’ :: τ1 × τ2 ⇒ τ
Advantage: partial application f a1 with a1 :: τ1
– p.14
![Page 49: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/49.jpg)
Terms: Syntactic sugar
Some predefined syntactic sugar:
• Infix: +, -, * , #, @, . . .• Mixfix: if _ then _ else _, case _ of , . . .
– p.15
![Page 50: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/50.jpg)
Terms: Syntactic sugar
Some predefined syntactic sugar:
• Infix: +, -, * , #, @, . . .• Mixfix: if _ then _ else _, case _ of , . . .
Prefix binds more strongly than infix:
! f x + y ≡ (f x) + y 6≡ f (x + y) !
– p.15
![Page 51: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/51.jpg)
Base types: bool, nat, list
– p.16
![Page 52: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/52.jpg)
Type bool
Formulae = terms of type bool
– p.17
![Page 53: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/53.jpg)
Type bool
Formulae = terms of type bool
True :: boolFalse :: bool∧, ∨, . . . :: bool ⇒ bool ⇒ bool...
– p.17
![Page 54: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/54.jpg)
Type bool
Formulae = terms of type bool
True :: boolFalse :: bool∧, ∨, . . . :: bool ⇒ bool ⇒ bool...
if-and-only-if: =
– p.17
![Page 55: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/55.jpg)
Type nat
0 :: natSuc :: nat ⇒ nat+, *, ... :: nat ⇒ nat ⇒ nat...
– p.18
![Page 56: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/56.jpg)
Type nat
0 :: natSuc :: nat ⇒ nat+, *, ... :: nat ⇒ nat ⇒ nat...
! Numbers and arithmetic operations are overloaded:0,1,2,... :: ’a, + :: ’a ⇒ ’a ⇒ ’a
You need type annotations: 1 :: nat, x + (y::nat)
– p.18
![Page 57: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/57.jpg)
Type nat
0 :: natSuc :: nat ⇒ nat+, *, ... :: nat ⇒ nat ⇒ nat...
! Numbers and arithmetic operations are overloaded:0,1,2,... :: ’a, + :: ’a ⇒ ’a ⇒ ’a
You need type annotations: 1 :: nat, x + (y::nat)
. . . unless the context is unambiguous: Suc z
– p.18
![Page 58: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/58.jpg)
Type list
• [] : empty list
• x # xs: list with first element x ("head")and rest xs ("tail")
• Syntactic sugar: [x1,. . . ,xn]
– p.19
![Page 59: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/59.jpg)
Type list
• [] : empty list
• x # xs: list with first element x ("head")and rest xs ("tail")
• Syntactic sugar: [x1,. . . ,xn]
Large library:hd, tl, map, length, filter, set, nth, take, drop, distinct, . . .
Don’t reinvent, reuse!; HOL/List.thy
– p.19
![Page 60: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/60.jpg)
Isabelle Theories
– p.20
![Page 61: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/61.jpg)
Theory = Module
Syntax: theory MyTh
imports ImpTh1 . . . ImpThn
begin
(declarations, definitions, theorems, proofs, ...)∗
end
• MyTh: name of theory. Must live in file MyTh.thy
• ImpThi: name of imported theories. Import transitive.
– p.21
![Page 62: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/62.jpg)
Theory = Module
Syntax: theory MyTh
imports ImpTh1 . . . ImpThn
begin
(declarations, definitions, theorems, proofs, ...)∗
end
• MyTh: name of theory. Must live in file MyTh.thy
• ImpThi: name of imported theories. Import transitive.
Usually: theory MyTh
imports Main...
– p.21
![Page 63: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/63.jpg)
Proof General
An Isabelle Interface
by David Aspinall
– p.22
![Page 64: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/64.jpg)
Proof General
Customized version of (x)emacs:• all of emacs (info: C-h i )• Isabelle aware (when editing .thy files)• mathematical symbols (“x-symbols”)
– p.23
![Page 65: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/65.jpg)
X-Symbols
Input of funny symbols in Proof General• via menu (“X-Symbol”)• via ascii encoding (similar to LATEX): \<and> , \<or> , . . .
• via abbreviation: /\ , \/ , --> , . . .
x-symbol ∀ ∃ λ ¬ ∧ ∨ −→ ⇒
ascii (1) \<forall> \<exists> \<lambda> \<not> /\ \/ --> =>
ascii (2) ALL EX % ˜ & |
(1) is converted to x-symbol, (2) stays ascii.
– p.24
![Page 66: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/66.jpg)
Finding theorems
1. Click on Find button
2. Input search pattern (e.g. “_ & True”)
– p.25
![Page 67: Overview of Isabelle/HOL - Uppsala University · Type inference Isabelle automatically computes (“infers”) the type of each variable in a term. In the presence of overloaded functions](https://reader035.vdocument.in/reader035/viewer/2022063015/5fd3e5165eb70866ba3065a7/html5/thumbnails/67.jpg)
Demo: terms and types
– p.26