Multiple-level Incorporation and Printed Names

I’m looking for a way to make it so that incorporation always refers to the “ultimate incorporater” when dealing with possessives when there are multiple levels of incorporation. Essentially, in this example, “>look hand” asks you to disambiguate between “your right arm’s hand” and “your left arm’s hand”… but I want it to simply say “your right hand” and “your left hand”.

Obviously, not having multiple levels of incorporation in the first place would solve it, but having the assemblies with multiple levels of incorporation is much MUCH simpler for what I’m trying to do than trying to piece everything back together in some crazy way under the hood. If an arm is cut off, well… then the hand should go too. I don’t want to have to sort through figuring out if a hand needs to be following an arm around “pretending” to be part of it… I just want it to actually be part of it to keep it simple. But the printed name is bizarre.

I tried throwing together a rule to deal with it, thinking that maybe internally the printed name “your right arm’s hand” was constructed of multiple printed names concatenated together. Maybe it is, but the rules I wrote don’t seem to address it all the same.

To decide which thing is the ultimate_incorporater of (A - a thing):
	let the ultimate_holder be a thing;
	if A is incorporated by something:
		if A is incorporated by a thing (called B):
			now ultimate_holder is B;
		if ultimate_holder is incorporated by a thing (called C):
			now ultimate_holder is C;
		if ultimate_holder is incorporated by a thing (called D):
			now ultimate_holder is D;
		if ultimate_holder is incorporated by a thing (called E):
			now ultimate_holder is E;
		decide on ultimate_holder;
		decide on A;

recursive_incorporation relates a thing (called x) to a thing (called y) when x is the ultimate_incorporater of y. The verb to recursively_incorporate (he recursively_incorporates, it is recursively_incorporated) implies the recursive_incorporation relation.

Before printing the name of something (called x):
	if x incorporates something (called y) and x is not the ultimate_incorporater of y:
		do nothing instead;
The kitchen is a room.

The player is in the kitchen.

An arm is a kind of thing.

A hand is a kind of thing.

A hand is a part of every arm.

A right arm is a kind of arm.

A left arm is a kind of arm.

A right arm is a part of every person

A left arm is a part of every person.

I think I figured it out… this is only a simple, unsophisticated use case, and there will need to be more in my real application, but at least from this seed I can resolve those cases I think:

The printed name of a left hand is usually "[regarding the ultimate_incorporater of the item described][possessive] left hand".