# gulzat-dev/blalgebra architecture

> Architecture diagram of the GitHub repository gulzat-dev/blalgebra, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gulzat-dev/blalgebra
- Repository: https://github.com/gulzat-dev/blalgebra

## Overview

This research codebase computes homomorphism counts (and, for one Hájek variant, explicit maps) for finite algebras associated with Łukasiewicz, Gödel, and Hájek/BL logics. The typical workflow loads example algebra data, converts forest data when needed, applies a logic-specific recurrence or counting rule, and prints a result; Gödel also visualizes its forests. The graph separates the shared loader, the three logic implementations, and the supplied examples. Relationships are limited to calls and file reads visible in the excerpts; no unsampled behavior is assumed.

Main entry points: [`godel/godel.py`](https://github.com/gulzat-dev/blalgebra/blob/main/godel/godel.py) (Gödel runner), [`hajec/hajecForestToForest.py`](https://github.com/gulzat-dev/blalgebra/blob/main/hajec/hajecForestToForest.py) (BL forest counting), [`hajec/hajecTreeToTree.py`](https://github.com/gulzat-dev/blalgebra/blob/main/hajec/hajecTreeToTree.py) (BL map enumeration), [`lukasiewicz/lukasiewicz_logic.py`](https://github.com/gulzat-dev/blalgebra/blob/main/lukasiewicz/lukasiewicz_logic.py) (MV runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared forest input"]
  node_forest_data["Forest examples"]
  node_loader["Forest loader<br/>[forestLoader.py]"]
end

subgraph group_godel["Gödel counting"]
  node_godel_runner["Gödel runner<br/>[godel.py]"]
  node_godel_count["Forest count recurrence<br/>[godel.py]"]
  node_godel_visual["Forest visualization<br/>[godel.py]"]
end

subgraph group_hajek["Hájek BL methods"]
  node_hajek_count["BL forest counting"]
  node_hajek_maps["BL map enumeration<br/>[hajecTreeToTree.py]"]
end

subgraph group_mv["Łukasiewicz MV"]
  node_mv_runner["MV runner"]
  node_mv_count["Labelled-set counting"]
  node_mv_data["MV examples"]
end

node_user(("Researcher"))
node_result(("Printed result"))

node_user -.->|"runs"| node_godel_runner
node_user -.->|"runs"| node_hajek_count
node_user -.->|"runs"| node_hajek_maps
node_user -.->|"runs"| node_mv_runner
node_godel_runner -->|"reads examples"| node_forest_data
node_godel_runner -->|"loads forests"| node_loader
node_godel_runner -->|"visualizes forests"| node_godel_visual
node_godel_runner -->|"counts maps"| node_godel_count
node_godel_runner -->|"prints count"| node_result
node_hajek_count -->|"reads examples"| node_forest_data
node_hajek_count -->|"loads forests"| node_loader
node_hajek_count -->|"prints count"| node_result
node_hajek_maps -->|"reads examples"| node_forest_data
node_hajek_maps -->|"loads forests"| node_loader
node_hajek_maps -->|"prints maps and count"| node_result
node_mv_runner -->|"reads examples"| node_mv_data
node_mv_runner -->|"calculates count"| node_mv_count
node_mv_runner -->|"prints count"| node_result

click node_forest_data "https://github.com/gulzat-dev/blalgebra/tree/main/src"
click node_loader "https://github.com/gulzat-dev/blalgebra/blob/main/forestLoader/forestLoader.py"
click node_godel_runner "https://github.com/gulzat-dev/blalgebra/blob/main/godel/godel.py"
click node_godel_count "https://github.com/gulzat-dev/blalgebra/blob/main/godel/godel.py"
click node_godel_visual "https://github.com/gulzat-dev/blalgebra/blob/main/godel/godel.py"
click node_hajek_count "https://github.com/gulzat-dev/blalgebra/blob/main/hajec/hajecForestToForest.py"
click node_hajek_maps "https://github.com/gulzat-dev/blalgebra/blob/main/hajec/hajecTreeToTree.py"
click node_mv_runner "https://github.com/gulzat-dev/blalgebra/blob/main/lukasiewicz/lukasiewicz_logic.py"
click node_mv_count "https://github.com/gulzat-dev/blalgebra/blob/main/lukasiewicz/lukasiewicz_logic.py"
click node_mv_data "https://github.com/gulzat-dev/blalgebra/tree/main/src/lukaseiwich"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_forest_data,node_loader toneBlue
class node_godel_runner,node_godel_count,node_godel_visual toneAmber
class node_hajek_count,node_hajek_maps toneMint
class node_mv_runner,node_mv_count,node_mv_data toneRose
class node_user,node_result toneIndigo
```

## Components

### Shared forest input

- [Forest examples](https://github.com/gulzat-dev/blalgebra/tree/main/src): `src`
- [Forest loader](https://github.com/gulzat-dev/blalgebra/blob/main/forestLoader/forestLoader.py): `forestLoader/forestLoader.py`

### Gödel counting

- [Gödel runner](https://github.com/gulzat-dev/blalgebra/blob/main/godel/godel.py): `godel/godel.py`
- [Forest count recurrence](https://github.com/gulzat-dev/blalgebra/blob/main/godel/godel.py): `godel/godel.py`
- [Forest visualization](https://github.com/gulzat-dev/blalgebra/blob/main/godel/godel.py): `godel/godel.py`

### Hájek BL methods

- [BL forest counting](https://github.com/gulzat-dev/blalgebra/blob/main/hajec/hajecForestToForest.py): `hajec/hajecForestToForest.py`
- [BL map enumeration](https://github.com/gulzat-dev/blalgebra/blob/main/hajec/hajecTreeToTree.py): `hajec/hajecTreeToTree.py`

### Łukasiewicz MV

- [MV runner](https://github.com/gulzat-dev/blalgebra/blob/main/lukasiewicz/lukasiewicz_logic.py): `lukasiewicz/lukasiewicz_logic.py`
- [Labelled-set counting](https://github.com/gulzat-dev/blalgebra/blob/main/lukasiewicz/lukasiewicz_logic.py): `lukasiewicz/lukasiewicz_logic.py`
- [MV examples](https://github.com/gulzat-dev/blalgebra/tree/main/src/lukaseiwich): `src/lukaseiwich`

### Other components

- **Researcher**
- **Printed result**

## Connections

- Researcher → Gödel runner: runs
- Researcher → BL forest counting: runs
- Researcher → BL map enumeration: runs
- Researcher → MV runner: runs
- Gödel runner → Forest examples: reads examples (evidence: `godel/godel.py`)
- Gödel runner → Forest loader: loads forests (evidence: `godel/godel.py`)
- Gödel runner → Forest visualization: visualizes forests (evidence: `godel/godel.py`)
- Gödel runner → Forest count recurrence: counts maps (evidence: `godel/godel.py`)
- Gödel runner → Printed result: prints count (evidence: `godel/godel.py`)
- BL forest counting → Forest examples: reads examples (evidence: `hajec/hajecForestToForest.py`)
- BL forest counting → Forest loader: loads forests (evidence: `hajec/hajecForestToForest.py`)
- BL forest counting → Printed result: prints count (evidence: `hajec/hajecForestToForest.py`)
- BL map enumeration → Forest examples: reads examples (evidence: `hajec/hajecTreeToTree.py`)
- BL map enumeration → Forest loader: loads forests (evidence: `hajec/hajecTreeToTree.py`)
- BL map enumeration → Printed result: prints maps and count (evidence: `hajec/hajecTreeToTree.py`)
- MV runner → MV examples: reads examples (evidence: `lukasiewicz/lukasiewicz_logic.py`)
- MV runner → Labelled-set counting: calculates count (evidence: `lukasiewicz/lukasiewicz_logic.py`)
- MV runner → Printed result: prints count (evidence: `lukasiewicz/lukasiewicz_logic.py`)
