generated from pikalab-unibo/ise-lab-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ise-lab-perception-actuation.tex
686 lines (586 loc) · 27.4 KB
/
ise-lab-perception-actuation.tex
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ISE Lab -- Topic
% Giovanni Ciatto
% Alma Mater Studiorum - Università di Bologna
% mailto:[email protected]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\documentclass[handout]{beamer}\mode<handout>{\usetheme{default}}
%
\documentclass[presentation]{beamer}\mode<presentation>{\usetheme{AMSBolognaFC}}
%\documentclass[handout]{beamer}\mode<handout>{\usetheme{AMSBolognaFC}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{ise-lab-common}
\usepackage{ise-lab-perception-actuation}
% version
\newcommand{\versionmajor}{1}
\newcommand{\versionminor}{1}
\newcommand{\versionpatch}{0}
\newcommand{\version}{\versionmajor.\versionminor.\versionpatch}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title[\currentLab{} -- Logic Agents]{Logic Agents, Perception and Actuation}
%
\subtitle{\courseName{} / Module \moduleN{} (\courseAcronym)}
%
\author[\sspeaker{\gcShort}]{\speaker{\gcFull} \\ \gcEmail}
%
\institute[\disiShort, \uniboShort]{\disi{} (\disiShort)\\\unibo}
%
\date[A.Y. \academicYear{} (v.\ \version)]{Academic Year \academicYear{}\\(version \version)}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%/////////
\frame{\titlepage}
%/////////
%%===============================================================================
\section*{Outline}
%%===============================================================================
%
%%/////////
\frame[c]{\tableofcontents[hideallsubsections]}
%%/////////
%===============================================================================
\section{Premises}
%===============================================================================
\begin{frame}{Lecture Goals}
\begin{itemize}
\item Understand the role of logic programming as a tool for building agents
\item Understand how to enable the perception and actuation from the agent perspective
\item Understand the notion of layered software system
\item Understand the key role of Application Programming Interfaces (API)
\end{itemize}
\end{frame}
%===============================================================================
\section{Software Agents}
%===============================================================================
\begin{frame}{Overview on Software Agents}
\begin{block}{\textbf{Environment} = anything laying outside the \textbf{agents}}
\begin{itemize}
\item
Can be \alert{perceived} via \emph{sensors}
\item
Can be \alert{affected} via \emph{actuators}
\end{itemize}
\end{block}
\begin{center}
\includegraphics[width=.5\linewidth]{figures/agent-environment.png}
\end{center}
\begin{alertblock}{Agent $\equiv$ \textbf{computational} agent}
\begin{multicols}{2}
\begin{itemize}
\item `Perception' $\approx$ \alert{input}
\item `Actuation' $\approx$ \alert{output}
\item Agent pursues \alert{goals} via \alert{computation}
\end{itemize}
\end{multicols}
\end{alertblock}
\end{frame}
\begin{frame}{Layered View of the Software Agent}
Software agents can be abstractly modelled as composed by \alert{layers}:
%
\begin{columns}
\begin{column}{.5\linewidth}
\begin{enumerate}
\item Some control software
%
\begin{itemize}
\item[eg] Java / logic / AgentSpeak program
\end{itemize}
\item Some interpreter for that software (e.g.~JVM, Prolog interpreter, Jason)
%
\begin{itemize}
\item[eg] Java / logic interpreter, Jason
\end{itemize}
\item Some OS mediating the usage of HW resources for the interpreter
\item Hardware resources
%
\begin{itemize}
\item[eg] memory, storage, computational power, I/O (there including networking)
\end{itemize}
\end{enumerate}
\end{column}
\begin{column}{.5\linewidth}
\includegraphics[width=\linewidth]{figures/layers.pdf}
\end{column}
\end{columns}
\end{frame}
\begin{frame}{Control Software}
\begin{itemize}
\item While running, the control software of an agent acts as its mind
\vfill
\item Put simply, the control software should \alert{decide} what actions to do
%
\begin{itemize}
\item based on the current perception of the environment
\item in order to reach the agent's goals
\end{itemize}
\vfill
\item The control software commonly consists of a \alert{loop} (possibly, \emph{infinite})
\vfill
\item Which programming languages to use for the control software?
%
\begin{itemize}
\item in principle, any programming language can be used
\item yet, logic programming (e.g. Prolog) comes with a natural support for \alert{goal-orientation}
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}[allowframebreaks]{Actions from the Agent Perspective}
\begin{itemize}
\item The environment is shaped by what perceptual/actuatory actions agents can perform
%
\begin{itemize}
\item[eg] sensing enviromental properties (temperature, humidity, light, etc.)
\item[eg] sensing distances, obstacles, etc.
\item[eg] moving wheels or harms, sucking or pushing air, etc.
\end{itemize}
\bigskip
\item The agent may also be endowed with \alert{epistemic} capabilities
%
\begin{itemize}
\item[eg] memorise new knowledge
\item[eg] forget (or update) memorised knowledge
\end{itemize}
\end{itemize}
\framebreak
\begin{alertblock}{Actions may \textbf{fail} (in so many ways!)}
\begin{itemize}
\item[a.] perceptual actions may provide \alert{imprecise} or \alert{meaningless} percept
%
\begin{itemize}
\item[b.] or fail in providing a percept at all
\end{itemize}
\item[c.] actuatory actions may \alert{silently} fail by \alert{provoking no effect}
%
\begin{itemize}
\item[d.] or explicitly fail returning some feedback to the agent
\end{itemize}
\end{itemize}
\end{alertblock}
%
\begin{itemize}
\item situations \alert{a.} and \alert{c.} are very subtle to spot
%
\begin{itemize}
\item since they're undistinguishable from `correct' actions
\end{itemize}
\item situations \alert{b.} and \alert{d.} subtend some form of \alert{proprioception}
\end{itemize}
\end{frame}
\begin{frame}[allowframebreaks]{Actions from the \textbf{Software} Agent Perspective}
\begin{alertblock}{Endowing agents with some perceptual/actuatory action requires}
\begin{enumerate}
\item some enabling HW facility to be present
\item some OS functionality enabling the usage of that HW facility
\item the interpreter to know how to call that OS functionality
\item the programming language to have some ad-hoc API wrapping the OS functionality
\end{enumerate}
\end{alertblock}
\begin{exampleblock}{The file system as an environment}
\begin{itemize}
\item \alert{reading} a file as a string, given its path as the \alert{perception} action
%
\begin{itemize}
\item fails explicitly when the path is missing, or non-readable
\end{itemize}
\item \alert{writing} a file as a string, given its path as the \alert{actuation} action
%
\begin{itemize}
\item fails when the path is missing, or non-readable
\end{itemize}
\end{itemize}
\end{exampleblock}
\end{frame}
\section{Logic Agents}
\begin{frame}[allowframebreaks]{Logic Agents}
\begin{block}{Goal-\textbf{driven} logic solvers are (simple) \textbf{reasoning} agents}
\begin{itemize}
\item Knowledge base $\rightarrow$ memory
\item Resolution $\rightarrow$ thinking / reasoning
\item Assertion/retraction $\rightarrow$ epistemic actions
\item ??? $\rightarrow$ Actuation
\item ??? $\rightarrow$ Perception
\item ??? $\rightarrow$ Environment
\end{itemize}
\end{block}
\framebreak
Basic stub of Prolog agent:
%
\prologimport{listings/logic-agent-stub.pl}
%
which is the same as:
%
\prologimport{listings/logic-agent-stub2.pl}
\begin{block}{Goal-\textbf{driven} logic solvers are (simple) \textbf{reasoning} agents}
\begin{itemize}
\item Knowledge base $\rightarrow$ memory
\item Resolution $\rightarrow$ thinking / reasoning
\item Assertion/retraction $\rightarrow$ epistemic actions
\item \alert{Write $\rightarrow$ Actuation}
\item ??? $\rightarrow$ Perception
\item ??? $\rightarrow$ Environment
\end{itemize}
\end{block}
\end{frame}
\begin{frame}[allowframebreaks]{Example -- Thermostat agent (maintenance)}
\prologimport[basicstyle=\tiny\ttfamily]{listings/thermostat-agent.pl}
\framebreak
\begin{exampleblock}{Goal}
\begin{itemize}
\item \alert{maintain} the temperature into the \alert{warm} range
\end{itemize}
\end{exampleblock}
\begin{alertblock}{Remarks}
\begin{itemize}
\item Knowledge base $\rightarrow$ memory
\item Resolution $\rightarrow$ thinking / reasoning
\item Assertion/retraction $\rightarrow$ epistemic actions
\item \alert{Write file $\rightarrow$ Actuation}
\item \alert{Read file $\rightarrow$ Perception}
\item \alert{File system $\rightarrow$ Environment}
\end{itemize}
\end{alertblock}
\begin{block}{Required functionalities}
\begin{enumerate}
\item reading a file as a string, given its path as the perception action
%
\begin{itemize}
\item \pl{read\_text/2} \alert{(to be implemented)}
\end{itemize}
\item writing a file as a string, given its path as the actuation action
%
\begin{itemize}
\item \pl{write\_text/2} \alert{(to be implemented)}
\end{itemize}
% \item capability to memorize custom information
% %
% \begin{itemize}
% \item \pl{assert/1}, \pl{asserta/1}, \pl{assertz/1} \alert{(provided by standard Prolog)}
% \end{itemize}
% \item capability to discard memorised information
% %
% \begin{itemize}
% \item \pl{retract/1} \alert{(provided by standard Prolog)}
% \end{itemize}
\end{enumerate}
\end{block}
\end{frame}
\begin{frame}[allowframebreaks]{Example -- Thermostat agent (achievement)}
\label{slide:achievement}
\prologimport[basicstyle=\tiny\ttfamily]{listings/thermostat-agent2.pl}
\framebreak
\begin{exampleblock}{Goal}
\begin{itemize}
\item \alert{achieve} a situation where temperature is into the \alert{warm} range
%
\begin{itemize}
\item[!] then stop
\end{itemize}
\end{itemize}
\end{exampleblock}
\begin{block}{How to realise these kind of functionalities?}
\begin{enumerate}
\item reading a file as a string, given its path as the perception action
%
\begin{itemize}
\item \pl{read\_text/2} \alert{(to be implemented)}
\end{itemize}
\item writing a file as a string, given its path as the actuation action
%
\begin{itemize}
\item \pl{write\_text/2} \alert{(to be implemented)}
\end{itemize}
\item capability to memorize custom information
%
\begin{itemize}
\item \pl{assert/1}, \pl{asserta/1}, \pl{assertz/1} \alert{(provided by standard Prolog)}
\end{itemize}
\item capability to discard memorised information
%
\begin{itemize}
\item \pl{retract/1} \alert{(provided by standard Prolog)}
\end{itemize}
\end{enumerate}
\end{block}
\end{frame}
\begin{frame}[allowframebreaks]{Example -- Thermostat agent}
\begin{block}{Questions}
\begin{enumerate}
\item Is the thermostat agent \alert{pro-active} or \alert{re-active}?
\item Is the thermostat agent \alert{autonomous}?
%
\begin{itemize}
\item w.r.t. \alert{motivational} autonomy?
\item w.r.t. \alert{executive} autonomy?
\item w.r.t. \alert{computational} autonomy?
\end{itemize}
\item Is the thermostat agent relying on a \alert{strong} or \alert{weak} notion of `goal'?
\end{enumerate}
\end{block}
\framebreak
\begin{block}{Open problems}
\begin{itemize}
\item How to endow logic agents with new \alert{actions}?
%
\begin{itemize}
\item[ie] how to realise the \alert{\pl{read\_text/2}} and \alert{\pl{write\_text/2}} functionalities?
\end{itemize}
\medskip
\item We need some mechanism to extend of the logic language API\ldots
%
\begin{itemize}
\item \ldots possibly, supporting the exploitation of OS resources
\item \ldots possibly, supporting the generation of side effects into the solver
\end{itemize}
\end{itemize}
\end{block}
%
\begin{itemize}
\item[cf.] exercises on slide \ref{slide:exercies}
\end{itemize}
\end{frame}
%===============================================================================
\section{Generators}
%===============================================================================
\begin{frame}[allowframebreaks]{The notion of `Generator'\ccite{2pkt-jelia2021}}
\begin{center}
\includegraphics[width=.7\linewidth]{figures/generator.pdf}
\end{center}
\begin{block}{Informal definition}
\begin{itemize}
\item Servers serving a solver's requests to perform actions
%
\begin{itemize}
\item providing 1, or more responses
\end{itemize}
\item A particular case of \alert{artefact}, under a MAS perspective
\end{itemize}
\end{block}
\begin{block}{Defitinion}
\begin{description}
\item[Signature:] name + arity ($\approx$ logic API)
\item[Behaviour:] function mapping \alert{requests} to \alert{\emph{streams} of responses}
\item[Requests:] carry information about
%
\begin{itemize}
\item the execution context (at the time of request issuing)
\item the \emph{actual} arguments of the request
\end{itemize}
\item[Responses:] carry information about
%
\begin{itemize}
\item success, failure, or errors
\item substitutions to be applied to resolution
\item side effects to be applied to the execution context
\end{itemize}
\end{description}
\end{block}
\begin{block}{Workflow}
\begin{enumerate}\small
\item While solving a (sub-)goal the solver may \alert{select} a generator
%
\begin{itemize}\scriptsize
\item by its \alert{signature}
\end{itemize}
\item Then, the solver creates a \alert{request} to be sent to the generator
\item The generator is then triggered: it produces a \alert{stream of responses}
\item The solver \alert{lazily consumes} the stream of responses
%
\begin{itemize}\scriptsize
\item \alert{when} a response is consumed depends on \alert{how} the solver performs resolution
\item consuming a response implies \alert{reifying} the side effects it is carrying
\end{itemize}
\item Each response constitutes a \alert{branch} in the proof three, \alert{to be explored}
%
\begin{itemize}\scriptsize
\item[eg] via \alert{backtracking}
\end{itemize}
\end{enumerate}
\end{block}
\begin{center}
\includegraphics[width=.6\linewidth]{figures/primitive-usage.pdf}
\end{center}
\end{frame}
\begin{frame}[allowframebreaks]{The notion of `\kt{Primitive}' in \twopkt{}}
\begin{itemize}
\item Generators are realised via by the \kt{Primitive} type hierarchy in \twopkt{}
%
\begin{center}
\includegraphics[width=\linewidth]{figures/primitive.pdf}
\end{center}
%
\begin{itemize}
\item as well as by the \kt{Solve.Request} and \kt{Solve.Response} types
\end{itemize}
\framebreak
\item Upon creation, solver accept \kt{Libraries}, containing zero or more primitives
%
\begin{itemize}
\item standard built-ins are constructed in this way
\end{itemize}
\bigskip
\item During resolution, solvers may exploit primitives to solve (sub-)goals
\bigskip
\item Primitives take precedence over ordinary logic rules
\end{itemize}
\end{frame}
\begin{frame}{\kt{Primitive}s in \twopkt{} -- Example: \pl{natural/1}}
\kotlinimport[basicstyle=\tiny\ttfamily]{listings/NatPrimitive.kt}
\end{frame}
\begin{frame}[allowframebreaks]{In practice, one may exploit \kt{PrimitiveWrapper}s}
\begin{block}{The \kt{PrimitiveWrapper} type hierarchy}
A pool of abstract classes factorising common aspects of primitives' implementation
%
\begin{itemize}
\item primitive wrapper $\approx$ signature + primitive + utility methods
\end{itemize}
\end{block}
\framebreak
\begin{center}
\includegraphics[width=\linewidth]{figures/wrappers.pdf}
\end{center}
\framebreak
Main wrapper classes:
%
\begin{description}
\item[\kt{PredicateWithoutArguments}] base class for 0-ary predicates
\item[\kt{UnaryPredicate}] base class for 1-ary predicates
\item[\kt{BinaryRelation}] base class for 2-ary predicates
\item[\kt{TernaryRelation}] base class for 3-ary predicates
\item[\kt{QuaternaryRelation}] base class for 4-ary predicates
\item[\kt{QuinaryRelation}] base class for 5-ary predicates
\end{description}
\framebreak
Each wrapper class, comes with 4 more abstract sub-classes:
%
\begin{description}
\item[\kt{WithoutSideEffects}] to be preferred if the predicate does not provoke side-effects
\item[\kt{NonBacktrackable}] to be preferred if the predicate is not backtrackable, yet it may provoke side-effects
\item[\kt{Functional}] to be preferred if the predicate is not backtrackable and does not provoke side-effects
\item[\kt{Predicative}] to be preferred if the predicate has a boolean semantics, i.e. it is not backtrackable, it does not provoke side-effects, and it does not assign any variable
\end{description}
\end{frame}
\begin{frame}{\kt{PrimitiveWrapper}s in \twopkt{} -- Example: \pl{natural/1} (bis)}
\kotlinimport[basicstyle=\tiny\ttfamily]{listings/NatPrimitive2.kt}
\end{frame}
\begin{frame}[allowframebreaks]{About \kt{PrimitiveWrapper}s' Utility Methods}\small
Each sub-class of \kt{PrimitiveWrapper} inherits a number of protected utility methods:
%
\begin{description}\small
\item[\kt{ensuringAllArgumentsAreInstantiated()}] throws an \kt{InstantiationError} if some argument is a \kt{Var}
% \framebreak
\item[\kt{ensuringArgumentIsWellFormedIndicator(Int)}] checks whether the argument at the provided index is a well formed indicator (i.e. \pl{\meta{Atom}/\meta{Integer}}), throwing the most adequate error in case it is not
% \framebreak
\item[\kt{ensuringArgumentIsWellFormedClause(Int)}] checks whether the argument at the provided index is a well formed clause (i.e. no sub-goal in the body is a \kt{Var}), throwing the most adequate error in case it is not
% \framebreak
\item[\kt{ensuringArgumentIsInstantiated(Int)}] throws an \kt{InstantiationError} if the argument at the provided index is a \kt{Var}
% \framebreak
\item[\kt{ensuringArgumentIsNumeric(Int)}] throws a \kt{TypeError} if the argument at the provided index is not \kt{Numeric}
% \framebreak
\item[\kt{ensuringArgumentIsStruct(Int)}] throws a \kt{TypeError} if the argument at the provided index is not a \kt{Struct}
% \framebreak
\item[\kt{ensuringArgumentIsCallable(Int)}] alias for \kt{ensuringArgumentIsStruct}
% \framebreak
\item[\kt{ensuringArgumentIsVariable(Int)}] throws a \kt{TypeError} if the argument at the provided index is not a \kt{Var}
% \framebreak
\item[\kt{ensuringArgumentIsCompound(Int)}] throws a \kt{TypeError} if the argument at the provided index is not a \kt{Struct} s.t. $\kt{arity} > 0$
% \framebreak
\item[\kt{ensuringArgumentIsAtom(Int)}] throws a \kt{TypeError} if the argument at the provided index is not an \kt{Atom}
% \framebreak
\item[\kt{ensuringArgumentIsConstant(Int)}] throws a \kt{TypeError} if the argument at the provided index is not a \kt{Constant}
% \framebreak
\item[\kt{ensuringArgumentIsGround(Int)}] throws an \kt{InstantiationError} if the argument at the provided index is not \emph{ground}
% \framebreak
\item[\kt{ensuringArgumentIsChar(Int)}] throws a \kt{TypeError} if the argument at the provided index is not an \kt{Atom} s.t. $\kt{value.length} == 1$
% \framebreak
\item[\kt{ensuringArgumentIsSpecifier(Int)}] throws a \kt{DomainError} if the argument at the provided index is not an \kt{Atom} from the set \pl{\{fx, fy, xf, yf, xfx, yfx, xfy\}}
% \framebreak
\item[\kt{ensuringArgumentIsList(Int)}] throws a \kt{TypeError} if the argument at the provided index is not an \kt{List}
% \framebreak
\item[\kt{ensuringArgumentIsInteger(Int)}] throws a \kt{TypeError} if the argument at the provided index is not an \kt{Integer}
% \framebreak
\item[\kt{ensuringArgumentIsNonNegativeInteger(Int)}] throws a \kt{TypeError} if the argument at the provided index is not an \kt{Integer}, or a \kt{DomainError} if it is a negative integer
% \framebreak
\item[\kt{ensuringArgumentIsArity(Int)}] throws a \kt{TypeError} if the argument at the provided index is not an \kt{Integer}, a \kt{DomainError} if it is a negative integer, or a \kt{RepresentationError} is it is an integer greater than \kt{MaxArity.defaultValue}
% \framebreak
\item[\kt{ensuringArgumentIsWellFormedList(Int)}] throws a \kt{TypeError} if the argument at the provided index is not an \kt{List}, or a \kt{DomainError} if it is a \kt{List} whose termination item is not \pl{[]}
% \framebreak
\item[\kt{ensuringArgumentIsCharCode(Int)}] throws a \kt{RepresentationError} if the argument at the provided index does not correspond to a character according to the UTF-16 encoding
% \framebreak
\item[\kt{checkTermIsRecursivelyCallable(Term)}] checks whether the provided \kt{Term} is a well formed clause (i.e. no sub-goal in the body is a \kt{Var}), throwing the most adequate error in case it is not
% \framebreak
\item[\kt{ensuringTermIsCharCode(Term)}] throws a \kt{RepresentationError} if the provided \kt{Term} does not correspond to a character according to the UTF-16 encoding
% \framebreak
\item[\kt{ensuringTermIsWellFormedList(Term)}] throws a \kt{TypeError} if the provided \kt{Term} is not an \kt{List}, or a \kt{DomainError} if it is a \kt{List} whose termination item is not \pl{[]}
% \framebreak
\item[\kt{ensuringProcedureHasPermission(Signature, PermissionError.Operation)}] throws a \kt{PermissionError} is the provided \kt{Signature} matches some entry among the \kt{Solver}'s libraries, or static KB
% \framebreak
\item[\kt{ensuringClauseProcedureHasPermission(Clause, PermissionError.Operation)}] same as above, except that the \kt{Signature} of the \kt{Clause}'s \kt{head} is considerer
\end{description}
\end{frame}
\begin{frame}{Other Examples: \pl{assert/1}}
\kotlinimport[basicstyle=\tiny\ttfamily]{listings/Assert.kt}
\end{frame}
\begin{frame}{Other Examples: \pl{retract/1}}
\kotlinimport[basicstyle=\tiny\ttfamily]{listings/Retract.kt}
\end{frame}
%===============================================================================
\section{Exercises}
%===============================================================================
\begin{frame}{Exercises}
\label{slide:exercies}
\begin{block}{Repository}\centering\small
\url{https://dvcs.apice.unibo.it/pika-lab/courses/ise/ay2324/lab-1}
\end{block}
%
\begin{itemize}
\startExercise
\item[] \alert{\currentExercise{}} --- Implement the \pl{read\_text/2} action as a primitive
\startExercise
\item[] \alert{\currentExercise{}} --- Implement the \pl{write\_text/2} action as a primitive
\startExercise
\item[] \alert{\currentExercise{}} --- Implement the \pl{update/1} action as a primitive
%
\begin{itemize}
\item this should be equivalent to the following meta-rule:
%
\begin{center}
\begin{tabular}{l}
\pl{update($f$($a_1$, \ldots, $a_n$)) :- }
\\
\qquad \pl{retract($f$(X$_1$, \ldots, X$_n$)),}
\\
\qquad \pl{!,}
\\
\qquad \pl{assert($f$($a_1$, \ldots, $a_n$)).}
\end{tabular}
\end{center}
\item try then re-writing the agent from slide \ref{slide:achievement} using \pl{update/1}
\end{itemize}
\end{itemize}
\end{frame}
%===============================================================================
\section*{}
%===============================================================================
%/////////
\frame{\titlepage}
%/////////
%===============================================================================
\section*{\refname}
%===============================================================================
%%%%
\setbeamertemplate{page number in head/foot}{}
%/////////
\begin{frame}[c,noframenumbering]{\refname}
%\begin{frame}[t,allowframebreaks,noframenumbering]{\refname}
% \tiny
\scriptsize
% \footnotesize
\bibliographystyle{apalike-AMS}
\bibliography{ise-lab-perception-actuation}
\end{frame}
%/////////
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%