Damerau Levenshtein Implementation in Kotlin
For determining correctness of your implementation I recommend referring to an existing implementation such as Apache commons-lang or the newer commons-text:


commons-lang:


StringUtils.java:7997-8254
StringUtilsTest.java:2378-2479

commons-text


LevenshteinDistance.java
LevenshteinDistanceTest.java
ParameterizedLevenshteinDistanceTest.java
LevenshteinDetailedDistance.java
LevenshteinDetailedDistanceTest.java
LevenshteinResults.java



As far as your Kotlin code goes, here are my comments:


Kotlin already guarantees that a and b are not null as you've used CharSequence for their type instead of CharSequence?. As such, the requireNotnull statements are unnecessary.
I do not believe you gain much from aLength and bLength. a.length and b.length read clearly and are read in constant time so the additional variables seem unnecessary to me.
You can place the last lambda argument in a function call into parentheses  as you have done but I personally find moving it out of the parentheses easier to read and more idiomatic:

val d = Array(a.length + 1, { IntArray(b.length + 1) })


becomes

val d = Array(a.length + 1) { IntArray(b.length + 1) }

In some languages variable names like maxdist are common and expected but in Kotlin (and Java) I find it more common and expected to have variables names avoid abbreviations, use camel casing, etc. I recommend using maxDistance instead of maxdist.
You are returning a Pair&lt;Int, Array&lt;IntArray&gt;&gt;. This is fine but data classes are so much better and Kotlin makes it so easy to define and use them. I recommend creating your own type to return. e.g.:

data class DamerauLevenshteinResult(val count: Int, val d: Array&lt;IntArray&gt;)