Valentin Iovene

Answering Meta-Analytic Questions on Heterogeneous and Uncertain Neuroscientific Data with Probabilistic Logic Programming

Keywords: Answering meta-analytic questions on heterogeneous and uncertain neuroscientific data with probabilistic logic programming logic programming, cognitive neuroscience, probabilistic programming, machine learning, domain-specific language, neuroinformatics

This thesis contributes to the development of a probabilistic logic programming language specific to the domain of cognitive neuroscience, coined NeuroLang, and presents some of its applications to the meta-analysis of the functional brain mapping literature. By relying on logic formalisms such as datalog, and their probabilistic extensions, we show how NeuroLang makes it possible to combine uncertain and heterogeneous data to formulate rich meta-analytic hypotheses. We encode the Neurosynth database into a Neu-roLang program and formulate probabilistic logic queries resulting in term-association brain maps and coactivation brain maps similar to those obtained with existing tools, and highlighting existing brain networks. We prove the correctness of our model by using the joint probability distribution defined by the Bayesian network translation of probabilistic logic programs, showing that queries lead to the same estimations as Neurosynth. Then, we show that modeling term-to-study associations probabilistically based on term frequency-document inverse frequency (TF-IDF) measures results in better accuracy on simulated data, and a better consistency on real data, for two-term conjunctive queries on smaller sample sizes. Finally, we use NeuroLang to formulate and test concrete functional brain mapping hypotheses, reproducing past results. By solving segregation logic queries combining the Neurosynth database, topic models, and the data-driven functional atlas DiFuMo, we find supporting evidence of the existence of an heterogeneous organisation of the frontoparietal control network (FPCN), and find supporting evidence that the subregion of the fusiform gyrus called visual word form area (VWFA) is recruited within attentional tasks, on top of language-related cognitive tasks.

On dit parfois que les remerciements sont la partie de la thèse qui sera la plus lue, je vais donc essayer de ne pas trop y dire de bêtises ! Bertrand, tu m'as dit une fois que j'avais parmi les sujets de thèse les plus compliqués de l'équipe, et que pendant ces trois années j'allais essayer de construire un château au milieu d'une forêt, mais que lorsqu'elle serait terminée il y aurait une petite cabane en bois au milieu de cette forêt. Je trouve que tes mots étaient très justes et je suis fier des quelques planches de bois que j'ai pu clouer ensemble malgré les tempêtes de neige.

III Discussions and Conclusions 6 Discussions

6.1 Broader Perspective on NeuroLang . . . . . . . . . .

Titre: Langage de programmation logique probabiliste pour la méta-analyse de données hétérogènes et incertaines en neuroscience cognitive Mots clés: programmation probabiliste, neurosciences cognitives, programmation logique, apprentissage automatique, language spécifique au domaine, neuroinformatique Résumé: Cette thèse contribue au développement d'un langage de programmation logique probabiliste spécifique aux neurosciences cognitives, appelé NeuroLang, et présente certaines de ses applications à la méta-analyse d'études en neuroimagerie. En reposant sur les formalismes logiques comme datalog, et leurs extensions probabilistes, nous montrons comment NeuroLang permet de mettre en relation des données incertaines et hétérogènes pour formuler des hypothèses métaanalytiques riches. Nous encodons la base de données Neurosynth dans un programme Neu-roLang et formulons des requêtes logiques probabilistes permettant d'obtenir des cartes cérébrales d'association à un terme spécifique mentionné dans les études de le base de données et de coactivation similaires aux outils existants, et mettant en évidence des réseaux cérébraux connus. Nous montrons que cette modélisation est correcte en traduisant un programme logique probabiliste en un réseau bayésien dont la distribution de probabilité jointe mène aux mêmes estimations que l'outil Neurosynth. Puis, nous montrons que modéliser l'association entre études et termes de manière probabiliste à partir des mesures TF-IDF (term frequency-inverse document frequency) permet d'obtenir, pour un nombre d'études réstreint, une meilleure précision lors de la résolution de requêtes conjonctives sur des données simulées, et une meilleure cohérence sur des données réelles, que par l'application d'un seuil. Enfin, nous utilisons NeuroLang pour formaliser et tester des hypothèses concrètes de cartographie cérébrale fonctionnelle, reproduisant ainsi les résultats d'études précédentes. En calculant la solution de requêtes ségrégatives combinant la base de données Neurosynth, les modèles de sujet et l'atlas fonctionnel DiFuMo, nous supportons l'existence d'une organisation hétérogène du réseau cérébral frontopariétal relié au contrôle cognitif, et supportons l'implication d'une région du lobule fusiforme appelée visual word form area (VWFA) dans des tâches cognitives d'attention, en plus des tâches cognitives reliées au langage.

Abstract: This thesis contributes to the development of a probabilistic logic programming language specific to the domain of cognitive neuroscience, coined NeuroLang, and presents some of its applications to the meta-analysis of the functional brain mapping literature. By relying on logic formalisms such as datalog, and their probabilistic extensions, we show how NeuroLang makes it possible to combine uncertain and heterogeneous data to formulate rich meta-analytic hypotheses. We encode the Neurosynth database into a NeuroLang program and formulate probabilistic logic queries resulting in term-association brain maps and coactivation brain maps similar to those obtained with existing tools, and highlighting existing brain networks. We prove the correctness of our model by using the joint probability distribution defined by the Bayesian network translation of probabilistic logic programs, showing that queries lead to the same estimations as Neurosynth. Then, we show that modeling term-to-study associations probabilistically based on term frequency-document inverse frequency (TF-IDF) measures results in better accuracy on simulated data, and a better consistency on real data, for two-term conjunctive queries on smaller sample sizes. Finally, we use NeuroLang to formulate and test concrete functional brain mapping hypotheses, reproducing past results. By solving segregation logic queries combining the Neurosynth database, topic models, and the data-driven functional atlas DiFuMo, we find supporting evidence of the existence of an heterogeneous organisation of the frontoparietal control network (FPCN), and find supporting evidence that the subregion of the fusiform gyrus called visual word form area (VWFA) is recruited within attentional tasks, on top of language-related cognitive tasks.

Résumé en français

Cette thèse contribue au développement d'un langage de programmation logique probabiliste spécifique aux neurosciences cognitives, appelé NeuroLang, et présente certaines de ses applications à la méta-analyse d'études en neuroimagerie. En reposant sur les formalismes logiques comme datalog, et leurs extensions probabilistes, nous montrons comment NeuroLang permet de mettre en relation des données incertaines et hétérogènes pour formuler des hypothèses méta-analytiques riches. Nous encodons la base de données Neurosynth dans un programme NeuroLang et formulons des requêtes logiques probabilistes permettant d'obtenir des cartes cérébrales d'association à un terme spécifique mentionné dans les études de le base de données et de coactivation similaires aux outils existants, et mettant en évidence des réseaux cérébraux connus. Nous montrons que cette modélisation est correcte en traduisant un programme logique probabiliste en un réseau bayésien dont la distribution de probabilité jointe mène aux mêmes estimations que l'outil Neurosynth. Puis, nous montrons que modéliser l'association entre études et termes de manière probabiliste à partir des mesures TF-IDF (term frequency-inverse document frequency) permet d'obtenir, pour un nombre d'études réstreint, une meilleure précision lors de la résolution de requêtes conjonctives sur des données simulées, et une meilleure cohérence sur des données réelles, que par l'application d'un seuil. Enfin, nous utilisons NeuroLang pour formaliser et tester des hypothèses concrètes de cartographie cérébrale fonctionnelle, reproduisant ainsi les résultats d'études précédentes. En calculant la solution de requêtes ségrégatives combinant la base de données Neurosynth, les modèles de sujet et l'atlas fonctionnel DiFuMo, nous supportons l'existence d'une organisation hétérogène du réseau cérébral fronto-pariétal relié au contrôle cognitif, et supportons l'implication d'une région du lobule fusiforme appelée visual word form area (VWFA) dans des tâches cognitives d'attention, en plus des tâches cognitives reliées au langage.

Contents

Introduction

These first few paragraphs, aimed at the general reader, serve as a brief linear introduction to the work conducted in this thesis: how it fits within the fields of cognitive neuroscience, computer science and artificial intelligence, and how it brings novel contributions that advance the narrower field of neuroimaging meta-analysis. A more thorough introduction of background concepts is provided in the first part of this dissertation.

What is the biological basis for how the human brain can learn, feel, and be conscious of itself? Answering this question is sometimes seen as the ultimate goal of neuroscience, and I like to tell myself that this thesis is a small step towards that goal. Natural sciences have in common that observations, measurements, and experimentation of natural phenomenons are used to empirically derive or support hypotheses about the rules of the world that surrounds us. This process often starts with making sure that we are able to reliably measure these phenomenons in the first place, before turning them into data that can then be quantitatively analysed. However, real-world data is noisy and statistical methods are primordial for distinguishing signal from noise to support scientific hypotheses with true effect sizes. In what might be the most impressive illustration, the Large Hadron Collider (LHC) lies in a 27km tunnel, cost billions of dollars to build, and the experimental data it produces is analysed by thousands of scientists in order to find empirical evidence that can support theories in particle physics.

In understanding the human brain, we are lucky in the sense that we do not have the problem of needing to accelerate particles to the speed of light. But, we are unlucky in the sense that we study a biological system 'stuck' within the skull of a human being, and not just particles (yes, human beings are made of particles, but they are 'living' ones!). Because of that, we cannot fully control laboratory conditions when measuring brain activity , like physicists at the LHC, without grave ethical implications. We instead have to Introduction rely on non-invasive instruments to measure neuronal activity in the human brain.

Functional magnetic resonance imaging (fMRI) is a technology that employs powerful magnets to produce a magnetic field, itself used to measure changes of oxygenation in extra-cellular space between blood vessels and neural networks that are tightly coupled to them. This phenomenon, called the hemodynamic response, is indicative of neurons 'firing' when they are recruited during mental processes. FMRI is a remarkable scientific breakthrough that largely contributed towards the understanding of the human brain that we have today. However, fMRI has its shortcomings: much like any instrument for measuring natural phenomenons, it is imperfect and noisy. The hemodynamic response occurs several seconds after the actual neuronal activity that caused it, which limits the time resolution of fMRI measurements. FMRI also has a limited spatial resolution, measuring an aggregate signal within 1 to 3 mm 3 portions of the brain that can contain tens or hundreds of thousands of neurons. New, more powerful and costly, scanners are being built to increase this spatial resolution by a factor of 10, but higher spatial resolutions also mean lower signal-to-noise ratio in the resulting data, which itself implies longer acquisition times to obtain an exploitable signal. Despite these shortcomings, fMRI remains a driving force in the field, and its non-invasive aspect made it possible to map the brain's functionalities like never before.

Conducting an fMRI experiment is constrained by the time and money costs of acquiring these measurements on a sufficiently large number of subjects. This led to a reproducibility crisis in the field of neuroimaging, and most studies were shown to lack the statistical power required to obtain true effect sizes that could generalise to the human population. As thousands of fMRI studies were published, it opened the door to the idea that their findings could be aggregated in order to study consensus within the field and derive more robust results, a process called meta-analysis. Through coordinatebased meta-analysis (CBMA), peak activation coordinates reported in fMRI studies can be pooled together to obtain brain maps reflecting the common neuronal signatures of experiments conducted by the studies. More recently, sharing whole-brain unthresholded statistical brain maps has become more common. The process of aggregating them is called image-based meta-analysis (IBMA).

An ecosystem of tools has been brought to life, in order to ease the process of metaanalysing the literature while following established best practices. Notably, BrainMap is a manually-curated database, accompanied by a set of feature-rich graphical software applications that can be used to conduct meta-analyses on its database. Neurosynth au-tomates the coordinate extraction process and uses natural language processing (NLP) techniques to automatically annotate studies based on the frequency of the terms occurring in their abstracts. Neurosynth trades a consistent database for the ability to scale to the ever-growing neuroimaging literature: the database can be re-generated based on new data, but this imperfect automatic process comes with the price of noise, both in the extracted coordinates and the annotations of each study.

Meta-analyses have become more and more elaborate over the past few years, by using topic models, ontologies, and/or atlases to produce richer scientific hypotheses. New tools need to be developed to address the challenge of making this type of analyses available to all. In particular, NiMARE is a library under development that aims to combine a wide range of meta-analytic models, databases, topic models, and ontologies into a single framework. In a different angle, NeuroQuery is a predictive model that can map an arbitrary text, containing words within its fixed vocabulary, to a statistical map putatively related to the words contained in the input text. However, these tools do not provide a formal system in which meta-analytic questions can be formally written. In a sense, their expressivity is limited to a subset of propositional logic, a language that lacks the possibility to represent quantification or logical variables, and therefore cannot be used to represent more general knowledge about the objects in the language's domain of discourse, but instead only of particular objects. Consequently, some meta-analytic questions cannot be natively expressed by existing tools.

Knowledge representation and reasoning (KRR) is a subfield of artificial intelligence concerned with designing formalisms that can encode information, and algorithms to reason about this information, in order to find solutions to complex computational problems. Can these formalisms be used to create a system that can represent neuroscientific knowledge, and formulate and solve meta-analytic questions based on this knowledge? This idea is at the heart of the NeuroLang project: designing and implementing a domainspecific language (DSL) for representing data and answering scientific hypotheses that are specific to the field of cognitive neuroscience.

In this thesis, we contribute to the development of the NeuroLang language, and we present applications of NeuroLang to the specific case of meta-analysing the functional human brain mapping literature. We demonstrate how CBMA databases and queries can be represented through the prism of probabilistic logic programming. Using Bayesian networks, we show analytically that evaluating probabilistic queries on NeuroLang programs leads to the same probability estimations of meta-analytic tools like Neurosynth.

Then, we propose a probabilistic relaxation of the way term-to-study associations are modeled in automated CBMA databases, based on TFIDF features, and show that this improves the voxel activation prediction accuracy on simulation data, and improves consistency in the obtained brain map on the Neurosynth database, for smaller samples sizes and across two-term conjunctive queries. Finally, we demonstrate NeuroLang's utility through a range of concrete applications of the language for meta-analysing the functional brain mapping literature, investigating the role of major networks of the brain through the integration of functional atlases and topic models.

In the next page, I provide an overview of how this dissertation is organised.

Organisation of this Dissertation

This thesis is organised in 3 parts.

Part I introduces the main background concepts needed to understand the challenge we take upon, and the novel methods used by NeuroLang to tackle it. Chapter 1 introduces the meta-analysis of functional human brain mapping studies, the existing tools for doing so, and their limitations. It ends with the idea that a language-oriented approach, based on existing formalisms for representing and querying relational knowledge, could be applied in the creation of language for meta-analysing the functional brain mapping literature. Chapter 2 introduces logic and database programming languages prolog and datalog, that can represent relational knowledge and use proof systems to deductively infer new knowledge based on a logic program's input. However, data-driven models of functional brain mapping are inherently noisy, and often probabilistic, therefore purely logic systems cannot encompass them. Chapter 3 introduces formalisms that extend logic systems with probabilistic semantics to represent uncertain knowledge, presents the problem of probabilistic query evaluation, and the extensional and intensional approaches to solving this problem in probabilistic logic systems.

Part II presents the novel contributions of this thesis, organised in two chapters. Chapter 4 presents the NeuroLang language, its syntax, semantics, and how it can be used to represent coordinate-based meta-analysis databases and solve typical term-based and coactivation-based queries. In an experiment, we relax the definition of term-tostudy associations based on TFIDF features, and show that this modeling can be used to solve two-term conjunctive queries using smaller sample sizes than with existing approaches. Chapter 5 presents a range of applications of NeuroLang for the meta-analysis of the functional brain mapping literature, by reproducing existing results. Shedding light on NeuroLang's ability to represent and reason with general relational uncertain knowledge, we integrate topic models and functional atlases, combining them into rich meta-analytic questions.

Part III concludes on the work of this thesis. Chapter 6 gives a broader perspective on the NeuroLang project, which has applications outside of meta-analysis, and refers to the work conducted in collaboration with or by other members of the NeuroLang team.

It also presents ideas for future work that were not explored yet. Chapter 7 provides a brief summary of the contributions proposed in this thesis.

The emergence and rapid growth of data archives, meta-analytic tools, software pipelines, and research groups devoted to improved methodology reflect this new sensibility.

[• • • ] the field has begun

to embrace new open research practices and illustrate how these can begin to address problems of reproducibility, statistical power, and transparency in ways that will ultimately accelerate discovery.

Gilmore et al. [START_REF] Gilmore | Progress toward openness, transparency, and reproducibility in cognitive neuroscience[END_REF] Part I

Background

Chapter 1

Meta-Analysis of Functional Human Brain Mapping

Abstract. In the field of human brain mapping, neuroimaging has grown to become a widely used approach to study brain-behaviour relationships, by deriving functional correlates of behavior, or disease, in populations of subjects. Each year, thousands of new studies analyse these images to test new hypotheses on the functional organisation of the human brain. Keeping up with this intensifying flow of new findings has become impossible outside of one's narrow subfield of neuroscience. Moreover, studies are often underpowered due to their small sample size, as acquiring new data is expensive and time-consuming, fueling a reproducibility crisis in cognitive neuroscience. Meta-analysis comes as a potential solution to these problems, and its usage has rapidly spread over the past two decades. Meta-analyses aggregate findings from hundreds or thousands of previously published articles into robust pieces of evidence. Their success is largely due to the availability of meta-analytic databases and tools, which drastically simplify the process of studying large bodies of neuroimaging literature. However, existing tools are limited because they can only pose and answer a narrow range of questions. Conducting elaborate meta-analyses requires extending these tools with custom software written in general-purpose programming languages: a tedious and error-prone process that requires a particular set of skills that cognitive neuroscience research teams do not necessarily have access to. In this thesis, we attempt to push the envelope of neuroimaging meta-analysis by contributing to the development of a domain-specific language for formulating richer meta-analytic queries. This language is coined NeuroLang.

Reverse-Engineering the Brain with Neuroimaging

Coming from a computer science background, I like to see cognitive neuroscience as a reverse-engineering process; although what one will stumble upon won't be transistors and logic gates, but rather similarities in the hierarchical organisation of biological and technological systems [START_REF] Csete | Reverse Engineering of Biological Complexity[END_REF]. What might be the most challenging part of this reverseengineering process is being able to getting access to the electrical current reflecting neural activity in the first place: a necessary requirement. Although the task of measuring neural activity is colossal, science has found its ways, and several physical instruments, invented for that purpose are now widely used around the world. Modalities for brain functional imaging and cognitive psychology are combined into experiments that provide insights for how the human brain gets affected by diseases of nervous system tissue.

Complexity of the Brain

The total number of neurons in the human brain is estimated to be around 86 billions, a 10 11 order of magnitude [START_REF] Herculano-Houzel | The human brain in numbers: A linearly scaledup primate brain[END_REF]. Each of these neurons has, on average, 7000 synaptic connections to other neurons [START_REF] Drachman | Do we have brain to spare?[END_REF]. In terms of neural connections, this corresponds to a 10 14 to 10 15 order of magnitude, with neurons varying in their size, shape, and in the way they are connected to other neurons. These numbers are extreme.

In what might the most stunning effort in human connectomics, a 1mm 3 volume of surgically sampled human cortex was recently cut into more than 5000 slices at 30 nanometers [START_REF] Shapson-Coe | A connectomic study of a petascale fragment of human cerebral cortex[END_REF]. Using a large computational cluster at Google, researchers reconstructed the three-dimensional structure of 50,000 cells, hundreds of millions of neurites (axons or dendrites), and more than 130 millions of synapses. These results were shared as a 1,4 petabyte dataset, directly browsable on the internet, as shown in fig. 1.1.

Being able to look at the brain at such a spatial resolution is remarkable -fascinating, even -but should be put into perspective. The collaborating teams had to go to great lengths to obtain it. Although this is a stunning result, it simultaneously shows our currently limited ability to measure the dynamic aspect of brain activity at a high resolution. Firstly, the process is invasive, since a small portion of a human brain had to be cut out through surgery before being scanned. Obtaining such a high resolution image of the human brain is not possible with non-invasive technology. Secondly, only a 1mm 3 vol- ume of the brain was processed in this experiment, which approximately represents a millionth of a human brain. Processing the entire brain would require one million times more computational resources, possibly leading to a 1.4 zettabyte (one zettabyte is one billion terabytes) dataset. Not many research labs can afford that kind of storage space, or computation power! Finally, and perhaps most importantly, the result of this process is a static and imperfect anatomical reconstruction of the brain that does not account for the dynamic nature of brain activity, i.e. how neurons are fired and how signals are transmitted in-between them.

In all, we are currently not in the capacity to observe or understand the dynamics of human brain activity at the resolution of individual neurons. Chances are that we never will be able to model the brain in its entire complexity [START_REF] Mcginn | Can We Solve the Mind-Body Problem?[END_REF], which might arguably be a good thing, when considering the possibly unethical applications this would enable [START_REF] Damasio | Neuroscience and Ethics: Intersections[END_REF].

Invasive Measurements

The finest resolution and most accurate reading of the electrical current produced by neuronal activity is obtained using electrodes that are surgically implanted into brain tissues. In particular, stereoelectroencephalography (sEEG), first applied by Bancaud et What is cognitive neuroscience? It is a discipline that aims to understand the relationship between the brain and mind. There exist two main approaches to cognitive neuroscience. First, the neurologically oriented approach studies the characteristics of a particular anatomical brain region, its function, and its connectivity with other brain tissue. Second, the psychologically oriented approach centers around the brain's mental capabilities, and how cognitive processes are supported by the brain's neurological organisation. [START_REF] Banich | Cognitive Neuroscience[END_REF] al. [START_REF] Bancaud | Functional stereotaxic exploration (SEEG) of epilepsy[END_REF] in the context of surgery on epileptic patients, uses electrodes comprising multiple contacts that can read the brain's local electric potential and locate brain areas that are responsible for the patient's seizures. This approach is illustrated in fig. 1 Although this method is still used today in the context of surgeries on patients with severe diseases, such as drug-resistant epilepsy, it is not adapted in the context of brain mapping because it has a high risk of causing brain lesions [START_REF] Goldstein | Safety and efficacy of stereoelectroencephalography in pediatric focal epilepsy: a single-center experience[END_REF].

Risky for the patient, expensive, and demanding of hospital installations and their qualified personnel, this approach to measuring brain signals does not scale to experiments on hundreds of subjects, and would be unethical to operate on healthy patients for the sole purpose of mapping functions of the brain. But, thankfully, non-invasive methods do exist.

Non-Invasive Measurements

Non-invasive techniques have been developed to measure brain activity. In particular, fMRI leverages the intrinsic magnetic properties of oxygenated and de-oxygenated hemoglobin to measure variations in blood flow -the so-called blood-oxygen-level dependent (BOLD) signal -in blood vessels that are tightly bound to neuronal networks [START_REF] Ogawa | Brain magnetic resonance imaging with contrast dependent on blood oxygenation[END_REF].

As such, the BOLD signal is an indirect measure -or proxy -of neural activity, whose interpretation requires understanding how it was acquired with magnetic resonance imaging (MRI) scanners [START_REF] Logothetis | Interpreting the BOLD Signal[END_REF]. The resolution of the resulting images depends, among other things, on the power of the magnet built into the scanner. A 3 Tesla MRI scanner can achieve resolutions of around 1.5×1.5×4mm 3 [START_REF] Van Reeth | Super-resolution in magnetic resonance imaging: A review[END_REF]. Promising new equipment, such as the one developed within the Iseult project at Neurospin [START_REF] Vedrine | The Whole Body 11.7 T MRI Magnet for Iseult/INUMAC Project[END_REF], can be used to obtain a ten-fold smaller granularity. A schematic of this scanner, recently installed at Neurospin CEA, is shown in fig. 1.3. [START_REF] Vedrine | The Whole Body 11.7 T MRI Magnet for Iseult/INUMAC Project[END_REF]. Developed in partnership between CEA Saclay and Siemens, it has a powerful 11.7 Tesla magnet, which will enable us to look at the human brain at a resolution of 0.1 to 0.2mm: ten times higher resolution than most MRI equipment.

Superconducting coils

Helium enclosure & mechanical structure FMRI has been a revolution in cognitive neuroscience, and rapidly came to dominate the field. Tens of thousands of studies rely on fMRI images for their experiments, and to make deductions about the nervous system's functional organisation, as can be seen in fig. 1.4.

Other modalities for functional brain imaging do exist. In particular, electroencephalography (EEG) can be used to measure electrical potential resulting from neuronal activity, by placing electrodes on the scalp of patients, as illustrated in fig. 1.5. One advantage of EEG is that it is more affordable than MRI instruments. Another advantage of EEG is that it is a very high frequency signal, which provides a much higher temporal resolution than fMRI. However, the electrical potentials produced by neuronal activity are diffused by the human skull, due to its low conductivity. This leads to a noisy signal which corresponds to a rough measure of the actual brain activity [START_REF] Gramfort | Mapping, timing and tracking cortical activations with MEG and EEG: Methods and application to human vision[END_REF]. EEG is therefore not adapted to fine-grain functional brain mapping, which explains why fMRI is more widely used for that purpose.

Shortcomings of Magnetic Resonance Imaging

FMRI provides a surrogate signal for neuronal activity, as it measures an increase of blood oxygenation within blood vessels of the brain, instead of directly measuring electrical potentials resulting from actual activations of neurons. Therefore, it cannot be trusted as a true measure of the electric currents produced during the activation of brain neurons.

Moreover, this hemodynamic response only occurs a few seconds after the neuronal activity. Because of this indirect aspect of the fMRI measure, the temporal resolution of the signal is limited to the time scale of this hemodynamic response, which is a few seconds. This temporal resolution is not adapted to understanding the dynamics of cognitive processes that can occur in tens or hundreds of milliseconds, such as the neuronal response to brain stimuli. In multimodal studies, fMRI and EEG are combined to give 'the best of both worlds' [START_REF] Sergent | Timing of the brain events underlying access to consciousness during the attentional blink[END_REF].

The spatial resolution of most common MRI equipment is currently limited to brain areas containing an average of 10 5 neurons, when using a scanner with 3 Tesla magnet. Although new and more powerful scanners are being constructed to improve this spatial resolution, their granularity is not yet sufficient to study neuronal activity at the scale of a neuron, and are instead limited to covering large groups of neurons. Moreover, a downside of increasing the resolution is that it decreases the signal-to-noise ratio (SNR), requiring longer acquisition times to obtain an exploitable signal [T V+17].

Nevertheless, "fMRI is currently the best tool we have for gaining insights into brain function and formulating interesting and eventually testable hypotheses" [START_REF] Logothetis | What we can do and what we cannot do with fMRI[END_REF]. De-Figure 1.5. Electroencephalography (EEG) is a non-invasive instrument to record the electrical potential which reflects neuronal activity, by placing electrodes on the scalp of a patient. On the left, a modern electrode helmet is placed on the head of a subject to measure electrical potential that are then amplified and digitised. On the right, an analysis of these signals using the MNE software [START_REF] Gramfort | MNE software for processing MEG and EEG data[END_REF]. spite its shortcomings, fMRI played a major role in the development of our understanding of how the brain works in the past decades [START_REF] Lisman | The Challenge of Understanding the Brain: Where We Stand in 2015[END_REF]. As of today, we can only rely on fMRI for mapping the brain at high spatial resolutions.

Reproducibility Crisis in Cognitive Neuroscience

The aforementioned shortcomings of today's technology for measuring neuronal activity lead to inherently noisy data [START_REF] Tomasi | fMRI-acoustic noise alters brain activation during working memory tasks[END_REF][START_REF] Thomas | Noise contributions to the fMRI signal: An overview[END_REF]. Therefore, a sufficiently large number of subjects need to participate in a given experiment to be able to distinguish signal from noise [START_REF] Turner | Small sample sizes reduce the replicability of task-based fMRI studies[END_REF]. Moreover, fMRI replicability also depends upon sufficient individuallevel data [START_REF] Evan | fMRI replicability depends upon sufficient individuallevel data[END_REF]. However, acquisition of new data is expensive and time consuming, leading to experiments with low sample sizes [But+13]. This interferes with the goal of understanding the functional properties of brain processes [START_REF] Logothetis | What we can do and what we cannot do with fMRI[END_REF], as it limits our ability to draw clear conclusions from neuroimaging data.

Power Failure

Most studies in neuroscience have a low statistical power that leads to overestimated effect sizes and a low reproducibility of their results [But+13]. Although the reproducibility crisis is a concern for scientific research as a whole, neuroimaging studies are particularly affected. Some suggest that the sample size in studies is nowhere near what it should be to have the statistical power needed to obtain true effect sizes. As journals tend to accept studies based on the statistical significance of their results, there are reasons to believe that observed effect sizes are commonly overestimating true effect sizes [START_REF] Lakens | Calculating and reporting effect sizes to facilitate cumulative science: A practical primer for t-tests and ANOVAs[END_REF].

'True' v.s. 'observed' effects. True effects generalise to a whole population. Observed effects are measured on a sample of participants. The size of true effects are at risk of being overestimated, depending on the statistical power of studies and the methods that were used to measure the size and significance of observed effects [START_REF] Ellis | The Essential Guide to Effect Sizes. Statistical Power, Meta-Analysis, and the Interpretation of Research Results[END_REF]. If we want to build a general understanding of the brain's internal organisation and mechanisms of cognition, and measure the practical significance of neuroscientific findings, it is necessary to provide good estimates for the size of true effects [But+13].

Different Processing Pipeline, Different Results

In a recent study, seventy teams of researchers were provided the same raw fMRI data and a number of brain mapping hypotheses to test against this data [START_REF] Botvinik-Nezer | Variability in the analysis of a single neuroimaging dataset by many teams[END_REF]. A high analytical variability across teams was observed, caused by varying processing pipelines and statistical methods. This study further emphasises the reproducibility crisis within the field, and the need to develop open, transparent, and reproducible practices and tools.

The Open Future of Neuroimaging

Being fully aware of this crisis, research groups around the world have started to shift their focus to tackling this important issue, in order to conduct more reliable research.

Open data archives have been created [PG14; Gor+15; Mar+21], with new data sharing practices making them continuously grow in size, meta-analytic tools and neuroimaging processing software are open-sourced, and new research has been conducted to improve the methodologies used in the analysis of neuroimaging data [START_REF] Gilmore | Progress toward openness, transparency, and reproducibility in cognitive neuroscience[END_REF].

Standard formats for sharing brain imaging data are gaining in popularity, such as the brain imaging data structure (BIDS) format [START_REF] Krzysztof | The brain imaging data structure, a format for organizing and describing outputs of neuroimaging experiments[END_REF]. This type of standardisation will make data curation more reliable, accessible, and transferable across teams, and therefore ease the process of replicating or combining results. As Botvinik-Nezer et al. [START_REF] Botvinik-Nezer | Variability in the analysis of a single neuroimaging dataset by many teams[END_REF] showed, several different analyses are required to compensate for the analytical variability of neuroscientific hypothesis testing.

There are good reasons to believe that the reproducibility of neuroscientific findings will continue to improve in the coming years, and that results will therefore be more reliable.

Neuroimaging Literature Synthesis

Today, many discoveries and advances in cumulative knowledge are being made not by those who do primary research studies but by those who use meta-analysis to discover the latent meaning of existing research literatures.

Schmidt [START_REF] Frank | What do data really mean? Research findings, metaanalysis, and cumulative knowledge in psychology[END_REF] Meta-analysis, defined as the synthesis of research results, has been applied to a broad range of research fields, as a way to aggregate findings from many individual studies into more robust ones, and to study consensus within a body of literature. As a methodological approach to synthesising results from neuroimaging studies, it has boomed over the past decade, as evidenced in fig. 1

In search of true effects

Meta-analysis has changed the way scientists view the results of individual studies: a primary study with a statistical power that is too low to draw a conclusion can now be seen as a contribution towards the accumulation of evidence that could ultimately lead to a conclusive answer [START_REF] Gurevitch | Meta-analysis and the science of research synthesis[END_REF][START_REF] Ellis | The Essential Guide to Effect Sizes. Statistical Power, Meta-Analysis, and the Interpretation of Research Results[END_REF].

Even though meta-analysis is still at risk of overestimating true effect sizes [START_REF] Brand | Accuracy of Effect Size Estimates from Published Psychological Research[END_REF][START_REF] Bakker | The Rules of the Game Called Psychological Science[END_REF], as it combines studies that might initially overestimate it, "meta-analysis provides the best estimate of the true effect size" [But+13], and is less biased and more powerful than the conventional 'narrative' approach to synthesising past literature.

In a narrative review of the literature, one uses their own words to synthesise the words of others. In contrast, meta-analysis is a quantitative approach -a statistical analysis of statistics -where one uses the numbers provided by others to produce a number of their own [START_REF] Ellis | The Essential Guide to Effect Sizes. Statistical Power, Meta-Analysis, and the Interpretation of Research Results[END_REF].

In the previously-mentioned study across many teams that highlighted the analytical variability of neuroimaging studies, the authors conducted a meta-analysis of the statistical maps shared by all participating research teams and concluded that "inconsistent results at the individual team level underlie consistent results when the results of teams are combined" [START_REF] Botvinik-Nezer | Variability in the analysis of a single neuroimaging dataset by many teams[END_REF], which demonstrates the power of meta-analysis.

Important meta-analysis guidelines

It is primordial to follow best practices when conducting meta-analyses. In particular, a meta-analysis should be transparent and replicable, such that it can be conducted again when new data becomes available [START_REF] Gurevitch | Meta-analysis and the science of research synthesis[END_REF]. Critically, the research question that one wishes to answer with meta-analysis should be specified as precisely as possible, beforehand and not after inspecting the data [START_REF] Müller | Ten simple rules for neuroimaging meta-analysis[END_REF]. A trade-off between power -the number of experiments included -and specificity -the restrictiveness of inclusion or exclusion criteria -should be carefully chosen. In cases where there is not enough literature about a specific research question, the idea of conducting the meta-analysis in the first place might be abandoned. However, a meta-analysis can also conclude that there is no evidence in the literature to answer a specific question, as was the case when trying to isolate the putative visual number-form area (VNFA) solely by using meta-analysis [YWP17]: a good example of publishing inconclusive results.

To conclude, meta-analysis has become an essential tool for building consensus on cognitive neuroscience research results. It remains under active development, as new methodologies and tools are frequently proposed to expand the scope of neuroimaging meta-analysis.

Meta-Analytic Databases and Tools

Most of the time, neuroimaging studies summarise significant brain activations within tables of peak activation coordinates, such as the one of table 1.1. Analysing coordinates reported by several neuroimaging studies to produce meta-analytic maps is called CBMA. Peak activation coordinates v.s. whole-brain statistical maps. When neuroimaging was born, data sharing practices and free repositories where data could be deposited were not in place. This explains why the practice of summarising statistical brain maps as coordinates in tables came to be. It is only recently that such repositories have been created. In particular, NeuroVault.org [START_REF] Krzysztof | .org: A web-based repository for collecting and sharing unthresholded statistical maps of the human brain[END_REF] is a public repository of unthresholded statistical maps, parcellations and atlases, while OpenNeuro [START_REF] Christopher | OpenNeuro: An open resource for sharing of neuroimaging data[END_REF] -which deprecated the OpenfMRI initiative [PG17] -is a free and open platform for sharing raw neuroimaging data in the most widely-used modalities. As one could expect, the analysis of unthresholded results -a process called IBMA -is superior [START_REF] Salimi-Khorshidi | Meta-analysis of neuroimaging data: A comparison of image-based and coordinate-based pooling of studies[END_REF], because peak activation coordinates are an imperfect summary of whole-brain statistical maps [START_REF] Samartsidis | The Coordinate-Based Meta-Analysis of Neuroimaging Data[END_REF]. However, it will take time before these repositories grow enough to be representative of past literature, and CBMA remains the main paradigm of meta-analysis for now.

A CBMA database gathers peak activation coordinates from thousands of studies, normalising them into a standard space -MNI or Talaraich space -to aggregate them and draw literature-based conclusions [START_REF] Samartsidis | The Coordinate-Based Meta-Analysis of Neuroimaging Data[END_REF]. There are two ways to construct this type of databases, used by some of the most popular neuroimaging meta-analysis tools available BrainMap and Neurosynth.

BrainMap: manual transcription and annotation

The historically first approach to gather peak activation coordinates, used by BrainMap [START_REF] Laird | BrainMap: The Social Evolution of a Human Brain Mapping Database[END_REF], is to manually transcribe them from tables found in studies. In this approach, coordinates are linked to the content of the studies that report them by taxonomy expert collaborators, who annotate experiments according to the cognitive processes they investigate. In other words, metadata is created for each experiment by scientists: a timeconsuming but remarkable endeavor. BrainMap uses their own taxonomy, called the BrainMap taxonomy, and provides a graphical user interface (GUI) to facilitate the transcription, called Scribe [START_REF] Laird | The BrainMap strategy for standardization, sharing, and meta-analysis of neuroimaging data[END_REF].

However, BrainMap's manually annotated CBMA database is not fully openly shared because it requires a collaborative license agreement, which makes it more difficult to integrate within other tools compared to other databases that are freely downloadable. Instead, computer programs are provided to interact with the BrainMap database. In particular, Sleuth is a program that allows searching the database for studies that match a certain set of criteria [START_REF] Laird | The BrainMap strategy for standardization, sharing, and meta-analysis of neuroimaging data[END_REF]. Once the user is done with the selection of studies that are relevant to the meta-analysis they wish to conduct, they can export the locations of peak activation coordinates reported by this subset of studies. Another tool, called GingerALE is used to produce whole-brain statistical maps by computing an activation likelihood estimation (ALE) statistic for each voxel [START_REF] Simon | Activation likelihood estimation meta-analysis revisited[END_REF]. In all, BrainMap proposes the most complete toolbox for neuroimaging meta-analysis, and is regularly updated with new manual annotations and software updates.

Neurosynth: Automatic Extraction and Annotation

As manual curation and annotation can be a daunting task, and as CBMA databases got bigger and more powerful, a fully-automated approach to meta-analysis, coined Neurosynth, was proposed by Yarkoni et al. [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF]. Automatic procedures extract locations of peak activations from tables within the text of neuroimaging studies. Moreover, Neurosynth uses NLP features called TFIDF to find associations between terms of interest and studies within the database. These terms live in a predefined vocabulary of words related to cognitive processes, mental functions, neuroanatomy, etc. Systematic approaches such as Neurosynth can keep up with the growth of neuroimaging research, and therefore larger databases can be obtained and automatically updated with newly published studies.

Neurosynth Topic Models

Topic modeling is a statistical approach to discovering latent semantical structure within a corpus of unlabeled textual documents. As such, this type of model falls into the class of unsupervised machine learning algorithms. The main parameter of a topic model is the number of topics that should be learned from the corpus. Latent Dirichlet allocation (LDA) [START_REF] David M Blei | Latent dirichlet allocation[END_REF] is perhaps the most widely-used topic model.

In the context of neuroimaging meta-analysis, LDA was used to classify studies within the Neurosynth database in topics related to specific mental functions or disorders [START_REF] Poldrack | Discovering Relations Between Mind, Brain, and Mental Disorders Using Topic Mapping[END_REF], with differentiable activation pattern for each topic-group of studies. Several topic models were trained with different number of topics, and are freely available on Neurosynth's website1 . In table 1.2, we give example of loadings for topics trained by Poldrack et al. [START_REF] Poldrack | Discovering Relations Between Mind, Brain, and Mental Disorders Using Topic Mapping[END_REF] for one randomly selected study within the Neurosynth database. Since this study is broadly studying brain activity related to emotion, topics with the highest loading value are, as expected, related to terms related to the mental process of emotion. More recently, an improved topic model called Generalized Correspondence Latent Dirichlet Allocation was trained on the Neurosynth database and used as a brain decoding model [START_REF] Rubin | Decoding brain activity using a large-scale probabilistic functional-anatomical atlas of human cognition[END_REF]. Brain decoding corresponds to the task of mapping any whole-brain measure of neuronal activity to the cognitive processes or mental functions that generated this observed activation pattern. For example, guessing that someone is moving their right hand just by looking at their brain activity.

Fully-Automated v.s. Manually Curated Databases

The Neurosynth database contains errors and imprecision in the location of the coordinates reported by studies 2 . As tables are formatted differently from one journal to another, the automated extraction procedure sometimes fails to either guess in which stereotactic space the coordinates live, or to extract the coordinates in the first place. This leads to spatial noise in the database, on top of the uncertainty already surrounding the exact location reported by the authors of the initial meta-analysed studies. Although BrainMap surely contains human errors, it is a more reliable database than Neurosynth. More importantly, however, is the difference in the way each tool links studies and experiments to specific mental processes that are supposedly being investigated. Here again, BrainMap is more reliable than Neurosynth, because experts annotate the studies and experiments manually. Using BrainMap's Sleuth tool, users can search studies based e.g. on the type of experiment that was conducted by the study, the modality used, or the type of stimulus [START_REF] Laird | The BrainMap strategy for standardization, sharing, and meta-analysis of neuroimaging data[END_REF]. Neurosynth uses an automatic NLP model that is based on the terms occurring in the text of study abstracts. Neurosynth cannot differentiate experiments within studies. This is an important limitation of fully-automated CBMA databases, which could be resolved through the development of more precise automatic annotation software.

Limitations of Existing Meta-Analysis Tools

To justify the methodological approach of this work, it seems primordial to understand the limitations of existing tools for conducting meta-analyses on the neuroimaging literature.

Expressivity: Posing More Elaborate Questions

How does one go from a question formulated in their native tongue to actually finding an answer to that question using data? Surely, some sort of system is needed to express the question such that a computer can understand and answer it.

One of the most simple meta-analytic question one could think of answering through neuroimaging meta-analysis is: "which regions of the brain are activated by experiments on the mental processing of physical pain?". Selecting studies relevant to answer this question does not require a complex formulation system, since searching and aggregating peak locations reported by experiments on physical pain is sufficient. This is what tools like BrainMap and Neurosynth can do.

However, some more elaborate questions can be harder to express, in which case BrainMap and Neurosynth reach their limits. We now discuss these expressivity limitations.

Conjunction (∧) or Disjunction (∨) of Criteria

Sleuth can select experiments based on several criteria. As per Sleuth's manual: "Logic operators are found at the bottom to refine your search as to whether the experiments must match 'all' or 'any' of the chosen criteria" 3 . In other words, Sleuth can express a conjunction -'∧' in logic syntax -of criteria, or it can express a disjunction -'∨' in logic syntax -of criteria. In a similar fashion, Neurosynth can formulate conjunctions and disjunctions of term associations4 . However, this corresponds to a limited fragment of what the first-order logic language can express. For example, these tools cannot combine conjunctions and disjunctions, and they cannot express first-order logic sentences with existentially (∃) or universally (∀) quantified variables, or with logical negation (¬) operators. This makes it impossible to express certain selection criteria such as 'studies should report at least one peak activation within region A but not within region B or C'. The lack of logical quantified variables also prevents the formulation of selection criteria such as 'studies should report at least one region that is anterior to the amygdala', where can be any region of the brain. In other words, they do not possess a formal logic system in which more general logical sentences can be express. This limits the types of meta-analyses that can be expressed.

NeuroQuery: from Text to Brain

NeuroQuery is a regularised predictive model trained on CBMA data, that was recentely proposed as a way to map any text fragment (i.e. a set of keywords of interest, that they dub 'query') to a statistical association map of the brain [START_REF] Dockès | NeuroQuery, comprehensive meta-analysis of human brain mapping[END_REF]. This approach, summarised in fig. 1.8, showed that modeling between-terms interactions can produce meaningful statistical maps for terms that are rarely mentioned in the literature. However, NeuroQuery cannot express a query that estimates a pattern of activation for studies associated with the 'working memory' cognitive process but not associated with a group of other cognitive processes such as 'task switching' or 'response inhibition'. Such a segregation of studies could be interesting to restrict the analysis to one specific cognitive process within a group of overlapping mental functions known to be related to subparts of a brain region. Text-based queries cannot encompass this type of queries because they do not have logical semantics. Typing the query 'working memory but not task switching' on neuroquery.org would rather have the opposite effect of calculating a brain map from studies mentioning both or either of the two terms. The words 'but' and 'not' in the query do not belong to NeuroQuery's pre-selected vocubulary, and have no influence in the resulting statistical map. Yet, even if they were, their semantics would not be close to what the English language logically expresses.

To conclude, NeuroQuery is a predictive model that does not aim to conduct statistical hypothesis testing, and is therefore complementary to existing meta-analytic tools which cannot map arbitrary text -such as description of task fMRI experiments -to a map of predicted neurological activation locations.

Integration of Heterogeneous Uncertain Data

BrainMap and Neurosynth do not come with a built-in general knowledge representation system. That is, they are not based on a formalism that can represent and reason on any type of knowledge. Therefore they are limited to the specific knowledge built within the tool itself, and other knowledge needs to be added externally. This hampers the integration of brain atlases, ontologies, coordinates, topic models into meta-analyses. Richer meta-analyses are become more and more common, and we do not know yet the type of knowledge that will be used within them in the future. A general knowledge representation system, based on logical formalisms, could provide the flexibility to integrate all of those, and more. This idea is at the heart of NeuroLang, which aims to propose such a system.

Regions of Interest and Anatomical or Functional Atlases

In Sleuth, users can define a custom region of interest (ROI) in a standard stereotactic space, and select studies that report activations within this ROI. The integration of external data remains however limited, as probabilistic functional or anatomical atlases cannot be integrated into probabilistic meta-analytic models. Eickhoff, Yeo, and Genon [START_REF] Eickhoff | Imaging-based parcellations of the human brain[END_REF] insist on the fundamental aspect of brain parcellations, but also on their high diversity. It is thus important for a meta-analytic tool to incorporate all brain parcellations proposed in the literature.

Moreover, the BrainMap toolbox is provided as a set of programs with a GUI, and no application programming interface (API) is provided to interact with the database in a programmable fashion. Defining ROIs therefore cannot be done programmaticaly with the BrainMap tools: it has to be done externally with third-party software. Can we create a tool that is flexible enough to define or create, load, and manipulate brain regions, and then use them in the context of meta-analyses within a single framework?

In Neurosynth, users can include studies in a meta-analysis based on their association with terms of interest, but they cannot select studies based on whether they report activations within a region of the brain. However, Neurosynth is open sourced as a Python package, which makes it possible to extend it in the Python general programming language. However, this has to be be done carefully, and requires a particular set of skills that is not necessarily commonplace in the cognitive neuroscience community.

Topic Models

Probabilistic topic models [START_REF] Rubin | Decoding brain activity using a large-scale probabilistic functional-anatomical atlas of human cognition[END_REF] are used within meta-analyses themselves to answer questions such as 'given a set of studies that report activations within each subpart of the frontoparietal cognitive control network, what is the probability that selected studies load on each topic?'. In other words, after selecting studies based on activation patterns, a 'reverse inference' would be ran to find which topics those studies are most likely to belong to. Neurosynth can be used to conduct such 'reverse inference', but only for terms. It currently lacks the ability to integrate topic models within its system for decoding metaanalytic neuronal activation patterns.

Similarly, to the best of our knowledge, other meta-analytic tools do not provide the ability to integrate topic models. As topic models are inherently probabilistic, a probabilistic system is required to integrate them into statistical meta-analysis tools.

NiMARE

In a related and recent approach, the open-source NiMARE Python package [START_REF] Salo | neurostuff/NiMARE: 0.0.10rc2[END_REF] consolidates the most-used methods and databases for coordinate-based or image-based meta-analysis, and integrates ontologies and topic-models for automatically annotating studies. NiMARE integrates both the Cognitive Atlas and Cognitive Paradigm ontologies. Neurosynth's Python package has officially been deprecated in favour of NiMARE, and the Neurosynth 2.0 website will use NiMARE internally. The focus of NiMARE is on meta-analytic tools, and it does not aim to be a more general framework, nor does it aim to provide a rich logic-based querying system, and a probabilistic inference engine. As NiMARE collects meta-analytic tools and puts them into a single Python package, both NiMARE and NeuroLang could interface with each other. We see both tools as complementary: for example, in the future NeuroLang could provide a rich query formulation and answering system for NiMARE.

Ontological Knowledge

The Cognitive Atlas is an ontology that relates mental processes and brain functions [START_REF] Poldrack | The Cognitive Atlas: Toward a Knowledge Foundation for Cognitive Neuroscience[END_REF]. Its purpose is to facilitate the integration of knowledge coming from the exponential number of cognitive neuroscience articles, by providing a semantical organisation of the terminology used within the community to describe mental processes and the tasks used to measure them. Tools like LISC [START_REF] Donoghue | LISC: A Python Package for Scientific Literature Collection and Analysis[END_REF] use these ontologies to better collect and analyse the scientific literature, by mapping cognitive and neuroscientific terms used in studies to their corresponding ontological entities. This type of initiative emphasises the need for tools that can scan the literature using structured concept representations.

In ontology-based decoding, a neuronal activation pattern is decoded into a cognitive function annotated in an ontology. For example, Varoquaux et al. [START_REF] Varoquaux | Atlases of cognition with large-scale human brain mapping[END_REF] use the Cognitive Paradigm Ontology (CogPO) [START_REF] Turner | The Cognitive Paradigm Ontology: Design and Application[END_REF] to build a decoder that works for a broader range of mental processes and cognitive functions, by leveraging the ontological relationship between them.

Integrating ontological knowledge within meta-analyses could be beneficial and lead to richer and testable brain mapping hypotheses. In BrainMap's tool Sleuth, an ontology is used to provide richer inclusion / exclusion criteria [START_REF] Turner | The Cognitive Paradigm Ontology: Design and Application[END_REF][START_REF] Laird | The BrainMap strategy for standardization, sharing, and meta-analysis of neuroimaging data[END_REF]. However, it is not possible to extend the tools with other ontologies, because Sleuth does not provide this flexibility.

End-to-End Reproducible Meta-Analysis

Shortcomings of existing tools for conducting meta-analyses are explained by the fact that they were not designed to be truly unifying frameworks for conducting rich endto-end meta-analyses. To the best of our knowledge, there does not exist a tool that can combine meta-analytic databases, rich data-driven topic models or functional atlases, and ontological knowledge, to formalise and test rich brain mapping hypotheses.

'End-to-end' is a term that grew in popularity over the past years. Two of its main usages are 'end-to-end encryption' -in the context of secured communication protocols, and 'end-to-end learning' -in the context of machine learning algorithms. In the case of meta-analysis, what we mean by 'end-to-end' is: a meta-analysis system that can integrate all the data necessary to conduct the meta-analysis, in which meta-analytic questions and models can be formulated, and that is capable of answering these questions through statistical hypothesis testing.

Such a system would make reproducibility of meta-analyses easier than having to go through the steps of recollecting all the studies of a previous meta-analysis and attempting to produce the exact same analysis. Even though sharing of open source code alongside published articles is becoming more common -sometimes even required by publication venues -reproducibility is not an immediate consequence as open-sourced code is sometimes hard or impossible to exploit.

In the next chapters, we introduce formalisms introduced in the field of artificial intelligence to represent and reason with arbitrary uncertain data. Then we apply these tools within the design of a domain-specific language that expands the scope of meta-analysis.

Chapter Key Points 1. Despite numerous shortcomings, fMRI is the leading neuroimaging technique in cognitive neuroscience. Brain mapping hypotheses can be tested against fMRI data, provided that analyses are performed cautiously.

2. Noisy signals, low power, and analytical variability undermine cognitive neuroscience, fuelling a reproducibility crisis. Researchers emphasise the need for openness, transparency, and reproducibility within the field.

3. Meta-analysis is perhaps the best technique available for estimating effect sizes that generalise to the population level, due to its ability to combine results from hundreds or thousands of neuroimaging studies. It is more-and-more used for brain mapping research, in large part thanks to the availability of open tools and software.

4.

Neuroimaging studies report peak activation coordinates, although sharing raw or unthresholded data is becoming more common. Conducting an analysis on coordinates gathered from many studies is called coordinate-based meta-analysis.

5.

Existing tools for conducting meta-analyses are however limited by their formal expressivity. Meta-analyses that combine heterogeneous uncertain sources of data and use complex inclusion/exclusion criteria are out of their scope, and are performed with custom error-prone software.

Chapter 2

Language-Oriented Knowledge Representation and Deduction Abstract. Soon after the birth of computing, programming languages have been developed for humans to instruct computers with knowledge, and procedures to calculate solutions to algorithmic problems. This led to the creation of wide variety of langugaes. Logic programming languages like Prolog, invented in the 1970s, use logic at their core for representing facts about the world, and rules that can be used to derive new knowledge. These languages are convenient for designing human-computer interfaces because their programs are more concerned with a formal formulation of the problem than the description of how to solve the problem: they internally use evaluation engines to derive the solution. Datalog, standing on Prolog as it uses a restrictive subset of its syntax, is a data-centric language for querying logic databases, providing polynomial query resolution time guarantees w.r.t. the size of input databases. We use the datalog language as the basis of NeuroLang, 'standing on the shoulders of giants' instead of 'reinventing the wheel'. The syntax of pure datalog is limited and mainly serves as a theoretical framework. Syntactic extensions to datalog have been developed to produce practical query languages that can be used in concrete applications. These extensions have important implications on the semantics of programs, evaluation strategies, and the tractability of queries. However, real-world use-cases often have to deal with uncertain knowledge and data that purely logical languages cannot encompass.

Domain-Specific Languages

The most common way to solve a problem with computers is to write a program in a general-purpose programming language (GPL), with instructions for the computer to calculate a solution to the initial problem. Another approach -called language-oriented programming -is to create a domain-specific programming language in which expressing a program that solves the problem is easier than it would be with a GPL.

General v.s. Domain-Specific Languages

One example of a GPL is the increasingly popular programming language called Python, initially designed by Guido van Rossum in 1991, and now developed by the Python Software Foundation. This is the language in which NeuroLang is implemented. There is wide variety of GPLs that are available in 2021, and some of them are more suited to solve certain classes of problems, due to the way they were conceived and the features their creators decided to provide them with. Functional programming languages like Haskell are first-class citizens when it comes to implementing compilers for other programming languages, thanks to their powerful built-in type systems. Languages like Erlang are more suited for developing distributed fault-tolerant systems, with a large number of concurrent processes that can crash individually without taking down the whole application.

GPLs have in common that they are not designed to solve a particular problem: they aim instead to be general enough to solve any problem. Although they could be used to implement any program, some GPLs are highly-specific to particular applications, to the point that we could call them DSLs. Scientific computing and data analysis languages such as R, Julia or Matlab would be counterintuitive to use for other applications. Therefore, we can say that there is a blurry line between GPLs and DSLs. What a language turns out to be used for also greatly depends on its community of developers and users: Python is increasingly used for scientific computing [Oli07], data analysis and machine learning, thanks to the availability of stable libraries such as NumPy, Pandas or Scikit-Learn [START_REF] Pedregosa | Scikit-learn: Machine Learning in Python[END_REF]. Contrary to Julia or R, Python was not particularly designed for these applications, and is also used in a broad range of other domains.

On the contrary, DSLs are specifically designed to solve a particular class of problems. They often are less expressive than GPLs, but this cost of expressiveness comes with a simpler syntax, closer to the domain of application. In fact, DSLs are usually created to bridge the gap between domain experts and automating some of their work by using computer programs.

We are Surrounded by DSLs

This document was written in a markup DSL named L A T E X, used to typeset most scientific articles around the world. The reader might have found this manuscript on the Internet, using a web browser that displays web pages whose content is described in a DSL called HyperText Markup Language (HTML). There is a good chance that the server hosting the website used to find this manuscript internally indexes research articles in a relational database, which was queried using a DSL called Structured Query Language (SQL). If research articles are indexed as a graph of dependency based on citations found in articles, GraphQL might have been used to query this graph instead. The reader probably reads a Portable Document Format (PDF) version of this manuscript, a file format based on the PostScript (PS) language: a DSL created by Adobe to describe the content of document pages.

Today, it is rarely possible to do anything on a computer without a DSL getting involved in one way or another. Semiconductors in the hardware itself might implement logical circuits that were specified in a DSL.

The aforementioned DSLs have all seen their design criticised. However, they all did provide solutions to problems that would have been harder to solve in a GPL. This is the strength of a language-oriented programming approach, where a language is specifically created to express more intuitive and understandable solutions to existing problems. DSLs might be the most humane way of designing interactions between human developers and computers (as long as our minds and computers are not connected by a revolutionising neurotechnology).

As an analogy, air traffic controllers and aircraft pilots use a concise subset of the English language to communicate with each other. They invented aeronautical phraseology -a language hardly understandable by common laymen -to solve the problem of reliably exchanging critical information in a time-constrained environment. We could say that this language is domain-specific, and that communicating in plain English would not lead to the most efficient communication.

To conclude, DSLs are omnipresent: they have become important tools for interacting with computers in ways that are intuitive to humans.

Turing Completeness A language is said to be Turing-complete if the solution to any computational problem can be written as a program in that language, without providing any guarantee of runtime or memory use. In practice, Turingcompleteness is impossible to achieve, as every machine has limited runtime and memory. Therefore, practical systems approximate Turing completeness up to the limits of their available runtime and memory [START_REF] Wilson | The annotated turing by Charles Petzoid[END_REF]. As a theoretical concept, Turing completeness is useful to asses the ability of languages to generalise to any computational problem. In practice, even markup languages like L A T E X or deep neural network architectures like Transformers can be Turing-complete [START_REF] Pérez | On the Turing Completeness of Modern Neural Network Architectures[END_REF]. This raises the question of whether a language can be qualified as 'domain-specific' when it achieves Turing completeness [START_REF] Michaelson | Are there Domain Specific Languages?[END_REF].

Tape

… …

Read/write head

Program

The Turing machine is an abstract model of computation that operates on an infinite tape, divided into cells. The machine uses its head to read or write symbols into the cells.

Logic Programming with Prolog

A logic program is a set of axioms, or rules, defining relations between objects. A computation of a logic program is a deduction of consequences of the program. A program defines a set of consequences, which is its meaning. The art of logic programming is constructing concise and elegant programs that have the desired meaning.

Sterling, Shapiro, and Garrett [START_REF] Sterling | The Art of Prolog[END_REF] Logic programming brings the language of logic to the expression of computer programs. Writing a logic program is done by declaring a set of logic implication rules. Then, a query -a logical premise -can be solved from the program by verifying its truth value in the model defined by the program. In other words, one asks "can the knowledge encoded in the program be used to deductively infer that the query is true?".

The most prominent logic programming language is called Prolog. It was developed in 1972 by Alain Colmerauer and Philippe Roussel in Luminy, France [START_REF] Colmerauer | The birth of Prolog[END_REF]. As Prolog is largely considered to be the first and most well-known logic programming language, and as datalog is largely based on Prolog, we focus our attention on Prolog instead of defining logic programs in general.

Before introducing Prolog, we define the syntax and semantics of predicate logic.

Basics of Logic

Logic is a branch of philosophy and mathematics that provides a language and methods for studying the principles of reasoning and knowledge. This formal framework allows us to represent knowledge and reason about the truth value of logical premises. Importantly, logic is at the heart of computing: through diodes and transistors, a computer's hardware implements the most basic logical operations.

Propositional logic studies whether propositions (logical statements) are true or false. Predicate logic -also called first-order logic -has a richer ontology, as it can represent objects and put them in relation with each other. It is a language that includes variables, predicates, quantifiers, and connectives. We briefly introduce the main concepts and the general terminology used in predicate logic.

Terms can be constants or variables. Implication. The implication connective, denoted by →, allows to infer the truth of a formula from the truth of another formula. For example, the formula ∀ Singer( ) → Programmer( ) can be interpreted as "every singer is also a programmer". If we know that Singer(Marvin) is true, we can combine this factual knowledge and the implication formula to deduce that Programmer(Marvin) is true. In the implication → , is called the antecedent or body, while is called the consequent or head. This terminology is often used interchangeably.

Facts.

Quantifiers. Variables occurring in formulas can be quantified using one of two quantifiers: the universal quantifier (denoted ∀) and the existential quantifier (denoted ∃).

The formula ∀ Singer(Marvin, ) means that every person with the first name Marvin is a singer, while the formula ∃ , Singer(Marvin, ) means that there exists at least one person whose first name is Marvin and who is a singer. This assumes that Singer is a binary relation that relates a first name with a last name. This is subject to interpretation, and the symbols occurring in logic formulas are often separated between two groups: logical symbols and non-logical symbols. Logical symbols are unambiguous and directly belong to the language of logic, such as quantifiers, variables, logical connectives, parentheses, the equality symbols, or special constants to denote 'true' ( ) or 'false' (⊥). While nonlogical symbols are subject to interpretation, such as constants or predicates.

Conjunction and disjunction connectives. A formula can be composed of multiple subformulas, that are connected with logical connectives. For example, literals can be connected using the conjunction (∧) and disjunction (∨) logical connectives. The formula Singer(Marvin) ∨ Programmer(Marvin) means that Marvin is either a singer, a programmer, or both. The formula Singer(Marvin) ∧ Programmer(Marvin) means that Marvin is both a singer and a programmer. More complex formulas can be constructed by iteratively connecting subformulas using logical connective. An implication → is logically equivalent to the disjunctive formula ¬ ∨ , which means that cannot be true while is false, and is easier to see by taking the negation of the implication formula

¬( → ) ⇔ ¬(¬ ∨ ) ⇔ ∧ ¬ .

Horn Clause: the Building Block of Prolog's Syntax

Prolog programs are defined as a finite set of Horn clauses. In logic, a clause is defined as a disjunction of positive and/or negative literals. A Horn clause is a clause with at most one positive literals, i.e. all the other literals in the disjunction are negative. If the Horn clause has exactly one positive literal, we call it a definite Horn clause, or a strict Horn clause. A definite Horn clause is logically equivalent to a logic implication whose consequent is a positive literal, and whose antecedent is a conjunction of a finite number (possibly zero) of positive literals.

A fact is a logic implication whose antecedent is -a constant symbol used to represent a formula that is always 'true' -and whose consequent is a ground positive literal (a predicate with constant terms). A fact corresponds to a definite Horn clause that has a single literal, also called a unit definite Horn clause. For example, Singer(Marvine, Gaye) is a fact.

Logic programming languages like Prolog are usually defined as a set of Horn clauses because the Horn-satisfiability -or HORNSAT -problem, that is the problem of deciding the satisfiability of a set of Horn clauses, can be solved in linear time [START_REF] Dowling | Linear-time algorithms for testing the satisfiability of propositional horn formulae[END_REF]. When Horn clauses are quantified, this decidability problem has polynomial-time solutions [START_REF] Buning | Resolution for Quantified Boolean Formulas[END_REF]. In the next sections, we only consider definite clauses.

The quantified definite Horn clause

∀ ((∀ ¬ 1 ( ) ∨ • • • ∨ ¬ ( )) ∨ ( )) (2.1)
is equivalent to the logic implication

∀ (∃ ( 1 ( , ) ∧ • • • ∧ ( , )) → ( )) (2.2)
where is a set of universally-quantified variables, is a set of existentially-quantified variables, 1 , . . . , are relation symbols, and where the head of the rule ( ) is a positive literal. Facts are unit clauses, which are definite clauses with no negative literal.

Prolog rules can be interpreted procedurally as "to answer query ( )?, we first have to answer the query ∃ 1 ( , ) ∧ • • • ∧ ( , )?". The authors of Prolog therefore decided that rules should be declared with the consequent as the left-hand term, and the antecedent as the right-hand term of a 'left arrow' logic implication connective. In other words, a rule is declared as

( ) ← ∃ 1 ( , ) ∧ • • • ∧ ( , ) (2.3)
where quantifiers are often omitted from the notation.

A consequence of using logic to represent knowledge is that such knowledge can be understood declaratively. A consequence of using deduction to derive consequences in a computational manner is that the same knowledge can also be understood procedurally. Thus, logic programming allows us to view the same knowledge both declaratively and procedurally.

Kowalski [START_REF] Kowalski | The early years of logic programming[END_REF]

Prolog Queries

Queries are used to retrieve information from a logic program. Prolog queries are sometimes denoted as predicate logic formulas ending with a question mark. The simplest query would be the one that verifies if a given fact is present in the program. If the program contains the fact Singer(Marvin, Gaye), solving the query Singer(Marvin, Gaye)? is simple: the truth of the query immediately follows from the fact in the program. However, if the program does not contain this fact, solving the query is more complex, as we have to check if the program's set of rules can be used to deductively infer that Singer(Marvin, Gaye) is true. For example, if we define a program encoding the knowledge that Marvin Gaye is a programmer, and that every programmer must also be a singer, as

Programmer(Marvin, Gaye) ← Singer( , ) ← Programmer( , ) (2.4)
then solving the same query Singer(Marvin, Gaye)? requires using the second rule in the program to deductively infer that the ground fact Singer(Marvin, Gaye) is true in any model that logically satisfies the rules of the program.

Queries are expressed within Prolog program using a special syntax for an implication: with a question mark as its consequent. For example, the previous query would be expressed as the rule

? ← Singer(Marvin, Gaye) (2.5)
Queries can also contain variables. A query that does not contain variables is sometimes called a goal, but we will define them as Boolean query whose answer is either true or false. When a query contains variables, the answer of the query is the set of substitutions of its variables to constants, such that the ground literals obtained by replacing variables by these constants can be deductively inferred from the program. For example, the query

? ← Singer(Marvin, ) (2.6)
asks for all substitutions of variable by some constant , such that the fact Singer(Marvin, c) can be inferred from the program's facts and rules.

Finally, queries can be more complex than single predicates. For example, a conjunctive query

? ← Singer(Marvin, ) ∧ Programmer(Marvin, ) (2.7)
asks for all last names of those whose first name is Marvin and who happen to be both singers and programmers. Note that this is equivalent to adding a rule to the program that defines the conjunction, and solving a single-predicate query, as follows

MyQuery( ) ← Singer(Marvin, ) ∧ Programmer(Marvin, ) ? ← MyQuery( ) (2.8)

Declarative and Logic Programming Paradigms

Paradigm -late Latin 'paradigma', meaning 'pattern' a . Programming paradigms are general patterns that are used to write computer programs. More than that, they are frames of cognition that deeply determine how a programmer will organise her thinking while implementing a solution to a particular problem. All programming languages are based on at least one paradigm.

a https://en.wiktionary.org/wiki/paradigm Programming languages are commonly classified into multiple paradigms, among them are imperative and declarative programming paradigms. Imperative languages define a program's control flow using a sequence of statements that modify the state of the program, while declarative languages describe the logic of the program itself, without necessarily detailing its control flow. With the great variety of programming languages avail-able in 2021, it is sometimes not possible to label a language with one particular paradigm, simply because they sometimes include features from multiple paradigms. Therefore, there is a whole spectrum between imperative and declarative languages. Sometimes, functionalities from one paradigm are implemented in a language that does not have that functionality because it is based on another paradigm. For example, NeuroLang has a built-in pattern matching system for its internal processing of program expressions, as Python does not come with a built-in pattern matching construct, typically found in functional programming languages like OCaml1 .

In an imperative language, the programmer writes a succession of instructions for the computer to update its state, and calculate a solution to a problem. Within this family, procedural languages use functions (a.k.a. procedures) to group instructions together, while object-oriented programming languages tie instructions and the part of the state they manipulate together into units called objects. Examples of imperative languages include some of the most popular languages in history, such as Fortran, C, or Python.

In contrast, in a declarative language, the programmer describes what the program should do rather than how it should do it. Functional programming languages, such as Haskell or Ocaml, describe computations as compositions of function applications, and rarely require an explicit sequence of instructions. Logic programs are defined as a set of facts and logic rules whose order of declaration is often unimportant. The underlying logic solver finds answers to queries on these programs by means of logic deduction, and therefore the programmer does not have to describe how the solution to the problem should be calculated. This is perhaps the most advantageous feature of the logic programming paradigm. However, Prolog is not a purely declarative language because the order of the rules in the program will impact the order in which facts are deductively inferred when solving a query. One program with its rules written in one order might not terminate, while if the rules had been written in another order, it would terminate [START_REF] Sterling | The Art of Prolog[END_REF]. In contrast, in purely declarative languages the order of the rules should not have such an impact. Datalog is a purely declarative deductive database programming language, as discussed next.

Database Programming with Datalog

With their ability to use predicates to relate objects with one another, logic programs can naturally express relational databases and queries. This is in fact one of the main applications of logic programming. Such databases, that are expressed through logic, are sometimes called logic databases. Datalog is perhaps the most famous language for expressing and querying logic databases. Its theoretical properties have been extensively studied, making it a solid formal foundation when developing practical systems to represent and reason about knowledge. The language that we develop in this thesis is based in big part on datalog. We introduce it in this section, mainly referring to the book Foundations of Databases [START_REF] Abiteboul | Foundations of databases[END_REF], that provides a comprehensible study of datalog. General intuitions are provided, but not formal notations and proofs, which are not required to understand the applicative nature of this thesis' contributions.

From Prolog to Datalog

Prolog is a general logic programming language, while datalog is a database programming language. However, there is a close syntactic resemblance between Prolog and datalog. In fact, datalog largely builds upon Prolog and logic programming in general [AHV95, p. 278]. We briefly clarify their main differences in terms of syntax, semantics, and purpose.

The most important syntactic difference between Prolog and datalog is that, contrarily to Prolog, datalog literals cannot contain function symbols. In other words, a literal ( ( )) is syntactically invalid in datalog because the function symbol appears within the literal (• • • ). This rather simple syntactic restriction has major implications.

Particularly, Prolog is a Turing-complete language because recursivity and function symbols can be used to generate an infinite domain from a finite set of symbols, thereby simulating an infinite Turing tape [AH88; Cro88]. On the contrary, because it lacks function symbols, a datalog program is bounded in size, and queries on the program are guaranteed to be solvable in polynomial time with respect to the size of the database.

Although it has less expressive power, the potential of datalog lies in its reduction of the query resolution problem into one that has formal tractability guarantees: queries are guaranteed to be solvable in polynomial time with respect to the size of the database.

Another syntactic difference is that datalog requires variables that occur in a rule's consequent to also occur in its antecedent. In other words, given a datalog rule of the form ∀ ( ( ) ← ∃ , ( , )), where ( , ) is a conjunction of literals, all universally quantified variables in must occur in ( , ). Otherwise, the rule is syntactically invalid. In particular, datalog only allows ground unit clauses, which are facts. In Prolog, it is possible to write the clause ∀ ( ( ) ← ), where is a set of variables, while this is forbidden in datalog because none of the variables occur in the antecedent of the rule.

Another important difference is that datalog has a more domain-specific usage, as a language for programming deductive databases. In Prolog, the initial knowledge (or data) is directly incorporated into the program itself, using facts. However, datalog programs are often viewed differently, with two sets of relations that are clearly separated: extensional relations only occur in the body of the rules, while intensional relations only occur in the head of the rules. Given a datalog program , its set of relation names is called its database schema, and denoted sch( ). Its set of extensional relation names is called the extensional database schema, and denoted edb( ), while its set of intensional relation names is called the intensional database schema, and denoted idb( ). Note that sch( ) = edb( ) ∪ idb( ). What does it mean to run a datalog program P on a given input database instance over edb( )? A datalog program is a mapping from database instances over edb( ) to database instances over idb( ). In other words, the program takes as input some already-known facts stored in extensional relations, and uses its rules to deductively infer new facts stored in intensional relations. This is illustrated in fig. 2

Recursivity

Datalog, much like Prolog, allows programs to be recursive. In logic programs, recursivity occurs when one relation's definition depends on itself. A common and intuitive example that illustrates recursivity is the 'Biblical' program [SSG87, p. 130], defined from the two rules ancestor( , ) ← parent( , ) ancestor( , ) ← parent( , ) ∧ ancestor( , ) (2.9) which respectively state "if is a parent of , then is an ancestor of " and "if is a parent of and is an ancestor of , then is also an ancestor of " (definition of a grandparent-grandchild relationship).

Recursivity in datalog programs can be detected by tracing the dependency graph of the program. That is, a graph where every node is a relation name, and where there is an edge → whenever relation occurs in the head of a rule while occurs in its body. Recursivity is important in programming as it enables the formulation of elegant solutions to problems that would be otherwise harder to express. Moreover, recursive structures can emerge naturally in data. Recursive programming is a powerful technique, but it can lead to infinite structures, requiring specific algorithms for evaluating programs. Next, we discuss how recursive datalog programs can be evaluated.

Evaluation of Datalog Programs Deductive Inference and Fixpoint Semantics

Starting from an instance over edb( ) and a set of rules that define the program , how can we obtain an instance over idb( ) containing all the facts that can be deductively inferred from ? Is this instance over idb( ) unique? These semantics should be formally defined. Several semantics of datalog have been studied, and they are all related. We focus on the intuitive fixpoint semantics, stemming from the more general fixpoint theory [START_REF] Tarski | A lattice-theoretical fixpoint theorem and its applications[END_REF], and relate them to the model-theoretic semantics stemming from model theory, an important topic of mathematical logic.

The fixpoint approach is a constructive and natural strategy for answering queries on datalog programs. Starting with an instance of the extensional database schema, the rules of a datalog program are applied to construct an intermediate instance. This process is repeated, starting from the last intermediate instance, until no new fact can be inferred from the application of the rules, and a final instance is reached. We say that the algorithm has converged to a fixpoint. This is illustrated in fig. 2.3.

Rules of the program are applied

repeatedly until no new knowledge can be inferred The fixpoint approach was proven to produce what is called the minimum model of a datalog program, defined as the smallest database instance that both contains the instance of the extensional database schema, and satisfies the logic rules of the program -from a model-theoretic semantics point of view [START_REF] Abiteboul | Foundations of databases[END_REF]p. 283]. Solving a query on a datalog program is asking whether the query is true in this minimum model. This is equivalent to asking whether the query can be deduced from the input instance and the rules of the program.

Final set of facts

Output

Initial set of facts

Input Intermediate Instance

Strategies such as the one described here are called bottom-up strategies, because they start with some initial knowledge and build up from there by inferring new knowledge using the rules. This is contrast with top-down strategies that would start with a logical premise -or query -for which we want to know whether it is implied by the program, and trace back down to the initial knowledge that could prove this premise.

A naive algorithmic implementation of the aforementioned bottom-up approach will run the inference on each new intermediate instance at every step of the algorithm. This means that, at each step, what has already been inferred is inferred again, and this can become a major computational bottleneck when dealing with a large number of facts.

Heuristics for evaluating programs more efficiently, without having to repeat the work several times in the process, have emerged in the literature since the 1980s.

Seminaive evalution [AHV95, p. 312] is an optimisation of the naive approach that focuses on the facts inferred at the previous step to infer new facts at the next step, thereby preventing redundant computation during the evaluation of the program.

Another bottom-up approach is based on a general algorithm called magic sets [Ban+86; BR91], and has been adapted to the evaluation of datalog programs. The magic set algorithm finds constraints within the body of the program's rules and rewrites the program, propagating the constraints to the rules' dependencies. It effectively rewrites the program, generating an equivalent program whose evaluation will be more optimal and reduce the amount of redundant or unnecessary computation.

Relational Algebra

Codd's relational model of data is the foundation of all modern relational database systems [START_REF] Codd | A relational model of data for large shared data banks[END_REF]. Relational algebra is one of the languages on which query languages such as SQL are based. Semantically, relational algebra manipulates relations which are equivalent to sets of tuples in relational calculus. The language provides operations that are applied to the relations, such as the union operator which computes the union of two sets of tuples in two relations.

Systems for evaluating queries on relational databases and datalog programs translate these queries to relational algebra expressions [START_REF] Boyce | Specifying Queries as Relational Expressions[END_REF][START_REF] Abiteboul | Foundations of databases[END_REF]. The idea is that the solution to the query is formulated as an algebraic expression that operates on the relations of the database, and this expression can be rewritten into an equivalent but more efficient expression, as the order of the operations can reduce the computational cost of solving the query.

Extensions of Datalog

For most applications, Horn clauses of raw datalog do not provide the expressive power to represent all domain knowledge, or formulate all queries of interest, to the point that it is not practical2 . To increase the expressive power of rules and queries in datalog, a number of syntactic extensions have been proposed. These extensions are part of most implementations of datalog in production systems, such as Soufflé: a high-performance datalog-based static program analyser [START_REF] Jordan | Soufflé: On Synthesis of Program Analyzers[END_REF].

The appeal of datalog is in the formal guarantee that queries will be solved in polynomial time with respect to the size of the database. Therefore, each extension must be carefully studied to formally understand under which conditions this guarantee will or will not remain. Extending the syntax will often impose restrictions on the type of queries that can be solved by the underlying engine, and sometimes change the semantics of the program itself.

Negation

By default, datalog does not permit negative literals in the body of its rules. For example, the rule Singer( ) ← ¬Programmer( ) violates the syntax of the language. In fact, it violates the definition of a datalog program itself: a negative literal in the body means that the clause has two positive literals, while a definite clause must have only one [START_REF] Horn | On sentences which are true of direct unions of algebras[END_REF]. When negative body literals are added to the language, then called datalog ¬ , the fixpoint and model-theoretic semantics that we discussed previously break apart. From the fixpoint semantics point of view, there is no guarantee that the resolution algorithm will converge to a fixpoint, nor that there is a unique fixpoint for a particular program and input instance. From the model-theoretic semantics point of view, there is no longer a guarantee on the uniqueness of the minimum model [START_REF] Abiteboul | Foundations of databases[END_REF]p. 376]. New semantics must be defined for datalog ¬ .

There is a second issue that comes with negation. If we go back to the rule of the previous paragraph, Singer( ) ← ¬Programmer( ), we might wonder: what are the possible constant substitutions for such that Singer( ) is true? The answer is that it depends on the assumption made about the universe of discourse, also called the domain of the database. In datalog, the domain of the database is defined as a countably infinite set of constants. The previous rule is problematic because using it for deductive inference will lead to an infinite number of inferred facts, substituting by all constants in the domain for which Programmer( ) is false.

The active domain assumption considers the domain to be restricted to the finite set of constants occurring in the input instance over edb( ), which prevents an infinite result. However, this is also not ideal because it might still not be what the user expects. For example, if the input instance contains both facts Furniture(Table ) and Programmer(Knuth), the active domain is the set of constants {Table, Knuth}. Assuming the program contains the previously-defined rule, the output of the program will contain the fact Singer(Table ), and singing tables might come as a surprise.

One way to address this problem is to associate types to variables [START_REF] Zook | Typed Datalog[END_REF], which limits the set of constants by which the variable can be substituted to a set of commonly-typed objects. But this approach does not provide semantics for datalog ¬ . Another way to address this problem is to impose syntactic restrictions that enforce the domain independence of queries. A domain independent query's solution is independent of the underlying database domain because its formula itself bounds its solution to the active domain, for any possible input instance over edb( ). But this time, the restriction is clearly formulated in the program, rather than imposed by the implicit active domain assumption that might surprise the user. Going back to the previous example, if we add an extensional relation Person and the fact Person(Knuth) to the program, and redefine the rule as Singer( ) ← ¬Programmer( ) ∧ Person( ) (2.10) then the output of the program will not contain any fact with relation symbol Singer because there is no substitution for such that Programmer( ) is false while Person( ) is true. Such queries are called safe-range because the range of constant substitutions of all their variables is explicitely restricted to a finite set, and therefore they cannot lead to infinite instances through deductive inference [AHV95, p. 83]. Importantly, it is possible to syntactically analyse queries to verify that they are safe-range, by translating the query into a normal form, using a set of rewritting rules [AHV95, p. 83], and checking that each variable in the query is 'range-restricted'. A query that is not safe-range -an unsafe oneis immediately discarded, and the user is asked to write the query in a safe-range manner.

Resolution of safe-range queries is guaranteed to converge to a unique fixpoint, and we recover the existence of a unique minimum model. The cost is that the user has to write queries in a particular form, meaning that some queries are forbidden, which might not necessarily feel intuitive to her.

Equality and Inequality Operators

Query languages often provide comparison operators between variables and/or constants. The addition of the equality (=) operator has similar implications to the addition of the negation operator, which we previously discussed. A rule such as A( , ) ← B( ) ∧ = leads to an infinite solution set because there are infinitely many valuations of variables and for which its antecedent is true. Therefore, variables occurring in an equality atom must be range-restricted [AHV95, p. 48] similarly to those occurring in negated atoms. Equality atoms can lead to unsatisfiable queries that should result in empty solution sets. For example, the rule, A( ) ← B( )∧ = a∧ = b, where both a and b are constants, has an antecedent that is always false (⊥) since cannot be equal to both constants simultaneously. When both equality and negation are added to the program, inequality can be expressed as the negation of an equality atom, such as in ¬( = ), and is written as ≠ .

Function Symbols

As mentioned earlier, logic languages like Prolog allow function symbols to occur within literals. This is a very powerful feature that allows Prolog to represent any kind of data structure, and that makes the language Turing-complete [SSG87

Other Extensions

Several syntactic extensions of datalog have been -and continue to be -studied, leading to a whole field of research. Disjunctive datalog extends the language by allowing disjunctions to appear in the head of the program's rules, such as in 1 ( ) ∨ 2 ( ) ← ∃ , ( , ), and was proved to be more expressive than datalog with negation [START_REF] Eiter | Disjunctive datalog[END_REF].

Other languages add the possibility of expressing rules with existentially quantified variables in their head, such as in the rule ∃ , ( , ) ← ( ). For example, datalog +/- [Cal+10] is a family of languages that add support for existentially quantified consequents, and the possibility of having a false consequent such as in ( ) → ⊥ to express constraints within the program. The principal application of datalog +/-is ontology querying. Although these languages extend the syntax of datalog with new features, they also simultaneously impose other syntactic restrictions to ensure decidability and tractability of query resolution.

Inherent Uncertainty of Real-World Data

When researchers got access to computers, the first thing they wanted to do was to make them intelligent. Then was born artificial intelligence3 . Their approach at the time was to encode knowledge about the world into programs, and the language of choice for that -the one a computer could understand -was first-order logic. Logic seemed perfect for representing the relationship between objects because it is a formal language with structured formulas that are easy to interpret for humans, and convenient to manipulate for computers. Since those descriptions of the world were using logic symbols, this branch of artificial intelligence came to be called symbolic AI.

However, it was soon realised that our surrounding environment was too noisy and complex to be solely represented through logic, as logic cannot express the uncertainty of the real-world. Some sort of probabilistic modeling had to be introduced to encode the uncertainty one had about a particular piece of knowledge or evidence. And probability seemed to be the tool of choice for representing uncertainty. As August de Morgan put it, back in 1838, "I consider the word probability as meaning the state of mind with respect to an assertion, a coming event or any other matter on which absolute knowledge does not exist". Other ways to represent uncertainty were later proposed, such as fuzzy logic, that we do not explore in this work. Probability is our main focus because it is a widely taught topic, and for that reason it feels feel more intuitive to most: a language that has fuzzy logic semantics could be harder to grasp for a community of neuroscientists.

Klir and Wierman characterised the concept of uncertainty and described its significance: "When dealing with real-world problems, we can rarely avoid uncertainty. At the empirical level, uncertainty is an inseparable companion of almost any measurement, resulting from a combination of inevitable measurement errors and resolution limits of measuring instruments" [START_REF] Klir | Uncertainty-Based Information[END_REF]. Although it applies to any real-world application, the second sentence of this quote greatly summarises the shortcomings of the fMRI signal that were discussed in the first chapter of this dissertation. The uncertainty that comes both from brain activity measurements and inter-subject variability is perhaps the main challenge that brain mapping research faces on a day-to-day basis. This means that any system dealing with this type of data must be designed in a way that it can represent its inherent uncertainty. Logically, the uncertainty of neuroimaging data immediately prop-agates to meta-analytic data, simply because meta-analysis aggregates studies whose results have been obtained from the analysis of neuroimaging data.

In our quest to design a language capable of expressing brain mapping hypotheses, languages like Prolog and datalog are thus not sufficient, as uncertainty is out of their scope. Parallel to the development of symbolic AI, Bayesian networks emerged as a general model for representing complex dependencies and causal relationships between random variables [Pea88; KMP97]. But Bayesian networks are less expressive than computer programs written in probabilistic programming languages, which can formulate more general programs, including recursive ones [START_REF] Van De Meent | An introduction to probabilistic programming[END_REF]. Probabilistic graphical models were proposed as a more general way of representing Bayesian networks, where conditional dependencies between random variables are represented with a graph that can contain cycles to represent circular dependencies [START_REF] Koller | Probabilistic Graphical Models: Principles and Techniques -Adaptive Computation and Machine Learning[END_REF]. Probabilistic logic programming is a natural extension of languages like Prolog and datalog, as they extend logic programming with probabilities to represent uncertainty. In the next chapter, we describe probabilistic logic programming formalisms and their links with Bayesian networks, graphical models, and probabilistic databases.

Inductive logic programming In parallel to the development of Bayesian networks, the daunting task of hand-crafting all the necessary knowledge within programs led to the idea of learning programs through inductive logic programming, a technique that preceded statistical relational learning, and with which logical rules of programs can be learned from data. Given a set of facts, also called background knowledge, and another set of expected positive or negative facts, inductive logic programming aims to find an hypothetical program with rules that correctly infer the truth and false valuations of the facts in the second set, based on the initial background knowledge. With enough background knowledge, and enough examples of expected facts, the algorithm should be able to derive logical rules that generalise to new data. More recently, ideas such as learning background knowledge instead of hand-crafting it with expert domain knowledge, and using gradient-based methods to induce relaxed logic programs have been explored [START_REF] Cropper | Turning 30: New Ideas in Inductive Logic Programming[END_REF].

Extensions of datalog have sometimes themselves been extended with probabilistic semantics. It has been the case for the datalog +/-family of languages, whose main application is automatic information extraction by querying ontologies that have been automatically constructed from Web data. This automatic extraction process leads to inconsistent and incomplete ontologies, and therefore some inherent uncertainty. Inconsistency and incompleteness are two of the most common sources of uncertainty in data [START_REF] Klir | Uncertainty-Based Information[END_REF], and it is important to measure it [START_REF] Vanina | How Dirty Is Your Relational Database? An Axiomatic Approach[END_REF]. Gottlob et al. [START_REF] Gottlob | Query answering under probabilistic uncertainty in Datalog+ /ontologies[END_REF] extend datalog +/-to incorporate probabilistic semantics that are based on Markov logic networks.

Chapter Key Points 1. Solving a problem using computers can be done either through the development of programs in general-purpose programming languages, or by designing a language that is specific to the task at hand: a domainspecific language.

2. Several paradigms of programming exist, leading to a wide variety of languages, with different purposes. Prolog is the most widely-known logic programming language, in which logical facts and rules are expressed, and new knowledge can be obtain through deductive inference.

3. Datalog stands on the work in logic programming to provide a language for solving queries on logic databases. Its syntax is more restrictive than Prolog: the cost is that datalog looses the turing-completeness of Prolog, but the gain is that queries on datalog programs are guaranteed to be solved in polynomial time w.r.t. the size of the database.

4.

For practical applications, datalog's syntax needs to be extended, but these extensions can break the formal guarantees of the language, requiring sometimes new semantics to be defined.

5.

Expressing uncertainty that comes with all real-world applications is out of the scope of logic programming languages because they are based on mathematical logic formalisms where each piece of knowledge is certain, not leaving any place for doubt.

Chapter 3

Reasoning Under Uncertainty with Probabilistic Logic Programs Abstract. Probabilistic logic programming extends logic programming with the concept of probabilities. In contrast with logical statements, which state that something is true with absolute certainty, probabilistic logic can state that something might be true, with some probability that depends on one's degree of belief. In a similar fashion, probabilistic databases extend traditional relational databases by attaching probabilities to tuples of the relations. Extensional relational algebra expressions can be used for exact probabilistic inference on these databases, but only for certain queries. Probabilistic query evaluation corresponds to summing the probabilities of the possible worlds in which a query is true, a special case of the weighted model counting (WMC) problem. WMC is #Phard to solve in general, as the number of possible worlds grows exponentially with the number of Boolean variables induced by program or database. Knowledge compilation (KC) strategies compile programs and databases into compact representations where the WMC problem can be solved more efficiently. If a query admits a polynomial-size compilation target, it can be answered in polynomial time, but this is not the case for all problems. Still, obtaining a compact representations can be computationally costly, because it requires the problem to be transposed to propositional logic. Lifted inference exploits structural symmetries in logical formulas to derive query plans that find answers to probabilistic queries without requiring to represent the problem as a propositional formula. However, this works only for some classes of queries. Those for which it does not work are provably #P-hard and called non-liftable.

Probabilistic Logic Programming

To reach our goal of designing a programming language for cognitive neuroscience, a field we argued to be assailed by noisy and uncertain data, logic alone will not cut it. A whole field of research has been there, long before us, and has developed formalisms to extend logic with probabilities.

By introducing probabilities into logical systems, we move from a world where everything is either true or false with absolute certainty, to a world in which relationships between objects are modeled probabilistically to account for the uncertainty surrounding these relationships.

One way to extend first-order logic with probabilities is to attach probabilities to logical facts, then called probabilistic facts. Albeit simple, probabilistic facts were shown to be expressive enough to represent a variety of models, such as Bayesian networks, Markov chains, and hidden Markov models [START_REF] Poole | Probabilistic Horn abduction and Bayesian networks[END_REF][START_REF] Sato | A Statistical Learning Method for Logic Programs with Distribution Semantics[END_REF][START_REF] Poole | An Introduction to Lifted Probabilistic Inference[END_REF]. Another way is to use probabilistic clauses, in which the consequent of the rule has a probability of being true if its antecedent is true.

The most important aspect of probabilistic a logic program is that, in contrast with logic programs whose semantics are defined by their least Herbrand interpretation, the semantics are instead that of a probability distribution over a set of possible worlds. Solving a query then corresponds to calculating the probability that it is true across all possible worlds, based on their distribution.

Example: are Jane and Andrea Flatmates?

Imagine a social network company that wants to profile their users as precisely as possible, based on their activity on the social network, and on data acquired using third-party cookies that the company uses to track them across all the Internet. There is this new data point that advertisement agencies have been asking them to provide: whether users are flatmates or not. This could help the agencies targeting users with more specific ads, like a mobile app that helps flatmates divide household tasks up. Also, the NSA is interested in this type of data points, for 'national security' reasons.

As an example, we consider two users: Jane and Andrea. Both Jane and Andrea have installed the social network's app on their smartphone. Their GPS location data, that the company has been recording by tapping their phone, tells them that they often spend a lot of time geographically close to each other (approximately 30 meters, but GPS data is sometimes inaccurate), especially at night. Maybe they are lovers, or maybe just neighbors?

The company really has to know, and -thankfully -they have plenty of other data about Jane and Andrea. They know that they are friends on the platform, and that they are often seen together on pictures taken at the same location which they both seem to be often sleeping at (at least that is what the face recognition algorithm that they ran on their pictures -and these pictures' metadata -tells them). Also, they know that Andrea is in a relationship with someone named Aiden, who they recorded at night at the same location as Andrea and Jane, but much less frequently.

There is still some uncertainty about Jane and Andrea being flatmates but they are more and more sure about this relationship being true. How can the engineers working at the company express their degree of belief within a probabilistic logic program?

Probabilistic Facts

The elaborate probabilistic model that the social network company used for producing some estimate of this uncertainty outputs 0.78, and so they add to their program the probabilistic fact, Flatmates(Jane, Andrea) : 0.78 ← (3.1) which semantically means that there is a 0.78 probability that Jane and Andrea are flatmates. Syntactically, a probability 'label', also sometimes called 'annotation', is simply attached to the logical predicate Flatmates(Jane, Andrea) using the notation above.

Ground Programs

Semantics of probabilistic logic programs often rely on the assumption that the program is ground. A logic program is ground if its rules only contain ground terms (i.e. terms with no variables). A ground program can be obtained from a non-ground program by replacing all variables by their possible constant term substitutions. A ground program often contains many more rules than its initial non-ground one, because one rule must be built for every possible constant substitutions of the initial rule's variables. For example the following program encodes that both Jane and Andrea are users of the social network, and that two users recorded to sleep at the same location are (rather naively) considered In the Flatmates rule of the program, 3 variables occur: , , and addr (address). Therefore, the program is not ground. A ground program can be constructed by creating all ground rules from the initial rules, where variables are replaced by their possible substitutions. This results in the following rules in the grounded program Flatmates(Andrea, Jane) ← User(Andrea) ∧ SleepLocation(Andrea, 2 rue des Degrés) ∧ User(Jane) ∧ SleepLocation(Jane, 2 rue des Degrés)

Flatmates(Jane, Andrea) ← User(Jane) ∧ SleepLocation(Jane, 2 rue des Degrés) ∧ User(Andrea) ∧ SleepLocation(Andrea, 2 rue des Degrés)

Flatmates(Aiden, Jane) ← User(Aiden) ∧ SleepLocation(Aiden, 2 rue des Degrés) ∧ User(Jane) ∧ SleepLocation(Jane, 2 rue des Degrés)

Flatmates(Jane, Aiden) ← User(Jane) ∧ SleepLocation(Jane, 2 rue des Degrés) ∧ User(Aiden) ∧ SleepLocation(Aiden, 2 rue des Degrés)

Flatmates(Aiden, Andrea) ← User(Aiden) ∧ SleepLocation(Aiden, 2 rue des Degrés) ∧ User(Andrea) ∧ SleepLocation(Andrea, 2 rue des Degrés)

Flatmates(Andrea, Aiden) ← User(Andrea) ∧ SleepLocation(Andrea, 2 rue des Degrés) ∧ User(Aiden) ∧ SleepLocation(Aiden, 2 rue des Degrés)

(3.3)
This definition of ground logic programs also translates to ground probabilistic logic programs, whose rules only contain ground terms, i.e. no variable.

Seeing ground programs highlights the expressive power of first-order logic compared to propositional logic, as one rule can encode the relationship between a large number of objects. A ground program is a propositional logic formula, as we replace all variables in the predicate logic version of the program. The necessity of generating this large propositional formula will turn out to be a large bottleneck when it leads to large ground programs.

Probability Distribution Over Possible Worlds

In the previous chapter, we formally defined the semantics of a datalog program as being a mapping from instances over its extensional database schema edb( ) to instances over its intensional database schema idb( ). Other semantics need to be defined for probabilistic logic programs. A probabilistic logic program defines a probability distribution over its set of possible outputs, also called possible worlds or possible outcomes.

Going back to the previous example, a probabilistic logic program that solely contains the probabilistic fact of eq. (3.1) defines two possible worlds: one in which Jane and Andrea are flatmates, and one in which they are not. And each one of these two worlds has a probability attached to it: the world where Flatmates(Jane, Andrea) is true ( ) has a probability of 0.78, while the world where Flatmates(Jane, Andrea) is false (⊥) has a probability of 1 -0.78 = 0.22. As for any proper probability distribution, the probabilities of all possible worlds sum to 1.

Distribution semantics were initially introduced by Sato [Sat95], who described a program as a set of probabilistic facts and a set of Horn clauses, interpreting the ground program as defining a probability distribution over the set of its possible Herbrand interpretations, which correspond to all possible truth assignments of ground atoms occurring in the program. This is illustrated in fig. 3.1. Distribution semantics are at the core of the probabilistic logic programming language PRISM, proposed by Sato and Kameya [START_REF] Sato | PRISM: A Language for Symbolic-Statistical Modeling[END_REF]. It should be noted that semantics of probabilistic first-order logic had been discussed before [START_REF] Joseph | An analysis of first-order logics of probability[END_REF].

In the same vein, independent choice logic [START_REF] Poole | The independent choice logic for modelling multiple agents under uncertainty[END_REF] provides constructive semantics for building possible worlds. A choice space is defined as a set of disjoint sets of ground atoms. In a given possible world, only one of each set's atoms is selected to be true, and the probability of selecting one particular atom is given by a probability measure. This is more general than probabilistic facts because it allows the representation of probabilistic choices: a set of atoms whose associated random variables are mutually exclusive. We discuss probabilistic choices further in the next subsection, in the context of the more general probabilistic clauses.

Probabilistic Clauses

Probabilistic facts are the simplest way to introduce probabilities in first-order logic. Another and more powerful way to do so is to use probabilistic clauses: rules in which probabilities can be attached to head predicates1 . This renders causal relationships themselves probabilistic. Multiple ways of expressing probabilistic clauses have been proposed in . Each of the 2 + 1 possible interpretation of the probabilistic facts in the program are associated with a probability that assumes facts to be independent from one another. The probability of one particular interpretation is the product of the probabilities of each fact's truth assignment in the interpretation: if it is true, 1if it is false, where is the probability label attached to the fact. The probability of the th interpretation is denoted by . Based on a given interpretation of , the program's set of Horn clauses, denoted , are used in deductive inference to obtain the least Herbrand model for ∪ , called possible world. Each interpretation of leads to a different possible world, and is associated with a probability.

the literature, leading to different semantics. We focus our discussion on some of the most widely used probabilistic extensions, which will be pertinent to the understanding of our contributions. We refer the reader to the excellent review of De Raedt and Kimmig [START_REF] De | Probabilistic (logic) programming concepts[END_REF] for more details on other approaches.

Logic Programs with Annotated Disjunctions

Introduced by Vennekens, Verbaeten, and Bruynooghe [START_REF] Vennekens | Logic Programs with Annotated Disjunctions[END_REF], logic programs with annotated disjunctions (LPADs) extend disjunctive logic programs with probabilities, and are defined as a set of rules written as

(ℎ 1 : 1 ) ∨ • • • ∨ (ℎ : ) ← 1 ∧ • • • ∧ (3.4)
where ℎ 1 , . . . , ℎ are head predicates, while 1 , . . . , are probability labels summing to 1 -i.e.

= 1 -and where 1 , . . . , are body predicates. Semantically, a LPAD CHAPTER 3. REASONING UNDER UNCERTAINTY WITH PROBABILISTIC LOGIC PROGRAMS defines a probability distribution over logic programs, because an annotated disjunction rule defines a probability distribution over the following set of logic programming rules

{(ℎ ← 1 ∧ • • • ∧ ) | = 1, . . . , } . (3.5)

Causal Probabilistic Logic

Causal probabilistic logic -CP-logic for short -programs are syntactically equivalent to LPADs. Rules of a CP-logic program are called causal probabilistic laws (CP-law), and are defined as taking the form

∀ (ℎ 1 : 1 ) ∨ • • • ∨ (ℎ : ) ← ( ) (3.6)
where are non-zero probabilities such that ≤ 1, is a first-order formula, ℎ are head predicates, and is the set of all free variables occurring in and the head predicates. CP-laws have a different semantic interpretation than annotated disjunction rules, as they are meant to be interpreted as "for each , the event of ( ) being true causes at most one of the head predicates ℎ to be true; for each , the probability that ℎ is the effect of this event is " [START_REF] Vennekens | CP-logic: A language of causal probabilistic events and its relation to logic programming[END_REF]. Note that because can be strictly lesser than 1, it is possible to express that the event ( ) has a probability of causing no head predicate to be true, even though the event did occur. Although this semantic interpretation of CPlaws is closer to the semantics of causal processes, the semantics of CP-logic programs have in fact been proven to be equivalent to those of LPADs by Vennekens, Denecker, and Bruynooghe [START_REF] Vennekens | CP-logic: A language of causal probabilistic events and its relation to logic programming[END_REF].

ProbLog

ProbLog is a probabilistic extension of the logic programming language Prolog, discussed in the previous chapter. In ProbLog, rules take the form

: ℎ ← 1 ∧ • • • ∧ (3.7)
where ℎ is a head predicate, are body predicates, and is the probability label of the rule. The semantics of a ground ProbLog program coincide with the semantics of its equivalent LPAD [START_REF] Vennekens | CP-logic: A language of causal probabilistic events and its relation to logic programming[END_REF]. The difference is in the semantics of non-ground ProbLog program, where the presence of the causality of the rule is probabilistic. That is, the ProbLog rule 0.42 : Friends( , ) ← Friends( , ) ∧ Friends( , )

(3.8) semantically means that there is a 0.42 probability that the Friends relation is transitive, instead of it being interpreted as "for each , , and such that and are friends and and are friends, there is a 0.42 probability that and are friends". In the ground version of the program, where this rule is repeated for each possible constant substitution of variables , and , the second interpretation would be the right one, and therefore the ground ProbLog program would be semantically equivalent to its corresponding LPAD.

Mixing Deterministic and Probabilistic Rules

In most applications, some knowledge will be uncertain but some knowledge might be certain as well. It can be important for a knowledge representation system to be able to accommodate the two. In our flatmates running example, we might want to encode the symmetric aspect of the Flatmates relation: if Jane is Andrea's flatmate, Andrea is Jane's flatmate as well. In other words, we would want to add the following rule to the program Flatmates( , ) ← Flatmates( , )

(3.9)

A deterministic rule can be interpreted as a probabilistic clause with a single head predicate that has a probability of 1.0 attached to it. That is, the rule ( ) ← ( ) can be written as the probabilistic clause ( ) : 1.0 ← ( ), meaning that there is a 100% chance that if ( ) is true then ( ) is true as well. Deterministic relations can be integrated within probabilistic query resolution systems without being considered to be probabilistic [START_REF] Van Den Broeck | Query Processing on Probabilistic Data: A Survey[END_REF]p. 286]. Our practical approach to mixing deterministic and probabilistic relations in NeuroLang is detailed in the next part of this thesis.

Example: Flatmate Relation Using Probabilistic Clauses

We can use any of the just-described languages, that provide a syntax for expressing probabilistic clauses, to refine our definition of whether two users of the social network are flatmates. We use CP-logic due to its intuitive causal semantics, although we saw that all these languages are for the most part equivalent to one another, in both their syntax and semantics. In particular, we could use the frequency at which two users sleep at the same geographical location to model the probability of them being flatmates. For example, Jane and Andrea are recorded at night at the same location 87% of the time, while the similar proportion for Andrea and Aiden is only of 18%. One way to encode this uncertainty with probabilistic clauses could be to write the following program User(Jane) ← User(Andrea) ← User(Aiden) ← SameSleepLocationFrequency(Jane, Andrea, 0.87) ← SameSleepLocationFrequency(Andrea, Aiden, 0. Note that this is equivalent to defining the two probabilistic facts Flatmates(Jane, Andrea) : 0.87 ← Flatmates(Andrea, Aiden) : 0.18 ← (3.11)

Modeling University Students based on Friendship

The true power of probabilistic clauses comes when they depend from one another, as this creates a chain of causal events. Let us assume that Jane, Andrea and Aiden are students, but we don't know for sure which university they belong to, because they did not fill that part of their profile on the social network's platform. However, they each have some friends on the platform who did fill in which university they study at, and these friends will influence our estimation of the probability that they study at the same university. We can then use this probability within our definition of the Flatmates relation.

We can define the following probabilistic clauses to model the probability that user studies at university based on whether her friends study there too UniStudent( ,

) : 1.0 ← UniLabel( , ) UniStudent( , ) : 0.1 ← ∃ Friends( , ) ∧ UniStudent( , ) (3.12)
where UniLabel( , ) is a deterministic relation encoding that user filled in their profile with their university . The first rule encodes that if user fill in their profile information with their university, their probability of studying at that university is 1.0 because this is considered to be certain information. The second rule encodes that if user has a friend who studies at university , then this contributes to the probability that user studies at university with probability 0.1.

Because this definition is recursive, if has some friend who has some friend that studies at university , this will impact the probability that studies at is well, but to a lesser extent. Moreover, can have multiple friends who study at university and will impact the probability that studies at university .

For example, let us assume the following Friends and UniLabel relations

Friends

Jane Elie Jane Noa Noa Riley

UniLabel

Elie UCL Noa UCL Riley MIT (3.13) and use the program of eq. (3.12) to determine the probability that Sam studies at UCL or MIT. Sam's probability of studying at some university will depend on the probabilities, for all of Sam's friends, that they study at as well. Both Elie and Noa are Sam's friends who study at UCL, and represent two independent causes for Sam to be considered a student at UCL as well. The grounding of eq. (3.12) contains the rules UniStudent(Jane, UCL) : 0.1 ← Friends(Jane, Elie) ∧ UniStudent(Elie, UCL) UniStudent(Jane, UCL) : 0.1 ← Friends(Jane, Noa) ∧ UniStudent(Noa, UCL)

(3.14) and the probability that Sam studies at UCL in any possible world defined by the program is obtained by calculating the probability of the complementary event that none of the two causes lead to the consequence that Sam studies at UCL. The probability is thus equal to

P[UniStudent(Jane, UCL)] = 1 -(1 -0.1) 2 = 0.19 (3.15)
If we now want to obtain the probability that Sam studies at MIT, the following ground rules will intervene in its computation UniStudent(Jane, MIT) : 0.1 ← Friends(Jane, Noa) ∧ UniStudent(Noa, MIT) UniStudent(Noa, MIT) : 0.1 ← Friends(Noa, Riley) ∧ UniStudent(Riley, MIT) UniStudent(Riley, MIT) : 1.0 ← UniLabel(Riley, MIT)

(3.16) The probability now depends on a chain of events. The first event is that Riley studies at MIT: it has a probability of 1.0 because Riley filled their profile with this university. The second event is that Noa studies at MIT: because Noa has only one friend (Riley) who studies at MIT. Noa's probability of studying there as well corresponds to the probability that the event UniStudent(Riley, MIT) causes the event UniStudent(Noa, MIT), which is 0.1. Finally, the third event is that Sam studies at MIT: the only cause for that event is that Noa studies at MIT, which we saw has a probability of 0.1. Therefore, the probability that Sam studies at MIT is the product of the probability that Noa studies at MIT, and of the probability that it causes Sam to study at MIT as well: 0.1 2 = 0.01. This shows that, with our friendship-based probabilistic modeling of whether users study at universities, although second-degree friends do have an impact on this probability, it is much smaller than the impact of first-degree friends.

Flatmates and University Students

Now that we have a probabilistic definition of whether users study at universities, we can plug it in our Flatmates relationship model using the following program SameSleepLocation(Jane, Andrea) : 0.87 ← SameSleepLocation(Andrea, Aiden) : 0.18 ← Flatmates( ,

) ← UniStudent( , ) ∧ UniStudent( , ) ∧ SameSleepLocation( , ) (3.17)
where we use a probabilistic fact relation SameSleepLocation to represent the uncertainty surrounding two users sleeping at the same location. The Flatmate relation now depends on two components: whether two users study at the same university, and whether they sleep at the same location.

Recursivity in Probabilistic Programs

The definition of the UniStudent relation is recursive, as it depends on itself. Were we to extend the Friends relation to encode its symmetrical aspect, the ground program would have many cycles, and the calculation of the probabilities of UniStudent facts would become much less trivial. For example, UniStudent(Jane, MIT) would depend on UniStudent(Noa, MIT) as before, but now UniStudent(Noa, MIT) would also depend on UniStudent(Jane, MIT), which itself depends on UniStudent(Noa, MIT), etc. Solving queries on recursive probabilistic logic programs requires more complex algorithms. The next sections discuss the problem of query resolution in the context of probabilistic logic programs.

Queries on Probabilistic Logic Programs

Given a probabilistic logic program that defines a distribution over a set of possible worlds, there are several probabilistic inference tasks that can be of interest. They are all reviewed by De Raedt and Kimmig [START_REF] De | Probabilistic (logic) programming concepts[END_REF]. In this work, we focus on inferring the probability that a formula expressed in a subset of first-order logic is true across all the possible worlds defined by a program. In other words, given a query formula , we want to infer the marginal probability P[ ] that is true across all possible executions of the probabilistic logic program.

Another task of interest is the one of inferring the conditional probability P[ | ] that the formula is true in possible worlds where some evidence formula is true as well. In this case, we assume to be true, therefore only considering possible worlds where is true, and infer the probability that is true in this subset of the program's possible worlds. This probability is obtained using the conditional law of probability theory, which states that

P[ | ] = P[ ∧ ] P[ ] (3.18)
It is typical of probabilistic inference systems in general to reduce inference of conditional probability distributions into inference of the marginal distributions of the corresponding conjunctions [Rae+16, sec. 5.1].

The Weighted Model Counting Problem

Solving queries on probabilistic logic programs can be reduced to solving a weighted model counting (WMC) problem. It is interesting to express the resolution of queries on probabilistic logic programs as a WMC problem because it is a well-studied problem, with already-existing efficient algorithmic solutions. In the next section, we will discuss how to reduce query resolution to WMC through knowledge compilation (KC). For now, we introduce the WMC problem and its link with complexity theory.

As weighted model counting is a generalisation of the model counting problem, also known as the #SAT problem, which is itself related to the SAT problem, we briefly introduce these problems before introducing the more general problem of weighted model counting.

SAT: Is There a Satisfying Assignment?

Given a Boolean formula over a set of variables = { 1 , . . . , }, a model for is a truth assignment function that assigns or ⊥ (true or false) to each variable in such that is satisfied, that is ( ) = . A formula can have several satisfying assignments, and thus multiple models. The problem of determining whether a Boolean formula has any satisfying assignment, also called the Boolean satisfiability problem or simply SAT, is famous in computational complexity theory for being the first computational problem that was proven to be NP-complete. In other words, the SAT problem can be used to simulate many other hard and interesting computational problems that fall within the NP complexity class. Solving SAT would therefore mean freeing many birds with one key. Although it has not been proven, it is widely believed that there is no algorithm that can solve the SAT problem efficiently in general.

Model Counting: How Many Satisfying Assignments?

The model counting problem concerns itself with counting how many models of exist.

In other words, it corresponds to computing the quantity

# = |{ | ( ) = }|,

Generalisation to Weighted Variables

Weighted model counting (WMC) generalises the model counting problem by attaching non-negative weights to variables and models. Let :

→ R be a function that associates a weight to each variable occurring in . The weight of a given model is denoted ( ) and is defined as the product of the weights of variables ∈ such that ( ) = .

More formally, ( )

= ∈ ( )= (3.19)
where is the weight associated with variable . The weighted model count of a given formula is denoted WMC( ), and is defined as the sum of the weights of its models (satisfying truth assignments)

WMC( ) = , ( )= ( ) (3.20)
The WMC problem corresponds to computing the quantity WMC( ), either exactly or approximatively.

Probability of Boolean Formulas

Notice that we did not impose any particular restriction on the weights of variables except them being real numbers. The model counting problem is equivalent to the WMC problem in the special case where we set ( ) = 1 for all variable ∈ . Moreover, WMC is equivalent to computing the probability of a Boolean formula if the weights are probabilities. That is, the problem of computing the probability P( ) defined as the sum of the probabilities of all models of . Both problems are equivalent because it suffices to normalise the weights of all variables in to fall back into the case in which probabilities are attached to variables, and vice versa.

Interestingly, it has been proven that the problem of computing the probability of a Boolean formula can be reduced to solving the model counting problem for another formula [START_REF] Chakraborty | From weighted to unweighted model counting[END_REF]. The two problems are however not equivalent, as there are Boolean formulas for which the model counting problem has a polynomial time complexity with respect to the number of variables while the probability computation problem is #P-hard.

Lineage: from First-Order to Boolean Formulas

Notice that we only discussed Boolean formulas for now. In the context of probabilistic logic programming, we are interested in formulas expressed in the first-order logic language. However, we need to obtain a Boolean formula from a initial first-order formula, because the WMC problem is framed in the context of Boolean formulas. This is done by introducing the concept of lineage. The lineage of a first-order formula is a Boolean formula that is obtained from and its domain (all possible groundings of variable terms occurring in ) by syntactically replacing existential quantification ∃ by disjunctions , and universal quantification ∀ by conjunctions . The lineage of a first-order formula is an expression of size (| | ), where | | is the size of the domain and the number of logical variables that occur in . In other words, the size of 's lineage expression is polynomial in the size of the domain [VS17, p. 244]. Solving the WMC problem for a first-order logic formula then corresponds to solving the WMC problem for its lineage Boolean expression. This approach is called first-order weighted model counting [START_REF] Van Den Broeck | Lifted probabilistic inference by first-order knowledge compilation[END_REF].

Knowledge Compilation to Tackle Intractability

In a naive approach to solve the WMC problem for a Boolean formula , one has to explore all possible truth assignments of variables that occur in , then, for each , verify that this assignment satisfies (i.e. that it is a model), and compute the product of the probabilities of variables that are true in . The number of possible assignments is 2 | | , which grows exponentially with the number of variables in .

For any real application, this approach is intractable. By intractable, we mean that although this naive solution can theoretically be described just as we did, in any realistic practical setting it would take too much resources to be useful.

Knowledge compilation (KC) is the name given to a set of intensional query evaluation strategies that aim to address the intractability of the WMC problem. These approaches all have in common that they reduce probabilistic query evaluation to solving a weighted model counting counting problem on a propositional Boolean formula, and that they compile this formula into a target representation -sometimes also called a circuit or a tractable representation -which is a data structure that can represent the formula in a compact way, by exploiting its internal structure. Third, they solve the WMC problem on this compact representation, where it can be solved in polynomial time with respect to the size of the resulting target representation. However, this approach only works for certain hard problems, as WMC remains #P-hard in general. For some queries, the compilation target can be exponential in the number of ground literals in the program.

One of the main advantages of this approach is that the target representation only needs to be compiled once and can be reused for other queries. The compilation step is sometimes called the offline step, while the probabilistic inference on the target representation is called the online query resolution step.

A multitude of target representations have been proposed, as the field of knowledge compilation grew. We do not go into a deep review of all target representations, as this is not pertinent to the understanding of our contributions, but rather focus on the most widely used. A deterministic decomposable negation normal form (d-DNNF) is a data structure defined as a rooted directed acyclic graph whose leaves are Boolean variables, and whose (internal) nodes are labelled with logic operators ¬ (negation), ∨ (disjunction) or ∧ (conjunction). The three following restrictions are imposed on the structure of d-DNNFs: all negations are pushed down to the leaves of the graph, and this is why it is called negation normal form, the subtrees of a conjunction node have disjoint sets of Boolean variables, which is what decomposable stands for, and finally the children of a disjunction node are mutually exclusive: the Boolean formulas they represent cannot simultaneously be true in the same possible world.

State-of-the-art probabilistic logic programming systems like ProbLog2 [START_REF] Dries | ProbLog2: Probabilistic Logic Programming[END_REF] internally use sentential decision diagrams (SDDs) as a target representation, which are a restricted version of d-DNNFs [START_REF] Darwiche | SDD: A new canonical representation of propositional knowledge bases[END_REF]. SDDs are a generalisation of ordered binary decision diagrams (OBDDs) that can have an exponential reduction in the size of the data structure for some queries.

Algorithms for compiling formulas to the d-DNNF or SDD target representations expect the input formula to be in conjunctive normal form (CNF) [START_REF] Darwiche | A compiler for deterministic, decomposable negation normal form[END_REF][START_REF] Darwiche | SDD: A new canonical representation of propositional knowledge bases[END_REF]. A Boolean formula is said to be in CNF if it is a conjunction of disjunctions of logic literals, also called conjuncts. In other words, if it takes the form

= =1 =1 (3.21)
where are (possibly negated) Boolean variables, is the number of conjuncted disjunctions, and is the number of variables in in the th disjunction. Although any Boolean formula can be rewritten to be in CNF by means of logical equivalence rewriting rules, this can have an exponential cost in the number of variables in the formula. More recent approaches avoid the intermediate representation of the formula in CNF and can compile programs incrementally into SDDs [START_REF] Vlasselaer | Anytime inference in probabilistic logic programs with Tp-compilation[END_REF]. This type of approaches is used by ProbLog2 [START_REF] Dries | ProbLog2: Probabilistic Logic Programming[END_REF], which -to the best of our knowledge -is the richest open-source implementation of probabilistic logic programming concepts. Lower-level implementations to compile and manipulate SDDs exist as well, such as the open-source PySDD library [START_REF] Darwiche | Recent trends in knowledge compilation (Dagstuhl Seminar 17381)[END_REF].

For a review of WMC, we refer the reader to the reviews of by Darwiche et al. [START_REF] Darwiche | Recent trends in knowledge compilation (Dagstuhl Seminar 17381)[END_REF] and by Van den Broeck and Suciu [START_REF] Van Den Broeck | Query Processing on Probabilistic Data: A Survey[END_REF]. For a thorough review of the #P complexity class, we refer to chapter 17 "Complexity of counting" by Arora and Barak [START_REF] Arora | Computational Complexity. A Modern Approach[END_REF].

Probabilistic Databases

We now turn our attention to another formalism called probabilistic databases, which extend traditional relational databases with probabilistic semantics. The field of probabilistic databases was developed concurrently to the one of probabilistic logic programming.

Lifted inference algorithms, which do not require a grounding and compilation step like knowledge compilation, will turn out to be crucial for solving meta-analytic queries at the whole-brain neuroimaging scale.

Distribution over Possible Instances

As discussed in the previous chapter, a (deterministic) relational database is defined by a set of relations (sometimes called tables) that contain a set of tuples. Logic queries can be formulated on these relations, and a solver is used to produce a relational algebra expression that calculates the result of the query. This principle is at the root of database engines such as SQL.

Probabilistic databases extend this definition by attaching probability labels to the tuples within the database. Let be a tuple within some relation in the database's schema. In a deterministic relational database, the semantics would be that ( ) is absolutely true, and thus that the objects within tuple are indeed related with each other, according to relation . In a probabilistic relational database, however, a probability label is attached to tuple , and the semantics is that ( ) is true with probability .

These semantics correspond to the semantics of probabilistic facts within a probabilistic logic program, where we denote ( ) : ← to mean that the marginal probability of ( ) being true is across all possible worlds defined by the program.

In fact, probabilistic databases define a probability distribution over all possible instances of the database. That is, over all possible truth assignments of its tuples, based on the probabilities attached to them. Formally, if D is a probabilistic database, then ( , P) is a probability space such that the space of outcomes = { 1 , . . . , } is the set of possible database instances, and such that P : → [0, 1] is a probability function, i.e.

P[ ] = 1 [VS17, sec. 2.1].

Tuple-Independence Assumption

Probabilistic databases most commonly assume that tuples are associated with independent random variables. In other words, for any given relations and and tuples and , the probability that ( ) and ( ) are simultaneously true in any possible instance of the database, i.e. P[ ( ) ∧ ( )], is the product of their respective probabilities: P[ ( )]P[ ( )]. These databases are called tuple-independant databases (TIDs).

Any possible world which contains a tuple that is not in the database is assumed to have probability 0, which corresponds to the closed-world assumption.

Formally, a TID D = (T, ) is defined by a set of tuples T and a probability function : T → [0, 1] that associates a probability to each tuple in T. Each instance of the database ⊆ T is a subset of tuples in T that are true in the associated possible world . The database D induces a probability distribution over possible instances ⊆ T defined by

P D ( ) = ∈ ( ) ∈T\ (1 -( )) (3.22)
This independence assumption makes it easier to uniquely define the probability distribution over possible instances of D.

Attribute-Level Uncertainty with Mutually Exclusive Tuples

Attribute-level uncertainty arises when we are certain that certain attributes are related to each other, but we are uncertain about the value of some others. For example, we might be certain that Aiden is a student but unsure about which university she studies at. More precisely, we know that UniStudent(Aiden, ) is true for some university and we have a probability distribution over possible constant substitutions for {MIT, UCL}. However, we might want to express that, in any given possible world, Aiden can only be studying at one university. This means that the two facts UniStudent(Aiden, MIT) and UniStudent(Aiden, UCL) cannot simultaneously be contained by any possible instance of the database. Representing this type of uncertainty is required by many real-world application, including our application to meta-analysis of neuroimaging literature, as we discuss in the next part of this thesis.

In the realm of probabilistic databases, mutual exclusivity between tuples can be represented through block-independent disjoint (BID) tables, introduced by Re and Suciu [START_REF] Re | Materialized views in probabilistic databases: For information exchange and query optimization[END_REF]. In a BID table, some attributes are called key attributes while the others are called non-key attributes. The key attributes define blocks within the table, and within each block there is a probability distribution over the possible values of the remaining non-key attributes. In any given possible instance of the database, only one tuple within each block can be true. For example, given the following BID which define two probabilistic choices over their respective head literals, which are mutually exclusive.

Queries on Probabilistic Databases

A query on a deterministic database results in a set of tuples for which the query is true. The semantics of a Boolean query on a probabilistic database D is defined as the marginal probability that is true across all possible instances of D. The semantics of a set-valued query ( ), where is a set of head variables, is defined as computing the probability of a set of Boolean queries ( ) defined by all possible substitutions of variables by constants. This result in a vector of non-zero probabilities, for each of these Boolean queries.

First-order logic being undecidable in general, as discussed in the previous chapter, queries on probabilistic databases are most often restricted to certain classes of queries expressed in subsets of first-order logic. These query languages are convenient to study the complexity of certain ranges of queries, as we will see next. For now, we define some of the most common query languages. We will later on impose further restrictions on these languages to study their complexity. query ans( ) ← ( ) on some program, the Horn clauses on which relation depends represent a UCQ. This means that, for certain programs and queries, the problem can be framed as solving queries on probabilistic databases.

The Grounding Bottleneck Since query evaluation on probabilistic logic programs can be framed as a weighted model counting problem, and since probabilistic databases can be represented by such programs, query evaluation on probabilistic databases can be framed as a WMC problem, and knowledge compilation (KC) techniques can thus be used as well. This approach is sometimes called intensional query evaluation, and probabilistic database engines do use KC for evaluating queries. However, as discussed earlier, KC approaches require to translate the problem into a propositional formula expressed in conjunctive normal form (CNF). In practice, the grounding step is often the bottleneck of a query evaluation system, even before the algorithm reaches the WMC step [START_REF] Tsamoura | Beyond the Grounding Bottleneck: Datalog Techniques for Inference in Probabilistic Logic Programs[END_REF]. Therefore, sometimes it does not matter that a compact target representation of the problem can be computed such that the query can be solved efficiently in PTIME w.r.t. the size of the representation, because reaching that step is already too costly to be practical.

Query Plans Queries on traditional relational databases are often solved by deriving a relational algebra expression that solves the query using algebraic operations on the database's relations (or tables). This algebraic expression is called a query plan. The advantage of deriving such symbolic expressions is that equivalence properties of the algebra can be used to move operations within the expression in order to optimise query resolution. This is all done at the symbolic level, before doing any computation that would require to access the data. Plans are then processed by an optimised relational algebra engine that can execute algebraic operations on tables efficiently. This approach is at the core of most modern relational database systems.

Extensional Query Plans In a tuple-independant database, relations are extended to have a special column containing the probability attached to each tuple (row) within the relation (table ). This special column has special semantics, and relational algebra operators have to be extended to define how the probability column is affected by the operations. This has led to the definition of new operators for probabilistic databases called extensional operators. We now define the semantics of these operators.

Extensional Operators

Each relational algebra operator is extended as follows.

Join When a join operator is applied between two relations, denoted ⊲⊳ , the joined tuples are assumed to be independent, and therefore the probability of a tuple in the resulting relation is defined as the product of the probabilities of the respective joined tuples in and .

Selection When a selection operator is applied to some relation , denoted ( )

where is some selection criteria formula, the probabilities of the selected tuples are kept unchanged. In other words, the operator has the same effect as it would have on non-probabilistic relations.

Projections While relational algebra defines a single projection operator, which selects a subset of a relation's attributes, two extensional operators need to be introduced in the case of probabilistic relations. They have different semantics corresponding to two different assumptions on the dependency between the relation's tuples. When an independent projection on a subset of some relation 's attributes is applied, denoted 1 ,..., ( ) where 1 , . . . , are attributes of , the tuples in that have the same value for attributes 1 , . . . , are assumed to be independent. Therefore, the resulting probability is computed as the noisy or of the probabilities of all tuples sharing the same value for the projected attributes. That is, the probability is 1

-(1 -1 . )(1 -2 . ) • • • where 1 , 2 , • • • ∈
are tuples with the same value for 1 , . . . , , and where . denotes the probability attached to tuple in . When a disjoint projection is applied to , denoted 1 ,..., , the tuples with common attribute values are assumed to be mutually exclusive. Therefore, any two of these tuples cannot be simultaneously true in any possibly instance of the database. Another way to think about it is that each tuple is associated with a disjoint set of possible instances of the database. Thus, their probabilities can be summed: the resulting probability is defined as 1 . + 2 . + • • • where 1 , 2 , . . . are tuples with the same value for attributes 1 , . . . , in .

Union The union of two relation and , denoted ∪ , assumes independence between tuples in and . In the resulting relation, any tuple that occur in both and will have probability 1 -(1 -. )(1 -. ) where refers to the tuple in and to the same tuple in . If the tuple only occurs in one of the two sets, its probability label in that set is simply propagated to the resulting set. Similarly to the union operator in relational algebra, this extensional union operator can only be applied to relations with the same arity (and with the same column names, if the columns are named). Semantically, this corresponds to a disjunctive query ( ) ∨ ( ) that asks for the probability that is in at least one of the two relations.

Difference Finally, the difference between two relations, denoted -, also assumes independence between their respective tuples. If a tuple is both in and , then its probability in the resulting set is . (1 -. ). And, if occurs only in its probability label is simply propagated to the resulting set. Semantically, this corresponds to a conjunctive query ( ) ∧ ¬ ( ) that asks for the probability of ( ) being true while simultaneously ( ) being false.

Extensional Probabilistic Query Evaluation

Extensional query evaluation starts from a query and derives a symbolic algebraic expression that makes use of extensional operations to compute a probability for each query answer. More precisely, given a logical query formula ( ) over head variables , it computes the probability P[ ( )] for each possible substitutions of the head variables by constants for which this probability is strictly greater than zero, i.e. those substitutions for which the probability is zero are not included, which goes along the lines of what is called positive relational calculus, in which only the relationships that we know are true are represented. Safe v.s. Unsafe Plan A plan for a set-valued query is said to be safe if it computes the correct probabilities for each resulting tuple, and for any input probabilistic database. Contrary to deterministic relational databases, multiple plans for the same query do not necessarily result in the same solution: the probabilities might different and be incorrect for certain plans. For a given query on a probabilistic database, there does not necessarily exist a safe plan, but instead there can be one or more unsafe plans.

In the following sections, we focus our attention to the computation of safe plans only.

In particular, we want to know for which classes of queries a safe plan can be obtained, and how it can be obtained. It should however be noted that, for certain queries, unsafe plans can be used to obtain an approximate solution to the probabilistic query evaluation problem, as they provide upper bound for the right probabilities [START_REF] Gatterbauer | Approximate lifted inference with probabilistic databases[END_REF].

Lifted Probabilistic Inference

To reason about the properties of extensional query evaluation algorithms, a rule-based formalism has been developed for Boolean queries, called lifted query processing. Although it is formally defined for Boolean queries, it is equivalent to the extensional query plans defined before [VS17, p. 265], and can be used to derive them for set-valued queries as well, by applying the rules while assuming head variables to be constants instead of quantified variables. In a Boolean query, every variable must be existentially or universally quantified, by definition.

By exploiting properties from probability theory such as the independence of probabilistic events, or the inclusion-exclusion principle (a counting technique used to obtain the number of elements in the union of two finite sets), lifted inference rules can be more powerful than grounded inference approaches. In particular, for applicable queries, they can find efficient query plans without having to represent the problem as a large ground propositional formula, which can be costly when the number of tuples is large.

Syntactic Independence

Lifted inference rules work at the syntactic level to find independences within a query's subformulas. However, the problem of finding whether two logic formulas are independent is hard in general, as per Trakhtenbrot's undecidability theorem. Instead, lifted inference uses a stricter condition of syntactic independence that is sufficient for independence to hold in general. This syntactic independence check requires the query to be rewritten in a special form: it needs to be shattered and ranked.

A query is said to be shattered if it does not contain any constant. And a query is said to be ranked if there exist a total order on its variables: for all the atoms in the query, if two variables and occur in the atom such that precedes in the order of the atom's terms, then must also precede in the total order of the variables in the query [START_REF] Dalvi | The dichotomy of probabilistic inference for unions of conjunctive queries[END_REF].

Unate First-Order Fragment Any query in FO ¬un,∃,∨,∧ can be rewritten into a query that is shattered and ranked, and such that the query evaluation problem P[ ] can be reduced to the evaluation of P[ ] [VS17, p. 274]. FO ¬un,∃,∨,∧ extends the UCQ language -previously defined as the FO ∃,∨,∧ fragment of first-order logic -with the negation (¬) operator, but requiring atoms to appear either only positively (non-negated) or negatively (negated) in the query. This fragment is used because its sentences admit a unique canonical form in which independence becomes decidable, while it is undecidable for first-order sentences in general [VS17, p. 279]. For this reason, it is on this fragment that the lifted inference rules apply, and that the dichotomy theorem -which we will discuss -is proven.

Separator Variable We use the notion of separator variable for checking syntactic independence between queries on BID tables. Given a query , a root variable is a variable that occurs in every atom (• • • ) in in a key position of relation . A separator variable is a root variable that occurs in the same key position of all atoms in that are unifiable. This definition will be used within the rules.

Lifted Inference Rules

We first describe the lifted inference rules that apply to Boolean queries on a database of BID tables. The rules are recursively applied on each subquery. Independent Join If = 1 ∧ 2 such that 1 and 2 are syntactically independent,

Ground atom

then P[ ] = P[ 1 ]P[ 2 ].
Independent Union If = 1 ∨ 2 such that 1 and 2 are syntactically independent,

then P[ ] = 1 -(1 -P[ 1 ])(1 -P[ 2 ]). Independent Existential Quantification If = ∃ such that variable is a separator variable in , then P[ ] = 1 - ∈ (1 -P[{ / } ])
, where { / } substitutes by constant in the query , where belongs to the database's domain (set of all possible constants).

Disjoint Existential Quantification for CQs If = ∃ such that is a conjunctive query in which there is an atom (• • • ) where (1) all attributes in key positions contain constants (there is no variable in a key position), and (2) is a variable that occurs in a non-key attribute of the BID table , then P[ ] =

∈ P[{ / } ]. Disjoint Existential Quantification for UCQs If is a UCQ of the form 1 ∨ , where 1 is a CQ having an atom with constants in all its key attributes, and is any other UCQ, then

P[ ] = P[ 1 ] + P[ ] -P[ 1 ∧ ].
Inclusion/Exclusion 1 Using the inclusion-exclusion principle, if = 1 ∨ 2 then

P[ ] = P[ 1 ] + P[ 2 ] + P[ 1 ∧ 2 ]. Inclusion/Exclusion 2 Similarly, if = 1 ∧ 2 then P[ ] = P[ 1 ]+P[ 2 ]+P[ 1 ∨
of each subquery are then combined through extensional relational algebra operators.

Dichotomy Results

The Dichotomy Theorem An important result within the field of probabilistic databases is the dichotomy theorem, proven by Dalvi and Suciu [START_REF] Dalvi | The dichotomy of probabilistic inference for unions of conjunctive queries[END_REF]. It states that, for any query expressed in FO ¬un,∃,∨,∧ that is shattered and ranked, if the previously-described lifted query processing rules succeed then P[ ] can be computed in polynomial time with respect to the size of the input database, but if the rules fail then computing P[ ] is proven to be #P-hard in the size of the input database. If the rules apply, the query is said to be liftable. When they don't, the query is said to be unliftable. The dichotomy theorem proves that the lifted inference rules are complete: any query in FO ¬un,∃,∨,∧ that is computable in PTIME will be liftable. This means that this set of rules is sufficient to encompass all queries that can be solved in PTIME with respect to the size of the input database.

Beyond Unate First-Order Logic More recent work has studied the complexity of query resolution beyond the unate fragment of first-order logic. In particular, Fink and Olteanu [START_REF] Fink | Dichotomies for Queries with Negation in Probabilistic Databases[END_REF] proves a dichotomy result for queries with negation, but imposing the constraint that queries have non-repeating relational symbols. That is, the same relational symbol cannot occur multiple times in the query.

Constraints on the Input Database Dichotomy results have later been proven for other classes of queries. Notably, Amarilli and Ceylan [START_REF] Amarilli | A Dichotomy for Homomorphism-Closed Queries on Probabilistic Graphs[END_REF] formally proved that probabilistic query evaluation is #P-hard for all infinite UCQs: a class of queries that can express recursion, and that encompasses disjunctive datalog (datalog with disjunctive rule consequents) and a broad class of ontology-mediated queries. The result is proven for probabilistic databases where all relations are binary (arity of 2), but is conjectured to propagate to -ary relations in general. In contrast with the dichotomy theorem, this result imposes less restrictions on the queries as it works for any sentence in monadic second-order logic, but it requires the input probabilistic databases to have a bounded tree-width.

Statistical Relational Artificial Intelligence

Probabilistic logic programming and probabilistic databases are not the only approaches to represent and reason with uncertain relational knowledge. They pertain to a broader field of research that has been coined statistical relational artificial intelligence, or StarAI for short, and defined as the study and design of intelligent agents that act in worlds composed of individuals (objects, things), where there can be complex [START_REF] De | Statistical Relational Artificial Intelligence: Logic, Probability, and Computation[END_REF]. StarAI postulates that predicate logic and probability theory can be used in synergy to make artificial intelligence more robust and general using relational models that go beyond modeling a fixed number of variables, by representing or learning relationships of dependence and causality between broader classes of objects. Among statistical relational models, we focus our attention on probabilistic graphical models, which are pertinent to our discussion, and invite a curious reader to learn more about this topic through the books of Koller et al. [START_REF] Koller | Introduction to Statistical Relational Learning[END_REF] and Raedt et al. [START_REF] De | Statistical Relational Artificial Intelligence: Logic, Probability, and Computation[END_REF].

relations among the individuals, where the agents can be uncertain about what properties individuals have, what relations are true, what individuals exist, whether different terms denote the same individual, and the dynamics of the world

Probabilistic Graphical Models

Probabilistic graphical models can represent complex probability distributions with hierarchical dependencies between a large number of random variables. They constitute a visually intuitive representation of the relations of dependence between these variables [Pea88; KF09]. They are most often represented in the form of graphs.

Graphs can be directed, with edges ( → ) meaning that variable depends on variable , or they can be undirected with edges ( ↔ ) meaning that variables and both depend on each other. Bayesian networks are a particular type of probabilistic graphical models that are represented as a directed acyclic graph whose nodes are associated with a set of random variables . Markov random fields are another type of probabilistic graphical models, represented as undirected and possibly cyclic graphs whose nodes are also associated with a set of random variables . Each of these two representations can express dependencies that the other cannot.

We briefly review Bayesian networks, which are pertinent to our work, and refer the reader to the review by Koller and Friedman [START_REF] Koller | Probabilistic Graphical Models: Principles and Techniques -Adaptive Computation and Machine Learning[END_REF] for more details on other types of probabilistic graphical models.

Conditional Independence Assumption in Bayesian Networks

More than dependencies between random variables, a Bayesian network encodes their conditional independencies. Let par( ) denote the set of random variables that are parents of in the network's graph. That is, for each variable ∈ par( ), there is an ege → in the graph. A Bayesian network model assumes that each of its variables is conditionally independent from all the other variables in the network given its parent variables. Let nonpar( ) = \ par( ) denote the set of variables that are not parents of in the Bayesian network. Then we formally write ⊥ nonpar( ) | par( ) to say that is conditionally independent of random variables nonpar( ) given the value of random variables par( ). This conditional independence implies that the following equality is true

P[ | \ { }] = P[ | parents( )]
(3.30)

where \ { } denotes the set of all variables in the network except from . This property makes it possible to factorise the joint probability distribution of variables into a product of conditional probability distributions. This idea of leveraging local independencies between variables to speed up calculations by reducing the number of operations is a common theme in many probabilistic inference approaches, and in fact what target representations in KC do as well. Formally, we can write

P[ ] = ∈ P[ |parents( )] (3.31)
and this formulation greatly reduces the number of operations needed to calculate the joint probability distribution of variables .

Inference in Probabilistic Graphical Models

Efficient exact inference algorithms exist to solve probabilistic inference tasks in graphical models: variable elimination [START_REF] Zhang | Exploiting Causal Independence in Bayesian Network Inference[END_REF], the junction tree algorithm [Pea88], and others. For a review of probabilistic graphical models and inference algorithms, the considerable work of Koller and Friedman [START_REF] Koller | Probabilistic Graphical Models: Principles and Techniques -Adaptive Computation and Machine Learning[END_REF] is most probably the best reference available.

It turns out that probabilistic inference in Bayesian networks can be framed as solving a WMC problem as well, because Bayesian networks can be seen as representing a probabilistic propositional knowledge base [START_REF] Chavira | On probabilistic inference by weighted model counting[END_REF]. Knowledge compilation can thus also be used as an exact probabilistic inference technique on graphical models, as was shown by Choi, Kisa, and Darwiche [START_REF] Choi | Compiling Probabilistic Graphical Models Using Sentential Decision Diagrams[END_REF] who compiled them to the same SDDs we described earlier.

Moreover, lifted inference techniques have also been applied to probabilistic inference in graphical models, and were first proposed by Poole [START_REF] Poole | First-order probabilistic inference[END_REF]. In their recent review, Poole [START_REF] Poole | An Introduction to Lifted Probabilistic Inference[END_REF] discuss the application of lifted techniques for exact and approximate inference in a broad class of statistical relational models.

From Probabilistic Logic Programs to Bayesian Networks

It is quite clear that common patterns and bridges exist between approaches, models, and algorithms that tackle the problem of statistical relational artificial intelligence. Sometimes, it can be useful to translate the representation of the problem into another representation, either to ease the study of theoretical equivalence properties between these representations, or to leverage probabilistic inference algorithms that were designed for another representation.

For example, CP-logic programs have been translated to Bayesian network representations by Meert, Struyf, and Blockeel [START_REF] Meert | Learning Ground CP-Logic Theories by Leveraging Bayesian Network Learning Techniques[END_REF], in order to learn the parameters of the program through Bayesian learning techniques. In the next chapter we use this translation to prove analytically the equivalence between the probabilities computed by our probabilistic logic programs with the probabilities obtained by common meta-analytic tools.

Note on Statistical Relational Learning

Statistical relational learning concerns itself with learning unknown parameters in statistical relational models. It is one of the pillars of statistical relational artificial intelligence, as learning the parameters of these models, or even learning their structure, is one of the most important challenges of the field, and one that has received the most contributions. However, we have not discussed this in this chapter, simply because the work presented in this thesis focuses on the representation of statistical relational knowledge and exact inference techniques. In the next chapter, we briefly discuss how we framed the problem of probabilistic inference as learning the parameters of a probabilistic logic program, by applying the learning from interpretations algorithm proposed by Gutmann, Thon, and De Raedt [START_REF] Gutmann | Learning the Parameters of Probabilistic Logic Programs from Interpretations[END_REF].

Chapter Key Points 1. Probabilistic logic programming extends logic programs with probabilistic semantics. Instead of having one possible output like logic programs, they define a distribution over possible worlds.

Solving queries on probabilistic logic programs corresponds to solv-

ing a weighted model counting problem, which is #P-hard in general.

Knowledge compilation techniques tackle this intractability by finding compact target representations of programs, on which some queries can be solved in polynomial time w.r.t. the size of the representation.

3. Probabilistic databases are another formalism that developed in parallel to probabilistic logic programming. It extends relational databases by attaching probabilities to tuples (or rows in the tables).

4.

Knowledge compilation can also be used to solve queries on probabilistic databases, as they can be represented by the more general probabilistic logic programs. However, grounding large programs can often be the bottleneck in real-world applications where the size of the data is large.

Lifted inference is an extensional technique to evaluate queries on prob-

abilistic databases by exploiting symmetries in logical sentences and laws in probability theory. They derive symbolic extensional query plans: algebraic expressions that make use of relational algebra operators extended for probabilistic relations.

6. These formalisms are tightly linked together within the broader topic of statistical relational artificial intelligence, and more particularly to probabilistic graphical models.

Part II

Contributions Chapter 4

Question Answering System for Functional Brain Mapping Meta-Analysis Abstract. NeuroLang adopts a language-oriented programming approach to expand the scope of functional brain mapping meta-analysis. In this chapter, we describe the syntax and semantics of the NeuroLang language, developed in collaboration with the NeuroLang team. We represent coordinate-based meta-analysis databases and queries through the prism of the probabilistic logic programming formalism. To ensure the correctness of this modeling, we translate programs to their equivalent Bayesian network representation, whose joint probability distribution is shown to lead to the same probabilistic estimation as Neurosynth for term-based meta-analytic queries, resulting in termassociation brain maps. We use NeuroLang to solve some of the most common metaanalytic queries, where activation patterns are obtained by selecting studies within the Neurosynth database, either based on term-to-study associations or seed voxel activation criteria. Finally, we propose a relaxed probabilistic modeling of term-to-study association based on TFIDF features. We test our approach on two-term conjunctive queries, both in a simulated classification setting where a ground truth is available, and in a real-world setting by comparing the consistency of the obtained brain maps with that of Neurosynth.

My contributions fit into a larger project, called NeuroLang, that aims to provide a DSL for cognitive neuroscience. NeuroLang is the collaborative effort of a team within the Parietal team of Inria, Saclay, led by Dr. Demian Wassermann. Gaston Zanitti, Jonas Renault, Antonia Machlouzarides-Shalit, Louis Odera-Rouillard, Nikita Zdainovich, and Matias Schimt all contribute or have previously contributed to the development of the language presented here.

Should we Create a New Language?

I start this chapter on NeuroLang with a brief answer to the question 'Should we create NeuroLang in the first place?'. I believe this is an important question, which -I speculate -any person who participated in the creation of a programming language repeatedly asked themselves in the process.

Designing a new language is an endeavor that requires both software engineering and theoretical skills, and an important time and effort investment. The benefits of taking a language-oriented approach should outweigh the cost of building the language itself, as pointed out by Mernik, Heering, and Sloane [START_REF] Mernik | When and how to develop domain-specific languages[END_REF] and Fowler [START_REF] Fowler | Domain-specific languages[END_REF]. NeuroLang's approach is not to 'reinvent the wheel', but instead rely on existing languages, thereby standing on the shoulders of giants. This is in line with the fifth and sixth guidelines "Compose existing languages where possible", and "Reuse existing language definitions", defined by Karsai et al. [START_REF] Karsai | Design Guidelines for Domain Specific Languages[END_REF] 1 . Therefore, in this work we do not create a new language from scratch, but rather adapt existing languages to the specific domain application of neuroimaging meta-analysis. This means that a lot of the problems that come with designing a language are offloaded onto existing languages, formalisms and query evaluation algorithms. This includes the definition of the language's grammar and semantics, which we base on datalog and its probabilistic extensions. It also includes the algorithms used for probabilistic query evaluation, which we base on existing knowledge compilation and lifted inference approaches, that we described in the previous chapter.

Bernard of Chartres used to compare us to dwarfs perched on the shoulders of giants. He pointed out that we see more and farther than our predecessors, not because we have keener vision or greater height, but because we are lifted up and borne aloft on their gigantic stature.

John of Salisbury, 1159

The bet of NeuroLang is that a language-oriented approach could help bridging the gap between cognitive neuroscience and the process of testing complex data-driven brain mapping hypotheses. By providing a seamless process for integrating heterogeneous sources of data within the same model, and providing a system for answering questions against this data, a wider ranger of hypotheses become readily available, without requiring specific software engineering skills from the end-user (the cognitive neuroscientist). Increased productivity and decreased user error-rate when DSLs are used for formulating queries have been observed in other domains than neuroscience [START_REF] Barišić | Quality in use of domain-specific languages. a case study[END_REF], which supports our approach.

In the design of NeuroLang, we provide a high-level programming interface for using meta-analysis databases in cognitive neuroscience research. We believe that this approach has three main advantages.

Accessibility Implementing a program to test a complex hypothesis against metaanalytic data can be time-consuming and error-prone, especially for those not proficient in general-purpose programming languages. A domain-specific syntax that is understandable and easier to grasp eases the process of formulating and testing hypotheses combining heterogeneous sources of data, such as meta-analytic databases and anatomical or functional atlases. This has the potential of speeding up the meta-analysis process.

Readability Being specific about the research question a meta-analysis is meant to investigate, and precisely how it is going to do so, is an important practice [START_REF] Müller | Ten simple rules for neuroimaging meta-analysis[END_REF]. NeuroLang's logical syntax makes model assumptions and inclusion or exclusion criteria understandable directly from the code of the program.

Sound semantics Any statistical tool can be used to produce an unsound model. However, grounding NeuroLang in the well-studied formalisms of datalog and probabilistic logic programming provides theoretical guarantees that both limit modeling errors and provide trust in the language. NeuroLang's engine can analyse programs and detect some of the most common errors.

Finally, these advantages taken together could make NeuroLang a tool of choice for sharing, reproducing, and replicating cognitive neuroscience meta-analyses. One Neu-roLang program developed for a study in 2021 could be re-used by another team of researchers in 2026, either as an inspiration for an entirely different study, or to confront the original study's results to the neuroimaging literature published from 2021 to 2026.

NeuroLang's Syntax

Although NeuroLang is built upon existing languages, we made several syntactic extensions to them, in order to provide the expressivity needed to represent real-world metaanalytic hypotheses.

For example, as we developed NeuroLang, we quickly realised that we needed to extend the language with built-in function symbols, to implement primitives required by concrete use-cases. This includes functions to relate brain regions in 3D space (which are not used in the main contributions of this thesis), functions to implement statistical tests, and functions to produce brain images that can then be plotted.

There is a growing Python ecosystem of libraries for cognitive neuroscience [START_REF] Gilmore | Progress toward openness, transparency, and reproducibility in cognitive neuroscience[END_REF], and of numerical analysis packages such as NumPy or Pandas [Oli07]. Although Neu-roLang is a separate language to Python, it proposes a fully-featured Python API to compose with existing neuroinformatics packages. Within NeuroLang itself, we use nibabel [START_REF] Brett | nipy/nibabel: 2.3. 0[END_REF] to represent brain images, we load the Neurosynth and NeuroQuery CBMA databases using their respective Python libraries [Yar+11; Doc+20], and we use nilearn [START_REF] Abraham | Machine learning for neuroimaging with scikitlearn[END_REF] to fetch anatomical atlases or produce brain region matplotlib plots [START_REF] Hunter | Matplotlib: A 2D graphics environment[END_REF]. NeuroLang aims to complement existing tools, and already interfaces with them. To do so, we propose a Python API to represent NeuroLang programs, and we allow userdefined functions to run arbitrary Python code.

Function Symbols and Aggregations

Prolog permits function symbols in the rule of the programs but datalog does not. Neu-roLang is not purely based on datalog, in the sense that some function symbols are permitted in the language, including aggregations functions. These extensions to the syntax of datalog are expected in any real-world application of the language, as was shown to be the case e.g. in the bioinformatics data analysis setting [START_REF] Seo | Datalog Extensions for Bioinformatic Data Analysis[END_REF].

Function Symbols

Deterministic rules in NeuroLang support built-in and user-defined function symbols within the body of the rules, as well as aggregation function symbols within the head of the rules. This is an extension of datalog, which does not support function symbols. In fact, extending datalog with function symbols breaks the guarantee that datalog programs are decidable. For example, the program

(0) ← ( ( )) ← ( ) (4.1)
where ( ) = + 1 leads to an infinite least model, due to the recursive definition of relation . Restrictions are thus imposed on the usage of function symbols, and in particular recursivity in this type of rules is forbidden.

Function symbols can be defined by the user through NeuroLang's Python API, which allows arbitrary Python code to be integrated within programs, leveraging the rich Python ecosystem. For example, the following boolean function takes two parameters and and returns whether the first parameter is greater than the length of the second parameter: @nl.add_symbol def my_function(x, y): return x > len(y)

where nl refers to a NeuroLang frontend object, used to represent a program and providing functionalities to add relational knowledge or code to the program. Equivalently, the function can be added as a Python lambda function as follows nl.add_symbol(lambda x, y: x > len(y), name='my_function')

This only works if is numerical and if is an object that implements a __len__ method, such as an iterable object (list, tuple, string, etc.). Because Python has a dynamic type system, if an argument of the wrong type is passed to the function, an exception will be raised within the user-defined Python function. NeuroLang also has a dynamic type system but the type of the objects can be specified using type annotations. Going back to our example, we can specify that the first parameter should be an integer, that the second one should be a string, and that the function should return a boolean: @nl.add_symbol def my_function(x: int, y: str) -> bool: return x > len(y)

Therefore, if the function symbol is applied to a parameter of the wrong type, NeuroLang can raise an exception to notify the user, through static analysis of the program types, before any actual call to the user-defined function. Be relying on Python's type annotations and type system, we follow the seventh guideline proposed by Karsai et al. [START_REF] Karsai | Design Guidelines for Domain Specific Languages[END_REF]: "Reuse existing type systems". Through its Python API, NeuroLang permits arbitrary user-defined Python functions to be integrated within its programs. In particular, users could define the following function

@nl.add_symbol def f(): return f()
which is infinitely recursive, and will prevent the resolution of any query that depends on it, because the resolution would not terminate.

Although it would be nice to provide the guarantee that any NeuroLang program terminates, being able to interface with Python functions is a powerful feature, which we deemed necessary, as it provides access to a large collection of existing scientific libraries that can be combined with NeuroLang, such as nilearn [START_REF] Abraham | Machine learning for neuroimaging with scikitlearn[END_REF] for plotting results of queries.

Note that this functionality is available through NeuroLang's Python API, which is a low level interface compared to NeuroLang's web interface. For higher level interfaces, this functionality is not available but built-in functions are exposed to the user, which are part of NeuroLang's official library, and for which we can provide termination guarantees, as they have been reviewed and tested.

Therefore, at resolution time, NeuroLang's engine assumes that user-defined functions will terminate.

Aggregations

Since NeuroLang supports function symbols, it also supports aggregation function symbols occurring in the head predicate of deterministic rules. Aggregations come with the same problem that they can generate an infinite number of constants in the program, but they are necessary to provide a feature-rich interface to the user. This is particularly useful to aggregate tuples within the same relation. An aggregation rule has the form

( , ( )) ← ( , ) (4.2)
where is a function that maps an arbitrary number of tuples of constants of the domain to a single constant of the domain, and where is a conjunction of literals over variables ∪ . For example, the following user-defined aggregation written in NeuroLang's Python API @nl.add_symbol def my_aggregation(values: Iterable[int]) -> int: return sum(values)

Most arithmetic or statistic aggregations are built in the language, so users do not have to redefine them.

Probability-Encoding Rules

To provide an end-to-end meta-analysis system, we found that it was primordial to be able to post-process the result of probabilistic queries using deterministic rules. In Neu-roLang, probabilistic queries are thus formulated as rules within the program itself, and their resulting probabilities are stored within deterministic relations. This is done using rules with a specific syntax, that we call probability encoding rules (PERs), simply because they encode the probabilities resulting from a query within a new relation. Semantics of PERs were developed in collaboration with a team in Argentina, led by Gaston Zanitti [START_REF] Gaston E Zanitti | Scalable Query Answering under Uncertainty to Neuroscientific Ontological Knowledge: The NeuroLang Approach[END_REF].

There are two types of PERs: SUCC and MARG ones. The first corresponds to what is sometimes referred to the SUCC task, while the second corresponds to what is sometimes referred to the MARG task, as per De Raedt and Kimmig [START_REF] De | Probabilistic (logic) programming concepts[END_REF]. Although PERs are, in essence, syntactic sugar to solve probabilistic queries within programs, the exact semantics of these queries they represent have to be defined.

SUCC probability encoding rule

A SUCC PER takes the form

( , P) ← ∃ , ( , ) (4.3)
where ( , ) is a conjunction of literals. This rule stores the results of the probabilistic calculation P[∃ , ( , )] in 's special attribute "P", for each possible grounding of the free variables such that P[∃ , ( , )] > 0. That is, those results for which the probability is zero are not included in the solution of the query.

MARG probability encoding rule

A MARG PER extends this definition with the possibility of computing conditional probabilities. MARG PERs take the form

( , P) ← ∃ , (∃ , ( , , )) | (∃ , ( , , )) (4.4)
where both ( , , ) and ( , , ) are conjunctions of literals, and where 's special P attribute contains, for each possible grounding of free variables , the result of the following probabilistic calculation

P [∃ , ∃ , ∃ , ( , , ) ∧ ( , , )] P [∃ , ∃ , ( , , )] (4.5)
These special syntax and semantics allow existentially-quantified variables to occur both within the conditioned and the conditioning formulas, resulting in variables to be shared in the numerator's query. This feature will be needed to reproduce the probabilistic queries of existing meta-analytic tools.

Query-Based Probabilistic Relations

Sometimes, the probability attached to a given predicate is not necessarily known in advance, and is instead the result of a calculation. For certain use-cases, we thus found it necessary to provide a more programmable way to define probabilistic relations.

NeuroLang provides the possibility to define probabilistic rules with a deterministic body. More formally, these rules take the form

( ) : ( , ) ← ∃ 1 ( , ) ∧ • • • ∧ ( , ) (4.6)
where ( , ) are positive or negative literals whose relation name is either in the extensional schema or in the deterministic intensional schema, and where is a function symbol (possibly an aggregation function that returns pr. In other words, either refers to a deterministic relation in the input of the program, or it only occurs in the head of rules that do not depend on any probabilistic relation.

Stratification Semantics in NeuroLang

The introduction of PERs and query-based probabilistic rules require stratification semantics in NeuroLang: a NeuroLang program should be stratifiable (or separable) into three parts [START_REF] Gaston E Zanitti | Scalable Query Answering under Uncertainty to Neuroscientific Ontological Knowledge: The NeuroLang Approach[END_REF], also called strata (stratum in singular). The first stratum is deterministic, containing facts, deterministic rules and query-based probabilistic relation definitions. The result of the resolution of the first stratum is a set of deterministic, and possibly probabilistic, relations, that define the input of the second stratum. The second stratum contains probabilistic fact and choice relations, probabilistic rules, and PERs. The resolution of the second stratum is a set of deterministic relations containing the result of probabilistic query evaluation of PERs. The third and last stratum is called the postprobabilistic deterministic stratum, and contains a set of deterministic rules that can postprocess the output of the second stratum, containing probabilistic results. We further develop this process of stratification in section 4.5, which discusses resolution of queries on NeuroLang programs.

Deterministic/Probabilistic Facts and Choices

Factual knowledge can directly be integrated in NeuroLang. Each tuple in a probabilistic fact relations are assumed to be independent from one another, following the semantics of tuple-independant database (TID) defined in chapter 3. Each tuple in a probabilistic choice relation is assumed to be mutually exclusive with each other, following the semantics of block-independent disjoint (BID) defined in chapter 3 as well. We do not fully implement BIDs at the moment, but only the specific case of probabilistic choices, which are BID tables where all attributes are key attributes. In other words, each tuple in the table is mutually exclusive with the others.

Often, relations containing a large number of facts need to be integrated in the program. We provide API primitives that accepts Python sets, Pandas dataframes, or NumPy arrays as input, and that can represent deterministic facts, probabilistic facts or probabilistic choices. For example, the following call loads a probabilistic relation TopicAssociation, assuming the first value of each tuple ( , , ) in the relation to be the probability that TopicAssociation( , ) is true in any possible world defined by the program.

nl.add_probabilistic_facts( { (0.16, "s1", "v5-topics-50_1_anxiety_trait_personality"), (0.02, "s2", "v5-topics-50_1_anxiety_trait_personality"), ..., (0.17, "s88", "v5-topics-100_30_emotional_negative_positive"), }, name="TopicAssociation", )

Probabilistic choices can be added similarly in the form of a block-independent disjoint (BID) table, or it can be assumed that each tuple in the table is equi-probable. For example, the following API call gives each study in a meta-analytic database an equal probability of being selected in a given execution of the program, defined in a BID table called SelectedStudy nl.add_equiprobable_probabilistic_choice( {(s1,), (s2,), ..., (sn)}, name="SelectedStudy", )

Representing Neuroscientific Knowledge

We describe how we represent neuroscientific knowledge as probabilistic tables, to account for the uncertainty surrounding findings reported by neuroimaging studies, that can have a high analytical variability [START_REF] Botvinik-Nezer | Variability in the analysis of a single neuroimaging dataset by many teams[END_REF]. A table is structured in columns, and each one its rows represents a piece of information. Probabilities can be attached to the rows of a table to encode the uncertainty of the data, in which case the table is said to be probabilistic.

Encoding CBMA Databases

We describe how CBMA data and queries can be encoded as a NeuroLang program. We then show how this program can be translated to a Bayesian network. We use its factorised joint probability distribution to analytically derive the same solutions for termbased queries as Neurosynth.

Automatically-Extracted CBMA Databases

An automatically-extracted CBMA database of studies with a fixed vocabulary of terms can be represented as two matrices ∈ R , and ∈ {0, 1} , , where is a TFIDF feature measured for term in study and = 1 if voxel is reported as activated in study . In practice, is a sparse matrix because only a small proportion of voxels are reported within a single study. Note that this definition corresponds to the shape of the database Neurosynth [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF], but also to the one of NeuroQuery [START_REF] Dockès | NeuroQuery, comprehensive meta-analysis of human brain mapping[END_REF]. Therefore, this definition is agnostic to the database at hand.

. . . Illustration of a CBMA database, where TFIDF features are extracted from the abstract or text of the studies using NLP algorithms, and where reported peak activation coordinates are extracted from the reported tables within the studies. This automatic extraction process is imperfect and leads to some noise in the data, as discussed by Yarkoni et al. [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF] and Dockès et al. [START_REF] Dockès | NeuroQuery, comprehensive meta-analysis of human brain mapping[END_REF].

study 1 11 • • • 1 1 • • • 11 TFIDF extract study 1 • • • • • • 1 TFIDF extract 1 term . . .

Neurosynth Term-Association Maps

Term-association brain maps are constructed from a probabilistic model where binary random variables and respectively model the activation of each voxel and the association of studies to each term . P [ | ] is the probability that voxel activates in studies conditioned on the studies being associated with term and P[

| insula ∧ speech ]
is the probability that voxel activates in studies conditioned on studies being associated with both terms 'insula' and 'speech'. Note that we use

P[ | , ] to denote P[ = 1 | = 1, = 1].
Yarkoni et al. [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF] associate terms to studies by applying a threshold to TFIDF features . Term-association brain maps are obtained by estimating, for each voxel ,

P | = =1 1[ > ] =1 1[ > ] (4.7)
Solving a query with a -term conjunction, = 1 ∧ • • • ∧ , is done by estimating, for each voxel ,

P [ | ] = =1 1[min( 1 , . . . , ) > ] =1 1[min( 1 , . . . , ) > ] (4.8)
As terms are added to this conjunction (and thus, complexity to the query), the term

1[min( 1 , . . . ,
) > ] goes to zero for an increasing number of studies. Rapidly, obtaining a meaningful brain map becomes infeasible due to statistical power failure. A different model that relaxes the hard thresholding of TFIDF features is proposed in the next sections. Note that, solving a disjunction of two terms is done by replacing min with max, thereby requiring that only one of the TFIDF features passes the threshold. The more terms are added, the larger the number of studies that are included in the estimation. In that case, statistical power is thus not an issue.

The program of fig. 4.3 encodes a CBMA database. The equiprobable choice on the SelectedStudy relation partitions the space of possible worlds such that each one corresponds to a particular study. VoxelReported and TermInStudy relations encode matrices and . We write the program such that solving the query P[Activation( ) | ], where conjuncts and/or disjuncts TermAssociation( ) atoms, produces the probabilistic model of term-based CBMA queries described in the Background section. For instance, when defining = TermAssociation(insula) ∧ TermAssociation(speech)

P[Activation( ) | ] is equivalent to the query P[ | speech ∧ insula ] described previously.
We show that in the next section.

Equivalence With Term-Based Query Solutions

To justify the design of the program in fig. 4.3, we translate it to an equivalent Bayesian network representation using the algorithm proposed by Meert, Struyf, and Blockeel

TermInStudy( , ) ← ∀ ∈ , ∀ ∈ , > VoxelReported( , ) ← ∀ ∈ , ∀ ∈ , = 1 =1 SelectedStudy( ) : 1 ← TermAssociation( ) ← ∃ TermInStudy( , ) ∧ SelectedStudy( ) Activation( ) ← ∃ VoxelReported( , ) ∧ SelectedStudy( ) Figure 4.3.
NeuroLang program encoding a probabilistic CBMA database. TermInStudy( , ) encodes the presence of term in study . VoxelReported( , ) represents that voxel was reported in study . The large SelectedStudy equiprobable choice over studies makes each possible world correspond to one independent and distinct study within the database. Activation( ) and TermAssociation( ) respectively model the activation of voxel and the association with term . The probabilistic query P[Activation( )] gives the marginal probability of activation of voxels over all studies. The query P[Activation( ) | TermAssociation(insula)] results in a term-association brain map for the term insula.

[MSB08]. The resulting Bayesian network is depicted in fig. 4.4 using plate-notation. To simplify the notation, we use , and to denote random variables Activation( ), TermAssociation( ), and TermAssociation( ). From the joint probability distribution defined by the Bayesian network, it can be derived that

P[ , , ] (4.9)
= =1 P[ SS = ]P[ VR = 1]P[ TIS = 1]P[ TIS = 1] (4.10) = 1 =1 1[ > ]1[ > ] (4.11)
and, similarly, that

P[ , ] = =1 P[ SS = ]P[ TIS = 1]P[ TIS = 1] (4.12) = 1 =1 1[ > ]1[ > ] (4.13)

Meta-Analytic Queries

Now that we have shown the analytical equivalence between term-based queries on Neu-roLang programs encoding a CBMA database and those of Neurosynth, we use Neu-roLang to solve actual queries, reproducing past meta-analytic results.

NeuroLang can be applied to the resolution of term-based and coactivation queries on CBMA databases, which are the most common types of meta-analyses conducted in the literature.

A term-based query derives an activation pattern associated with a term of interest that relates to psychological concepts or cognitive process. And, a coactivation query delineates a brain activation pattern that comprises spatially distant brain regions, putatively forming a large-scale functional network. Answering these queries is typically done using tools like Neurosynth [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF] or BrainMap [START_REF] Laird | BrainMap: The Social Evolution of a Human Brain Mapping Database[END_REF].

We give examples of each of the two types of queries in NeuroLang. In the process, we also show how the language can be used to encode spatial priors, used by the most common meta-analysis models to represent the uncertainty surrounding the spatial location of peaks reported by studies.

From Terms to Brain Maps

A core goal of meta-analyses is to identify brain regions that are preferentially activated in experiments studying a psychological or cognitive process, relative to the rest of the brain. With this goal in mind, Neurosynth produces term-association maps -previously called forward inference maps2 -which identify brain activations preferentially activated by a selected subset of the database, compared to their overall activation across the entire database [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF]. As an example, a meta-analysis of studies on emotion should find that the amygdala is one of the regions that is the most likely to be reported by this set of studies. In other words, the meta-analysis should find that there is an association between studies of emotion and a neural response in the amygdala.

Several meta-analytic models exists for computing probabilistic brain maps from a set of studies associated with a given term of interest ('emotion', in this example). We focus our attention on two of the most widely used models: multilevel kernel density analysis (MKDA) [START_REF] Tor | Meta-analysis of functional neuroimaging data: Current and future directions[END_REF] and ALE [Tur+02; LLF05; Eic+12]. Both provide an estimate of the probability that each brain voxel gets reported by studies based on a much small number of peaks reported in tables within published neuroimaging studies.

Peak activations are 3-dimensional points in the brain that live in a standardised stereotactic coordinate system, and that can be seen as a sparse representation of the statistical map obtained from an experimental study of neuroimaging signals. To account for the noise and variability of the exact location of these peaks, meta-analysis models often assume a neighborhood around peaks to be reported, or to have a probability of being reported. The definition of this spatial neighborhood is an a priori of the meta-analysis, sometimes called a spatial prior. This process, applied to the map of each study separately, is called smoothing [START_REF] Samartsidis | The Coordinate-Based Meta-Analysis of Neuroimaging Data[END_REF].

Encoding Meta-analytic Smoothing Priors

A simple but common spatial smoothing approach is to consider all voxels within a sphere centered at a reported peak location's coordinates to also be reported by the study. This prior, used by MKDA, is illustrated on the left part of fig. such binary pattern for each study, and aggregates them as frequencies at which each voxel is reported by studies selected for a meta-analysis. In plain English, 'a voxel at location ( , , ) is reported by a study whenever reports a peak activation within 10mm of that voxel'. In NeuroLang, this sentence is encoded by the following VoxelReported rule

VoxelReported(x, y, z, s) :- PeakReported(x2, y2, z2, s) & Voxel(x, y, z) & d = euclidean_distance(x, y, z, x2, y2, z2) & d < 10
where the pairwise Euclidean distance between pairs of voxels is calculated using a builtin euclidean_distance function. The lower bound d < 10 defines a 10mm radius ball around each peak location [START_REF] Tor | Meta-analysis of functional neuroimaging data: Current and future directions[END_REF]. An MKDA meta-analytic map is obtained by estimating the conditional probability that each voxel gets reported by studies associated with a given term of interest (e.g. 'emotion'.) To compute estimates of these probabilities, we define the following NeuroLang rule, which gives each study an equal probability of being selected SelectedStudy(s_1) : 1/N, ..., SelectedStudy(s_N) : 1/N :-

The distribution of the program's outputs can then be used to estimate the probability of each voxel being reported. Then, the result of solving a conditional probabilistic rule ans(x, y, z, PROB) :-VoxelReported(x, y, z, s) & SelectedStudy(s) // TermAssociation(emotion, s) & SelectedStudy(s)

will contain a probability for each voxel of the brain, based on the frequency at which it is reported by studies within the database. The // operator represents a probabilistic conditioning.

Another approach to smoothing peak activations is to model their location's uncertainty probabilistically. We give the example of the ALE algorithm [START_REF] Simon | Activation likelihood estimation meta-analysis revisited[END_REF], illustrated on the right part of ??. Instead of using a hard sphere, a three-dimensional Gaussian probability distribution is defined at each peak. This distribution provides a probability that depends on the Euclidean distance between each reported peak and brain voxel. The standard deviation of the Gaussian distribution is directly linked to the user-specified full-width half-maximum (FWHM), as in the ALE algorithm. In NeuroLang, this is modeled using a rule that programmatically defines a VoxelReported table as follows Following the ALE model, the probability of activation for voxel ( , , ) is calculated as the probability that any study in the meta-analysis report its activation. Assuming voxel reporting events to be independent, this means that the probability

P[∃ , VoxelReported( , , , ) ∧ TermAssociation(emotion, )] is equal to 1 - (1 -P[VoxelReported( , , , ) ∧ TermAssociation(emotion, )]) (4.15)
where is a study, as described in [START_REF] Simon | Coordinate-based activation likelihood estimation meta-analysis of neuroimaging data: A random-effects approach based on empirical estimates of spatial uncertainty[END_REF]. That is because of the tuple-independent assumption made on the VoxelReported and TermAssociation tables, described in the formalisation of TIDs [START_REF] Van Den Broeck | Query Processing on Probabilistic Data: A Survey[END_REF]. In other words, the probability of the expression being true for any grounding of variable (a study) is defined as the complement probability of the expression being false for all possible groundings of . To estimate this probability, we use an existentially-quantified rule -that is, a rule that uses a predicate logic existential (∃) quantifier -as follows ans(x, y, z, PROB) :-VoxelReported(x, y, z, s) & TermAssociation("emotion", s)

In fig. 4.6, we compare the probability maps obtained from the MKDA and ALE Neu-roLang programs. As expected, the association maps obtained with the two methods highlight a cluster in the amygdala, which is known to be part of the neural signature of emotion.

From Seed Voxels to Coactivation Maps

We now show how meta-analyses of voxel coactivations can be formulated in NeuroLang. These analyses are able to capture some of the most studied functional networks of the brain: the frontoparietal cognitive control network, dorsal attention network and sensorymotor network. This was already shown to be possible on the manually curated Brain- which asks, in plain English, 'what is the probability that each voxel at MNI coordinates ( , , ) gets reported by studies reporting the activation of some seed voxel at MNI coordinates ( 2 , 2 , 2 )'. This is solved for every voxel within 10mm of any peak reported at least once in the database, because the MKDA spatial smoothing prior is used. Note that this rule computes the coactivation maps for each seed voxel within the SeedVoxel table, meaning that the query needs to be solved only once to obtain several meta-analytical results. The SeedVoxel table contains the same coordinates as the ones used Toro, Fox, and Paus [START_REF] Toro | Functional Coactivation Map of the Human Brain[END_REF].

In fig. 4.7, we show the resulting coactivation map for each seed voxel. The first coactivation map, with a seed voxel in the left central sulcus (CS), correctly highlights the sensory-motor network (SMN), with clear activation clusters in the precentral and postcentral gyri [START_REF] Chenji | Investigating Default Mode and Sensorimotor Network Connectivity in Amyotrophic Lateral Sclerosis[END_REF]. The second coactivation map, with a seed voxel in the anterior cingulate cortex (aCC), correctly highlights the default mode network (DMN), with activation clusters in the medial prefrontal cortex, posterior cingulate cortex, and nucleus accumbens. Finally, the third coactivation map, with a seed voxel in the left intraparietal sulcus (lIPS), correctly hightlights the dorsal attention network (DAN), with activation clusters in the supplementary motor area, anterior insula, frontal eye fields, dorsolateral prefrontal cortex, and ventral occipital cortex. These coactivation maps correctly highlight the functional network their respective seed voxel is expected to belong to, similarly to what was reported by Toro, Fox, and Paus [START_REF] Toro | Functional Coactivation Map of the Human Brain[END_REF].

To conclude, we have shown that typical term-based and coactivation-based queries on CBMA could be expressed and solved with NeuroLang.

Solving Whole-Brain Meta-Analytic Queries

We have seen examples of some of the most common meta-analytic queries within the literature: term-association maps, and coactivation maps. However, we have not detailed how NeuroLang's engine is able to solve these queries, but instead only showed the results of the queries. We now describe the internal organisation of NeuroLang's engine, and how solutions of queries are calculated.

Stratification

The first step of the resolution is to stratify the program. Stratification corresponds to splitting the program in several parts, or strata, that can be resolved sequentially. If a given program can be split into three strata 1 , 2 and 3 such that 1 does not depend on any of the rules in 2 or 3 , such that 2 depends on the solution of 1 but not of 3 , and such that 3 only depends on the solution of 2 , then we can first solve 1 and pass its solution as input when solving 2 , then solve 2 and pass its solution as input when solving 3 .

Since NeuroLang has different resolution strategies for deterministic and probabilistic programs, we stratify the program into three strata. First, the deterministic stratum, on which the probabilistic stratum depends. Second, the probabilistic stratum, that can contain probabilistic relations, rules, and PERs. Third, the post-probabilistic stratum that contains only deterministic rules which can post-process the results of the probabilistic queries defined within the program by the PERs. This process is illustrated in fig. 4.8.

Stratifiable Program

post-probabilistic stratum with deterministic rules that can act on probabilistic results deterministic & probabilistic relations deterministic rules and probabilistic encoding rules (PER) andprobabilistic (D andE) tables. The first stratum (in green) contains a prod aggregation rule and a query-based probabilistic relation . The second stratum (in blue) contains a PER that stores the result of the probabilistic query evaluation in table 'ans'. The third stratum (in orange) aggregates the resulting probabilities by calculating their mean for each possible valuation of variables and .

Our stratified approach allows us to use the full power of datalog -and its extensions -within the deterministic strata, and probability encoding rules act as bridges between the probabilistic and deterministic strata.

We use the notion of reachable code to discard any rule or relation from the program such that the query does not depend on them. In other words, we pretend these rules and relations are not there when solving the query. This is an optimisation that is typical of logic programming systems, which allows us to restrict computations only to the necessary part of the program.

Deterministic Resolution

NeuroLang implements the improved seminaive algorithm to solve linear datalog programs [START_REF] Abiteboul | Foundations of databases[END_REF]p. 316]. A rule is linear if there is at most one literal within its body whose predicate is mutually recursive with , and a datalog program is linear if all of its rules are linear.

Negated literals are only permitted in NeuroLang rules if the rule is safe-range. That is, if a negative literal ¬ ( 1 , . . . , ) appears in the body of a rule, then all variables 1 , . . . , 2 must occur within at least one positive literal within the same rule.

When we evaluate deterministic strata of NeuroLang programs, we first derive a relational algebra expression -a plan -that computes the solution to the query. Then we execute this plan one one of our backends that implement relational algebra operations. Currently, two backends are supported: one is based on the pandas library [START_REF] Mckinney | pandas: a Foundational Python Library for Data Analysis and Statistics[END_REF], and another one is based on the Dask library [START_REF] Rocklin | Dask: Parallel Computation with Blocked algorithms and Task Scheduling[END_REF], which can be used to parallelise calculations on computing clusters for large programs. The Dask backend implementation is mainly the work of research engineer Jonas Renault. Specific functions for relating brain regions spatially are integrated within the language. For computing voxel neighborhoods in large scale whole-brain images, we use scipy's -d tree implementation [START_REF] Virtanen | SciPy 1.0: Fundamental algorithms for scientific computing in Python[END_REF].

Probabilistic Query Evaluation

NeuroLang's probabilistic engine uses both knowledge compilation and lifted inference algorithms to solve probabilistic queries, which are defined in its PERs.

We initially implemented a translation of NeuroLang programs to ProbLog2 [START_REF] Dries | ProbLog2: Probabilistic Logic Programming[END_REF], and translated the program of fig. 4.3 to it. We observed that, when solving two-term CQs, grounding and compiling the program to SDDs was impractical. Solving a two-term CQ takes more than 30 minutes on a recent laptop. This is due to the large number of voxels, terms and studies modeled simultaneously in the program, leading to a large number of ground literals. To give perspective on the scale of CBMA and neuroimaging data, a brain is typically partitioned into a grid of about 230,000 2mm 3 voxels. On average, studies in the Neurosynth database report 3165 voxel activatons. There are 14,371 studies and 3228 terms in the Neurosynth database.

We also tried compiling our program manually to SDDs [START_REF] Darwiche | SDD: A new canonical representation of propositional knowledge bases[END_REF]. But, despite our efforts, which did note include exploring recent tree-building strategies [START_REF] Darwiche | Recent trends in knowledge compilation (Dagstuhl Seminar 17381)[END_REF], the resolution of queries was still too slow to be practical for real-world applications. Currently available CBMA tools are capable of solving single-term queries in seconds. Resolution of more complex queries should have a similar time complexity to convince the end-user of the practicality of our tool.

NeuroLang implements the lifted query processing algorithm proposed by Suciu et al. [START_REF] Suciu | Probabilistic Databases[END_REF] and Dalvi and Suciu [START_REF] Dalvi | The dichotomy of probabilistic inference for unions of conjunctive queries[END_REF], which is used whenever the query formulated by the user is liftable, based on the definition of liftability provided in the previous chapter. An extensional query plan for the query is obtained by the lifted query processing algorithm, as illustrated in fig. 4.9, and an extensional relational algebra backend evaluates the probabilistic solution to queries.

Extensional Query Plan

Algebraic expressions with operators extended for probabilistic calculations

Given a query

The query plan computes Figure 4.9. An extensional query plan solves P[ ] for a given query by using algebraic operations that are extended with probabilistic calculations [START_REF] Suciu | Probabilistic Databases[END_REF][START_REF] Van Den Broeck | Query Processing on Probabilistic Data: A Survey[END_REF]. Whenever the query is not liftable, knowledge compilation is used instead using the open-sourced PySDD library, which was initially proposed by Darwiche et al. [START_REF] Darwiche | Recent trends in knowledge compilation (Dagstuhl Seminar 17381)[END_REF]. The possibility of falling back to KC was already noted by Suciu et al. [Suc+11,p. 120]: "Finally, we note that the extensional and intensional query evaluation approaches can be combined. The query evaluation rules discussed in Chapter 4 can be applied as long as possible, and once we get stuck, we can switch to intensional query evaluation.".

One other promising algorithm proposed by Van den Broeck [START_REF] Van Den Broeck | Towards high-level probabilistic reasoning with lifted inference[END_REF] is to lift knowledge compilation by introducing a new target representation, called first-order deterministic decomposable negation normal form, which exploits context-specific independencies that are commonly found in probabilistic logic models to provide resolution time polynomial in the size of the representation.

Overall architecture

The overall architecture of NeuroLang's query evaluation engine is illustrated in fig. 4.10. Let be a NeuroLang program with a set of rules ℐ, an input instance of a deterministic extensional database ℰ , and an input tuple-independent probabilistic database ℰ extended with probabilistic choices, which are block-independent disjoint tables in which all attributes are key attributes, leading to all tuples being mutually exclusive. Let ( ) be a query on .

First, any rule or relation that is not needed to solve the query is discarded to prevent any unneeded computation. The rules ℐ are stratified into three sets: a deterministic stratum ℐ , a probabilistic stratum ℐ , and a post-probabilistic deterministic stratum ℐ .

The deterministic solver is first used to resolve the rules in ℐ on the input instance ℰ . The solution to this resolution, which contains deterministic relations but also possibly query-based probabilistic relations, is then used as input to the probabilistic solver, alongside the probabilistic database ℰ . All the PERs necessary to solve the final query ( ) are then solved by the probabilistic solver, and the probabilities are thus stored within the intensional relations. When solving a probabilistic query, we first try to apply the lifted query processing algorithm. If the query is deemed not liftable, we fall back to the knowledge compilation engine. Finally, the solution to this probabilistic query evaluation is used as input to the final post-probabilistic deterministic stratum ℐ , alongside the input instance ℰ , on which these rules can also depend.

Probabilistic Term-to-Study Associations

Solving two-term conjunctive queries, that selects studies within a CBMA that are related both to some term 1 and some other term 2 , can lead to power failure for rare terms. In this section, we experiment a relaxation to the way terms and studies are considered to be associated by Neurosynth. Instead of of a hard-thresholding scheme, depicted in fig. 4.11, which imposes a strict restriction on the set of studies to be considered associated with both terms, we use the relaxation illustrated in fig. 4.12, where studies have a probability to be associated with both terms, based on the TFIDF values for each term. Conjunctive queries are solved in Neurosynth by hardthresholding TFIDF features to represent term-to-study associations. For a conjunction 1 ∧ 2 , only studies that have TFIDF features passing the threshold for both terms are included. Figure 4.12. We propose a relaxation of Neurosynth's hard-thresholding scheme. We use TFIDF values to model term-to-study associations probabilistically: the higher the TFIDF value, the higher the probability that a given study is associated with a term.

Relating Terms and Studies Probabilistically

We hypothesise that the hard-thresholding 1[ > ] of TFIDF features , used by Neurosynth, could miss studies that would be relevant to the resolution of queries. Because we are interested in solving more complex queries, in this contribution we explore a relaxation of the hard-thresholding scheme by introducing the soft-thresholding function

( ; , ) ( ( -)) ∈ [0, 1] (4.16)
where is the logistic function defined as ( ) = 1 1+ -and a threshold. As increases, ( ; , ) converges towards the hard-thresholding function 1[ > ]. With an appropriate , a larger proportion of studies is included in the calculation of P[ | ], giving better estimates on small databases. For example, results of two-term CQs P[

| 1 ∧ 2 ]
and UCQ P[

| 1 ∨ 2 ] are estimated through P[ | 1 ∧ 2 ] = =1
( 1 ; , ) ( 2 ; , )

=1

( 1 ; , ) ( 2 ; , ) (4.17)

P [ | 1 ∨ 2 ] = =1 1 - 2 =1 1 - ; , =1 1 - 2 =1 1 - ; , (4.18)
More generally, P[ | ] can be estimated for first-order logic formulas that blend conjunctions and disjunctions of Boolean random variables , ∈ 1, . . . , . For example, if = ( 1 ∨ 2 ) ∧ ( 3 ∨ 4 ), we have

P[ | ] = =1 ( 1 , 2 ) ( 3 , 4 ) =1 ( 1 , 2 ) ( 3 , 4 ) (4.19)
where

( 1 , 2 ) = 1 -(1 -( 1 ; , ))(1 -( 2 ; , )).
This modeling is implemented simply by integrating ( ; , ) as the probabilities of probabilistic facts TermInStudy( , ) in the program of fig. 4.3.

Experiments and Results

We compare our method with Neurosynth's on simulated CBMA databases sampled from a generative model and on the Neurosynth database. Using both models, we solve 55 different two-term CQs P[ | ∧ ].

Gain of Statistical Power when Solving Two-Term CQs on Smaller Simulated CBMA Databases

We evaluate our method on simulated small CBMA databases obtained by sampling from the generative model of fig. 4.13. This generative model provides the ground truth of which voxels activate in studies matching a given query of interest. This binary classification setting makes it possible to compare models by measuring their ability to identify true voxel activations for multiple sample sizes. We experimented with multiple numbers of voxels ( ∈ [100, 1000]). Preliminary results showed that varying the number of voxels in this range does not alter the results. We report results for = 1000 voxels, of which 5% are activated in studies matching the query. Predicted voxel activations are obtained by thresholding -values computed from each model's estimation of

P[ | ]
using a -test of independence. We use a -value threshold of 0.01 and a Bonferroni correction for multiple comparisons. Simulation results for two-term CQs are presented in

( ) TFIDF = ( ) TF × IDF IDF ( ) TF ∼ ( , ) ( ) = ( • TFIDF ) ( ) ∼ ℬ( ) ∈ ∈ Logistic ℬ Bernoulli Gaussian
TF } ∈ .
is the probability of activation of voxel . Vectors are obtained from a rejection sampling scheme that controls the proportion of voxels that activate when the query is verified. IDF , and are estimated from 4168 scrapped PubMed abstracts. fig. 4.14, where we compare our model's and Neurosynth's 1 scores across 55 two-term CQs. These queries correspond to all two-term combinations out of 11 terms (depicted on the -axis of the bottom plot of fig. 4.14) associated with a sufficiently large number of studies within the Neurosynth database to produce meaningful term-association maps. The 1 score measures the performance of a binary classifier by combining its precision and recall into a single metric. We see the advantage of our approach over Neurosynth's for smaller generated samples where activations related to the query can be identified more reliably (higher 1 scores). Multiple values of in the range [100, 1000] were tried during our experiments. However when is too small or too large, the model tends to include either too many (and irrelevant) or too few studies in the estimation. When tends to 0, becomes equivalent to Neurosynth's hard thresholding. We found that a sweet spot for was around 300 and report results for that value. Drawing the sigmoid curve for = 300 confirms that this transformation of TFIDF features is adequate because it maintains Neurosynth's hard thresholding's property of giving a 0 or 1 probability to the lowest and highest TFIDF features (respectively).

The proposed approach did not show an advantage over Neurosynth for solving twoterm disjunctive queries. This is expected, as such queries do not reduce the number of studies incorporated in the estimation of P[

| ∨ ], as explained in the Background section.

Gain of Activation Consistency on a Real CBMA Database

We evaluate our method on the Neurosynth CBMA database. Because we don't have a ground truth of which voxels activate for a given query, we resort to comparing models based on the consistency of their predicted activations over many random sub-samples of the Neurosynth database.

From predicted activation maps of voxels obtained from sub-samples of a CBMA database, the consistency for a two-term conjunctive formula is computed as

1 =1 1 -2 × 1 =1 ˆ - 1 2 (4.20)
where ˆ = 1 if voxel is predicted to be activated in sub-sample when formula is true. The closer to one, the closer the average activation is to 0 or 1, which indicates a higher consistency across sub-samples. The closer to zero, the closer the average activation is to 0.5 which indicates that the predicted activations are highly variable across samples.

Results are reported in fig. 4.15, where the distribution of consistencies, across the same 55 CQs as in the previous experiment, are shown for multiple sample sizes. For the largest sample sizes, consistency scores are closer to 1 with our method than with Neurosynth's. For a sample size of 2395 (chosen on a logarithmic scale), the average consistency of our method was 0.48 while Neurosynth's was 0.4 (+20%) across samples and queries. For a sample size of 3856, we notice a 10% improvement. We did not experiment with larger sample sizes due to the computational cost of running the experiment on many Neurosynth subsamples for all CQs. Also, we were mainly interested in whether our approach would be more consistent for smaller sample sizes. We observed that the consistency between Neurosynth and our approach was similar when both models were estimated on the entire database. This means that the proposed approach is more consistent on smaller sample sizes but equivalently consistent on larger sample sizes.

The number of voxels ( = 1000) used in the simulation experiments is orders of magnitude lower than on the typical whole-brain neuroimaging setting, where (10 5 ).

We chose to lower the dimension in the simulation setting for computational practicality purposes. However, we believe that maintaining the same proportion of reported activations as in the Neurosynth database was enough to confirm our approach on simulations before applying it to real data.

Our related publications

Valentin Iovene, Gaston E Throughout this work, we formulate meta-analytic conditional probabilistic queries of the form P[ ( )| ( )], where ( ) and ( ) are first-order logic formulas describing studyspecific probabilistic events of interest; such as whether a region / network is reported by study , or whether is associated with a topic related to a particular psychological concept. where is the number of studies such that ( ), is the number of studies such that ( ), is the number of studies such that ( ) ∧ ( ), and is the total number of studies within the database. As 2 log is asymptotically 2 distributed with 1 degree of freedom [START_REF] Mcfarlane | Introduction to the Theory of Statistics[END_REF], it provides an estimate of the false-positive rate when rejecting the null hypothesis.

Chapter 5

Applications of NeuroLang to Functional Brain Mapping Meta-Analysis Abstract. We present examples of meta-analyses performed with NeuroLang, that reproduce findings from the functional neuroimaging literature. The examples shed light on the utility of NeuroLang's probabilistic logic semantics in representing and examining hypotheses of functional neuroanatomy and brain-behaviour relationships that cannot be readily examined using existing meta-analysis tools. These hypotheses embed structurally complex questions that often require a composite workflow to be answered. In a first example, we use between-network segregation queries to study differences in the functional connectivity profiles of three major functional networks: the dorsal attention network (DAN), default mode network (DMN), and frontoparietal cognitive control network (FPCN). In a second example, we explore potential associations between Neurosynth topics and coactivations between the visual word-form area and the frontoparietal attention network. In a third example, we use the power of first-order logic to formulate topic segregation queries that uncover differences in the FPCN's activation patterns for a number of cognitive processes that have been hypothesised to be functionally linked to this network. In a fourth and last example, we use the CBMA database NeuroQuery, and the DiFuMo data-driven functional parcellation to study the heterogeneity in the functional connectivity of the FPCN's subnetworks, corroborating results from past studies. Together, these experiments illustrate NeuroLang's ability to simplify the formulation and resolution of complex queries on CBMA data.

Topic Models and Functional Atlases

In the previous chapter, we have shown that a CBMA database can be encoded as a probabilistic logic program, and we proved that this modeling does correspond to existing models like Neurosynth. We showed that term-association and coactivation maps could be obtained from NeuroLang, which corresponds to the typical queries solved by Neurosynth and BrainMap. We now build on top of that, by integrating other sources of knowledge into NeuroLang programs. More particularly, we integrate machine-learned topic models and data-driven anatomical or functional atlases to meta-analytic NeuroLang programs to be able to formulate richer queries. The diagram of fig. 5.1 illustrates the different pieces of neuroscientific knowledge that we use for this chapter's queries.

Data-driven topic models, learned and openly shared by Neurosynth [START_REF] Poldrack | Discovering Relations Between Mind, Brain, and Mental Disorders Using Topic Mapping[END_REF], are incorporated within a TopicAssociation probabilistic table, containing one row ( , , P) for each uncertain association between a topic and a study . In probabilistic predicate logic, we write TopicAssociation( , ) : P to state 'study has a probability P of being associated with topic ' [START_REF] Iovene | Complex Coordinate-Based Meta-Analysis with Probabilistic Programming[END_REF].

It is common for meta-analyses to integrate anatomical or functional brain parcellations [START_REF] Andrews-Hanna | The default network and self-generated thought: Component processes, dynamic control, and clinical relevance. The brain's default network[END_REF] to produce finer and richer meta-analyses. We use the DiFuMo-256 atlas [START_REF] Dadi | Fine-grain atlases of functional modes for fMRI analysis[END_REF], which was trained on millions of fMRI brain volumes to decompose brain signals into 256 high-dimensional components. This data-driven functional atlas achieved similar statistical performance to analyses at the voxel-level, while simultaneously reducing computational cost and providing higher interpretability. We incorporate DiFuMo-256 components in a RegionVoxel table, containing a row ( , , , ) for each brain voxel at MNI location ( , , ) belonging to DiFuMo-256 component . An excerpt of the Re-gionVoxel table is depicted at the bottom of fig. 5.1. We also incorporate a table Net-workRegion that contains a row ( , ) whenever component is found to overlap with some network within widely-used 7-and 17-network parcellations [START_REF] Thomas Yeo | The organization of the human cerebral cortex estimated by intrinsic functional connectivity[END_REF].

Similarly to Neurosynth or GingerALE, we assume each study within the meta-analytic database to be an independent equiprobable sample of neuroscientific knowledge [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF][START_REF] Simon | Activation likelihood estimation meta-analysis revisited[END_REF]. These assumptions are encoded by a SelectedStudy rule, depicted in the middle left part of fig. 5.1, which gives each study an equal probability 1/ of being used in a possible execution of the program, where is the total number of studies within the ticular brain network, with an additional constraint that no activation in other networks is reported. The added constraint can be readily expressed in NeuroLang and aims to functionally segregate brain networks in order to assess their functional specializations with greater specificity. In other words, the goal of this example is to show that a reverse inference segregation query can identify which network's activation provides more evidence in favor of the engagement of a particular cognitive process.

The networks included in this example are the default mode network (DMN), frontoparietal cognitive control network (FPCN) and the dorsal attention network (DAN). These networks exhibit competitive and cooperative coupling dynamics in support of a wide array of internally and externally directed mental functions [START_REF] Spreng | Intrinsic Architecture Underlying the Relations among the Default, Dorsal Attention, and Frontoparietal Control Networks of the Human Brain[END_REF]. Yet, each one of them is believed to be specialized for certain broad cognitive processes [Spr+13; PSF17; Dix+18]. The FPCN contributes to a wide variety of tasks by engaging top-down cognitive control processes; the DAN is concerned with orienting attention towards a particular stimuli, location, or task; and the DMN is involved in higher-order self-referential, social and affective functions. Therefore, using a segregation query, we can identify the functional specializations of these networks, reflecting upon the general understanding of their roles in the literature.

We assume a DiFuMo-256 component to be reported by a study whenever a peak activation is reported by the study within that region. In NeuroLang, this is expressed by the following logic implication rule RegionReported(r, s) :-PeakReported(x, y, z, s) & RegionVoxel(r, x, y, z) which translates, in plain English, to 'region is reported by study if reports a peak at location ( , , ) that falls within region '. We model the reporting of networks by studies probabilistically, based on the reported regions that belong to each network, to account for the uncertainty in the location of reported peak activation coordinates. More precisely, each study has a probability of being considered to be reporting a network, equal to the reported volumetric proportion of the network in the study. In plain English, 'a network is considered to be reported by study with probability / , where is the sum of the volumes of regions within network that are reported by study , and is the total volume of the network'. This is implemented by the following deterministic and probabilistic rules which make use of NeuroLang's built-in count and sum aggregation functions, and where resolution sets the resolution to 3mm 3 voxels. Now that we have a definition for whether a network is reported by a study, we define a rule that infers the probability that studies are associated with each topic given that they report only one of the three networks. In plain English, we query the probability that a study is associated with topic given that some network is reported by but no other network is reported by . In NeuroLang, this corresponds to the following rule

ans(t, n, PROB) :-TopicAssociation(t, s) & SelectedStudy(s) // NetworkReported(n, s) & ~exists(n2; Network(n2) & n2 != n & NetworkReported(n2, s) )
where the // operator represents a probabilistic conditioning. This rule contains a negated existential expression, ∼exists(• • • ), that prevents two networks from being reported by a study at the same time. Functional profiles obtained with network-based segregation queries that identify the most probable topic associations in studies reporting activations within one network but not reporting activations within any of the other networks. A 95% confidence interval is depicted, across 1000 random 50% subsamples of the Neurosynth database [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF].

We report the resulting functional profiles in fig. 5.2. We observe that topics related to sensory processing of direct environmental demands such as eye movements, visual attention, action, and spatial location are more likely to appear in studies reporting activations in the DAN than those reporting activation in the FPCN or DMN. We also observe that topics related to domain-general cognitive functions such as decision making, task switching, task demands, response inhibition, and performance monitoring are more likely to be mentioned in studies reporting activations in the FPCN than in the DAN and DMN. Finally, topics related to higher-order abstract cognitive and memory-related processes are mostly associated with studies reporting DMN activations than those reporting FPCN or DAN.

Meta-Analysing the Role of the Visual Word-Form Area in Attention Circuitry

It has been hypothesised that the visual word-form area (VWFA) is part of attention circuitry, through an analysis of high-resolution multimodal imaging data from a Human Connectome Project cohort [START_REF] Chen | The visual word form area (VWFA) is part of both language and attention circuitry[END_REF]. Can this relationship be identified solely from a meta-analysis of past studies that have reported activations in the left ventral occipitotemporal cortex without necessarily identifying it as the VWFA?

We formulate NeuroLang queries that infer the most probable topic associations among studies that report activations close to the VWFA region, while simultaneously reporting activations within the frontoparietal attention network [START_REF] Ptak | The Frontoparietal Attention Network of the Human Brain. Action, Saliency, and a Priority Map of the Environment[END_REF], but not reporting activations within the 'language' network. By excluding studies that report activations within the language network, we maintain the focus of the meta-analysis on studies that might be studying the attention circuitry, while still reporting activations within the VWFA.

We use the Neurosynth CBMA database [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF], consisting of 14371 studies, and its associated v5-topics-100 topic model [START_REF] Poldrack | Discovering Relations Between Mind, Brain, and Mental Disorders Using Topic Mapping[END_REF]. To define the VWFA; frontoparietal attention network and 'language' network; we use the same seed locations as in [START_REF] Chen | The visual word form area (VWFA) is part of both language and attention circuitry[END_REF], stored in a RegionSeedVoxel database table that contains a row ( , , , ) for each region 's seed voxel located at MNI coordinates ( , , ). Voxels within 6mm of each seed location are displayed both for the 'language' and 'attention' networks in fig. 5 table NetworkRegion contains rows ( , ) for each region belonging to network . A brain region is considered to be reported by a study if it reports a peak activation within 10mm of the region seed voxel's location, following the assumption made by meta-analyses based on MKDA. The choice of a 10mm radius was used to facilitate comparisons with the range of smoothing kernels that are typically used within meta-analyses to account for the uncertainty in the location of reported peaks. A network is considered to be reported by a study if it reports one of the network's regions, based on the previous definition. In NeuroLang which calculates the probability of finding an association with topic among studies that report the activation of both the VWFA and network , but do not report the activation of any other network 2 , where 2 ≠ . Because only two networks, language and attention, are present in the Network table, this rule simultaneously calculates the probabilities for each pair of networks, including one while segregating the other.

.3. A database

Results are shown in table 5.1. Topic 32 was found to be significantly associated with studies that report activations within the VWFA and the frontoparietal attention network but that do not report activations within the 'language' network. This topic highly loads on terms related to object recognition: a task for which attention circuitry is essential [START_REF] Corbetta | The Reorienting System of the Human Brain: From Environment to Theory of Mind[END_REF]. This result suggests that the VWFA does play a role in attention, as studies that report its activations are significantly associated with object recognition, and supports the running scientific hypothesis that the VWFA plays a role in processing multiple categories of visual stimuli [START_REF] Chen | The visual word form area (VWFA) is part of both language and attention circuitry[END_REF]. We also observe a significant association with topic 21, which highly loads on terms related to the task of reading words.

Deriving Differential Meta-Analytic Activation Pat-

terns within the FPCN using Logical Topic Segregation Queries

In this example, we perform forward inference topic-based segregation queries to derive activation patterns within the frontoparietal cognitive control network (FPCN), given the presence of a psychological topic of interest, with an additional condition that studies included within the meta-analysis are not associated with all other topics of interest. Often referred to as the multiple demand system [START_REF] Duncan | The multiple-demand (MD) system of the primate brain: Mental programs for intelligent behaviour[END_REF], activity within the FPCN is associated with a large set of tasks, themselves belonging to disparate and overlapping cognitive components such as decision making, working memory, memory retrieval, task switching, and semantic processing, to name a few. Yet, the literature provides evidence for an heterogeneous internal organization, whereby a different combination of regions may be involved in a different domain of processing [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF]. Thus, the main goal of this example is to identify unique activation patterns within the FPCN each predicted by the presence of a particular topic and the simultaneous absence of other topics.

Segregation queries can maximise the specificity of meta-analytic forward inferences by minimising the amount of overlap amongst nuanced topics. In this framework, the topic-based segregation query automatically selects the studies that predominantly load on a single topic representing a cognitive process known to be associated with FPCN activity, while simultaneously discarding studies that load on any of the other topics, which also represent cognitive processes associated with activity of the FPCN.

From a set of 200 topics, learned from a large corpus of studies using topic modeling and made available by Neurosynth [START_REF] Poldrack | Discovering Relations Between Mind, Brain, and Mental Disorders Using Topic Mapping[END_REF], we selected five topics representing a subset of the broad cognitive processes widely attributed to the FPCN, along with the loading values of studies on each topic: working memory, decision making, task set switching, semantic processing, and memory retrieval [Yar+05; Nie+12; Dun10 We report the resulting topic-based activations within the FPCN in fig. 5.4. The results of this segregation query show that the FPCN exhibits a varied activation profile across topics, corroborating previous findings of flexible adaptation of activity within this network as task type change. Specifically, working memory and task set switching tend to activate, to some extent, spatially interleaved, frontal and parietal regions of the FPCN network. Semantic processing, on the other hand, dominantly activates a left-lateralised frontal region anchored in the middle frontal gyrus and extends to the inferior frontal gyrus. Finally, decision making and memory retrieval are associated with activation in the cingulo-medial portion of the FPCN, the pre-supplementary motor/dorsal anterior cingulate cortex (decision making) and a precuneus/posterior cingulate cortex network (memory retrieval). These results are in-line with existing findings from the literature and demonstrate the power of NeuroLang in expressing segregation queries capable of uncovering a network's internal organisation.

Coactivation Analysis of the Functional Connectivity Differences Between Two FPCN Subnetworks

A running hypothesis is that the frontoparietal cognitive control network (FPCN) can be decomposed into subsystems associated with disparate and overlapping mental processes. Dixon et al. [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF] studied two broad subsystems of the FPCN that also appear as separate networks in the influential 17-network model from Thomas Yeo et al. [START_REF] Thomas Yeo | The organization of the human cerebral cortex estimated by intrinsic functional connectivity[END_REF]. Using the same nomenclature, we label these two subsystems FPCN-A and FPCN-B. Dixon et al. [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF] observed significant couplings between FPCN-A and the default mode network (DMN), and between FPCN-B and the dorsal attention network (DAN). We reproduce theses results by conducting a similar meta-analysis with Neu-roLang.

Our approach is to formulate conditional probabilistic queries that include studies reporting activations in each of the two FPCN subnetworks. By contrasting their probabilistic maps, we identify a distinct coactivation pattern associated with each subnetwork. Using the same probabilistic definition of network reported by studies as in the previous experiments, we formulate a rule that calculates the coactivation pattern of each FPCN subnetwork. In NeuroLang we use the following rule to calculate the conditional probability of a region being reported given that a network is also reported ans(r, n, PROB) :-RegionReported(r, s) & SelectedStudy(s) // NetworkReported(n, s) & SelectedStudy(s)

whose resulting ans table contains tuples ( , , ), where is the probability of region being reported by studies reporting network , where is either FPCN-A or FPCN-B. We use a likelihood-ratio test, and a FDR correction for multiple comparison, to identify significant coactivating regions. To obtain a distribution and study the variance of our results, we estimated these probabilities on 1000 random 50% subsamples of the Neu-roQuery database. We estimated empirical distributions and computed the confidence intervals of our probability estimates by re-running the program on 1000 subsamples of the NeuroQuery database, where 50% of studies are randomly selected at each run.

In fig. 5.5, we show scatter plots of the probabilities that each DiFuMo-256 brain region activates given the activation of the FPCN-A or FPCN-B subnetworks, as defined by the 17-network proposed by Thomas Yeo et al. [START_REF] Thomas Yeo | The organization of the human cerebral cortex estimated by intrinsic functional connectivity[END_REF]. We only show the results of regions that exhibit a significant coactivation with at least one subnetwork, based on a likelihood-ratio test. In the left panel, regions colored by their respective network membership according to Thomas Yeo et al. [START_REF] Thomas Yeo | The organization of the human cerebral cortex estimated by intrinsic functional connectivity[END_REF]'s coarse 7-network functional parcellation. Likewise, in fig. 5.5 we differentiated the coactivation profiles of the DMN and the DAN with the FPCN subnetworks. On one hand, 31 out of 32 regions of the DMN selectively coactivate with FPCN-A, while only one DMN region (a subregion in the middle frontal gyrus) seem to exhibit a preferential coactivation with FPCN-B. In fig. 5.6, we illustrate a meta-analytic coactivation contrast map between FPCN-A and FPCN-B, showing that the former coactivates to a greater extent with the core regions of the DMN, especially the medial prefrontal cortex and the angular gyrus, than does the latter. On the other hand, without indicating any preference, we observe that 21 out of 30 DAN regions exhibit statistically significant coactivations with FPCN-A, while 19 show statistically significant coactivations with FPCN-B. However, only 11 regions have a higher probability of activating given an FPCN-B activation than FPCN-A, while the others have comparable probabilities of coactivating with either subnetworks. This is in line with the findings from Dixon et al. [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF], showing less distinction in the DAN with respect to coactivation with the FPCN subnetworks. However, FPCN-B does indeed coactivate to a greater extent with the core regions of the DAN, the superior parietal lobule and frontal eye fields, as seen from the meta-analytic coactivation contrast map in fig. 5.6.

Higher Specificity from Logic Segregation Queries

Selecting studies to include in a meta-analysis that examines a specific hypothesis is a crucial yet daunting task. Traditionally, researchers select studies carefully by hand or rely on databases of manually curated annotations of studies, such as BrainMap [START_REF] Laird | BrainMap: The Social Evolution of a Human Brain Mapping Database[END_REF]. However, non-automated meta-analysis can be arduous, suffer from low statistical power, lack scalability, and may lead to biased results. As a response to these shortcomings, automated meta-analysis tools, such as NeuroSynth [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF] and NeuroQuery [START_REF] Dockès | NeuroQuery, comprehensive meta-analysis of human brain mapping[END_REF] have been developed to enable scalable and unbiased analysis of studies from the neuroimaging literature, providing remarkable statistical power. Yet, these tools lack an automatic way to contrast and select studies based on the strength of their selective relevance to a specific brain signature or neuroscientific concept of interest. This shortcoming precludes using these tools to formulate complex hypotheses and answer new questions about functional specificity and heterogeneity in the brain.

In contrast, NeuroLang is distinguished by its ability to express more flexible and intricate queries to select studies using first-order logic semantics [START_REF] Iovene | Complex Coordinate-Based Meta-Analysis with Probabilistic Programming[END_REF]. A concrete and recurring use-case throughout the examples presented herein is that of segregation queries, which we formulate using first-order logic negation operator (¬) and existential quantifier (∃). Using segregation queries enables the automatic selection of studies in a meta-analysis, by narrowing large set of studies to a particular psychological concept or neurological signature of interest.

Segregation queries can be particularly useful to assess the functional specificity of brain regions, and those trying to understand mind-brain relationships at a larger scale. For example, the use of segregation queries can alleviate the problem of inferring functional specialisation from observed activations in a brain region that is recruited to varying degrees by multiple tasks or networks, such as the VWFA [START_REF] Chen | The visual word form area (VWFA) is part of both language and attention circuitry[END_REF] or the anterior insula [START_REF] Menon | Microstructural organization of human insula is linked to its macrofunctional circuitry and predicts cognitive control[END_REF]. The degree of belief in a reverse inference is dependent on the selectivity of a region's activation to a particular task or network, relative to the likelihood of its activation across other tasks and networks. This is difficult to determine with existing meta-analytic approaches applied to a large body of literature without a pertinent methodological access, an automated tool that readily splits studies based on tailored criteria. Likewise, studies investigating the fractionation of a large-scale network [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF] into functionally specialized subsystems can benefit from performing meta-analysis using segregation queries to derive evidence with enhanced specificity. Moreover, segregation queries can be advantageous in investigating the specific neural underpinnings of cognitive processes (e.g., working memory updating and interference resolution) that may be mutually or independently engaged by various tasks (e.g., n-back and flanker test) and themselves recruit shared and distinct neuronal populations [START_REF] Thomas Yeo | Functional Specialization and Flexibility in Human Association Cortex[END_REF].

The examples we have presented highlight use cases of segregation queries in Neu-roLang. In our analysis of brain networks, we used segregation queries to select studies reporting activations in a single functional network, enabling the inference of functional preference profiles for each network, separately. The functional specializations of largescale networks is a well-established phenomena across the literature [Dam+06; Smi+09; Tho+11]. However, common fMRI tasks can be decomposed into the relative contributions of overlapping and distant networks, depending on the cognitive processes engaged during task performance [START_REF] Bzdok | Formal Models of the Network Co-occurrence Underlying Mental Operations[END_REF]. So, to meta-analytically infer the selective involvement of a network in a cognitive process, one must be able to segregate it from other networks, i.e. select the studies reporting activations in a single network of interest, while discarding studies reporting activations in multiple networks. Accordingly, and in accordance with the literature [Dun10; Rai15; VGF13], the results of this example reveal the selective involvement of the FPCN in executive functions (e.g., response inhibition and task switching), the DMN in introspection, emotion, and social cognition (e.g., mentalis-ing, declarative memory and subjective experience), and the DAN in externally oriented functions (e.g., eye movements and spatial location). Some topics, however, do not show a predominant network involvement by a vast margin, such as 'working memory', 'visual attention', 'action', and 'performance monitoring'. The reason for this might be that these topics correspond to macro-scale domain-general functions that embed a finer specificity at the task level or consistently require a balanced contribution of two or more large-scale networks. It is worthwhile investigating this phenomena in future studies to establish specific mappings between subtopics and individual networks or subnetworks.

In our analysis of brain topics, we use segregation queries to derive differential activation patterns within the FPCN associated with a set of process known to recruit this large-scale network to varying degrees. The FPCN, part of the extended multiple demand network [Cam+18; Dun10], comprises regions that coactivate across diverse sets of tasks. This property confers a heterogeneous organisation within the FPCN spanned by multiple subsystems with specific activation and functional profiles [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF][START_REF] Thomas Yeo | The organization of the human cerebral cortex estimated by intrinsic functional connectivity[END_REF]. However, given the lack of formal definitions and fine lines between different executive functions, which are often conjointly studied, it can be difficult to determine domain-specific FPCN activation patterns. For this purpose, our segregation meta-analysis selects studies highly loading on one single topic, while discarding those loading on other related topics. We observe a relatively selective coactivation pattern associated with each topic, corroborating findings of dynamical reconfigurations in canonical brain networks as a function of varying demands [START_REF] Fenna | Reconfigurable task-dependent functional coupling modes cluster around a core functional architecture[END_REF]. This type of segregation meta-analysis can be especially beneficial for generating new hypotheses in many system-level causal modeling approaches [START_REF] Friston | Dynamic causal modelling[END_REF] applied to fMRI data (e.g., dynamic causal modeling), which require strong a priori hypotheses about the specific regions involved in certain brain processes.

Along the same line, in our analysis of the FPCN, we use segregation queries to reproduce the results of Dixon et al. [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF], similarly revealing two dissociable subsystems, FPCN-A and FPCN-B that exhibit distinct activations profiles and selective associations with the DMN and DAN, respectively. However, our results slightly differ in terms of individual brain regions that show statistically significant coactivation with either FPCN-A or FPCN-B. For instance, unlike Dixon et al. [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF], we did not find that the posterior cingulate and lateral temporal cortices (hubs in the DMN) have statistically significant coactivations with FPCN-A (see fig. 5.6), even though they are more likely to coactivate with FPCN-A than FPCN-B. On top of that, we found that the dorsal anterior cingulate and anterior insula significantly coactivate with FPCN-B more than with FPCN-A, a result not reported in the original work. This finding highlights the differences in the constraints put forth on the dataset in both research works. Dixon et al. [START_REF] Matthew | Heterogeneity within the frontoparietal control network and its relationship to the default and dorsal attention networks[END_REF] did not exclude studies that conjointly report peaks within the FPCN-A and FPCN-B. This may have increased statistical power at the expense of specificity, which tends to result in coactivations being statistically significant in the posterior cingulate cortex, but cannot reveal the selective tendency of the anterior insula and dACC to couple with either of the FPCN subsystems. This might be because these two regions are also part of the extended multiple demand system [Cam+18; Dun10], and thus may have close ties with both FPCN-A and FPCN-B across studies, that only segregation queries can disentangle.

Finally, in our analysis of the visual word-form area (VWFA), we use segregation queries to isolate studies that report activations within the VWFA and regions of the 'attention' network without reporting activations within the language network, and vice versa. The VWFA is a region that is popularly known to be recruited when reading words, but has recently been shown to also be involved in processing a broader range of visual stimuli that are not necessarily related to word forms, and to be a functional part of the frontoparietal attention network [START_REF] Chen | The visual word form area (VWFA) is part of both language and attention circuitry[END_REF]. The main result of this segregation metaanalysis highlights a significant association with a Neurosynth topic that loads on terms related to object recognition and visual stimuli, which further supports the neuroscientific hypothesis that the VWFA may be recruited by visual processing tasks unrelated to reading words, co-recruiting the attention circuitry. However, we acknowledge that the topic loads on terms such as 'fusiform' and 'occipitotemporal', corresponding to zones in the close proximity of the VWFA, which may have biased the results. Nonetheless, given that these zones are central for representing features and attributes of objects [START_REF] Weiner | The anatomical and functional specialization of the fusiform gyrus[END_REF], and the requirement that the attention network is active, our result suggests a role for the VWFA in the context of object recognition and visual processing when the attention network is recruited. This finding further supports a relationship between non-linguistic visual attention abilities and the VWFA. Another equally important result reveals no statistically significant topic associations for the VWFA when reporting the language network while excluding the frontoparietal attention network. In contrast, when not excluding studies reporting the frontoparietal attention network, we find a significant association with a topic related to "reading words" when activations within the language network are reported by studies. This finding suggests that the VWFA may not play a selectively specialised role in the context of the language network per se, but rather plays a broader role at the interface of language and attention. It follows that findings from [START_REF] Chen | The visual word form area (VWFA) is part of both language and attention circuitry[END_REF] also suggest that the VWFA acts as a gateway that links visual attention to language processing, such that the attention network amplifies the representations of written words in the VWFA so they may be conveyed to the language network for further processing. Taken together, the results of this segregation meta-analysis further support a multiplex model of VWFA, providing a finer and more specific delineation of its general role in visual processing.

Together, these examples show that NeuroLang's logical rules can be used to express complex meta-analytic scientific hypotheses to corroborate existing knowledge with enhanced specificity as well as generate new knowledge about functional specialisations in the brain.

Richer Queries on Heterogeneous Uncertain Knowledge

Meta-analyses often need to combine heterogeneous sources of data. For example, Andrews-Hanna, Smallwood, and Spreng [ASS14] integrate a whole-brain parcellation of restingstate fMRI data, revealing three components of the DMN whose respective functions are decoded through reverse inference. To study the functional profiles of brain networks, and the coactivation patterns of FPCN subsystems, we integrated the machine-learned DiFuMo-256 functional atlas to conduct meta-analyses at the level of high-dimensional functional modes. Components of this functional atlas are naturally anchored on anatomical structures and were labelled with the name of their most relevant anatomical interpretation by experts [START_REF] Dadi | Fine-grain atlases of functional modes for fMRI analysis[END_REF]. Analyses at the level of these high-dimensional representations are computationally cheaper, their results are more interpretable, and they were shown to have similar statistical performance than those at the level of voxels. While conducting meta-analyses, this approach facilitated the formulation of our hypotheses and helped with the interpretation of our results. Based on each component's anatomical and functional labels, we could conveniently defined functional networks in our experiments. We believe that future studies conducted with NeuroLang could benefit from its capacity to incorporate anatomical and functional atlases.

Moreover, due to the large analytical variability of results reported by neuroimaging studies [START_REF] Botvinik-Nezer | Variability in the analysis of a single neuroimaging dataset by many teams[END_REF], this data representation should account for the uncertainty surrounding neuroscientific knowledge. Probabilistic programs and databases constitute general frameworks for representing structured but uncertain knowledge. As these two paradigms reside at the heart of NeuroLang, uncertain data can be combined within its probabilistic programs. In our experiments, we modeled the reporting of functional modes and networks probabilistically, based on their volumetric proportion that is reported by studies. This probabilistic definition is arbitrary, and NeuroLang aims to be expressive enough to represent other assumptions just as well. To obtain network-based functional profiles, we further combined meta-analytic data, functional mode representations, and learned topic models that associate neuroimaging studies with data-driven psychological concepts. This made it possible to highlight the differences in the functional profiles of wellstudied functional brain networks. These examples show that NeuroLang can be used to combine various sources of data, enabling the formulation of richer neuroscientific hypotheses.

Finally, a complete meta-analytic tool should be flexible enough to represent any type of parcellation, meta-analytic database or, more generally, neuroscientific knowledge. Within our experiments, we were able to represent both the Neurosynth database and its associated openly-shared topic models in NeuroLang. But, in two of our experiments, we also used the NeuroQuery database because of its lower error-rate in the extraction of peak activation coordinates [START_REF] Dockès | NeuroQuery, comprehensive meta-analysis of human brain mapping[END_REF]. When using NeuroLang, switching from one database to another can be done seamlessly. Together, these examples demonstrate that NeuroLang is agnostic to the database used for conducting meta-analyses, and could incorporate future sources of neuroscientific knowledge.

Our related publications

Discussions

One of the main strengths of NeuroLang is that its users can focus on the description of the problem, rather than on how the solution to the problem will be computed. The computation is deferred to NeuroLang's probabilistic inference engine. The idea of describing the problem, while letting a solver figure out how to find its solution, is not new, and goes way back to the early stages of artificial intelligence and logic programming [START_REF] Sterling | The Art of Prolog[END_REF]. In fact, this ability is a direct consequence of the fact that NeuroLang is largely based on existing formalisms with well-studied semantics: datalog and its probabilistic extensions, presented in chapter 2 and chapter 3.

Since NeuroLang is based on first-order logic, variables can be used to represent general properties. In contrast, propositional logic systems are limited by the lack of logical variables, and every object must be specifically designated within the formulas. For example, Sleuth can be seen as a system for formulating either conjunctive or disjunctive propositional formulas describing inclusion / exclusion criteria, by e.g. filtering studies on a specific modality, as discussed in chapter 1. NeuroLang goes beyond that by representing knowledge as a set of first-order logical sentences containing variables that can be existentially or universally quantified, thereby ranging on an arbitrary set of objects in a domain.

The functional decoding example presented in chapter 5 uses negated existential statements to produce neuronal activation patterns specific to each topic of interest. Only one rule suffices to produce a brain map for each individual topic, segregating all the others by using a logical variable that automatically ranges over a set of expert-chosen topics, based on past literature on the frontoparietal cognitive control network. Moreover, sentences in NeuroLang can be combined to form more complex ones, which is not possible with existing tools.

Finally, NeuroLang rules can also be used to define ROIs programmatically, based on existing anatomical or functional atlases, and it all happens within the same program. The self-contained aspect of NeuroLang programs makes them easy to share, and paves the way for reproducing results of these complex analyses.

Broader Perspective on NeuroLang

NeuroLang is the ambitious project of designing a domain-specific language for cognitive neuroscience, which goes way beyond the contributions of this thesis. In particular, the work presented in this thesis focuses on applying the language to answering metaanalytic questions, while NeuroLang does not aim to be a language solely dedicated to meta-analysis.

Logic-Based Sulcal Mapping of Individual Sulci

NeuroLang contains an engine to represent three-dimensional brain regions efficiently and establish spatial relationships between them. Internally, regions are indexed in a tree of axis-aligned bounding boxes to fasten computations. Operations on brain regions include checking whether two regions overlap on a axis, or whether regions are anterior/posterior, superior/lateral, or medial/lateral to each other. The anatomical description of the regions' direction or position is given relative to the standard stereotactic anatomical planes and axes.

In work led by Antonia Machlouzarides-Shalit, we use first-order logic rules to locate individual sulci from structural magnetic resonance imaging data [START_REF] Machlouzarides-Shalit | NeuroLang: Representing neuroanatomy with sulcus-specific queries[END_REF][START_REF] Machlouzarides-Shalit | Development of subject-specific representations of neuroanatomy via a domain-specific language[END_REF]. Starting with the most stable sulci -the ones showing the less inter-subject variability in their location, also called primary sulci -the rules can uncover the names of other less stable sulci in the brain: secondary and tertiary sulci [START_REF] Machlouzarides-Shalit | A Novel Sulcal Hierarchy Based on Manually Labelled Sulci[END_REF]. This hierarchy between sulci is shown in fig. 6.2, and an example of rules defining the precentral sulcus is depicted in fig. 6 as a proxy to quantify the stability of sulci within the hierarchy, the primary ones being the most stable, therefore leading to the most robust logic-based definitions. Visualisation of sulci that were manually labelled by Antonia Machlouzarides-Shalit and Nikos Makris, and that we projected on the medial axis of the brain. We used these plots to investigate stable directions of sulci across individual brains in the STAR coordinate system [START_REF] Kandogan | Star coordinates: A multi-dimensional visualization technique with uniform treatment of dimensions[END_REF], and as a way to quantify their inter-subject stability. Red lines are the result a linear regression for each individual sulcus, and each individual sulcus is represented with a different color.

Our related publications

Our related publications

Continuous Distributions in NeuroLang

One of the end goal of NeuroLang is to be able to represent complex hierarchical continuous distributions within the language, because statistical models for cognitive neuroscience often require to model continuous distributions. Representing continuous distribution within a grounded probabilistic framework like NeuroLang would help bridging the gap between cognitive neuroscience and complex statistical modeling. Extending probabilistic logic programming languages and databases with continuous distributions is an active field of research [START_REF] Grohe | Probabilistic Data with Continuous Distributions[END_REF]. There are exciting new developments in the field of knowledge representation, that try to bridge recent deep learning models and statistical relational intelligence, such as the use of relational embeddings in probabilistic databases [START_REF] Friedman | Symbolic Querying of Vector Spaces: Probabilistic Databases Meets Relational Embeddings[END_REF]. More recently, Manhaeve et al. [START_REF] Manhaeve | Neural probabilistic logic programming in Deep-ProbLog[END_REF] integrated deep learning models within ProbLog2 programs. In the context of NeuroLang, Rouillard and Wassermann [START_REF] Rouillard | ADAVI: Automatic Dual Amortized Variational Inference Applied To Pyramidal Bayesian Models[END_REF] recently used variational inference techniques to reduce the number of parameters to learn in hierarchical Bayesian models, applying it for brain parcellation.

White Matter Query Language

Other DSLs exist within the field of brain mapping. In particular, the White Matter Query Language (WMQL), was developed by Wassermann et al. [Was+13] to help experts formally describe white matter tracts in a near-to-English syntax. WMQL could be integrated to NeuroLang in order to combine results from tractography with other modalities already supported by NeuroLang.

An Interface Closer to Human Discourse

The declarative and logic programming paradigms are not necessarily intuitive for the common cognitive neuroscience user of NeuroLang. Although NeuroLang does provide an API that is close to datalog in its syntax, it aims to provide an interface layer that is closer to human discourse. The idea is that sentences written in plain English could be translated to NeuroLang rules

Ideas for Future Work

Here I gather ideas that were not materialised as contributions. Some of these ideas are possible applications of NeuroLang, while some are direct improvements to the applications presented in the thesis.

Improvements to NeuroLang's Probabilistic Engine

When a user interacts with a NeuroLang program, each time she runs a non-liftable query, which is thus solved through knowledge compilation, the SDD representation is re-computed. One optimisation would be to cache the target representation such that if another query is ran on the same program, we can avoid grounding and building the SDD every time.

Weighting by Sample Size

Fully-automated extraction processes are currently limited in the type of annotations they can extract from studies. In contrast to Brainmap's annotations manually obtained by collaborating with taxonomy experts, databases like Neurosynth or NeuroQuery do not have the ability to differentiate between multiple experiments conducted within the same study. They also lack annotations on the types of experiments that were conducted for the study, or the brain imaging modality that was used, or whether the meta-analysis was conducted on a grey matter submask instead of the whole-brain. Moreover, they do not provide information on the sample size of each experiment, which could be used to give more weights to studies that have greater statistical power, and less to underpowered ones, resulting in more reliable meta-analytic results [START_REF] Samartsidis | The Coordinate-Based Meta-Analysis of Neuroimaging Data[END_REF]. As Ellis [START_REF] Ellis | The Essential Guide to Effect Sizes. Statistical Power, Meta-Analysis, and the Interpretation of Research Results[END_REF] puts it: "The worst way to combine the individual effect sizes is to simply average them. A far better alternative is to calculate a weighted mean effect size after each individual estimate has been corrected for measurement error. There are different procedures for weighting effect size estimates, but the easiest method, and arguably the best, is to weight estimates by their corresponding sample size.". These limitations are not attributable to NeuroLang but to the difficulty of obtaining rich annotations through an automatic process. We are currently working on integrating the Brainmap database within NeuroLang, through a collaborative license. Moreover, recent advances in deep learning language models could pave the way to a better automated annotation process of neuroimaging studies, which could then be integrated within NeuroLang.

Image-Based Meta-Analysis in NeuroLang

We gave examples of coordinate-based meta-analyses, as databases like Neurosynth contain more studies than image-based meta-analyses. We acknowledge that image-based meta-analysis will become the main paradigm, as sharing unthresholded statistical maps in repositories like NeuroVault [START_REF] Krzysztof | .org: A web-based repository for collecting and sharing unthresholded statistical maps of the human brain[END_REF], or raw data in repositories like OpenNeuro [REF]. We believe that NeuroLang is general-enough to answer image-based meta-analysis

NeuroQuery Topic Model

This is a low-hanging fruit, ready to be harvested. NeuroQuery is a cleaner database than Neurosynth, and its TFIDF features are obtained on the whole text of the studies. In contrast Neurosynth obtains them from the abstracts of the studies. This means that the NeuroQuery vocabulary is larger than the one of Neurosynth, as detailed by Dockès et al. [START_REF] Dockès | NeuroQuery, comprehensive meta-analysis of human brain mapping[END_REF], and also contains many more term-to-study associations. The same topic models that were learned on the Neurosynth database could be learned on the Neuro-Query database. I suspect that this would produce richer topic models, and would widen the range of term-based queries that could be solved on past literature. In particular, some meta-analytic queries could lead to power failure on Neurosynth but not on NeuroQuery. This is hypothetical, but easy to try because the NeuroQuery database is fully available, and many libraries for training and comparing topic models exist today1 .

Beyond the Closed-World Assumption

In this work, we always assume closed-world semantics: if a fact cannot be proven, then it is false. Open-world semantics are different in that they do not assume a fact that cannot be proven to be false. These semantics are useful for ontology querying in the context of functional brain mapping, as pointed out by Zanitti et al. [START_REF] Gaston E Zanitti | Scalable Query Answering under Uncertainty to Neuroscientific Ontological Knowledge: The NeuroLang Approach[END_REF]. Ceylan, Darwiche, and Van den Broeck [START_REF] İsmail İlkan Ceylan | Openworld probabilistic databases: Semantics, algorithms, complexity[END_REF] propose open-world semantics for probabilistic databases, proposing a dichotomy for queries on these databases such as the one proposed by Dalvi and Suciu [START_REF] Dalvi | The dichotomy of probabilistic inference for unions of conjunctive queries[END_REF] and described in chapter 3. However, when negation is part of the language, some queries can become NP-hard. It could be interesting to see if these semantics could be integrated in NeuroLang to solve some queries currently limited by the closed-world assumption.

Temporal Aspect of Meta-Analysis

Meta-analysis helps us establish the existence (or absence) of consensus within the field of functional brain mapping. What was not done in the experiments presented by this thesis was to take into account the date at which meta-analysed studies were published.

  Analysis of Functional Human Brain Mapping 1.1 Reverse-Engineering the Brain with Neuroimaging . . . . . . . . . . . . . . 1.2 Reproducibility Crisis in Cognitive Neuroscience . . . . . . . . . . . . . . . 1.3 Neuroimaging Literature Synthesis . . . . . . . . . . . . . . . . . . . . . . . 1.4 Meta-Analytic Databases and Tools . . . . . . . . . . . . . . . . . . . . . . . 1.5 Limitations of Existing Meta-Analysis Tools . . . . . . . . . . . . . . . . . . 2 Language-Oriented Knowledge Representation and Deduction 2.1 Domain-Specific Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Logic Programming with Prolog . . . . . . . . . . . . . . . . . . . . . . . . 2.3 Database Programming with Datalog . . . . . . . . . . . . . . . . . . . . . 2.4 Inherent Uncertainty of Real-World Data . . . . . . . . . . . . . . . . . . . . 3 Reasoning Under Uncertainty with Probabilistic Logic Programs 3.1 Probabilistic Logic Programming . . . . . . . . . . . . . . . . . . . . . . . . 3.2 The Weighted Model Counting Problem . . . . . . . . . . . . . . . . . . . . 3.3 Probabilistic Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 Query Evaluation on Probabilistic Databases . . . . . . . . . . . . . . . . . 3.5 Statistical Relational Artificial Intelligence . . . . . . . . . . . . . . . . . . . II Contributions 4 Question Answering System for Functional Brain Mapping Meta-Analysis 4.1 Should we Create a New Language? . . . . . . . . . . . . . . . . . . . . . . 4.2 NeuroLang's Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Representing Neuroscientific Knowledge . . . . . . . . . . . . . . . . . . . 4.4 Meta-Analytic Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5 Solving Whole-Brain Meta-Analytic Queries . . . . . . . . . . . . . . . . . . 4.6 Probabilistic Term-to-Study Associations . . . . . . . . . . . . . . . . . . . 4.7 Measuring the Statistical Significance of Results . . . . . . . . . . . . . . . 5 Applications of NeuroLang to Functional Brain Mapping Meta-Analysis 5.1 Topic Models and Functional Atlases . . . . . . . . . . . . . . . . . . . . . . 5.2 Between-Network Segregation: Reverse Inference of Brain Network Function133 5.3 Meta-Analysing the Role of the Visual Word-Form Area in Attention Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Deriving Differential Meta-Analytic Activation Patterns within the FPCN using Logical Topic Segregation Queries . . . . . . . . . . . . . . . . . . . . 5.5 Coactivation Analysis of the Functional Connectivity Differences Between Two FPCN Subnetworks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.6 Higher Specificity from Logic Segregation Queries . . . . . . . . . . . . . . 5.7 Richer Queries on Heterogeneous Uncertain Knowledge . . . . . . . . . .

Figure 1 . 1 .

 11 Figure 1.1. Brain cells in the "H01" dataset, consisting of a three-dimensional rendering of a 1mm 3 sample of human brain cortical tissue. This image is a screen capture of the open access Neuroglancer browser interface at https://ai.googleblog.com/2021/ 06/a-browsable-petascale-reconstruction-of.html.

Figure 1 . 3 .

 13 Figure 1.3. Schematic of Neurospin's very high field MRI equipment[START_REF] Vedrine | The Whole Body 11.7 T MRI Magnet for Iseult/INUMAC Project[END_REF]. Developed in partnership between CEA Saclay and Siemens, it has a powerful 11.7 Tesla magnet, which will enable us to look at the human brain at a resolution of 0.1 to 0.2mm: ten times higher resolution than most MRI equipment.

Figure 1 . 4 .

 14 Figure 1.4. Cumulative number of journal articles within the PubMed database that match the exact search terms 'neuroimaging' or 'fmri'.

Figure 1 . 6 .

 16 Figure 1.6. Cumulative number of journal articles within the PubMed database that match both exact search terms 'neuroimaging' and 'meta-analysis' simultaneously.

Figure 1 . 7 .

 17 Figure 1.7. Word clouds for several selected topics learned by Generalized Correspondence Latent Dirichlet Allocation, and distribution of activations reported by studies associated to each topic. The size of the words are proportional to their respective loading on each topic. Figure reproduced from [Rub+17].

Figure 1 . 8 .

 18 Figure 1.8. NeuroQuery's model interpolates between terms that are related to each other in order to produce brain maps for a larger set of text 'queries', even for those containing terms that are rarely used across its database. Figure reproduced from [Doc+20].

Figure 2 . 2 .

 22 Figure 2.2. Recursivity introduces cycles in dependency graphs.

Figure 2 . 3 .

 23 Figure 2.3. Constructive fixpoint resolution of a query on a datalog program.

  to be flatmates User(Jane) ← User(Andrea) ← User(Aiden) ← SleepLocation(Jane, 2 rue des Degrés) ← SleepLocation(Andrea, 2 rue des Degrés) ← SleepLocation(Aiden, 2 rue des Degrés) ← Flatmates( , ) ← ∃addr User( ) ∧ SleepLocation( , addr) ∧ User( ) ∧ SleepLocation( , addr) ∧ ≠ (3.2)

Figure 3 . 1 .

 31 Figure 3.1. Constructive illustration of the distribution semantics attributed to Sato[START_REF] Sato | A Statistical Learning Method for Logic Programs with Distribution Semantics[END_REF]. Each of the 2 + 1 possible interpretation of the probabilistic facts in the program are associated with a probability that assumes facts to be independent from one another. The probability of one particular interpretation is the product of the probabilities of each fact's truth assignment in the interpretation: if it is true, 1if it is false, where is the probability label attached to the fact. The probability of the th interpretation is denoted by . Based on a given interpretation of , the program's set of Horn clauses, denoted , are used in deductive inference to obtain the least Herbrand model for ∪ , called possible world. Each interpretation of leads to a different possible world, and is associated with a probability.

  18) ← Flatmates( , ) : freq ← User( ) ∧ User( ) ∧ SameSleepLocationFrequency( , , freq) (3.10) whose last rule defines the probabilistic Flatmate relation based on the frequency at which two users sleep at the same location.

  If = ( ) where is a database relation, and a tuple in that relation, then P[ ] = ( ), where ( ) is the probability label for tuple in the tupleindependant database. Negation If = ¬ then P[ ] = 1 -P[ ].

Figure 4 . 1 .

 41 Figure 4.1. A dwarf sitting on the shoulders of a giant, by Adrian Smith.

  Figure 4.2. Illustration of a CBMA database, where TFIDF features are extracted from the abstract or text of the studies using NLP algorithms, and where reported peak activation coordinates are extracted from the reported tables within the studies. This automatic extraction process is imperfect and leads to some noise in the data, as discussed by Yarkoni et al.[START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF] and Dockès et al.[START_REF] Dockès | NeuroQuery, comprehensive meta-analysis of human brain mapping[END_REF].

  4.5. MKDA obtains one Reported peak at location ( , , ) Voxels have a probability of being reported, based on a 3D Gaussian distribution centered at the peak location and their distance fro the peak ( ; 0, ) Activation Likelihood Estimation FWHM: typically 10mm

Figure 4 . 5 .

 45 Figure 4.5. Illustration of spatial smoothing priors used by MKDA and ALE to address the uncertainty in the location of peak activation coordinates reported by neuroimaging studies.

  VoxelReported(x, y, z, s) : p :-PeakReported(x2, y2, z2, s) & Voxel(x, y, z) & d = euclidean_distance(x, y, z, x2, y2, z2) & d < 2 * FWHM & p = gaussian(d ; 0, sigma) & FWHM = 10 & sigma = FWHM / 2 * sqrt(2 * log(2))

Figure 4 . 6 .

 46 Figure 4.6. Probability maps for the term 'emotion', obtained from the MKDA and ALE NeuroLang programs. Values are shown before any statistical test is performed. The maps are thresholded to select only the top 1% probabilities.

Figure 4 . 7 .

 47 Figure 4.7. Coactivation maps obtained from seed voxels in the dorsal part of the left CS ( = -34, = -26, = 60), the aCC ( = -2, = 46, = -4), and the lIPS ( = -26, = -58, = 48). The number of studies reporting activations within 10mm of each seed voxel was 971, 1812, and 1380 for the CS, the aCC, and the lIPS, respectively.

Figure 4 . 8 .

 48 Figure 4.8. Stratification in NeuroLang. The program's input contains both deterministic (A 1 , A 2 , and C), and probabilistic (D and E) tables. The first stratum (in green) contains a prod aggregation rule and a query-based probabilistic relation . The second stratum (in blue) contains a PER that stores the result of the probabilistic query evaluation in table 'ans'. The third stratum (in orange) aggregates the resulting probabilities by calculating their mean for each possible valuation of variables and .

Figure

  Figure 4.11.Conjunctive queries are solved in Neurosynth by hardthresholding TFIDF features to represent term-to-study associations. For a conjunction 1 ∧ 2 , only studies that have TFIDF features passing the threshold for both terms are included.

Figure 4 . 13 .

 413 Figure 4.13. Model for generating CBMA databases of size .( ) TF models term frequencies in study and follows a logisticnormal distribution. IDF computes inverse document frequencies from { ( )

Figure 4 . 15 .

 415 Figure 4.15. Comparison of both models' distributions of voxel activation consistency across 1000 sub-samples of the Neurosynth's database, for 55 two-term CQs and for multiple sample sizes. As the sample size increases, our method finds more consistent activations than Neurosynth.

  For brevity, we write P[ ( )| ( )] instead of P[ ( ) = | ( ) = ], where ( ) and ( ) are modeled as Bernoulli random variables that have a probability of being true ( ) or false (⊥) in any possible execution of the probabilistic logic program. The formula ( ) imposes conditions that select studies that will be included in a meta-analysis. To test the statistical dependence of ( ) on ( ), we use a likelihood ratio test similar to Toro, Fox, and Paus [TFP08], whose null ( 0 ) and alternative ( 1 ) hypotheses are 0 : P[ ( )| ( )] = P[ ( )|¬ ( )] = P[ ( )] (4.21) 1 : P[ ( )| ( )] ≠ P[ ( )|¬ ( )] (4.22) We define the likelihood ratio as = ℒ( 1 )/ℒ( 0 ), where ℒ( 1 ) and ℒ( 0 ) are the maximum likelihood of the observed data under the alternative and null hypotheses, defined as ℒ( 0 ) = Bin( ; , P[ ( )])Bin( -; -, P[ ( )]) (4.23) ℒ( 1 ) = Bin( ; , P[ ( )| ( )])Bin( -; -, P[ ( )|¬ ( )]) (4.24)

  RegionVolume(r, count(x, y, z) * resolution) :-RegionVoxel(r, x, y, z) & resolution = 3 NetworkVolume(n, sum(v)) :-RegionVolume(r, v) & NetworkRegion(n, r) ReportedVolume(n, s, sum(v)) :-RegionVolume(r, v) & NetworkRegion(n, r) & RegionReported(r, s) NetworkReported(n, s) : v/V :-ReportedVolume(n, s, v) & NetworkVolume(n, V)

Figure 5 .

 5 Figure 5.2. Functional profiles obtained with network-based segregation queries that identify the most probable topic associations in studies reporting activations within one network but not reporting activations within any of the other networks. A 95% confidence interval is depicted, across 1000 random 50% subsamples of the Neurosynth database[START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF].

Figure 5 . 3 .

 53 Figure 5.3. Regions of interest based on geodesic discs of 6mm radius centered at each seed location. This figure is reproduced from the one shared by Chen et al. [Che+19].

5 PFPCNFigure 5 . 5 .

 555 Figure 5.5. Comparison of the probabilities that DiFuMo-256 components coactivate with the two FPCN subnetworks. Regions are colored based on their belonging to the networks proposed by Thomas Yeo et al. [Tho+11]. Only regions exhibiting a statistically significant ( FDR < 0.05) coactivations with either subnetwork are included in the figure, based on the likelihood-ratio test and a correction for multiple comparison. P[RegionReported( )|NetworkReported(FPCN-A)] denotes the conditional probability of region being reported by studies reporting FPCN-A in the database. Probabilities are calculated on 1000 random 50% subsamples of the NeuroQuery CBMA database.

Figure 5 . 6 .

 56 Figure 5.6. DiFuMo-256 components coactivating the most with each FPCN subnetwork. In blue, we depict regions exhibiting a stronger coactivation pattern with FPCN-A. In red, we depict regions exhibiting a stronger coactivation pattern with FPCN-B. The value is the difference between region coactivation probabilities Δ = P[RegionReported( )|NetworkReported(FPCN-A)] -P[RegionReported( )|NetworkReported(FPCN-B)]. A likelihood-ratio test and a FDR correction for multiple comparison are used to select the regions that exhibit significant coactivations. Only regions within the top 90% and bottom 10% of Δ are considered to exhibit a coactivation with one network that is sufficiently stronger than with the other.

  Valentin Iovene, Majd Abdallah, Gaston Zanitti, and Demian Wassermann. "Meta-Analysis of Neuroimaging Literature with Probabilistic Logic Programming". In: working paper (2021) Majd Abdallah, Valentin Iovene, and Demian Wassermann. "Probabilistic Logic for Coordinate-Based Meta-Analysis of Functional Segregation in the Brain". In: Organization for Human Brain Mapping (OHBM). 2021 Part III Discussions and Conclusions Chapter 6

Figure 6 . 1 .

 61 Figure 6.1. First-order logic rules to define the precentral sulcus based on its spacial relationship with the central culcus and the lateral fissure. Built-in function symbols are denoted in a lowercase bold font.

Antonia

  Figure 6.3.Visualisation of sulci that were manually labelled by Antonia Machlouzarides-Shalit and Nikos Makris, and that we projected on the medial axis of the brain. We used these plots to investigate stable directions of sulci across individual brains in the STAR coordinate system[START_REF] Kandogan | Star coordinates: A multi-dimensional visualization technique with uniform treatment of dimensions[END_REF], and as a way to quantify their inter-subject stability. Red lines are the result a linear regression for each individual sulcus, and each individual sulcus is represented with a different color.

  Gaston E Zanitti, Yamil Soto, Valentin Iovene, Maria Vanina Martinez, Ricardo O Rodriguez, Gerardo I Simari, and Demian Wassermann. "Scalable Query Answering under Uncertainty to Neuroscientific Ontological Knowledge: The Neu-roLang Approach". working paper or preprint. Apr. 2021. url: https://hal. inria.fr/hal-03187887 Gaston Zanitti, Valentin Iovene, and Demian Wassermann. "Verifying ontological knowledge through meta-analysis: Study cases of Pain and Consciousness". In: OHBM 2021 -Organization for Human Brain Mapping. Virtual, France, June 2021. url: https://hal.inria.fr/hal-03216621

Figure 7 . 2 .

 72 Figure 7.2. Published work and working papers, including collaborations, within the context of this thesis.

  .2.

A B C Amygdala Insula Figure 1.2. Illustrative schema of sEEG electrodes, reproduced from Iida and Otsubo [IO17]. Electrode A is used to record electric current at the surface of a gyrus, while electrodes B and C are multicontact electrodes that can be used to record from deeper structure, such as the amygdala.

Table 1 .

 1

	Topic

2. Neurosynth topics with the 10 highest loading for study with PMID 25438046

[START_REF] Sterpenich | Ability to Maintain Internal Arousal and Motivation Modulates Brain Responses to Emotions[END_REF]

, as reported at https://neurosynth.org/studies/25438046/.

  .1.

	Input Instance		Output Instance
		over edb( )		over idb( )
	Relations		Deductive Inference		Relations
	Containing Known Facts	ℛ	Datalog Program	ℛ	Containing Inferred Facts
	Figure 2.1. A datalog program is a mapping from instances over edb( ) to instances
	over idb( ).

  The program is recursive if its dependency graph is cyclic: there is a trail in the graph such that the first and last nodes are the same. The dependency graph of the Biblical example is traced in fig.2.2a. As the relation ancestor directly depends upon itself, this creates a loop in the graph: the smallest cycle possible, with a trail of length 2. The program of fig.2.2b is also recursive, but in a less direct manner: depends on which in turn depends on . This creates a cycle between and , with a trail of length 3, as shown in fig.2.2c.

  It is important to note, however, that only certain types of constant objects can be summed together: those that implement an addition operation. Here, 45 and 27 can be added together because they are numbers. Similarly, the min and max aggregation functions require objects to live in a partially ordered set. The count aggregation function only requires constant objects to be comparable. Those requirements on objects, introduced by aggregation functions in the rules of the program, should be verified either through a static analysis of the program or at resolution time, by verifying that the type of objects that are aggregated validates the requirements imposed by the aggregation function.

	45 2 27	( , sum( )) ←	( , )	sum 2 72	(2.11)
	Aggregations
	Another wanted feature of query languages is the ability to aggregate values using func-
	tions. Languages like SQL provide a fixed set of built-in aggregation functions, such as

;[START_REF] Crookes | Using Prolog to present abstract machines[END_REF]

. It is therefore not possible to combine general function symbols and the guarantee that any query can be solved on the program. However, by enforcing safety conditions that can be syntactically checked on the rules of the program, it is possible to integrate built-in function symbols, and augment the expressivity of datalog programs for particular applications [CGT12, p. 208]. sum, count, min or max. Aggregation can be added to datalog by allowing only specific function symbols to occur in head predicates of the program's rules. In the following example, valuations of the second attribute of relation are grouped by each valuation of its first attribute and summed to obtain relation .

  This is illustrated by the program's cyclic dependency graph of fig.3.2 in which a loop can be observed. However, the ground version of the program is acyclic, as can be seen in the

	Friends		Figure 3.2. Cyclic dependency graph of the program
			modeling the probability that a user belongs to a given
	UniStudent	loop	university. Friends and UniLabel are both deterministic relations, but the UniStudent relation is both probabilistic
			and recursive.
	UniLabel

dependency graph of fig. 3.3. This is because the Friends relation, on which UniStu-Figure 3.3. Dependency graph between atoms in the grounded version of the program. Although the dependency graph between relations has a loop (and, therefore, a cycle), it does not result in a recursive ground program, where a ground atom would depend on itself. UniStudent(Sam, MIT) UniStudent(Sam, UCL) UniStudent(Noa, UCL) UniStudent(Noa, MIT) UniStudent(Riley, MIT) dent depends, does not lead to two ground UniStudent atoms depending on each other.

  table that defines a UniStudent relation

		UniStudent
	Student University P
	Aiden	MIT UCL	0.7 0.3	(3.23)
	Noa	MIT	0.1
		UCL	0.9
	Student is a key attribute while University is a non-key attribute. In the notation, we
	underline key attributes to differentiate them from non-key ones. This BID table is se-
	mantically equivalent to the following annotated disjunctions in an LPAD

UniStudent(Aiden, MIT) : 0.7 ∨ UniStudent(Aiden, UCL) : 0.3 ← UniStudent(Noa, MIT) : 0.1 ∨ UniStudent(Noa, UCL) : 0.9 ← (3.24)

  Comparison of Neurosynth's and our method's 1 scores across 55 two-term CQs on simulated CBMA databases of varying sample sizes. For each sample size, 100 random sub-samples were used. Above, 1 score distributions on all queries are compared across sample sizes. Below, 1 score matrices (white is 0, black is 1) are compared across sample sizes. The upper triangular contains scores of our method and the lower triangular contains scores of Neurosynth. The threshold = 0.1 is used in both models. The value = 300 was empirically chosen. Varying near this value does not change the results noticeably. Sample sizes were taken on a logarithmic scale.

	1 score	0.25 0.5 0.75 1	Neurosynth Our method
			0
			356 452 573 727 923 1172 1487 1887 2395 3039 3856 4893 6210 7880
					Sample size
			573	923	1487	2395	3856	7880
	memory motor pain reward social visual	Our method
	age attention faces emotion auditory	Neurosynth
	Figure 4.14.

  Zanitti, and Demian Wassermann. "Complex Coordinate-Based Meta-Analysis with Probabilistic Programming". In: Proceedings of the AAAI Conference on Artificial Intelligence 35.1 (May 2021), pp. 223-231.

	url: https://ojs.aaai.org/index.php/AAAI/article/view/16096
	4.7 Measuring the Statistical Significance of Results

  , this is expressed with the following rules

	RegionReported(r, s) :-
	PeakReported(x, y, z, s) & RegionSeedVoxel(x1, y1, z1, r)
	& d = euclidean_distance(x, y, z, x1, y1, z1) & d < 10
	NetworkReported(n, s) :-RegionReported(r, s) & NetworkRegion(n, r)
	where euclidean_distance is a built-in function that calculates the Euclidean distance
	between two coordinates in MNI space.
	Finally, to test our hypothesis, we use the following probability encoding rule
	ans(t, n, PROB) :-TopicAssociation(t, s) & SelectedStudy(s)
	// RegionReported(vwfa, s) & NetworkReported(n, s)
	& SelectedStudy(s) & ~exists(n2;
	Network(n2) & n2 != n & Study(s)
	& NetworkReported(n2, s)
	)

Term associated with studies reporting the VWFA and the 'language' network, but not reporting the frontoparietal attention network

	Term	-val (uncorrected)
	l2	0.000773
	bilinguals	0.001411
	l1	0.003706
	sublexical	0.006793
	visual word recognition	0.006987

Term associated with studies reporting the VWFA and the fronto- parietal attention network, but not reporting the 'language' network

	Term	-val (uncorrected)
	occipitotemporal cortex	0.000008
	object recognition	0.000145
	conflict detection	0.007809
	spatial processing	0.007809
	visual working memory	0.009181
	visual word recognition	0.009684
	word recognition	0.009684
	ba37	0.009684
	visual stream	0.014894
	exner	0.024605
	fonts	0.032104

Table 5 .

 5 2. Term associations surviving a likelihood ratio test ( < 0.05).

  ;[START_REF] Spreng | Intrinsic Architecture Underlying the Relations among the Default, Dorsal Attention, and Frontoparietal Control Networks of the Human Brain[END_REF]. Then, we formulate the following NeuroLang program which performs topic segregation queries, yielding an activation map for each topic separately

	SingleTopicAssociation(topic, s) :-
	TopicAssociation(topic, s) & ~exists(t;
	Topic(t) & t != topic & TopicAssociation(t, s)
	)
	ans(topic, x, y, z, PROB) :-
	VoxelReported(x, y, z, s) & SelectedStudy(s)
	// SingleTopicAssociation(topic, s) & SelectedStudy(s)

https://neurosynth.org/analyses/topics/

See https://neurosynth.org/faq/

See Sleuth's user manual: http://www.brainmap.org/sleuth/manual.pdf

See, in the code base of Neurosynth, the presence of a parameter that allows users to select studies based on their association with several terms simultaneously (conjunction), any of the terms (disjunction), or, using a less semantically interpretable selection criteria, by asking that the sum of the TFIDF features of the terms given by the user to pass a certain threshold: https://github.com/neurosynth/neurosynth/ blob/9022f1b5a9713dedc9d8836ed023aaba2a983d87/neurosynth/base/dataset.py#L701

pattern matching was recently added to the Python language through PEP 622 (see https://www. python.org/dev/peps/pep-0622/).

"Although datalog is of great theoretical importance, it is not adequate as a practical query language because of the lack of negation."[START_REF] Abiteboul | Foundations of databases[END_REF] p. 271]

Stuart Russel recounts the history of AI in a keynote at the PROBPROG 2018 conference: https://youtu.be/JzBrp5LnNCo

Note that a probabilistic fact is a unit probabilistic clause with a head predicate and a body equal to . Probabilistic clauses are more general in the sense that they allow the rule's body to be a logical formula.

].The resulting evaluation of P[ ] is independent of the order in which the rules are applied, as the same query can admit several safe plans that lead to the same probabilities. These rules can be used to construct a recursive algorithm, where each query is separated in two or more subqueries that are then evaluated[START_REF] Suciu | Probabilistic Databases[END_REF] p. 82]. The resulting plans

"The development of a new language and an accompanying toolset is a labor-intensive task. However, it is often the case that existing languages can be reused, sometimes even without adaptation."[START_REF] Karsai | Design Guidelines for Domain Specific Languages[END_REF]

see the answer to the question "What happened to the "forward inference" and "reverse inference" maps that used to be on the website?" at https://neurosynth.org/faq/

e.g. https://github.com/MIND-Lab/OCTIS

Remerciements

Conjunctive Queries

The conjunctive query (CQ) language is equivalent to the first-order logic fragment denoted FO ∃,∧ which allows variables to be existentially quantified, and restricts the set of operations in the language to conjunctions only. With abuse of language, we call a query in that language a conjunctive query (CQ). A CQ is thus defined as a conjunction of positive relational atoms

where is a set of free variables in the query that are also sometimes called head variables, are existentially quantified variables, and are sequences of terms which are either constants of the domain or logical variables in ∪ .

Solving a query on a non-recursive datalog program without union -that is, the same head literal cannot occur in multiple rules -is equivalent to solving a CQ on a deterministic database.

Union of Conjunctive Queries

The union of conjunctive queries (UCQ) language is equivalent to the positive, existential fragment of first-order logic, denoted FO ∃,∨,∧ . It extends the CQ language with the disjunction (∨) operator. A UCQ is defined as a disjunction of CQs as follows

where all are CQs.

Given a non-recursive datalog program and a query ans( ) ← ( ), the rules on which depends can be used to rewrite the query as a UCQ. For example, solving the query ans( ) ← ( ) on the program with two rules

where variables in the head literals of the rules have been unified.

Query Evaluation on Probabilistic Databases

Query evaluation in probabilistic databases corresponds to inferring the probability that a logical formula over the relations in the database is true. This is depicted in fig. 3.4.

A B C

Union of Conjunctive Queries

Task: infer probabilities

Database

Figure 3.4. Query evaluation on probabilistic databases. Given a set of probabilistic tables and a set-valued logic query ( , ), our goal is to find, for all the possible groundings of variables ( , ), the probability that ( , ) is true across all possible instances of the database.

Compiling Probabilistic Databases

Probabilistic databases can be represented as probabilistic logic programs. It is easy to see that the probabilistic relations of a tuple-independant database can be implemented in a probabilistic logic program as a set of probabilistic facts, with one probabilistic fact for each tuple in the relation. Similarly, BID tables can be implemented using probabilistic choice rules: each block in the table is implemented as an annotated disjunction of the form

2 ) :

AND node From these two joint probability distributions, the solution of the conditional query can be derived using that

, which gives the formula of eq. (4.8), for = 2.

The same can be shown for disjunctive queries P[

| ∨ ] by summing the results of 3 two-term CQs as follows meta-analytic database. This makes it possible to estimate statistics on CBMA databases using the distribution of possible outcomes of a NeuroLang program, as we discussed in the previous section.

Between-Network Segregation: Reverse Inference of Brain Network Function

In this first example, we formulate a reverse inference segregation query that derives the probability of a psychological topic being present given knowledge of activation in a par-

Topic

Likelihood Ratio Test 32_object_objects_visual 2 (1, = 455) = 15.96, FDR = 0.0065 21_reading_words_word

2 (1, = 455) = 14.4, FDR = 0.0074 Table 5.1. Topics associated with studies reporting the VWFA and the frontoparietal attention network, but not reporting the 'language' network. We only depict associations surviving a likelihood ratio test and a false discovery rate (FDR) correction for multiple comparison ( FDR < 0.05). Topics are those from Neurosynth's v5-topics-100 topic model. Out of Neurosynth's 14,371 studies, 455 report activations within the frontoparietal attention network without reporting activations within the 'language' network.

We conducted the same topic analysis, but on the opposite segregation query, selecting studies reporting the VWFA and the 'language' network but not reporting the frontoparietal attention network ( = 318). This analysis did not yield any significant topic association after correction for multiple comparison. A similar topic analysis but without excluding studies that report the frontoparietal attention network, does however yield a significant association with topic 21, linked to the 'reading words' cognitive process ( 2 (1, = 852) = 56.86, FDR = 0.000081). Since this topic association is not found statistically significant when excluding studies that report the frontoparietal attention network, one explanation could be the relative decrease in statistical power (i.e. smaller number of studies) in the segregation query compared to the non-segregation query.

Finally, we conducted a similar analysis of term-to-study associations, using terms found both in the Neurosynth and NeuroQuery databases, and defining term-to-study associations based on thresholded TFIDF features [START_REF] Yarkoni | Large-scale automated synthesis of human functional neuroimaging data[END_REF][START_REF] Dockès | NeuroQuery, comprehensive meta-analysis of human brain mapping[END_REF]. Terms related to object recognition and reading words have below-threshold uncorrected -values, but do not survive a FDR correction for multiple comparison, where the number of simultaneously tested statistical hypotheses is equal to the size of the database's vocabulary.

In table 5.2, we complement our topic-based study of the VWFA but with an analysis of raw terms within the Neurosynth database. The terms are indeed related to the topics found in our experiments: object and word recognition. However, none of these term associations survive a FDR-based correction for multiple comparison. The calculation is ran for all terms within Neurosynth's vocabulary. We conducted the same analysis on the NeuroQuery database, which contains a broader vocabulary and more term associations, and obtained similar results. Secondly, I applied NeuroLang to the specific case of the meta-analysis of functional human brain mapping research. My first contribution was to represent coordinate-based meta-analysis databases and queries within the framework of probabilistic logic programming, and prove the equivalence of the answers with existing meta-analytic tools. As I started to experiment with more complex two-term conjunctive query, which led to power failure for some of the terms, we used the idea of modeling term-to-study associations probabilistically, based on values, to increase the statistical power of our analyses. Both of these contributions were accepted for publication at the AAAI 2021 conference [START_REF] Iovene | Complex Coordinate-Based Meta-Analysis with Probabilistic Programming[END_REF], and were presented in chapter 4.

Thirdly, in a collaboration with Majd Abdallah, we applied NeuroLang in a more complex study of the brain's functional connectivity through meta-analysis, where we replicated results in the literature. In this study, we pushed the limits of meta-analysis, as we leveraged the full power of NeuroLang's representation and query evaluation engines. These contributions have been reviewed at Science Advances, are still under revision by our team [START_REF] Iovene | Meta-Analysis of Neuroimaging Literature with Probabilistic Logic Programming[END_REF], and were presented in chapter 5.