Rand uses Lan to maneuver Mat into revealing how much he'd gained in the way of military knowledge. Lan is the one who guesses about Mat's acumen. It's less a trap and more taking advantage of an opportune moment. From The Fires of Heaven, Before the Arrow:
"A pretty situation, wouldn't you say?"
Mat's head jerked up at Lan's voice, but the Warder had entered the tent alone. "Just something to look at while I waited. Is Rand coming back?"
...
Rand stood staring after Mat long after the tent flaps had fallen to hide him. "I only heard the last bit," he said finally. "Was it all like that?"
"Very nearly," Lan replied. "With only a few minutes to study the maps, he laid out close to the battle plan that Rhuarc and the others made...."
Rand looked at him. The Warder showed no surprise, not the twitch of an eyelash. Of course, he was the one who said Mat seemed surprisingly knowledgeable about military matters.
...
He had seen Mat climbing toward this tent, and never hesitated in sending Lan in to discover what might come to the surface in idle conversation alone.