---
name: Active Inference in Prolog
description: Prolog implementation of Active Inference with belief updating, free energy minimization, and policy selection
---

# Active Inference in Prolog

## Overview

This skill provides a complete Active Inference implementation in Prolog,
demonstrating Bayesian belief updating, variational free energy calculation,
and expected free energy-based policy selection.

## Core Algorithms

1. **Belief Updating**: Bayesian inference using observation likelihoods to update posterior beliefs
2. **Free Energy Calculation**: KL divergence between posterior beliefs and prior distribution
3. **Policy Selection**: Softmax action selection over expected free energy per action
4. **Perception-Action Loop**: Iterative sense → infer → act cycle with generative model

## Key Files

- `active_inference.pl` — Source implementation
- `run.sh` — Execution script (handles compilation if needed)
- `README.md` — Usage documentation and requirements

## Usage

```bash
cd 0_CONTEXT/Computer_Languages/Prolog/
./run.sh
```

## Language-Specific Features

- Declarative constraint solving
- Pattern matching and unification
- Backtracking search

## Integration

- Tested via `master_controller.py test prolog`
- Benchmarked via `benchmark_suite.py`
- Listed in `languages.json` under category "Logic"

## Prerequisites

See `README.md` for Prolog-specific installation requirements.
