Skip to content

Commit

Permalink
CVS v1.2 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bediger4000 committed May 21, 2016
1 parent 46811bb commit 69a79ae
Show file tree
Hide file tree
Showing 2 changed files with 591 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests.in/050
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# {B, T, M, K} basis
# $Id: 050,v 1.1 2011/07/10 17:36:35 bediger Exp $
rule: B 1 2 3 -> 1 (2 3)
rule: T 1 2 -> 2 1
rule: M 1 -> 1 1
rule: K 1 2 -> 1

# Crummy, home-made algorithm.
abstraction: [_] *- -> K 1
abstraction: [_] _ -> B (T M) K
abstraction: [_] *- _ -> 1
abstraction: [_] *^ *^ -> [_] M 1
abstraction: [_] *- *+ -> B 1 ([_] 2)
abstraction: [_] *+ *- -> B (T 2) ([_] 1)
abstraction: [_] * * -> B (T (B (T ([_]2))(B B ([_]1)))) (B M (B B T))

# Check each of the abstraction rules
[x] Z = K Z
[x] x = B (T M) K
[x] Z x = Z
[x] x x = M
[x] Z (T x) = B Z T
[x] (T x) Z = B (T Z) T
[x] (T x) (B x) = B (T (B (T B) (B B T))) (B M (B B T))
# Exercize abstraction rule 4, above.
[x,y,z] (x x) (y y) (z z) = B (B (T M)) (B (B B) (B (T M) (B B M)))
# Leave out rule 4 ([_] *^ *^ -> [_] M 1) and you get a much, much bigger expression.
def WO_RULE4 B (B (T (B (T (B (T (B (T M) K)) (B B (B (T M) K)))) (B M (B B T))))) (B (B B) (B (T (B (T (B (T (B (T M) K)) (B B (B (T M) K)))) (B M (B B T)))) (B B (B (T (B (T (B (T M) K)) (B B (B (T M) K)))) (B M (B B T))))))
[x,y,z] (x x) (y y) (z z) = WO_RULE4
#
# Very small Fixed point combinator:
def Y [x] B x M (B x M)
# And it has a normal form:
Y
#
load tests.in/abstractions
Loading

0 comments on commit 69a79ae

Please sign in to comment.