词条 | Twelf |
释义 |
Twelf is an implementation of the logical framework LF. It is used for logic programming and for the formalization of programming language theory. IntroductionAt its simplest, a Twelf program (called a "signature") is a collection of declarations of type families and constants that inhabit those type families. For example, the following is the standard definition of the natural numbers, with nat : type. z : nat. s : nat -> nat. Here plus : nat -> nat -> nat -> type. plus_zero : {M:nat} plus M z M. plus_succ : {M:nat} {N:nat} {P:nat} plus M (s N) (s P) <- plus M N P. The type family The constant Twelf features type reconstruction and supports implicit parameters, so in practice one usually does not need to explicitly write These simple examples do not display LF's higher-order features, nor any of its theorem checking capabilities. See the Twelf distribution for its included examples. UsesTwelf is used in several different ways. Logic programmingTwelf signatures can be executed via a search procedure, so Twelf can be used as a logic programming language. Its core is more sophisticated than Prolog, since it is higher-order and dependently typed, but it is restricted to pure operators: there is no cut or other extralogical operators (such as ones for performing I/O) as are often found in Prolog implementations, which may make it less well-suited for practical logic programming applications. Some of the use of cut rule as used in Prolog is obtained through the ability to declare that certain operators belong to deterministic type families, which avoids recalculation. Also, like λProlog, Twelf generalizes the Horn clauses underlying Prolog to hereditary Harrop formulas, which allow for logically well-founded operational notions of fresh-name generation and scoped extension of the clause database. Formalizing mathematicsTwelf's main use today is as a system for formalizing mathematics (especially the metatheory of programming languages). Used this way it is closely related to Coq and Isabelle/HOL/HOL Light. However, unlike those systems, Twelf proofs are typically developed by hand. Despite this, for the problem domains at which it excels, Twelf proofs are often shorter and easier to develop than in the automated, general-purpose systems. Twelf is particularly well suited to the encoding of programming languages and logics, because it has a built-in notion of binding and substitution. Most logics and programming languages of interest make use of binding and substitution. When implemented in Twelf, binders can often be directly encoded using the technique of higher-order abstract syntax (HOAS), in which the meta-language (Twelf) binders are used to represent the object-level binders. As a consequence, standard theorems such as type-preserving substitution and alpha conversion come "for free". Twelf has been used to formalize many different logics and programming languages (examples are included with the distribution). Among the larger projects are a proof of safety for the Standard ML programming language,[1] a foundational typed assembly language system from CMU,[2] and a foundational proof carrying code system from Princeton. ImplementationTwelf is written in Standard ML and binaries are available for Linux and Microsoft Windows. {{asof|2006}} it is under active development (mostly at Carnegie Mellon University). References1. ^{{cite conference | first = Daniel | last = Lee |author2=Karl Crary |author3=Robert Harper | title = Towards a Mechanized Metatheory of Standard ML | conference = Proceedings of the 2007 Symposium on the Principles of Programming Languages | date = January 2007 | location = Nice, France | url = http://www.cs.cmu.edu/~dklee/papers/tslf-popl.pdf | accessdate = 2007-02-08|format=PDF}} 2. ^{{cite conference | first = Karl | last = Crary | title = Toward a Foundational Typed Assembly Language | conference = Proceedings of the 2003 Symposium on the Principles of Programming Languages | year = 2003 | accessdate = 2007-02-08 | url = http://www.cs.cmu.edu/~crary/papers/2003/talt/talt.pdf}} External links
5 : Dependently typed languages|Logic programming languages|Theorem proving software systems|Type theory|Logic in computer science |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。