packages feed

phino-0.0.85: resources/morphing.yaml

# SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com
# SPDX-License-Identifier: MIT
---
# Morphing 𝕄 β€” applied top-to-bottom, first matching clause wins. The input is
# always a normal form: a non-NF expression matches no clause. 𝕄 navigates a
# normal form down to a formation one operation at a time,
# resolving the universe Ξ¦ and peeling dispatches and applications through
# normalization 𝒩. It never fires a bare atom: a saturated Ξ»-formation is
# returned untouched and fired later by 𝔼 (the 'fire' rule of 𝔻).

- name: prim
  description: '𝕄(⟦𝐡⟧) ⟿ ⟦𝐡⟧'
  match: ⟦𝐡⟧
  then: ⟦𝐡⟧

- name: lambda
  label: \lambda
  description: '𝕄(⟦𝐡1, Ξ» ‍ 𝐹, 𝐡2⟧.Ο„) ⟿ 𝕄(𝒩(𝔼(⟦𝐡1, Ξ» ‍ 𝐹, 𝐡2⟧).Ο„))'
  match: '⟦𝐡1, λ ‍ 𝐹, 𝐡2⟧.𝜏'
  where:
    - meta: 𝑒
      function: lambda
      args:
        - '⟦𝐡1, λ ‍ 𝐹, 𝐡2⟧'
  then:
    morph:
      normalize: '𝑒.𝜏'

- name: dispatch
  description: '𝕄(n.Ο„) ⟿ 𝕄(𝒩(𝕄(n).Ο„))'
  match: '𝑛.𝜏'
  where:
    - meta: 𝑒
      function: morph
      args:
        - 𝑛
  then:
    morph:
      normalize: '𝑒.𝜏'

- name: application
  description: '𝕄(n(Ο„ ↦ e)) ⟿ 𝕄(𝒩(𝕄(n)(Ο„ ↦ e)))'
  match: '𝑛(𝜏 ↦ 𝑒)'
  where:
    - meta: 𝑒1
      function: morph
      args:
        - 𝑛
  then:
    morph:
      normalize: '𝑒1(𝜏 ↦ 𝑒)'

- name: applicationa
  description: '𝕄(n(Ξ±_i ↦ e)) ⟿ 𝕄(𝒩(𝕄(n)(Ξ±_i ↦ e)))'
  match: '𝑛(α𝑖 ↦ 𝑒)'
  where:
    - meta: 𝑒1
      function: morph
      args:
        - 𝑛
  then:
    morph:
      normalize: '𝑒1(α𝑖 ↦ 𝑒)'

- name: root
  description: '𝕄(Ξ¦) ⟿ 𝕄(𝒩(e)) where e := global(), unless e is Ξ¦'
  match: Ξ¦
  where:
    - meta: 𝑒
      function: global
  when:
    not:
      eq:
        - 𝑒
        - Ξ¦
  then:
    morph:
      normalize: 𝑒

- name: dead
  description: '𝕄(βŠ₯) ⟿ βŠ₯'
  match: βŠ₯
  then: βŠ₯

- name: xi
  description: '𝕄(ΞΎ) ⟿ βŠ₯'
  match: ΞΎ
  then: βŠ₯

- name: globe
  description: '𝕄(Ξ¦) ⟿ βŠ₯ when the universe is Ξ¦ itself'
  match: Ξ¦
  then: βŠ₯