Hi,
I've got the attached simplified model, where:
1. The Server sends its cert(certS) to the Client
2. The Client verifies certS, then encrypts its own cert(certC) and a nonce(Nc) with the Server's public key (from certS)
3. The Server decrypts and verifies certC and Nc.
Plus a simple non-injective agreement lemma that doesn't terminate.
The issue comes because the certificates have no identifying elements to indicate whether they're from a client or server. This means that the M2 rule has a valid source of certS by extracting the certC from another run of the M2 rule. This builds a chain of M2 rules that continues indefinitely. As seen from the image here (from manually stepping through for a while)

I know the manual talks about fixing loops by having an inductively proven reuse lemma like:
lemma AlwaysStarts [use_induction, reuse]:
" All x #i. Loop(x) @i ==> Ex #j. Start(x) @j " // Effectively: If I'm looping on a value x, then at some point I started with x.
But I don't think I can apply this to my code because there is no "x", all the values in the loop change each iteration because it creates a whole new set of certificates.
I don't want to restrict the protocol to say that M2 can only source its certSs from M1, to limit it to only 1 or 2 Clients/Servers, or to add a field to the certificates to identify if they are for a 'Client' or 'Server', because it could then miss genuine attacks.
Ideally I'm thinking of some sort of concept that limits the size of that loop of M2s to only being one or two rules long.chain
Does anyone know of any way to stop Tamarin getting stuck in such loops? I feel like I'm just missing something obvious.
Thanks in advance,
Dan