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. Lets see if I follow the fuzzy logic reasoning, that has interested me long ago as a student, when I though it was about general 'fuzzy' logic,not necessarily a certain interpretation of the concept. Assuming probabilities, we'd have that the probability of A and B is A*B, lets say P(a) = 0.5 and P(b) = 0.5, the combined probability is 0.25 . Sort of OK, but it means we must assume for correct statistics to ripple through the logic that events, and the variables describing them are ''independent''. Related parts of a formula usually are not, for instance the ''probability'' of fuzzyAnd(A,A)= pow(A,2) ... On could take geometric average instead, to make this better, but dealing with the whole subject right would take you into very interesting (basic but non-trivial) quantum physics integrals for doing these things, I guess. ---- [Category Concept]