-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Fix code in README.md
+ (auto)align version in repl + minor improvements (typos, etc.)
#36
Conversation
@@ -37,7 +37,7 @@ Loaded! | |||
|
|||
We can then ask it to solve 2 + 3 (and find the correct answer 5): | |||
|
|||
``` | |||
```text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR makes it so that README.md
is used in lib.rs
as Rust doc (see below) to check the code. Rust assumes code blocks to be "rust" by default, so we need to say "text" here.
We can now ask the solver to prove statements within this universe, e.g. that "there exists an X | ||
such that X + 2 = 3". This statement is indeed true for X = 1, and indeed, the solver will provide | ||
this answer: | ||
// We can now ask the solver to prove statements within this universe, e.g. that "there exists an X |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The easiest way to make cargo test
pass was to merge these blocks. We are trading flexibility of writing for correctness, though.
@@ -147,6 +147,11 @@ | |||
//! | |||
//! | |||
|
|||
// Test examples from README.md. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This "trick" allows to ensure the code in the README.md
is checked during cargo test
w/o using additional dependencies.
@@ -131,8 +139,7 @@ r.insert(Rule::fact(is_natural, vec![z.into()])); | |||
// Define the rule `is_natural(s(P)) :- is_natural(P)`, i.e. that | |||
// the successor of P is a natural number if P is also a natural number. | |||
r.insert(ast::forall(|[p]| { | |||
Rule::fact(is_natural, vec![ast::app(s, vec![p.into()])]) | |||
.when(is_natural, vec![p.into()]) | |||
Rule::fact(is_natural, vec![ast::app(s, vec![p.into()])]).when(is_natural, vec![p.into()]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is due to rustfmt
.
// Obtain an iterator that allows us to exhaustively search the solution space: | ||
let solutions = query_dfs( | ||
&r, | ||
&mut r, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the following makes cargo test
pass. Not sure if it's the best way to resolve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for your cleanup!
And glad to hear my little hobby project could be of use :)
I think the title says everything. I'll add a bit of explanation inline.
PS: Thanks for this library! We are looking very closely into it, because it might help us a lot!