Skip to content

Commit 3824e19

Browse files
committed
Auto merge of #620 - detrumi:fix-book-context-links, r=jackh726
Fix mdbook links after chalk-engine changes This broke a while back in #611, but only now broke the build because the hosted docs were updated. CC `@jackh726`
2 parents fc2e1ab + eb9df19 commit 3824e19

File tree

2 files changed

+14
-46
lines changed

2 files changed

+14
-46
lines changed

book/src/engine/logic.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Overview
44

55
`chalk-engine` solves a `Goal` using a hybrid search strategy with elements of depth- and breadth-first search. When asked to solve a
6-
particular `Goal` it hasn't seen before, it will first ask the [`Context`] to
6+
particular `Goal` it hasn't seen before, it will first try to
77
generate a set of program clauses, that get turned into [`Strand`]s, that could
88
solve that goal. Otherwise, if asked to solve a `Goal` it has seen before, it
99
will select the existing table.
@@ -37,7 +37,7 @@ created to store current and future answers. First, the [`Goal`] is converted in
3737
an `HhGoal`. If it can be simplified, then a `Strand` with one or more
3838
subgoals will be generated and can be followed as above. Otherwise, if it is a
3939
`DomainGoal` (see above), then
40-
[`program_clauses`](https://rust-lang.github.io/chalk/chalk_engine/context/trait.ContextOps.html#tymethod.program_clauses)
40+
[`program_clauses_for_goal`](https://rust-lang.github.io/chalk/chalk_solve/clauses/fn.program_clauses_for_goal.html)
4141
is called and each clause is converted into a `Strand` and can be followed.
4242

4343
## `root_answer` and `ensure_root_answer`
@@ -58,7 +58,7 @@ into separate functions that branch out from `ensure_root_answer`.
5858
Once a given `Strand` for a table has been selected, a subgoal has to be
5959
selected. If there are no subgoals left, then there is nothing to do. Otherwise,
6060
if there are subgoals left, then a subgoal will attempt to be selected (from
61-
[`next_subgoal_index`](https://rust-lang.github.io/chalk/chalk_engine/context/trait.Context.html#tymethod.next_subgoal_index)).
61+
[`next_subgoal_index`](https://rust-lang.github.io/chalk/chalk_engine/slg/struct.SlgContext.html#method.next_subgoal_index)).
6262
If the table for that subgoal had previously floundered (see next section), then
6363
we mark that subgoal as floundered and try the next subgoal. If all subgoals are
6464
marked as floundered, then this entire `Strand` is marked as floundered. If a
@@ -126,6 +126,6 @@ For much more in-depth
126126
[`Stack`]: https://rust-lang.github.io/chalk/chalk_engine/stack/struct.Stack.html
127127
[`StackEntry`]: https://rust-lang.github.io/chalk/chalk_engine/stack/struct.StackEntry.html
128128
[`Table`]: https://rust-lang.github.io/chalk/chalk_engine/table/struct.Table.html
129-
[`Goal`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.Context.html#associatedtype.Goal
129+
[`Goal`]: https://rust-lang.github.io/chalk/chalk_ir/struct.Goal.html
130130
[`Answer`]: https://rust-lang.github.io/chalk/chalk_engine/struct.Answer.html
131131
[`CompleteAnswer`]: https://rust-lang.github.io/chalk/chalk_engine/struct.CompleteAnswer.html

book/src/engine/major_concepts.md

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,14 @@ This section goes over a few different concepts that are crucial to
44
understanding how `chalk-engine` works, without going over the exact solving
55
logic.
66

7-
## `Context`, `ContextOps`, and `InferenceTable`
8-
9-
### `Context`
10-
11-
The [`Context`] trait is the primary bridge between Chalk internal logic and
12-
external types. In addition actually *defining* the types (via associated
13-
types), it also contains associated functions to convert or extract
14-
information from those types. Overall, this allows the types to be basically
15-
opaque to the engine internals. Functions in the trait are agnostic to specific
16-
program or environment details, since they lack a `&self` argument.
17-
18-
To give an example, there is an associated [`Goal`] type. However, Chalk doesn't
19-
know how to solve this. Instead, it has to be converted an `HhGoal` via the
20-
`Context::into_hh_goal` function. This will be coverted more in the `Goals`
21-
section.
22-
23-
### `ContextOps`
24-
25-
The [`ContextOps`] trait contains functions that may specifically require
26-
information a specific program or environment. For example, the
27-
`program_clauses` function gives potential ways to prove a `Goal`, but obviously
28-
it requires knowing the program (for example, what types, traits, and impls
29-
there are). Functions in this trait all take a `&self` argument.
30-
31-
### `InferenceTable`
32-
33-
The [`InferenceTable`] is a super trait to the [`UnificationOps`], [`TruncateOps`],
34-
and [`ResolventOps`]. Each of these contains functions that track the state of
35-
specific parts of the program. Importantly, these operations can dynamically
36-
change the state of the logic itself.
37-
387
## Goals
398

409
A "goal" in Chalk can be thought of as "something we want to prove". The engine
4110
itself understands `HhGoal`s. `HHGoal`s consist of the most basic logic,
4211
such as introducing Binders (`Forall` or `Exists`) or combining goals (`All`).
43-
On the other hand, `Context::Goal` represents an opaque goal generated
12+
On the other hand, `Goal` represents an opaque goal generated
4413
externally. As such, it may contain any extra information or may be interned.
45-
When solving a logic predicate, Chalk will lazily convert `Context::Goal`s
14+
When solving a logic predicate, Chalk will lazily convert `Goal`s
4615
into `HHGoal`s.
4716

4817
There are three types of completely opaque `HhGoal`s that Chalk can solve:
@@ -77,11 +46,10 @@ goals that depend on this goal.
7746

7847
However, oftentimes, this is not what external crates want when solving for a
7948
goal. Instead, the may want a *unique* solution to this goal. Indeed, when we
80-
solve for a given root [`Goal`], we return a since [`Solution`]. It is up to the
81-
implementation of [`Context`] to decide how a `Solution` is made, given a possibly
82-
infinite set of answers. One of example of this is the
49+
solve for a given root [`Goal`], we return a single [`Solution`]. The
8350
[`AntiUnifier`](https://rust-lang.github.io/chalk/chalk_engine/slg/aggregate/struct.AntiUnifier.html)
84-
from `chalk-solve`, which finds a minimal generalization of answers which don't
51+
struct from `chalk-solve` then finds that solution, by finding a minimal
52+
generalization of answers which don't
8553
unify. (For the example above, it would return only `Ambiguous`, since `A` and
8654
`B` can't unify.)
8755

@@ -91,7 +59,7 @@ An [`ExClause`] is described in literature as `A :- D | G` or
9159
`A holds given that G holds with D delayed goals`. In `chalk-engine`, an
9260
`ExClause` stores the current state of proving a goal, including existing
9361
substitutions already found, subgoals yet to be proven, or delayed subgoals. A
94-
[`Strand`] wraps both an [`ExClause`] and an [`InferenceTable`] together.
62+
[`Strand`] wraps both an [`ExClause`] and an [`TruncatingInferenceTable`] together.
9563

9664
## Tables and Forests
9765

@@ -110,15 +78,15 @@ stack).
11078

11179
[`Context`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.Context.html
11280
[`ContextOps`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.ContextOps.html
113-
[`InferenceTable`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.InferenceTable.html
114-
[`Solution`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.Context.html#associatedtype.Solution
81+
[`TruncatingInferenceTable`]: https://rust-lang.github.io/chalk/chalk_engine/slg/struct.TruncatingInferenceTable.html
82+
[`Solution`]: https://rust-lang.github.io/chalk/chalk_solve/solve/enum.Solution.html
11583
[`ExClause`]: https://rust-lang.github.io/chalk/chalk_engine/struct.ExClause.html
11684
[`Strand`]: https://rust-lang.github.io/chalk/chalk_engine/strand/struct.Strand.html
11785
[`Table`]: https://rust-lang.github.io/chalk/chalk_engine/table/struct.Table.html
11886
[`Forest`]: https://rust-lang.github.io/chalk/chalk_engine/forest/struct.Forest.html
119-
[`Goal`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.Context.html#associatedtype.Goal
87+
[`Goal`]: https://rust-lang.github.io/chalk/chalk_ir/struct.Goal.html
12088
[`UnificationOps`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.UnificationOps.html
12189
[`TruncateOps`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.TruncateOps.html
12290
[`ResolventOps`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.ResolventOps.html
123-
[`ProgramClause`]: https://rust-lang.github.io/chalk/chalk_engine/context/trait.Context.html#associatedtype.ProgramClause
91+
[`ProgramClause`]: https://rust-lang.github.io/chalk/chalk_ir/struct.ProgramClause.html
12492
[`Answer`]: https://rust-lang.github.io/chalk/chalk_engine/struct.Answer.html

0 commit comments

Comments
 (0)