linear-logic
БесплатноБез исполняемых скриптовНе проверенLinear Logic Skill
от plurigrid★ 73 звезды на GitHubОб этом скилле
linear-logic Skill
"Every resource used exactly once. No copying. No discarding. Pure computation."
Overview
Linear Logic implements Girard's linear logic for resource-aware computation. Linear types ensure resources are used exactly once, enabling safe concurrency and optimal memory management.
GF(3) Role
| Aspect | Value |
|---|---|
| Trit | -1 (MINUS) |
| Role | VALIDATOR |
| Function | Validates resource usage constraints |
Connectives
┌─────────────────────────────────────────────────────────────────┐
│ LINEAR LOGIC CONNECTIVES │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Multiplicative: Additive: │
│ │
│ A ⊗ B (tensor) A ⊕ B (plus/choice) │
│ A ⅋ B (par) A & B (with/product) │
│ 1 (unit) 0 (zero) │
│ ⊥ (bottom) ⊤ (top) │
│ │
│ Exponential: Negation: │
│ │
│ !A (of course) A⊥ (linear negation) │
│ ?A (why not) │
│ │
└─────────────────────────────────────────────────────────────────┘
Resource Semantics
-- Linear type: must be used exactly once
data Linear a where
Use :: a -> Linear a
-- Consume: takes ownership, returns result
consume :: Linear a -> (a -> b) -> b
consume (Use x) f = f x
-- Cannot duplicate linear values!
-- duplicate :: Linear a -> (Linear a, Linear a) -- FORBIDDEN
-- Cannot discard linear values!
-- discard :: Linear a -> () -- FORBIDDEN
Proof Net Representation
┌───────────────────────────────────────┐
│ PROOF NET STRUCTURE │
└───────────────────────────────────────┘
A ⊗ B ⊸ C A ⅋ (B ⊸ C)
│ │
┌──┴──┐ ┌───┴───┐
│ ⊗ │ │ ⅋ │
└──┬──┘ └───┬───┘
╱ ╲ ╱ ╲
A B A B⊸C
╲ │
╲ ┌───┴───┐
╲ │ ⊸ │
╲ └───┬───┘
C ╱ ╲
B C
Linear Types in Rust
// Rust's ownership = linear types!
fn linear_example() {
let resource = acquire_resource(); // Linear resource
// resource can only be used once
consume(resource);
// This would fail to compile:
// consume(resource); // ERROR: use of moved value
// This would also fail:
// drop(resource); // ERROR: use of moved value
}
// Affine types (can discard but not duplicate)
fn affine_example() {
let resource = acquire_resource();
// Can choose to not use it (drop implicitly)
// But cannot use twice
}
GF(3) Linear Validation
class LinearValidator:
"""Validate linear resource usage with GF(3)."""
TRIT = -1 # VALIDATOR role
def validate_usage(self, program) -> bool:
"""
Check that all linear resources are used exactly once.
Returns True if program is linearly valid.
"""
resources = self.extract_linear_resources(program)
usage_counts = self.count_usages(program, resources)
for resource, count in usage_counts.items():
if count != 1:
return False # Used 0 times or >1 times
return True
def validate_proof_net(self, net) -> bool:
"""
Check proof net validity via Danos-Regnier criterion.
A proof net is valid iff:
- It's connected
- Switching gives acyclic graph
"""
for switching in self.all_switchings(net):
if self.has_cycle(switching):
return False
if not self.is_connected(switching):
return False
return True
Exponentials: Controlled Non-Linearity
-- !A means "unlimited copies of A"
-- ?A means "can be discarded"
-- Promotion: introduce !
promote :: a -> !a
-- Dereliction: use one copy
derelict :: !a -> a
-- Contraction: duplicate
contract :: !a -> (!a, !a)
-- Weakening: discard
weaken :: !a -> ()
-- The exponential modality allows escape from linearity
-- but must be explicitly introduced
Curry-Howard Correspondence
| Linear Logic | Programming |
|---|---|
| A ⊗ B | Pair (both available) |
| A ⅋ B | Session type (one wait |
Установить linear-logic в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл linear-logic?
Linear Logic Skill
Как установить скилл linear-logic?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл linear-logic запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic