-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from hiratara/fix-free-vars
[BUG] Fix convert_classic_tokens
- Loading branch information
Showing
3 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use lambda_calculus::{ | ||
parse, | ||
parser::ParseError, | ||
term::Notation::{Classic, DeBruijn}, | ||
}; | ||
|
||
#[test] | ||
fn parse_debruijn_and_classic() -> Result<(), ParseError> { | ||
for (dbr, cla) in [ | ||
("12", "a b"), | ||
("λλ21", "λs. λz. s z"), | ||
( | ||
"λ2134(λ3215(λ4321)3215)2134", | ||
"λx. w x y z (λy. w x y z (λz. w x y z) w x y z) w x y z", | ||
), | ||
( | ||
// See: http://alexandria.tue.nl/repository/freearticles/597619.pdf | ||
"λ2(λ421(5(λ4127)λ8))67", | ||
// the free variable list is ..ywzfba | ||
"λx. a (λt. b x t (f (λu. a u t z) λs. w)) w y", | ||
), | ||
( | ||
// apply `plus zero one` to `s` and `z` | ||
"(λλλλ42(321))(λλ1)(λλ21)12", | ||
"(λm.λn.λs.λz. m s (n s z)) (λs.λz. z) (λs.λz. s z) s z", | ||
), | ||
] { | ||
let term_dbr = parse(dbr, DeBruijn)?; | ||
let term_cla = parse(cla, Classic)?; | ||
assert_eq!(term_dbr, term_cla); | ||
} | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters