Skip to content

Commit

Permalink
Editor links to docs now
Browse files Browse the repository at this point in the history
  • Loading branch information
robsimmons committed Nov 23, 2023
1 parent 57cd208 commit 957dca5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
14 changes: 7 additions & 7 deletions docs/src/content/docs/docs/language/constraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
title: Constraints
---

Constraints are critical to understanding solutions in Dusa. A solution in Dusa must
Constraints are critical to understanding solutions in Dusa. A solution in Dusa must
have four properties:

1. Whenever the premises of a closed rule are satisfied, one of the mutually exclusive
conclusions must be present in the solution.
2. Whenever all the premises of an open rule are satisfied, either one of the mutually
exclusive conclusions must be present in the solution, or else the addition of any
exclusive conclusions must be present in the solution, or else the addition of any
mutually exclusive conclusion must violate a functional constraint.
3. There must be no way to satisfy all the premises of any `#forbid` constraint.
4. There must be some way to satisfy all the premises of every `#demand` constraint.

## Functional constraints

Functional constraints are at the core of Dusa. Choices in rules expand the search
Functional constraints are at the core of Dusa. Choices in rules expand the search
space of solutions, and constraints trim the search space back down.

If any attribute is forced to take two distinct values, the solution is invalidated.
Expand All @@ -33,7 +33,7 @@ rejected.

## Forbid constraints

If all the premises to any `#forbid` declaration can be simultaneously satisfied, the
If all the premises to any `#forbid` declaration can be simultaneously satisfied, the
database is invalidated.

species is { bear, bird }.
Expand All @@ -43,7 +43,7 @@ database is invalidated.

This program again has only one solution, containing the facts `species is bear` and
`name is yogi`. Positing that the species is bird won't cause a functional constraint
to fail, but it will cause the solution to contain `name is tweety` to be derived,
to fail, but it will cause the solution to contain `name is tweety` to be derived,
which is rejected by the constraint.

### Syntactic sugar
Expand All @@ -68,7 +68,7 @@ every `#demand` declaration can be simultaneously satisfied.
name is tweety :- species is bird.
#demand name is yogi.

Once again, this program again has only one solution, containing the facts
Once again, this program again has only one solution, containing the facts
`species is bear` and `name is yogi`. If the name is not Yogi, the database will
be rejected, and so we will not see any solutions with birds, who can only be named
tweety.
Expand All @@ -89,4 +89,4 @@ accepting the solution only if an alterantive value is derived.
required 2 is { unsatisfied? }.
required 1 is satisfied :- <premises_1>.
required 2 is satisfied :- <premises_2>.
#forbid required _ is unsatisfied.
#forbid required _ is unsatisfied.
4 changes: 1 addition & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
<div class="dk-sessions">
<div class="dk-header">
<div id="dk-tabs" class="dk-tabs"></div>
<div class="dk-logo">
<a href="https://github.com/robsimmons/dusa/blob/main/README.md">Dusa</a>
</div>
<div class="dk-logo">Dusa</div>
</div>
<div id="session" class="mobile-view-editor">
<div id="codemirror-root"></div>
Expand Down
15 changes: 14 additions & 1 deletion src/web/Config.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { MoonIcon, Share1Icon, SunIcon } from '@radix-ui/react-icons';
import { MoonIcon, QuestionMarkCircledIcon, Share1Icon, SunIcon } from '@radix-ui/react-icons';
import { ICON_SIZE } from './constants';
import * as Tooltip from '@radix-ui/react-tooltip';
const LS_THEME = 'dusa-theme';
Expand All @@ -25,6 +25,19 @@ export default function Config(props: Props) {

return (
<>
<div className="top-config">
<Tooltip.Root>
<Tooltip.Trigger asChild className="dk-trigger-button">
<button onClick={() => window.open('/docs/', '_blank')}>
<QuestionMarkCircledIcon width={ICON_SIZE} height={ICON_SIZE} />
</button>
</Tooltip.Trigger>
<Tooltip.Content className="dk-tooltip-button" side="right" sideOffset={8}>
View the docs
</Tooltip.Content>
</Tooltip.Root>
</div>
<div />
<div className="bottom-config">
<Tooltip.Root>
<Tooltip.Trigger asChild className="dk-trigger-button">
Expand Down
12 changes: 9 additions & 3 deletions src/web/dusa.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ main {
}

.dk-config {
display: grid;
align-items: end;
padding-bottom: var(--dk-small-padding);
display: flex;
flex-direction: column;
height: 100%;
padding-block: var(--dk-small-padding);
align-items: stretch;
}

.dk-config div {
Expand All @@ -102,6 +104,10 @@ main {
gap: var(--dk-medium-padding);
}

.dk-config div.top-config {
flex-grow: 1;
}

.dk-config button {
height: var(--dk-button-size);
border: 0;
Expand Down

0 comments on commit 957dca5

Please sign in to comment.