feat: Finish Chapter 5

This commit is contained in:
Glen Whitney 2021-01-19 21:00:56 -08:00
parent a33c1585d6
commit d5a19e0d69
6 changed files with 81 additions and 9 deletions

View file

@ -1,7 +1,7 @@
/** md
Title: The Remaining Tests
## Programmable Rewriting strategies
## Programmable Rewriting Strategies
The manual then begins to discuss "programmable rewriting strategies" in
[Section 5.2](http://www.metaborg.org/en/latest/source/langdev/meta/lang/stratego/strategoxt/05-rewriting-strategies.html#programmable-rewriting-strategies)
@ -54,12 +54,13 @@ test sec5_1_2_test1_cnf_ex [[
Or(Not(Atom("r")), Atom("q"))),
Atom("p"))
test sec5_1_2_test1_both_ex [[
test sec5_1_2_test1_both [[
(r -> p & q) & p
]] run dcnf to (Or(And(Not(Atom("r")),Atom("p")),And(And(Atom("p"),Atom("q")),Atom("p"))),
And(And(Or(Not(Atom("r")), Atom("p")),
Or(Not(Atom("r")), Atom("q"))),
Atom("p")))
]] run dcnf to Atom("x")
//(Or(And(Not(Atom("r")),Atom("p")),And(And(Atom("p"),Atom("q")),Atom("p"))),
// And(And(Or(Not(Atom("r")), Atom("p")),
// Or(Not(Atom("r")), Atom("q"))),
// Atom("p")))
test sec5_3_1_test1_dnf_ex [[
(r -> p & q) & p
@ -70,3 +71,23 @@ test sec5_3_1_test1_cnf_ex [[
]] run cnf4 to And(And(Or(Not(Atom("r")), Atom("p")),
Or(Not(Atom("r")), Atom("q"))),
Atom("p"))
test sec5_3_2_eval_up_ex [[
(1 -> p & q) & p
]] run eval-up to And(And(Atom("p"),Atom("q")),Atom("p"))
test sec5_3_2_eval_down_ex [[
(1 -> p & q) & p
]] run eval-down to And(And(Atom("p"),Atom("q")),Atom("p"))
test sec5_3_2_desugar_ex [[
(1 -> p & q) & p
]] run desugar to And(Or(Not(True()),And(Atom("p"),Atom("q"))),Atom("p"))
test sec5_3_2_impl_nf_ex [[
(1 -> p & q) & p
]] run impl-nf to Impl(Impl(Impl(True(),Impl(Impl(Atom("p"),
Impl(Atom("q"),False())),
False())),
Impl(Atom("p"),False())),
False())