Skip to content
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

Port Reduct #21

Open
kasimebrahim opened this issue Jul 16, 2018 · 7 comments
Open

Port Reduct #21

kasimebrahim opened this issue Jul 16, 2018 · 7 comments

Comments

@kasimebrahim
Copy link
Collaborator

As suggested in issue #3, In order to proceed to porting other subsystems we choose to wrap the existing Combo reduct engine.
Given a program P to be reduced, first we want to convert P to a combo::tree CP and reduce it using reduct to CP_reduced then convert it back to Atomese P_reduced.
Finally we need to store it in ReductLink, ReductLink can be

 REDUCT_LINK <- ORDERED_LINK "ReductLink"
(ReductLink
    (Schema "Rule")
    (Schema "P")
    (Schema "P_reduced"))

or just

(ReductLink
    (Schema "P")
    (Schema "P_reduced"))
@masrb
Copy link
Collaborator

masrb commented Jul 24, 2018

I think according to issue #3 , it is

(ReductLink
  (And
    (Predicate "f1")
    (Predicate "f1"))
  (Predicate "f1")))

behailu04 pushed a commit to behailu04/asmoses that referenced this issue Nov 3, 2018
@linas
Copy link
Member

linas commented Feb 7, 2019

Several remarks:

  • A portion of ReductLink has already been implemented; it is here: atomspace/opencog/atoms/reduct It only does the arithmetic links (plus, minus, times, divide)

  • It is implemented in C++ After implementing it in C++ I realized that this was just crazy and hard and inefficient and a totally untenable long-term strategy.

  • I'm not just expressing some idle opinion -- just look at the grunge that is moses reduct! Its huge, complicated, and porting/debugging that as C++ code would be insane.

  • So, instead, the proposal is to replace moses reduct by atomspace rules, as a bunch of bind-links: viz "IF this pattern matches THEN output a reduced pattern". Then run all of these rules over and over, in a loop, until not a single one of them matches any more. At that point, the reduction is done.

  • Its possible that maybe the ForwardChainer can run the above loop (ask @ngeiswei to be sure)

  • The above is the practice. The theory is that reduct is a kind-of-abstract term-rewriting-system. A simple one. The rules are just the rewrite rules of arithmetic (e.g. (x+0) reduces to x) and the rules of propositional logic (e.g. (y and True) reduces to y) The idea is that, by looping over and over on the rules, one continues until one has reached a "normal form" that cannot be reduced any further. See https://en.wikipedia.org/wiki/Normal_form_(abstract_rewriting) and https://en.wikipedia.org/wiki/Abstract_rewriting_system

  • By writing the rules in the atomspace, instead of hard-coding them in C++, you get to add other kinds of algebras to the system (there is much much much more to the world than just the axioms of arithmetic, and the axioms of propositional logic!!)

The upshot is -- you do not need ReductLink. You just need to write some reduction rules, and let the pattern matcher do the job it was designed to do.

Yes, this is easy to say, and maybe harder to do. You should start out by writing few simple rules, and see how it goes. I'm here to help.

@linas linas mentioned this issue Feb 7, 2019
@ngeiswei
Copy link
Member

ngeiswei commented Feb 8, 2019

@linas,

ReductLink
   A
   B

would not reduce but just indicate that expression B is reduced form of expression A.

We need to keep track of that because some reductions are defined recursively, such "if B1 is the reduced form of A1 and B2 is the reduced form of A2, then D = blahblah of B1 and B2 is the reduced form of C = blahblah of A1 and A2".

The plan is indeed to have the URE performs the reduction (forward and backward chainer should be possible).

@ngeiswei
Copy link
Member

ngeiswei commented Feb 8, 2019

The ReductLink name is not set in stone, just till we find the actual name. The fact that it trumped you indicates we do need a better one. Note that we don't need a new link type we can use

Evaluation
  Predicate "is-reduction-of"
  List
    A
    B

but since it is gonna be used quite extensively a dedicated link sounds appropriate, though for starter we can probably go with an EvaluationLink.

@ngeiswei
Copy link
Member

ngeiswei commented Feb 8, 2019

Maybe a better link name would be ReducedToLink.

@linas
Copy link
Member

linas commented Feb 8, 2019

OH, OK. I'm pretty certain you want to assign them to named classes, and limit reduct so that it works only with the provided classes (instead of any old link it can find in the atomspace). The classic moses ones were "arithmetic" and "propositional logic". but there are many more: "linear algebra" is popular for "linear programming problems", and integer algebras are popular for "discrete linear programming", and then there are dozens? hundreds? of different kinds of modal logics, each with it's own set of reduction rules.

@linas
Copy link
Member

linas commented Apr 24, 2020

See also issue #66 for more about arithmetic functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants