TP 13 mars 2026
This commit is contained in:
104
2026/TPAutomate1.jff
Normal file
104
2026/TPAutomate1.jff
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--Created with JFLAP 7.1.--><structure>
|
||||||
|
<type>fa</type>
|
||||||
|
<automaton>
|
||||||
|
<!--The list of states.-->
|
||||||
|
<state id="0" name="q0">
|
||||||
|
<x>152.0</x>
|
||||||
|
<y>203.0</y>
|
||||||
|
<initial/>
|
||||||
|
</state>
|
||||||
|
<state id="1" name="q1">
|
||||||
|
<x>273.0</x>
|
||||||
|
<y>129.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="2" name="q2">
|
||||||
|
<x>465.0</x>
|
||||||
|
<y>126.0</y>
|
||||||
|
<final/>
|
||||||
|
</state>
|
||||||
|
<state id="3" name="q3">
|
||||||
|
<x>278.0</x>
|
||||||
|
<y>268.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="4" name="q4">
|
||||||
|
<x>467.0</x>
|
||||||
|
<y>254.0</y>
|
||||||
|
<final/>
|
||||||
|
</state>
|
||||||
|
<state id="5" name="q5">
|
||||||
|
<x>592.0</x>
|
||||||
|
<y>189.0</y>
|
||||||
|
</state>
|
||||||
|
<!--The list of transitions.-->
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>2</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>3</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>5</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>3</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>5</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>0</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>4</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>4</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>0</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>2</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>3</from>
|
||||||
|
<to>4</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>2</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
</automaton>
|
||||||
|
</structure>
|
||||||
118
2026/TPAutomate2.jff
Normal file
118
2026/TPAutomate2.jff
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--Created with JFLAP 7.1.--><structure>
|
||||||
|
<type>fa</type>
|
||||||
|
<automaton>
|
||||||
|
<!--The list of states.-->
|
||||||
|
<state id="0" name="q0">
|
||||||
|
<x>152.0</x>
|
||||||
|
<y>203.0</y>
|
||||||
|
<initial/>
|
||||||
|
</state>
|
||||||
|
<state id="1" name="q1">
|
||||||
|
<x>273.0</x>
|
||||||
|
<y>129.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="2" name="q2">
|
||||||
|
<x>465.0</x>
|
||||||
|
<y>126.0</y>
|
||||||
|
<final/>
|
||||||
|
</state>
|
||||||
|
<state id="3" name="q3">
|
||||||
|
<x>278.0</x>
|
||||||
|
<y>268.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="4" name="q4">
|
||||||
|
<x>467.0</x>
|
||||||
|
<y>254.0</y>
|
||||||
|
<final/>
|
||||||
|
</state>
|
||||||
|
<state id="5" name="q5">
|
||||||
|
<x>592.0</x>
|
||||||
|
<y>189.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="6" name="q6">
|
||||||
|
<x>709.0</x>
|
||||||
|
<y>191.0</y>
|
||||||
|
</state>
|
||||||
|
<!--The list of transitions.-->
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>2</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>4</from>
|
||||||
|
<to>4</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>5</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>3</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>2</from>
|
||||||
|
<to>2</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>2</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>6</from>
|
||||||
|
<to>6</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>0</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>5</from>
|
||||||
|
<to>6</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>6</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>5</from>
|
||||||
|
<to>4</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>0</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>5</from>
|
||||||
|
<to>2</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>4</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>3</from>
|
||||||
|
<to>4</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
</automaton>
|
||||||
|
</structure>
|
||||||
51
2026/TPAutomate3.jff
Normal file
51
2026/TPAutomate3.jff
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--Created with JFLAP 7.1.--><structure>
|
||||||
|
<type>fa</type>
|
||||||
|
<automaton>
|
||||||
|
<!--The list of states.-->
|
||||||
|
<state id="0" name="q0">
|
||||||
|
<x>99.0</x>
|
||||||
|
<y>161.0</y>
|
||||||
|
<initial/>
|
||||||
|
</state>
|
||||||
|
<state id="1" name="q1">
|
||||||
|
<x>227.0</x>
|
||||||
|
<y>172.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="2" name="q2">
|
||||||
|
<x>380.0</x>
|
||||||
|
<y>166.0</y>
|
||||||
|
<final/>
|
||||||
|
</state>
|
||||||
|
<!--The list of transitions.-->
|
||||||
|
<transition>
|
||||||
|
<from>0</from>
|
||||||
|
<to>0</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>2</from>
|
||||||
|
<to>2</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>2</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>2</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>0</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
</automaton>
|
||||||
|
</structure>
|
||||||
94
2026/TPAutomate4.jff
Normal file
94
2026/TPAutomate4.jff
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--Created with JFLAP 7.1.--><structure>
|
||||||
|
<type>fa</type>
|
||||||
|
<automaton>
|
||||||
|
<!--The list of states.-->
|
||||||
|
<state id="0" name="q0">
|
||||||
|
<x>79.0</x>
|
||||||
|
<y>174.0</y>
|
||||||
|
<initial/>
|
||||||
|
</state>
|
||||||
|
<state id="1" name="q1">
|
||||||
|
<x>156.0</x>
|
||||||
|
<y>75.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="2" name="q2">
|
||||||
|
<x>168.0</x>
|
||||||
|
<y>234.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="3" name="q3">
|
||||||
|
<x>298.0</x>
|
||||||
|
<y>72.0</y>
|
||||||
|
<final/>
|
||||||
|
</state>
|
||||||
|
<state id="4" name="q4">
|
||||||
|
<x>291.0</x>
|
||||||
|
<y>239.0</y>
|
||||||
|
</state>
|
||||||
|
<state id="5" name="q5">
|
||||||
|
<x>406.0</x>
|
||||||
|
<y>141.0</y>
|
||||||
|
<final/>
|
||||||
|
</state>
|
||||||
|
<!--The list of transitions.-->
|
||||||
|
<transition>
|
||||||
|
<from>3</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>2</from>
|
||||||
|
<to>4</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>0</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>3</from>
|
||||||
|
<to>4</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>4</from>
|
||||||
|
<to>5</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>5</from>
|
||||||
|
<to>4</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>4</from>
|
||||||
|
<to>1</to>
|
||||||
|
<read>b</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>0</from>
|
||||||
|
<to>2</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>2</from>
|
||||||
|
<to>0</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>1</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
<transition>
|
||||||
|
<from>5</from>
|
||||||
|
<to>3</to>
|
||||||
|
<read>a</read>
|
||||||
|
</transition>
|
||||||
|
</automaton>
|
||||||
|
</structure>
|
||||||
108
2026_TP_Determinisation_Equivalence.md
Normal file
108
2026_TP_Determinisation_Equivalence.md
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
# BUT2 Théorie des langages
|
||||||
|
# TP du vendredi 13 mars 2026 (FI)
|
||||||
|
|
||||||
|
Ce TP revient en détails sur les notions suivantes.
|
||||||
|
|
||||||
|
* automate non déterministe
|
||||||
|
* mise en pratique de la déterminisation
|
||||||
|
* mise en pratique du test de l'équivalence de 2 automates
|
||||||
|
|
||||||
|
|
||||||
|
Vous devez faire ce TP sur papier ou sur votre ordinateur.
|
||||||
|
Vous pouvez vous aider de JFLAP.
|
||||||
|
|
||||||
|
Il faut écrire vos réponses soit sur un papier, soit dans un fichier en Markdown.
|
||||||
|
|
||||||
|
Votre réponse (scannée ou en markdown) sera intégrée dans un répertoire git qui s'appelle :
|
||||||
|
|
||||||
|
BUT2_TOMATE_26
|
||||||
|
|
||||||
|
Il faut partager ce git avec Florent Madelaine et Yves Kasparian.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## QCM
|
||||||
|
|
||||||
|
Pour voir si vous êtes à jour dans votre cours.
|
||||||
|
Plusieurs bonnes réponses possibles pour une question.
|
||||||
|
|
||||||
|
|
||||||
|
### Question 1.
|
||||||
|
|
||||||
|
* Un automate accepte un mot si on peut dans l'automate fabriquer un chemin étiquetté par les lettres du mot de gauche à droite en suivant des transitions de l'automate depuis l'état initial vers un état acceptant.
|
||||||
|
|
||||||
|
* Un automate est non déterministe si il existe deux états depuis lequel il existe une transition avec la même lettre.
|
||||||
|
|
||||||
|
* Un automate est non déterministe si il existe un état depuis lequel il existe deux transitions avec la même lettre.
|
||||||
|
|
||||||
|
* Un automate non déterministe rejette un mot si on peut dans l'automate fabriquer un chemin étiquetté par les lettres du mot de gauche à droite en suivant des transitions de l'automate depuis l'état initial vers un état non-acceptant.
|
||||||
|
|
||||||
|
* Il existe plusieurs chemins pour un mot dans un automate non-déterministe
|
||||||
|
|
||||||
|
* Il existe plusieurs chemins pour un mot dans un automate déterministe
|
||||||
|
|
||||||
|
### Question 2.
|
||||||
|
|
||||||
|
* Il existe un automate non déterministe qui reconnaît un langage L qui ne peut pas être reconnu par un automate déterministe
|
||||||
|
|
||||||
|
* Il existe toujours un automate déterministe qui reconnaît le même langage qu'un automate non déterministe, mais on ne sait pas toujours le construire.
|
||||||
|
|
||||||
|
* Il existe toujours un automate déterministe qui reconnaît le même langage qu'un automate non déterministe, et on peut automatiser la construction.
|
||||||
|
Dans le pire des cas on va obtenir un automate qui a un nombre d'état qui est $2^n -1$ si l'automate non déterministe de départ a $n$ états.
|
||||||
|
|
||||||
|
### Question 3.
|
||||||
|
|
||||||
|
* On peut tester l'équivalence de 2 automates déterministes en testant avec des mots au hasard de taille 42 et conclure ou non que les automates sont équivalents.
|
||||||
|
|
||||||
|
* Si deux automates déterministes ne sont pas équivalents, il existe un mot qui peut servir de contre exemple de longueur au plus $n*m-1* si $n$ et $m$ sont le nombre d'états respectifs des automates.
|
||||||
|
|
||||||
|
* On ne peut pas tester si deux automates non-déterministes sont équivalents, par contre on peut tester si un automate non déterministe est équivalent à un autre automate qui lui est déterministe.
|
||||||
|
|
||||||
|
|
||||||
|
## Mise en oeuvre : déterminisation.
|
||||||
|
|
||||||
|
On considère l'automate TPAutonate1.jff dans le répertoire 2026.
|
||||||
|
|
||||||
|
1. Est-ce que cet automate est déterministe?
|
||||||
|
1. Est-ce que le mot aa est accepté? pourquoi?
|
||||||
|
1. Même question pour le mot aaba.
|
||||||
|
1. Pour les 2 mots ci-dessus, écrivez l'arbre de calcul.
|
||||||
|
1. Est-ce que vous pouvez déterminisez cet automate?
|
||||||
|
|
||||||
|
## Mise en oeuvre : déterminisation.
|
||||||
|
|
||||||
|
On considère l'automate TPAutonate2.jff dans le répertoire 2026.
|
||||||
|
|
||||||
|
1. Est-ce que cet automate est déterministe?
|
||||||
|
1. Est-ce que le mot aa est accepté? pourquoi?
|
||||||
|
1. Même question pour le mot aaba.
|
||||||
|
1. Pour les 2 mots ci-dessus, écrivez l'arbre de calcul.
|
||||||
|
1. Est-ce que vous pouvez déterminisez cet automate?
|
||||||
|
|
||||||
|
## Mise en oeuvre : équivalence
|
||||||
|
|
||||||
|
On considère les automates TPAutonate3.jff et TPAutonate4.jff dans le répertoire 2026.
|
||||||
|
|
||||||
|
1. Est-ce-que ces automates sont déterministes?
|
||||||
|
1. Est-ce-que ces automates sont complets?
|
||||||
|
1. Est-ce que ces automates sont équivalents?
|
||||||
|
|
||||||
|
## Mise en oeuvre : équivalence
|
||||||
|
|
||||||
|
On revisite les automates TPAutonate1.jff et TPAutonate2.jff dans le répertoire 2026.
|
||||||
|
|
||||||
|
1. Est-ce que ces automates sont équivalents?
|
||||||
|
|
||||||
|
## Pourquoi?
|
||||||
|
|
||||||
|
Reprendre le QCM du départ en justifiant chaque réponse.
|
||||||
|
|
||||||
|
## Pour aller plus loin : Équivalence.
|
||||||
|
|
||||||
|
On considère 2 programmes en java qui prennent en entrée un entier un int et retourne un booléen.
|
||||||
|
Est-ce qu'on peut tester si les deux programmes sont équivalents?
|
||||||
|
|
||||||
|
Même question pour un programme qui prend en entrée un fichier texte.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user