Pymatching implicitly supports non-deterministic observables, because it's only trying to predict whether the observable is flipped and this prediction does not care about whether or not the observable is deterministic.
Stim currently has no way to define a non-deterministic observable. The reason for this is because stim only supports stabilizer circuits, and in stabilizer circuits all measurements and parities of combinations of measurements are either completely deterministic or completely 50/50 random. So if you declare a non-deterministic observable, it would be impossible to check if it's working. The circuit wouldn't correspond to a useful experiment.
The main place where this is an issue isn't lattice surgery. It's non-clifford gates. For example, suppose you want to test a T-state injection into a surface code. One way to do this is by tomography, where you inject the state many times doing a variety of x and y and z basis measurements to figure out the process fidelity. Because you're injecting into a surface code, this involves error correction, but because it involves non-clifford gates, there are observables that aren't deterministic and aren't fully random either.
My plan for adding support for this use case is to eventually extend the observable include instruction to allow qubit Pauli terms. Like OBSERVABLE_INCLUDE(0) X0 X1
. The idea is that this would allow you to artificially pretend that an observable didn't pass through a non-Clifford operation, by removing specific terms and then adding them back in after the gate. The tricky bit is that this doesn't correspond to any physical operation, it's more of a " don't you worry about this gate I'll take care of this gate" sort of thing. I haven't added it yet because I'm pretty sure it would be really easy to use it wrong and get nonsense out.
I mentioned that lattice surgery still allows you to define experiments that check that it is working. Here's an example. An XX parity measurement should preserve the ZZ observable. You can turn that rule into an experiment checking that it does so. The circuit
R 0 1
MPP X0*X1
M 0 1
OBSERVABLE_INCLUDE(0) rec[-1] rec[-2]
is checking the ZZ preservation rule of the parity measurement. Change the individual qubits into surface code qubits and that's a valid thing that you could run on hardware checking that your surface code lattice surgery works. You can check all of the required rules in this way. You can't necessarily check all the rules with a single experiment... but the same is true of memory experiments. In order to know that memory works, you do separate experiments where you check that the Z observable and the X observable are preserved.