Hets - the Heterogeneous Tool Set

Copyright(c) Ewaryst Schulz, DFKI 2008
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerEwaryst.Schulz@dfki.de
Stabilityprovisional
Portabilityportable
Safe HaskellNone

OMDoc.DataTypes

Contents

Description

Datatypes for an intermediate OMDoc representation.

Synopsis

Documentation

data OMDoc

OMDoc root element with libname and a list of toplevel elements

Constructors

OMDoc String [TLElement] 

Instances

Eq OMDoc 
Ord OMDoc 
Read OMDoc 
Show OMDoc 
XmlRepresentable OMDoc

The root instance for representing OMDoc in XML

data TLElement

Toplevel elements for OMDoc, theory with name, meta and content, view with from, to and morphism

Instances

Eq TLElement 
Ord TLElement 
Read TLElement 
Show TLElement 
XmlRepresentable TLElement

toplevel OMDoc elements to XML and back

data TCElement

Theory constitutive elements for OMDoc

Constructors

TCSymbol String OMElement SymbolRole (Maybe OMElement)

Symbol to represent sorts, constants, predicate symbols, etc.

TCNotation OMQualName String (Maybe String)

A notation for the given symbol with an optional style

TCSmartNotation OMQualName Fixity Assoc Int Int

A smart notation for the given symbol with fixity, associativity, precedence and the number of implicit arguments

TCFlexibleNotation OMQualName Int [NotationComponent]

A smart notation for the given symbol, the argument- and text-components have to alternate in the component list

TCADT [OmdADT]

Algebraic Data Type represents free/generated types

TCImport String OMCD TCMorphism

Import statements for referencing other theories

TCComment String

A comment, only for development purposes

Instances

Eq TCElement 
Ord TCElement 
Read TCElement 
Show TCElement 
XmlRepresentable TCElement

theory constitutive OMDoc elements to XML and back

type TCorOMElement = Either TCElement OMElement

return type for sentence translation (ADT or formula)

type TCMorphism = [(OMName, OMImage)]

Morphisms to specify signature mappings

type OMImage = Either String OMElement

The target type of a mapping is just an alias or an assignment to a symbol

data OmdADT

The flattened structure of an Algebraic Data Type

Constructors

ADTSortDef String ADTType [OmdADT]

A single sort given by name, type and a list of constructors

ADTConstr String [OmdADT]

A constructor given by its name and a list of arguments

ADTArg OMElement (Maybe OmdADT)

An argument with type and evtually a selector

ADTSelector String Totality

The selector has a name and is total (Yes) or partial (No)

ADTInsort OMQualName

Insort elements point to other sortdefs and inherit their structure

Instances

Eq OmdADT 
Ord OmdADT 
Read OmdADT 
Show OmdADT 
XmlRepresentable OmdADT

OMDoc - Algebraic Data Types

data SymbolRole

Roles of the declared symbols can be object or type

Constructors

Obj 
Typ 
Axiom 
Theorem 

data Fixity

Fixity of notation patterns

Constructors

Infix 
Prefix 
Postfix 

data Assoc

Associativity of notation patterns

data ADTType

Type of the algebraic data type

Constructors

Free 
Generated 

data Totality

Totality for selectors of an adt

Constructors

Yes 
No 

data NotationComponent

A component can be a text-component, e.g., value="["/, or an argument-component such as index="1" precedence="p1"/

Constructors

TextComp String 
ArgComp Int Int 

data OMName

Names used for OpenMath variables and symbols

Constructors

OMName 

Fields

name :: String
 
path :: [String]
 

data OMAttribute

Attribute-name/attribute-value pair used to represent the type of a type-annotated term

Constructors

OMAttr OMElement OMElement 

Instances

data OMCD

CD contains the reference to the content dictionary and eventually the cdbase entry

Constructors

CD [String] 

Instances

data OMElement

Elements for Open Math

Constructors

OMS OMQualName

Symbol

OMV OMName

Simple variable

OMATTT OMElement OMAttribute

Attributed element needed for type annotations of elements

OMA [OMElement]

Application to a list of arguments, first argument is usually the functionhead

OMBIND OMElement [OMElement] OMElement

Bindersymbol, bound vars, body

Instances

Hets Utils

Utils for Translation

type UniqName = (String, Int)

type NameMap a = Map a UniqName

data SigMap a

Mapping of symbols and sentence names to unique ids (used in export)

Constructors

SigMap (NameMap a) (NameMap String) 

data SigMapI a

Mapping of OMDoc names to hets strings, for signature creation, and strings to symbols, for lookup in terms (used in import)

cdToList :: OMCD -> [String]

The result list has always two elements: [base, modul]

Name handling: encoding, decoding, unique names

uniqPrefix :: String

The closing paren + percent can be used neither in ordinary Hets-names nor in sentence names hence it is used here for encodings.

nameEncode

Arguments

:: String

the kind of the encoding, may not contain colons

-> [String]

the values to encode

-> String 

Special name encoding in order to be able to recognize these names while reading.

nameDecode :: String -> Maybe (String, [String])

This invariant should hold: (x, l) = fromJust $ nameDecode $ nameEncode x l

Constructing/Extracting Values

tcName :: TCElement -> OMName

name of the theory constitutive element, error if not TCSymbol, TCNotation, or TCImport

Lookup utils for Import and Export

Pretty instances