Mescal
Loading...
Searching...
No Matches
monoid.h
Go to the documentation of this file.
1
16
17#ifndef _MONOID_H_
18#define _MONOID_H_
19
20#ifndef max
21#define max(a, b) (((a) > (b)) ? (a) : (b))
22#endif
23
24#ifndef min
25#define min(a, b) (((a) < (b)) ? (a) : (b))
26#endif
27
28#include "graphs.h"
29#include "nfa.h"
30#include "tools.h"
31#include "type_abr.h"
32#include "type_basic.h"
33#include "type_binheap.h"
34#include "type_dequeue.h"
35#include "type_dequeue_gen.h"
36#include "graphs_tarjan.h"
37#include <stdarg.h>
38#include <stdbool.h>
39#include <stdio.h>
40#include <stdlib.h>
41#include <limits.h>
42
43 /* __ __ _ _ _ */
44 /* | \/ | ___ _ __ ___ (_) __| |___ __ _ _ __ __| | */
45 /* | |\/| |/ _ \| '_ \ / _ \| |/ _` / __| / _` | '_ \ / _` | */
46 /* | | | | (_) | | | | (_) | | (_| \__ \ | (_| | | | | (_| | */
47 /* |_| |_|\___/|_| |_|\___/|_|\__,_|___/ \__,_|_| |_|\__,_| */
48 /* _ __ ___ ___ _ __ _ __ | |__ (_)___ _ __ ___ ___ */
49 /* | '_ ` _ \ / _ \| '__| '_ \| '_ \| / __| '_ ` _ \/ __| */
50 /* | | | | | | (_) | | | |_) | | | | \__ \ | | | | \__ \ */
51 /* |_| |_| |_|\___/|_| | .__/|_| |_|_|___/_| |_| |_|___/ */
52 /* |_| */
53
54
55
56//#define DEBUG_MONO
57
58
63#define ONE 0
64
69typedef struct {
70
71 /* Partitions */
76
77 /* Informations on regular elements */
80
81 /* Information on groups */
83} green;
84
85
86
91typedef struct {
92 /* Mandatory fields */
94 uint* pred_ele;
95 uint* pred_lab;
98
99 uint nb_idems;
100 uint* idem_list;
106
110
111 /* Optional fields (NULL if not computed) */
112 uint* mult;
113 uint** order;
116} morphism;
117
118/*******************/
119/* Basic functions */
120/*******************/
121
126void delete_green(green*
127);
128
134);
135
144);
145
157uint mor_letter_index(const morphism*,
158 letter
159);
160
165
167 uint
168);
169
170
171/**********************************************/
172/* Preliminary functions for the construction */
173/**********************************************/
174
183);
184
194 uint
195);
196
202);
203
211void gr_green_compute(uint*,
212 uint,
213 green*
214);
215
216
225);
226
227
236);
237
246);
247
248
249/************************************/
250/* Construction from a complete DFA */
251/************************************/
252
253
269 bool,
270 int*,
271 uint**
272);
273
274
284);
285
294);
295
304);
305
306
307
308
309/***************************************/
310/* Computing information on a morphism */
311/***************************************/
312
313
314
323);
324
333);
334
343);
344
356);
357
358
359/***************************/
360/* Operations on morphisms */
361/***************************/
362
371 uint
372);
373
374
385uint mor_mult(morphism*,
386 uint,
387 uint
388);
389
401 uint,
402 ...
403);
404
412uint mor_omega(morphism*,
413 uint
414);
415
428 uint,
429 uint*
430);
431
432
433
434
435
436/**************/
437/* Properties */
438/**************/
439
451 FILE*
452);
453
462);
463
472);
473
474
475
488 word*
489);
490
491
492
504 uint rcl
505);
506
507/*
508
509// Récupération des éléments intersectant chaque alphabet dans un tableau
510dequeue** at_table_cayley(morphism*);
511
512// Affichage du tableau
513void print_at_table(morphism* M, dequeue** table, FILE* out); */
514
515#endif // _MONOID_H_
Implementation of graphs.
Implementation of Tarjan's algorithm.
dfa * morphism_to_dfa(morphism *)
Computation of a complete DFA from the right Cayley graph of a morphism.
Definition monoid.c:987
letter * mor_duplicate_alpha(const morphism *)
Copy the alphabet of a morphism.
Definition monoid.c:85
void mor_compute_leftcayley(morphism *)
Computation of the left Cayley graph of a morphism.
Definition monoid.c:112
uint mor_mult_gen(morphism *, uint,...)
Multiplication of an arbitrary number of elements.
Definition monoid.c:1206
dgraph * mor_extract_rcl(morphism *M, uint rcl)
Returns the graph of a single R-class.
Definition monoid.c:1340
void mor_compute_green(morphism *)
Allocates and computes the Green relations of a morphism.
Definition monoid.c:300
uint dfa_to_morphism_size(dfa *A)
Computes the size of the morphism associated to a complete DFA without storing the actual morphism.
Definition monoid.c:922
dequeue ** mor_compute_order(morphism *)
Computation of the syntactic order table of a morphism.
Definition monoid.c:1082
void mor_compute_rep(morphism *)
Computation of list of representative idempotents for the morphism.
Definition monoid.c:356
uint mor_regular_jclass(const morphism *, uint)
Given as input a regular element, retrieves the index of the.
dequeue * mor_name(morphism *, uint)
Return the name of an element (product of generators) in a dequeue.
Definition monoid.c:1179
bool mor_num_idem(morphism *, uint, uint *)
Computes the index of an idempotent element.
Definition monoid.c:1237
lgraph * mor_lmirror(morphism *)
Computation of the mirror of the left Cayley graph.
Definition monoid.c:1077
uint mor_compute_image(morphism *, word *)
Computes the image of a word.
Definition monoid.c:1326
uint * green_sorted_jclass(green *, uint)
Computes an array containing all elements in a given J-class sorted according to the indices of their...
Definition monoid.c:189
void mor_compute_mult(morphism *)
Computation of the multiplication table of a morphism.
Definition monoid.c:1030
void delete_morphism(morphism *)
Release of a morphism.
Definition monoid.c:34
void h_green_compute(green *)
Computation of the relation H from J, L and R (which must be already computed).
Definition monoid.c:200
uint mor_letter_index(const morphism *, letter)
Retrieves the index of a letter in the alphabet of a morphism.
Definition monoid.c:97
bool mor_nonempty_neutral(morphism *)
Tests if there exists a nonempty antecedent of the neutral element in a morphism.
Definition monoid.c:1309
uint mor_mult(morphism *, uint, uint)
Multiplication of two elements.
Definition monoid.c:1189
uint mor_omega(morphism *, uint)
Computes the omega power of an element.
Definition monoid.c:1221
morphism * dfa_to_morphism(dfa *, bool, int *, uint **)
Computation of the transition morphism associated to a complete DFA.
Definition monoid.c:736
bool mor_neutral_letter(morphism *, FILE *)
Tests if there exists a letter mapped to the neutral element.
Definition monoid.c:1291
bool mor_all_regular(morphism *)
Tests if all elements in a morphism are regular.
Definition monoid.c:1319
lgraph * mor_rmirror(morphism *)
Computation of the mirror of the right Cayley graph.
Definition monoid.c:1073
void mor_compute_min_regular_jcl(morphism *)
Computation of the number of strict J-classes.
dfa * left_morphism_to_dfa(morphism *)
Computation of a complete DFA from the left Cayley graph of a morphism.
Definition monoid.c:1005
void delete_green(green *)
Release of the Green relations.
Definition monoid.c:16
void gr_green_compute(uint *, uint, green *)
Computation of informations on regular elements and groups (the Green relations themselves must be al...
Definition monoid.c:268
Implementation of NFAs.
Type used to represent a dequeue of unsigned integers.
Definition type_dequeue.h:26
Type used to represent a complete DFA.
Definition nfa.h:61
Type used to represent a complete deterministic directed labeled graph.
Definition graphs.h:73
Type used to represent the Green relations of a finite monoid.
Definition monoid.h:69
bool * group_array
Array of Booleans indexed by the elements of the monoid. Marks the ones that belong to a group.
Definition monoid.h:82
parti * LCL
L-classes.
Definition monoid.h:73
bool * regular_array
Array of Booleans indexed by the elements of the monoid. Marks the regular elements.
Definition monoid.h:79
uint nb_regular_elems
Number of regular elements.
Definition monoid.h:78
parti * JCL
J-classes.
Definition monoid.h:72
parti * HCL
H-classes.
Definition monoid.h:75
parti * RCL
R-classes.
Definition monoid.h:74
The type used to represent a letter.
Definition words.h:33
Type used to represent a directed labeled graph.
Definition graphs.h:57
The type used to represent a morphism into a finite monoid.
Definition monoid.h:91
uint nb_regular_jcl
Number of regular J-classes.
Definition monoid.h:107
uint * order_size
The size of the ordering for each element (the number of larger elements).
Definition monoid.h:114
uint * mult
The multiplication table size r_cayley->size_graph * r_cayley->size_graph (NULL if not computed).
Definition monoid.h:112
bool * accept_array
An array of Booleans indexed by the elements. Marks the accepting elements.
Definition monoid.h:104
uint * accept_list
The list of all accepting elements, sorted in increasing order.
Definition monoid.h:103
green * rels
The Green relations of the monoid.
Definition monoid.h:105
uint * regular_idems
Array indexed by the regular J-classes (sorted in topological order). Associates a member idempotent ...
Definition monoid.h:109
dgraph * l_cayley
The left Cayley graph of the morphism.
Definition monoid.h:97
uint * pred_lab
Array of preceding letters (for the naming as a product of generators).
Definition monoid.h:95
letter * alphabet
An array indexed by the letters indices (generators). Assigns its letter to each index.
Definition monoid.h:93
uint nb_idems
Number of idempotents in the morphism.
Definition monoid.h:99
uint * order_storage
The storage of the ordering (one dimension array).
Definition monoid.h:115
dgraph * r_cayley
The right Cayley graph of the morphism (stores the number of elements and the numbers of letters).
Definition monoid.h:96
uint ** order
Partial information on the ordering on the monoid. Array of size nb_regular_jcl, Each representative ...
Definition monoid.h:113
uint nb_min_regular_jcl
The number of "strict minimal" J-classes (no smaller regular J-class has a nonempty antecedent).
Definition monoid.h:108
uint * pred_ele
Array of preceding elements (for the naming as a product of generators).
Definition monoid.h:94
uint nb_accept
Number of accepting elements in the morphism.
Definition monoid.h:102
uint * idem_list
The list of all idempotents, sorted in increasing order.
Definition monoid.h:100
bool * idem_array
An array of Booleans indexed by the elements. Marks the idempotents.
Definition monoid.h:101
First type used to represent a partition. This is not the one used by Union-Find.
Definition type_partitions.h:36
The type used to represent a word.
Definition words.h:143
Implementation of AVLs for representing sets of objects.
Basic types.
Implementation of generic binary heaps.
Implementation of dequeues of unsigned integers.
Implementation of generic dequeues which store void pointers.