• Keine Ergebnisse gefunden

What’s in Main

N/A
N/A
Protected

Academic year: 2021

Aktie "What’s in Main"

Copied!
13
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

What’s in Main

Tobias Nipkow December 12, 2021

Abstract

This document lists the main types, functions and syntax provided by theory Main. It is meant as a quick overview of what is available.

For infix operators and their precedences see the final section. The sophisticated class structure is only hinted at. For details see https:

//isabelle.in.tum.de/library/HOL/HOL.

HOL

The basic logic: x = y, True, False, ¬ P, PQ, PQ, P −→ Q,x. P,

x. P, ∃!x. P, THE x. P.

undefined :: 0a default :: 0a Syntax

x 6= y ≡ ¬ (x = y) (~=)

P ←→ QP = Q

if x then y else zIf x y z

let x = e1 in e2Let e1 (λx. e2)

Orderings

A collection of classes defining basic orderings: preorder, partial order, linear order, dense linear order and wellorder.

(2)

(≤) :: 0a0abool (<=) (<) :: 0a0abool

Least :: (0abool)0a Greatest :: (0abool)0a min :: 0a0a0a max :: 0a0a0a

top :: 0a

bot :: 0a

mono :: (0a0b)bool strict_mono :: (0a0b)bool Syntax

xyyx (>=)

x > yy < x

x≤y. P ≡ ∀x. xy −→ P

x≤y. P ≡ ∃x. xyP Similarly for <, ≥ and >

LEAST x. PLeast (λx. P) GREATEST x. PGreatest (λx. P)

Lattices

Classes semilattice, lattice, distributive lattice and complete lattice (the lat- ter in theory HOL.Set).

inf :: 0a0a0a sup :: 0a0a0a Inf :: 0a set0a Sup :: 0a set0a Syntax

Available via unbundle lattice_syntax.

x v yxy x @ yx < y x u yinf x y x t ysup x y

dAInf A

FASup A

(3)

> ≡ top

⊥ ≡ bot

Set

{} :: 0a set

insert :: 0a0a set0a set Collect :: (0abool)0a set

(∈) :: 0a0a setbool (:) (∪) :: 0a set0a set0a set (Un) (∩) :: 0a set0a set0a set (Int) S :: 0a set set0a set

T :: 0a set set0a set Pow :: 0a set0a set set UNIV :: 0a set

(‘) :: (0a0b)0a set0b set Ball :: 0a set ⇒ (0abool)bool Bex :: 0a set ⇒ (0abool)bool Syntax

{a1,. . .,an} ≡ insert a1 (. . . (insert an {}). . .)

a ∈/ A ≡ ¬(x ∈ A)

ABAB

ABA <B

ABBA

ABB < A

{x. P}Collect (λx. P)

{t | x1 . . . xn. P} ≡ {v. ∃x1 . . . xn. v = tP} Sx∈I. A ≡ S

((λx. A) ‘ I) (UN)

Sx. A ≡ S

((λx. A) ‘ UNIV) Tx∈I. A ≡ T

((λx. A) ‘ I) (INT)

Tx. A ≡ T

((λx. A) ‘ UNIV)

x∈A. PBall A (λx. P)

x∈A. PBex A (λx. P)

range ff ‘ UNIV

(4)

Fun

id :: 0a0a

(◦) ::(0a0b) ⇒ (0c0a)0c0b (o) inj_on ::(0a0b)0a setbool

inj ::(0a0b)bool surj ::(0a0b)bool bij ::(0a0b)bool

bij_betw ::(0a0b)0a set0b setbool fun_upd ::(0a0b)0a0b0a0b Syntax

f(x := y)fun_upd f x y

f(x1:=y1,. . .,xn:=yn) ≡ f(x1:=y1). . .(xn:=yn)

Hilbert_Choice

Hilbert’s selection (ε) operator: SOME x. P.

inv_into :: 0a set ⇒ (0a0b)0b0a Syntax

invinv_into UNIV

Fixed Points

Theory: HOL.Inductive.

Least and greatest fixed points in a complete lattice 0a:

lfp :: (0a0a)0a gfp :: (0a0a)0a

Note that in particular sets (0abool) are complete lattices.

Sum_Type

Type constructor +.

(5)

Inl :: 0a0a + 0b Inr :: 0a0b + 0a

(<+>) :: 0a set0b set ⇒ (0a + 0b) set

Product_Type

Types unit and ×.

() ::unit

Pair :: 0a0b0a × 0b fst :: 0a × 0b0a snd :: 0a × 0b0b

case_prod ::(0a0b0c)0a × 0b0c curry ::(0a × 0b0c)0a0b0c

Sigma :: 0a set ⇒ (0a0b set) ⇒ (0a × 0b) set Syntax

(a, b)Pair a b

λ(x, y). tcase_prod (λx y. t) A × BSigma A (λ_. B)

Pairs may be nested. Nesting to the right is printed as a tuple, e.g. (a, b, c) is really (a, (b, c)). Pattern matching with pairs and tuples extends to all binders, e.g. ∀(x, y)∈A. P, {(x, y). P}, etc.

Relation

converse :: (0a × 0b) set ⇒ (0b × 0a) set

(O) :: (0a × 0b) set ⇒ (0b × 0c) set ⇒ (0a × 0c) set (‘‘) :: (0a × 0b) set0a set0b set

inv_image :: (0a × 0a) set ⇒ (0b0a) ⇒ (0b × 0b) set Id_on :: 0a set ⇒ (0a × 0a) set

Id :: (0a × 0a) set

Domain :: (0a × 0b) set0a set Range :: (0a × 0b) set0b set Field :: (0a × 0a) set0a set

refl_on :: 0a set ⇒ (0a × 0a) setbool refl :: (0a × 0a) setbool

sym :: (0a × 0a) setbool

(6)

antisym :: (0a × 0a) setbool trans :: (0a × 0a) setbool irrefl :: (0a × 0a) setbool

total_on :: 0a set ⇒ (0a × 0a) setbool total :: (0a × 0a) setbool

Syntax

r−1converse r (^-1)

Type synonym 0a rel = (0a × 0a) set

Equiv_Relations

equiv :: 0a set ⇒ (0a × 0a) setbool (//) :: 0a set ⇒ (0a × 0a) set0a set set congruent :: (0a × 0a) set ⇒ (0a0b)bool

congruent2 :: (0a × 0a) set ⇒ (0b × 0b) set ⇒ (0a0b0c)bool Syntax

f respects rcongruent r f f respects2 rcongruent2 r r f

Transitive_Closure

rtrancl ::(0a × 0a) set ⇒ (0a × 0a) set trancl ::(0a × 0a) set ⇒ (0a × 0a) set reflcl ::(0a × 0a) set ⇒ (0a × 0a) set acyclic ::(0a × 0a) setbool

(^^) ::(0a × 0a) setnat ⇒ (0a × 0a) set Syntax

rrtrancl r (^*) r+trancl r (^+) r=reflcl r (^=)

(7)

Algebra

Theories HOL.Groups, HOL.Rings, HOL.Fields and HOL.Divides define a large collection of classes describing common algebraic structures from semi- groups up to fields. Everything is done in terms of overloaded operators:

0 :: 0a 1 :: 0a

(+) :: 0a0a0a (−) :: 0a0a0a

uminus :: 0a0a (-) (∗) :: 0a0a0a

inverse :: 0a0a (div) :: 0a0a0a abs :: 0a0a sgn :: 0a0a

(dvd) :: 0a0abool (div) :: 0a0a0a (mod) :: 0a0a0a Syntax

|x| ≡ abs x

Nat

datatype nat = 0 | Suc nat

(+) (−) (∗) (^) (div) (mod) (dvd) (≤) (<) min max Min Max

of_nat :: nat0a

(^^) :: (0a0a)nat0a0a

Int

Type int

(+) (−) uminus (∗) (^) (div) (mod) (dvd) (≤) (<) min max Min Max

abs sgn

(8)

nat ::intnat of_int ::int0a

š :: 0a set (Ints) Syntax

intof_nat

Finite_Set

finite :: 0a setbool card :: 0a setnat

Finite_Set.fold :: (0a0b0b)0b0a set0b

Lattices_Big

Min :: 0a set0a Max :: 0a set0a

arg_min :: (0a0b) ⇒ (0abool)0a

is_arg_min :: (0a0b) ⇒ (0abool)0abool arg_max :: (0a0b) ⇒ (0abool)0a

is_arg_max :: (0a0b) ⇒ (0abool)0abool Syntax

ARG_MIN f x. Parg_min f (λx. P) ARG_MAX f x. Parg_max f (λx. P)

Groups_Big

sum :: (0a0b)0a set0b prod :: (0a0b)0a set0b Syntax

P Asum (λx. x) A (SUM)

Px∈A. tsum (λx. t) A Px|P. t ≡ P

x | P. t Similarly for Q

instead of P

(PROD)

(9)

Wellfounded

wf ::(0a × 0a) setbool Wellfounded.acc ::(0a × 0a) set0a set measure ::(0anat) ⇒ (0a × 0a) set

(<∗lex∗>) ::(0a × 0a) set ⇒ (0b × 0b) set ⇒ ((0a × 0b) × 0a × 0b) set (<∗mlex∗>) ::(0anat) ⇒ (0a × 0a) set ⇒ (0a × 0a) set

less_than ::(nat × nat) set pred_nat ::(nat × nat) set

Set_Interval

lessThan :: 0a0a set atMost :: 0a0a set greaterThan :: 0a0a set atLeast :: 0a0a set greaterThanLessThan :: 0a0a0a set atLeastLessThan :: 0a0a0a set greaterThanAtMost :: 0a0a0a set atLeastAtMost :: 0a0a0a set Syntax

{..<y} ≡ lessThan y {..y} ≡ atMost y

{x<..} ≡ greaterThan x

{x..} ≡ atLeast x

{x<..<y} ≡ greaterThanLessThan x y

{x..<y} ≡ atLeastLessThan x y

{x<..y} ≡ greaterThanAtMost x y

{x..y} ≡ atLeastAtMost x y Si≤n. A ≡ S

i ∈ {..n}. A

Si<n. A ≡ S

i ∈ {..<n}. A Similarly for T

instead of S

Px = a..b. tsum (λx. t) {a..b}

Px = a..<b. tsum (λx. t) {a..<b}

Px≤b. tsum (λx. t) {..b}

Px<b. tsum (λx. t) {..<b}

Similarly for Q

instead of P

(10)

Power

(^) :: 0anat0a

Option

datatype 0a option = None | Some 0a the :: 0a option0a

map_option :: (0a0b)0a option0b option set_option :: 0a option0a set

Option.bind :: 0a option ⇒ (0a0b option)0b option

List

datatype 0a list = [] | (#) 0a (0a list) (@) :: 0a list0a list0a list butlast :: 0a list0a list

concat :: 0a list list0a list distinct :: 0a listbool

drop ::nat0a list0a list

dropWhile ::(0abool) ⇒ 0a list0a list filter ::(0abool) ⇒ 0a list0a list find ::(0abool) ⇒ 0a list0a option fold ::(0a0b0b)0a list0b0b foldr ::(0a0b0b)0a list0b0b foldl ::(0a0b0a)0a0b list0a hd :: 0a list0a

last :: 0a list0a length :: 0a listnat

lenlex ::(0a × 0a) set ⇒ (0a list × 0a list) set lex ::(0a × 0a) set ⇒ (0a list × 0a list) set

lexn ::(0a × 0a) setnat ⇒ (0a list × 0a list) set lexord ::(0a × 0a) set ⇒ (0a list × 0a list) set

listrel ::(0a × 0b) set ⇒ (0a list × 0b list) set listrel1 ::(0a × 0a) set ⇒ (0a list × 0a list) set lists :: 0a set0a list set

(11)

listset :: 0a set list0a list set sum_list :: 0a list0a

prod_list :: 0a list0a

list_all2 :: (0a0bbool)0a list0b listbool list_update :: 0a listnat0a0a list

map :: (0a0b)0a list0b list measures :: (0anat) list ⇒ (0a × 0a) set (!) :: 0a listnat0a

nths :: 0a listnat set0a list remdups :: 0a list0a list

removeAll :: 0a0a list0a list remove1 :: 0a0a list0a list replicate :: nat0a0a list rev :: 0a list0a list

rotate :: nat0a list0a list rotate1 :: 0a list0a list

set :: 0a list0a set

shuffles :: 0a list0a list0a list set sort :: 0a list0a list

sorted :: 0a listbool

sorted_wrt :: (0a0abool)0a listbool splice :: 0a list0a list0a list

take :: nat0a list0a list

takeWhile :: (0abool)0a list0a list tl :: 0a list0a list

upt :: natnatnat list upto :: intintint list

zip :: 0a list0b list ⇒ (0a × 0b) list Syntax

[x1,. . .,xn] ≡ x1 #. . . # xn # []

[m..<n] ≡ upt m n [i..j] ≡ upto i j

xs[n := x] ≡ list_update xs n x

Px←xs. elistsum (map (λx. e) xs)

Filter input syntax [pat ← e. b], where pat is a tuple pattern, which stands for filter (λpat. b) e.

List comprehension input syntax: [e. q1, . . ., qn] where each qualifier qi is either a generator pate or a guard, i.e. boolean expression.

(12)

Map

Maps model partial functions and are often used as finite tables. However, the domain of a map may be infinite.

Map.empty :: 0a0b option

(++) :: (0a0b option) ⇒ (0a0b option)0a0b option (◦m) :: (0a0b option) ⇒ (0c0a option)0c0b option (|‘) :: (0a0b option)0a set0a0b option

dom :: (0a0b option)0a set ran :: (0a0b option)0b set

(⊆m) :: (0a0b option) ⇒ (0a0b option)bool map_of :: (0a × 0b) list0a0b option

map_upds :: (0a0b option)0a list0b list0a0b option Syntax

Map.empty ≡ λ_. None

m(x 7→ y)m(x:=Some y)

m(x17→y1,. . .,xn7→yn) ≡ m(x17→y1). . .(xn7→yn)

[x17→y1,. . .,xn7→yn] ≡ Map.empty(x17→y1,. . .,xn7→yn) m(xs [7→] ys)map_upds m xs ys

(13)

Infix operators in Main

Operator precedence associativity

Meta-logic =⇒ 1 right

≡ 2

Logic ∧ 35 right

∨ 30 right

−→, ←→ 25 right

=,6= 50 left

Orderings ≤, <, ≥, > 50

Sets ⊆, ⊂,⊇, ⊃ 50

∈, ∈/ 50

∩ 70 left

∪ 65 left

Functions and Relations ◦ 55 left

90 right

O 75 right

‘‘ 90 right

^^ 80 right

Numbers +,− 65 left

∗, / 70 left

div, mod 70 left

^ 80 right

dvd 50

Lists #,@ 65 right

! 100 left

Referenzen

ÄHNLICHE DOKUMENTE

Am achmittag fanden dann zwei Workshops statt. Der eine beschäf- tigte sich mit den Hochschüler- schaften in den einzelnen Ländern und den Einflußmäglichkeiten dieser. Im zweiten

OMICRON ist ein international ausgerichtetes, expan- dierendes Unternehmen, das sich auf die Entwicklung und Vermarktung von innovativer Prüftechnik für Schutz-

c) At the moment, programs of the source language are just expressions. We now want to extend the lan- guage with assignments. As seen in the tutorial, the semantics of expressions

Andrews, An Introduction to Mathematical Logic and Type Theory: To Truth Through Proof, Academic..

• (λx. J interprets all constants as defined in the lecture and + as the usual addition on natural numbers.. Exercises 2 and 4 will only be discussed in the exercise meeting, if

Map ’a ~=&gt; ’b partielle Abbildungen (’a =&gt; ’b option). ∗ in

Hieraus erhält man die den Beobachtungen hinzuzufiigenden Redu ctionen auf das Centrum des

März 1896 in Ostfriesland Importirt aus Ostfriesland durch de Beer Vater