=Paper=
{{Paper
|id=Vol-3193/short1PLP
|storemode=property
|title=Semantics for Hybrid Probabilistic Logic Programs with Function Symbols: Technical Summary
|pdfUrl=https://ceur-ws.org/Vol-3193/short1PLP.pdf
|volume=Vol-3193
|authors=Damiano Azzolini,Fabrizio Riguzzi,Evelina Lamma
|dblpUrl=https://dblp.org/rec/conf/iclp/AzzoliniRL22
}}
==Semantics for Hybrid Probabilistic Logic Programs with Function Symbols: Technical Summary==
Semantics for Hybrid Probabilistic Logic Programs with Function Symbols: Technical Summary Damiano Azzolini1 , Fabrizio Riguzzi2 and Evelina Lamma3 1 Dipartimento di Scienze dell’Ambiente e della Prevenzione – University of Ferrara Via Borsari 46, 44121, Ferrara, Italy 2 Dipartimento di Matematica e Informatica – University of Ferrara, Via Machiavelli 30, 44121, Ferrara, Italy 3 Dipartimento di Ingegneria – University of Ferrara, Via Saragat 1, 44122, Ferrara, Italy Abstract Hybrid probabilistic logic programs extends probabilistic logic programs by adding the possibility to manage continuous random variables. Despite the maturity of the field, a semantics that unifies discrete and continuous random variables and function symbols was still missing. In this paper, we summarize the main concepts behind a new proposed semantics for hybrid probabilistic logic programs with function symbols. Keywords Probabilistic Logic Programming, Hybrid Programs, Semantics 1. Contribution This paper is a technical summary of [1]. Probabilistic Logic Programming [2] extends Logic Programming with probabilistic facts, i.e., logical atoms with an associated probability. These are usually indicated with the syntax [3]: Π :: 𝑓 where 𝑓 is an atom and Π ∈]0, 1]. Intuitively, 𝑓 is true with probability Π and false with probability 1 − Π. To illustrate probabilistic logic programs, let us start with a simple example: Example 1. Card single round. 1 1/3 :: spades(X). 2 1/2 :: clubs(X). 3 pick(0,spades) :- spades(0). 4 pick(0,clubs) :- \+ spades(0), clubs(0). 5 pick(0,hearts) :- \+ spades(0), \+ clubs(0). PLP 2022: The 9th Workshop on Probabilistic Logic Programming $ damiano.azzolini@unife.it (D. Azzolini); fabrizio.riguzzi@unife.it (F. Riguzzi); evelina.lamma@unife.it (E. Lamma) 0000-0002-7133-2673 (D. Azzolini); 0000-0003-1654-9703 (F. Riguzzi); 0000-0003-2747-4292 (E. Lamma) © 2022 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings http://ceur-ws.org ISSN 1613-0073 CEUR Workshop Proceedings (CEUR-WS.org) This program describes a game of card with only 1 round (identified with 0) and 3 cards. A player draws a card that can be either of spades, clubs, or hearts. These have all the same probability. Note that, to describe three possible cards we only need 2 (probabilistic) facts, since the third can be represented with the negation of the other two (see line 5). The predicate pick/2 describes the three possible outcomes. The probability of a query asked on the program of Example 1 is easy to compute. For example, the probability of pick(0,hearts) is (1 − 1/3) · (1 − 1/2) = 1/3. However, we can make the program more interesting by adding multiple rounds. To do this, we introduce a function symbol s/1 to the program of Example 1. Example 2. Cards with multiple rounds. We extend Example 1 by considering multiple rounds. We introduce the function symbol s/1 to indicate a round and with s(X) we indicate the round after the round X. So, starting from 0 (first round), we have s(0) for the second round, s(s(0)) for the third round and so on. We introduce an additional rule: the game stops when the player picks a card of hearts. The program thus became: 1 1/3 :: spades(X). 2 1/2 :: clubs(X). 3 pick(0,spades) :- spades(0). 4 pick(0,clubs) :- \+ spades(0), clubs(0). 5 pick(0,hearts) :- \+ spades(0), \+ clubs(0). 6 pick(s(X),spades):- \+ pick(X,hearts), spades(s(X)). 7 pick(s(X),clubs):- \+ pick(X,hearts), \+ spades(s(X)), clubs(s(X)). 8 pick(s(X),hearts):- \+ pick(X,hearts), \+ spades(s(X)), 9 \+ clubs(s(X)). 10 11 at_least_once_spades :- pick(_,spades). 12 never_spades :- \+ at_least_once_spades. A possible question could be: “what is the probability that the player picks at least one time spades?” This probability can be computed by asking the query 𝑎𝑡_𝑙𝑒𝑎𝑠𝑡_𝑜𝑛𝑐𝑒_𝑠𝑝𝑎𝑑𝑒𝑠. To compute the probability of the query 𝑎𝑡_𝑙𝑒𝑎𝑠𝑡_𝑜𝑛𝑐𝑒_𝑠𝑝𝑎𝑑𝑒𝑠 from Example 2, we need to consider pairwise incompatible covering set of explanations [4]. If we replace spades with 𝑓1 and clubs with 𝑓2 and we use 0 and 1 to indicate respectively not selected and selected, we get a pairwise incompatible covering set of explanations 𝐾 = {𝜅0 , 𝜅1 , . . .} with 𝜅0 = {(𝑓1 , {𝑋/0}, 1)} 𝜅1 = {(𝑓1 , {𝑋/0}, 0), (𝑓2 , {𝑋/0}, 1), (𝑓1 , {𝑋/𝑠(0)}, 1)} ... 𝜅𝑖 = {(𝑓1 , {𝑋/0}, 0), (𝑓2 , {𝑋/0}, 1), . . . , (𝑓1 , {𝑋/𝑠𝑖−1 (0)}, 0), (𝑓2 , {𝑋/𝑠𝑖−1 (0)}, 1), (𝑓1 , {𝑋/𝑠𝑖 (0)}, 1)} ... From here, we can compute the probability of the query 𝑞 = 𝑎𝑡_𝑙𝑒𝑎𝑠𝑡_𝑜𝑛𝑐𝑒_𝑠𝑝𝑎𝑑𝑒𝑠 as 2 1 2 (︂ )︂ (︂ )︂ 1 1 2 1 1 𝑃 (𝑞) = + · · + · · + ... 3 3 3 2 3 3 2 (︂ )︂ (︂ )︂2 1 1 1 1 1 = + · + · + ... 3 3 3 3 3 1 1 1 3 1 = · = · = 3 1 − 13 3 2 2 since we have a sum of a geometric series. We can even further extend the previous example by also considering continuous random variables. To represent these, we use the syntax 𝑎 : 𝑑𝑒𝑛𝑠𝑖𝑡𝑦 where 𝑎 is an atom and 𝑑𝑒𝑛𝑠𝑖𝑡𝑦 is a special atom that denotes its probability density. Example 3. Cards multiple rounds and continuous random variables. We extend Example 2 by adding another rule: the player still draws a card but, in addition, he/she need to spin a wheel. If the axis of the wheel is between 0 and 180 degrees the game stops. This scenario can be encoded with: 1 angle(_,X) : uniform_dens(X,0,360). 2 1/3 :: spades(X). 3 1/2 :: clubs(X). 4 pick(0,spades) :- spades(0), angle(0,V), V > 180. 5 pick(0,clubs) :- \+ spades(0), clubs(0), angle(0,V), V > 180. 6 pick(0,hearts) :- \+ spades(0), \+ clubs(0), angle(0,V), V > 180. 7 pick(s(X),spades):- \+ pick(X,hearts), spades(s(X)), angle(s(X),V), V > 180. 8 pick(s(X),clubs):- \+ pick(X,hearts), \+ spades(s(X)), clubs(s(X)), angle(s(X),V), V > 180. 9 pick(s(X),hearts):- \+ pick(X,hearts), \+ spades(s(X)), 10 \+ clubs(s(X)), angle(s(X),V), V > 180. 11 12 at_least_once_spades :- pick(_,spades). 13 never_spades :- \+ at_least_once_spades. In line 1 we have a continuous probabilistic fact angle/2 where its argument X follows a uniform distribution between 0 and 360. We may be still interested in computing the probability of the query 𝑎𝑡_𝑙𝑒𝑎𝑠𝑡_𝑜𝑛𝑐𝑒_𝑠𝑝𝑎𝑑𝑒𝑠 from Example 3. Differently from Example 2, we now need to consider a mutually disjoint covering set of worlds 𝜔. First, we partition the random variables in two sets: a countable set X of continuous random variables (identified by 0, 𝑠(0), . . . , where each element has a range [0, 360]) and a countable set Y of discrete random variables (where each element can be true or false). The set 𝜔 = 𝜔0 ∪ 𝜔1 . . . is such that: 𝜔0 = {(𝑤X , 𝑤Y ) | 𝑤X = (𝑥0 , 𝑥1 , . . .), 𝑤Y = (𝑦0𝑐 , 𝑦0𝑠 , 𝑦1𝑐 , 𝑦1𝑠 , . . .), 𝑥0 ∈]180, 360], 𝑦0𝑠 = 1} 𝜔1 = {(𝑤X , 𝑤Y ) | 𝑤X = (𝑥0 , 𝑥1 , . . .), 𝑤Y = (𝑦0𝑐 , 𝑦0𝑠 , 𝑦1𝑐 , 𝑦1𝑠 , . . .), 𝑥0 ∈]180, 360], 𝑦0𝑠 = 0, 𝑦0𝑐 = 1, 𝑥1 ∈]180, 360], 𝑦1𝑠 = 1} ... In other words: for 𝜔0 , spades was selected at round 0 (𝑦0𝑠 = 1) and the wheel (𝑥0 ) in the same round was in the range ]180, 360]; for 𝜔1 , spades was not selected at round 0 (𝑦0𝑠 = 0), clubs was selected at round 0 (𝑦0𝑐 = 1), the wheel (𝑥0 ) was in the range ]180, 360] at round 0, spades was selected at round 𝑠(0) (𝑦1𝑠 = 1) and the wheel (𝑥1 ) was in the range ]180, 360] at round 𝑠(0), and so on. The probability for each 𝜔𝑖 can be computed by multiplying the discrete and continuous components. For 𝜔0 (the process is similar for all the 𝜔𝑖 ∈ 𝜔) we have: ∫︁ 360 𝜇(𝜔0 ) = 𝜇Y ({(𝑦0𝑐 , 𝑦0𝑠 , 𝑦1𝑐 , 𝑦1𝑠 , . . .) | 𝑦0𝑐 = 1}) 𝑑𝜇X 180 ∫︁ 360 1 1 1 1 1 = · 𝑑𝑥0 = · = . 180 3 360 3 2 6 where 13 is the contribution of the discrete random variable (spades) and 360 1 is the contri- bution of the continuous one (angle). ∑︀ By considering all the values obtained for all the 𝜔𝑖 , we get 13 · 12 · ∞ 2 1 1 𝑖 1 ∞ 1 𝑖 𝑖=0 ( 6 ) = 6 · 5 = 5 as probability for the query 1 6 1 ∑︀ ( · 𝑖=0 3 2 2 · ) = 6 · at_least_once_spades. In [1], we prove that this semantics is well defined, i.e., it assigns a probability value to queries for a large class of programs. However, as discussed in [5], these programs must met some requirements, mainly needed to ensure the existence of the sets of discrete and continuous random variables. These requirements are: 1) the set of random variables must be countable; 2) clauses with the same head but different bodies must be mutually exclusive; 3) the value of a continuous random variable must be used only as a parameter for another distribution, and not as a variable for another term; 4) clauses must be range restricted (every variable in the head also appears in a positive literal in the body): this ensures that answers to queries are ground instantiations of it. For a more in-depth discussion see [5]. References [1] D. Azzolini, F. Riguzzi, E. Lamma, A semantics for hybrid probabilistic logic programs with function symbols, Artificial Intelligence 294 (2021) 103452. doi:10.1016/j.artint.2021. 103452. [2] F. Riguzzi, Foundations of Probabilistic Logic Programming: Languages, semantics, inference and learning, River Publishers, Gistrup, Denmark, 2018. [3] L. De Raedt, A. Kimmig, H. Toivonen, Problog: A probabilistic prolog and its application in link discovery, in: M. M. Veloso (Ed.), IJCAI, 2007, pp. 2462–2467. [4] F. Riguzzi, The distribution semantics for normal programs with function symbols, Interna- tional Journal of Approzimate Reasoning 77 (2016) 1–19. doi:10.1016/j.ijar.2016.05. 005. [5] D. Azzolini, F. Riguzzi, Syntactic requirements for well-defined hybrid probabilistic logic programs, in: A. Formisano, Y. A. Liu, B. Bogaerts, A. Brik, V. Dahl, C. Dodaro, P. Fodor, G. L. Pozzato, J. Vennekens, N.-F. Zhou (Eds.), Proceedings 37th International Conference on Logic Programming (Technical Communications), Open Publishing Association, Waterloo, Australia, 2021, pp. 14–26. doi:10.4204/EPTCS.345.