User Tools

Site Tools


best_practices

This is an old revision of the document!


Best Practices

This is a collection of hints and conventions that enable you to write compilable and useful functions and formula faster. There are some obvious, syntactical issues but also more subtle things you should keep in mind when building a theory.

Syntax

Parentheses

Some syntactical constructs of Isabelle/HOL are not as well-structures as you might think so you want to put parentheses around them. In particular, these applies to

  • Conditions: (if P then x else y)
  • Case distinctions: (case x of p1 ⇒ e1 | p2 ⇒ e2)
  • Constructors (in patterns): (x#xs)

In all of these cases it is generally inadvisable to leave out the outermost parentheses.

You might also run into problems by implicitly put parentheses (by precedence rules).

As an example, consider quantifiers: Is to be read as or as ? One might expect the latter (which is commonly done in mathematics) but Isabelle does the former.

If in doubt, check [Isabelle → Settings → Display → Show Brackets] and find out what exactly happens.

Modelling

Sets and Functions

Sets and (boolean) functions are equivalent. However, using both worlds in parallel, e.g. using sometimes and sometimes or even , you might run into issues during proofs as Isabelle has to perform certain steps in order to switch from one point of view to the other. Therefore you better choose wether to express your statements in predicate or in set notation and stick with it.

best_practices.1334324110.txt.gz · Last modified: 2012/04/13 15:35 by paddy