This file is indexed.

/usr/lib/swi-prolog/doc/Manual/dynamic.html is in swi-prolog-nox 5.10.4-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<HTML>
<HEAD>
<TITLE>SWI-Prolog 5.11.18 Reference Manual: Section 4.13</TITLE><LINK REL=home HREF="index.html">
<LINK REL=contents HREF="Contents.html">
<LINK REL=index HREF="DocIndex.html">
<LINK REL=summary HREF="summary.html">
<LINK REL=previous HREF="db.html">
<LINK REL=next HREF="examineprog.html">
<STYLE type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/

dd.defbody
{ margin-bottom: 1em;
}

dt.pubdef
{ background-color: #c5e1ff;
}

dt.multidef
{ background-color: #c8ffc7;
}

.bib dd
{ margin-bottom: 1em;
}

.bib dt
{ float: left;
margin-right: 1.3ex;
}

pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}

div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}

div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}

div.author
{ text-align: center;
font-style: italic;
}

div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}

div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}

div.toc-h1
{ font-size: 200%;
font-weight: bold;
}

div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}

div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}

div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}

span.sec-nr
{
}

span.sec-title
{
}

span.pred-ext
{ font-weight: bold;
}

span.pred-tag
{ float: right;
padding-top: 0.2em;
font-size: 80%;
font-style: italic;
color: #202020;
}

/* Footnotes */

sup.fn { color: blue; text-decoration: underline; }
span.fn-text { display: none; }
sup.fn span {display: none;}
sup:hover span
{ display: block !important;
position: absolute; top: auto; left: auto; width: 80%;
color: #000; background: white;
border: 2px solid;
padding: 5px; margin: 10px; z-index: 100;
font-size: smaller;
}
</STYLE>
</HEAD>
<BODY BGCOLOR="white">
<DIV class="navigate"><A class="nav" href="index.html"><IMG SRC="home.gif" BORDER=0 ALT="Home"></A>
<A class="nav" href="Contents.html"><IMG SRC="index.gif" BORDER=0 ALT="Contents"></A>
<A class="nav" href="DocIndex.html"><IMG SRC="yellow_pages.gif" BORDER=0 ALT="Index"></A>
<A class="nav" href="summary.html"><IMG SRC="info.gif" BORDER=0 ALT="Summary"></A>
<A class="nav" href="db.html"><IMG SRC="prev.gif" BORDER=0 ALT="Previous"></A>
<A class="nav" href="examineprog.html"><IMG SRC="next.gif" BORDER=0 ALT="Next"></A>
</DIV>

<H2><A NAME="sec:4.13"><SPAN class="sec-nr">4.13</SPAN> <SPAN class="sec-title">Declaring 
predicates properties</SPAN></A></H2>

<A NAME="ch:dynamic"></A>
<A NAME="sec:declare"></A>

<P>This section describes directives which manipulate attributes of 
predicate definitions. The functors <A NAME="idx:dynamic1:658"></A><A class="pred" href="dynamic.html#dynamic/1">dynamic/1</A>, <A NAME="idx:multifile1:659"></A><A class="pred" href="dynamic.html#multifile/1">multifile/1</A> 
and
<A NAME="idx:discontiguous1:660"></A><A class="pred" href="dynamic.html#discontiguous/1">discontiguous/1</A> 
are operators of priority 1150 (see <A NAME="idx:op3:661"></A><A class="pred" href="operators.html#op/3">op/3</A>), 
which implies the list of predicates they involve can just be a comma 
separated list:

<PRE class="code">
:- dynamic
        foo/0,
        baz/2.
</PRE>

<P>On SWI-Prolog all these directives are just predicates. This implies 
they can also be called by a program. Do not rely on this feature if you 
want to maintain portability to other Prolog implementations.

<DL class="latex">
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="dynamic/1"><STRONG>dynamic</STRONG> <VAR>:PredicateIndicator, \ldots</VAR></A></DT>
<DD class="defbody">
Informs the interpreter that the definition of the predicate(s) may 
change during execution (using <A NAME="idx:assert1:662"></A><A class="pred" href="db.html#assert/1">assert/1</A> 
and/or <A NAME="idx:retract1:663"></A><A class="pred" href="db.html#retract/1">retract/1</A>). 
In the multi-threaded version, the clauses of dynamic predicates are 
shared between the threads. The directive <A NAME="idx:threadlocal1:664"></A><A class="pred" href="threadcom.html#thread_local/1">thread_local/1</A> 
provides an alternative where each threads has its own clause-list for 
the predicate. Dynamic predicates can be turned into static ones using
<A NAME="idx:compilepredicates1:665"></A><A class="pred" href="dynamic.html#compile_predicates/1">compile_predicates/1</A>.</DD>
<DT class="pubdef"><A NAME="compile_predicates/1"><STRONG>compile_predicates</STRONG>(<VAR>:ListOfNameArity</VAR>)</A></DT>
<DD class="defbody">
Compile a list of specified dynamic predicates (see <A NAME="idx:dynamic1:666"></A><A class="pred" href="dynamic.html#dynamic/1">dynamic/1</A> 
and
<A NAME="idx:assert1:667"></A><A class="pred" href="db.html#assert/1">assert/1</A>) 
into normal static predicates. This call tells the Prolog environment 
the definition will not change anymore and further calls to <A NAME="idx:assert1:668"></A><A class="pred" href="db.html#assert/1">assert/1</A> 
or <A NAME="idx:retract1:669"></A><A class="pred" href="db.html#retract/1">retract/1</A> 
on the named predicates raise a permission error. This predicate is 
designed to deal with parts of the program that is generated at runtime 
but does not change during the remainder of the program execution.<SUP class="fn">40<SPAN class="fn-text">The 
specification of this predicate is from Richard O'Keefe. The 
implementation is allowed to optimise the predicate. This is not yet 
implemented. In multi-threaded Prolog however, static code runs faster 
as it does not require synchronisation. This is particularly true on SMP 
hardware.</SPAN></SUP></DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="multifile/1"><STRONG>multifile</STRONG> <VAR>:PredicateIndicator, \ldots</VAR></A></DT>
<DD class="defbody">
Informs the system that the specified predicate(s) may be defined over 
more than one file. This stops <A NAME="idx:consult1:670"></A><A class="pred" href="consulting.html#consult/1">consult/1</A> 
from redefining a predicate when a new definition is found.</DD>
<DT class="pubdef"><span class="pred-tag">[ISO]</span><A NAME="discontiguous/1"><STRONG>discontiguous</STRONG> <VAR>:PredicateIndicator, \ldots</VAR></A></DT>
<DD class="defbody">
Informs the system that the clauses of the specified predicate(s) might 
not be together in the source file. See also <A NAME="idx:stylecheck1:671"></A><A class="pred" href="debugger.html#style_check/1">style_check/1</A>.</DD>
<DT class="pubdef"><A NAME="public/1"><STRONG>public</STRONG> <VAR>:PredicateIndicator, \ldots</VAR></A></DT>
<DD class="defbody">
Instructs the cross-referencer that the predicate can be called. It has 
no semantics.<SUP class="fn">41<SPAN class="fn-text">This declaration is 
compatible to SICStus. In YAP, <A NAME="idx:public1:672"></A><A class="pred" href="dynamic.html#public/1">public/1</A> 
instructs the compiler to keep the source. As the source is always 
available in SWI-Prolog, our current interpretation also enhanced the 
compatibility to YAP.</SPAN></SUP></DD>
<DT class="pubdef"><A NAME="index/1"><STRONG>index</STRONG>(<VAR>+Head</VAR>)</A></DT>
<DD class="defbody">
Index the clauses of the predicate with the same name and arity as
<VAR>Head</VAR> on the specified arguments. <VAR>Head</VAR> is a term of 
which all arguments are either `1' (denoting `index this argument') or 
`0' (denoting `do not index this argument'). Indexing has no 
implications for the semantics of a predicate, only on its performance. 
If indexing is enabled on a predicate a special purpose algorithm is 
used to select candidate clauses based on the actual arguments of the 
goal. This algorithm checks whether indexed arguments might unify in the 
clause head. Only atoms, integers and compound terms are considered. 
Compound terms are indexed on the combination of their name and arity. 
Indexing is very useful for predicates with many clauses representing 
facts.

<P>Due to the representation technique used at most 4 arguments can be 
indexed. All indexed arguments should be in the first 32 arguments of 
the predicate. If more than 4 arguments are specified for indexing only 
the first 4 will be accepted. Arguments above 32 are ignored for 
indexing.

<P>Indexing as specified by this predicate uses a quick but linear scan. 
Without explicit specification the system uses an algorithm depending on 
the structure of the first argument and number of clauses, In 
particular, for predicates that can be indexed on the first argument and 
have many clauses, the system will use an automatically resizing 
hash-table to provide access time independent from the number of 
clauses.<SUP class="fn">42<SPAN class="fn-text">SWI-Prolog indexing is 
no longer state-of-the-art. Better schemas for multi-argument as well as 
indexing <EM>inside</EM> compound terms are known. We hope to integrate 
this in future versions.</SPAN></SUP> If---for example---one wants to 
represents sub-types using a fact list `sub_type(Sub, Super)' that 
should be used both to determine sub- and super types one should declare sub_type/2 
as follows:

<PRE class="code">
:- index(sub_type(1, 1)).

sub_type(horse, animal).
...
...
</PRE>

<P>Note that this type of indexing makes selecting clauses much faster 
but remains <EM>linear</EM> with respect to the number of clauses, while 
hashing as described with <A NAME="idx:hash1:673"></A><A class="pred" href="dynamic.html#hash/1">hash/1</A> 
provides constant access time. See also <A NAME="idx:hash1:674"></A><A class="pred" href="dynamic.html#hash/1">hash/1</A> 
and <A NAME="idx:termhash2:675"></A><A class="pred" href="db.html#term_hash/2">term_hash/2</A>.</DD>
<DT class="pubdef"><A NAME="hash/1"><STRONG>hash</STRONG>(<VAR>+Head</VAR>)</A></DT>
<DD class="defbody">
Index the given predicate by hashing on the first argument. This is done 
by default on any predicate with more than 5 clauses having a first 
argument that can be indexed and at most two that can not be indexed. On 
dynamic predicates the hash-table is resized as the number of clauses 
grows, providing roughly constant-time access regardless of the number 
of clauses predicates that can be indexed on the first argument. See 
also <A NAME="idx:index1:676"></A><A class="pred" href="dynamic.html#index/1">index/1</A>, <A NAME="idx:termhash2:677"></A><A class="pred" href="db.html#term_hash/2">term_hash/2</A> 
and <A NAME="idx:predicateproperty2:678"></A><A class="pred" href="examineprog.html#predicate_property/2">predicate_property/2</A>.

<P></DD>
</DL>

<P></BODY></HTML>