1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include <civlc.cvh>
|
|---|
| 2 | #include <assert.h>
|
|---|
| 3 |
|
|---|
| 4 | $input int n=3;
|
|---|
| 5 | $input int x;
|
|---|
| 6 | $input int y;
|
|---|
| 7 | $input int X1[n];
|
|---|
| 8 |
|
|---|
| 9 | $assume (x < n && y < n && x >=0 && y>=0);
|
|---|
| 10 |
|
|---|
| 11 | int lcp(int *arr, int n, int x, int y){
|
|---|
| 12 | int l=0;
|
|---|
| 13 | while (x+l<n && y+l<n && arr[x+l]==arr[y+l]) {
|
|---|
| 14 | l++;
|
|---|
| 15 | }
|
|---|
| 16 | return l;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | void main(){
|
|---|
| 20 | int result = lcp(X1, n, x, y);
|
|---|
| 21 | assert($forall {int i | i>=0 && i<result} X1[x+i] == X1[y+i]);
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.