Terms
Output types
All Dusa terms have a correspondence with JavaScript types:
- The trivial type
()
in Dusa corresponds tonull
in JavaScript. - The string type in Dusa corresponds to the string type in JavaScript.
- The integer and natural number types in Dusa correspond to the
BigInt
type in JavaScript. The JavaScript BigInt four is written as
4n
, not4
. - Constants like
a
,tt
, orbob
in Dusa correspond to objects{ name: 'a' }
,{ name: 'tt' }
, or{ name: 'bob' }
in JavaScript. - An uninterpreted function with arguments like
h 9 "fish"
in Dusa corresponds to an object{ name: 'h', args: [9n, 'fish'] }
in JavaScript.
type Term
type Fact
Input types
The Dusa and DusaSolution methods that take terms and facts as argument accept inputs that are more flexible than the outputs that Dusa will return (see the Robustness Principle).
type InputTerm
Dusa will accept numbers of type number
and convert them to
BigInt
values. This will raise a RangeError
if you try to pass a non-integer number
to Dusa.
An input constant like a
can also be given as { name: 'a', args: [] }
, even
though that constant will always be output as { name: 'a' }
.
type InputFact
The value
field is optional when giving a fact as an argument (for example, to
the assert()
method.), and a missing value
field will be interpreted as the trivial Dusa value ()
.