Notaries are defined to never accept double spends. If you built a notary that did, things would break. Notaries also cannot change states before signing (it would invalidate all other signatures). They aren’t meant to hold that kind of app specific logic. So, I’d forget about notaries. They aren’t designed to detect similar transactions.
Now, can we do what you want in other ways? Sure!
Consider that in an insurance use case, every claim is going to have a unique claim ID. That includes claims that are duplicates, until their duplicate-ness is detected. So the lifecycle of a claim is going to need to include something like “closing as a duplicate of claim C”. You could do this by putting logic like this in your contract code:
- If there are two input claims
- And a command that says this transaction is resolving duplicates
- And both input claims appear to be the same (or very similar) other than the claim ID
- Then there must be only one output claim, which is a copy of one of the input claims
This would let you delete a claim from the ledger, in a single transaction. The degree of similarity required can be encoded into the contract.
However, I would question whether even this is the right thing to do. Because the smart contract code is intended to govern shared logic. But surely if you’re an insurance company, only you can decide if two claims from your customers are duplicates, and it’s entirely your own concern - not something any other institution on the ledger would care about.
If the parties who are sharing the ledger in this case include end users then I’d understand, but right now Corda isn’t really designed for ordinary consumers to directly access the ledger. It could be done technically, but typically those users will expect someone to interact with the ledger for them (as getting access to the ledger involves downloading software, setting it up, getting an identity issued by the network operator etc).