PhantomTrace — a mathematical framework where numbers exist in present or absent states with custom operations to include addition, subtraction, multiplication, division, and erasure.
Project description
PhantomTrace
A Python library implementing an experimental mathematical framework where numbers can exist in two states: present or absent. It defines five operations that interact with these states in consistent, rule-based ways.
Zero is redefined: 0 is not emptiness — it's one absence (1(0)). This means every operation has a defined result, including division by zero.
Read the paper: Absence Theory
Installation
pip install phantomtrace
Quick Start
from absence_calculator import AbsentNumber, add, subtract, multiply, divide, erase, format_result
# Create numbers — present (default) or absent
five = AbsentNumber(5) # 5 (present)
three_absent = AbsentNumber(3, 1) # 3(0) (absent)
# Addition — same state combines, mixed state is unresolved
result = add(AbsentNumber(5), AbsentNumber(3))
print(result) # 8
# Subtraction — equal values cancel to void
result = subtract(AbsentNumber(7), AbsentNumber(7))
print(result) # void
# Multiplication — states combine (like XOR)
result = multiply(AbsentNumber(5, 1), AbsentNumber(3))
print(result) # 15(0)
# Erasure — flips the state of the erased portion
result = erase(AbsentNumber(5), AbsentNumber(3))
print(result) # 2 + 3(0)
# Division by zero — defined! (0 is one absence)
result = divide(AbsentNumber(10), AbsentNumber(1, 1))
print(result) # 10(0)
Using the Expression Solver
from absence_calculator import solve, format_result
# Parse and solve string expressions
print(format_result(solve("5 + 3"))) # 8
print(format_result(solve("5(0) + 3(0)"))) # 8(0)
print(format_result(solve("7 - 7"))) # void
print(format_result(solve("5(0) * 3"))) # 15(0)
print(format_result(solve("5 erased 3"))) # 2 + 3(0)
print(format_result(solve("5(0)(0)"))) # 5 (double absence = present)
# Zero operations
print(format_result(solve("0 + 0"))) # 2(0) (two absences)
print(format_result(solve("0 * 0"))) # 1 (absence of absence = presence)
print(format_result(solve("10 * 0"))) # 10(0)
print(format_result(solve("10 / 0"))) # 10(0)
Interactive Calculator
After installing, you can run the interactive calculator from the command line:
phantomtrace
Or as a Python module:
python -m absence_calculator
This gives you a calc >> prompt where you can type expressions and see results.
Core Concepts
Objects and States
An object is a number that has both a value and a state:
- Present (default): Written normally, e.g.
5. Present quantities reflect the presence of a given unit of interest. (e.g. if the unit is a cat, then 5 represents 5 cats that are there or in a present state) - Absent: Written with
(0), e.g.5(0)— think of it as5 * 0. Absent quantities reflect the absence of a given unit of interest. (e.g. if the unit is a phone, then 5(0) represents 5 phones that are not currently there but are still considered for computation)
Absence
- Zero:
0is not emptiness, it's one absence (1(0) = 1 * 0 = 0) - Absence of absence returns to present:
5(0)(0) = 5, and0(0) = 1
Operations
| Operation | Symbol | Rule |
|---|---|---|
| Addition | + |
Expands the amount of objects under consideration. Same state: magnitudes combine. Mixed: unresolved |
| Subtraction | - |
Contracts the amount of objects under consideration. (If the domain of consideration is constricted to nothing then the result is void. Void is not an object, nor the new zero, it simply means we are not considering anything on which to act.) Same state: magnitudes reduce. Mixed: unresolved |
| Multiplication | * |
Magnitudes multiply. States combine (presentpresent=present, absentpresent=absent, absent*absent=present) |
| Division | / |
Magnitudes divide. States combine same as multiplication. Division by 0 is defined! |
| Erasure | erased |
Same state required. Remainder keeps state, erased portion flips state |
Result Types
- AbsentNumber: A number with a state (present or absent)
- Void: Complete cancellation — not zero, but the absence of any quantity under consideration
- ErasureResult: Two parts — remainder (keeps state) and erased portion (flipped state)
- Unresolved: An expression that cannot be simplified (e.g., adding present + absent)
API Reference
Types
AbsentNumber(value, absence_level=0)— A number with a state.absence_level0 = present, 1 = absentVoid/VOID— Represents complete cancellationErasureResult(remainder, erased)— Result of an erasure operationUnresolved(left, op, right)— An expression that can't be simplified
Functions
add(x, y)— Add two AbsentNumberssubtract(x, y)— Subtract two AbsentNumbersmultiply(x, y)— Multiply two AbsentNumbersdivide(x, y)— Divide two AbsentNumberserase(x, y)— Erase y from x (both must have same state)solve(expr_string)— Parse and evaluate a string expressionformat_result(result)— Convert any result to a readable stringparse_number(s)— Parse a string like"5(0)"into an AbsentNumber
Constants
ALL_OPERATIONS— Dictionary describing all operations with rules and examples
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file phantomtrace-0.1.0.tar.gz.
File metadata
- Download URL: phantomtrace-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d58995f102ee7cb6e9a87fb23d9b18a36fd1f2c6dd94bb529bc3fdefcccb30b
|
|
| MD5 |
b1b3f95315cd0747714335ee309deee7
|
|
| BLAKE2b-256 |
9a8c1e8300b5d8960f765587cc37439c7a376b9d90cd1ab4c8ca02cdc026e1fb
|
File details
Details for the file phantomtrace-0.1.0-py3-none-any.whl.
File metadata
- Download URL: phantomtrace-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10a71a0fcecbb7d5f3d13de9200c29e051a7e1585b2a9fbc81765900e2cf5db5
|
|
| MD5 |
6a3f501fb6053479fe20c8d3eafba748
|
|
| BLAKE2b-256 |
e8ac91c1577d47b808c63b0e47dcecb33ae479571897d39cef63dc5ec0a4c082
|