diff --git a/site/docs/src/SUMMARY.md b/site/docs/src/SUMMARY.md index 32c966896..1a904800c 100644 --- a/site/docs/src/SUMMARY.md +++ b/site/docs/src/SUMMARY.md @@ -1,3 +1,4 @@ # Summary - [README](./README.md) +- [User-defined rules](./user-defined-rules.md) diff --git a/site/docs/src/common/normalize-phi-options.md b/site/docs/src/common/normalize-phi-options.md new file mode 100644 index 000000000..8ea6ab178 --- /dev/null +++ b/site/docs/src/common/normalize-phi-options.md @@ -0,0 +1,18 @@ +Learn about `normalize-phi` options. + +```sh +normalize-phi --help +``` + +```console +Normalizer + +Usage: normalize-phi [-c|--chain] [--rules-yaml STRING] [-o|--output STRING] + [STRING] + +Available options: + -h,--help Show this help text + -c,--chain Print out steps of reduction + --rules-yaml STRING Path to the Yaml file with custom rules + -o,--output STRING Output file path (defaults to stdout) +``` diff --git a/site/docs/src/common/sample-program.md b/site/docs/src/common/sample-program.md new file mode 100644 index 000000000..5d008f63b --- /dev/null +++ b/site/docs/src/common/sample-program.md @@ -0,0 +1,18 @@ +Save a `PHI` program to a file. +This program will be used in subsequent commands. + +```sh +cat > program.phi < + +## Use rules + +{{#include ./common/normalize-phi-options.md}} + +### Sample program + +{{#include ./common/sample-program.md}} + +### Prepare environment + +The commands in the following sections access files that are available in the project repository. +Clone and enter the repository directory. + +```sh +git clone https://github.com/objectionary/normalizer +cd normalizer +``` + +#### `--ruleset-yaml` + +Normalize a 𝜑-expression from `program.phi` using the [yegor.yaml](#yegoryaml) rules. + +There can be multiple numbered results that correspond to multiple rule application sequences. + +```sh +normalize-phi --rules-yaml ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml program.phi +``` + +```console +Rule set based on Yegor's draft +Input: +{ a ↦ ⟦ b ↦ ⟦ c ↦ ∅, d ↦ ⟦ φ ↦ ξ.ρ.c ⟧ ⟧, e ↦ ξ.b (c ↦ ⟦ ⟧).d ⟧.e } +==================================================== +Result 1 out of 1: +⟦ a ↦ ξ.b (c ↦ ⟦ ⟧).d (ρ ↦ ⟦ b ↦ ⟦ c ↦ ∅, d ↦ ⟦ φ ↦ ξ.ρ.c ⟧ ⟧ ⟧) ⟧ +---------------------------------------------------- +``` + +#### `--chain` + +Use `--chain` to see numbered normalization steps for each normalization result. + +```sh +normalize-phi --chain --rules-yaml ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml program.phi +``` + +```console +Rule set based on Yegor's draft +Input: +{ a ↦ ⟦ b ↦ ⟦ c ↦ ∅, d ↦ ⟦ φ ↦ ξ.ρ.c ⟧ ⟧, e ↦ ξ.b (c ↦ ⟦ ⟧).d ⟧.e } +==================================================== +Result 1 out of 1: +[ 1 / 2 ]⟦ a ↦ ⟦ b ↦ ⟦ c ↦ ∅, d ↦ ⟦ φ ↦ ξ.ρ.c ⟧ ⟧, e ↦ ξ.b (c ↦ ⟦ ⟧).d ⟧.e ⟧ +[ 2 / 2 ]⟦ a ↦ ξ.b (c ↦ ⟦ ⟧).d (ρ ↦ ⟦ b ↦ ⟦ c ↦ ∅, d ↦ ⟦ φ ↦ ξ.ρ.c ⟧ ⟧ ⟧) ⟧ +---------------------------------------------------- +``` + +#### `--single` + +Use `--single` to print a single normalized program. + +```sh +normalize-phi --single --rules-yaml ./eo-phi-normalizer/test/eo/phi/rules/yegor.yaml program.phi +``` + +```console +⟦ a ↦ ξ.b (c ↦ ⟦ ⟧).d (ρ ↦ ⟦ b ↦ ⟦ c ↦ ∅, d ↦ ⟦ φ ↦ ξ.ρ.c ⟧ ⟧ ⟧) ⟧ +```