\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}
%
\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{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]{\left\langle #1 \middle| #2 \right\rangle}
\newcommand{\inconsistent}{\bot}
\newcommand{\given}{\ensuremath{~\middle|~}}
\newcommand{\todo}[1]{{\color{red!50!black}(\emph{#1})}}
\newcommand{\remark}[2]{\dashuline{#1}~{\color{green!40!black}\emph{#2}}}
\newcommand{\replace}[2]{\sout{#1}/{\color{green!20!black}#2}}

\newcommand{\bruno}{\color{red!60!blue}}
%
%   ACRONYMS
%
\acrodef{BK}[BK]{background knowledge}
\acrodef{ASP}[ASP]{answer set program}
\acrodef{NP}[NP]{normal (logic) 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}
%
%
%
\title{Zugzwang\\\emph{Logic and Artificial Intelligence}\\{\bruno Why this title?}}
\author{
    \begin{tabular}{cc}
        Francisco Coelho & Bruno Dinis\\
        \texttt{fc@uevora.pt} & \texttt{bruno.dinis@uevora.pt}\\
        \begin{minipage}{0.5\textwidth}\centering
            Universidade de Évora and NOVA\textbf{LINCS}
        \end{minipage}
        & Universidade de Évora
    \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 \ac{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 stochastic \ac{DS} primitive and they take the form of logical facts, $a$, labelled with a probability, $p$, such as $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} $c = \set{p::a, \ldots}$ such that

\begin{equation}
    \pr{C = c} = \prod_{a\in c} p \prod_{a \not\in c} \co{p}.
    \label{eq:prob.total.choice}
\end{equation}

% \todo{Insert simple example?}


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}

%
%\todo{Outline/Explain our idea, further developed in \cref{sec:extending.probalilities}}
%
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 given \ac{TC}, $a$, but there is not enough information 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. This lack of knowledge can 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 the paper 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{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}
        0.3::a&,\cr
        b \vee c& \leftarrow a.
    \end{aligned}
    \label{eq:example.1}
\end{equation}
This specification has three stable models, $\co{a}, ab$ and $ac$ (see Figure~\ref{F:stableexample}). While it is straightforward to set $P(\co{a})=0.7$, there is \emph{no further information} to assign values to $P(ab)$ and $P(ac)$. Assuming that the \acf{SM} are (probabilistically) independent, we can use a parameter \replace{$\lambda$}{$\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$}.

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 stable models, we want to extend it to all the events of the \replace{specification}{domain}. 
    \item This extended probability can then be related to the \emph{empirical distribution}, using a probability divergence, such as Kullback-Leibler; 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. 

Conditional independence of stable worlds asserts a least informed strategy that we discussed in the introduction and make explicit here:

\begin{assumption}\label{assumption:smodels.independence}
    Stable models are conditionally independent, given their total choices.
\end{assumption}

The stable models $ab, ac$ from \cref{running.example} result from the clause $b \vee c \leftarrow a$ and the total choice $a$. These formulas alone impose 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) {$\set{}$};
            \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[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] (ac) to[bend right] (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] (c) to[bend right] (bc);
            \draw[doubt] (abc) to[bend left] (bc);
            \draw[doubt] (Abc) to (bc);
            \draw[doubt] (c) to[bend right] (Ac);
        \end{tikzpicture}
    \end{center}
    \caption{Events related to the stable models of \cref{running.example}. The circle nodes are the \acp{TC} and the shaded nodes are the \acp{SM}.}
    % \caption{Extending probabilities from total choice nodes to stable models and then to general events in a \emph{node-wise} process quickly leads to coherence problems concerning probability, with no clear systematic approach --- Instead, weight extension can be based in \emph{the relation an event has with the stable models}.{\bruno Why is this comment on the caption?}}
    \label{F:stableexample}
\end{figure}

\todo{Somewhere, we need to shift the language from extending \emph{probabilities} to extending \emph{measures}}

The diagram in \cref{F:stableexample} illustrates the problem of extending probabilities from total choice nodes to stable models and then to general events in a \emph{node-wise} process. This quickly leads to coherence problems concerning probability, with no clear systematic approach --- Instead, weight extension can be based in the relation an event has with the stable models.

\subsection{An Equivalence Relation}\label{subsec:equivalence.relation}

Given an ASP specification 
% DONE: {\bruno This should be defined somewhere (maybe in the introduction).}
\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{total choices} $c \in \fml{C} \iff c = a \vee \neg a$ and \emph{stable models} $s \in \fml{S}\subset\fml{W}$. 

% In a statistical setting, the outcomes are the literals $x$, $\neg x$ for each atom $x$, the events express a set of possible outcomes (including $\emptyset$, $\set{a, b}$, $\set{a, \neg a, b}$, \emph{etc.}), and worlds are events with no contradictions.


Our path starts with a perspective of stable models as playing a role similar to \emph{prime} factors. 
The stable models of a specification are the irreducible events entailed from that specification and any event must be \replace{interpreted}{considered} under its relation with the stable models.

\remark{\todo{Introduce a structure with worlds, events, and stable models}}{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 stable models form the basis of the equivalence relation}. %This \replace{stance}{} leads to definition \ref{def:rel.events}:

\begin{definition}\label{def:rel.events}
    The \emph{\ac{SC}} of the event $e\in \fml{E}$ is

    % \begin{equation}
    %     \uset{e} = \set{s \in \fml{S} \given e \subseteq s},\label{eq:uset}
    % \end{equation}
    % \begin{equation}
    %     \lset{e} = \set{s \in \fml{S} \given e \supseteq s}, \label{eq:lset}
    % \end{equation}
    % \begin{equation}
    %     \stablecore{e} = \uset{e} \cup \lset{e} \label{def:stable.core}
    % \end{equation}
    \begin{equation}
        \stablecore{e} := \set{s \in \fml{S} \given e \subseteq s \vee s \subseteq e} \label{eq:stable.core}
    \end{equation}

    \end{definition}
    
We now define an equivalence relation, $\sim$, so that two events are related if they are either both inconsistent or both consistent with the same stable core.

\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 stable models implies that, in \cref{def:stable.core}, either $e$ is a stable model or one of $e \subseteq s, s \subseteq e$ is never true. 
%
% \begin{definition}\label{def:smodel.events}
%     For $\set{s_1, \ldots, s_n} \subseteq \fml{S}$ define
%     \begin{equation}
%         \lclass{s_1, \ldots, s_n} = \set{e\in \fml{E}\setminus \fml{S} \given \uset{e} = \set{s_1, \ldots, s_n}},
%         \label{eq:smodel.lclass}
%     \end{equation}
%     \begin{equation}
%         \uclass{s_1, \ldots, s_n} = \set{e\in \fml{E}\setminus \fml{S} \given \lset{e} = \set{s_1, \ldots, s_n}}
%         \label{eq:smodel.uclass}
%     \end{equation}
%     and
%     \begin{equation}
%         \smclass{s_1, \ldots, s_n} = \set{s_1, \ldots, s_n}
%         \label{eq:smodel.smclass}
%     \end{equation}
% \end{definition}
%
This relation defines a partition of the events space, where each class holds a unique relation with the stable models. In particular, we denote each class by:
\begin{equation}
    \class{e} =
    \begin{cases}
        \inconsistent := \fml{E} \setminus \fml{W}   &\text{if~} e \not\in \fml{E} \setminus \fml{W}, \\
        \set{u \in \fml{W} \given \stablecore{u} = \stablecore{e}}      &\text{if~} e \in \fml{W}, \\
        % \lclass{\uset{e}}      &\text{if~} \uset{e} \not= \emptyset, \\
        % \uclass{\lset{e}}      &\text{otherwise}.
    \end{cases}\label{eq:event.class}
\end{equation}

% The stable core defines a \emph{canonical} representative of each class:
% \begin{theorem}
%     Let $e\in\fml{E}$ and $\stablecore{e} = \set{s_1, \ldots, s_n} \subseteq \fml{S}$. Then
%     \begin{equation}
%         \class{e} = \class{s_1 \cup \cdots \cup s_n}.
%     \end{equation}
%     We simplify the notation with $\class{s_1, \ldots, s_n} := \class{s_1 \cup \cdots \cup s_n}$. 
%     \todo{This only works for consistent $s_1, \ldots, s_n$: $\set{\set{}} = \class{\co{a}, ab, ac} \not= \class{a\co{a}bc} = \inconsistent$.}
% \end{theorem}
% \begin{proof}
% \todo{tbd}
% \end{proof}

The subsets of the stable models, together with $\inconsistent$, form a set of representatives. Consider again Example~\ref{running.example}. As previously mentioned, the stable models are $\fml{S} = \co{a}, ab, ac$ so the quotient set of this relation is $\class{\fml{E}}:$
\begin{equation}
    \set{
        \inconsistent,
        \emptyset,
        \class{\co{a}},
        \class{ab},
        \class{ac},
        \class{\co{a}, ab},
        \class{\co{a}, ac},
        \class{ab, ac},
        \class{\co{a}, ab, ac}
        }
% \begin{aligned}
%     & \inconsistent, \emptyset, \\
%     & \stablecore{\co{a}}, \stablecore{ab}, \stablecore{ac}, \\
%     & \stablecore{\co{a}, ab}, \stablecore{\co{a}, ac},  \stablecore{ab, ac}, \\
%     & \stablecore{\co{a}, ab, ac}.
% \end{aligned}
\end{equation}

For example, 
\begin{equation*}
    \begin{aligned}
        \class{\set{}} &= \class{\co{a}, ab, ac},
            & \class{a} &= \class{ab, ac},
            & \class{b} &= \class{ab},
            & \class{\co{b}} &= \emptyset, 
        \\ \class{a\co{c}} &= \emptyset, 
            & \class{ab} &= \emptyset,
            & \class{b\co{b}} &= \inconsistent, 
            & \class{\co{a}b} &=\class{\co{a}}, 
        \\ \class{\co{bc}} &=\emptyset,
            & \class{abc} &=  \class{ab, ac},
            & \class{a\co{b}c} &=  \class{ac},
            & \class{\co{a}bc} &=  \class{\co{a}},
        % & \class{\co{a}} &= \class{\co{a}},
        %         &  \class{\set{}} &= \class{\co{a}, ac, ab}
    \end{aligned}
\end{equation*}


\begin{itemize}
    \item Since all events within an equivalence class are in relation with a specific set of stable models, \emph{weights, including probability, should be constant within classes}:
    \[
    \forall u\in \class{e} \left(\pr{u} = \pr{e} \right).
    \]
    \item So, instead of dealing with $64 = 2^6$ events, we need only to handle $9 = 2^3 + 1$ classes, well defined in terms of combinations of the stable models. 
    % \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{itemize}
    \item Extending the probabilities, \emph{as weights}, of the total choices to events.
    \item Normalization of the weights.
\end{itemize}

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 total choices, $\pw{c} = \pr{C = c}$, expands it to stable models, $\pw{s}$, and then, within the equivalence relation from Equation \eqref{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{c} := \pr{C = c}= \prod_{a\in c} p \prod_{a \not\in c} \co{p}
        \label{eq:weight.tchoice}
    \end{equation}
    %
    \item[Stable Models.] Each total choice $c$, together with the rules and the other facts of a specification, defines a set of stable models associated with that choice, that we denote by $S_c$.
    
    Given a stable model $s \in \fml{S}$, a total choice $c$, and variables/values $\theta_{s,c} \in \intcc{0, 1}$, 
    \begin{equation}
        \pw{s, c} := \begin{cases}
            \pw{c}\theta_{s,c} & \text{if~} s \in S_c\cr
            0&\text{otherwise}
        \end{cases}
        \label{eq:weight.stablemodel}
    \end{equation}
    such that $\sum_{s\in S_c} \theta_{s,c} = 1$.
    %
    \item[Classes.] \label{item:class.cases} Each class is either the inconsistent class, $\inconsistent$, or is represented by some set of  stable models.
    \begin{itemize}
        \item \textbf{Inconsistent Class.} The inconsistent class contains events that are logically inconsistent. Since these events should never be observed:
        \begin{equation}
            \pw{\inconsistent, c} := 0.
            \label{eq:weight.class.inconsistent}
        \end{equation}
        \item \textbf{Independent Class.} A world that neither contains nor is contained in a stable model describes a case that, according to the specification, should never be observed. So the respective weight is set to zero:
        \begin{equation}
            \pw{\class{e}, c} := 0,~\text{if}~\stablecore{e} = \emptyset.
            \label{eq:weight.class.independent}
        \end{equation}
        \item \textbf{Other Classes.} The extension must be constant within a class, its value should result from the elements in the stable core, and respect the assumption \ref{assumption:smodels.independence}:
        \begin{equation}
            \pw{\class{e}, c} := \prod_{k=1}^{n}\pw{s_k, c},~\text{if}~\stablecore{e} = \set{s_1, \ldots, s_n}.
            \label{eq:weight.class.other}
        \end{equation}
    \end{itemize} 
    %
    \item[Events.] \label{item:event.cases} Each (general) event $e$ is in the class defined by its stable core, $\stablecore{e}$. So, we set:
    \begin{equation}
        \pw{e, c} := \pw{\class{e}, c}.
        \label{eq:weight.events}
    \end{equation}
    and 
    \begin{equation}
        \pw{e} := \sum_{c\in\fml{C}} \pw{e, c}.
        \label{eq:weight.events.unconditional}
    \end{equation}
\end{description}

% PARAMETERS FOR UNCERTAINTY
\begin{itemize}
    \item \todo{Remark that $\pw{\inconsistent, c} = 0$ is independent of the total choice.}
    \item \todo{Remark the example $bc$ for equation \ref{eq:weight.class.independent}.}
    \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,c}$ parameters in equation \eqref{eq:weight.stablemodel} express the \emph{specification's} lack of knowledge about the weight assignment, when a single total choice entails more than one stable model. In that case, how to distribute the respective weights? Our \replace{answer}{proposal} to \replace{}{address} this problem consists in assigning an unknown weight, $\theta_{s,c}$, conditional {\bruno depending???} on the total choice, $c$, to each stable model $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 stable models. 

    
\section{Developed Examples}

\subsection{The SBF Example}

We continue with the specification from Equation \eqref{eq:example.1}. 

\textbf{Total Choices.} The total choices, and respective stable models, are
\begin{center}
    \begin{tabular}{l|r|r}
        Total Choice ($c$) & $\pw{c}$ & Stable Models ($s$)\\
        \hline 
        $a$ & $0.3$ & $ab$ and $ac$.\\
        $\co{a} = \neg a$ & $\co{0.3} = 0.7$ & $\co{a}$.
    \end{tabular}
\end{center}

\textbf{Stable Models.} The weights from equation \eqref{eq:weight.stablemodel} can be tabulated by a matrix where a column represents a total choice and a row a stable model. We get: 
\begin{multline*}
    \pw{s, c} = 
    \begin{pmatrix}
        \pw{ab, a} & \pw{ab, \co{a}} \\
        \pw{ac, a} & \pw{ac, \co{a}} \\
        \pw{\co{a}, a} & \pw{\co{a}, \co{a}}
    \end{pmatrix}
    = 
    \begin{pmatrix}
        \pw{a} \theta_{ab, a} & \pw{\co{a}} \theta_{ab, \co{a}} \\
        \pw{a} \theta_{ac, a} & \pw{\co{a}} \theta_{ac, \co{a}} \\
        \pw{a} \theta_{\co{a}, a} & \pw{\co{a}} \theta_{\co{a}, \co{a}}
    \end{pmatrix}
    \\
    = 
    \begin{pmatrix}
        0.3 \times \theta_{ab, a} &  0.7 \times 0.0 \\
        0.3 \times \theta_{ac, a} &  0.7 \times 0.0 \\
        0.3 \times 0.0 & 0.7 \times 1.0
    \end{pmatrix}
    = 
    \begin{pmatrix}
        0.3\theta & 0.0 \\
        0.3\co{\theta} &  0.0 \\
        0.0 & 7.0
    \end{pmatrix}
\end{multline*} 
where we set $\theta = \theta_{ab, a}$ to simplify the notation.

\textbf{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, and weights:
\begin{equation*}
    \begin{array}{ll|rr}
        \text{\textbf{Core}} & \text{\textbf{Class}} & \text{\textbf{Parameters}} & \text{\textbf{Weights}}\\
        \hline 
        %
        \inconsistent
        & \text{inconsistent events}
        & 0.0
        \\
        %
        \emptyset 
        & \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 
        & 0.0
        \\
        %
        \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}
        & 1.0 
        & 0.7
        \\
        %
        ab
        & b, ab, ab\co{c}
        & \theta
        & 0.3
        \\
        %
        ac
        & c, ac, a\co{b}c 
        & \co{\theta}
        & 0.3
        \\
        %
        ab, ac
        & a, abc
        & \co{\theta}\theta
        & 0.3
        \\
        %
        \co{a}, ab, ac
        & \set{}
        & \co{\theta}\theta, 1.0
        & 0.3, 0.7
    \end{array}
\end{equation*}
\remark{fc}{I really don't like those squares}

\subsection{A Not So Simple Example}

\todo{this subsection}

\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 stable models 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}).
%
%   ================================================================
%
\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
$$
0.3::a, b \vee c \leftarrow a, 0.2::d, b \leftarrow c \wedge d.
$$
with stable models
$
\co{ad}, \co{a}d, a\co{d}b, a\co{d}c, adb
$. 


The interesting case is the subtree of the total choice $ad$. Notice that no stable model $s$ contains $adc$ because $(i)$  $adb$ is a stable model 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 total choice $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 $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}

\section{Final Remarks}

\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 total choices, given observations.
    \begin{equation*}
        \pw{e} := \sum_{c\in\fml{C}} \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}