Edited by Jacqui Snyder
Mathcad 8-15 allows Boolean functions to be defined although the set of Mathcad 8 built-in functions and operators does not include Boolean logic functions (Not, And, Or etc.), normally present in all programming languages. But you can’t do without these functions in solving various logic tasks, such as organizing cycles and branching programs. Why didn't the Mathcad 8 developers include these simples, but necessary logic functions? The situation seems especially strange, given that all digital computer facilities, which Mathcad 8 itself uses, use only zeroes and ones, and all arithmetic and other operations are nothing more than Boolean operations performed on these zeroes and ones.
Let’s investigate this problem.
Mathematics (see, for example, «Mathematical Handbook for Scientists and Engineers» Korn G. and Korn T., McGraw-Hill Book) operates with one monadic (single argument) and seven binary Boolean functions. They all are showed (see items 0-3) and determined (items 4-7) on Fig. 1. Boolean variable can be likened to a switch with two positions, «on» and «off». In this case, conjunction is a serial connection of switches (item), and disjunction is parallel connection. The electrical analogue of biconditionality (item 3) is of use in illumination of a long corridor – the corridor has a light switch at each end to turn the light on and off.
Item 8 (see Fig. 2) generates a two-place Boolean function, "Verdict1", which is the decision of a 3-member. The "jury" delivers a verdict when at least two members agree. To abstain or to avoid voting is impossible.
The function Verdict1, a program implementation of the voting procedure, in item 8 also has an electrical analogue, the hardware realization is a voting machine, a combination of serial and parallel switches.
Binary Boolean functions (items 1-7 on Fig. 1) have four (22) combinations of argument values (table of the validity), three-place, which is already 8 (23), and, naturally, the monadic have only two (21) combinations, 0 or 1. There can be 16 binary Boolean functions (42) – we have described only seven – and 64 three-place functions (43) – we have described only one). There can also be four monadic functions (41) – we have described only one. Three other monadic Boolean “functions”: y2 (x): =1, y3 (x): =0 and y4 (x): =x. Are of no practical value in programming. The first of the two (y2 and y3) are constants, and y4 is simply an argument itself. The other nine undefined binary Boolean functions (16-7) are nameless and, as a rule, have no application in mathematics, or programming.
A mathematical Boolean function generates only two values (0 or 1), and in programming generates minimum of three values: "yes", "no" and. "emergency detent", which is caused by an error when one or more arguments were not defined). This error can be processed (for this purpose Mathcad includes the on error operator) and computation will choose the third way. The amount of monadic Boolean functions can exceed four.
How would you like this function: y5 (x): =if (rnd (1) > 0.7, 1, 0), which returns one with 30% probability and zero with 70% probability.
"Verdict" can be more easily defined as the calculation of the arithmetic mean of arguments (see Fig. 3). The built-in Mathcad-function mean serves this purpose. If its value exceeds 0.5, then a verdict is accepted (one is returned), If not zero is returned.
Verdict(V): = mean(V) > 0.5
Thus, it is possible to increase the number of arguments of a new function Verdict without the complicated tree graph of Boolean operations shown in item 8.
Item 9 on Fig. 3 formulates one more Verdict function. This one allows a committee with any number of members to vote and determines the verdict by the majority vote. Some committee members have the right of veto. (An example of this is the Security Council of the UNO where the votes of selected nations count more than the votes of other nations. As George Orwell wrote, "Everybody is equal, but some are more equal". Committee members, or the USA, Russia, China, France and Great Britain, in the case of the UN Security Council, with the right of veto are incorporated in a vector Const (constant members of the SC), and all others in a vector Var. While the arithmetic mean fits the majority vote verdict, for blocking a verdict can be refused with the geometric mean (gmean). This is the n-th root of a "n" factor product. (Note: This built-in function appeared in the eighth version of Mathcad.) Because of this, gmean requires that all vector (matrix) elements not be zeroes. That is why we redefined gmean in item 9 in order to let it "swallow" zero elements of vector-argument. Then using gmean, we defined the Verdict function like that for the electorate of the UN Security Council. At the end of item 9, three typical voting outcomes are shown:
- the verdict is accepted by the majority vote;
- the verdict is failed by one man who has the right of veto;
- The verdict is not accepted, as the majority votes “contra”.
- The majority votes yes
- The majority votes yes but is overridden by one member who has the right of veto
- The majority votes no
Obviously, it is perverse to use a geometrical mean for vote calculation. In this case, the function And is suitable – i.e., simple logic multiplication without evolution. Item 10 formulates the functions And and Or, whose arguments are column-vectors with variable numbers of elements.
Another title for this article was "To execute it is impossible to forgive". But this is too hackneyed. The reader is traditionally asked to add a comma to this sentence ("To execute, it is impossible to forgive" or "To execute it is impossible, to forgive") and to observe the transformation of the verdict depending on the placement of such a harmless punctuation mark.
About the comma placement, should it be “smeared” over the sentence – should the comma occur after “ execute” in n percents of cases, and in 100-n – after “impossible”? This new sentence structure can be treated differently, let's first look at the statement of this question itself.
One leader of the Third Reich liked to repeat that he always snatched away his gun after hearing the word "culture". When programmers collide with a logic task, they grab the trinity of Boolean functions Not, And, Or. But these functions are missing from the set of Mathcad built-in functions. Boolean (logical) variables are also missing. A programmer will curse the situation and define user functions (see items 0 – 7), forcing numerical4 variables to carry out the role of the absent Boolean functions. Now Verdict function can easily be defined returning I/O or Yes/No responses depending on the results of voting. A verdict is accepted when two at least jury members vote "Yes".
Returning to the “to execute-to forgive” dilemma and allowing the roles of jury, judge and executioner to be combined, we can try to replace an electric bulb in the circuit of item 8 on... an electric chair. It is said that a similar knife-switch circuit feeds the American execution device. Each of three executioners hopes to turn on a simulated electric door rather than the real one.
Another common switch is the rheostat, which charges the incandescence of light's filaments from zero to 100 %. Cinema has long used such switches to gradually dim the lights before a film starts.
Is it possible to substitute a rheostat in the voting procedure hardware? Can the Verdict function include not only logic, but also real arguments and return real value, varying smoothly from zero to one (0 to 100 %)? Juries often find it difficult to reach a verdict. Sometimes, even in an obvious crime, in the defendant can be see as unfortunate rather than at fault. Such juries are still forced to give only black-and-whites decisions. Tolerance is not allowed them.
At first, tolerance penetrated religion. After bloody religious wars, mankind has grown wiser. At present, a civilized man can say, that he is a k% atheist, l% Moslem, m% Catholic, and n % Protestant. And k+l+n+m is not necessarily equal to 100%. In some American churches, the mullah preaches on Fridays, the rabbi on Saturdays, and the priest on Sundays and nobody is shocked. Then tolerance captured the world of art, washing away a system of classical canons and styles. Now the main thing is the talent of an artist and what he wants to tell to the world. It is not important, what type of artist. The artist is – realist, impressionist, primitivist, etc. Now tolerance in science has begun to be discussed. It is evidenced in fuzzy set and the fuzzy logic theory. The estimation of indeterminacy has begun to prevail not only in humanities, but also in sciences, including mathematics. The author, sometimes intentionally and sometimes through ignorance (through undercomprehension – a good example of fuzzy set in lively language) sees the fuzzy set theory theses as not entirely correct. Formerly, his colleagues would have chewed the author up. But nowadays it does not matter – he is published, his books are read.
Let's investigate a verdict of our voting task using the theses of fuzzy logic (item 10 see Fig. 4). It is possible to enrich this problem with nonlinear elements, taking into account a conventional separation of voters into conservatives (k), who are traditionally inclined to find a defendant guilty, centrists (c), and liberals (l) who are inclined to find a defendant not guilty. We shall estimate the degree of radicalism of the jury (or of parliament and any electorate in general) using factor k. A degree of “pro” verdict (from 0 up to 1) is fixed by the jury members, but the verdict is influenced with yk, yc and yl functions, which are damping extreme estimations (see item 10.1).
The «colour» Verdict function, constructed by the use of min and max functions (see item 10.2), with logic arguments (0 or 1) correlates completely with its “black-and-white” analogue, using And and Or functions (see item 8 on Fig. 2). The built-in min and max functions allow operations with logic, real, and even complex8 arguments. Besides, min and max functions are convenient because they can have column-vector arguments (max function argument in item 10.2), row-vector arguments (min) and even matrices. This allows the argument types (horizontal-vertical) of the created «colour» logic function to be combined, making it tighter and more easily understood. (Not the function but the afterfixed operator is generated here, which allows superfluous brackets to be removed.)
«O.K.», the reader will say, and what should you do with a verdict like '57% guilty and 43% not guilty'?" Let's look at the diagrams showing the «colour» verdict!
Item 10.2 shows the verdict when the liberal votes are fixed at 0.5 (The liberal jury member has abstained).
· the red color of the diagram speaks for itself – it means blood, capital punishment;
· orange – life imprisonment;
· yellow – penal servitude;
· green – imprisonment;
· cyan – suspended sentence;
· dark blue – public reprimand;
· Violet – is not guilty.
The colour palette can be shifted, considering tendencies in social consciousness and variations in legislation – the death penalty moratorium, for instance. But in so doing, other kinds of punishments should be also «pushed down» (in cold tones). A prison may be so wretched that capital punishment may appear a preferable decision.
The main argument of the death penalty opponents is that life is a gift of the Lord, and only God has a right to sentence someone to capital punishment. The second argument is that the death penalty does not allow judicial mistakes to be corrected. However, who can return a wasted life when after having been imprisoned for 20 years, a convict is told pardon, we were mistaken?
The fuzzy function Not is also useful in construction of «colour» logic schemes:
Not (x): = |1-x| or
Not (x): = |100-x|
In item 10.3 (see Fig. 5) max and min functions are replaced with their «analogues» – mean (arithmetic mean) and gmean (geometric mean). The surface has become smoother – nature can’t stand sharp corners, as we know.
Item 11 generates multivariate And and Or functions. But it is possible to simplify this formula:
And(x): =min(x) Or(x): =max(x),
It is also useful to operate only with min and max functions, which cope well with both Boolean (precise logic) and real (fuzzy logic) arguments. But it is better for the user to apply the multiplication operator instead the min function, optimizing the program. The point is that zero is returned instantly if the first factor of product is zero. The min function is too much pedantic – it overhauls all elements of its matrix-argument (vector).
But one should be cautious becoming enthusiastic about statistical functions (min, max, mean, gmean, rnd, var etc.) on realizing the logic schemes. As Winston Churchill said, there is a Great Lie, a Simple Lie and… Statistics.
1. The political divertissement
Our politicians, discussing status of Chechnya (the Basque country, Corsica, etc.) are painting themselves into a corner. They say that independence is like pregnancy: either it exists, or it does not. You can’t be just a little pregnant, and it is impossible for a country to be slightly independent.
This contradiction can be solved using the fuzzy set theory. The explanation of its bases is usually made by the paradox of the heap of grain. Is a hundred grains of wheat a heap or not? Certainly not – it is a handful of grains. And if this handful is supplemented by one more grain, does it become a heap? Again, no. But if one more grain and another is added sooner or later, the handful becomes a heap. People have been trying to determine the exact number of grains that delimits a handful and a heap in the context of classic mathematics, but have not succeeded. Politicians are trying to determine the attributes (authorities) separating an independent state from a federation subject in the same way.
The point is that “the independent state” is traditionally considered as a precise set element. That is to say, the state constitution may either belong or not belong to this set. But everything is both much more complicated and much easier. Concepts of a handful and a heap represent fuzzy sets. One hundred grains is a handful and at the same time it is a heap, while the value of accessory of the hundred grain function to the handful set approaches one, and to the heap set approaches zero. If this amount is increased by only one grain, then the first value (approximately one) will slightly decrease, and the second one (approximately zero) – will slightly increase. We should reiterate – nature can’t stand sharp corners, or black-and-white estimations.
In the context of the fuzzy set theory, the heap of grain problem can be solved in such a way: various amounts of grain are poured in, while some grain experts make estimations such as: “This is a handful (0)”, “This is sooner a handful than a heap (0.33)”, “This is sooner a heap than a handful (0.67)”, “This is neither a handful nor a heap, but something average (0.5)”, “ This is a heap (1)” and so on. (At present, for instance, public opinion polls are carried out in this way). Thereafter the appertain function to the fuzzy set “a heap of grains” is formulated. This function curve is smooth and fuzzy rising from zero (there are few grains) to one (many grains) without any discontinuities. The “handful of grains” appertain function is “bent”: it equals zero on boundaries (we move from a separate grain to a heap of grains) and one in the middle (a handful of grains).
The Chechen problem is not only Russian, but also the whole world's problem, in that the UN statute includes two laws – the stability of border principle and the right of nations to self-determination (to independence). This problem can be solved taking into account the fact that concepts “nation” and “independent state” are fuzzy sets, too. The state formation (province, region, and republic) can be just a little independent, as well as absolutely independent. The reader, if he wishes, may compile a table: the first column should list country names (using the Russian Federation), and the second one column the appertain function value to the “independent state” set. Is Germany an independent state? It seems so, but many of its sovereign authorities are confined by its membership in NATO, the European Union, the Common Market etc. Germany is now loosing an important attribute of independence, -its national currency-. And the German language becomes more like a local dialect – all serious scientific conferences are held in English. So this country has today less “independence” than Chechnya itself. Speaking the fuzzy set theory language, the German appertain function value to the set of “independent states” is lower than the Chechen one. The fact that in Bonn there are many foreign embassies, and there is not one in Grozny, the capital of Chechnya, is unimportant. Let's imagine that tomorrow all countries will sever diplomatic relations with Germany. The independent status of Germany would only improve. The most independent states on our planet are the most odious countries: “alcoholics” (drug suppliers), “parasites” (living off the world community), “hooligans” (Libya, Iraq, Northern Korea are small “hooligans”; Russia, USA, China are adult “hooligans”). We shall not name “alcoholics” and “parasites” – it is difficult to say whether these countries are guilty or simply unfortunate. Remember, “To execute it is impossible to forgive!”
So, we shall consider all subjects of the Russian Federation to be independent states, but each has different appertain function values to this fuzzy set. The Tver region has one value, Tatarstan another, and Chechnya the highest. During the formation of a state these numbers can vary smoothly (reforms) or spasmodically (revolutions, wars, although a referendum is preferable), but they will never drop to zero and will never reach one.
2. The policy-computer divertissement.
The fuzzy set and fuzzy logic theories may appear to be useful in the problem of computer piracy. All people are divided by law into two precise sets: “the set of legal program users” and “ the set of illegal users (pirates)”. But actually, it is much more complicated. Computer users comprise a great variety of fuzzy sets. There is a set trading in “black” disks on “Gorbushka street” (where you go in Moscow to buy CD-ROMs) and a set of those who deal only with legal copies, on principle, and will never offer a hand to sinners. (Those who have broken license agreements) The “sinner-righteous” axis can plot bent statistical curves describing the state of the computer market in a country. Where is the maximum of this curve? Where and with what speed does it migrate in time?
3. The computer divertissement.
Danyil Harms has noticed that memory is a strange phenomenon: You can memorize something, and recollect later something absolutely different. And it may happen that you memorize something so deeply that not for anything can you recollect it again.
The main distinction between human memory and computer “memory” is that the human differently remembers different information. It is one thing to memorize a casual friend his telephone number, and quite another to remember such information as: “If you poke your nose in here one more time, I will tear your head off!”
The digital computer elementary memory locations hold either zero or one, without assigning differences in the importance of the information. "A bit" of information in a human brain is a neuron connection of different “thickness”, varying, conventionally speaking, from zero to one. Maybe computer capacitors should be charged smoothly, not stepwise…
There are more examples that pure zeroes and ones don't exist. The most obvious questions do not have precise and unequivocal answers.
Campfires in a forest are considered to increase the danger of wild life. But campers gathering brushwood and deadwood for fires burn in a civilized manner the combustible material that was otherwise liable to be ignited by lightning or a carelessly thrown cigarette. So forest campfires do not destroy forests, they protect forest from fire.
Russian politicians are going all out, trying to make the oil pipelines from the Caspian region pass exclusively through Russian territory. They believed that the other ways of petroleum transporting will deprive Russia of significant revenue and political influence. But is immoral to influence someone by blackmailing him with a damper overlap. The economic effects benefits of petroleum transit can be evaluated only if a risk analysis is also made, considering such hazards as pipeline breaks and other failures. By fair means or foul, we should secure pipeline exterior to Russian territory. New pipelines should be laid only after the existing pipeline operation has been shown to be acceptable. This issue includes gas pipelines – let's remember the two passenger trains that burned near Ufa. In a normal country, any utility company will go bankrupt paying for such accident. But there are not any consequences in our country….
At present, there is an international campaign to prohibit anti-infantry land mines. The campaign mascot is a one-legged child on crutches, whose leg was blown off by a mine that remained after a long-standing conflict. But in the conflicting parties, (such as the Tutsis and Hutus in Burundi), had not been separated from each other with mine fields (Mine field safe crossing were supervised by neutral forces), the number of innocent victims, could have been much higher. It is not that anti-infantry mines are bad, but forgetting them or not knowing how to liquidate them after a confrontation is finished is bad.
There is a popular slogan of hurrah-patriots: “If people do not want to feed their army, they will feed a foreign one”. We have been feeding and supporting the Soviet army, which has fired at peaceful people in Novocherkassk, and witch left Hungary, Czechoslovakia, Germany, Afghanistan, and even Chechnya ignominiously... The Red Army was defeated for a couple of months in 1941 by German troops. Victory was gained by the bread-winner nation itself, (with the help of the Voevode-Frost, engineers, teachers and other working people left their peaceful jobs for four long years and took up weapon to defend their country. It is not easy to judge an army, but the native militia, and furthermore the GAI (the Russian motor licensing and inspection department) should be replaced with a foreign, non-corrupt organization. (German, for example). It would be more effective and cost less. The army shouldn’t be supported at all – neither ours or someone else's. The nuclear missile military forces – are virtually not an army at all. That is really nothing more than a scientific and technical kind of business in which workers have been for some reason been dressed in uniforms.
The availability of weapons to the population is considered to be one of the most important factors in the increase in crime in our country. But democracy as well as civil law, was established in Western Europe only after peasants took up weapon and began protecting themselves from the medieval racket – from the aristocrat tyranny. If the contemporary “aristocracy” (the Russian Mafia) is able to impose servitude on modern “peasants” (businessmen), who are aware of the possibility of receiving a bullet through their brains, then anything is legal. It would not have been any 37 year in our country, if only the “black funnel” owners (NKVD ¾ People’s Commissariat of Internal Affairs) were afraid of armed resistance of the arrested.
Today nobody will say anything positive about terrorists. Besides, people capturing innocent victims and those who take up weapons to solve their own political and other problems are consciously placed on a single board (see above). At first glance, the situation with terrorists is more or less clear, They should be considered as a natural calamity, against which nobody is insured. You should avoid terrorist trouble and if you do then behave correctly. But at second glance, the situation of “terrorists” is not so simple. A folk saying states, “A pike in the sea makes a crucian stay awake”. It is said that any political figure can be liquidated. – The limiting point is in the availability of the resource that can be invested on this project. A political leader stays alive not only owing to his mighty security force, but also because nobody wants his life, so far. Or somebody has no means for taking it. The politician behaves properly, being afraid of his opponent's bullets (his people).
The integrity of Russia is idolized by our politicians. But the point is that real people feel themselves to not only be Russians, but also Europeans, and citizens of the world. Nationalism, as has been said before is the last refuge of scoundrels. Many Russians would move away from Moscow and settle in Strasbourg, for instance, but they don't have the means to do, mainly, they have no reason. To leave this country? No, thanks! Instead, let those people leave from whom we want to be separated…