Skip to content

Commit

Permalink
Merge branch 'develop' into _update-deps/runtimeverification/hs-backe…
Browse files Browse the repository at this point in the history
…nd-booster
  • Loading branch information
goodlyrottenapple authored Jan 22, 2024
2 parents a792880 + 2743d63 commit aee2cb1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions k-distribution/include/kframework/builtin/domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -1881,11 +1881,15 @@ of the above operations in K.
requires findString(Source, ToReplace, 0) <Int 0
// Note that the replace function is undefined when Count < 0. This allows different backends to
// implement their own behavior without contradicting these semantics. For instance, a symbolic
// backend can return #Bottom for that case, while a concrete backend can throw an exception.
rule replace(Source:String, ToReplace:String, Replacement:String, Count:Int) =>
substrString(Source, 0, findString(Source, ToReplace, 0)) +String Replacement +String
replace(substrString(Source, findString(Source, ToReplace, 0) +Int lengthString(ToReplace), lengthString(Source)), ToReplace, Replacement, Count -Int 1)
requires Count >Int 0
rule replace(Source:String, _, _, 0) => Source
requires Count >Int 0 andBool findString(Source, ToReplace, 0) >=Int 0
rule replace(Source:String, _, _, Count) => Source
requires Count >=Int 0 [owise]
rule replaceAll(Source:String, ToReplace:String, Replacement:String) => replace(Source, ToReplace, Replacement, countAllOccurrences(Source, ToReplace))
endmodule
Expand Down

0 comments on commit aee2cb1

Please sign in to comment.