N ECESSARY AND S UFFICIENT C ONDITIONS FOR C OMPOSITIONAL R EPRESENTATIONS
Anonymous authors
Paper under double-blind review
A BSTRACT
Humans naturally use compositional representations for ﬂexible recognition and expression, but current machine learning lacks such ability.
Despite many efforts in speciﬁc cases, there is still absence of theories and tools to study it systematically.
In this paper, we leverage group theory to mathematically prove necessary and sufﬁcient conditions for two fundamental questions of compositional representations.
(1) What are the properties for a set of components to be expressed compositionally.
(2) What are the properties for mappings between compositional and original representations.
We provide examples to better understand the borders of the conditions.
We also use the theory to provide a new explanation of why attention mechanism helps compositionality.
We hope this work will help to advance understanding of compositionality and improvement of artiﬁcial intelligence towards human level.
I NTRODUCTION
Humans recognize the world and create imaginations in a supple way by leveraging systematic compositionality to achieve compositional generalization, the algebraic capacity to understand and produce large amount of novel combinations from known components (Chomsky, 1957; Montague, 1970).
This is a key element of human intelligence (Minsky, 1986;
Lake et al., 2017), and we hope to equip machines with such ability.
Conventional machine learning has been mainly developed with an assumption that training and test distributions are identical.
Compositional generalization, however, is a type of out-of-distribution generalization (Bengio, 2017) which has different training and test distributions.
In compositional generalization, a sample is a combination of several components.
For example, an image object may have two factor components of color and rotation.
In language, a sentence is a combination of grammar and lexicon.
The generalization is enabled by recombining seen components for an unseen combination during inference.
The main approach for compositional generalization is to learn compositional representations 1 (Bengio, 2013), which contain several component representations.
Each of them depends only on the corresponding underlying factor, and does not change when other factors change.
Multiple methods have been proposed to learn compositional representations.
However, little discussion has been made for some fundamental questions.
What kind of factor combinations can be expressed in compositional representation?
Though there are some common factor components such as colors and size, what property enable them?
When a set of components satisfy the conditions, what kind of mappings are available between the original and compositional representations?
Can we use the conditions to explain compositionality in conventional models such as attention?
In this paper, we mathematically prove two propositions (Proposition 1.1 and Proposition 1.2) for necessary and sufﬁcient conditions regarding compositional representations.
We construct groups for changes on representations, and relate compositional representation with group direct product, and compositional mapping with group action equivalence.
Then, we use theorems and propositions in group theory to prove the conditions.
Proposition 1.1 (Compositional representation) .
A set of components can be expressed compositionally if and only if the subgroup product equals to the original group, each component subgroup is normal subgroup of the original group, and the group elements intersect only at identity element.
Proposition 1.2 (Compositional mapping) .
Given compositional representation, a mapping is compositional if and only if each component has equivalent action in compositional and original representations, and for each element of the original representation, the orbits intersect only at the element.
Please see Proposition 4.2 and Proposition 4.10 for symbolic statements.
We provide examples to better understand the borders of the conditions.
For the condition of compositional mapping, we use this result to provide a new explanation of why attention mechanism helps compositionality.
Our contributions can be summarized as follows.
• We propose and prove necessary and sufﬁcient conditions for compositional representation and compositional mapping.
• We provide new explanation for existing compositional models, such as attention models.
R ELATED W ORK
Human-level compositional learning (Marcus, 2003; Lake & Baroni, 2018) has been an important open challenge (Yang et al., 2019; Keysers et al., 2020).
There are recent progress on measuring compositionality (Andreas, 2019; Lake & Baroni, 2018; Keysers et al., 2020) and learning language compositionality for compositional generalization (Lake, 2019; Russin et al., 2019; Li et al., 2019;
Gordon et al., 2020; Liu et al., 2020) and continual learning (Jin et al., 2020;
Li et al., 2020).
Another line of related but different work is statistically and marginally independent disentangled representation learning (Burgess et al., 2018; Locatello et al., 2019).
This setting assumes marginal independence between underlying factors hence does not have compositional generalization problem.
On the other hand, compositional factors may not be marginally independent.
Understanding of compositionality has been discussed over time.
Some discussions following Montague (1970) uses homomorphism to deﬁne composition operation between original and representations.
Recently, Li et al.
(2019) deﬁnes compositionality probabilistically without discussing conditions to achieve it.
Gordon et al.
(2020) ﬁnds compositionality in SCAN task can be expressed as permutation group action equivalence.
This equivalent action is on a component subgroup, but it does not discuss equivalent action on the whole group and the relations between them.
There are also other works related to group theory in machine learning (Kondor, 2008; Cohen & Welling, 2016;
Ravanbakhsh et al., 2017; Higgins et al., 2018; Kondor & Trivedi, 2018).
However, the previous works do not prove conditions for compositional representation or mapping.
In this paper, we provide and theoretically prove necessary and sufﬁcient conditions for compositional representations and compositional mappings.
We use deﬁnitions, propositions and theorems from group theory.
Some of them are summarized in books, such as Dummit & Foote (2004) and
Gallian (2012), and we refer to them in the later sections.
P RELIMINARIES FOR G ROUP T HEORY
In this section, we go through some preliminaries for group theory.
We provide widely used deﬁnitions, propositions and theorems, with references for more details.
3. G ROUPS
Deﬁnition 3.1 (Group) .
A group is an ordered pair ( G, ◦ ) where G is a set and ◦ is a binary operation on G satisfying associativity, identity and inverses.
We say G is a group if the operation ◦ is clear from the context, and we also omit ◦ .
Dummit & Foote (2004) p.
(also Gallian (2012) p.43)
Deﬁnition 3.2 (Subgroup) .
If a subset H of a group G is itself a group under the operation of G , we say that H is a subgroup of G .
Gallian (2012) p.61 (also Dummit & Foote (2004) p.46)
Deﬁnition 3.3 (Normal subgroup) .
A subgroup H of a group G is called a normal subgroup of G if aH =
Ha, ∀ a ∈ G .
We denote this by H (cid:47) G .
Dummit & Foote (2004) p.82, Gallian (2012)
p.
M APPINGS
Deﬁnition 3.4 (Group homomorphism) .
A homomorphism ϕ from a group G to a group H is a mapping from G into H that preserves the group operation, i.e., ∀ a, b ∈ G, ϕ ( ab ) =
ϕ ( a ) ϕ ( b ) .
Gallian (2012) p.208, Dummit & Foote (2004) p.36.
Deﬁnition 3.5 (Group isomorphism) .
The map ϕ : G → H is called an isomorphism and G and H are said to be isomorphic or of the same isomorphism type, written G ∼ =
H , if ϕ is a homomorphism and a bijection.
Dummit & Foote (2004) p.37, Gallian (2012) p.128.
3. P RODUCTS
Deﬁnition 3.6 (Product of subgroups) .
Let H 1 , . . .
, H K be subgroups of a group and deﬁne
H 1 H 2 . . .
H K =
{ h 1 h 2 . . .
h K | h i ∈
H i , ∀ i = 1 , . . .
, K } .
Dummit & Foote (2004)
p.
Deﬁnition 3.7 (External direct product) .
Let G 1 , . .
, G K be a ﬁnite collection of groups.
The external direct product of G 1 , . .
, G K , written as G 1 × · · · × G K , is the set of all K -tuples for which the i th component is an element of G i and the operation is component wise.
In symbols,
G 1 × · · · × G K =
{ ( g 1 , . .
. , g K ) | g i ∈
G i } , ( g 1 , . .
. , g K )
( g (cid:48) 1 , . . .
, g (cid:48) [Equation] g
[Equation]
g (cid:48) [Equation]
Gallian (2012) p.162, Dummit & Foote (2004)
p.
Proposition 3.1 (External direct product is a group) .
If G 1 , . . .
, G K are groups, their external direct product is a group.
Dummit & Foote (2004) p.153.
Proposition 1.
Deﬁnition 3.8 (Internal direct product) .
Let H 1 , . . .
, H K be a ﬁnite collection of normal subgroups of G .
We say that G is the internal direct product of H 1 , . . .
, H K , if
G = H 1 H 2 . . .
H K and
[Equation]
[Equation]
[Equation]
Gallian (2012) p.197, Dummit & Foote (2004) p.172.
Theorem 3.2 (Recognition theorem) .
If a group G is the internal direct product of a ﬁnite number of subgroups H 1 , . .
, H K , then G is isomorphic to the external direct product of H 1 , . . .
, H K .
Gallian (2012) p.198, Dummit & Foote (2004) p.171.
3. G ROUP ACTIONS
Deﬁnition 3.9 (Group action) .
A group action of a group G on a set
X is a map from G × X to X (written as g ( x ) , ∀ g ∈ G, x ∈ X ) satisfying the following properties:
[Equation]
and e ( [Equation] [Equation] X
Dummit & Foote (2004)
p.
Deﬁnition 3.10 (Product action) .
G =
G 1 × · · · × G K is a group, and X = X 1 × · · · × X K is a set.
G acts on X by the rule ( g 1 , . . .
, g K )( x 1 , . . .
, x K ) =
( g 1 x 1 , . . .
, g K x K ) .
Cameron et al.
Praeger & Schneider (2018)
p.71.
Deﬁnition 3.11 (Orbit) .
Let G be a group action on the nonempty set X .
The equivalence class
O Gx = { g ( x ) | g ∈ G } is called the orbit of G containing x .
Dummit & Foote (2004)
p.
Deﬁnition 3.12 (Transitive action) .
The action of G on A is called transitive if there is only one orbit, i.e., given any two elements a, b ∈
A there is some g ∈ G such that a = g ( b ) .
Dummit &
Foote (2004)
p.
Deﬁnition 3.13 (Equivalent action) .
Two actions of a group G on sets X and Y are called equivalent if there is a bijection ϕ : X → Y such that ϕ
( g ( x ))
=
g ( ϕ ( x )) for all g ∈ G and x ∈ X .
We say G eq.
acts on X and Y .
Lovett (2015) p.385.
C OMPOSITIONALITY AND G ROUPS
In this section, we derive necessary and sufﬁcient conditions for compositionality step by step.
We ﬁrst construct groups for representations.
We then describe compositionality with group properties, and study the conditions for them.
Based on that, we further study the conditions for mappings between two representations.
4. G ROUPS ON REPRESENTATIONS
Compositionality arises when we compare different samples, where some components are the same but others are not.
This means compositionality is related to the changes between samples.
These changes can be regarded as mappings, and since the changes are invertible, the mappings are bijective.
To study compositionality we consider a set of all bijections from a set of possible representation values to the set itself, and construct a group with the following Proposition 4.1.
Proposition 4.1.
Let X be any nonempty set and S X be the set of all bijections from X to itself.
The set S X is a group under function composition 2 .
Dummit & Foote (2004)
P.
Since S X contains all bijections, the group S X acts on the set X (Deﬁnition 3.9), and the action is transitive (Deﬁnition 3.12).
We consider two representations and corresponding sets.
X is original entangled representation, and Y is compositional representation.
We create group G on set X , and group H on set Y .
4. C OMPOSITIONAL R EPRESENTATION
When multiple hidden variables live in the same representation, and cannot be separated by simply splitting the representation, then these variables are entangled in the representation.
For example, rotation and color are two hidden variables and they are both in a representation of image.
We hope to extract the hidden variables by disentangling the representation.
Suppose X is a set of original representations, and Y is a set of compositional representations.
Y has Cartesian product of K small sets Y 1 , . . .
, Y K .
We hope to ﬁnd the conditions the changes on X can be expressed by the changes on the components in Y .
A component corresponds to a set.
For example, color component can take blue, green, etc., from a set of colors.
With Proposition 4.1, we can construct a group for each component.
With Deﬁnition 3.2, each of these groups is a subgroup of the original group.
We consider K subgroups.
We hope the changes on the original representation X are equally expressed by changes on the compositional representation Y .
This means group G should be isomorphic with the external direct product (Proposition 3.1) of the subgroups H = N 1 × · · · × N K .
The following Proposition 4.2 has the necessary and sufﬁcient conditions.
Proposition 4.2.
N 1 , . .
. , N K are subgroups of group G .
G is isomorphic to the external direct product of the subgroups if and only if G is internal direct product of the subgroups.
From Deﬁnition 3.8, we have the following.
[Equation]
Proof.
“ ⇐ = ”: Theorem 3.2.
“ = ⇒ ”:
G and N 1 ×· · ·× N K are isomorphism, and N 1 ×· · ·× N K satisﬁes the conditions by construction in deﬁnition.
(A1) means the subgroup product should cover the original group.
(A2) means all the component subgroups are normal subgroups of the original group.
(A3) means the intersection of a subgroup and the previous subgroups only contain the identity element.
This corresponds to Proposition 1.1.
We will provide examples and look into more details in discussion section.
4. C OMPOSITIONAL MAPPING
We consider to create a mapping between the representations X and Y , which we can use to design models.
We ﬁrst consider what property the mapping should satisfy.
We then explore conditions for the properties, based on the compositional representation conditions mentioned above.
To make the ideas clear, we summarize the relations between sets and groups in Figure 1 (left).
We have a isomorphism µ between group G and group H .
G is constructed from set X and H is constructed from set Y .
ϕ is a mapping between X and Y .
We denote N (cid:48)
i = { h ∈ H | h i ∈ N i , h j = e, ∀ j (cid:54) = i } .
Then the relations between subsets and subgroups are in Figure 1 (right).
G
H
X
Y
[Equation]
= µ ϕ
N
[Equation]
N (cid:48)
i
O
[Equation]
x
O N
[Equation]
) ∼ = µ ϕ
We ﬁrst consider what property we hope the mapping ϕ to have.
We hope both representations always change together.
However, the actions are deﬁned for different groups G and H .
With
Proposition 4.5 below, we deﬁne action of the same group on both representations.
Proposition 4.3.
For any group G and any nonempty set X there is a bijection between the actions of G on X and the homomorphisms of G into S X .
Dummit & Foote (2004) p.43,p.
Lemma 4.4.
The function composition of homomorphisms is a homomorphism.
Clark (1984) p.45.
Proposition 4.5.
For groups G and H , G ∼ = H with bijection µ , H acts on X with homomorphism σ : H → S X , then G acts on X with homomorphism σ ◦ µ : G → S X .
Proof.
With Proposition 4.3, we only need to prove σ ◦ µ is homomorphism.
This is true because σ and µ are both homomorphisms (Lemma 4.4).
With such action, we look into more details of the requirements.
When an action changes one representation, it should always changes the other representation uniquely, which means the mapping should be bijective.
Also, the mapping ϕ should preserve the group action.
This means the group actions on X and Y are equivalent.
(Deﬁnition 3.13).
Note that mapping direction can be either way because the mapping is bijective.
We then consider how to make the action equivalent, with the conditions for compositional representations.
We observe that H is external group acting on Cartesian set Y , the action of H on Y is product action (Deﬁnition 3.10).
We look at related properties as follows.
Proposition 4.6.
N 1 ×· · ·× N K has production action on X =
X 1 ×· · ·× X K , then ∀ x ∈ X, ∀ i = 1 , . .
, K − 1 : O N 1 ...
N i x ∩ O N
i +1 x
= { x } .
Proof.
A direct product is isomorphic to itself, so properties in Proposition 4.2 can be used.
[Equation]
=
[Equation]
Proposition 4.7.
N 1 , . .
. , N K are subgroups of a group acting on a set X .
If ∀ x ∈ X, ∀ i = 1 , . .
, K − 1 : O N 1 ...
N i x ∩ O N
i +1 x
= { x } , then ∀ x ∈ X, ∀ n 1 ∈ N 1 , n 2 ∈ N 2 , . .
. , n K ∈ N K , n 1 n 2 . . .
n K ( x ) =
x ⇐⇒ n i ( x ) = x, ∀ i = 1 , . .
K
Proof.
“ ⇐ = ”: Repeat for i = K, . . .
, 1 : n 1 n 2 . . .
n K ( x ) = n 1 n 2 . . .
n K − 1 ( x ) = · · · = x “ = ⇒ ”: n 1 n 2 . . .
n K ( x ) =
x = ⇒ n K ( x ) =
( n 1 n 2 . . .
n K − 1 ) − 1 ( x ) =
⇒ n K ( x ) ∈
O N 1 ...N K − 1 x ∩
O N K x = { x } = ⇒ n K ( x ) = x and n 1 n 2 . .
n K − 1 ( x ) = x
Repeat for i =
K − 1 , . .
, 2 , we have n i ( x ) = x, ∀ i = 1 , . .
, K
Proposition 4.8.
N 1 ×· · ·× N K has production action on X =
X 1 ×· · ·× X K , then ∀ x ∈ X, ∀ n 1 ∈
N 1 , n 2 ∈ N 2 , . .
. , n K ∈ N K , we have n 1 n 2 . . .
n K ( x ) =
x ⇐⇒ n i ( x ) = x, ∀ i = 1 , . .
, K .
Proof.
Proposition 4.6 and Proposition 4.7.
Since H and Y are composed by multiple components, we hope to explore whether the equivalence action property can be broken down to conditions on each component, and the relation between components.
A natural condition on each component is that the action is equivalent for the component.
On Y , by its structure, the orbits of each component group action on a element y intersects only at y , so we hope this condition also applies to X .
With Proposition 4.9, we prove in the following
Proposition 4.10 that the two conditions together is actually the necessary and sufﬁcient condition for the equivalent action.
Proposition 4.9.
If ∀ x ∈ X, ∀ i = 1 , . .
, K − 1 : O N 1 ...
N i x ∩ O N
i +1 x
= { x } .
∀ i, ∀ x ∈ X :
N i eq.
acts on O N i x and O N i ϕ ( x ) , then ϕ : X → Y is one-to-one.
Proof.
Any component has bijective mapping, and preserves action.
We prove by contradiction.
∀ x, x (cid:48)
( x (cid:54) = x (cid:48) )
∈ X, ∃ g = n 1 . . .
n K ∈ N 1 N 2 . . .
N K : x (cid:48) =
g ( x ) (transitive, Section 4.1) suppose ϕ ( x ) =
ϕ
( x (cid:48) ) , then ϕ ( x ) =
ϕ ( g ( x )) =
ϕ ( n 1 . . .
n K ( x ))
= presv.
n 1 . . .
n K ( ϕ ( x ))
=
⇒ Prop 4.7 ϕ ( x )
=
n i ( ϕ ( x
[Equation]
Proposition 4.10.
G ∼ = N 1 × · · · × N K .
With ϕ : X → Y ,
G eq.
acts on X and Y ⇐⇒
[Equation]
Proof.
“ ⇐ = ”.
From Deﬁnition 3.13, an equivalent action is bijective and preserves action.
We ﬁrst prove the mapping preserves action.
∀
[Equation]
n
[Equation]
n
[Equation] [Equation]
We then prove that ϕ is bijection on X → Y .
We prove it is one-to-one, onto, well-deﬁned.
One-to-one: Proposition 4.9.
Onto: ∀ y ∈ Y, ∀ x ∈ X ∃ n 1 n 2 . . .
n K (transitive, Section 4.1) :
y = n 1 n 2 . . .
n K ( ϕ ( x ))
=
ϕ ( n 1 n 2 . . .
n K ( x )) , so ∃ x (cid:48)
=
n 1 n 2 . .
n K ( x ) ∈ X : y
= ϕ
( x (cid:48) ) .
Welldeﬁned: H has production action on Y , and ϕ is onto, and with Proposition 4.6 and Proposition 4.9, ϕ − 1 : Y → X is one-to-one, so ϕ is well-deﬁned.
“ = ⇒ ”.
We ﬁrst prove (B2).
Since subgroup has the same operation with the original group, the equivalent action holds for each component.
We then prove (B1).
[Equation]
To summarize, this proposition says that to ﬁnd whether a mapping has equivalent action on both representations, we only need to examine whether, for each element, the action is equivalent for each subgroup, and the intersections of orbits only contains the element.
This corresponds to Proposition 1.2.
In cases both representations are entangled, and we hope to have a compositional representation to connect them, we can use the conditions twice for the mapping.
We will discuss the relation to machine learning and compositional generalization, and provide examples in the discussion section.
D ISCUSSIONS
In this section, we provide examples for the conditions of compositional representation and mapping, and look into more insights for better understanding.
5. C OMPOSITIONAL REPRESENTATION
We provide examples for the boundaries of compositional representation conditions.
Proposition 5. is used to test normal subgroups.
Proposition 5.1 (Normal Subgroup Test) .
A subgroup H of G is normal in G if and
only if xHx − 1 ⊆ H, ∀ x ∈ G .
Dummit & Foote (2004) p.82 Theorem 6(5), Gallian (2012) p.186 Theorem 9.1.
Object transformation We think about examples violating conditions in Proposition 4.2.
For a two dimensional geometric object (e.g. image of letter “P”), we consider rotation group N 1 , and mirror reﬂection group N 2 .
If G = N 1 , and N 2 contains non-identity element, then G (cid:54) = N 1 N 2 , because any combination of rotation does not generate a reﬂection.
This violates (A1).
We set G = N 1 N 2 , and both rotation and reﬂection take all possible values.
In this case, both
N 1 and N 2 are normal subgroups of G , N 1 , N 2 (cid:47) G .
However the intersection of N 1 and N 2 does not only contain identity, N 1 ∩ N 2 (cid:54) =
{ e } .
For example, rotating by π is equivalent with vertical reﬂection then horizontal reﬂection.
Therefore, this violates (A3).
If we constrain reﬂection action to horizontal reﬂection, and leave rotation to have all possible values, then rotation N 1 and horizontal reﬂection N 2 form a group G .
In this case, N 1 and Nonly intersects at identity, N 1 ∩ N 2 = { e } .
However, N 2 is not normal subgroup of G .
If we set rotation action n 1 to be rotate by π/ 2 , n − 1 1 is to rotate by − π/ 2 .
Action of horizontal reﬂection has n 2 = n − 1 2 .
We ﬁnd n 1 n 2 n − 1/ ∈ N 2 , because rotate by π/ 2 , ﬂip horizontally, and rotate − π/ 2 , then it does not recover the original by a horizontal reﬂection.
With Proposition 5.1, N 2 is not a normal subgroup of G , so this violates (A2).
We further think about an example, where we also constrain the rotation to be rotate opposite (by π ), and reﬂection remains only horizontal.
they form group G .
In this case, rotation and reﬂection are both normal subgroups of G , N 1 , N 2 (cid:47) G .
Also, N 1 and N 2 only have identity in their intersection
N 1 ∩ N 2 = { e } .
Therefore, N 1 and N 2 can be expressed by compositional representation.
We have another example with color as N 1 and combination of rotation and reﬂection as N 2 .
They form group G .
In this case, regardless the elements in the sets, N 1 and N 2 are always normal subgroups of G , and their intersection always only contains identity.
So they can be expressed as compositional representation.
From these examples, we see that whether the components can be expressed with compositional representation does not depend only on each component itself, but also on their combination, and the possible values to take.
For some combinations, they are not inﬂuenced by possible values.
Grammar tree node We also look at an example for language grammar tree node.
In a grammar tree, each node G has multiple children.
We regard each child as a component
N i , i = 1 , . .
, K .
We then consider whether the components can be expressed by compositional representation.
For context free grammar, G = N 1 N 2 . . .
N K .
Each N i is normal subgroup of G , because a change in one children does not affect others.
Also, the intersection of them only contains identity, because each sub-tree is separated.
Therefore, a tree node with context free grammar is possible to be expressed with compositional representation.
We also look at an example of root node in syntactic tree for ﬁxed length sentences.
When at least one subgroup actions change the phrase length, the product of N i may be not a group, because it may change the sentence length ( G (cid:54) =
N 1 N 2 . . .
N K ).
This means G does not ﬁt the conditions.
Note that such grammar is not a context free grammar.
5. C OMPOSITIONAL MAPPINGS
Conditions for compositional mapping can be used to design models for the relation between two representations.
We ﬁrst describe the connection with machine learning, and then use the conditions to explain some existing neural network models and tasks.
Model training and architecture for compositional generalization We consider samples in training.
For compositional generalization, some elements in the whole set Y (or X ) are missing, but for each subset Y i , the elements are complete.
For condition (B2) in Proposition 4.10, each subset has complete samples, so it is satisﬁed.
For condition (B1), the set has missing elements, so we do not have information to tell whether it is satisﬁed.
To address this problem for condition (B1), we may constraint the mapping ϕ that the images for each component intersect at only one element.
Attention mechanism Attention mechanism is used for compositional modelings (Goyal et al., 2019; Russin et al., 2019;
Li et al., 2019).
We consider a problem that there are two components for an object.
One component is the position of the object, and the other is the local shape (or word for language processing) of the object.
We look into an attention network that combines the two components to generate output.
We ﬁrst check whether the two components can be expressed as compositional representation.
Set
N 1 is group for position, N 2 is group for shape, and G = N 1 N 2 .
For an object, if we change shape, position, and shape back, the shape does not change.
Similarly, change position, shape and position back, the position does not change.
With Proposition 5.1, N 1 and N 2 are both normal subgroups of
G .
Also, N 1 ∩ N 2 = { e } because changing position does not change shape, and changing shape does not change position.
This means the components can be expressed as compositional representation.
We then check whether the model is compositional mapping.
First, we look at each component.
For both position and shape, the mapping is bijective and preserves action.
Second, we look at the orbits of images.
Since the shape only changes locally, it does not change position, and position does not change shape.
Therefore, the model is compositional.
Note that we do not assume that the attention is sparse for each sample.
This is different from some conventional explanations (Bengio, 2017; Goyal et al., 2019) of attention mechanism.
The attention helps compositional generalization not because it is dynamically sparse, but it ﬁts the conditions.
For example, when there are multiple positions to attend in one attention map, it may still ﬁt the conditions.
Spatial transformer
In the example of attention mechanism, position is aligned with one build-in dimension of data structure.
However, this is not necessary.
Here, we provide another example with Spatial Transformer (Jaderberg et al., 2015) for such a case.
We focus on the transformations for rotation and scaling.
The data structure does not have such build-in dimensions.
We see that rotation and scaling satisfy Proposition 4.2 to be expressed with compositional representation, and the mapping satisﬁes Proposition 4.10 to be compositional mapping.
However, if we consider rotation and shape, the network might not be compositional.
For example, rotations by 0 , 2 π/ 3 , 4 π/ 3 map a triangle it to itself, but this does not apply to a square.
This means if a set of rotation contains both 0 and 2 π/ 3 , it is not bijective for triangle.
If it contains 0 but not 2 π/ 3 , it is not bijective for square.
Therefore, it violates (B2).
Ambiguous context free grammar We discussed that a node for context free grammar is able to be expressed with compositional representation.
However, when there is syntactic ambiguity, we are not able to get the compositional mapping.
This violates the condition (B1), because the orbits have more than one elements in the intersection.
C ONCLUSION
We use group theory to prove necessary and sufﬁcient conditions for compositional representation and mapping.
We discuss examples for the conditions, and understand the boarders of them.
We also provide new explanation for existing methods.
We hope this work will help to advance compositionality and artiﬁcial intelligence research.