Metadata-Version: 2.4
Name: tamber-tower
Version: 3.2.0
Summary: 塔数系统（Ta Numbers）的 Python 实现
Home-page: https://github.com/yourusername/tamber
Author: Tamber Team
Author-email: 3753227864@qq.com
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: requires-python
Dynamic: summary

# Tamber 塔数模块

一个用于处理塔数系统的 Python 模块，支持塔数的创建、转换和各种运算，包括外部运算、内部运算、结构运算和升维运算四大体系。

A Python module for handling the Tamber Number system, supporting the creation, conversion, and various operations of Tamber Numbers, including four major systems: external operations, internal operations, structural operations, and dimension-lifting operations.

## 功能特性

### Features

- **talift()**: 升维运算器，执行维度提升操作（#）
- **talift()**: Dimension-lifting operator, performs dimension elevation operation (#)
- **strucal()**: 结构运算器，处理复合塔的层次化展开
- **strucal()**: Structural operator, handles hierarchical expansion of complex towers
- **allnum()**: 全值展开器，返回塔数的所有可能值
- **allnum()**: Full-value expander, returns all possible values of a Tamber Number
- **tanum()**: 将塔数转换为常数，返回可能的值集合
- **tanum()**: Converts Tamber Number to constant, returns possible value set
- **tacal()**: 外部运算器，计算包含塔数的表达式（返回单个值）
- **tacal()**: External operator, calculates expressions containing Tamber Numbers (returns single value)
- **tascal()**: 内部运算器，处理纯塔数之间的可能性叠加（返回可能值集合）
- **tascal()**: Internal operator, handles possibility superposition between pure Tamber Numbers (returns possible value set)

## 安装方法

### Installation

```bash
pip install tamber-tower
```

或者将 `tamber` 目录复制到你的 Python 项目中，添加到 Python 的搜索路径中。

Or copy the `tamber` directory to your Python project and add it to Python's search path.

## 使用示例

### Usage Examples

### 1. 基本用法

#### 1. Basic Usage

```python
from tamber import talift, tanum, tacal, tascal, strucal, allnum

# 创建塔数（使用升维运算）
ta_num = talift("5 # 1")
print(ta_num)  # 输出: 5'

# 获取塔数的可能值
values = tanum(ta_num)
print(values)  # 输出: [5, 0]

# 计算表达式（外部运算）
result = tacal("2^3'")
print(result)  # 输出: 8

# 内部运算
result = tascal("3' ⊕ 5'")
print(result)  # 输出: [3, 5, 8, 0]
```

### 2. 升维运算示例

#### 2. Dimension-Lifting Operation Examples

```python
# 常数 # 常数 → 多塔数
result = talift("2 # 3")
print(result)  # 输出: 2'''

# 塔数 # 常数 → 多塔数
result = talift("1' # 2")
print(result)  # 输出: 1'''

# 常数 # 塔数 → 复合塔
result = talift("3 # 4'")
print(result)  # 输出: ((3')')'

# 塔数 # 塔数 → 复合塔
result = talift("5' # 6'")
print(result)  # 输出: ((5')')'
```

### 3. 结构运算示例

#### 3. Structural Operation Examples

```python
# 复合塔结构运算
result = strucal("(2')' ⊕ (3')'")
print(result)  # 输出层次化结构

# 多塔数与单塔数结构运算
result = strucal("(1 # 3) ⊗ 2'")
print(result)  # 输出层次化结构
```

### 4. 全值展开示例

#### 4. Full-Value Expansion Examples

```python
# 展开单塔数
result = allnum("2'")
print(result)  # 输出: [2, 0]

# 展开多塔数
result = allnum("3 # 2")
print(result)  # 输出: [3, -3, 0, 0, 0]

# 展开复合塔
result = allnum("(4')'")
print(result)  # 输出: [4, 0, 0]
```

### 5. 支持的运算符

#### 5. Supported Operators

#### 外部运算（塔数-常数混合）

##### External Operations (Tamber Number-Constant Mix)

- **加法**: `+`
- **Addition**: `+`
- **减法**: `-`
- **Subtraction**: `-`
- **乘法**: `×`
- **Multiplication**: `×`
- **除法**: `÷`
- **Division**: `÷`
- **幂运算**: `^`
- **Exponentiation**: `^`
- **开方运算**: `√`
- **Square Root**: `√`
- **升维运算**: `#`
- **Dimension-Lifting**: `#`
- **括号**: `()`
- **Parentheses**: `()`

#### 内部运算（纯塔数之间）

##### Internal Operations (Between Pure Tamber Numbers)

- **加法**: `⊕` 或 `+`
- **Addition**: `⊕` or `+`
- **减法**: `⊖` 或 `-`
- **Subtraction**: `⊖` or `-`
- **乘法**: `⊗` 或 `*`
- **Multiplication**: `⊗` or `*`
- **除法**: `⊘` 或 `/`
- **Division**: `⊘` or `/`
- **升维运算**: `#`
- **Dimension-Lifting**: `#`
- **括号**: `()`
- **Parentheses**: `()`

### 6. 塔数类型

#### 6. Tamber Number Types

```python
from tamber import talift, parse_number

# 单塔数
ta1 = talift("5 # 1")
print(ta1)  # 输出: 5'

# 双塔数
ta2 = parse_number("3''")
print(ta2)  # 输出: 3''

# 多塔数
ta3 = talift("2 # 3")
print(ta3)  # 输出: 2'''

# 特殊塔数
ta4 = parse_number("inf'")
print(ta4)  # 输出: inf'

# 混合类塔数
ta5 = parse_number("2'3")
print(ta5)  # 输出: 2'3

# 复合塔
ta6 = talift("3 # 4'")
print(ta6)  # 输出: ((3')')'
```

### 7. 外部运算示例

#### 7. External Operation Examples

```python
# 塔数加法
print(tacal("1' + 2'"))  # 输出: 2

# 塔数乘法
print(tacal("2' × 3'"))  # 输出: 6'

# 塔数幂运算
print(tacal("2'^3'"))  # 输出: 8'

# 常数底塔指数
print(tacal("2^3'"))  # 输出: 8

# 塔数底常指数
print(tacal("2'^3"))  # 输出: 8

# 混合类塔数
print(tacal("2'3 + 4'5"))  # 输出: 45

# 升维运算 + 外部运算
print(tacal("2 # 3 + 4'"))  # 输出: 4
```

### 8. 内部运算示例

#### 8. Internal Operation Examples

```python
# 内部加法
print(tascal("3' ⊕ 5'"))  # 输出: [3, 5, 8, 0]

# 内部减法（自减升维）
print(tascal("4' ⊖ 4'"))  # 输出: 4''

# 内部乘法
print(tascal("2' ⊗ 3'"))  # 输出: 6'''

# 内部除法
print(tascal("10' ⊘ 2'"))  # 输出: [5, inf']

# 升维运算 + 内部运算
print(tascal("1 # 3 ⊗ 2'"))  # 输出: [2, -2, 0, 0, 0]
```

## 塔数系统规则

### Tamber Number System Rules

### 基本定义

#### Basic Definitions

- **常数**: 普通数字，如 `1`, `2`, `3`
- **Constant**: Regular number, e.g., `1`, `2`, `3`
- **单塔数**: 带一个撇号的数字，如 `1'`, `2'`, 状态集 `{a, 0}`
- **Single Tamber Number**: Number with one apostrophe, e.g., `1'`, `2'`, state set `{a, 0}`
- **双塔数**: 带两个撇号的数字，如 `1''`, `2''`, 状态集 `{a, -a, 0}`
- **Double Tamber Number**: Number with two apostrophes, e.g., `1''`, `2''`, state set `{a, -a, 0}`
- **多塔数**: 带更多撇号的数字，如 `1'''`, 更高维可能性
- **Multi Tamber Number**: Number with more apostrophes, e.g., `1'''`, higher-dimensional possibilities
- **复合塔**: 嵌套的塔数结构，如 `((a')')'`
- **Complex Tamber Number**: Nested Tamber Number structure, e.g., `((a')')'`
- **特殊塔数**: `inf'`, 状态集 `{inf, 0}`
- **Special Tamber Number**: `inf'`, state set `{inf, 0}`
- **混合类**: 高位塔数位，低位常数位，如 `2'3`
- **Mixed Type**: High digit Tamber Number, low digit constant, e.g., `2'3`

### 外部运算规则

#### External Operation Rules

- **塔数 + 塔数**: 若两数相等结果为 0，否则结果为后一个数
- **Tamber Number + Tamber Number**: 0 if equal, otherwise the latter value
- **塔数 + 常数**: 结果为常数
- **Tamber Number + Constant**: Result is constant
- **常数 + 塔数**: 结果为两数之和
- **Constant + Tamber Number**: Result is sum of both
- **塔数 × 塔数**: 结果为两数之积的塔数
- **Tamber Number × Tamber Number**: Result is product as Tamber Number
- **塔数 × 常数**: 结果为 0（湮灭规则）
- **Tamber Number × Constant**: Result is 0 (annihilation rule)
- **塔数 ^ 塔数**: 结果为塔数
- **Tamber Number ^ Tamber Number**: Result is Tamber Number
- **塔数 ^ 常数**: 结果为常数
- **Tamber Number ^ Constant**: Result is constant
- **常数 ^ 塔数**: 结果为常数
- **Constant ^ Tamber Number**: Result is constant

### 内部运算规则

#### Internal Operation Rules

- **塔数 ⊕ 塔数**: 计算所有可能值的组合
- **Tamber Number ⊕ Tamber Number**: Calculate all possible value combinations
- **塔数 ⊖ 塔数**: 自减升维（`a' ⊖ a' = a''`）
- **Tamber Number ⊖ Tamber Number**: Self-subtraction dimension lift (`a' ⊖ a' = a''`)
- **塔数 ⊗ 塔数**: 保持塔数性质
- **Tamber Number ⊗ Tamber Number**: Maintain Tamber Number properties
- **塔数 ⊘ 塔数**: 引入 `inf'`
- **Tamber Number ⊘ Tamber Number**: Introduce `inf'`

### 升维运算规则

#### Dimension-Lifting Operation Rules

- **常数 # 常数**: 生成多塔数 `a^{(k)}`
- **Constant # Constant**: Generate multi Tamber Number `a^{(k)}`
- **塔数 # 常数**: 增加塔层数 `a^{(m+k)}`
- **Tamber Number # Constant**: Increase tower levels `a^{(m+k)}`
- **常数 # 塔数**: 生成复合塔 `((a')')'`
- **Constant # Tamber Number**: Generate complex tower `((a')')'`
- **塔数 # 塔数**: 生成复合塔
- **Tamber Number # Tamber Number**: Generate complex tower

## 错误处理

### Error Handling

- 除数不能为零
- Division by zero is not allowed
- 不能对负数开方
- Square root of negative number is not allowed
- 括号必须匹配
- Parentheses must match
- 运算符格式必须正确
- Operator format must be correct
- 无效字符
- Invalid characters

## 版本信息

### Version Information

- 版本: 3.1.5
- Version: 3.1.5
- 作者: Sudely
- Author: Sudely
- 日期: 2026-02-10
- Date: 2026-02-10
- 特性: 支持升维运算、结构运算、全值展开、复合塔
- Features: Support dimension-lifting operations, structural operations, full-value expansion, complex towers

## 塔数系统 v4.0.0 特性

### Tamber Number System v4.0.0 Features

塔数是一种描述可能性、观测与结构维度的数学系统。数字不仅是值，还携带不确定性层次与观测历史路径。系统通过独特的运算规则、升维操作与结构嵌套，实现对"观测如何塑造现实"的形式化建模。

Tamber Numbers are a mathematical system describing possibility, observation, and structural dimensions. Numbers are not just values, but also carry uncertainty levels and observation history paths. Through unique operation rules, dimension-lifting operations, and structural nesting, the system realizes formal modeling of "how observation shapes reality."

### 四大运算体系

#### Four Major Operation Systems

- **外部运算** (+, -, ×, ÷, ^, √): 观测坍缩过程
- **External Operations** (+, -, ×, ÷, ^, √): Observation collapse process
- **内部运算** (⊕, ⊖, ⊗, ⊘): 可能性叠加
- **Internal Operations** (⊕, ⊖, ⊗, ⊘): Possibility superposition
- **结构运算**: 层次化展开
- **Structural Operations**: Hierarchical expansion
- **升维运算** (#): 维度提升与结构转换
- **Dimension-Lifting Operations** (#): Dimension elevation and structural transformation
