How to lowercase Greek letter 'Σ' correctly as for example rust does?

I haven’t seen how the rule is specified in unicode papers but I know the rule from my mother language, the Greek language.
The rule is very simple.
There is one capital letter (‘Σ’) for these two small letters ‘σ’ and ‘ς’.
Upcasing is easy, it’s always ‘Σ’ for both small letters.
Downcasing of ‘Σ’ is always ‘σ’ unless ‘Σ’ is the last letter of an, at least 2 letters, word where it is converted to ‘ς’ which for this reason is called final sigma.
e.g.
“Σ” -> “σ”
“ΣΣ” -> “σς”
“ΣΑΣ ΜΑΣ ΜΑΣΑΣ” -> “σας μας μασας”
“ΣΑΣ. ΜΑΣ, ΜΑΣΑΣ.” -> “σας. μας, μασας.”