# itsluuis/first-order-logic architecture

> Architecture diagram of the GitHub repository itsluuis/first-order-logic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/itsluuis/first-order-logic
- Repository: https://github.com/itsluuis/first-order-logic

## Overview

This is a browser-based symbolic-logic learning app. A student can build a molecular proposition, convert it to a well-formed formula (FBF), or enter an FBF for natural-language reconstruction; the app also evaluates truth tables and offers four timed practice games. The main controller coordinates these workflows, with local profile/settings persistence and a local student model supporting practice and Moli’s contextual tutoring. README capabilities are included where implementation excerpts were unavailable; the graph omits uncertain wiring for those unsampled areas.

Main entry points: [`js/app.js`](https://github.com/itsluuis/first-order-logic/blob/main/js/app.js) (App controller), [`js/practice/practiceEngine.js`](https://github.com/itsluuis/first-order-logic/blob/main/js/practice/practiceEngine.js) (Four-game engine), [`js/mascot/mascotController.js`](https://github.com/itsluuis/first-order-logic/blob/main/js/mascot/mascotController.js) (Moli controller), [`js/ml/studentModel.js`](https://github.com/itsluuis/first-order-logic/blob/main/js/ml/studentModel.js) (Student learning model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application workflows"]
  node_controller["App controller<br/>[app.js]"]
  node_builder["Visual builder<br/>[app.js]"]
  node_inverse["Inverse workflow<br/>[app.js]"]
end

subgraph group_logic["Logic tools"]
  node_parser["FBF parser and AST<br/>[ast.js]"]
  node_generators["Random generators<br/>[generators.js]"]
  node_language["Natural-language mapping<br/>[naturalLanguage.js]"]
  node_truth["Truth-table engine<br/>[truthTable.js]"]
end

subgraph group_practice["Practice and learning"]
  node_practice_view["Practice interface<br/>[practiceView.js]"]
  node_practice_engine["Four-game engine<br/>[practiceEngine.js]"]
  node_student_model["Student learning model<br/>[studentModel.js]"]
  node_neural_net["Neural network<br/>[neuralNet.js]"]
end

subgraph group_moli["Moli tutor"]
  node_mascot_controller["Moli controller"]
  node_mascot_view["Moli OLED view<br/>[mascotView.js]"]
end

subgraph group_state["Local state"]
  node_profiles[("Profiles and settings<br/>[storage.js]")]
end

node_student(("Student"))

node_student -->|"uses app"| node_controller
node_controller -->|"reads and writes"| node_profiles
node_controller -->|"routes to"| node_builder
node_controller -->|"routes to"| node_inverse
node_controller -->|"requests evaluation"| node_truth
node_controller -->|"initializes"| node_practice_view
node_controller -->|"initializes"| node_practice_engine
node_controller -->|"initializes"| node_mascot_controller
node_builder -->|"generates formulas"| node_generators
node_builder -->|"translates proposition"| node_language
node_builder -->|"formats FBF"| node_parser
node_inverse -->|"parses FBF"| node_parser
node_inverse -->|"generates FBF"| node_generators
node_inverse -->|"reconstructs proposition"| node_language
node_truth -->|"reads AST"| node_parser
node_practice_engine -->|"parses and formats"| node_parser
node_practice_engine -->|"evaluates formulas"| node_truth
node_practice_engine -.->|"reports performance"| node_student_model
node_student_model -->|"trains and predicts"| node_neural_net
node_student_model -->|"persists profile"| node_profiles
node_mascot_controller -->|"updates display"| node_mascot_view
node_mascot_controller -->|"requests diagnosis"| node_student_model
node_mascot_controller -->|"reads app context"| node_controller
node_student -->|"plays games"| node_practice_view

click node_controller "https://github.com/itsluuis/first-order-logic/blob/main/js/app.js"
click node_profiles "https://github.com/itsluuis/first-order-logic/blob/main/js/storage.js"
click node_builder "https://github.com/itsluuis/first-order-logic/blob/main/js/app.js"
click node_inverse "https://github.com/itsluuis/first-order-logic/blob/main/js/app.js"
click node_parser "https://github.com/itsluuis/first-order-logic/blob/main/js/logic/ast.js"
click node_generators "https://github.com/itsluuis/first-order-logic/blob/main/js/logic/generators.js"
click node_language "https://github.com/itsluuis/first-order-logic/blob/main/js/logic/naturalLanguage.js"
click node_truth "https://github.com/itsluuis/first-order-logic/blob/main/js/logic/truthTable.js"
click node_practice_view "https://github.com/itsluuis/first-order-logic/blob/main/js/practice/practiceView.js"
click node_practice_engine "https://github.com/itsluuis/first-order-logic/blob/main/js/practice/practiceEngine.js"
click node_student_model "https://github.com/itsluuis/first-order-logic/blob/main/js/ml/studentModel.js"
click node_neural_net "https://github.com/itsluuis/first-order-logic/blob/main/js/ml/neuralNet.js"
click node_mascot_controller "https://github.com/itsluuis/first-order-logic/blob/main/js/mascot/mascotController.js"
click node_mascot_view "https://github.com/itsluuis/first-order-logic/blob/main/js/mascot/mascotView.js"

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_controller,node_builder,node_inverse toneBlue
class node_parser,node_generators,node_language,node_truth toneAmber
class node_practice_view,node_practice_engine,node_student_model,node_neural_net toneMint
class node_mascot_controller,node_mascot_view toneRose
class node_profiles,node_student toneIndigo
```

## Components

### Application workflows

- [App controller](https://github.com/itsluuis/first-order-logic/blob/main/js/app.js): `js/app.js`
- [Visual builder](https://github.com/itsluuis/first-order-logic/blob/main/js/app.js): `js/app.js`
- [Inverse workflow](https://github.com/itsluuis/first-order-logic/blob/main/js/app.js): `js/app.js`

### Logic tools

- [FBF parser and AST](https://github.com/itsluuis/first-order-logic/blob/main/js/logic/ast.js): `js/logic/ast.js`
- [Random generators](https://github.com/itsluuis/first-order-logic/blob/main/js/logic/generators.js): `js/logic/generators.js`
- [Natural-language mapping](https://github.com/itsluuis/first-order-logic/blob/main/js/logic/naturalLanguage.js): `js/logic/naturalLanguage.js`
- [Truth-table engine](https://github.com/itsluuis/first-order-logic/blob/main/js/logic/truthTable.js): `js/logic/truthTable.js`

### Practice and learning

- [Practice interface](https://github.com/itsluuis/first-order-logic/blob/main/js/practice/practiceView.js): `js/practice/practiceView.js`
- [Four-game engine](https://github.com/itsluuis/first-order-logic/blob/main/js/practice/practiceEngine.js): `js/practice/practiceEngine.js`
- [Student learning model](https://github.com/itsluuis/first-order-logic/blob/main/js/ml/studentModel.js): `js/ml/studentModel.js`
- [Neural network](https://github.com/itsluuis/first-order-logic/blob/main/js/ml/neuralNet.js): `js/ml/neuralNet.js`

### Moli tutor

- [Moli controller](https://github.com/itsluuis/first-order-logic/blob/main/js/mascot/mascotController.js): `js/mascot/mascotController.js`
- [Moli OLED view](https://github.com/itsluuis/first-order-logic/blob/main/js/mascot/mascotView.js): `js/mascot/mascotView.js`

### Local state

- [Profiles and settings](https://github.com/itsluuis/first-order-logic/blob/main/js/storage.js): `js/storage.js`

### Other components

- **Student**

## Connections

- Student → App controller: uses app
- App controller → Profiles and settings: reads and writes
- App controller → Visual builder: routes to
- App controller → Inverse workflow: routes to
- App controller → Truth-table engine: requests evaluation
- App controller → Practice interface: initializes
- App controller → Four-game engine: initializes
- App controller → Moli controller: initializes
- Visual builder → Random generators: generates formulas
- Visual builder → Natural-language mapping: translates proposition
- Visual builder → FBF parser and AST: formats FBF
- Inverse workflow → FBF parser and AST: parses FBF
- Inverse workflow → Random generators: generates FBF
- Inverse workflow → Natural-language mapping: reconstructs proposition
- Truth-table engine → FBF parser and AST: reads AST
- Four-game engine → FBF parser and AST: parses and formats
- Four-game engine → Truth-table engine: evaluates formulas
- Four-game engine → Student learning model: reports performance
- Student learning model → Neural network: trains and predicts
- Student learning model → Profiles and settings: persists profile
- Moli controller → Moli OLED view: updates display
- Moli controller → Student learning model: requests diagnosis
- Moli controller → App controller: reads app context
- Student → Practice interface: plays games
