2.7 Implicit Coercions

2.7 Implicit Coercions

Coercions can be used to implicitly inject terms from one ``class'' in which they reside into another one. A class is either a sort (denoted by the keyword SORTCLASS), a product type (denoted by the keyword FUNCLASS) or an inductive type (denoted by its name).

2.7.1 Class ident.

Declares the name ident as a new class.


Variant:
  1. Class Local ident.
    Declares the name ident as a new local class to the current section.

2.7.2 Coercion ident : ident1 >-> ident2.

Declares the name ident as a coercion between ident1 and ident2. The classes ident1 and ident2 are first declared if necessary.


Variants:
  1. Coercion Local ident : ident1 >-> ident2.
    Declares the name ident as a coercion local to the current section.

  2. Identity Coercion ident:ident1 >-> ident2.
    Coerce an inductive type to a subtype of it.

  3. Identity Coercion Local ident:ident1 >-> ident2.
    Idem but locally to the current section.

2.7.3 Displaying available coercions

Print Classes.

Print the list of declared classes in the current context.

Print Coercions.

Print the list of declared coercions in the current context.

Print Graph.

Print the list of valid path coercions in the current context.

2.7.4 Examples




See also: the technical chapter 14 on coercions.



Retrieved by Memoweb from http://pauillac.inria.fr/coq/doc/node.0.1.6.html at 8/10/98