• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

robsimmons / dusa / 9492069169
95%

Build:
DEFAULT BRANCH: main
Ran 13 Jun 2024 01:15AM UTC
Jobs 1
Files 24
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

13 Jun 2024 01:14AM UTC coverage: 71.67% (+0.8%) from 70.866%
9492069169

push

github

web-flow
Significantly refactor and simplify flattening transformation, unify handling of builtins and functional predicates (#23)

## Background

### Functional predicates

I originally introduced **functional predicates** with the observation
that it's pretty nice to be able to write

```
size is 3.
color 1 is red.
color 2 is blue.
color 3 is green.
color 4 is orange.

a (color N) :- b N, N < size.
```

where the last rule is a shorthand for 

```
a Color :- b N, size is Size, N < Size, color N is Color.
```

Expanding out this shorthand is done in a step called the _flattening
transformation_.

### Built-in operatons

I also originally introduced **built-in operations** in a way that had a
complicated interaction with the term-matching infrastructure, so that,
for example, matching the term `3` against the pattern `succ X` with
`succ` registered as the `NAT_SUCC` operator would result in X being
bound to 2.

This introduced complexity into a pretty core part of the system,
**and** it wasn't clear what should happen if you try to write things
like `succ "Hello world"`.

One correct, well-understood, and uniform way to handle this sort of
operation is by treating the successor operator as an infinite relation
of the form `succ X is Y`, with the following entries:

```
succ 0 is 1.
succ 1 is 2.
succ 2 is 3.
...
```

This PR unifies the way both functional predicates and built-in
relations get treated by the static checker and the flattening
transformation.

## Built-ins are now uniformly treated as relations

Without this PR, Dusa doesn't allow you to write built-in operations as
relations. The following isn't allowed, for example:

```
#builtin NAT_SUCC succ
a 3.
b Y :- a X, succ X is Y.
```

In Dusa 0.0.14 and below, built-ins can only be referenced in their
functional form, not their relational form, even though the program was
compiling everything into the relational form. This is fixed, and... (continued)

389 of 490 branches covered (79.39%)

Branch coverage included in aggregate %.

297 of 361 new or added lines in 18 files covered. (82.27%)

15 existing lines in 5 files now uncovered.

1306 of 1875 relevant lines covered (69.65%)

9120.85 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
82.35
3.78% src/language/binarize.ts
2
62.73
-0.48% src/client.ts
2
88.46
-11.54% src/language/dusa-builtins.ts
3
80.36
0.36% src/language/indexize.ts
5
94.9
0.16% src/language/dusa-parser.ts
5
77.42
-8.66% src/language/syntax.ts
7
44.38
-1.54% src/datastructures/data.ts
10
94.05
5.97% src/language/check.ts
14
84.27
2.65% src/language/flatten.ts
15
33.13
-7.66% src/engine/builtin.ts

Uncovered Existing Lines

Lines Coverage ∆ File
1
94.9
0.16% src/language/dusa-parser.ts
1
62.73
-0.48% src/client.ts
2
44.38
-1.54% src/datastructures/data.ts
5
77.42
-8.66% src/language/syntax.ts
6
33.13
-7.66% src/engine/builtin.ts
Jobs
ID Job ID Ran Files Coverage
1 9492069169.1 13 Jun 2024 01:15AM UTC 24
71.67
GitHub Action Run
Source Files on build 9492069169
  • Tree
  • List 24
  • Changed 23
  • Source Changed 20
  • Coverage Changed 17
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #9492069169
  • 85f73694 on github
  • Prev Build on main (#9458770357)
  • Next Build on main (#10029520334)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc