Fuzzy logic is logic with truth values that are not necessarily 0 and 1, but somewhere in between. Here's code, mostly by [dkf] as seen in the [Tcl chatroom] on 2003-12-05: proc fuzzyAnd {x y} {expr {$x*$y}} proc fuzzyNot {x} {expr {1.-$x}} proc fuzzyNAND {x y} {expr {1.-$x*$y}} proc fuzzyTrue {} {expr {1.}} proc fuzzyFalse {} {expr {0.}} proc fuzzyOr {x y} {fuzzyNot [fuzzyAnd [fuzzyNot $x] [fuzzyNot $y]]} proc fuzzyXor {x y} { fuzzyOr [fuzzyAnd $x [fuzzyNot $y]] [fuzzyAnd [fuzzyNot $x] $y] } proc fuzzyEq {x y} {fuzzyNot [fuzzyXor $x $y]} ---- [TV] Maybe you want to bound the range of the functions symmetrically by soft limiting them between [[-1,1]] using: set PId2 [expr acos(-1)] proc clampto1 x {global PId2; return [expr atan($x*$PId2)/$PId2]} Not distributive, the result would be, but fun. [DKF]: What on earth are you talking about? Fuzzy Logic works with (what can be thought of as) probabilities. The domain of each of the input values is [[0,1]], and given that, the range of the functions is [[0,1]] as well. Clamping is unnecessary. [TV] Sorry, I must have had my mind elsewhere, you are completely right that given the definition claming is out of order. It's sort of electronics like thinking, where signals are never guaranteed to be exactly bounded. ---- [Category Concept]