This document describes the implementation of a gradual polymorphic type system with standard subtyping for the logic programming language Prolog. It introduces the concept of adding types to Prolog in a gradual way, beginning with untyped programs and incrementally adding more types through type inference and user-added type signatures. The document discusses previous work on adding types to Prolog, including the Mycroft-O'Keefe type system, type inference through abstract interpretation, and gradually applying types in other languages like ActionScript and Erlang. It proposes extensions to the type system such as a subtyping hierarchy.
Computer Graphics Project Development Help with OpenGL computer graphics proj...Team Codingparks
Computer Graphics Project Development Help (OpenGL Computer Graphics Ideas and Help, C Computer Graphics Programs Ideas and Help, C++ Computer Graphics Programs Ideas and Help, Adobe Photoshop Computer Graphics Ideas and Help, Adobe Illustrator Computer Graphics Ideas and Help)
Fore More Details Visit - http://www.codingparks.com/computer-graphics-project-development-and-assignment-help/
Get OpenGL Programming Topics and Ideas to work with OpenGL Project and Assignment Help.
This session will introduce you to the new Form component in Symfony2. With the new domain-driven paradigma and its flexible design, the component opens a door to a wide range of possibilities. The brand new architecture makes creating complex forms easier and faster than ever before. This talk will teach you today what you need to know to build powerful forms tomorrow.
Computer graphics mini project on bellman-ford algorithmRAJEEV KUMAR SINGH
This is PPT of Computer graphics mini project on bellman-ford algorithm. The 6th sem Opengl Projects for VTU.
The projects demo about the Bellman-Ford algorithm, how it works using the OpenGL graphics library in MS Visual Studio.
You can get free source code for this mini projects from - http://www.openglprojects.in/2012/06/mini-project-on-bellman-ford-algorithm.html
Computer Graphics Project Development Help with OpenGL computer graphics proj...Team Codingparks
Computer Graphics Project Development Help (OpenGL Computer Graphics Ideas and Help, C Computer Graphics Programs Ideas and Help, C++ Computer Graphics Programs Ideas and Help, Adobe Photoshop Computer Graphics Ideas and Help, Adobe Illustrator Computer Graphics Ideas and Help)
Fore More Details Visit - http://www.codingparks.com/computer-graphics-project-development-and-assignment-help/
Get OpenGL Programming Topics and Ideas to work with OpenGL Project and Assignment Help.
This session will introduce you to the new Form component in Symfony2. With the new domain-driven paradigma and its flexible design, the component opens a door to a wide range of possibilities. The brand new architecture makes creating complex forms easier and faster than ever before. This talk will teach you today what you need to know to build powerful forms tomorrow.
Computer graphics mini project on bellman-ford algorithmRAJEEV KUMAR SINGH
This is PPT of Computer graphics mini project on bellman-ford algorithm. The 6th sem Opengl Projects for VTU.
The projects demo about the Bellman-Ford algorithm, how it works using the OpenGL graphics library in MS Visual Studio.
You can get free source code for this mini projects from - http://www.openglprojects.in/2012/06/mini-project-on-bellman-ford-algorithm.html
Model-Based Diagnosis of Discrete Event Systems via Automatic PlanningLUCACERIANI1
This is the talk given for my PhD. dissertation at the University of Brescia (Italy) in March 2015. The slides are integrated with notes to help the reader.
Welcome to the first live UiPath Community Day Dubai! Join us for this unique occasion to meet our local and global UiPath Community and leaders. You will get a full view of the MEA region's automation landscape and the AI Powered automation technology capabilities of UiPath. Also, hosted by our local partners Marc Ellis, you will enjoy a half-day packed with industry insights and automation peers networking.
📕 Curious on our agenda? Wait no more!
10:00 Welcome note - UiPath Community in Dubai
Lovely Sinha, UiPath Community Chapter Leader, UiPath MVPx3, Hyper-automation Consultant, First Abu Dhabi Bank
10:20 A UiPath cross-region MEA overview
Ashraf El Zarka, VP and Managing Director MEA, UiPath
10:35: Customer Success Journey
Deepthi Deepak, Head of Intelligent Automation CoE, First Abu Dhabi Bank
11:15 The UiPath approach to GenAI with our three principles: improve accuracy, supercharge productivity, and automate more
Boris Krumrey, Global VP, Automation Innovation, UiPath
12:15 To discover how Marc Ellis leverages tech-driven solutions in recruitment and managed services.
Brendan Lingam, Director of Sales and Business Development, Marc Ellis
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Enhancing Performance with Globus and the Science DMZGlobus
ESnet has led the way in helping national facilities—and many other institutions in the research community—configure Science DMZs and troubleshoot network issues to maximize data transfer performance. In this talk we will present a summary of approaches and tips for getting the most out of your network infrastructure using Globus Connect Server.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Epistemic Interaction - tuning interfaces to provide information for AI support
WLPE12
1. Introduction Background Extensions Type Inference Implementation Results Conclusion
.
Implementation of a Gradual
Polymorphic Type System with
.
Standard Subtyping for Prolog
Spyros Hadjichristodoulou
David S. Warren1
Stony Brook University
Computer Science Department
WLPE 2012
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 1 / 23
2. Introduction Background Extensions Type Inference Implementation Results Conclusion
Types in Prolog?
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 2 / 23
3. Introduction Background Extensions Type Inference Implementation Results Conclusion
Types in Prolog?
.
Theorem (Most Prolog Books)
..
Prolog is an untyped language...
.
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 2 / 23
4. Introduction Background Extensions Type Inference Implementation Results Conclusion
Types in Prolog?
.
Theorem (Most Prolog Books)
..
Prolog is an untyped language...
.
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 2 / 23
5. Introduction Background Extensions Type Inference Implementation Results Conclusion
Types in Prolog?
.
Theorem (Most Prolog Books)
..
Prolog is an untyped language...
.
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 2 / 23
6. Introduction Background Extensions Type Inference Implementation Results Conclusion
Previous works
Mycroft-O’Keefe’s type system (DEC-10)
Mercury, Visual Prolog
Type inference by abstract interpretation (Barbuti,Giacobazzi
- 1990s)
Towards typed Prolog (Schrijvers, Santos Costa, Wielemaker,
Demoen - 2009)
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 3 / 23
7. Introduction Background Extensions Type Inference Implementation Results Conclusion
Previous works
Mycroft-O’Keefe’s type system (DEC-10)
Mercury, Visual Prolog
Type inference by abstract interpretation (Barbuti,Giacobazzi
- 1990s)
Towards typed Prolog (Schrijvers, Santos Costa, Wielemaker,
Demoen - 2009)
Why do Prolog vendors still keep it type-free?
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 3 / 23
8. Introduction Background Extensions Type Inference Implementation Results Conclusion
Our vision
A Gradual Polymorphic type system with Subtyping
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 4 / 23
9. Introduction Background Extensions Type Inference Implementation Results Conclusion
Our vision
A Gradual Polymorphic type system with Subtyping
T
. ype
I
.nference
M
. ore G
. radual,
U .
. ntyped T
. ypes T
. ype I
.ncremental
P
. rogram A
. dded S
. afe P
. rocess
P
. ossibly
U
. nsafe T
. ype
C
. hecking
(
. user)
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 4 / 23
10. Introduction Background Extensions Type Inference Implementation Results Conclusion
The Mycroft-O’Keefe Type System
.
Example 1
..
:- type list(A) ---> [] ; [A|list(A)].
:- pred append(list(A),list(A),list(A)).
append([],L,L).
. append([X|L1],L2,[X|L3]) :- append(L1,L2,L3).
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 5 / 23
11. Introduction Background Extensions Type Inference Implementation Results Conclusion
The Mycroft-O’Keefe Type System
.
Example 1
..
:- type list(A) ---> [] ; [A|list(A)].
:- pred append(list(A),list(A),list(A)).
append([],L,L).
. append([X|L1],L2,[X|L3]) :- append(L1,L2,L3).
Prolog code
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 5 / 23
12. Introduction Background Extensions Type Inference Implementation Results Conclusion
The Mycroft-O’Keefe Type System
.
Example 1
..
:- type list(A) ---> [] ; [A|list(A)].
:- pred append(list(A),list(A),list(A)).
append([],L,L).
. append([X|L1],L2,[X|L3]) :- append(L1,L2,L3).
Prolog code Type constructor
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 5 / 23
13. Introduction Background Extensions Type Inference Implementation Results Conclusion
The Mycroft-O’Keefe Type System
.
Example 1
..
:- type list(A) ---> [] ; [A|list(A)].
:- pred append(list(A),list(A),list(A)).
append([],L,L).
. append([X|L1],L2,[X|L3]) :- append(L1,L2,L3).
Prolog code Type constructor Type signature
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 5 / 23
14. Introduction Background Extensions Type Inference Implementation Results Conclusion
Towards Typed Prolog (2009)
Implementation of the Mycroft-O’Keefe type system
For SWI-Prolog and YAProlog
Type checking
Interaction between typed and untyped code
Typed Prolog vs untyped Prolog
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 6 / 23
15. Introduction Background Extensions Type Inference Implementation Results Conclusion
Type inference by abstract interpretation
(1990s)
A
. bstract
P
. redicate A
. bstraction
R
. epresentation
fi
.x
Extension with type union
Able to type metapredicates (univ/2)
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 7 / 23
16. Introduction Background Extensions Type Inference Implementation Results Conclusion
ActionScript and Erlang
ActionScript:
Gradual type systems: mixing static and dynamic type
checking
User has control over portion of program statically checked
Recently added type inference
Erlang:
Dialyzer tool for static analysis
Gradually applied Dialyzer to Wrangler
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 8 / 23
17. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (1)
⊤
integer float
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 9 / 23
18. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (1)
⊤
c
number
t
t
t
) t
”
integer float
t
t
t
t
”
)
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 9 / 23
19. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (1)
⊤
c
number
t .
t Example 2
t ..
) t
” foo(42).
integer float . foo(4.2).
t
t
t
t
”
)
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 9 / 23
20. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (1)
⊤
c
number
t .
t Example 2
t ..
) t
” foo(integer).
integer float . foo(float).
t
t
t
t
”
)
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 9 / 23
21. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (1)
⊤
c
number
t .
t Example 2
t ..
) t
”
foo(number).
integer float .
t
t
t
t
”
)
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 9 / 23
22. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (2)
⊤
number atom
t £
t £
) t
”
integer float £
£
t £
t £
t c£
”
t
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 10 / 23
23. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (2)
⊤
c
atomic
t
t
)
t
”
number atom
t £
t £
) t
”
integer float £
£
t £
t £
t c£
”
t
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 10 / 23
24. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (2)
⊤
c
atomic
t
t .
)
t
” Example 3
number atom ..
t £ foo(42).
t £ foo(4.2).
) t
”
integer float £ . foo(bar).
£
t £
t £
t c£
”
t
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 10 / 23
25. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (2)
⊤
c
atomic
t
t .
)
t
” Example 3
number atom ..
t £ foo(integer).
t £ foo(float).
) t
”
integer float £ . foo(atom).
£
t £
t £
t c£
”
t
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 10 / 23
26. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (2)
⊤
c
atomic
t
t .
)
t
” Example 3
number atom ..
t £ foo(number).
t £
) t
”
integer float £ . foo(atom).
£
t £
t £
t c£
”
t
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 10 / 23
27. Introduction Background Extensions Type Inference Implementation Results Conclusion
Extensions (2)
⊤
c
atomic
t
t .
)
t
” Example 3
number atom ..
t £ foo(atomic).
t £
) t
”
integer float £ .
£
t £
t £
t c£
”
t
⊥
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 10 / 23
28. Introduction Background Extensions Type Inference Implementation Results Conclusion
The struct type
.
lookup/3
..
.
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 11 / 23
29. Introduction Background Extensions Type Inference Implementation Results Conclusion
The struct type
.
lookup/3
..
:- type list(A) --- [] ; [A|list(A)].
.
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 11 / 23
30. Introduction Background Extensions Type Inference Implementation Results Conclusion
The struct type
.
lookup/3
..
:- type list(A) --- [] ; [A|list(A)].
lookup([], ,0).
. lookup([X’=’Y|T],X,Y) :- atom(X),integer(Y),lookup(T, , ).
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 11 / 23
31. Introduction Background Extensions Type Inference Implementation Results Conclusion
The struct type
.
lookup/3
..
:- type list(A) --- [] ; [A|list(A)].
:- pred lookup(list(struct),atom,integer).
lookup([], ,0).
. lookup([X’=’Y|T],X,Y) :- atom(X),integer(Y),lookup(T, , ).
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 11 / 23
32. Introduction Background Extensions Type Inference Implementation Results Conclusion
The struct type
.
lookup/3
..
:- type list(A) --- [] ; [A|list(A)].
:- type pair(A,B) --- A (=) B.
:- pred lookup(list(struct),atom,integer).
lookup([], ,0).
. lookup([X’=’Y|T],X,Y) :- atom(X),integer(Y),lookup(T, , ).
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 11 / 23
33. Introduction Background Extensions Type Inference Implementation Results Conclusion
The struct type
.
lookup/3
..
:- type list(A) --- [] ; [A|list(A)].
:- type pair(A,B) --- A (=) B.
:- pred lookup(list(pair(atom,integer),atom,integer)).
lookup([], ,0).
. lookup([X’=’Y|T],X,Y) :- atom(X),integer(Y),lookup(T, , ).
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 11 / 23
35. Introduction Background Extensions Type Inference Implementation Results Conclusion
The cult of the bound variable
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 13 / 23
36. Introduction Background Extensions Type Inference Implementation Results Conclusion
The cult of the bound variable
Why even bother doing type inference?
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 13 / 23
37. Introduction Background Extensions Type Inference Implementation Results Conclusion
The cult of the bound variable
Why even bother doing type inference?
Similar method to “Type inference by abstract interpretation”
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 13 / 23
38. Introduction Background Extensions Type Inference Implementation Results Conclusion
The cult of the bound variable
Why even bother doing type inference?
Similar method to “Type inference by abstract interpretation”
Infrastructure taken by “Towards Typed Prolog”
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 13 / 23
39. Introduction Background Extensions Type Inference Implementation Results Conclusion
The cult of the bound variable
Why even bother doing type inference?
Similar method to “Type inference by abstract interpretation”
Infrastructure taken by “Towards Typed Prolog”
Type variables vs Prolog variables
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 13 / 23
40. Introduction Background Extensions Type Inference Implementation Results Conclusion
The cult of the bound variable
Why even bother doing type inference?
Similar method to “Type inference by abstract interpretation”
Infrastructure taken by “Towards Typed Prolog”
Type variables vs Prolog variables
A
. 2 T
.2
. .
A
. 1 T
.1
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 13 / 23
41. Introduction Background Extensions Type Inference Implementation Results Conclusion
The idea
.
General Idea
..
repeat
For a predicate H, let {H1 , . . . , Hn } be the heads of the
clauses that define it
for all Hi ∈ {H1 , . . . , Hn } do
Let Hi : −Bi be the respective clause of H
for all B ∈ Bi do
Find the type of B and accumulate variable-type bindings
for the entire clause
end for
The new type for H is the intersection of the types found
for each Hi
end for
. until No change is made to the inferred type for H
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 14 / 23
42. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Type
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
43. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 1
Type
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
44. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 1
Type
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
45. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 1
member(A,list(A))
Type
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
46. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 1
member(A,list(A))
Type
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
47. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 1
member(A,list(A)) member(B,list(C))
Type
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
48. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 1
member(A,list(A)) member(B,list(C))
Type member(A,list(A))
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
49. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 1
Type member(A,list(A))
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
50. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 2
Type member(A,list(A))
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
51. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 2
Type member(A,list(A))
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
52. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 2
member(A,list(A))
Type member(A,list(A))
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
53. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 2
member(A,list(A))
Type member(A,list(A))
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
54. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 2
member(A,list(A)) member(B,list(B))
Type member(A,list(A))
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
55. Introduction Background Extensions Type Inference Implementation Results Conclusion
An example
.
Example 4: member/2
..
:- type list(A) --- [] ; [A|list(A)].
member(X,[X| ]).
. member(X,[ |T]) :- member(X,T).
Iteration 2
member(A,list(A)) member(B,list(B))
Type member(B,list(B))
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 15 / 23
56. Introduction Background Extensions Type Inference Implementation Results Conclusion
Overview
Compile Load Execute
XSB
Disk
.P
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 16 / 23
57. Introduction Background Extensions Type Inference Implementation Results Conclusion
Overview
User
1
c
Compile Load Execute
XSB
Disk
.P
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 16 / 23
58. Introduction Background Extensions Type Inference Implementation Results Conclusion
Overview
User
1
c
Compile Load Execute
XSB
Disk
Type 2
Analysis ' .P
XSB
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 16 / 23
59. Introduction Background Extensions Type Inference Implementation Results Conclusion
Overview
User
1
c
Compile Load Execute
XSB T
3 Disk
Type 2
Analysis ' .P
XSB
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 16 / 23
60. Introduction Background Extensions Type Inference Implementation Results Conclusion
Overview
User
1
c
Compile Load Execute
XSB T 4
3 Disk
Type 2
Analysis ' .P
XSB E .xwam
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 16 / 23
61. Introduction Background Extensions Type Inference Implementation Results Conclusion
Overview
User
1
c
Compile Load Execute
XSB T 4 T
3 Disk
Type 2
Analysis ' .P 5
XSB E .xwam
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 16 / 23
62. Introduction Background Extensions Type Inference Implementation Results Conclusion
Overview
User
1
c
Compile Load 6 E Execute
XSB T 4 T
3 Disk
Type 2
Analysis ' .P 5
XSB E .xwam
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 16 / 23
63. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling
.
|?- f(X).
..
f(21).
f(42).
f(84).
.
.
Global Table
..
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 17 / 23
64. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling
.
|?- f(X).
..
f(21).
f(42).
f(84).
.
.
Global Table
..
f
. (21).
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 17 / 23
65. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling
.
|?- f(X).
..
f(21).
f(42).
f(84).
.
.
Global Table
..
f(21).
f(42).
.
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 17 / 23
66. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling
.
|?- f(X).
..
f(21).
f(42).
f(84).
.
.
Global Table
..
f(21).
f(42).
f(84).
.
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 17 / 23
67. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling with Answer Subsumption
Answer Subsumption
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 18 / 23
68. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling with Answer Subsumption
.
|?- f(X).
..
f(21).
f(42).
f(84).
.
.
Global Table
..
Answer Subsumption
Lattice operation: max/3
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 18 / 23
69. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling with Answer Subsumption
.
|?- f(X).
..
f(21).
f(42).
f(84).
.
.
Global Table
..
f(21).
. Answer Subsumption
Lattice operation: max/3
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 18 / 23
70. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling with Answer Subsumption
.
|?- f(X).
..
f(21).
f(42).
f(84).
.
.
Global Table
..
f(42).
. Answer Subsumption
Lattice operation: max/3
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 18 / 23
71. Introduction Background Extensions Type Inference Implementation Results Conclusion
Tabling with Answer Subsumption
.
|?- f(X).
..
f(21).
f(42).
f(84).
.
.
Global Table
..
f(84).
. Answer Subsumption
Lattice operation: max/3
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 18 / 23
72. Introduction Background Extensions Type Inference Implementation Results Conclusion
The code (1)
.
Type inference: tabling with answer subsumption
..
type inference n(Head,Type) :-
copy term1(Head,Type),
numbervars(Head,0, ).
type inference n(Head,Type) :-
copy term(Head,Head1),
clause(Head1,Body),
get env(Body,Env),
compute type(Env,Head1,Type1),
copy term(Type1,Type),
. numbervars(Type,0, ).
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 19 / 23
73. Introduction Background Extensions Type Inference Implementation Results Conclusion
The code (2)
.
Lattice operation: unification
..
type unify(X,Y,X1) :-
unnumbervars(X,0,X1),
unnumbervars(Y,0,Y1),
X1 = Y1,
. numbervars(X1,0, ).
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 20 / 23
74. Introduction Background Extensions Type Inference Implementation Results Conclusion
Results (1)
Name LOC # Def # Inf T(s)
lib/pairlist.P 125 10 10 0.006
lib/lists.P 515 59 59 0.022
lib/ugraphs.P 850 90 90 0.102
lib/assoc xsb.P 566 49 48 0.029
lib/ordsets.P 422 39 39 0.023
examples/tree1k.P 2046 1 1 0.105
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 21 / 23
75. Introduction Background Extensions Type Inference Implementation Results Conclusion
What’s next?
D
. eclaration Free
T .
. est/Debug
M
. odules
M
. etapredicates
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 22 / 23
76. Introduction Background Extensions Type Inference Implementation Results Conclusion
Thanks for your attention :-)
Spyros Hadjichristodoulou David S. Warren Impl. of a Gradual Pol. Type System with St. Subtyping for Prolog 23 / 23