<s>
Twelf	B-Application
is	O
an	O
implementation	O
of	O
the	O
logical	O
framework	O
LF	O
developed	O
by	O
Frank	O
Pfenning	O
and	O
Carsten	O
Schürmann	O
at	O
Carnegie	O
Mellon	O
University	O
.	O
</s>
<s>
It	O
is	O
used	O
for	O
logic	B-Language
programming	I-Language
and	O
for	O
the	O
formalization	O
of	O
programming	O
language	O
theory	O
.	O
</s>
<s>
At	O
its	O
simplest	O
,	O
a	O
Twelf	B-Application
program	O
(	O
called	O
a	O
"	O
signature	O
"	O
)	O
is	O
a	O
collection	O
of	O
declarations	O
of	O
type	O
families	O
(	O
relations	O
)	O
and	O
constants	O
that	O
inhabit	O
those	O
type	O
families	O
.	O
</s>
<s>
The	O
constant	O
defines	O
the	O
case	O
for	O
when	O
the	O
second	O
argument	O
is	O
the	O
successor	O
of	O
some	O
other	O
number	O
(	O
see	O
pattern	B-Language
matching	I-Language
)	O
.	O
</s>
<s>
The	O
arrow	O
can	O
be	O
understood	O
operationally	O
as	O
Prolog	B-Language
's	O
,	O
or	O
as	O
logical	O
implication	O
(	O
"	O
if	O
M	O
+	O
N	O
=	O
P	O
,	O
then	O
M	O
+	O
(	O
s	O
N	O
)	O
=	O
(	O
s	O
P	O
)	O
"	O
)	O
,	O
or	O
most	O
faithfully	O
to	O
the	O
type	O
theory	O
,	O
as	O
the	O
type	O
of	O
the	O
constant	O
(	O
"	O
when	O
given	O
a	O
term	O
of	O
type	O
,	O
return	O
a	O
term	O
of	O
type	O
"	O
)	O
.	O
</s>
<s>
Twelf	B-Application
features	O
type	O
reconstruction	O
and	O
supports	O
implicit	O
parameters	O
,	O
so	O
in	O
practice	O
,	O
one	O
usually	O
does	O
not	O
need	O
to	O
explicitly	O
write	O
(	O
etc	O
.	O
)	O
</s>
<s>
See	O
the	O
Twelf	B-Application
distribution	O
for	O
its	O
included	O
examples	O
.	O
</s>
<s>
Twelf	B-Application
is	O
used	O
in	O
several	O
different	O
ways	O
.	O
</s>
<s>
Twelf	B-Application
signatures	O
can	O
be	O
executed	O
via	O
a	O
search	O
procedure	O
.	O
</s>
<s>
Its	O
core	O
is	O
more	O
sophisticated	O
than	O
Prolog	B-Language
,	O
since	O
it	O
is	O
higher-order	O
and	O
dependently	O
typed	O
,	O
but	O
it	O
is	O
restricted	O
to	O
pure	O
operators	O
:	O
there	O
is	O
no	O
cut	O
or	O
other	O
extralogical	O
operators	O
(	O
such	O
as	O
ones	O
for	O
performing	O
I/O	B-General_Concept
)	O
as	O
are	O
often	O
found	O
in	O
Prolog	B-Language
implementations	O
,	O
which	O
may	O
make	O
it	O
less	O
well-suited	O
for	O
practical	O
logic	B-Language
programming	I-Language
applications	O
.	O
</s>
<s>
Some	O
uses	O
of	O
Prolog	B-Language
's	O
cut	O
rule	O
can	O
be	O
obtained	O
by	O
declaring	O
that	O
certain	O
operators	O
belong	O
to	O
deterministic	O
type	O
families	O
,	O
which	O
avoids	O
recalculation	O
.	O
</s>
<s>
Also	O
,	O
like	O
λProlog	B-Language
,	O
Twelf	B-Application
generalizes	O
Horn	B-Application
clauses	I-Application
to	O
hereditary	O
Harrop	O
formulas	O
,	O
which	O
allow	O
for	O
logically	O
well-founded	O
operational	O
notions	O
of	O
fresh-name	O
generation	O
and	O
scoped	O
extension	O
of	O
the	O
clause	O
database	O
.	O
</s>
<s>
Twelf	B-Application
is	O
mainly	O
used	O
today	O
as	O
a	O
system	O
for	O
formalizing	O
mathematics	O
,	O
especially	O
the	O
metatheory	O
of	O
programming	O
languages	O
.	O
</s>
<s>
As	O
such	O
,	O
it	O
is	O
closely	O
related	O
to	O
Coq	B-Application
and	O
Isabelle/HOL/HOL	O
Light	O
.	O
</s>
<s>
However	O
,	O
unlike	O
those	O
systems	O
,	O
Twelf	B-Application
proofs	O
are	O
typically	O
developed	O
by	O
hand	O
.	O
</s>
<s>
Despite	O
this	O
,	O
for	O
the	O
problem	O
domains	O
at	O
which	O
it	O
excels	O
,	O
Twelf	B-Application
proofs	O
are	O
often	O
shorter	O
and	O
easier	O
to	O
develop	O
than	O
in	O
the	O
automated	O
,	O
general-purpose	O
systems	O
.	O
</s>
<s>
Twelf	B-Application
's	O
built-in	O
notion	O
of	O
binding	O
and	O
substitution	O
facilitates	O
the	O
encoding	O
of	O
programming	O
languages	O
and	O
logics	O
,	O
most	O
of	O
which	O
make	O
use	O
of	O
binding	O
and	O
substitution	O
,	O
which	O
can	O
often	O
be	O
directly	O
encoded	O
through	O
higher-order	B-Application
abstract	I-Application
syntax	I-Application
(	O
HOAS	O
)	O
,	O
where	O
the	O
meta-language	O
'	O
s	O
binders	O
represent	O
the	O
object-level	O
binders	O
.	O
</s>
<s>
Twelf	B-Application
has	O
been	O
used	O
to	O
formalize	O
many	O
different	O
logics	O
and	O
programming	O
languages	O
(	O
examples	O
are	O
included	O
with	O
the	O
distribution	O
)	O
.	O
</s>
<s>
Among	O
the	O
larger	O
projects	O
are	O
a	O
proof	O
of	O
safety	O
for	O
Standard	B-Language
ML	I-Language
,	O
a	O
foundational	O
typed	B-Language
assembly	I-Language
language	I-Language
system	O
from	O
CMU	O
,	O
and	O
a	O
foundational	O
proof	B-Application
carrying	I-Application
code	I-Application
system	O
from	O
Princeton	O
.	O
</s>
<s>
Twelf	B-Application
is	O
written	O
in	O
Standard	B-Language
ML	I-Language
,	O
and	O
binaries	O
are	O
available	O
for	O
Linux	O
and	O
Windows	O
.	O
</s>
