본문으로 건너뛰기
cccskills
무료GitHub에 공개

catcolab-petri-nets

CatColab Petri Nets - concurrent system modeling via places (states), transitions (events), and token flow. Foundation for process algebra, workflow, and chemical reaction networks.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(3)

  • SKILL.md5.9 KB
  • CONCOMITANT_SKILLS.md2.8 KB
  • NEIGHBOR_SKILLS.md3.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

CatColab Petri Nets: Concurrent Systems

Trit: +1 (PLUS - generator) Color: Magenta (#FF00FF)

Overview

Petri nets in CatColab model concurrent and distributed systems:

  • Places: States holding tokens (resources, conditions)
  • Transitions: Events that fire when enabled
  • Arcs: Flow of tokens between places and transitions
  • Tokens: Resources consumed/produced by transitions

Petri nets are the categorical foundation for process algebra, workflow modeling, and chemical reaction networks.

Mathematical Foundation

A Petri net is a bipartite graph:

┌─────────────────────────────────────────────────────┐
│                    PETRI NET                         │
├─────────────────────────────────────────────────────┤
│  Places (States):                                    │
│    (P1) Ready   (P2) Running   (P3) Done            │
│                                                      │
│  Transitions (Events):                               │
│    [T1] Start   [T2] Finish                          │
│                                                      │
│  Arcs (Token Flow):                                  │
│    P1 → T1 → P2 → T2 → P3                           │
│                                                      │
│  Diagram:                                            │
│    (P1)●──►[T1]──►(P2)──►[T2]──►(P3)                │
│     ●=token                                          │
└─────────────────────────────────────────────────────┘

Free Symmetric Monoidal Category

Petri nets are the free symmetric monoidal category on a signature:

Objects: P₁, P₂, ..., Pₙ (places)
Morphisms: Generated by transitions

Tensor: P₁ ⊗ P₂ (concurrent resources)
Composition: Sequential firing

Example:
  T: P₁ ⊗ P₂ → P₃ ⊗ P₄
  "Transition T consumes tokens from P₁, P₂
   and produces tokens in P₃, P₄"

Double Theory

// Petri net double theory
pub fn th_petri_net() -> DiscreteDblTheory {
    let mut cat = FpCategory::new();

    // Object type
    cat.add_ob_generator(name("Place"));

    // Morphism type (transitions as structured morphisms)
    cat.add_mor_generator(name("Transition"), name("Place"), name("Place"));

    // Monoidal structure (parallel composition)
    // P ⊗ Q represents "P and Q concurrently"

    cat.into()
}

CatColab Implementation

Place Declaration

{
  "type": "ObDecl",
  "name": "Idle",
  "theory_type": "Place",
  "description": "process waiting for input"
}

Transition Declaration

{
  "type": "MorDecl",
  "name": "activate",
  "inputs": ["Idle", "Resource"],
  "outputs": ["Active"],
  "theory_type": "Transition",
  "description": "process starts when resource available"
}

Practical Examples

Example 1: Producer-Consumer

Places: Buffer (capacity N), Produced, Consumed

Transitions:
  produce: Empty → Buffer + Produced
  consume: Buffer → Consumed

Tokens: Buffer starts empty, count items produced/consumed

Example 2: Dining Philosophers

Places: Thinking(i), Eating(i), Fork(i) for i=1..5

Transitions:
  pickup(i): Thinking(i) ⊗ Fork(i) ⊗ Fork(i+1) → Eating(i)
  putdown(i): Eating(i) → Thinking(i) ⊗ Fork(i) ⊗ Fork(i+1)

Deadlock possible when all pick up left fork simultaneously

Example 3: Chemical Reaction (A + B → C)

Places: A, B, C (species concentrations as token counts)

Transitions:
  react: A ⊗ B → C

Stochastic: Rate = k·[A]·[B] (mass action)

Connection to Stock-Flow

Petri nets and stock-flow diagrams are equivalent:

Petri Net           ≅   Stock-Flow
  Place             ↔   Stock
  Transition        ↔   Flow
  Token count       ↔   Population
  Firing rate       ↔   Mass-action rate

AlgebraicPetri.jl Integration

using AlgebraicPetri
using Catlab

# Define SIR as Petri net
sir_petri = @acset LabelledPetriNet begin
  S = 3  # places: S, I, R
  T = 2  # transitions: infect, recover

  tname = [:infect, :recover]
  sname = [:S, :I, :R]

  is = [1, 2]     # infect inputs: S, I
  os = [2, 2]     # infect outputs: I, I
  it = [1, 1]     # transition indices
  ot = [1, 1]
end

# Compose Petri nets
combined = sir_petri ⊕ vaccination_petri

GF(3) Triads

catcolab-regulatory-networks (-1) ⊗ topos-catcolab (0) ⊗ catcolab-petri-nets (+1) = 0 ✓
crn-topology (-1) ⊗ catcolab-stock-flow (0) ⊗ catcolab-petri-nets (+1) = 0 ✓

Commands

# Create Petri net
just catcolab-new petri-net "producer-consumer"

# Analyze reachability
just catcolab-analyze producer-consumer --reachability

# Check for deadlock
just catcolab-analyze producer-consumer --deadlock

# Export to PNML
just catcolab-export producer-consumer --format=pnml

# Simulate token dynamics
just catcolab-simulate producer-consumer --stochastic

References


Skill Name: catcolab-petri-nets Type: Concurrent Systems / Process Algebra Trit: +1 (PLUS) GF(3): Balances the CatColab skill ecosystem

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Model ElevenLabs voice synthesis as an ACSet schema with Unison ability handlers for typed voice operations. Use when integrating ElevenLabs TTS into category-theoretic pipelines, building typed voice synthesis workflows, or managing multi-voice narration with GF(3) conservation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

Systematic process for analyzing and modernizing legacy applications to comply with the 12-Factor App methodology. Covers code analysis, configuration externalization, dependency management, and container/Kubernetes best practices.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

13c0e3

무료

Gay MCP skill at invocation 26

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

19d57d

무료

Gay MCP skill at invocation 5

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

1ea91a

무료

Gay MCP skill at invocation 27

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

1eab21

무료

Gay MCP skill at invocation 3

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

plurigrid/asi702026년 7월 10일 업데이트

plurigrid의 스킬 모두 보기

이 스킬의 문제 신고