Crdt.KCounter.valid: def of bend-kit-crdt@0.2.0.0 Import: import bend-kit-crdt@0.2.0.0/crdt.bend as Crdt Lines 325-331 of bend-kit-crdt@0.2.0.0/crdt.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-crdt@0.2.0.0/crdt.bend&start_line=325&end_line=331 import Base # A valid state has strictly ascending IDs and no 0 count, so each counter has one form. def KCounter.valid(~K: Data, ~cmp: K -> K -> Cmp, s: KCounter) -> Bool: match s: case KNil{}: True{} case KCon{+x, c, +r}: Bool.and(Bool.and(U32.is_ne(c, 0), KCounter.above(~K, ~cmp, r, x)), KCounter.valid(~K, ~cmp, r)) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Cmp https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_ne https://jend.leeeet.dev/definition.txt?path=bend-kit-crdt@0.2.0.0/crdt.bend&name=KCounter https://jend.leeeet.dev/definition.txt?path=bend-kit-crdt@0.2.0.0/crdt.bend&name=KCounter.above