{"id":6347,"date":"2018-05-30T13:38:37","date_gmt":"2018-05-30T12:38:37","guid":{"rendered":"http:\/\/smart--grid.net\/?page_id=6347"},"modified":"2022-12-03T23:00:29","modified_gmt":"2022-12-03T22:00:29","slug":"langages-reguliers-et-expressions-regulieres","status":"publish","type":"page","link":"https:\/\/complex-systems-ai.com\/en\/language-theory\/regular-languages-and-regular-expressions\/","title":{"rendered":"Regular languages and regular expressions"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"6347\" class=\"elementor elementor-6347\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4246d1c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4246d1c\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-6c90b6f\" data-id=\"6c90b6f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2a08eaf elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"2a08eaf\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/complex-systems-ai.com\/en\/language-theory\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Language theory<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-9ee40a5\" data-id=\"9ee40a5\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-546da1c elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"546da1c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/complex-systems-ai.com\/en\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Home page<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<div class=\"elementor-column elementor-col-33 elementor-top-column elementor-element elementor-element-8c2eb5d\" data-id=\"8c2eb5d\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b61443a elementor-align-justify elementor-widget elementor-widget-button\" data-id=\"b61443a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/fr.wikipedia.org\/wiki\/Grammaire_r%C3%A9guli%C3%A8re\" target=\"_blank\" rel=\"noopener\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Wiiki<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-38b7465 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"38b7465\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-9e9f54b\" data-id=\"9e9f54b\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-cb074cd elementor-widget elementor-widget-progress\" data-id=\"cb074cd\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"progress.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t<span class=\"elementor-title\" id=\"elementor-progress-bar-cb074cd\">\n\t\t\t\tDifficulty\t\t\t<\/span>\n\t\t\n\t\t<div aria-labelledby=\"elementor-progress-bar-cb074cd\" class=\"elementor-progress-wrapper\" role=\"progressbar\" aria-valuemin=\"0\" aria-valuemax=\"100\" aria-valuenow=\"25\" aria-valuetext=\"25% (Facile)\">\n\t\t\t<div class=\"elementor-progress-bar\" data-max=\"25\">\n\t\t\t\t<span class=\"elementor-progress-text\">Easy<\/span>\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-progress-percentage\">25%<\/span>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-34a56aa3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"34a56aa3\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-244fb042\" data-id=\"244fb042\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-100384e8 elementor-widget elementor-widget-text-editor\" data-id=\"100384e8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/complex-systems-ai.com\/en\/language-theory\/regular-languages-and-regular-expressions\/#Langages-reguliers-et-expressions-regulieres\" >Regular languages and regular expressions<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/complex-systems-ai.com\/en\/language-theory\/regular-languages-and-regular-expressions\/#Langage-et-expression\" >Language and expression<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/complex-systems-ai.com\/en\/language-theory\/regular-languages-and-regular-expressions\/#Processus-de-creation-dautomate-a-partir-dune-expression-reguliere\" >Process of creating an automaton from a regular expression<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Langages-reguliers-et-expressions-regulieres\"><\/span>Regular languages and regular expressions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>There are two types of regular expressions.<\/p>\n\n<p>We recall that a <a href=\"https:\/\/complex-systems-ai.com\/en\/language-theory\/types-of-grammars\/\">grammar<\/a> G1 = (T, N, S, R) is a right regular expression if the rules of R are of the form: A \u2192 aB or A \u2192 a with A, B \u2208 N and a \u2208 T.<\/p>\n\n<p>Recall that a grammar G2 = (T, N, S, R) is a left-hand regular expression if the rules of R are of the form: A \u2192 Ba or A \u2192 a with A, B \u2208 N and a \u2208 T .<\/p>\n\n<div style=\"padding: 5px; background-color: #d5edff; border: 2px solid #3c95e8; -moz-border-radius: 9px; -khtml-border-radius: 9px; -webkit-border-radius: 9px; border-radius: 9px;\">A language is regular or rational if and only if there exists a regular grammar generating this language.<\/div>\n\n<p>The advantage of distinguishing regular grammars on the right or on the left appears during the analysis: if we read the symbols of the word to be analyzed from left to right, then<\/p>\n\n<ul class=\"wp-block-list\">\n<li>a regular right-hand grammar will be used for a top-down analysis, from the axiom to the word<\/li>\n<li>a regular left-hand grammar will be used for a bottom-up analysis, from the word to the axiom.<\/li>\n<\/ul>\n\n<p>For example, to analyze the word aaabb with the grammar G1, we will construct the derivation S1 \u21d2 aS1 \u21d2 aaS1 \u21d2 aaaU1 \u21d2 aaabU1 \u21d2 aaabb; while to analyze this word with the G2 grammar, we will construct the derivation aaabb \u21d0 U2aabb \u21d0 U2abb \u21d0 U2bb \u21d0 S2b \u21d0 S2.<\/p>\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Langage-et-expression\"><\/span>Language and expression<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n<div style=\"padding: 5px; background-color: #d5edff; border: 2px solid #3c95e8; -moz-border-radius: 9px; -khtml-border-radius: 9px; -webkit-border-radius: 9px; border-radius: 9px;\">\n<p>An expression E is a regular expression on an alphabet A if and only if:<\/p>\n<ul>\n<li>E = \u2205 or<\/li>\n<li>E = \u03b5 or<\/li>\n<li>E = a with a \u2208 A or<\/li>\n<li>E = E1 | E2 and E1 and E2 are two regular expressions on A or<\/li>\n<li>E = E1.E2 and E1 and E2 are two regular expressions on A or<\/li>\n<li>E = E<sup>\u2217<\/sup><sub>1<\/sub> summer<sub>1<\/sub> is a regular expression on A<\/li>\n<\/ul>\n<\/div>\n\n<p>The operators \u2217,. and | have decreasing priority. If necessary, parentheses can be added.<\/p>\n\n<div style=\"padding: 5px; background-color: #d5edff; border: 2px solid #3c95e8; -moz-border-radius: 9px; -khtml-border-radius: 9px; -webkit-border-radius: 9px; border-radius: 9px;\">\n<p>The language L (E) described by a regular expression E defined on an alphabet A is defined by<\/p>\n<ul>\n<li>L (E) = \u2205 if E = \u2205,<\/li>\n<li>L (E) = {\u03b5} if E = \u03b5,<\/li>\n<li>L (E) = {a} if E = a,<\/li>\n<li>L (E) = L (E1) \u222a L (E2) if E = E1 | E2,<\/li>\n<li>L (E) = L (E1) .L (E2) if E = E1.E2,<\/li>\n<li>L (E) = L (E1)<sup>\u2217<\/sup>\u00a0if E = E<sup>\u2217<\/sup><sub>1<\/sub> summer<sub>1<\/sub> is a regular expression on A.<\/li>\n<\/ul>\n<\/div>\n\n<p>The equivalence between regular expressions and regular languages is established by the following two implications:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>Any regular expression describes a regular language.<\/li>\n<li>Any regular language can be described by a regular expression.<\/li>\n<\/ul>\n\n<p>Trivial equivalence list:<\/p>\n\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-6501\" src=\"https:\/\/complex-systems-ai.com\/wp-content\/uploads\/2018\/07\/langage25.png\" alt=\"regular expressions\" width=\"823\" height=\"198\" title=\"\"><\/figure>\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Processus-de-creation-dautomate-a-partir-dune-expression-reguliere\"><\/span>Process of creating an automaton from a regular expression<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" class=\"alignnone\" src=\"https:\/\/complex-systems-ai.com\/wp-content\/uploads\/2018\/10\/langen2.png\" alt=\"regular expression\" width=\"336\" height=\"362\" title=\"\"><\/figure>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Language Theory Wiiki Home Page Difficulty Easy 25% Regular Languages and Regular Expressions There are two types of regular expressions. Remember that a G1 grammar ... <\/p>","protected":false},"author":1,"featured_media":0,"parent":5028,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6347","page","type-page","status-publish","hentry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages\/6347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/comments?post=6347"}],"version-history":[{"count":3,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages\/6347\/revisions"}],"predecessor-version":[{"id":18583,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages\/6347\/revisions\/18583"}],"up":[{"embeddable":true,"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/pages\/5028"}],"wp:attachment":[{"href":"https:\/\/complex-systems-ai.com\/en\/wp-json\/wp\/v2\/media?parent=6347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}