phino-0.0.83: 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
description: 'π(β¦π΅1, Ξ» β€ F, π΅2β§.Ο) βΏ π(π©(πΌ(β¦π΅1, Ξ» β€ F, π΅2β§).Ο))'
match: 'β¦π΅1, Ξ» β€ !F, π΅2β§.π'
where:
- meta: π
function: lambda
args:
- 'β¦π΅1, Ξ» β€ !F, π΅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: stuck
description: 'π(n) βΏ β₯ otherwise'
match: π
then: β₯