# SUBLEQ

> OISC where the one instruction is to subtract and branch if less than or equal to zero

**Wikidata**: [Q3943965](https://www.wikidata.org/wiki/Q3943965)  
**Source**: https://4ort.xyz/entity/subleq

## Summary
SUBLEQ is a One Instruction Set Computer (OISC) architecture and low-level programming language where the sole instruction is "subtract and branch if less than or equal to zero." It is classified as a Turing tarpit, meaning it offers functional flexibility but is difficult to learn and use because it lacks support for common programming tasks. The language provides minimal abstraction from the computer's hardware.

## Key Facts
- **Definition:** SUBLEQ stands for "SUbtract and Branch if Less than or EQual to zero."
- **Classification:** It is an instance of a One Instruction Set Computer (OISC), a Turing tarpit, and a low-level programming language.
- **Core Mechanism:** The language operates using a single instruction that performs a subtraction operation and triggers a branch only if the result is less than or equal to zero.
- **Abstraction Level:** It is considered a low-level programming language because it provides minimal abstraction from the underlying hardware.
- **Usability:** It is categorized as a Turing tarpit, defined as an interface that is difficult to learn and use due to a lack of support for common tasks, despite being theoretically flexible.
- **Identifiers:** The entity has a Google Knowledge Graph ID of `/g/120_gbz2` and a Wikidata description matching its functional definition.
- **Documentation:** The concept is described in English at `http://mazonka.com/subleq/index.html` (archived reference from 2020).
- **Aliases:** It is also known as "Subleq" and "subtract and branch if less equal."

## FAQs
### Q: What does the instruction in SUBLEQ actually do?
A: Based on its definition as an OISC, the single instruction in SUBLEQ performs a subtraction operation. It then transfers control (branches) to a different instruction address if the result of that subtraction is less than or equal to zero.

### Q: Why is SUBLEQ considered difficult to use?
A: SUBLEQ is classified as a "Turing tarpit." This means that while it is capable of computing anything (flexibility in function), it is extremely difficult to learn and use because it offers little to no support for common, complex tasks found in higher-level languages.

### Q: Is SUBLEQ a high-level or low-level language?
A: SUBLEQ is a low-level programming language. It provides minimal abstraction from the hardware, requiring the programmer to manage details that would be automated in high-level languages.

## Why It Matters
SUBLEQ is significant in the fields of computer science and esoteric programming as a quintessential example of a One Instruction Set Computer (OISC). It demonstrates the theoretical minimum required for a system to be Turing-complete—capable of solving any computational problem given enough time and memory. By reducing the instruction set to a single operation ("subtract and branch if less than or equal to zero"), SUBLEQ illustrates how complex logic can be built from the most elementary primitives.

Its status as a "Turing tarpit" highlights the trade-off between simplicity and usability; while the language is structurally simple, the lack of support for common tasks makes it a challenge to program effectively. This makes SUBLEQ a valuable tool for educational exploration into compiler theory, low-level hardware abstraction, and the boundaries of computational logic. It serves as a proof-of-concept that a computer does not need a complex set of opcodes to function, influencing the study of minimalist computing architectures.

## Notable For
- **Minimalist Architecture:** Being a One Instruction Set Computer (OISC) that requires only a single instruction to be Turing-complete.
- **Theoretical Purity:** Serving as a prime example of a "Turing tarpit"—a language that is theoretically flexible but practically difficult.
- **Hardware Abstraction:** Operating at an extremely low level, providing almost no abstraction from the raw hardware.
- **Logic Simplicity:** Distilling complex control flow into a simple conditional branch based on subtraction.

## Body
### Definition and Operation
SUBLEQ is a specific type of One Instruction Set Computer (OISC). Unlike traditional processors that have distinct instructions for moving data, arithmetic, and logic, a SUBLEQ machine executes only one command repeatedly. This command is defined as "subtract and branch if less than or equal to zero."

### Classification and Characteristics
The language is formally classified as a **low-level programming language**. It provides minimal abstraction from the hardware, meaning there is a strong correspondence between the language's constructs and the machine's actual hardware operations.

Furthermore, SUBLEQ is categorized as a **Turing tarpit**. This term refers to a programming language or computer interface that allows for flexibility in function but is notoriously difficult to learn and use. This difficulty arises because the language offers little or no support for common programming tasks, forcing the user to construct complex workarounds for simple operations.

### Related Concepts
SUBLEQ is closely related to the concept of the **Turing tarpit** and **low-level programming languages**. It serves as a practical example of how a system can be functionally complete (flexible) while remaining user-hostile due to a lack of standard features or support structures.

### Documentation and Identifiers
- **External Descriptions:** The concept is detailed at `http://mazonka.com/subleq/index.html` (English).
- **Community Implementations:** It has a dedicated page on Rosetta Code (ID: Subleq), a site dedicated to showing how to solve programming tasks in different languages.
- **Knowledge Graphs:** It is tracked in the Google Knowledge Graph with the ID `/g/120_gbz2` and has an Italian Wikipedia entry.

## References

1. [Source](https://esolangs.org/wiki/Subleq)