pre-paper.tex
43.3 KB
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
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
\documentclass[a4paper, 12pt]{article}
\usepackage[
bibstyle=numeric,
citestyle=numeric
]{biblatex} %Imports biblatex package
\addbibresource{zugzwang.bib} %Import the bibliography file
\usepackage[x11colors]{xcolor}
\usepackage{tikz}
\tikzset{
event/.style={},
smodel/.style={fill=gray!25},
tchoice/.style={draw, circle},
indep/.style={draw, dashed},
proptc/.style = {-latex, dashed},
propsm/.style = {-latex, thick},
doubt/.style = {gray}
}
\usetikzlibrary{calc, positioning, patterns}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
citecolor=blue,
}
\usepackage{commath}
\usepackage{amsthm}
\newtheorem{assumption}{Assumption}
\newtheorem{definition}{Definition}
\newtheorem{proposition}{Proposition}
\newtheorem{example}{Example}
\newtheorem{theorem}{Theorem}
\usepackage{amssymb}
\usepackage[normalem]{ulem}
\usepackage[nice]{nicefrac}
\usepackage{stmaryrd}
\usepackage{acronym}
\usepackage{multicol}
\usepackage{cleveref}
%
% Local commands
%
\newcommand{\note}[1]{\marginpar{\scriptsize #1}}
\newcommand{\naf}{\ensuremath{\sim\!}}
\newcommand{\larr}{\ensuremath{\leftarrow}}
\newcommand{\at}[1]{\ensuremath{\!\del{#1}}}
\newcommand{\co}[1]{\ensuremath{\overline{#1}}}
\newcommand{\fml}[1]{\ensuremath{{\cal #1}}}
\newcommand{\deft}[1]{\textbf{#1}}
\newcommand{\pset}[1]{\ensuremath{\mathbb{P}\at{#1}}}
\newcommand{\ent}{\ensuremath{\lhd}}
\newcommand{\cset}[2]{\ensuremath{\set{#1,~#2}}}
\newcommand{\langof}[1]{\ensuremath{\fml{L}\at{#1}}}
\newcommand{\uset}[1]{\ensuremath{#1^{\ast}}}
\newcommand{\lset}[1]{\ensuremath{#1_{\ast}}}
\newcommand{\yset}[1]{\ensuremath{\left\langle #1 \right\rangle}}
\newcommand{\stablecore}[1]{\ensuremath{\left\llbracket #1 \right\rrbracket}}
\newcommand{\uclass}[1]{\ensuremath{\intco{#1}}}
\newcommand{\lclass}[1]{\ensuremath{\intoc{#1}}}
\newcommand{\smclass}[1]{\ensuremath{\intcc{#1}}}
\newcommand{\pr}[1]{\ensuremath{\mathrm{P}\at{#1}}}
\newcommand{\pw}[1]{\ensuremath{\mu\at{#1}}}
\newcommand{\class}[1]{\ensuremath{[{#1}]_{\sim}}}
\newcommand{\urep}[1]{\ensuremath{\rep{#1}{}}}
\newcommand{\lrep}[1]{\ensuremath{\rep{}{#1}}}
\newcommand{\rep}[2]{\ensuremath{\left\langle #1 \middle| #2 \right\rangle}}
\newcommand{\inconsistent}{\bot}
\newcommand{\given}{\ensuremath{~\middle|~}}
\newcommand{\emptyevent}{\ensuremath{\vartriangle}}
\newcommand{\indepclass}{\ensuremath{\Diamond}}
\newcommand{\probfact}[2]{\ensuremath{#1\!::\!#2}}
\newcommand{\tcgen}[1]{\ensuremath{\widehat{#1}}}
\newcommand{\lfrac}[2]{\ensuremath{{#1}/{#2}}}
\newcommand{\condsymb}[2]{\ensuremath{p{#1}\_{#2}}}
\newcommand{\todo}[1]{{\color{red!50!black}(\emph{#1})}}
\newcommand{\remark}[2]{\uwave{#1}~{\color{green!40!black}(\emph{#2})}}
\newcommand{\replace}[2]{\sout{#1}/{\color{green!20!black}#2}}
\newcommand{\franc}[1]{{\color{orange!60!black}#1}}
\newcommand{\bruno}{\color{red!60!blue}}
%
% Acronyms
%
\acrodef{BK}[BK]{background knowledge}
\acrodef{ASP}[ASP]{answer set program}
\acrodef{NP}[NP]{normal program}
\acrodef{DS}[DS]{distribution semantics}
\acrodef{PF}[PF]{probabilistic fact}
\acrodef{TC}[TC]{total choice}
\acrodef{SM}[SM]{stable model}
\acrodef{SC}[SC]{stable core}
\acrodef{KL}[KL]{Kullback-Leibler}
\title{An Algebraic Approach to Stochastic ASP
%Zugzwang\\\emph{Logic and Artificial Intelligence}\\{\bruno Why this title?}
}
\author{
\begin{tabular}{ccc}
Francisco Coelho
\footnote{Universidade de Évora, NOVALINCS, High Performance Computing Chair}
& Bruno Dinis
\footnote{Universidade de Évora, CIMA, CMAFcIO}
& Salvador Abreu
\footnote{Universidade de Évora, NOVALINCS}
\\
\texttt{fc@uevora.pt}
& \texttt{bruno.dinis@uevora.pt}
& \texttt{spa@uevora.pt}
\end{tabular}
}
\begin{document}
\maketitle
\nocite{*}
\begin{abstract}
\todo{rewrite}
A major limitation of logical representations in real world applications is the implicit assumption that the \acl{BK} is perfect. This assumption is problematic if data is noisy, which is often the case. Here we aim to explore how \acl{ASP} specifications with probabilistic facts can lead to \remark{characterizations of probability functions}{Why is this important? Is this what `others in sota' are trying do to?} on the specification's domain.
\end{abstract}
\section{Introduction and Motivation}
\todo{Define and/or give references to all necessary concepts used in the paper}
\todo{state of the art; references}
\Acf{ASP} is a logic programming paradigm based on the \ac{SM} semantics of \acp{NP} that can be implemented using the latest advances in SAT solving technology. Unlike ProLog, \ac{ASP} is a truly declarative language that supports language constructs such as disjunction in the head of a clause, choice rules, and hard and weak constraints.
\todo{references}
The \ac{DS} is a key approach to extend logical representations with probabilistic reasoning. \Acp{PF} are the most basic \ac{DS} stochastic primitives and take the form of logical facts, $a$, labelled with probabilities, $p$, such as $\probfact{p}{a}$; Each \ac{PF} represents a boolean random variable that is true with probability $p$ and false with probability $\co{p} = 1 - p$. A (consistent) combination of the \acp{PF} defines a \acf{TC} $t = \set{\probfact{p}{a}, \ldots}$ such that \franc{changed \acl{TC} $c$ to $t$ everywhere.}
\begin{equation}
\pr{T = t} = \prod_{a\in t} p \prod_{a \not\in t} \co{p}.
\label{eq:prob.total.choice}
\end{equation}
Our goal is to extend this probability, from \acp{TC}, to cover the \emph{specification} domain. We use the term ``specification'' as set of rules and facts, plain and probabilistic, to decouple it from any computational semantics, implied, at least implicitly, by the term ``program''. We can foresee at least two key applications of this extended probability:
\begin{enumerate}
\item Support probabilistic reasoning/tasks on the specification domain.
\item Also, given a dataset and a divergence measure, the specification can be scored (by the divergence w.r.t.\ the \emph{empiric} distribution of the dataset), and weighted or sorted amongst other specifications. These are key ingredients in algorithms searching, for example, optimal specifications of a dataset.
\end{enumerate}
Our idea to extend probabilities starts with the stance that a specification describes an \emph{observable system} and that observed events must be related with the \acp{SM} of that specification. From here, probabilities must be extended from \aclp{TC} to \acp{SM} and then from \acp{SM} to any event.
Extending probability from \acp{TC} to \acp{SM} faces a critical problem, illustrated by the example in \cref{sec:example.1}, concerning situations where multiple \acp{SM}, $ab$ and $ac$, result from a single \ac{TC}, $a$, but there is not enough information (in the specification) to assign a single probability to each \ac{SM}. We propose to address this issue by using algebraic variables to describe that lack of information and then estimate the value of those variables from empirical data.
In a related work, \cite{verreet2022inference}, epistemic uncertainty (or model uncertainty) is considered as a lack of knowledge about the underlying model, that may be mitigated via further observations. This seems to presuppose a Bayesian approach to imperfect knowledge in the sense that having further observations allows to improve/correct the model. Indeed, the approach in that work uses Beta distributions in order to be able to learn the full distribution. This approach seems to be specially fitted to being able to tell when some probability lies beneath some given value. \todo{Our approach seems to be similar in spirit. If so, we should mention this in the introduction.}
\todo{Also remark that our apporach remains algebraic in the way that we address the problems concerning the extension of probabilities.}
\todo{cite \citetitle{sympy} \franc{--- why here? but cite \citetitle{cozman2020joy} and relate with our work.}}
\todo{Discuss the least informed strategy and the corolary that \aclp{SM} should be conditionally independent on the \acl{TC}.}
\todo{Give an outline of the paper.}
\section{A simple but fruitful example}\label{sec:example.1}
\todo{Write an introduction to the section}
\begin{example}\label{running.example}
Consider the following specification
\begin{equation}
\begin{aligned}
\probfact{0.3}{a}&,\cr
b \vee c& \leftarrow a.
\end{aligned}
\label{eq:example.1}
\end{equation}
This specification has three \aclp{SM}, $\co{a}, ab$ and $ac$ (see \cref{fig:running.example}). While it is straightforward to set $P(\co{a})=0.7$, there is no further information to assign values to $P(ab)$ and $P(ac)$. Assuming that the \acfp{SM} are (probabilistically) independent, we can use a parameter $\theta$ such that
$$
\begin{aligned}
P(ab) &= 0.3 \theta,\cr
P(ac) &= 0.3 (1 - \theta).
\end{aligned}
$$
\end{example}
While uncertainty is inherent to the specification it can be mitigated with the help of a dataset: the parameter $\theta$ can be estimated from a empirical distribution \todo{or we can have a distribution of $\theta$}. \todo{point to examples of this in following sections.}
In summary, if an \ac{ASP} specification is intended to describe some observable system then:
\begin{enumerate}
\item Observations can be used to estimate the value of the parameters (such as $\theta$ above and others entailed from further clauses).
\item \todo{What about the case where we already know a distribution of $\theta$?}
\item With a probability set for the \aclp{SM}, we want to extend it to all the events of the specification domain.
\item This extended probability can then be related to the \emph{empirical distribution}, using a probability divergence, such as \ac{KL}; and the divergence value used as a \emph{performance} measure of the specification with respect to the observations.
\item If that specification is only but one of many possible candidates then that performance measure can be used, \emph{e.g.} as fitness, by algorithms searching (optimal) specifications of a dataset of observations.
\end{enumerate}
\begin{quote}
\todo{Expand this:} If observations are not consistent with the models of the specification, then the specification is wrong and must be changed.
\end{quote}
Currently, we are addressing the problem of extending a probability function (possibly using parameters such as $\theta$), defined on the \acp{SM} of a specification, to all the events of that specification. Of course, this extension must satisfy the Kolmogorov axioms of probability so that probabilistic reasoning is consistent with the \ac{ASP} specification.
The conditional independence of stable worlds asserts the \remark{least informed strategy}{references?} that we discussed in the introduction and make explicit here:
\begin{assumption}\label{assumption:smodels.independence}
\Acl{SM} are conditionally independent, given their \aclp{TC} .
\end{assumption}
The \aclp{SM} $ab, ac$ from \cref{running.example} result from the clause $b \vee c \leftarrow a$ and the \acl{TC} $a$. These formulas alone imposes no relation between $b$ and $c$ (given $a$), so none should be assumed. Dependence relations are further discussed in \cref{subsec:dependence}.
\section{Extending Probabilities}\label{sec:extending.probalilities}
\begin{figure}[t]
\begin{center}
\begin{tikzpicture}
\node[event] (E) {$\emptyevent$};
\node[tchoice, above left = of E] (a) {$a$};
\node[smodel, above left = of a] (ab) {$ab$};
\node[smodel, above right = of a] (ac) {$ac$};
\node[event, below = of ab] (b) {$b$};
\node[event, below = of ac] (c) {$c$};
\node[event, above right = of ab] (abc) {$abc$};
\node[event, above left = of ab] (abC) {$ab\co{c}$};
\node[event, above right = of ac] (aBc) {$a\co{b}c$};
\node[indep, right = of ac] (bc) {$bc$};
\node[tchoice, smodel, below right = of bc] (A) {$\co{a}$};
\node[event, above = of A] (Ac) {$\co{a}c$};
\node[event, above right = of Ac] (Abc) {$\co{a}bc$};
% ----
\draw[doubt] (a) to[bend left] (ab);
\draw[doubt] (a) to[bend right] (ac);
\draw[doubt] (ab) to[bend left] (abc);
\draw[doubt] (ab) to[bend right] (abC);
\draw[doubt] (ac) to[bend right] (abc);
\draw[doubt] (ac) to[bend left] (aBc);
\draw[doubt, dash dot] (Ac) to (Abc);
\draw[doubt] (A) to (Ac);
\draw[doubt] (A) to (Abc);
\draw[doubt] (ab) to[bend right] (E);
\draw[doubt] (ac) to[bend right] (E);
\draw[doubt] (A) to[bend left] (E);
\draw[doubt] (ab) to (b);
\draw[doubt] (ac) to (c);
% \draw[doubt] (ab) to[bend left] (a);
% \draw[doubt] (ac) to[bend right] (a);
\draw[doubt, dash dot] (c) to[bend right] (bc);
\draw[doubt, dash dot] (abc) to[bend left] (bc);
\draw[doubt, dash dot] (bc) to (Abc);
\draw[doubt, dash dot] (c) to[bend right] (Ac);
\end{tikzpicture}
\end{center}
\caption{Events related to the \aclp{SM} of \cref{running.example}. The circle nodes are \aclp{TC} and shaded nodes are \aclp{SM}. The \emph{empty event}, with no literals, is denoted by $\emptyevent$. Notice that the event $bc$ is not related with any \acl{SM}.}
\label{fig:running.example}
\end{figure}
\todo{Somewhere, we need to shift the language from extending \emph{probabilities} to extending \emph{measures}}
\note{$\emptyevent$ notation introduced in \cref{fig:running.example}.}
The diagram in \cref{fig:running.example} illustrates the problem of extending probabilities from \acp{TC} nodes to \acp{SM} and then to general events in a \emph{node-wise} process. This quickly leads to \remark{coherence problems}{for example?} concerning probability, with no clear systematic approach --- Instead, weight extension can be based in the relation an event has with the \aclp{SM}.
\subsection{An Equivalence Relation}\label{subsec:equivalence.relation}
\begin{figure}[t]
\begin{center}
\begin{tikzpicture}
\node[event] (E) {$\emptyevent$};
\node[tchoice, above left = of E] (a) {$a$};
\node[smodel, above left = of a] (ab) {$ab$};
\node[smodel, above right = of a] (ac) {$ac$};
\node[event, below = of ab] (b) {$b$};
\node[event, below = of ac] (c) {$c$};
\node[event, above right = of ab] (abc) {$abc$};
\node[event, above left = of ab] (abC) {$ab\co{c}$};
\node[event, above right = of ac] (aBc) {$a\co{b}c$};
\node[indep, right = of ac] (bc) {$bc$};
\node[tchoice, smodel, below right = of bc] (A) {$\co{a}$};
\node[event, above = of A] (Ac) {$\co{a}c$};
\node[event, above right = of Ac] (Abc) {$\co{a}bc$};
% ----
\path[draw, rounded corners, pattern=north west lines, opacity=0.2]
(ab.west) --
(ab.north west) --
%
(abC.south west) --
(abC.north west) --
(abC.north) --
%
(abc.north east) --
(abc.east) --
(abc.south east) --
%
(ab.north east) --
(ab.east) --
(ab.south east) --
%
(a.north east) --
%
(E.north east) --
(E.east) --
(E.south east) --
(E.south) --
(E.south west) --
%
(b.south west) --
%
(ab.west)
;
% ----
\path[draw, rounded corners, pattern=north east lines, opacity=0.2]
(ac.south west) --
(ac.west) --
(ac.north west) --
%
(abc.south west) --
(abc.west) --
(abc.north west) --
%
(aBc.north east) --
(aBc.east) --
(aBc.south east) --
%
(ac.north east) --
%
(c.east) --
%
(E.east) --
(E.south east) --
(E.south) --
(E.south west) --
%
(a.south west) --
(a.west) --
(a.north west) --
(a.north) --
%
(ac.south west)
;
% ----
\path[draw, rounded corners, pattern=horizontal lines, opacity=0.2]
% (A.north west) --
%
(Ac.north west) --
%
(Abc.north west) --
(Abc.north) --
(Abc.north east) --
(Abc.south east) --
%
% (Ac.north east) --
% (Ac.east) --
%
% (A.east) --
(A.south east) --
%
(E.south east) --
(E.south) --
(E.south west) --
(E.west) --
(E.north west) --
%
(Ac.north west)
;
\end{tikzpicture}
\end{center}
\caption{Classes (of consistent events) related to the \aclp{SM} of \cref{running.example} are defined through intersections and inclusions. \todo{write the caption}}
\label{fig:running.example.classes}
\end{figure}
Given an ASP specification,
\remark{{\bruno Introduce also the sets mentioned below}}{how?}
we consider the \emph{atoms} $a \in \fml{A}$ and \emph{literals}, $z \in \fml{L}$, \emph{events} $e \in \fml{E} \iff e \subseteq \fml{L}$ and \emph{worlds} $w \in \fml{W}$ (consistent events), \emph{\aclp{TC} } $t \in \fml{T} \iff t = a \vee \neg a$ and \emph{\aclp{SM} } $s \in \fml{S}\subset\fml{W}$.
Our path starts with a perspective of \aclp{SM} as playing a role similar to \emph{prime} factors. The \aclp{SM} of a specification are the irreducible events entailed from that specification and any event must be \replace{interpreted}{considered} under its relation with the \aclp{SM}.
%\remark{\todo{Introduce a structure with worlds, events, and \aclp{SM} }}{seems irrelevant}
This focus on the \acp{SM} leads to the following definition:
\begin{definition}\label{def:stable.structure}
A \emph{stable structure} is a pair $\del{A, S}$ where $A$ is a \remark{set of atoms}{can be extracted from $S$.} and $S$ is a set of consistent events over $A$.
\end{definition}
\todo{expand this text to explain how the \aclp{SM} form the basis of the equivalence relation}. %This \replace{stance}{} leads to definition \ref{def:rel.events}:
\begin{definition}\label{def:stable.core}
The \emph{\ac{SC}} of the event $e\in \fml{E}$ is
\begin{equation}
\stablecore{e} := \set{s \in \fml{S} \given s \subseteq e \vee e \subseteq s} \label{eq:stable.core}
\end{equation}
\end{definition}
We now define an equivalence relation, $\sim$, so that two events are related if either both are inconsistent or both are consistent with the same \acl{SC}.
\begin{definition}\label{def:equiv.rel}
For a given specification, let $u, v \in \fml{E}$. The equivalence relation $\sim$ is defined by
\begin{equation}
u \sim v :\!\iff u,v \not\in\fml{W} \vee \del{u,v \in \fml{W} \wedge \stablecore{u} = \stablecore{v}}.\label{eq:equiv.rel}
\end{equation}
\end{definition}
Observe that the minimality of \aclp{SM} implies that, in \cref{def:stable.core}, either $e$ is a \acl{SM} or one of $s \subseteq e, e \subseteq s$ is never true. This relation defines a partition of the events space, where each class holds a unique relation with the \aclp{SM}. In particular, we denote each class by:
\begin{equation}
\class{e} =
\begin{cases}
\inconsistent := \fml{E} \setminus \fml{W}
&\text{if~} e \in \fml{E} \setminus \fml{W}, \\
\set{u \in \fml{W} \given \stablecore{u} = \stablecore{e}}
&\text{if~} e \in \fml{W},
\end{cases}\label{eq:event.class}
\end{equation}
The subsets of the \aclp{SM}, together with $\inconsistent$, form a set of representatives. Consider again Example~\ref{running.example}. As previously mentioned, the \aclp{SM} are $\fml{S} = \co{a}, ab, ac$ so the quotient set of this relation is:
\begin{equation}
\class{\fml{E}} = \set{
\inconsistent,
\indepclass,
\class{\co{a}},
\class{ab},
\class{ac},
\class{\co{a}, ab},
\class{\co{a}, ac},
\class{ab, ac},
\class{\co{a}, ab, ac}
}
\end{equation}
where $\indepclass$ denotes both the class of \emph{independent} events $e$ such that $\stablecore{e} = \emptyset$ and its core (which is the emptyset). We have:
\begin{equation*}
\begin{array}{l|lr}
\text{\textbf{Core}}, \stablecore{e}
& \text{\textbf{Class}}, \class{e}
& \text{\textbf{Size}}, \# \class{e}\\
\hline
%
\inconsistent
& a\co{a}, \ldots
& 37
\\
%
\indepclass
& \co{b}, \co{c}, bc, \co{b}a, \co{b}c, \co{b}\co{c}, \co{c}a, \co{c}b, \co{b}\co{c}a
& 9
\\
%
\co{a}
& \co{a}, \co{a}b, \co{a}c, \co{a}\co{b}, \co{a}\co{c}, \co{a}bc, \co{a}b\co{c}, \co{a}\co{b}c, \co{a}\co{b}\co{c}
& 9
\\
%
ab
& b, ab, ab\co{c}
& 3
\\
%
ac
& c, ac, a\co{b}c
& 3
\\
%
\co{a}, ab
& \emptyset
& 0
\\
%
\co{a}, ac
& \emptyset
& 0
%
\\
%
ab, ac
& a, abc
& 2
\\
%
\co{a}, ab, ac
& \emptyevent
& 1
\\
%
\hline
\Omega
& \text{all events}
& 64
\end{array}
\end{equation*}
\begin{itemize}
\item Since all events within an equivalence class are in relation with a specific set of \aclp{SM}, \emph{weights, including probability, should be constant within classes}:
\[
\forall u\in \class{e} \left(\mu\at{u} = \mu\at{e} \right).
\]
\item So, instead of dealing with $64 = 2^6$ events, we consider the $9 = 2^3 + 1$ classes, well defined in terms of combinations of the \aclp{SM}. In general, we have \emph{much more} \aclp{SM} than literals. Nevertheless, the equivalence classes allow us to propagate probabilities from \aclp{TC} to events, as explained in the next subsection.
% \item The extended probability \emph{events} are the \emph{classes}.
\end{itemize}
\subsection{From Total Choices to Events}\label{subsec:from.tchoices.to.events}
\todo{Check adaptation} Our path to set a probability measure on $\fml{E}$ has two phases:
\begin{enumerate}
\item Extending the probabilities, \emph{as weights}, from the \aclp{TC} to events.
\item Normalization of the weights.
\end{enumerate}
The ``extension'' phase, traced by equations (\ref{eq:prob.total.choice}) and (\ref{eq:weight.tchoice} --- \ref{eq:weight.events}), starts with the weight (probability) of \aclp{TC}, $\pw{t} = \pr{T = t}$, expands it to \aclp{SM}, $\pw{s}$, and then, within the equivalence relation from \cref{eq:equiv.rel}, to (general) events, $\pw{e}$, including (consistent) worlds.
\begin{description}
%
\item[Total Choices.] Using \eqref{eq:prob.total.choice}, this case is given by
\begin{equation}
\pw{t} := \pr{T = t}= \prod_{a\in t} p \prod_{a \not\in t} \co{p}
\label{eq:weight.tchoice}
\end{equation}
%
\item[Stable Models.] Each \acl{TC} $t$, together with the rules and the other facts of a specification, defines a set of \aclp{SM} associated with that choice, that \remark{we denote by $\tcgen{t}$}{put this in the introduction, where core concepts are presented}.
Given a \acl{SM} $s \in \fml{S}$, a \acl{TC} $t$, and variables/values $\theta_{s,t} \in \intcc{0, 1}$,
\begin{equation}
\pw{s, t} := \begin{cases}
\theta_{s,t} & \text{if~} s \in \tcgen{t}\cr
0&\text{otherwise}
\end{cases}
\label{eq:weight.stablemodel}
\end{equation}
such that $\sum_{s\in \tcgen{t}} \theta_{s,t} = 1$.
%
\item[Classes.] \label{item:class.cases} Each class is either the inconsistent class, $\inconsistent$, or is represented by some set of \aclp{SM}.
\begin{description}
\item[Inconsistent Class.] The inconsistent class contains events that are logically inconsistent, thus should never be observed:
\begin{equation}
\pw{\inconsistent, t} := 0.
\label{eq:weight.class.inconsistent}
\end{equation}
\item[Independent Class.] A world that neither contains nor is contained in a \acl{SM} describes a case that, according to the specification, shouldn't exist. So the respective weight is set to zero:
\begin{equation}
\pw{\indepclass, t} := 0.
\label{eq:weight.class.independent}
\end{equation}
\item[Other Classes.] The extension must be constant within a class, its value should result from the elements in the \acl{SC}, and respect the assumption \ref{assumption:smodels.independence} (\aclp{SM} independence):
\begin{equation}
\pw{\class{e}, t} := \sum_{k=1}^{n}\pw{s_k, t},~\text{if}~\stablecore{e} = \set{s_1, \ldots, s_n}.
\label{eq:weight.class.other}
\end{equation}
and
\begin{equation}
\pw{\class{e}} := \sum_{t \in \fml{T}} \pw{\class{e}, t}\pw{t}.
\label{eq:weight.class.unconditional}
\end{equation}
\end{description}
%
\item[Events.] \label{item:event.cases} Each (general) event $e$ is in the class defined by its \acl{SC}, $\stablecore{e}$. So, we set:
\begin{equation}
\pw{e, t} := \frac{\pw{\class{e}, t}}{\# \class{e}} .
\label{eq:weight.events}
\end{equation}
and
\begin{equation}
\pw{e} := \sum_{t\in\fml{T}} \pw{e, t} \pw{t}.
\label{eq:weight.events.unconditional}
\end{equation}
% \remark{instead of that equation}{if we set $\pw{s,t} := \theta_{s,t}$ in equation \eqref{eq:weight.stablemodel} here we do:
% $$
% \pw{e} := \sum_{t\in\fml{T}} \pw{e, t}\pw{t}.
% $$
% By the way, this is the \emph{marginalization + bayes theorem} in statistics:
% $$
% P(A) = \sum_b P(A | B=b)P(B=b)
% $$
% }
\end{description}
% PARAMETERS FOR UNCERTAINTY
\begin{itemize}
\item \todo{Remark that $\pw{\inconsistent, t} = 0$ is independent of the \acl{TC}.}
\item Consider the event $bc$. Since $\class{bc} = \indepclass$, from \cref{eq:weight.class.independent} we get $\mu\at{bc} = 0$.
\item \todo{Remark that equation \eqref{eq:weight.events.unconditional}, together with observations, can be used to learn about the \emph{initial} probabilities of the atoms, in the specification.}
\end{itemize}
The $\theta_{s,t}$ parameters in equation \eqref{eq:weight.stablemodel} express the \emph{specification's} lack of knowledge about the weight assignment, when a single \acl{TC} entails more than one \acl{SM}. In that case, how to distribute the respective weights? Our proposal to address this problem consists in assigning an unknown weight, $\theta_{s,t}$, conditional on the \acl{TC}, $t$, to each \acl{SM} $s$. This approach allows the expression of an unknown quantity and future estimation, given observed data.
% SUPERSET
Equation \eqref{eq:weight.class.other} results from conditional independence of \aclp{SM}.
\section{Developed Examples}
\subsection{The SBF Example}
We continue with the specification from Equation \eqref{eq:example.1}.
\begin{description}
%
\item[\Aclp{TC}.] The \aclp{TC}, and respective \aclp{SM}, are
\begin{center}
\begin{tabular}{ll|r}
\textbf{\Acl{TC}} & \textbf{\Aclp{SM}} & \textbf{$\pw{t}$}\\
\hline
$a$ & $ab, ac$ & $0.3$\\
$\co{a} = \neg a$ & $\co{a}$ & $\co{0.3} = 0.7$
\end{tabular}
\end{center}
%
\item[\Aclp{SM}.] The $\theta_{s,t}$ parameters in this example are
$$
\theta_{ab,\co{a}} = \theta_{ac,\co{a}} = \theta_{\co{a}, a} = 0
%
\text{~and~}
%
\theta_{\co{a}, \co{a}} = 1, \theta_{ab, a} = \theta, \theta_{ac, a} = \co{\theta}
$$
with $\theta \in \intcc{0, 1}$.
\item[Classes.] Following the definitions in \cref{eq:stable.core,eq:equiv.rel,eq:event.class} and in \cref{eq:weight.class.inconsistent,eq:weight.class.independent,eq:weight.class.other} we get the following quotient set (ignoring $\inconsistent$ and $\indepclass$), and weights:
\begin{equation*}
\begin{array}{l|ll|r}
\stablecore{e}
& \pw{s_k, t= \co{a}}
& \pw{s_k, t= a}
& \pw{\class{e}}=\sum_{t}\pw{\class{e},t}\pw{t}
\\
\hline
\co{a}
& 1
&
& 0.7
\\
%
ab
&
& \theta
& 0.3\theta
\\
%
ac
&
& \co{\theta}
& 0.3\co{\theta}
\\
%
\co{a}, ab
& 1, 0
& 0, \theta
& 0.7 + 0.3\theta
\\
%
\co{a}, ac
& 1, 0
& 0, \co{\theta}
& 0.7 + 0.3\co{\theta}
\\
%
ab, ac
&
& \theta, \co{\theta}
& 0.3
\\
%
\co{a}, ab, ac
& 1, 0, 0
& 0, \theta, \co{\theta}
& 1
\end{array}
\end{equation*}
\item[Normalization.] To get a weight that sums up to one, we compute the \emph{normalization factor}. Since $\pw{\cdot}$ is constant on classes,\todo{prove that we get a probability.}
\begin{equation*}
Z := \sum_{e\in\fml{E}} \pw{e}
= \sum_{\class{e} \in\class{\fml{E}}} \frac{\pw{\class{e}}}{\#\class{e}},
\end{equation*}
that divides the weight function into a normalized weight
\begin{equation*}
\pr{e} := \frac{\pw{e}}{Z}.
\end{equation*}
such that
$$
\sum_{e \in \fml{E}} \pr{e} = 1.
$$
For the SBF example,
\begin{equation*}
\begin{array}{lr|r|rr}
\stablecore{e}
& \# \class{e}
& \pw{\class{e}}
& \pw{e}
& \pr{e}
\\
\hline
%
\inconsistent
& 37
& 0
& 0
& 0
\\[4pt]
%
\indepclass
& 9
& 0
& 0
& 0
\\[4pt]
%
\co{a}
& 9
& \frac{7}{10}
& \frac{7}{90}
& \frac{7}{792}
\\[4pt]
%
ab
& 3
& \frac{3\theta}{10}
& \frac{\theta}{10}
& \frac{\theta}{88}
\\[4pt]
%
ac
& 3
& \frac{3\co{\theta}}{10}
& \frac{\co{\theta}}{10}
& \frac{\co{\theta}}{88}
\\[4pt]
%
\co{a}, ab
& 0
& \frac{7 + 3\theta}{10}
& 0
& 0
\\[4pt]
%
\co{a}, ac
& 0
& \frac{7 + 3\co{\theta}}{10}
& 0
& 0
%
\\[4pt]
%
ab, ac
& 2
& \frac{3}{10}
& \frac{3}{20}
& \frac{3}{176}
\\[4pt]
%
\co{a}, ab, ac
& 1
& 1
& 1
& \frac{5}{176}
\\[4pt]
%
\hline
&
& Z = \frac{44}{5}
\end{array}
\end{equation*}
\end{description}
\todo{Continue this example with a set of observations to estimate $\theta$ and try to show some more. For example, that the resulting distribution is not very good when $t = \co{a}$. Also gather a sample following the specification.}
%
%
%
\subsection{An example involving Bayesian networks}
\franc{Cometários:}
\begin{itemize}
\item Há uma macro, $\backslash\text{pr}\{A\}$, para denotar a função de probabilidade, $\pr{A}$ em vez de $P(A)$. Já agora, para a condicional também há um comando, $\backslash\text{given}$: $\pr{A \given B}$.
\item E, claro, para factos+probabilidades: $\probfact{p}{a}$.
\item A designação dos `pesos' não está consistente: $pj\_a$ e $a\_be$. Fiz uma macro (hehe) para sistematizar isto: \condsymb{a}{bnc}
\end{itemize}
As it turns out, our framework is suitable to deal with more sophisticated cases, \replace{for example}{in particular} cases involving Bayesian networks. In order to illustrate this, in this section we see how the classical example of the Burglary, Earthquake, Alarm \cite{Judea88} works in our setting. This example is a commonly used example in Bayesian networks because it illustrates reasoning under uncertainty. The gist of example is given in \cref{Figure_Alarm}. It involves a simple network of events and conditional probabilities.
The events are: Burglary ($B$), Earthquake ($E$), Alarm ($A$), Mary calls ($M$) and John calls ($J$). The initial events $B$ and $E$ are assumed to be independent events that occur with probabilities $P(B)$ and $P(E)$, respectively. There is an alarm system that can be triggered by either of the initial events $B$ and $E$. The probability of the alarm going off is a conditional probability given that $B$ and $E$ have occurred. One denotes these probabilities, as per usual, by $P(A|B)$, and $P(A|E)$. There are two neighbours, Mary and John who have agreed to call if they hear the alarm. The probability that they do actually call is also a conditional probability denoted by $P(M|A)$ and $P(J|A)$, respectively.
\begin{figure}
\begin{center}
\begin{tikzpicture}[node distance=2.5cm]
% Nodes
\node[smodel, circle] (A) {A};
\node[tchoice, above right of=A] (B) {B};
\node[tchoice, above left of=A] (E) {E};
\node[tchoice, below left of=A] (M) {M};
\node[tchoice, below right of=A] (J) {J};
% Edges
\draw[->] (B) to[bend left] (A) node[right,xshift=1.1cm,yshift=0.8cm] {\footnotesize{$P(B)=0.001$}} ;
\draw[->] (E) to[bend right] (A) node[left, xshift=-1.4cm,yshift=0.8cm] {\footnotesize{$P(E)=0.002$}} ;
\draw[->] (A) to[bend right] (M) node[left,xshift=0.2cm,yshift=0.7cm] {\footnotesize{$P(M|A)$}};
\draw[->] (A) to[bend left] (J) node[right,xshift=-0.2cm,yshift=0.7cm] {\footnotesize{$P(J|A)$}} ;
\end{tikzpicture}
\end{center}
\begin{multicols}{3}
\footnotesize{
\begin{equation*}
\begin{split}
&P(M|A)\\
& \begin{array}{c|cc}
& m & \neg m \\
\hline
a & 0.9 & 0.1\\
\neg a& 0.05 & 0.95
\end{array}
\end{split}
\end{equation*}
}
\footnotesize{
\begin{equation*}
\begin{split}
&P(J|A)\\
& \begin{array}{c|cc}
& j & \neg j \\
\hline
a & 0.7 & 0.3\\
\neg a& 0.01 & 0.99
\end{array}
\end{split}
\end{equation*}
}
\footnotesize{
\begin{equation*}
\begin{split}
P(A|B \wedge E)\\
\begin{array}{c|c|cc}
& & a & \neg a \\
\hline
b & e & 0.95 & 0.05\\
b & \neg e & 0.94 & 0.06\\
\neg b & e & 0.29 & 0.71\\
\neg b & \neg e & 0.001 & 0.999
\end{array}
\end{split}
\end{equation*}
}
\end{multicols}
\caption{The Earthquake, Burglary, Alarm model}
\label{Figure_Alarm}
\end{figure}
Considering the probabilities given in \cref{Figure_Alarm} we obtain the following spe\-ci\-fi\-ca\-tion
\begin{equation*}
\begin{aligned}
\probfact{0.001}{b}&,\cr
\probfact{0.002}{e}&,\cr
\end{aligned}
\label{eq:not_so_simple_example}
\end{equation*}
For the table giving the probability $P(M|A)$ we obtain the specification:
\begin{equation*}
\begin{aligned}
\probfact{0.9}{pm\_a}&,\cr
\probfact{0.05}{pm\_na}&,\cr
m & \leftarrow a, pm\_a,\cr
\neg m & \leftarrow a, \neg pm\_a.
\end{aligned}
\end{equation*}
This latter specification can be simplified by writing $\probfact{0.9}{m \leftarrow a}$ and $\probfact{0.05}{m \leftarrow \neg a}$.
Similarly, for the probability $P(J|A)$ we obtain
\begin{equation*}
\begin{aligned}
&\probfact{0.7}{pj\_a},\cr
&\probfact{0.01}{pj\_na},\cr
j & \leftarrow a, pj\_a,\cr
\neg j & \leftarrow a, \neg pj\_a.\cr
\end{aligned}
\end{equation*}
Again, this can be simplified by writing $\probfact{0.7}{j \leftarrow a}$ and $\probfact{0.01}{j \leftarrow \neg a}$.
Finally, for the probability $P(A|B \wedge E)$ we obtain
\begin{equation*}
\begin{aligned}
&\probfact{0.95}{a\_be},\cr
&\probfact{0.94}{a\_bne},\cr
&\probfact{0.29}{a\_nbe},\cr
&\probfact{0.001}{a\_nbne},\cr
a & \leftarrow b, e, a\_be,\cr
\neg a & \leftarrow b,e, \neg a\_be, \cr
a & \leftarrow b,e, a\_bne,\cr
\neg a & \leftarrow b,e, \neg a\_bne, \cr
a & \leftarrow b,e, a\_nbe,\cr
\neg a & \leftarrow b,e, \neg a\_nbe, \cr
a & \leftarrow b,e, a\_nbne,\cr
\neg a & \leftarrow b,e, \neg a\_nbne. \cr
\end{aligned}
\end{equation*}
One can then proceed as in the previous subsection and analyse this example. The details of such analysis are not given here since they are analogous, albeit admittedly more cumbersome.
\section{Discussion}
% % SUBSET
% \hrule
%
% \bigskip
% I'm not sure about what to say here.\marginpar{todo}
%
% My first guess was
% \begin{equation*}
% \pr{W = w \given C = c} = \sum_{s \supset w}\pr{S = s \given C = c}.
% \end{equation*}
%
% $\pr{W = w \given C = c}$ already separates $\pr{W}$ into \textbf{disjoint} events!
%
% Also, I am assuming that \aclp{SM} are independent.
%
% This would entail $p(w) = p(s_1) + p(s_2) - p(s_1)p(s_2)$ \emph{if I'm bound to set inclusion}. But I'm not. I'm defining a relation
%
% Also, if I set $p(w) = p(s_1) + p(s_2)$ and respect the laws of probability, this entails $p(s_1)p(s_2) = 0$.
%
% So, maybe what I want is (1) to define the cover $\hat{w} = \cup_{s \supset w} s$
%
% \begin{equation*}
% \pr{W = w \given C = c} = \sum_{s \supset w}\pr{S = s \given C = c} - \pr{W = \hat{w} \given C = c}.
% \end{equation*}
%
% But this doesn't works, because we'd get $\pr{W = a \given C = a} < 1$.
% %
%
% %
% \bigskip
% \hrule
%
% INDEPENDENCE
%
%, per equation (\ref{eq:weight.class.independent}).
%
% ================================================================
%
\begin{itemize}
\item Changed from $\prod$ to $\sum$ to represent ``either'' instead of ``both'' since the later is not consistent with the ``only one stable model at a time'' assumption.
\item \todo{The `up and down' choice in the equivalence relation and the possibility of describing any probability distribution.}
\item \todo{Remark that no benchmark was done with other SOTA efforts.}
\item \todo{The possibility to `import' bayesian theory and tools to this study.}
\end{itemize}
\subsection{Dependence}
\label{subsec:dependence}
Our basic assertion about dependence relations between atoms of the underlying system is that they can be \emph{explicitly expressed in the specification}. And, in that case, they should be.
For example, a dependence relation between $b$ and $c$ can be expressed by $b \leftarrow c \wedge d$, where $d$ is an atomic choice that explicitly expresses the dependence between $b$ and $c$. One would get, for example, a specification such as
$$
\probfact{0.3}{a}, b \vee c \leftarrow a, \probfact{0.2}{d}, b \leftarrow c \wedge d.
$$
with \aclp{SM}
$
\co{ad}, \co{a}d, a\co{d}b, a\co{d}c, adb
$.
The interesting case is the subtree of the \acl{TC} $ad$. Notice that no \acl{SM} $s$ contains $adc$ because $(i)$ $adb$ is a \acl{SM} and $(ii)$ if $adc \subset s$ then $b \in s$ so $adb \subset s$.
Following equations \eqref{eq:world.fold.stablemodel} and \eqref{eq:world.fold.independent} {\bruno What are these equations?} this entails
\begin{equation*}
\begin{cases}
\pr{W = adc \given C = ad} = 0,\cr
\pr{W = adb \given C = ad} = 1
\end{cases}
\end{equation*}
which concentrates all probability mass from the \acl{TC} $ad$ in the $adb$ branch, including the node $W = adbc$. This leads to the following cases:
$$
\begin{array}{l|c}
x & \pr{W = x \given C = ad}\\
\hline
ad & 1 \\
adb & 1\\
adc & 0\\
adbc & 1
\end{array}
$$
so, for $C = ad$,
$$
\begin{aligned}
\pr{W = b} &= \frac{2}{4} \cr
\pr{W = c} &= \frac{1}{4} \cr
\pr{W = bc} &= \frac{1}{4} \cr
&\not= \pr{W = b}\pr{W = c}
\end{aligned}
$$
\emph{i.e.} the events $W = b$ and $W = c$ are dependent and that dependence results directly from the segment $\probfact{0.2}{d}, b \leftarrow c \wedge d$ in the specification.
{\bruno Why does this not contradict Assumption 1?}
%
%
\hrule
\begin{quotation}\note{Todo}
Prove the four world cases (done), support the product (done) and sum (tbd) options, with the independence assumptions.
\end{quotation}
\subsection{Future Work}
\todo{develop this section.}
\begin{itemize}
\item The measure of the inconsistent events doesn't need to be set to $0$ and, maybe, in some cases, it shouldn't.
\item The physical system might have \emph{latent} variables, possibly also represented in the specification. These variables are never observed, so observations should be concentrated \emph{somewhere else}.
\item Comment on the possibility of extending equation \eqref{eq:weight.events.unconditional} with parameters expressing further uncertainties, enabling a tuning of the model's \aclp{TC}, given observations.
\begin{equation*}
\pw{e} := \sum_{c\in\fml{T}} \pw{e, c}\theta_c.
\end{equation*}
\end{itemize}
\section*{Acknowledgements}
This work is supported by NOVA\textbf{LINCS} (UIDB/04516/2020) with the financial support of FCT.IP.
\printbibliography
\end{document}