From b2cca2c5584ee92a2fbd006ca7d33f4dddec7d93 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 24 Apr 2022 15:45:39 +0200 Subject: Tests --- src/Reducer.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Reducer.hs') diff --git a/src/Reducer.hs b/src/Reducer.hs index 809687b..a7c544a 100644 --- a/src/Reducer.hs +++ b/src/Reducer.hs @@ -20,11 +20,11 @@ bind :: Expression -> Expression -> Int -> Expression bind exp (Bruijn x) n = if x == n then exp else Bruijn x bind exp (Application exp1 exp2) n = Application (bind exp exp1 n) (bind exp exp2 n) -bind exp (Abstraction exp') n = Abstraction (bind (exp <-> 0) exp' (succ n)) +bind exp (Abstraction exp') n = Abstraction (bind (exp <-> (-1)) exp' (succ n)) step :: Expression -> Expression step (Bruijn exp ) = Bruijn exp -step (Application (Abstraction exp) app ) = (bind (app <-> 0) exp 0) <+> 0 +step (Application (Abstraction exp) app ) = (bind (app <-> (-1)) exp 0) <+> 0 step (Application exp1 exp2) = Application (step exp1) (step exp2) step (Abstraction exp ) = Abstraction (step exp) -- cgit v1.2.3