Warning:
This wiki has been archived and is now read-only.

Factorial Forward Chaining

From RIF
Jump to: navigation, search




Test TypePositiveEntailmentTest
ContributorGary Hallmark
StatusApproved
Record9 June 2009 telecon
DialectCore
Purposeexpress factorial using Core
DescriptionThis version of factorial is safe, and thus can be implemented by a forward chaining Core or PRD reasoner. Note the difference from Factorial Relational -- the variable ?N is computed from ?N1 rather than the other way around.
SeeAlsoFactorial Relational, Factorial Functional
SpecRef
Premises
Presentation SyntaxDocument( Prefix(pred <http://www.w3.org/2007/rif-builtin-predicate#>) Prefix(func <http://www.w3.org/2007/rif-builtin-function#>) Prefix(ex <http://example.org/example#>) Group ( ex:factorial(0 1) Forall ?N ?F ?N1 ?F1 ( ex:factorial(?N ?F) :- And(External(pred:numeric-greater-than-or-equal(?N1 0)) ?N = External(func:numeric-add(?N1 1)) ex:factorial(?N1 ?F1) ?F = External(func:numeric-multiply(?N ?F1)) ) ) ) )
XMLview RIF/XML
Conclusion
Presentation Syntaxex:factorial(6 720)
XMLview RIF/XML