Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Logic programming
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Knowledge representation=== The use of logic to represent procedural knowledge and strategic information was one of the main goals contributing to the early development of logic programming. Moreover, it continues to be an important feature of the Prolog family of logic programming languages today. However, many applications of logic programming, including Prolog applications, increasingly focus on the use of logic to represent purely declarative knowledge. These applications include both the representation of general [[Commonsense reasoning|commonsense]] knowledge and the representation of domain specific [[Expert system|expertise]]. Commonsense includes knowledge about cause and effect, as formalised, for example, in the [[situation calculus]], [[event calculus]] and [[action language]]s. Here is a simplified example, which illustrates the main features of such formalisms. The first clause states that a fact holds immediately after an event initiates (or causes) the fact. The second clause is a ''[[frame problem|frame axiom]]'', which states that a fact that holds at a time continues to hold at the next time unless it is terminated by an event that happens at the time. This formulation allows more than one event to occur at the same time: <syntaxhighlight lang="prolog"> holds(Fact, Time2) :- happens(Event, Time1), Time2 is Time1 + 1, initiates(Event, Fact). holds(Fact, Time2) :- happens(Event, Time1), Time2 is Time1 + 1, holds(Fact, Time1), not(terminated(Fact, Time1)). terminated(Fact, Time) :- happens(Event, Time), terminates(Event, Fact). </syntaxhighlight> Here <code>holds</code> is a meta-predicate, similar to <code>solve</code> above. However, whereas <code>solve</code> has only one argument, which applies to general clauses, the first argument of <code>holds</code> is a fact and the second argument is a time (or state). The atomic formula <code>holds(Fact, Time)</code> expresses that the <code>Fact</code> holds at the <code>Time</code>. Such time-varying facts are also called [[Fluent (artificial intelligence)|fluents]]. The atomic formula <code>happens(Event, Time)</code> expresses that the Event happens at the <code>Time</code>. The following example illustrates how these clauses can be used to reason about causality in a toy [[blocks world]]. Here, in the initial state at time 0, a green block is on a table and a red block is stacked on the green block (like a traffic light). At time 0, the red block is moved to the table. At time 1, the green block is moved onto the red block. Moving an object onto a place terminates the fact that the object is on any place, and initiates the fact that the object is on the place to which it is moved: <syntaxhighlight lang="prolog"> holds(on(green_block, table), 0). holds(on(red_block, green_block), 0). happens(move(red_block, table), 0). happens(move(green_block, red_block), 1). initiates(move(Object, Place), on(Object, Place)). terminates(move(Object, Place2), on(Object, Place1)). ?- holds(Fact, Time). Fact = on(green_block,table), Time = 0. Fact = on(red_block,green_block), Time = 0. Fact = on(green_block,table), Time = 1. Fact = on(red_block,table), Time = 1. Fact = on(green_block,red_block), Time = 2. Fact = on(red_block,table), Time = 2. </syntaxhighlight> Forward reasoning and backward reasoning generate the same answers to the goal <code>holds(Fact, Time)</code>. But forward reasoning generates fluents ''progressively'' in temporal order, and backward reasoning generates fluents ''regressively'', as in the domain-specific use of [[situation calculus#Regression|regression]] in the [[situation calculus]].<ref>Reiter, R., 1991. The frame problem in the situation calculus: A simple solution (sometimes) and a completeness result for goal regression. Artificial and Mathematical Theory of Computation, 3.</ref> Logic programming has also proved to be useful for representing domain-specific expertise in [[expert system]]s.<ref>Merritt, D., 2012. Building expert systems in Prolog. Springer Science & Business Media. https://ds.amu.edu.et/xmlui/bitstream/handle/123456789/4434/%28Text%20Book%29%20Building%20Expert%20Systems%20in%20Prolog.pdf?sequence=1&isAllowed=y</ref> But human expertise, like general-purpose commonsense, is mostly implicit and [[Tacit knowledge|tacit]], and it is often difficult to represent such implicit knowledge in explicit rules. This difficulty does not arise, however, when logic programs are used to represent the existing, explicit rules of a business organisation or legal authority. For example, here is a representation of a simplified version of the first sentence of the British Nationality Act, which states that a person who is born in the UK becomes a British citizen at the time of birth if a parent of the person is a British citizen at the time of birth: <syntaxhighlight lang="prolog"> initiates(birth(Person), citizen(Person, uk)):- time_of(birth(Person), Time), place_of(birth(Person), uk), parent_child(Another_Person, Person), holds(citizen(Another_Person, uk), Time). </syntaxhighlight> Historically, the representation of a large portion of the British Nationality Act as a logic program in the 1980s<ref>{{cite journal|last1=Sergot|first1=M.J.|last2=Sadri|first2=F.|last3=Kowalski|first3=R.A.|last4=Kriwaczek|first4=F.|last5=Hammond|first5=P|last6=Cory|first6=H.T.|date=1986|url=http://www.doc.ic.ac.uk/~rak/papers/British%20Nationality%20Act.pdf|title=The British Nationality Act as a logic program|journal=[[Communications of the ACM]]|volume=29|issue=5|pages=370–386|doi=10.1145/5689.5920 |s2cid=5665107 }}</ref> was "hugely influential for the development of computational representations of legislation, showing how logic programming enables intuitively appealing representations that can be directly deployed to generate automatic inferences".<ref>{{cite journal|last1=Prakken|first1=H.|last2=Sartor|first2=G.|date=October 2015|url=https://www.sciencedirect.com/science/article/pii/S0004370215000910/pdfft?md5=4dc0cf07e5c2a6926d285431b987a859&pid=1-s2.0-S0004370215000910-main.pdf|title=Law and logic: a review from an argumentation perspective|journal=[[Artificial Intelligence (journal)|Artificial Intelligence]]|volume=227|pages=214–245|doi=10.1016/j.artint.2015.06.005|s2cid=4261497 }}</ref> More recently, the PROLEG system,<ref>Satoh, K., 2023. PROLEG: Practical legal reasoning system. In Prolog: The Next 50 Years (pp. 277-283). Cham: Springer Nature Switzerland.</ref> initiated in 2009 and consisting of approximately 2500 rules and exceptions of civil code and supreme court case rules in Japan, has become possibly the largest legal rule base in the world.<ref name=":02">{{Cite journal |last1=Körner |first1=Philipp |last2=Leuschel |first2=Michael |last3=Barbosa |first3=João |last4=Costa |first4=Vítor Santos |last5=Dahl |first5=Verónica |last6=Hermenegildo |first6=Manuel V. |last7=Morales |first7=Jose F. |last8=Wielemaker |first8=Jan |last9=Diaz |first9=Daniel |last10=Abreu |first10=Salvador |last11=Ciatto |first11=Giovanni |date=November 2022 |title=Fifty Years of Prolog and Beyond |journal=Theory and Practice of Logic Programming |language=en |volume=22 |issue=6 |pages=776–858 |doi=10.1017/S1471068422000102 |issn=1471-0684|doi-access=free |arxiv=2201.10816 }}</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Logic programming
(section)
Add topic