View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

4.5 | 2 ratings Rate this file 5 Downloads (last 30 days) File Size: 8.58 KB File ID: #9218 Version: 1.01



Bill Whiten (view profile)


01 Dec 2005 (Updated )

An easy to use deduction engine useful for small expert systems and embedding complex condition ...

| Watch this File

File Information

An easy to use deduction engine useful for small expert systems and embedding complex condition statements.

Rules are written in a structure (one field for each rule) using a general format easily obtained from "If And Then? rules e.g.
"If bird And ~flies And swims Then penguin" is input as
rules.r1={'~bird' 'flies? '~swims? 'penguin?}
(This is the conjunctive normal form where each term (proposition) in the converted rule is separated by an "or" operator, and each rule by an "and" operator. Any logical conditions can be converted to this form)

Data is entered as a second struct e.g.
data.penguin=false; data.bird=true; data.swims=true

Deduction is done as: results=deduce(rules,data)

Both data and results can be printed e.g.:

A meaning struct can be created for propositions (in data & results):
info.penguin='The animal is a penguin?; info.bird=?The animal is a bird'
and used with printdata e.g. printdata(data,info)

Rules can be constructed using classical logic, but deduction is done using a two variable logic that includes unknown, partly true, partly false, and if you get it wrong inconsistent, as well as the ordinary true and false. Logic is implemented as "min" for "and" and "max" for "or", which avoids problems with redundant rules and allows efficient simple deductions.

Results give what is known about a proposition as %true and %false. So true is 100% true and 0 %false, while false is 0% true and 100% false. Data can be entered in this format also e.g. data.flies=[50 0].

Deduction is carried out using a more efficient numerical internal format, that can be used in place of the above structs for repeated use of large rule sets e.g.


Let me know if you find this useful, or are interested in getting extensions to it:


This file inspired Expert2 Propositional Logic.

MATLAB release MATLAB 7 (R14)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
10 Oct 2015 Bill Whiten

Bill Whiten (view profile)

See the update Expert2 53445

Comment only
02 Apr 2012 Ronan CIMADURE

11 Mar 2010 Bill Whiten

Bill Whiten (view profile)

The ANZIAM Journal , Volume 51 , Issue 01 , Jul 2009 , pp 102-122
doi: 10.1017/S1446181109000352 (About doi), Published online by Cambridge University Press 09 Mar 2010

Comment only
02 Dec 2005 John D'Errico

Pretty. Even if I don't have a direct use for this tool, I still
recognize something nice when I see it.

31 Mar 2016 1.01

License update

Contact us