Open ngeiswei opened 4 months ago
We have a Rust function which checks two atoms for being alpha-equivalent: https://github.com/trueagi-io/hyperon-experimental/blob/9c126b107f8a5c4ea95db33f7c805e70692d8e9c/lib/src/atom/matcher.rs#L1253 Thus it is not a problem to add couple new operations actually.
Awesome, would you do it? Or would you rather have me do it? I'll be a bit slower but it should be within my reach.
Also, there are at least two ways to do it:
atoms_are_equivalent
to MeTTa, then implement assertAlphaEqual
in MeTTa (add it in stdlib.metta
I suppose).assertAlphaEqual
in Rust, exposed to MeTTa.Even if we go with 2, I think it would be useful to expose atoms_are_equivalent
to MeTTa. I did find it useful in my own code, and I assume the Rust implementation is far more efficient than my MeTTa implementation.
Also, how would you name in MeTTa
atoms_are_equivalent
. I have used =alpha
in my code for instance.assertEqual
up to alpha-equivalence? I had thought of assertAlphaEqual
but they are other possibilities like assertEquivalent
, etc.Also, a different issue that I'm bringing only because we are discussing names. I don't understand the name assertEqualToResult
. Didn't you mean assertEqualToResults
, ending with an s? But anyway, that certainly is for another issue.
Describe the bug Probably not a bug, but it would be very convenient if
assertEqual
andassertEqualToResult
could support alpha-equivalence. Either it could be the default (maybe undesirable though), or new assert operators, such asassertAlphaEqual
andassertAlphaEqualToResult
could be added.To Reproduce Steps to reproduce the behavior:
Expected behavior If
assertEqual
supported alpha-equivalence it would output[()]
.Actual behavior Instead it outputs
Additional context
assertAlphaEqual
andassertAlphaEqualToResult
than relaxing the behavior ofassertEqual
. Such addition could be at the Rust level or at the MeTTa level. Note that I have already implemented an alpha-equivalence MeTTa function here https://github.com/ngeiswei/chaining/blob/97923a18f3c6138f2eaf697e89ca9500e219e729/experimental/converters/calculi-converter.metta#L311-L327. However it is slow and I wonder if it would be actually easier to implement at the Rust level. If you think implementing it at the MeTTa level is fine, I'm happy to take care of it.