I TA'd for a Prolog course at my university (Imperial College London) during the four years of my PhD there. As part of that work I helped correct students' papers. It was pretty clear to me that the students were sharing their code and only changing variable names etc. to make it look different.

It didn't work, because you could see the same, let's say, idiosyncracies, in their code. For example, there might be three or four different ways to solve a coding exercise and about 60-75% of the papers would solve it using the same way, which was not necessarily the best, or even the most obvious, way (what is the most obvious way to solve a Prolog exercise might not be common sense, but that's why you are given a lecture, first, and then the exercise).

What's most interesting is that I saw the same patterns repeated over the three years I TA'd for one of the Prolog courses. I guess they shared the answers between years, or somebody had put them online (I searched but couldn't find them). Or they just copied solutions to similar exercises they found online.

I didn't report the cheating because I felt there was no benefit in doing so. In particular with Prolog, because it's not a language commonly used in the industry, and it's taught at Imperial mainly for historical reasons (there are many of us logicists studying, or teaching, there) I reckoned that most students found it a useless chore and did not understand why they needed to learn it, and why they needed to "waste" time solving those coding problems. So they copied from each other in order to get the job done quickly and then have more time to spend on the things they felt were more useful to them (like learning Python or "ML" I suppose).

I personally thought, and still think, that learning to program in Prolog is useful, just to disentangle a programmer's mind from the particularities of the coding paradigms, and the programming languages, she's most familiar with. At CS schools today, programming is introduced with Python and I guess it's easy to get into a mindframe that all programming languages must necessarily work like Python. Studying languages from different paradigms, like Prolog or Haskell, can shake you off that mentality (it sure did me, back when I did my CS degree).

The problems is that you can't really force this appreciation of the need to learn different things on students, who are often in a terrible hurry and under terrible pressure to do good on their course, so they can get on with life. The Prolog course I TA'd was mandatory and so it must have really felt like someone was trying to force the knowledge down the studnets' throats.

I don't think that's a good idea. You can't teach people that way. They'll just see your obvious effort to force them to learn what you want, and they'll simply take the obvious route around it. And that ends up teaching them a lesson that you really weren't expecting to teach: the world is full of idiots who think they can teach you things, but you know better than they do and you'll show them who's boss.

That's what students do with tests, also. They can see they're a useless waste of time and they can see the obvious way around them is to cheat, and that it's to their benefit to cheat. And so they cheat. I don't have solutions to this. The students shouldn't have to fight the school, and the school shouldn't have to fight the students. The school is there for the students' benefit after all.