The word problem for a finite set of ground identities is known to be decidable in polynomial time using congruence closure, and this is also the case if some of the function symbols are assumed to be commutative or defined by certain shallow identities, called strongly shallow. We show that decidability in P is preserved if we add the assumption that certain function symbols f are extensional in the sense that $$f(s_1,\ldots ,s_n) \mathrel {\approx }f(t_1,\ldots ,t_n)$$
f
(
s
1
,
…
,
s
n
)
≈
f
(
t
1
,
…
,
t
n
)
implies $$s_1 \mathrel {\approx }t_1,\ldots ,s_n \mathrel {\approx }t_n$$
s
1
≈
t
1
,
…
,
s
n
≈
t
n
. In addition, we investigate a variant of extensionality that is more appropriate for commutative function symbols, but which raises the complexity of the word problem to coNP.