On Applying Or-Parallelism and Tabling to Logic Programs

L
Lino PossamaiPhD, Computer Science at University of Bologna
On Applying Or-Parallelism and Tabling to Logic Programs Possamai Lino Department of Computer Science University of Venice www.possamai.it/lino Logic Programming Lecture  February 2, 2007
Introduction ,[object Object],[object Object],[object Object],[object Object]
Parallelism within Prolog ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Parallelism within Prolog ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Or-Parallelism (YapOr)
An Or-Parallelism Example p(L):-s(L,M),t(M,L). p(K):-r(K). q(1). q(2). s(2,3). s(4,5). t(3,3). t(3,2). r(1). r(3). ?- t(X,3),p(Y),q(Y). p(Y),q(Y) s(L,M),t(M,L),q(L) {X/3} {Y/L} r(K),q(K) {Y/K} t(5,4),q(4) t(3,2),q(2) {L/2,M/3} {L/4, M/5} {K/1} {K/3} q(1) q(3) W1 W1 W2 W1 W3 W2 W4 W1 q(2) Success Fail Success Fail
Or-Parallelism drawbacks ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Wam, Warren Abstract Machine ,[object Object],[object Object],PDL : area used for unification process. Trail : array of address that points to variables memorized into heap or local stack resetted upon backtracking. Stack : containts  environments  and  choice points . Heap : Memorize variables than can’t be stored in the stack. Code area : contains instruction for wam and Prolog compiled code.
How Or-Parallelism is implemented? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Environment copying ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],N2 N5 N3 N4 N1 Q P Node without alternatives Node with alternatives Alt 1 Alt 2 Alt 3 Alt 1 Alt 2 Alt 3
Tabling (YapTab)
Tabling (YapTab) ,[object Object],[object Object],[object Object],[object Object]
Tabling (YapTab) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SLG-resolution ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
?-table path. path(X,Z):-path(X,Y),path(Y,Z). path(X,Z):-arc(X,Z). arc(a,b). arc(b,c). Tabling, an example ?-path(a,Z). path(a,Y),path(Y,Z) arc(a,Z) path(b,Z) path(b,Z) path(b,Y),path(Y,Z) arc(b,Z) path(c,Z) path(c,Z) path(c,Y),path(Y,Z) arc(c,Z) {Z/b} fail fail {Z/c} fail fail fail fail path(a,Z) path(b,Z) path(c,Z) {Z/b} {Z/c} {Z/c} {Z/c} path(c,Z) fail path(a,Y),path(Y,Z) Generator Node Consumer Node Interior Node Answer Subgoal
Or-Parallelism and Tabling (OPTYap) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],An OPT Example :-table a/1. a(X):-a(X). a(X):-b(X). b(1). b(X):- … b(X):- … ?-a(X). ?- a(X). a(X) b(X) {X/1} W2 W1 a(X) {X/1}   Shared Nodes Answer Subgoal
Performance, non-tabled programs ,[object Object],[object Object],[object Object],[object Object]
Performance, tabled programs ,[object Object],[object Object]
Index / References ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
1 of 20

Recommended

2 a stacks by
2 a stacks2 a stacks
2 a stacksNguync91368
70 views19 slides
2 b queues by
2 b queues2 b queues
2 b queuesNguync91368
61 views21 slides
1 list datastructures by
1 list datastructures1 list datastructures
1 list datastructuresNguync91368
35 views24 slides
Recursion Pattern Analysis and Feedback by
Recursion Pattern Analysis and FeedbackRecursion Pattern Analysis and Feedback
Recursion Pattern Analysis and FeedbackSander Mak (@Sander_Mak)
1K views58 slides
Data structures by
Data structuresData structures
Data structuresSaurabh Mishra
20.2K views254 slides
Libro de MATLAB by
Libro de MATLABLibro de MATLAB
Libro de MATLABguestecaca7
3.8K views449 slides

More Related Content

What's hot

Chap12 scr by
Chap12 scrChap12 scr
Chap12 scrHirwanto Iwan
379 views16 slides
Matlab for beginners, Introduction, signal processing by
Matlab for beginners, Introduction, signal processingMatlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processingDr. Manjunatha. P
730 views24 slides
A recommender system for generalizing and refining code templates by
A recommender system for generalizing and refining code templatesA recommender system for generalizing and refining code templates
A recommender system for generalizing and refining code templatesCoen De Roover
843 views20 slides
New c sharp3_features_(linq)_part_iii by
New c sharp3_features_(linq)_part_iiiNew c sharp3_features_(linq)_part_iii
New c sharp3_features_(linq)_part_iiiNico Ludwig
258 views22 slides
Fundamentals of matlab by
Fundamentals of matlabFundamentals of matlab
Fundamentals of matlabNarendra Kumar Jangid
2.7K views66 slides
Unit 5 by
Unit 5Unit 5
Unit 5Vasavi College of Engg
24K views37 slides

What's hot(20)

Matlab for beginners, Introduction, signal processing by Dr. Manjunatha. P
Matlab for beginners, Introduction, signal processingMatlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processing
Dr. Manjunatha. P730 views
A recommender system for generalizing and refining code templates by Coen De Roover
A recommender system for generalizing and refining code templatesA recommender system for generalizing and refining code templates
A recommender system for generalizing and refining code templates
Coen De Roover843 views
New c sharp3_features_(linq)_part_iii by Nico Ludwig
New c sharp3_features_(linq)_part_iiiNew c sharp3_features_(linq)_part_iii
New c sharp3_features_(linq)_part_iii
Nico Ludwig258 views
Matlab-Data types and operators by Luckshay Batra
Matlab-Data types and operatorsMatlab-Data types and operators
Matlab-Data types and operators
Luckshay Batra938 views
Introduction to data structures and Algorithm by Dhaval Kaneria
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria45.6K views
4. Recursion - Data Structures using C++ by Varsha Patil by widespreadpromotion
4. Recursion - Data Structures using C++ by Varsha Patil4. Recursion - Data Structures using C++ by Varsha Patil
4. Recursion - Data Structures using C++ by Varsha Patil
widespreadpromotion3.3K views
application based Presentation on matlab simulink & related tools by Eshaan Verma
application based Presentation on matlab simulink & related toolsapplication based Presentation on matlab simulink & related tools
application based Presentation on matlab simulink & related tools
Eshaan Verma388 views
Introduction of data structure by eShikshak
Introduction of data structureIntroduction of data structure
Introduction of data structure
eShikshak8.6K views
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in... by Frank Nielsen
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...
(chapter 3) A Concise and Practical Introduction to Programming Algorithms in...
Frank Nielsen169 views

Viewers also liked

Frida kahlo presentation. mc kaylee miller. 7th hr by
Frida kahlo presentation. mc kaylee miller. 7th hrFrida kahlo presentation. mc kaylee miller. 7th hr
Frida kahlo presentation. mc kaylee miller. 7th hrmmiller24
140 views6 slides
GUERRERO PACIFISTA by
GUERRERO PACIFISTAGUERRERO PACIFISTA
GUERRERO PACIFISTASamanta Tapia
159 views2 slides
Voluntary Employee Benefits by
Voluntary Employee BenefitsVoluntary Employee Benefits
Voluntary Employee Benefitssgarrett
595 views14 slides
Slashdot.Org by
Slashdot.OrgSlashdot.Org
Slashdot.OrgLino Possamai
532 views10 slides
Opendag zaterdag 17 maart 2012 otc opleiding & trainingen curacao tony lin... by
Opendag zaterdag 17 maart 2012   otc opleiding & trainingen curacao  tony lin...Opendag zaterdag 17 maart 2012   otc opleiding & trainingen curacao  tony lin...
Opendag zaterdag 17 maart 2012 otc opleiding & trainingen curacao tony lin...OTC Opleiding & Trainingen Curaçao
376 views1 slide
Novo modelo do relatório de responsabilidade socioambiental sff - ganin by
Novo modelo do relatório de responsabilidade socioambiental   sff - ganinNovo modelo do relatório de responsabilidade socioambiental   sff - ganin
Novo modelo do relatório de responsabilidade socioambiental sff - ganinFrancis Zeman
634 views7 slides

Viewers also liked(17)

Frida kahlo presentation. mc kaylee miller. 7th hr by mmiller24
Frida kahlo presentation. mc kaylee miller. 7th hrFrida kahlo presentation. mc kaylee miller. 7th hr
Frida kahlo presentation. mc kaylee miller. 7th hr
mmiller24140 views
Voluntary Employee Benefits by sgarrett
Voluntary Employee BenefitsVoluntary Employee Benefits
Voluntary Employee Benefits
sgarrett595 views
Novo modelo do relatório de responsabilidade socioambiental sff - ganin by Francis Zeman
Novo modelo do relatório de responsabilidade socioambiental   sff - ganinNovo modelo do relatório de responsabilidade socioambiental   sff - ganin
Novo modelo do relatório de responsabilidade socioambiental sff - ganin
Francis Zeman634 views
Spanish presentation by rjacky101
Spanish presentationSpanish presentation
Spanish presentation
rjacky101353 views
Para que con tus santos te alabe by monica eljuri
Para que con tus santos te alabePara que con tus santos te alabe
Para que con tus santos te alabe
monica eljuri791 views
Uprising at Akwesasne by Dr Rugenstein by Ernest Rugenstein
Uprising at Akwesasne by Dr RugensteinUprising at Akwesasne by Dr Rugenstein
Uprising at Akwesasne by Dr Rugenstein
Ernest Rugenstein2.2K views
HBX Acceptance Letter by Xiao Zheng
HBX Acceptance LetterHBX Acceptance Letter
HBX Acceptance Letter
Xiao Zheng328 views
Beeline RPO Dossier by mariag888
Beeline RPO DossierBeeline RPO Dossier
Beeline RPO Dossier
mariag8885.8K views
ENSAYO, PEDRO SANCHEZ ESCOBESDO CAPITULO 1 by Samanta Tapia
ENSAYO, PEDRO SANCHEZ ESCOBESDO CAPITULO 1ENSAYO, PEDRO SANCHEZ ESCOBESDO CAPITULO 1
ENSAYO, PEDRO SANCHEZ ESCOBESDO CAPITULO 1
Samanta Tapia244 views
Online Classified Ad in Newspaper Whitianga, Mercury Bay | the Mercury Bay In... by theinformer119
Online Classified Ad in Newspaper Whitianga, Mercury Bay | the Mercury Bay In...Online Classified Ad in Newspaper Whitianga, Mercury Bay | the Mercury Bay In...
Online Classified Ad in Newspaper Whitianga, Mercury Bay | the Mercury Bay In...
theinformer1191.3K views
Machine Learning and Data Mining: 08 Clustering: Hierarchical by Pier Luca Lanzi
Machine Learning and Data Mining: 08 Clustering: Hierarchical Machine Learning and Data Mining: 08 Clustering: Hierarchical
Machine Learning and Data Mining: 08 Clustering: Hierarchical
Pier Luca Lanzi3.5K views
HERENCIA MATERNA O MITOCONDRIAL by Samanta Tapia
HERENCIA MATERNA O MITOCONDRIALHERENCIA MATERNA O MITOCONDRIAL
HERENCIA MATERNA O MITOCONDRIAL
Samanta Tapia16.7K views

Similar to On Applying Or-Parallelism and Tabling to Logic Programs

Control system Lab record by
Control system Lab record Control system Lab record
Control system Lab record Yuvraj Singh
6.3K views37 slides
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO... by
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...IJCI JOURNAL
12 views13 slides
Rapport_Cemracs2012 by
Rapport_Cemracs2012Rapport_Cemracs2012
Rapport_Cemracs2012Jussara F.M.
273 views13 slides
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A... by
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...Erica Thompson
2 views8 slides
GRAPH MATCHING ALGORITHM FOR TASK ASSIGNMENT PROBLEM by
GRAPH MATCHING ALGORITHM FOR TASK ASSIGNMENT PROBLEMGRAPH MATCHING ALGORITHM FOR TASK ASSIGNMENT PROBLEM
GRAPH MATCHING ALGORITHM FOR TASK ASSIGNMENT PROBLEMIJCSEA Journal
16 views14 slides
Parallel algorithms by
Parallel algorithmsParallel algorithms
Parallel algorithmsDanish Javed
4.2K views29 slides

Similar to On Applying Or-Parallelism and Tabling to Logic Programs(20)

Control system Lab record by Yuvraj Singh
Control system Lab record Control system Lab record
Control system Lab record
Yuvraj Singh6.3K views
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO... by IJCI JOURNAL
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...
BARRACUDA, AN OPEN SOURCE FRAMEWORK FOR PARALLELIZING DIVIDE AND CONQUER ALGO...
IJCI JOURNAL12 views
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A... by Erica Thompson
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...
A Modified Chaotic Firefly Algorithm For Solving Discrete Logarithm Problem A...
Erica Thompson2 views
GRAPH MATCHING ALGORITHM FOR TASK ASSIGNMENT PROBLEM by IJCSEA Journal
GRAPH MATCHING ALGORITHM FOR TASK ASSIGNMENT PROBLEMGRAPH MATCHING ALGORITHM FOR TASK ASSIGNMENT PROBLEM
GRAPH MATCHING ALGORITHM FOR TASK ASSIGNMENT PROBLEM
IJCSEA Journal16 views
Parallel algorithms by Danish Javed
Parallel algorithmsParallel algorithms
Parallel algorithms
Danish Javed4.2K views
Group Project by Xiyuan Sun
Group ProjectGroup Project
Group Project
Xiyuan Sun176 views
Functional Programming in Scala: Notes by Roberto Casadei
Functional Programming in Scala: NotesFunctional Programming in Scala: Notes
Functional Programming in Scala: Notes
Roberto Casadei1.6K views
A Domain-Specific Embedded Language for Programming Parallel Architectures. by Jason Hearne-McGuiness
A Domain-Specific Embedded Language for Programming Parallel Architectures.A Domain-Specific Embedded Language for Programming Parallel Architectures.
A Domain-Specific Embedded Language for Programming Parallel Architectures.
Deep learning concepts by Joe li
Deep learning conceptsDeep learning concepts
Deep learning concepts
Joe li30 views
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe... by Raffi Khatchadourian
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
A review of automatic differentiationand its efficient implementation by ssuserfa7e73
A review of automatic differentiationand its efficient implementationA review of automatic differentiationand its efficient implementation
A review of automatic differentiationand its efficient implementation
ssuserfa7e73110 views
Parallel algorithms by guest084d20
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d207.9K views
ScalaDays 2013 Keynote Speech by Martin Odersky by Typesafe
ScalaDays 2013 Keynote Speech by Martin OderskyScalaDays 2013 Keynote Speech by Martin Odersky
ScalaDays 2013 Keynote Speech by Martin Odersky
Typesafe 14.1K views

More from Lino Possamai

Music Motive @ H-ack by
Music Motive @ H-ack Music Motive @ H-ack
Music Motive @ H-ack Lino Possamai
727 views5 slides
Metodi matematici per l’analisi di sistemi complessi by
Metodi matematici per l’analisi di sistemi complessiMetodi matematici per l’analisi di sistemi complessi
Metodi matematici per l’analisi di sistemi complessiLino Possamai
634 views58 slides
Multidimensional Analysis of Complex Networks by
Multidimensional Analysis of Complex NetworksMultidimensional Analysis of Complex Networks
Multidimensional Analysis of Complex NetworksLino Possamai
708 views59 slides
Optimization of Collective Communication in MPICH by
Optimization of Collective Communication in MPICH Optimization of Collective Communication in MPICH
Optimization of Collective Communication in MPICH Lino Possamai
1.5K views21 slides
A static Analyzer for Finding Dynamic Programming Errors by
A static Analyzer for Finding Dynamic Programming ErrorsA static Analyzer for Finding Dynamic Programming Errors
A static Analyzer for Finding Dynamic Programming ErrorsLino Possamai
959 views13 slides
Cure, Clustering Algorithm by
Cure, Clustering AlgorithmCure, Clustering Algorithm
Cure, Clustering AlgorithmLino Possamai
19.9K views19 slides

More from Lino Possamai(6)

Metodi matematici per l’analisi di sistemi complessi by Lino Possamai
Metodi matematici per l’analisi di sistemi complessiMetodi matematici per l’analisi di sistemi complessi
Metodi matematici per l’analisi di sistemi complessi
Lino Possamai634 views
Multidimensional Analysis of Complex Networks by Lino Possamai
Multidimensional Analysis of Complex NetworksMultidimensional Analysis of Complex Networks
Multidimensional Analysis of Complex Networks
Lino Possamai708 views
Optimization of Collective Communication in MPICH by Lino Possamai
Optimization of Collective Communication in MPICH Optimization of Collective Communication in MPICH
Optimization of Collective Communication in MPICH
Lino Possamai1.5K views
A static Analyzer for Finding Dynamic Programming Errors by Lino Possamai
A static Analyzer for Finding Dynamic Programming ErrorsA static Analyzer for Finding Dynamic Programming Errors
A static Analyzer for Finding Dynamic Programming Errors
Lino Possamai959 views
Cure, Clustering Algorithm by Lino Possamai
Cure, Clustering AlgorithmCure, Clustering Algorithm
Cure, Clustering Algorithm
Lino Possamai19.9K views

Recently uploaded

Voice Logger - Telephony Integration Solution at Aegis by
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at AegisNirmal Sharma
39 views1 slide
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院IttrainingIttraining
58 views8 slides
Kyo - Functional Scala 2023.pdf by
Kyo - Functional Scala 2023.pdfKyo - Functional Scala 2023.pdf
Kyo - Functional Scala 2023.pdfFlavio W. Brasil
400 views92 slides
PRODUCT PRESENTATION.pptx by
PRODUCT PRESENTATION.pptxPRODUCT PRESENTATION.pptx
PRODUCT PRESENTATION.pptxangelicacueva6
15 views1 slide
Serverless computing with Google Cloud (2023-24) by
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)wesley chun
11 views33 slides
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc
11 views29 slides

Recently uploaded(20)

Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院 by IttrainingIttraining
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
【USB韌體設計課程】精選講義節錄-USB的列舉過程_艾鍗學院
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc11 views
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2218 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson92 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
HTTP headers that make your website go faster - devs.gent November 2023 by Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn22 views
STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 views
Powerful Google developer tools for immediate impact! (2023-24) by wesley chun
Powerful Google developer tools for immediate impact! (2023-24)Powerful Google developer tools for immediate impact! (2023-24)
Powerful Google developer tools for immediate impact! (2023-24)
wesley chun10 views
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva

On Applying Or-Parallelism and Tabling to Logic Programs

  • 1. On Applying Or-Parallelism and Tabling to Logic Programs Possamai Lino Department of Computer Science University of Venice www.possamai.it/lino Logic Programming Lecture February 2, 2007
  • 2.
  • 3.
  • 4.
  • 6. An Or-Parallelism Example p(L):-s(L,M),t(M,L). p(K):-r(K). q(1). q(2). s(2,3). s(4,5). t(3,3). t(3,2). r(1). r(3). ?- t(X,3),p(Y),q(Y). p(Y),q(Y) s(L,M),t(M,L),q(L) {X/3} {Y/L} r(K),q(K) {Y/K} t(5,4),q(4) t(3,2),q(2) {L/2,M/3} {L/4, M/5} {K/1} {K/3} q(1) q(3) W1 W1 W2 W1 W3 W2 W4 W1 q(2) Success Fail Success Fail
  • 7.
  • 8.
  • 9.
  • 10.
  • 12.
  • 13.
  • 14.
  • 15. ?-table path. path(X,Z):-path(X,Y),path(Y,Z). path(X,Z):-arc(X,Z). arc(a,b). arc(b,c). Tabling, an example ?-path(a,Z). path(a,Y),path(Y,Z) arc(a,Z) path(b,Z) path(b,Z) path(b,Y),path(Y,Z) arc(b,Z) path(c,Z) path(c,Z) path(c,Y),path(Y,Z) arc(c,Z) {Z/b} fail fail {Z/c} fail fail fail fail path(a,Z) path(b,Z) path(c,Z) {Z/b} {Z/c} {Z/c} {Z/c} path(c,Z) fail path(a,Y),path(Y,Z) Generator Node Consumer Node Interior Node Answer Subgoal
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.