Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Guillaume Sabbagh
Modification de categories
Commits
06731fa7
Commit
06731fa7
authored
Jun 15, 2021
by
Guillaume Sabbagh
Browse files
stash
parent
5b87dfc9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Cluster.py
View file @
06731fa7
...
...
@@ -205,7 +205,9 @@ class CategorieClusters(CategorieInteractions):
result
=
set
()
for
source
in
sources
:
for
cible
in
cibles
:
print
(
source
,
cible
)
interactions
=
CategorieInteractions
.
__call__
(
self
,{
source
},{
cible
})
print
(
source
,
cible
)
proto_cluster_maximaux
=
set
()
while
len
(
interactions
)
>
0
:
interact
=
interactions
.
pop
()
...
...
EnsFinis.py
View file @
06731fa7
...
...
@@ -86,9 +86,9 @@ class CategorieEnsemblesFinis(Categorie):
for
a
in
sources
:
for
b
in
cibles
:
if
not
issubclass
(
type
(
a
),
frozenset
):
raise
Exception
(
"On s'attend à avoir des frozenset dans l'ensemble source, pas un "
+
str
(
type
(
a
))
+
'
\n
'
+
str
(
source
))
raise
Exception
(
"On s'attend à avoir des frozenset dans l'ensemble source, pas un "
+
str
(
type
(
a
))
+
'
\n
'
+
str
(
source
s
))
if
not
issubclass
(
type
(
b
),
frozenset
):
raise
Exception
(
"On s'attend à avoir des frozenset dans l'ensemble cible, pas un "
+
str
(
type
(
b
))
+
'
\n
'
+
str
(
cible
))
raise
Exception
(
"On s'attend à avoir des frozenset dans l'ensemble cible, pas un "
+
str
(
type
(
b
))
+
'
\n
'
+
str
(
cible
s
))
result
|=
{
Application
(
a
,
b
,
dict
(
zip
(
a
,
prod
)))
for
prod
in
itertools
.
product
(
b
,
repeat
=
len
(
a
))}
return
result
...
...
ExemplesCategories.py
View file @
06731fa7
...
...
@@ -11,20 +11,21 @@ cat.transformer_graphviz()
d1
=
DiagrammeObjets
(
cat
,{
frozenset
({
1
,
2
}),
frozenset
({
3
})})
d2
=
DiagrammeObjets
(
cat
,{
frozenset
({
3
,
2
}),
frozenset
({
1
})})
d1
.
transformer_graphviz
()
#
d1.transformer_graphviz()
#d2.transformer_graphviz()
c_p1
=
ChampActif
(
d1
)
c_p2
=
ChampActif
(
d2
)
#
c_p1 = ChampActif(d1)
#
c_p2 = ChampActif(d2)
sous_c_p1
=
SousCategoriePleine
(
c_p1
,
c_p1
.
objets_colimites
())
sous_c_p1
.
transformer_graphviz
()
#
sous_c_p1 = SousCategoriePleine(c_p1,c_p1.objets_colimites())
#
sous_c_p1.transformer_graphviz()
sous_c_p2
=
SousCategoriePleine
(
c_p2
,
c_p2
.
objets_colimites
())
sous_c_p2
.
transformer_graphviz
()
#
sous_c_p2 = SousCategoriePleine(c_p2,c_p2.objets_colimites())
#
sous_c_p2.transformer_graphviz()
cat_hom
=
CategorieHomologue
({
sous_c_p1
,
sous_c_p2
})
#on cherche simplement un isomoprhisme entre les colimites pour dire qu'ils ont les mêmes colimites
print
(
"cat_hom"
)
cat_hom
.
transformer_graphviz
()
\ No newline at end of file
from
Cluster
import
CategorieClusters
cat_clust
=
CategorieClusters
(
cat
,{
d1
,
d2
})
SousCategoriePleine
(
cat_clust
.
transformer_graphviz
(),{
d1
,
d2
}).
transformer_graphviz
()
\ No newline at end of file
Interaction.py
View file @
06731fa7
...
...
@@ -122,7 +122,7 @@ class CategorieInteractions(Categorie):
"""
Categorie
.
__init__
(
self
,
diagrammes
,
"Catégorie des diagrammes et interactions sur "
+
str
(
univers
)
if
nom
==
None
else
nom
)
self
.
univers
=
univers
self
|=
{
DiagrammeObjets
(
univers
,
obj
)
for
obj
in
univers
.
objets
}
self
|=
{
DiagrammeObjets
(
univers
,
{
obj
}
)
for
obj
in
univers
.
objets
}
if
config
.
TOUJOURS_VERIFIER_COHERENCE
:
self
.
verifier_coherence
()
...
...
@@ -138,7 +138,8 @@ class CategorieInteractions(Categorie):
for
b
in
cibles
:
if
a
.
cible
!=
b
.
cible
:
raise
Exception
(
"Les deux diagrammes n'ont pas la même catégorie cible"
)
fleches
=
{
ObjetCommaCategorie
(
i
,
f
,
j
)
for
i
in
a
.
source
.
objets
for
j
in
b
.
source
.
objets
for
f
in
a
.
cible
(
a
(
i
),
b
(
j
))}
fleches
=
{
ObjetCommaCategorie
(
i
,
f
,
j
)
for
i
in
a
.
source
.
objets
for
j
in
b
.
source
.
objets
for
f
in
a
.
cible
({
a
(
i
)},{
b
(
j
)})}
print
(
len
(
fleches
)
+
1
)
for
k
in
range
(
1
,
len
(
fleches
)
+
1
):
for
combi
in
itertools
.
combinations
(
fleches
,
k
):
result
|=
{
Interaction
(
a
,
b
,
set
(
combi
))}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment