Chapter 1: Programming for Artificial Intelligence and Machine Learning: Introduction to SWI-Prolog

Ron McFarland PhD
20 min readJun 12, 2023

--

SWI-Prolog Logo

A note about this series on SWI-Prolog programming

A long time ago, in a distant era, I took Prolog Programming as a part of my doctoral coursework. Back in the day (yes, it was quite some time ago), Prolog used more localized data (files, data stores, etc.). With the advent of AI in the news (think ChatGPT) and the burgeoning “pools” and other globally available data sources (think “data science”), I will be creating a series of SWI Prolog chapters for your learning. Give me a few weeks per chapter. And… if you do use this material, please cite me and this link. So here goes…

Overview

Artificial Intelligence and Machine Learning have been around for about 40 years. While Artificial Intelligence (AI) and Machine Learning (ML) have been around for several decades, their recent surge in popularity can be attributed to several factors:

1. Increase in Data Availability: With the proliferation of digital technologies and the internet, vast amounts of data are generated daily. Data is the fuel for AI and ML algorithms, and the availability of big data has created new opportunities to extract valuable insights, make accurate predictions, and develop sophisticated AI systems.

2. Advancements in Computing Power: AI and ML algorithms often require substantial computational resources, especially when dealing with complex models and large datasets. The exponential growth in computing power, driven by factors such as Moore’s Law and the development of specialized hardware (e.g., GPUs), has made it more feasible to train and deploy AI models at scale.

3. Algorithmic Innovations: Researchers and practitioners have made significant advancements in AI and ML algorithms over the years. Breakthroughs in areas like deep learning, reinforcement learning, and natural language processing have led to remarkable improvements in the accuracy and performance of AI systems. These advancements have spurred interest and excitement around AI and ML.

4. Industry Applications and Success Stories: AI and ML have demonstrated their practical value in solving real-world problems across various industries. From image recognition and speech synthesis to recommendation systems and autonomous vehicles, there have been numerous success stories showcasing the transformative impact of AI and ML. Such applications have sparked widespread interest and investment in these technologies.

5. Open Source Communities and Libraries: The growth of open source communities and the availability of robust ML libraries and frameworks (e.g., TensorFlow, PyTorch, scikit-learn) have democratized access to AI and ML tools. These resources have made it easier for developers, researchers, and enthusiasts to experiment, learn, and apply AI and ML techniques to their projects.

6. Business Potential and Economic Impact: AI and ML have significant potential to drive innovation, improve efficiency, and create new business opportunities. Many organizations recognize the strategic value of AI and ML in gaining a competitive edge, optimizing processes, and delivering personalized experiences to customers. AI’s economic impact and potential to reshape industries have drawn considerable attention and investment.

7. Media Coverage and Hype: The popularization of AI and ML in mainstream media has increased visibility and public interest. News outlets frequently report on breakthroughs, AI applications, and the potential implications of these technologies, further fueling curiosity and excitement among the general public.

The convergence of these factors has led to the current popularity and accelerated adoption of AI and ML. The advancements, data availability, success stories, and economic potential have created a virtuous cycle of innovation and interest, driving the widespread attention and enthusiasm surrounding AI and ML today.

Reasons to learn about AI and ML programming.

There are several compelling reasons to learn about AI and Machine Learning (ML) programming:

1. Increasing Demand: AI and Machine Learning are experiencing rapid growth and high industry demand. Organizations seek professionals who can develop AI-based solutions, analyze data, and make data-driven decisions. By learning AI and Machine Learning, you can position yourself for exciting career opportunities in data science, AI engineering, research, and development.

2. Problem-Solving: AI and Machine Learning provide powerful tools for solving complex problems and making predictions based on data. Understanding these concepts allows you to approach real-world challenges from a data-driven perspective and develop innovative solutions. Whether developing intelligent systems, optimizing processes, or extracting insights from large datasets, AI and Machine Learning skills can help you tackle many problems.

3. Future Technology Trends: AI and Machine Learning are at the forefront of technological advancements. From autonomous vehicles and robotics to natural language processing and personalized recommendations, AI and Machine Learning technologies are shaping the future. By learning about these fields, you stay up-to-date with the latest technological trends and position yourself to take advantage of future opportunities.

4. Enhancing Data Analysis Skills: AI and Machine Learning heavily rely on analyzing and interpreting large volumes of data. By learning these fields, you develop strong data analysis skills, including data preprocessing, feature selection, and model evaluation. These skills are highly transferrable and valuable in various domains, enabling you to extract insights and make informed decisions from data.

5. Entrepreneurial Opportunities: AI and Machine Learning provide a foundation for building innovative products and startups. By acquiring knowledge in these areas, you gain the ability to identify business opportunities and create AI-driven solutions that address specific market needs. This entrepreneurial mindset can empower you to launch your own ventures or contribute to startups in the AI and technology space.

6. Ethical Considerations: AI and Machine Learning raise important ethical and societal considerations. Learning about these fields enables you to understand the potential impact of AI systems on privacy, bias, fairness, and transparency. By having a solid understanding of the underlying principles and techniques, you can contribute to responsible and ethical AI development and deployment.

7. Continuous Learning and Intellectual Growth: AI and Machine Learning are intellectually stimulating constantly evolving fields. Learning about them requires continuous learning and staying updated with the latest research and developments. Engaging with AI and Machine Learning keeps your mind active, fosters curiosity, and encourages lifelong learning.

Whether you’re interested in pursuing a career in AI, leveraging data for better decision-making, or simply staying informed about the latest advancements in technology, learning about AI and Machine Learning can open doors to exciting opportunities and expand your intellectual horizons.

Artificial Intelligence and Machine Learning

Artificial Intelligence (AI) and Machine Learning (ML) are closely related fields that have gained significant attention recently. Here’s a general background on AI and ML:

· Artificial Intelligence: Artificial Intelligence refers to developing computer systems or machines that can perform tasks that typically require human intelligence. AI aims to create intelligent systems that can perceive their environment, reason, learn, and make decisions to achieve specific goals. AI encompasses various subfields, including machine learning, natural language processing, computer vision, expert systems, and robotics.

· Machine Learning: Machine Learning is a subset of AI that focuses on enabling computers to learn and make predictions or decisions without being explicitly programmed. It involves developing algorithms and statistical models that can automatically learn patterns and relationships from data and use them to make accurate predictions or take actions. Machine Learning algorithms are designed to improve their performance through experience, typically by analyzing large datasets.

Key Concepts in Machine Learning:

1. Training Data: Machine Learning algorithms require large amounts of training data, which is used to learn patterns and relationships. The quality and quantity of training data greatly impact the model’s performance.

2. Features and Labels: Features are the measurable characteristics or attributes of the data, while labels represent the target variable or the outcome to be predicted.

3. Supervised Learning: The training data includes input features and corresponding labels in supervised learning. The model learns from this labeled data to predict new, unseen data.

4. Unsupervised Learning: Unsupervised learning involves training algorithms on unlabeled data to discover patterns or structures within the data. It is useful for clustering, dimensionality reduction, and anomaly detection tasks.

5. Neural Networks: Neural networks are a class of machine learning models inspired by the structure and function of the human brain. They consist of interconnected layers of artificial neurons that process and learn from data.

6. Deep Learning: Deep Learning is a subfield of machine learning that focuses on training deep neural networks with many layers. Deep Learning has achieved remarkable success in tasks such as image recognition, natural language processing, and speech recognition.

7. Model Evaluation and Deployment: Machine Learning models need to be evaluated on unseen data to assess their performance and generalization capabilities. Once a model is trained and evaluated, it can be deployed to make predictions on new data in real-world applications.

Applications of AI and ML:

AI and ML have a wide range of applications across various industries, including:

- Image and speech recognition

- Natural language processing and understanding

- Autonomous vehicles and robotics

- Fraud detection and cybersecurity

- Recommender systems

- Healthcare and medical diagnostics

- Financial analysis and prediction

- Predictive maintenance

- Personalized marketing and customer segmentation

AI and ML are constantly evolving, driven by advances in computing power, availability of large datasets, and algorithm breakthroughs. The development of AI and ML technologies holds great potential for transforming industries and shaping the future of technology.

Learning SWI-Prolog

There are several compelling reasons to consider learning SWI-Prolog:

1. Logic Programming Paradigm: SWI-Prolog is a widely used implementation of Prolog, a logic programming language. Learning Prolog introduces you to a unique paradigm focusing on declarative programming and logical reasoning. Prolog’s emphasis on pattern matching, backtracking, and rule-based programming can expand your problem-solving skills and broaden your programming horizons.

2. Versatility and Expressiveness: Prolog, including SWI-Prolog, offers a high level of expressiveness and versatility. It excels in artificial intelligence, natural language processing, expert systems, and constraint programming. With its powerful pattern-matching and rule-based inference capabilities, Prolog can tackle complex problems that are challenging to solve using other programming languages.

3. Proximity to Human Reasoning: Prolog’s logical foundations make it well-suited for modeling human reasoning processes. By learning SWI-Prolog, you can develop a deeper understanding of logic and gain insights into how humans approach problem-solving and decision-making. This can be valuable for cognitive science, linguistics, and philosophy.

4. AI and Expert Systems: Prolog has been extensively used in the field of artificial intelligence (AI) for knowledge representation, rule-based systems, and expert systems. SWI-Prolog’s extensive set of libraries, tools, and support for external connectivity make it a powerful platform for developing AI applications. Learning SWI-Prolog can equip you with highly relevant skills in the AI domain.

5. Prolog as a Scripting Language: SWI-Prolog can also be used as a scripting language for rapid prototyping, automation tasks, and scripting purposes. Its concise syntax, built-in database capabilities, and support for file I/O make it a convenient choice for various scripting scenarios. If you are already familiar with other programming languages, adding Prolog to your skill set can provide you with an additional tool for scripting needs.

6. Active Community and Resources: SWI-Prolog benefits from an active community of users and contributors. You can access many resources, including documentation, tutorials, libraries, and forums, to support your learning journey and development projects. The community-driven nature of SWI-Prolog ensures ongoing support and updates to the language and its ecosystem.

7. Cross-Platform Compatibility: SWI-Prolog is available on multiple platforms, including Windows, macOS, Linux, and Unix-like systems. This cross-platform compatibility allows you to write Prolog programs that can run on different operating systems without major modifications, enhancing the portability and flexibility of your code.

Learning SWI-Prolog can open up new perspectives in programming, problem-solving, and AI development. It provides unique tools and techniques to complement your existing skills and broaden your opportunities in various domains.

What is Prolog?

Prolog is a high-level programming language primarily associated with artificial intelligence and computational linguistics. Prolog stands for “PROgramming in LOGic”, and it’s one of the most common languages used for logic programming.

Unlike most other programming languages based on imperative or procedural paradigms, Prolog is based on first-order logic. A Prolog program consists of a series of “clauses,” which are either facts (which state things that are unconditionally true) or rules (which state conditions under which certain things are true). Prolog’s syntax and semantics are designed to make it easy to express complex logical relationships and to perform automated reasoning about those relationships.

Prolog is known for its pattern-matching capabilities and ability to backtrack and try different solutions when necessary automatically. It suits theorem proving, expert systems, and natural language processing tasks. Prolog also supports list handling and has features that allow for flexible and dynamic data structures.

Despite being less commonly used for general-purpose programming, Prolog is still widely used in research and education, particularly in AI and computational linguistics. It’s also used in specialized databases, graphical interfaces, and networked applications. Some variants of Prolog are used in commercial systems and in industry.

What is SWI-Prolog

SWI-Prolog is a flexible Prolog language implementation. Although it’s widely used in educational settings, its evolution is primarily influenced by application development needs. It features a comprehensive interface connecting various IT components, supporting many document types and network protocols. SWI-Prolog also provides an extensive low-level C interface that forms the foundation for high-level interfaces with C++, Java (included), C#, Python, Rust, and more (available externally). It supports advanced data types, like dicts and strings, and offers full support for Unicode and unbounded integers, making data exchange with other components effortless.

Scalability is a key focus of SWI-Prolog. It offers sturdy multi-threading support, allowing efficient use of multi-core hardware and straightforward integration in concurrent applications. The Just In Time Indexing (JITI) feature ensures efficient support for predicates comprising millions of clauses.

SWI-Prolog incorporates several extensions to the core language that have emerged from the Prolog community, such as tabling, constraints, global variables, destructive assignment, delimited continuations, and interactors.

For development, SWI-Prolog offers a diverse range of tools. The native system includes an Emacs-like editor coded in Prolog, featuring semantic highlighting based on real-time code analysis. Other tools encompass a graphical debugger, profiler, coverage analysis, and cross-reference. There are also additional modes available for GNU-Emacs, an Eclipse plugin called PDT, and a VSC plugin. These can be combined with native graphical tools. A computational notebook and web-based IDE, SWISH, is also provided, highly customizable for various scenarios.

SWI-Prolog introduces an add-on distribution and installation mechanism known as packs. A pack is a directory with minimal organization guidelines and a control file indicating its origin, version, dependencies, and auto-upgrade support. Packs can be installed from an archive, GIT repository, or URL using pack_install/1. They serve as a medium for code sharing within the community, leading to the growth of ecosystem handling types, coroutine, and more.

Server Applications

SWI-Prolog comes with a comprehensive web server (HTTP) framework, suitable for offering (REST) services as well as creating end-user applications built on HTML5, CSS, and JavaScript. It utilizes Prolog engines (Pengines), enabling clients to execute queries against client-provided programs on a remote server through a universal API, with the capability to run such programs in a sandboxed environment.

For server support, particularly web servers, SWI-Prolog leverages scalable multi-threading. This feature was proven effective by an 80-fold speed increase observed on a 128-core PowerPC system. As such, SWI-Prolog becomes a favorable choice for CPU-heavy server tasks where numerous clients require access to a large, potentially dynamic, shared dataset. Unlike many other high-level languages like Python and Node.js that only utilize a single core and switch tasks based on blocking I/O, SWI-Prolog’s approach is different. Although single-core languages usually provide satisfactory resource usage for I/O-intensive services with many connections, any task blocked on a computation would delay all other clients. As SWI-Prolog’s global garbage collectors for atoms and removed dynamic clauses operate fully asynchronously in a dedicated thread, it exhibits excellent (soft) real-time behavior.

One of SWI-Prolog’s unique features is its ability to reduce the need for server restarts when correcting bugs or injecting diagnostic code. Its incremental compilation and typically local and back trackable data structures (undo) allow for program patching without needing restarting. Furthermore, SWI-Prolog can safely reload running code from another thread as long as the signature of the running predicates remains unchanged. This means that while you’re allowed to add, remove, or modify clauses, you’re not allowed to add, remove, or reorder arguments. Nevertheless, this feature benefits hot-fixing servers or injecting diagnostic code into a server without a restart.

Prolog can be considered a unifying language

While Prolog is often seen as a specific-purpose language predominantly for rule evaluation tasks, we view it primarily as an effective platform for bridging different components. This viewpoint is motivated by the fact that data forms the foundation of many contemporary applications, and this data is characterized by considerable variety in its structure and storage. Traditional query languages, such as SQL, SPARQL, XPATH, etc., can handle only one format, whereas Prolog offers a succinct and intuitive query language for each format. These queries can be executed directly or compiled into specific query language expressions. Prolog’s relational paradigm is particularly compatible with tabular data (RDBMS), and its optimized support for recursive code aligns well with tree and graph-shaped data (RDF).

Prolog serves as an apt language for Domain Specific Languages (DSLs). This capability has been enhanced in SWI-Prolog through syntactical extensions to the Prolog language. Examples of the accepted syntax that can be unambiguously processed include a[1][2], point{x:1, y:1}, and function(). Additionally, quasi-quotations allow for secure and neat integration with the syntax of any language. For instance, the following statement represents a fragment of JavaScript with a secure interpolation of the Prolog value X.

{|javascript(X)||var x = X;|}

SWI-Prolog Feature List

The Prolog language feature list includes (a) the Engine, (b) Constraint Handling, © Connectivity, (d) Development Tools, (e) Compatibility, (f) Portability, and (g) Legal. Each of these features is briefly described below.

Engine

The SWI-Prolog engine is a sophisticated, versatile platform for implementing logic programming and the Prolog language. Renowned for its scalability, robustness, and ability to manage large applications, it excels in domains like artificial intelligence, data mining, and semantic web applications. Further, it features interactors, or engines, that offer coroutines for state accumulation and massive concurrency — critical for simulations and swarm intelligence applications. Key characteristics of the SWI-Prolog engine include:

1. Rapid Compilation: The engine is engineered for speedy compilation, a crucial trait for efficiently handling large applications and considerable data sets. For instance, it loads WordNet 3.0 in just 7 seconds from the Prolog source or a mere 0.25 seconds from the quick load file format (via `qcompile/1`), even on systems running Ubuntu 22.04 on an AMD 3950X with 64GB of memory and processing a WordNet source of 821,515 lines.

2. Robustness & Memory Management: The robust SWI-Prolog engine demonstrates exemplary memory management, reducing leaks and optimizing usage. This makes it apt for round-the-clock server applications. Its dependability is validated by its usage in several 24x7 servers.

3. Scalability: The engine’s capacity to process programs of any size without performance degradation is a testament to its scalability. This is critical when working with extensive applications involving large data sets. Despite its capability, SWI-Prolog remains compact, with the complete development environment occupying approximately 70MB of hard disk space, and the kernel about 1.6MB (Ubuntu 22.04 .so file).

4. Just-In-Time Indexing: SWI-Prolog offers Just-In-Time (JIT) indexing for both static and dynamic code on any argument, simplifying the handling of multi-moded relations with many clauses. As of version 7.7, it also supports indexing on compound term arguments, thereby boosting performance for managing terminals in grammar rules (DCGs).

5. Multithreading Support: The engine comes with built-in multithreading support, allowing the concurrent execution of multiple pre-emptively scheduled Prolog engines on a single database, thereby augmenting computational power.

6. Extended Arithmetic: SWI-Prolog leverages the GMP library to support unbounded integer and rational number arithmetic.

7. Unicode Character Set Handling: The engine handles the Unicode character set internally, making it ideal for international and web applications.

8. Exception Handling: Built-in mechanisms for exception handling enhance the robustness and reliability of the SWI-Prolog engine.

9. Unique Features: The engine boasts advanced features like coroutines (engines or interactors), tabling (SLG resolution), and delimited continuations, offering powerful tools for constructing new control structures and implementing aspect programming.

10. Deductive Database Features: The 8.1.x development series provides well-founded semantics for negation and incremental tabling to update tabling automatically as the knowledge base changes. This adds Datalog-style deductive database capabilities.

Overall, the SWI-Prolog engine, with its blend of speed, robustness, and extensive feature set, is a formidable tool for handling intricate logic programming tasks.

Constraint Handling

SWI-Prolog offers a robust set of libraries for constraint handling, a powerful technique used in logic programming to solve problems expressed as a series of constraints. Constraint handling in SWI-Prolog is facilitated primarily through libraries for Constraint Handling Rules (CHR) and constraint logic programming over different domains such as finite domains (clp(FD)) and real and rational numbers (clp(R,Q)).

1. Constraint Handling Rules (CHR): This is a declarative language extension for writing user-defined constraints. CHR is a rule-based language used primarily for writing constraint solvers, and it has been integrated into several Prolog systems, including SWI-Prolog. In CHR, constraints are rewritten or simplified according to a set of user-defined rules until they are solved. This makes it a powerful tool for writing complex constraint solvers clearly and concisely.

2. clp(FD) — Constraint Logic Programming over Finite Domains: clp(FD) allows for the declaration of constraints over finite domains, which are sets of integers. This is particularly useful in problems such as scheduling, where tasks must be assigned to specific time slots, or puzzles like Sudoku, where numbers must be placed in a grid according to certain rules. The clp(FD) library in SWI-Prolog allows developers to describe these problems in terms of their constraints and have the system automatically solve them.

3. clp(R,Q) — Constraint Logic Programming over Real and Rational Numbers: This library supports constraints over real and rational numbers, allowing for precise numerical computations and solutions. This can be especially useful in problems requiring precise numerical values, or where relationships between numbers must be accurately maintained.

These libraries enable SWI-Prolog to handle various constraint logic programming tasks, making it a versatile and powerful tool for solving complex problems that can be expressed in terms of constraints.Connectivity

Connectivity

In SWI-Prolog, connectivity refers to establishing connections and communication between Prolog and other systems or services. SWI-Prolog provides various built-in predicates and libraries that enable connectivity with external databases, web services, files, and other Prolog instances. Here are some common ways to achieve connectivity in SWI-Prolog:

1. Database Connectivity: SWI-Prolog supports database connectivity through the ODBC (Open Database Connectivity) and ODBC-based libraries. The `odbc` library allows you to connect to database systems such as MySQL, PostgreSQL, Oracle, and SQLite, among others. It provides predicates like `odbc_connect/3` to establish a connection and execute SQL queries on the connected database.

2. Web Connectivity: SWI-Prolog provides libraries for interacting with web services and handling HTTP requests. The `http` library allows you to perform HTTP requests, send JSON/XML data, and retrieve data from web APIs. The `http_client` library also provides functionality for making HTTP requests and processing responses.

3. File I/O Connectivity: SWI-Prolog offers predicates for reading from and writing to files. You can use predicates like `open/3`, `read/2`, `write/2`, and `close/1` to establish a connection with a file, read/write data, and close the connection.

4. Inter-Prolog Connectivity: SWI-Prolog supports inter-Prolog connectivity, enabling communication between multiple Prolog instances. The `socket` library provides predicates for creating, connecting, and communicating over sockets, allowing Prolog processes running on different machines to exchange data.

5. External Language Connectivity: SWI-Prolog allows you to connect with external programming languages using different mechanisms. The `foreign` library enables calling C functions from Prolog and vice versa, allowing you to integrate Prolog with C/C++ code. Additionally, SWI-Prolog supports embedding Prolog in other languages like C++ and Java.

These are just a few examples of the connectivity options available in SWI-Prolog. You can choose the appropriate libraries or predicates to establish connections and communicate with external systems depending on your specific requirements.

Development Tools

SWI-Prolog provides a comprehensive set of development tools that aid in developing, debugging, and testing Prolog programs. These tools are designed to enhance developers’ productivity and facilitate the creation of robust and efficient Prolog applications. Here are some of the key development tools available in SWI-Prolog:

1. Interactive Interpreter (Top-Level): SWI-Prolog provides an interactive interpreter, the top-level or Prolog shell. It allows you to interactively enter and execute Prolog queries, making testing and experimenting with Prolog code easy. The top level provides features such as tab completion, command history, and error reporting, which help in the development and debugging process.

2. Integrated Development Environment (IDE): SWI-Prolog includes an integrated development environment called PceEmacs, based on the Emacs editor. The IDE offers syntax highlighting, code navigation, auto-indentation, and integration with various development tools. It provides a convenient interface for writing, editing, and managing Prolog code.

3. Debugger: SWI-Prolog features a powerful interactive debugger that allows you to trace and debug Prolog programs. The debugger helps identify and fix errors by providing step-by-step execution, variable inspection, breakpoints, and backtracking capabilities. It also supports graphical visualization of the program’s execution flow.

4. Profiler: SWI-Prolog includes a profiling tool that enables you to analyze the performance of your Prolog programs. The profiler helps identify bottlenecks and optimize code by providing detailed information about predicate execution times, backtracking, and memory usage.

5. Unit Testing Framework: SWI-Prolog provides a built-in unit testing framework called `plunit`. It allows you to define and run tests for individual predicates or modules. The framework supports assertions, test suites, test fixtures, and reporting of test results, helping you ensure the correctness and reliability of your Prolog code.

6. Documentation Generation: SWI-Prolog includes a tool called `pldoc` for generating documentation from Prolog source code. It uses specially formatted comments to extract information about predicates, modules, and other entities and generates HTML documentation with cross-references, predicate descriptions, and usage examples.

7. Package Manager: SWI-Prolog has a package manager called `pack` that allows you to discover, install, and manage third-party libraries and tools. The package manager simplifies the process of integrating external libraries into your Prolog projects and promotes code reuse and collaboration within the SWI-Prolog community.

These development tools and other utilities and libraries form a robust ecosystem for developing Prolog applications in SWI-Prolog. They provide essential features and functionalities that assist developers in writing, testing, debugging, and documenting Prolog code effectively.

Compatibility

SWI-Prolog boasts an exhaustive collection of built-in predicates encompassing Part 1 of the ISO standard, the universally accepted Edinburgh Prolog standard, and significant portions of Quintus and SICStus Prolog. It also maintains reasonable compatibility with Ciao, YAP, and GNU-Prolog. While SWI-Prolog strives to uphold compatibility as much as possible, it intentionally diverges from the ISO standard when necessary to integrate extra functionality and to stay in sync with contemporary languages.

Portability

SWI-Prolog is highly portable and can be run on numerous platforms, such as most Unix/Linux platforms, Windows, MacOS X (using Xquartz for graphics), WebAssembly (WASM), Android Termux, and many others. It supports 32-bit and 64-bit hardware architectures and has been compiled and tested on various CPUs, including x86, x64, SPARC, PowerPC, and many ARM models, including Apple’s M1. The source code is written in plain C11 and configured using CMake, with continual improvements in cross-compilation support. It offers machine-independent saved-states, which means you can save on one platform and run using the virtual machine of another platform.

SWI-Prolog provides regular binary distributions for Windows (32/64 bits) and MacOS X (64 bits), Personal Package Archives (PPAs) for Ubuntu (both stable and development versions), SNAP, and Docker. Additionally, the full source packages are distributed regularly. The sources can also be accessed through GIT.

Legal

SWI-Prolog is shared under the terms of the Simplified BSD license, also referred to as the BSD-2 license. However, please note that certain libraries and extension packages used may be subject to different licensing conditions. To check the licenses applicable to a specific configuration, you can use the license/0 command.

About the series

I plan on posting a Chapter each 2 weeks to help get you started with Prolog. Please direct any comments to me (see info below).

About the Author

Ron McFarland, Ph.D., CISSP, is a Senior Cybersecurity Consultant at CMTC (California Manufacturing Technology Consulting) in Long Beach, CA. He received his doctorate from NSU’s School of Engineering and Computer Science, an MSc in Computer Science from Arizona State University, and a Post-Doc Graduate Research Program in Cyber Security Technologies from the University of Maryland. He taught Cisco CCNA (Cisco Certified Network Associate), CCNP (Cisco Certified Network Professional), CCDA (Design), CCNA-Security, Cisco CCNA Wireless, and other Cisco courses. He was honored with the Cisco Academy Instructor (CAI) Excellence Award in 2010, 2011, and 2012 for excellence in teaching. He also holds multiple security certifications, including the prestigious Certified Information Systems Security Professional (CISSP). He writes for Medium as a guest author to provide information to learners of cybersecurity, students, and clients.

CONTACT Dr. Ron McFarland, Ph.D.

· CMTC Email: rmcfarland@cmtc.com

· Email: highervista@gmail.com

· LinkedIn: https://www.linkedin.com/in/highervista/

· ·YouTube Channel: https://www.youtube.com/@RonMcFarland/featured

--

--

Ron McFarland PhD

Cybersecurity Consultant, Educator, State-Certified Digital Forensics and Expert Witness (California, Arizona, New Mexico)