Thứ Bảy, 30 tháng 3, 2013

Coffee shop songs


Coffee House Music Strategies

Offering amazing blends of coffee and competitive prices to customers are a few of the elements that make a successful coffee shop. This is the reason why coffee shops install the right kind of lighting, plenty of comfortable chairs and sofas, and free internet.
Coffee Shop Music
Another element that makes coffee shops really interesting to coffee lovers is the background music. Coffee shop music is also a prerequisite when running a caf‚ because it creates a relaxing interior for the customers. Without music, customers may find the coffee shop bland and boring and they may leave after they have ordered their drink. As such, it is very important to play music while people are enjoying their coffee. Of course it is very important that music is appropriate for the whole place too.
Playing the Right Kind of Music
Playing music must not be main idea just to convince customers to stay. It is the right kind of music that will convince customers to go back for more. Playing the wrong kind of melody will just shoo customers away. Thus it is very important that customers will agree to the music being played on the background.
Important Link
To pick which kind of beat to play while customers are dining, the melody must be soothing to the ears. It can be an upbeat or a slow music as long as customer find it very relaxing when they dine inside the coffee shop. Right now, there is a genre called coffee house music which may be composed of house music, down tempo, instrumentals, and other genres with good melody.
It is also important that the melody is ideal for the customers currently dining inside the place. It must also remain as music for the background and not the main focus of the coffee shop. Remember that people go to drink their favorite blend and relax. As such, the music must enhance these elements so people could enjoy their time inside the coffee shop. People would come back for more if they really find the whole place very relaxing. Good coffee, good price, good ambiance, and good music are the elements that make coffee shops really successful.
The success of a coffee shop is not only attributed to the price and great blends offered to consumers. It is also linked to the ambiance created by the set as well as the background music. A good background music creates a welcoming atmosphere inside the coffee place. The melodies improve the overall experience of coffee lovers as they take a sip from their favorite coffee blend. If you ask any coffee shop owner, they would also credit their success on the music playing on the background. If you are planning to establish your own coffee house, make sure to include great music in your setup. Here are examples of types of music that make an amazing background melody in a coffee house.
Acoustic/Instrumental
Acoustic and instrumental melodies are great to play inside a coffee house. Coffee drinkers seem to appreciate these types of music. It may have something to do with the subtle and soothing beat generated by acoustic instruments. Acoustic and instrumental versions of popular songs are usually played in coffee shops. This is so people could easily relate to the music being played while they remain calm all throughout the experience. As a result, acoustic and instrumental music creates a relaxing aura when played as a background noise in coffee houses.
Jazz
Another popular genre being played in coffee houses is jazz. The dynamic elements that comprise this music is what makes Jazz ideal for coffee places. Jazz is described as a mixture of different elements. You will notice the diverse instruments, the singer’s amazing tone, and the improvisation that creates the genre really distinct. All in all, jazz melodies create a positive and soothing vibe that makes listeners relaxed and comfortable.
Bossa Nova
Bossa Nova is quite new in the coffee shop scene but the genre is gaining popularity especially among coffee house customers. The genre is from Brazil and it is a mixture of samba and jazz. The beat is quite fast and it is usually comprised of guitar, percussion, piano, and strings. As such, it makes an interesting music for coffee places.
Ambient Music
Ambient music was invented to be a background melody for the environment. This is the reason why it is usually used in places where there are lots of people conversing.
http://huntington613.wordpress.com/tag/coffee-house-music/

Thứ Năm, 21 tháng 3, 2013

Skolem function - p3

Tóm lại: skolem functions dùng để khử   và 

Trong số các ví dụ đã post ở phần p1 và p2, thì ví dụ sau đây là dễ hiểu nhất, súc tích nhất và cô đọng nhất.
-->

Steps to convert a sentence to clause form:

Eliminate all <=> connectives by replacing each instance of the form (P <=> Q) by expression ((P => Q) ^ (Q => P))
Eliminate all => connectives by replacing each instance of the form (P => Q) by (~P v Q)
Reduce the scope of each negation symbol to a single predicate by applying equivalences such as converting
~~P to P
~(P v Q) to ~P ^ ~Q
~(P ^ Q) to ~P v ~Q
~(Ax)P to (Ex)~P
~(Ex)P to (Ax)~P
Standardize variables: rename all variables so that each quantifier has its own unique variable name. For
example, convert (Ax)P(x) to (Ay)P(y) if there is another place where variable x is already used.
Eliminate existential quantification by introducing Skolem functions. For example, convert (Ex)P(x) to
P(c) where c is a brand new constant symbol that is not used in any other sentence. c is called a Skolem
constant.
More generally, if the existential quantifier is within the scope of a universal quantified
variable, then introduce a Skolem function that depends on the universally quantified variable.
For example, (Ax)(Ey)P(x,y) is converted to (Ax)P(x, f(x)). f is called a Skolem function, and must be a
brand new function name that does not occur in any other sentence.
Example: (Ax)(Ey)loves(x,y) is converted to (Ax)loves(x,f(x)) where in this case f(x) specifies the
person that x loves.
(If we knew that everyone loved their mother, then f could stand for the mother-of function.)
Remove universal quantification symbols by first moving them all to the left end and making the scope of
each the entire sentence, and then just dropping the "prefix" part. E.g., convert (Ax)P(x) to P(x)
Distribute "and" over "or" to get a conjunction of disjunctions called conjunctive normal form.
convert (P ^ Q) v R to (P v R) ^ (Q v R)
convert (P v Q) v R to (P v Q v R)
Split each conjunct into a separate clause, which is just a disjunction ("or") of negated and nonnegated
predicates, called literals
Standardize variables apart again so that each clause contains variable names that do not occur in any
other clause

Examples:

Convert the sentence
(Ax)(P(x) => ((Ay)(P(y) => P(f(x,y))) ^ ~(Ay)(Q(x,y) => P(y))))
Eliminate <=> Nothing to do here.
Eliminate => (Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ ~(Ay)(~Q(x,y) v P(y))))
Reduce scope of negation (Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ (Ey)(Q(x,y) ^ ~P(y))))
Standardize variables (Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ (Ez)(Q(x,z) ^ ~P(z))))
Eliminate existential quantification (Ax)(~P(x) v ((Ay)(~P(y) v P(f(x,y))) ^ (Q(x,g(x)) ^ ~P(g(x)))))
Drop universal quantification symbols (~P(x) v ((~P(y) v P(f(x,y))) ^ (Q(x,g(x)) ^ ~P(g(x)))))
Convert to conjunction of disjunctions (~P(x) v ~P(y) v P(f(x,y))) ^ (~P(x) v Q(x,g(x))) ^ (~P(x) v
~P(g(x)))
Create separate clauses
~P(x) v ~P(y) v P(f(x,y))
~P(x) v Q(x,g(x))
~P(x) v ~P(g(x))
Standardize variables
~P(x) v ~P(y) v P(f(x,y))
~P(z) v Q(z,g(z))
~P(w) v ~P(g(w)) 

Skolem function - p2


Skolem function

A concept in predicate logic. If  is a predicate formula with individual variables (cf. Individual variable, whose domains are sets , respectively, then a function  is called a Skolem function or resolving function for the formula  if for all  one has
Skolem functions were introduced by T. Skolem in the 1920s and have since been widely used in papers on mathematical logic. This is due to the fact that Skolem functions can be used to eliminate alternation of the quantifiers  and . For example, for every formula  of the language of the restricted predicate calculus it is possible to construct a formula of the form  (called the Skolem normal form of ), where  does not contain new quantifiers but does contain new function symbols, such that  is deducible in predicate calculus if and only if its Skolem normal form is.
Skolem functions are used in such fundamental theorems of mathematical logic as Herbrand's theorem, which reduces the question of deducibility of a predicate formula in predicate calculus to that of deducing an infinite sequence of propositional formulas in propositional calculus. They also figure in the Löwenheim–Skolem theorem (cf. Gödel completeness theorem) and elsewhere.
When one deals with formulas on an object domain with an additional structure, one may require a Skolem function to have a definite connection with this structure. For example, if the object domain belongs to the hierarchy of Gödel constructible sets (cf. Gödel constructive set), then one may require that the Skolem functions also belong to a definite level in this hierarchy. It is not always guaranteed that Skolem functions satisfying additional properties exist, but when they do, the effect of using them turns out to be very significant.
By way of an example one can point to Jensen's result on the deducibility of Chang's two-cardinals conjecture (see [6]) and the negation of the Suslin hypothesis (see [5]) from Gödel's axiom of constructibility. The Novikov–Kondo theorem on the uniformization of -relations fromdescriptive set theory confirms the existence of a certain type of Skolem function (see [2]).

References

[1]P.S. Novikov, "Elements of mathematical logic" , Oliver & Boyd and Acad. Press (1964) (Translated from Russian)
[2]J.R. Shoenfield, "Mathematical logic" , Addison-Wesley (1967)
[3]C.C. Chang, H.J. Keisler, "Model theory" , North-Holland (1973)
[4]Yu.L. Ershov, E.A. Palyutin, "Mathematical logic" , Moscow (1987) (In Russian)
[5]K. Devlin, "Constructibility" J. Barwise (ed.) , Handbook of mathematical logic , North-Holland (1977) pp. 453–489
[6]K.J. Devlin, "Aspects of constructibility" , Lect. notes in math. , 354 , Springer (1973)

Skolem function - p1


LP, the Larch Prover -- Skolem constants and functions


Skolem constant is a new constant that is substituted for a variable when eliminating an existential quantifier from a fact or a universal quantifier from a conjecture. For example, the fact \A x (f(x) = c) can be obtained by eliminating the existential quantifier from \E y \A x (f(x) = y) and replacing y by the Skolem constant c. As long as c does not appear in any other fact or in the current conjecture, this Skolemization represents a conservative extension of LP's logical system.For another example, the conjecture \A x (f(x) = 0) can be proved from the subgoal f(c) = 0, where c is a Skolem constant. As long as c is new, the proof is sound.
When an existential quantifier is being eliminated from a fact that contains free variables, or when the existential quantifier occurs in the scope of a universal quantifier, the quantified variable must be replaced by a term involving a Skolem functionapplied to the free and universally quantified variables. For example, the fact \A x (x < bigger(x)) can be obtained by eliminating the existential quantifier from \A x \E y (x < y) and replacing y by bigger(x). See the fix command and thegeneralization proof method.


LP, the Larch Prover -- Quantifiers


Terms and formulas in LP can contain existential and universal first-order quantifiers. Examples:
\A x \E y (x < y)
x < y => \E z (x < z /\ z < y)
The existential quantifier \E x is pronounced ``there exists an x''. The universal quantifier \A x is pronounced ``for all x''.

Syntax

    ::=  <variable>
 ::= \A | \E

Examples

\A x
\E i: Nat

Usage

All quantified variables must have been declared previously in a 
declare variables command.The standard quantifier scope rules (from first-order logic) apply within terms and formulas. The scope of the leading quantifier in the terms \A x t and \E x t is the term t. An occurrence of a variable in a term is bound if it is in the scope of a quantifier over that variable; otherwise it is free. The free variables in a formula, rewrite rule, or deduction rule are understood to be quantified universally. LP suppresses the display of leading universal quantifiers.
LP uses the following hardwired rewrite rules to reduce terms containing quantifiers.
\A x t -> t
\E x t -> t
\E x \E x1 ... xn (x = t /\ P(x))            -> \E x1 ... \E xn P(t)
\A x \A x1 ... xn (~(x = t) \/ Q(x))         -> \A x1 ... xn Q(t)
\A x \A x1 ... xn (x = t /\ P(x) => Q(x))    -> \A x1 ... xn (P(t) => Q(t))
\A x \A x1 ... xn (P(x) => ~(x = t) \/ Q(x)) -> \A x1 ... xn (P(t) => Q(t))
Here P(x) and Q(x) are arbitrary terms, t is a term with no free occurrences of x, and P(t) and Q(t) are the results of substituting t for x in P(x) and Q(x) with appropriate changes of bound variables to prevent a quantifier in P or Q fromcapturing a variable in t.The fix and instantiate commands, together with the generalization and specialization proof methods, enable users to eliminate quantifiers from facts and conjectures.
See also prenex form.


LP, the Larch Prover -- Conservative extension


One system is a conservative extension of another if any consequence of that system is also a consequence of the other or contains a function symbol that does not occur in the other. Thus, conservative extensions can be used to define properties of new symbols, but do not introduce inconsistencies or additional properties of existing symbols.


LP, the Larch Prover -- The fix command


The fix command provides a method of forward inference, which can be used to eliminate an existential quantifier from a fact in LP's logical system.

Syntax

 ::= fix <variable> as <term> in <names>

Examples

fix x as s(0) in *Hyp

Usage

The fix command eliminates the unique accessible prenex-existential quantifier over the variable from the named facts and substitutes the term for all occurrences of the variable bound by that quantifier. For example, given the formulas
user.1: \E x \A y (f(y) = x)
user.2: \E z (x < z)
the commands fix x as c in user and fix z as bigger(x) in user produce the results
user.1.1: f(y) = c
user.2.1: x < bigger(x)
LP will reject a fix command unless the following conditions are satisfied.
  • The named facts must contain exactly one accessible prenex-existential quantifier over the variable (because it is not sound to instantiate two different existential quantifiers by the same term).
  • The term must have the form sk(x1, ..., xn), where sk is a function identifier that does not appear in any fact or in the current conjecture, and where x1, ..., xn include all variables that are bound by outer (explicit or implicit) prenex-universal quantifiers in the formula containing the eliminated quantifier. See Skolem function.
LP automatically changes bound variables in the named facts, as needed, to avoid having them bind (or capture) variables that occur free in the term. This action, together with the above two conditions, guarantee that the results constitute a conservative extension to LP's logical system, i.e., that any consequence of the extended system is either a consequence of the original system or contains an occurrence of sk. The last condition prevents unsound derivations such as c ~= c from \E x (x ~= c)or \A y (c = y) from \A y \E x (x = y).


LP, the Larch Prover -- Proofs by generalization


The command prove F by generalizing x from t directs LP to prove a formula F by creating a single subgoal in which the unique accessible (explicit or implicit) prenex-universal quantifier over the variable x has been eliminated from F and all occurrences of x bound by that quantifier have been replaced by t.The command resume by generalizing x from t directs LP to resume the proof of the current conjecture by this method.
This proof method, which eliminates a universal quantifier from a conjecture, is the dual of the fix command, which eliminates an existential quantifier from a fact. It is subject to restrictions on x and t as for the fix command.
This command is unlikely to be used when F contains free variables other than x. When x is the only free variable in F, the only restriction is that t be a constant that does not occur in F or in any fact in LP's logical system. For example, the command
prove \A x (f(x) = c) by generalizing x from d
is allowed when d is a new constant and reduces the proof of the conjecture to establishing the subgoal f(d) = c. SeeSkolem-constant.

Thứ Ba, 19 tháng 3, 2013

Combinators for Bidirectional Tree Transformations: A Linguistic Approach to the View Update Problem - part 1


Monotonic function

From Wikipedia, the free encyclopedia


Figure 1. A monotonically increasing function. It is strictly increasing on the left and right while just non-decreasing in the middle.
Figure 2. A monotonically decreasing function
Figure 3. A function that is not monotonic

In mathematics, a monotonic function (or monotone function) is a function between ordered sets that preserves the given order. This concept first arose incalculus, and was later generalized to the more abstract setting of order theory.

Combinatory logic

From Wikipedia, the free encyclopedia
Combinatory logic is a notation to eliminate the need for variables in mathematical logic. It was introduced by Moses Schönfinkel and Haskell Curry and has more recently been used in computer science as a theoretical model of computation and also as a basis for the design of functional programming languages. It is based on combinators. A combinator is a higher-order function that uses only function application and earlier defined combinators to define a result from its arguments.

Domain theory


Domain theory is a branch of mathematics that studies special kinds of partially ordered sets (posets) commonly called domains. Consequently, domain theory can be considered as a branch of order theory. The field has major applications in computer science, where it is used to specify denotational semantics, especially for functional programming languages. Domain theory formalizes the intuitive ideas of approximation and convergence in a very general way and has close relations to topology. An alternative important approach to denotational semantics in computer science is that of metric spaces.

Topology (from the Greek τόπος, “place”, and λόγος, “study”) is a major area of mathematics concerned with the most basic properties of space, such as connectedness. More precisely, topology studies properties that are preserved under continuous deformations, including stretching and bending, but not tearing or gluing. The exact mathematical definition is given below. Topology developed as a field of study out of geometry and set theory, through analysis of such concepts as space, dimension, and transformation.

Partially ordered set

From Wikipedia, the free encyclopedia

The Hasse diagram of the set of all subsetsof a three-element set {x, y, z}, ordered by inclusion.
In mathematics, especially order theory, a partially ordered set (or poset) formalizes and generalizes the intuitive concept of an ordering, sequencing, or arrangement of the elements of a set. A poset consists of a set together with a binary relation that indicates that, for certain pairs of elements in the set, one of the elements precedes the other. Such a relation is called a partial orderto reflect the fact that not every pair of elements need be related: for some pairs, it may be that neither element precedes the other in the poset. Thus, partial orders generalize the more familiar total orders, in which every pair is related. A finite poset can be visualized through itsHasse diagram, which depicts the ordering relation.[1]
A familiar real-life example of a partially ordered set is a collection of people ordered by genealogicaldescendancy. Some pairs of people bear the descendant-ancestor relationship, but other pairs bear no such relationship.




Bidirectional Graph Transformation Tools

Tools:
  1. Harmony
  2. TGG
  3. AGG
  4. AToM
  5. Boomerang
  6. Blinkit
  7. GRoundTram
  8. QVT
  9. eMoflon

Recitation 3: Higher-order Functions, Anonymous Functions, Currying, Side effects, Printing and Exceptions


Recitation 3: Higher-order Functions, Anonymous Functions, Currying, Side effects, Printing and Exceptions

This recitation covers:
  • higher-order functions
  • anonymous functions
  • currying
  • side-effects and printing
  • exceptions

Higher-order functions

Functions are values just like any other value in OCaml. What does that mean exactly? This means that we can pass functions around as arguments to other functions, that we can store functions in data structures, that we can return functions as a result from other functions. The full implication of this will not hit you until later, but believe us, it will.
Let us look at why it is useful to have higher-order functions. The first reason is that it allows you to write more general code, hence more reusable code. As a running example, consider functions double and square on integers:
let double (x : int) : int = 2 * x
let square (x : int) : int = x * x
Let us now come up with a function to quadruple a number. We could do it directly, but for utterly twisted motives decide to use the function double above:
let quad (x : int) : int = double (double x)
Straightforward enough. What about a function to raise an integer to the fourth power?
let fourth (x : int) : int = square (square x)
There is an obvious similarity between these two functions: what they do is apply a given function twice to a value. By passing in the function to another functiontwice as an argument, we can abstract this functionality and thus reuse code:
let twice ((f : int -> int), (x : int)) : int = f (f x)
Using this, we can write:
let quad (x : int) : int = twice (double, x)
let fourth (x : int) : int = twice (square, x)
We have exploited the similarity between these two functions to save work.  This can be very helpful.  If someone comes up with an improved (or corrected) version of twice, then every function that uses it profits from the improvement.
The function twice is a so-called higher-order function: it is a function from functions to other values. Notice the type of twice is ((int -> int) * int) -> int.
To avoid polluting the top-level namespace, it can be useful to define the function locally to pass in as an argument. For example:
let fourth (x : int) : int =
  let square (y : int) : int = y * y in
    twice (square, x)
What happens when we evaluate an expression that uses a higher-order function? We use the same rules as earlier: when a function is applied (called), we replace the call with the body of the function, with the argument variables (actually, variables appearing in the argument pattern) bound to the corresponding actual values. For example, fourth 3 evaluates as follows:
 fourth 3
   --> (fun x -> let square (y : int) : int = y * y in
                      twice (square, x)) 3
   --> let square (y : int) : int = y * y in
            twice (square, 3))
   --> twice (fun (y : int) -> y * y, 3)
   --> (fun (y : int) -> y * y) ((fun (y : int) -> y * y) 3)
   --> (fun (y : int) -> y * y) (3 * 3)
   --> (fun (y : int) -> y * y) 9
   --> 9 * 9
   --> 81

Anonymous functions

It seems silly to define and name a function simply to pass it in as an argument to another function. After all, all we really care about is that twice gets a function that doubles its argument.  Fortunately, OCaml provides a better solution — anonymous functions:
let fourth (x : int) : int = twice (fun (y : int) -> y * y, x)
We introduce a new expression denoting "a function that expects an argument of a certain type and returns the value of a certain expression":
e ::= ...  |  fun (x : t) -> e
The fun expression creates an anonymous function: a function without a name. The type makes things actually clearer. The return type of an anonymous function is not declared (and is inferred automatically). What is the type of fun (y : int) -> y = 3 ?
Answer: int -> bool
Notice that the declaration 
let square : int -> int = fun (y : int) -> y * y
has the same effect as
let square (y : int) : int = y * y
In fact, the declaration without fun is just syntactic sugar for the more tedious long definition. (This isn't true for recursive functions, however.)

Currying

Anonymous functions are useful for creating functions to pass as arguments to other functions, but are also useful for writing functions that return other functions. Let us rewrite the twice function to take a function as an argument and return a new function that applies the original function twice:
let twice (f : int -> int) =
  fun (x : int) -> f (f x)
This function takes a function f (of type int -> int) as an argument, and returns the value fun (x : int) -> f (f x), which is a function which when applied to an argument applies f twice to that argument. Thus, we can write
let fourth = twice (fun (x : int) -> x * x)
let quad = twice (fun (x : int) -> 2 * x)
and trying to evaluate fourth 3 does indeed result in 81.
Functions that return other functions are so common in functional programming that OCaml provides a special syntax for them.  For example, we could write the twice function above as
let twice (f : int -> int) (x : int) : int = f (f x)
The "second argument" x here is not an argument to twice, but rather an argument to twice f.  The function twice takes only one argument, namely a functionf, and returns another function that takes an argument x and returns an int.  The distinction here is critical.
This device is called currying after the logician H. B. Curry. At this point you may be worried about the efficiency of returning an intermediate function when you're just going to pass all the arguments at once anyway. Run a test if you want (you should find out how to do this), but rest assured that curried functions are entirely normal in functional languages, so there is no speed penalty worth worrying about.
The type of twice is (int -> int) -> int -> int.  The -> operator is right associative, so this is equivalent to (int -> int) -> (int -> int).  Notice that if we had left out the parentheses on the type of f, we would no longer long have a function that took in another function as an argument, since int -> int -> int -> int is equivalent to int -> (int -> (int -> int)).
Here are more examples of useful higher-order functions that we will leave you to ponder (and try out at home):
let compose ((f, g) : (int -> int) * (int -> int)) (x : int) : int =
  f (g x)
let rec ntimes ((f, n) : (int -> int) * int) =
  if n = 0
  then (fun (x : int) -> x)
  else compose (f, ntimes (f, n - 1))

Side effects

Up until now, we have only shown you pure functional programming.  But in certain cases, imperative programming is unavoidable.  One such case is printing a value to the screen.  By now you may have found it difficult to debug your OCaml code without any way to display intermediate values on the screen.  OCaml provides the function print_string : string -> unit to print a string to the screen.
Printing to the screen is called a side-effect because it alters the state of the computer.  Until now we have been writing functions that do not change any state but merely compute some value.  Later on we will show you more examples of side-effects, but printing will suffice for now.
Because of OCaml's type system, print_string is not overloaded like Java's System.out.println.  To print an intfloatbool, etc, you must first convert it to a string.  Fortunately, there are built-in functions to do this conversion. For example, string_of_int converts an int to a string.  So to print 3, we can write print_string (string_of_int 3).  The parentheses are needed here bacause OCaml evaluates expressions left to right.
So how can you put print statements in your code?  There are two ways.  The first is with a let expression. These can be placed inside other let expressions, allowing you to print intermediate values.
let x = 3 in
  let () = print_string ("Value of x is " ^ (string_of_int x)) in
  x + 1
  
There is a second way as well.  For this we introduce new syntax.
e ::= ...  |  ( e1; ... ; en )
This expression tells OCaml to evaluate expressions e1,...,en in order and return the result of evaluating en.  So we could write our example as
let x = 3 in
  (print_string ("Value of x is " ^ (string_of_int x));
   x + 1)

Exceptions

To handle errors, OCaml provides built in exceptions, much like Java.  To declare an exception named Error, you write
exception Error
Then to throw the exception, we use the raise keyword.  An example using the square root function is
let sqrt1 (x : float) : float =
  if x < 0 then raise Error
  else sqrt x
The type of an exception matches the code in which the exception is thrown.  So for example, in the sqrt1 function, the type of Error will be float since the expression must evaluate to a real.
Exceptions can also carry values.  An example is the built-in exception Failure, defined as
exception Failure of string
To raise this exception, we write
raise (Failure "Some error message")
We can also catch exceptions by use of the try-with keywords.  It is important not to abuse this capability.  Excessive use of exceptions can lead to unreadable spaghetti code.  For this class, it will probably never be necessary to handle an exception.  Exceptions should only be raised in truly exceptional cases, that is, when some unrecoverable damage has been done.  If you can avoid an exception by checking bounds or using options, this is far preferable.  Refer to the OCaml style guide for more examples and info on how to use exceptions properly.