# hutynj/mathstep architecture

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

- Interactive diagram: https://gitdiagram.com/hutynj/mathstep
- Repository: https://github.com/hutynj/mathstep

## Overview

MathStep appears to be an Android math-solving app: users enter an expression, view a solution, and can access history or graphing. The tree also indicates local arithmetic/symbolic solving, an AI solver, session preferences, and Firebase App Check. The supplied excerpts contain no app source or README, so workflow links are unverified and shown as dashed rather than asserted as inspected call paths.

Main entry points: [`app/src/main/java/com/example/MainViewModel.kt`](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/MainViewModel.kt) (Main view model), [`app/src/main/java/com/example/math/MathEngine.kt`](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/MathEngine.kt) (Math engine), [`app/src/main/java/com/example/MainActivity.kt`](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/MainActivity.kt) (Main activity), [`app/src/main/java/com/example/ui/screens/SolutionScreen.kt`](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/SolutionScreen.kt) (Solution screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app_ui["App interface"]
  node_activity["Main activity<br/>[MainActivity.kt]"]
  node_viewmodel["Main view model<br/>[MainViewModel.kt]"]
  node_input["Input screen<br/>[InputScreen.kt]"]
  node_solution["Solution screen<br/>[SolutionScreen.kt]"]
  node_history["History screen<br/>[HistoryScreen.kt]"]
  node_graph["Graph screen<br/>[GraphScreen.kt]"]
end

subgraph group_solving["Math solving"]
  node_engine["Math engine<br/>[MathEngine.kt]"]
  node_evaluator["Expression evaluator<br/>[MathEval.kt]"]
  node_local_solver["Equation solver"]
  node_symbolic["Symbolic solvers"]
  node_step_reducer["Step reducer"]
  node_ai_solver["AI solver<br/>[AiMathSolver.kt]"]
  node_models["Math models<br/>[MathModels.kt]"]
end

subgraph group_session["Session and services"]
  node_preferences["Session preferences"]
  node_app_check["App Check setup<br/>[AppCheckInit.kt]"]
end

subgraph group_presentation["Math presentation"]
  node_keyboard["Math keyboard<br/>[MathKeyboard.kt]"]
  node_formula["Formula view<br/>[MathFormulaView.kt]"]
  node_loading["Loading indicator"]
end

node_user(("User"))
node_firebase{{"Firebase"}}

node_user -.->|"opens"| node_activity
node_activity -.->|"hosts"| node_viewmodel
node_viewmodel -.->|"presents"| node_input
node_user -.->|"enters math"| node_input
node_input -.->|"uses"| node_keyboard
node_viewmodel -.->|"requests solving"| node_engine
node_engine -.->|"evaluates"| node_evaluator
node_engine -.->|"solves equations"| node_local_solver
node_engine -.->|"uses symbolic methods"| node_symbolic
node_engine -.->|"reduces steps"| node_step_reducer
node_viewmodel -.->|"requests AI solving"| node_ai_solver
node_ai_solver -.->|"may use"| node_firebase
node_viewmodel -.->|"uses results"| node_models
node_viewmodel -.->|"presents result"| node_solution
node_solution -.->|"renders formulas"| node_formula
node_solution -.->|"shows progress"| node_loading
node_viewmodel -.->|"supports history"| node_history
node_viewmodel -.->|"supports graphing"| node_graph
node_viewmodel -.->|"uses session settings"| node_preferences
node_activity -.->|"initializes"| node_app_check
node_app_check -.->|"configures"| node_firebase

click node_activity "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/MainActivity.kt"
click node_viewmodel "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/MainViewModel.kt"
click node_input "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/InputScreen.kt"
click node_solution "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/SolutionScreen.kt"
click node_history "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/HistoryScreen.kt"
click node_graph "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/GraphScreen.kt"
click node_keyboard "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/components/MathKeyboard.kt"
click node_formula "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/components/MathFormulaView.kt"
click node_loading "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/components/OrbitLoadingIndicator.kt"
click node_engine "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/MathEngine.kt"
click node_evaluator "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/MathEval.kt"
click node_local_solver "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/LocalEquationSolver.kt"
click node_symbolic "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/SymbolicMathSolvers.kt"
click node_step_reducer "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/ArithmeticStepReducer.kt"
click node_ai_solver "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/data/AiMathSolver.kt"
click node_models "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/model/MathModels.kt"
click node_preferences "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/data/SessionPreferencesRepository.kt"
click node_app_check "https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/firebase/AppCheckInit.kt"

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_activity,node_viewmodel,node_input,node_solution,node_history,node_graph,node_user toneBlue
class node_engine,node_evaluator,node_local_solver,node_symbolic,node_step_reducer,node_ai_solver,node_models toneAmber
class node_preferences,node_app_check toneMint
class node_keyboard,node_formula,node_loading toneRose
class node_firebase toneIndigo
```

## Components

### App interface

- [Main activity](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/MainActivity.kt): `app/src/main/java/com/example/MainActivity.kt`
- [Main view model](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/MainViewModel.kt): `app/src/main/java/com/example/MainViewModel.kt`
- [Input screen](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/InputScreen.kt): `app/src/main/java/com/example/ui/screens/InputScreen.kt`
- [Solution screen](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/SolutionScreen.kt): `app/src/main/java/com/example/ui/screens/SolutionScreen.kt`
- [History screen](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/HistoryScreen.kt): `app/src/main/java/com/example/ui/screens/HistoryScreen.kt`
- [Graph screen](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/screens/GraphScreen.kt): `app/src/main/java/com/example/ui/screens/GraphScreen.kt`

### Math solving

- [Math engine](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/MathEngine.kt): `app/src/main/java/com/example/math/MathEngine.kt`
- [Expression evaluator](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/MathEval.kt): `app/src/main/java/com/example/math/MathEval.kt`
- [Equation solver](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/LocalEquationSolver.kt): `app/src/main/java/com/example/math/LocalEquationSolver.kt`
- [Symbolic solvers](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/SymbolicMathSolvers.kt): `app/src/main/java/com/example/math/SymbolicMathSolvers.kt`
- [Step reducer](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/math/ArithmeticStepReducer.kt): `app/src/main/java/com/example/math/ArithmeticStepReducer.kt`
- [AI solver](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/data/AiMathSolver.kt): `app/src/main/java/com/example/data/AiMathSolver.kt`
- [Math models](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/model/MathModels.kt): `app/src/main/java/com/example/model/MathModels.kt`

### Session and services

- [Session preferences](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/data/SessionPreferencesRepository.kt): `app/src/main/java/com/example/data/SessionPreferencesRepository.kt`
- [App Check setup](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/firebase/AppCheckInit.kt): `app/src/main/java/com/example/firebase/AppCheckInit.kt`

### Math presentation

- [Math keyboard](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/components/MathKeyboard.kt): `app/src/main/java/com/example/ui/components/MathKeyboard.kt`
- [Formula view](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/components/MathFormulaView.kt): `app/src/main/java/com/example/ui/components/MathFormulaView.kt`
- [Loading indicator](https://github.com/hutynj/mathstep/blob/main/app/src/main/java/com/example/ui/components/OrbitLoadingIndicator.kt): `app/src/main/java/com/example/ui/components/OrbitLoadingIndicator.kt`

### Other components

- **User**
- **Firebase**

## Connections

- User → Main activity: opens
- Main activity → Main view model: hosts
- Main view model → Input screen: presents
- User → Input screen: enters math
- Input screen → Math keyboard: uses
- Main view model → Math engine: requests solving
- Math engine → Expression evaluator: evaluates
- Math engine → Equation solver: solves equations
- Math engine → Symbolic solvers: uses symbolic methods
- Math engine → Step reducer: reduces steps
- Main view model → AI solver: requests AI solving
- AI solver → Firebase: may use
- Main view model → Math models: uses results
- Main view model → Solution screen: presents result
- Solution screen → Formula view: renders formulas
- Solution screen → Loading indicator: shows progress
- Main view model → History screen: supports history
- Main view model → Graph screen: supports graphing
- Main view model → Session preferences: uses session settings
- Main activity → App Check setup: initializes
- App Check setup → Firebase: configures
