Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 7 additions & 23 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Project Overview

This is a Python implementation of LODA - an assembly language designed for integer sequences. The project enables reading, writing, evaluating, and generating LODA programs using machine learning techniques to discover new integer sequence programs.
This is a Python implementation of LODA - an assembly language designed for integer sequences. The project enables reading, writing, evaluating LODA programs and searching for matches in the OEIS database.

## Core Concepts

Expand All @@ -15,10 +15,6 @@ This is a Python implementation of LODA - an assembly language designed for inte
- **Operations**: `mov`, `add`, `sub`, `mul`, `div`, `dif`, `mod`, `pow`, `gcd`, `bin`, `cmp`, `min`, `max`, `lpb`, `lpe`
- **Loops**: `lpb $n` starts loop, `lpe` ends loop (counter-based termination)

### Token Encoding for ML
Each operation becomes 3 tokens: `[operation_type, target_operand, source_operand]`
Example: `mov $1,5` → `["mov", "$1", "5"]`

## Source Code Structure

### Core Language (`loda/lang/`)
Expand All @@ -36,9 +32,8 @@ Example: `mov $1,5` → `["mov", "$1", "5"]`
- **`program_cache.py`**: `ProgramCache` manages filesystem loading/caching
- **`prefix_index.py`**: `PrefixIndex` enables sequence matching by prefix patterns

### Machine Learning (`loda/ml/`)
### Utilities (`loda/ml/`)
- **`util.py`**: Token conversion utilities (program ↔ tokens, merging)
- **`keras/program_generation_rnn.py`**: RNN model for program generation using TensorFlow

### Mining (`loda/mine/`)
- **`miner.py`**: `Miner` searches for programs matching OEIS sequences
Expand Down Expand Up @@ -68,15 +63,6 @@ elif operand.type == OperandType.INDIRECT:
value = memory[memory[operand.value]]
```

### When working with ML tokens:
```python
# Convert programs to tokens for ML
from loda.ml.util import program_to_tokens, tokens_to_program

tokens = program_to_tokens(program)
reconstructed = tokens_to_program(tokens)
```

### When working with sequences:
```python
# Always specify term count and handle evaluation errors
Expand Down Expand Up @@ -112,11 +98,11 @@ program = program_cache.get_program(sequence_id)

### Token Conversion Pattern:
```python
# ML workflow
tokens = program_to_tokens(program)
# Process with ML model
new_tokens = model.generate(tokens)
new_program = tokens_to_program(new_tokens)
# Token conversion utilities
from loda.ml.util import program_to_tokens, tokens_to_program

tokens, vocab = program_to_tokens(program)
reconstructed = tokens_to_program(tokens)
```

## Testing Conventions
Expand All @@ -138,13 +124,11 @@ Always set appropriate limits:

- Programs: `A######.asm` format (OEIS sequence numbers)
- B-files: `b######.txt` format for sequence terms
- Models: Use descriptive names with hyperparameters
- Use relative paths from project root

## Integration Points

- OEIS database integration via sequence IDs
- TensorFlow/Keras for neural networks
- File system caching for performance
- CSV parsing for test data

Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ This Python package contains an implementation of the [LODA Language](https://lo
an assembly language and computational model for finding integer sequence programs.

This Python package allows you to read and write LODA programs, to evaluate
them to integer sequences, to search for matches in the
[OEIS](https://www.oeis.org/) database,
and to use machine learning tools from [Tensorflow](https://www.tensorflow.org/)
to find new integer sequence programs.
them to integer sequences, and to search for matches in the
[OEIS](https://www.oeis.org/) database.

## Getting Started

Expand Down
60 changes: 0 additions & 60 deletions generate.py

This file was deleted.

6 changes: 2 additions & 4 deletions loda/documentation.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
This Python package allows you to read and write LODA programs, to evaluate
them to integer sequences, to search for matches in the
[OEIS](https://www.oeis.org/) database,
and to use machine learning from [Tensorflow](https://www.tensorflow.org/)
to generate new integer sequence programs.
them to integer sequences, and to search for matches in the
[OEIS](https://www.oeis.org/) database.

## Installation

Expand Down
1 change: 0 additions & 1 deletion loda/ml/keras/__init__.py

This file was deleted.

Loading