Logica fuzzy
Questa è una pagina di introduzione al corso: contiene i turni, le modalità d'insegnamento, alcune informazioni generali ed eventuali giudizi sul corso in questione. Se sei giunto qui passando da un link, puoi tornare indietro e correggerlo in modo che punti direttamente alla voce appropriata. 
A.A. passati
Informations
Course's website
Times and classrooms:
Monday 15:30  17:30  Room 5 (Ground floor  via comelico 39)
Friday 10:30  12:30  Room 5
Lessons' notes
This notes are written in english to help foreign students to follow this course.
Classical Propositional Logic
We are going to describe the classical propositional logic (CPL) language.
Syntax
The syntax of a language is the set of rules that specify how the elements of the language are formed regardless their meaning.
Let be the set of the natural numbers and an alphabet of symbols.
The symbols are called respectively "falsum", "verum".
is the set of strings on this alphabet. For example .
We have now to define the set of the "well formed formula" , that is the set of the elements of the L.P.C.
Definition (well formed formulas). is defined with some conditions:
, where  is taken n times. For example: if , then .
 if , then .
 if , then .
 if , then .
Well formed formulas is often abbreviated with f.b.f.
The strings in condition (2) are called "propositional variables" or "atomic formulas" or "propositional letters" or simply "variables". They are abbreviated with this notation:
(In other books p, q, r, .., are used to refer to variables).
The set of variables is .
Example of well formed formulas:
Instead
In this notes we omit (, ) where it is clear the precedence of the connectives. (Connectives are )
Why don't we use directly or ?
Because it is important that the alphabet is a finited set. Although, in this notes, we use notation.
It is essential, even, that the L.P.C. language is decidable, that is it must exist an algorithm that tell us if a string is or not.
For this reason it is crucial the
Unique readability of well formed formulas. For all one (and only one) of the following sentences must be true:
 or but not both.
 Exists an unique such that .
 Exists an unique such that .
 Exist unique such that .
 Exist unique such that .
 Exist unique such that .
Let's, infact, consider the parser of the algorithm we talked above: When it finds, for example, , to decide if the string belongs to FORM, it have to decide (for the unique readability of well formed formulas) if . But how can it do this? Deciding if and . This is what the above theorem tell us. Try to draw the parser tree. It is unique thanks to, again, that theorem.
Formally, a string is a finite sequence of elements:
A substring of is a string in the form , where and .
A subformula is a substring .
For example:
are both substring of but only is a subformula.
With we indicate the set of variables that are subformulas of .
With we denote a formula whose variables are a subset of .
Semantic
The semantic of a language is the relation between the elements of that language and their meaning.
The set {0,1} is called truth values set. 0 means false and 1 means true.
Definition(Assignment). An atomic assignment is any function
.
An assignment (or interpretation) is a function
that extends and respects the following rules for every .
 and
Informally we can say that the variables represent propositions with one verb and one or more complement. For example:
"It rains";
"I go to school".
"I don't go to school"
"It rains and I go to school"
"it rains or I go to school"
"If it rains then I will go to school"
I can choose such as and
Consequently we have
Proposition (Unique extendibility of atomic assignment): Every atomic assignment admits exactly one extension to an assignment
More informally, as you can see in the example above, when we choose the values of the variables we determinate the values of the formulas within those variables.
Definition (truth and falsehood). Let . When we have we say that is true in the interpretation of , or is a model of . Instead, when we have we say that is false in the interpretation of , or is an antimodel of .
In symbols:
when
when .
When is true for every we say that is a tautology. Instead when we have false for every assignment we say that is a contradiction.
When exists a such as we say that is satisfiable; instead when exists a such as we say that is refutable.
In symbols:
tautology
refutable
In these notes we abbreviate
with
and it can be read as "if and only if".
Exercise. Prove that the following formulas are tautologies for all
Hint: use the truth table
 (Excluded middle)
 (Not contradiction)
 (Law of double negation)
 (De Morgan rule I)
 (De Morgan rule II)
 (Ex falso quodlibet)
 (Prelinearity)
Exercise. Prove that exist for those the following formulas aren't tautologies. Which of these are contradiction?
Hint: to prove that a formula isn't a tautology is sufficient an counterexample but to prove that it is a contradiction it isn't sufficient. You can use the truth table again.
Relationship between syntax and semantic
Definition (Axioms of CPL (Classical propositional logic)). For all , let's consider the following formulas.
The formulas between 1 and 12 .
is called set of the axioms of the classical propositional logic.
Why these formulas are axioms and not others? Because they are needed to prove the theorem of completeness that is very important for logic. We will talk about this theorem later..
The cardinality of is because can be other formulas. For example:
Let and substitute in the first axiom; it becomes
It is important to understand that the axioms are defined only through syntax, because we don't speak about values of formulas. Axioms, for definition, are demostrable without demonstration.
Think about syntax and semantic as two different worlds. In "syntax world" there are but even , the set of theorems. So we have
The elements of are the demonstrable formulas.
Definition. We say that a formula is demonstrable (or syntactic consequence), if exist a finite sequence of formulas such that one of the following conditions is true.
 Exist indexes such that is deducible from and through modus ponens.
A sequence of formulas like that is a formal demonstration of .
Definition (modus ponens). Let . We say that is deducible, through modus ponens, if .
For example:
"If it rains then I will stay home" "It rains" "I will stay home".
We know that are true, hence we can say that is true.
The elements of are found in this way through modus ponens starting from elements of .
Modus ponens is one of the inference rules.
Example of demonstration:
We want to prove that .
We start from axioms 1, 4.
1A
4A
(substitution of in A1 (first axiom)
(substitution in A4)
Now we have hence we can conclude that
It is really hard to find theorems in this way: in this course we don't have to learn this, just have to know how a formal syntactic demonstration are made. Thanks to completeness and validity theorem we can prove theorem through an easier way; infact it says that the set of theorems and the set of tautologies coincide. Hence, proving that a formula is a tautology is equals to prove that a formula is a theorem. This is the bridge between Syntax and Semantic.
Theorem of validity and completeness. For all we have
The demonstrable formulas coincide with tautologies.
Example: If I prove that (using truth table or by reduction to absurd or any other way that use the values of the formulas (semantic)) then, it must exist a syntactical demonstration (starting from axioms and going on through modus ponens) to prove that formula.
We can divide the theorem in two part:
 Theorem of validity:
 Theorem of completeness:
It is very difficult to prove the theorem of completeness (in this course it isn't requested), but it is simple to prove the theorem of validity.
Theorem of validity proof: Before prove this theorem we have to prove that modus ponens (MP) preserves tautology:
if are tautologies then is a tautology.
Proof by absurdity:
Let's suppose
We have a contraddiction because
So MP preserves tautologicity.
Now we can face theorem of validity proof:
infact the hypothesis means:
 such that

 or (then is a tautology for definition)
 or is proved by modus ponens.
So, thanks to preservation of tautologicy of MP, we have that
Decidability
When a logic is decidable?
When exists a program that:
Input:
Output: YES, if, else NO.
The classical propositional logic is decidable because, for the theorem of completeness (and validity), we have , so the program can make the truth table of the formula and then check if all the evaluation are 1. Infact, if a formula's truth table have all the entry 1, we can say that and so .
Godel logic
Syntax
The syntax of Godel logic is the same of the syntax of the classical propositional logic, so we have that .
So we can write .
Semantic
The semantic in the Godel logic is polyvalent infact assumes values in .
When:
 we say that is false, or absolutely false;
 we say that is true, or absolutely true;
 we cannot say that is true neither false. Although these values represent difference degrees of truth.
For example:
we can say that is truer then .
Infact let "Matt is young" and "Matt is old".
I'm 23 so I can say that I'm not absolutely young and not absolutely old so we can assign a value 0.7 to and 0.3 because I'm more young than old.
Definition(Assignment). An atomic assignment is any function
.
An assignment (or interpretation) is a function
that extends and respects the following rules for every .
 and
This is the sematic of Goedel logic but it is not the only fuzzy logic. There are many fuzzy logic with different semantic. So the question is "why those functions and not others?"
The answer is because the semantic of every fuzzy logic must behave, for assignment in as classical propositional logic.
Even Godel logic satisfy the principle of truthfunctionality so the value of depends only from the values assigned to .
Exercise. Let . Prove that the semantic of Goedel logic coincide with semantic of classical propositional logic for the formulas .
Exercise. let . Prove that

The negation is semantically definable from implication and "falsum" ().  if and only if
Exercise. Make a plot of every function of Goedel logic. (Some are in 3D).
Here's the graph of graph
It is important to said that evary fuzzy logic assign when infact, without this, MP wouldn't preserve tautology in fuzzy logic and it would be impossible to prove the theorem of completeness in that fuzzy logic.
Definition (truth, not truth, falsehood). Let and . When we have we say that is true in the interpretation of , or is a model of . Instead, when we have we say that is not true in the interpretation of .
In particular we say that is false in the interpretation of when we have .
In symbols:
when
when .
When is true for every we say that is a tautology. Instead when we have false for every assignment we say that is a contradiction.
When exists a such as we say that is satisfiable; instead when exists a such as we say that is refutable.
In symbols:
tautology
refutable
Exercise. Establish which of the following formulas are tautology in Godel Logic and which not. Hint: use truth table for
 (Excluded middle)
 (Not contradiction)
 (Law of double negation)
 (De Morgan rule I)
 (De Morgan rule II)
 (Ex falso quodlibet)
 (Prelinearity)
For example: The law of Excluded middle is not a tautology in Godel Logic, infact for we have that .
It is clear that the semantic of Godel logic is equal to classical logic only for boolean values of the variables. The exercise above shows that some tautology in classical logic aren't tautology in Godel logic. Summing up:
Proposition. If is a tautology is Godel logic then is a tautology is a tautology in classical logic, but the reverse isn't true.
Exercise. Prove the above proposition.
Here's my proof:
where
where
Well, as we said above, Godel logic, under classical assignment , behaves the same way of the classical one; so, when we say that is a tautology in Godel Logic, we mean that but in these there are the classical ones! Therefore also.
Relationship between syntax and semantic
Definition (Axioms of GL (Godel logic)). For all , let's consider the following formulas.
The formulas between 1 and 10, 12 .
is called set of the axioms of Godel logic.
.
Exercise. Choose some formulas and prove that they are tautology. Note: to prove that a formula isn't a tautology we used a counterexample but now we have to prove that a formula is a tautology. The cardinality of is so we can't try every assignment...The solution is to choose that represents a class of . For example, we want to prove that is a tautology. So we have three cases:
 that represents all the
We have to evaluate the whole formula in these three cases. The evaluation is always true. Hint: the number of cases depends on the number of variables; infact, to prove A1, we have to consider 3 x 3 assignment. This will be clearer when we will face Decidibility of Godel Logic.
Theorem of validity and completeness. For all we have
The demonstrable formulas coincide with tautologies also in Godel Logic. We can split the theorem in two part:
 Theorem of validity:
 Theorem of completeness:
Even here we prove only the former because the latter is too much harder.
Theorem of validity proof (in GD) We had to prove two propositions in order to prove the theorem:
It was the exercise above. MP (Modus ponens) preserves tautology in GD also.
To prove this proposition we have to prove that if then . Thanks to the semantic definition of implication in GD, it is clear that can be only with that conditions.
Proposition. Every formula proved in GL is proved also in CPL.
Decidability
Godel logic is decidable if exists a program such that: Input: Output: Yes if , No else.
In the Classical Logic this program exists, as we said above; infact we just have to write the truth table of the formula and check if every entry result is 1. More formally, for every possible assignment we check if ; if at least one we can conclude that . This method doesn't work for Godel Logic because of the number of that is infinity. In other words, the truth table of every formula cannot be computed.
Nevertheless Godel Logic is decidable. The reason is because it is possible to reduce, as we will see later, the infinity number of assignment to a finite number of cases.
Take a look at all the possible plots of File:Plot.pdf.
Note that, everytime we have where and we have also for every assignment . This consideration is defined in the two following theorems.
Definition(Equivalent assignments). Let be two assignments. We can say the are equivalent (on the first n variables) if exists a permutation and a function such that
In this case we can write like this:
To understand the definition above, here's an example.
Example. We fix the number of variables . Let's consider the assignment
Then
Infact, seen that , there is no choice for the permutation . The only one is the identity function . For the function we choose .
Then and as the definition request.
Instead, if we had we would have
because but isn't true.
We can conclude that two assignment are equivalent on the first variable if one of the following sentences is true:
Proposition. The relation on the set of all possible assignments is an equivalent relation, infact it is reflexive, symmetric, transitive.
Because of it is a equivalent relation, it partitions the set of all assignments, so we can define the equivalent classes like this:
where is the set of all possible assignments.
We can write
to refer to the quotient set of the relation on the set of all possible assignment. We can call it also family of all equivalence classes.
Proposition. is a finite set.
Example: for infact we have
Lemma (possible worlds reduction). Let be two assignments. If
then for every formula
if and only if .
on the other hand, if then
exists a formula such that it true that either
but
or
but
It was a very strong theorem because, to prove that where is now possible:
infact we cannot compute for every possible , because the set it is an infinitive set but we can compute because it is a finite set and, thanks the lemma above, we know that it is the same thing.
Now we can write the algorithm we talked at the beginning of the paragraph:
Input:
 Enumerate of the possible permutations
 Enumerate of the possible
 For every couple find, if exists, an assignment such that it is true
 Compute
 if exit with output NO else go on cycling
 Exit with output YES
Note that:
 finding such that it is true that is equals to finding an representative for its own equivalence class.
 We can arrive to step 6 if only, for every representative , we have
because there are repetitions or untrue sentences. For example:
it cannot exist a such that .
Last concepts (Devo ancora decidire che titolo dargli)
The last concepts' notes (of the first part of the course) are written directly in latex because are full of plots and Hasse diagrams. File:Posets Hesse.pdf