@@ -6,12 +6,12 @@ This is a glossary of terminology (possibly) used in the chalk crate.
6
6
7
7
### Basic notation
8
8
9
- | Notation | Meaning |
10
- | --------------| ----------------------------------|
11
- | ` ?0 ` | [ Type inference variable] |
12
- | ` ^0 ` , ` ^1.0 ` | [ Bound variable] |
13
- | ` !0 ` | [ Placeholder ] |
14
- | ` A :- B ` | [ Clause] ; A is true if B is true |
9
+ | Notation | Meaning |
10
+ | --------------| ----------------------------------------- |
11
+ | ` ?0 ` | [ Type inference variable] |
12
+ | ` ^0 ` , ` ^1.0 ` | [ Bound variable] ; bound in a [ ` forall ` ] |
13
+ | ` !0 ` , ` !1.0 ` | [ Placeholder ] |
14
+ | ` A :- B ` | [ Clause] ; A is true if B is true |
15
15
16
16
### Rules
17
17
@@ -26,6 +26,7 @@ This is a glossary of terminology (possibly) used in the chalk crate.
26
26
27
27
[ Type inference variable ] : ../types/rust_types.md#inference-variables
28
28
[ Bound variable ] : ../types/rust_types.md#bound-variables
29
+ [ `forall` ] : #debruijn-index
29
30
[ Placeholder ] : ../types/rust_types.md#placeholders
30
31
[ Clause ] : ../clauses/goals_and_clauses.md
31
32
@@ -103,6 +104,11 @@ Given the example `forall<T> { exists<U> { T: Foo<Item=U> } }` the
103
104
literal names ` U ` and ` T ` are replaced with ` 0 ` and ` 1 ` respectively and the names are erased from the binders: `forall<_ >
104
105
{ exists<_ > { 1: Foo<Item=0> } }`.
105
106
107
+ As another example, in ` forall<X, Y> { forall <Z> { X } } ` , ` X ` is represented
108
+ as ` ^1.0 ` . The ` 1 ` represents the de Bruijn index of the variable and the ` 0 `
109
+ represents the index in that scope: ` X ` is bound in the second scope counting
110
+ from where it is referenced, and it is the first variable bound in that scope.
111
+
106
112
## Formula
107
113
A formula is a logical expression consisting of literals and constants connected
108
114
by logical operators.
0 commit comments