Commit ba8bd4b5 authored by Andrei Paskevich's avatar Andrei Paskevich

remove trailing whitespace, tabs, and latin1 characters

parent 37f06a22
...@@ -50,7 +50,9 @@ ...@@ -50,7 +50,9 @@
* choisir un logo * choisir un logo
=== Roadmap for third release ========================================== === Roadmap for third release 0.70 =======================================
* increment the magic number in config (A)
* enlever les caracteres de tab des sources * enlever les caracteres de tab des sources
et les caracteres latin1 (A) et les caracteres latin1 (A)
......
...@@ -2,7 +2,7 @@ module M ...@@ -2,7 +2,7 @@ module M
use import module ref.Ref use import module ref.Ref
let foo (x : ref int) (y : ref int) = let foo (x : ref int) (y : ref int) =
x := 1; x := 1;
y := 2 y := 2
......
...@@ -2,7 +2,7 @@ module M ...@@ -2,7 +2,7 @@ module M
use import module ref.Ref use import module ref.Ref
let foo (x : ref int) (y : ref int) = let foo (x : ref int) (y : ref int) =
x := 1; x := 1;
y := 2 y := 2
......
...@@ -2,7 +2,7 @@ module M ...@@ -2,7 +2,7 @@ module M
use import module ref.Ref use import module ref.Ref
let foo (x : ref int) (y : ref int) = let foo (x : ref int) (y : ref int) =
x := 1; x := 1;
y := 2 y := 2
......
module M module M
use import module stdlib.Ref use import module stdlib.Ref
use import list.List use import list.List
val r : ref (list 'a) val r : ref (list 'a)
end end
...@@ -6,7 +6,7 @@ module M ...@@ -6,7 +6,7 @@ module M
(* missing variant *) (* missing variant *)
let rec even (x:int) : int variant {x} = let rec even (x:int) : int variant {x} =
odd (x-1) odd (x-1)
with odd (x:int) : int = with odd (x:int) : int =
even (x-1) even (x-1)
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
(* different relations *) (* different relations *)
module M module M
use import int.Int use import int.Int
predicate rel int int predicate rel int int
let rec even (x:int) : int variant {x} with rel = let rec even (x:int) : int variant {x} with rel =
odd (x-1) odd (x-1)
with odd (x:int) : int variant {x} = with odd (x:int) : int variant {x} =
even (x-1) even (x-1)
......
...@@ -21,7 +21,7 @@ let f () = ...@@ -21,7 +21,7 @@ let f () =
end end
(* (*
Local Variables: Local Variables:
compile-command: "unset LANG; make -C ../../.. bench/programs/good/complex_arg_1" compile-command: "unset LANG; make -C ../../.. bench/programs/good/complex_arg_1"
End: End:
*) *)
...@@ -19,7 +19,7 @@ let test () = ...@@ -19,7 +19,7 @@ let test () =
end end
(* (*
Local Variables: Local Variables:
compile-command: "unset LANG; make -C ../../.. bench/programs/good/complex_arg_2" compile-command: "unset LANG; make -C ../../.. bench/programs/good/complex_arg_2"
End: End:
*) *)
...@@ -85,7 +85,7 @@ let test4d x = ...@@ -85,7 +85,7 @@ let test4d x =
end end
(* (*
Local Variables: Local Variables:
compile-command: "unset LANG; make -C ../../.. bench/programs/good/for" compile-command: "unset LANG; make -C ../../.. bench/programs/good/for"
End: End:
*) *)
...@@ -20,14 +20,14 @@ module M ...@@ -20,14 +20,14 @@ module M
let i = ref 2 in let i = ref 2 in
while !i <= 10 do while !i <= 10 do
invariant { 2 <= !i <= 11 /\ inv a /\ invariant { 2 <= !i <= 11 /\ inv a /\
(* ghost *) !loop1 = !i - 2 /\ 2 * !loop2 <= (!i-2) * (!i-1) } (* ghost *) !loop1 = !i - 2 /\ 2 * !loop2 <= (!i-2) * (!i-1) }
variant { 10 - !i } variant { 10 - !i }
(* ghost *) incr loop1; (* ghost *) incr loop1;
let j = ref !i in let j = ref !i in
while a[!j] < a[!j - 1] do while a[!j] < a[!j - 1] do
invariant { 1 <= !j <= !i /\ inv a /\ invariant { 1 <= !j <= !i /\ inv a /\
(* ghost *) 2 * !loop2 <= (!i-2) * (!i-1) + 2*(!i - !j) } (* ghost *) 2 * !loop2 <= (!i-2) * (!i-1) + 2*(!i - !j) }
variant { !j } variant { !j }
(* ghost *) incr loop2; (* ghost *) incr loop2;
let temp = a[!j] in let temp = a[!j] in
a[!j] <- a[!j - 1]; a[!j] <- a[!j - 1];
......
...@@ -21,7 +21,7 @@ module M ...@@ -21,7 +21,7 @@ module M
let u = ref (length a - 1) in let u = ref (length a - 1) in
while !l <= !u do while !l <= !u do
invariant { invariant {
0 <= !l /\ !u < length a /\ 0 <= !l /\ !u < length a /\
forall i : int. 0 <= i < length a -> a[i] = v -> !l <= i <= !u } forall i : int. 0 <= i < length a -> a[i] = v -> !l <= i <= !u }
variant { !u - !l } variant { !u - !l }
let m = !l + div (!u - !l) 2 in let m = !l + div (!u - !l) 2 in
......
...@@ -40,7 +40,7 @@ module M1 ...@@ -40,7 +40,7 @@ module M1
while !l <= !u do while !l <= !u do
invariant { 0 <= !l /\ !u <= n-1 /\ invariant { 0 <= !l /\ !u <= n-1 /\
forall k:int. 0 <= k < n -> get !mem t k = v -> !l <= k <= !u } forall k:int. 0 <= k < n -> get !mem t k = v -> !l <= k <= !u }
variant { !u - !l } variant { !u - !l }
let m = div (!l + !u) 2 in let m = div (!l + !u) 2 in
if get !mem t m < v then l := m + 1 if get !mem t m < v then l := m + 1
else if get !mem t m > v then u := m - 1 else if get !mem t m > v then u := m - 1
...@@ -94,7 +94,7 @@ module M2 ...@@ -94,7 +94,7 @@ module M2
while !l <= !u do while !l <= !u do
invariant { 0 <= !l /\ !u <= n-1 /\ invariant { 0 <= !l /\ !u <= n-1 /\
forall k:int. 0 <= k < n -> get !mem t k = v -> !l <= k <= !u } forall k:int. 0 <= k < n -> get !mem t k = v -> !l <= k <= !u }
variant { !u - !l } variant { !u - !l }
let m = div (!l + !u) 2 in let m = div (!l + !u) 2 in
if get_ t m < v then l := m + 1 if get_ t m < v then l := m + 1
else if get_ t m > v then u := m - 1 else if get_ t m > v then u := m - 1
...@@ -152,7 +152,7 @@ module M3 ...@@ -152,7 +152,7 @@ module M3
invariant { 0 <= to_int !l /\ to_int !u <= to_int n - 1 /\ invariant { 0 <= to_int !l /\ to_int !u <= to_int n - 1 /\
forall k:int. 0 <= k < to_int n -> forall k:int. 0 <= k < to_int n ->
to_int (get !mem t k) = to_int v -> to_int !l <= k <= to_int !u } to_int (get !mem t k) = to_int v -> to_int !l <= k <= to_int !u }
variant { to_int !u - to_int !l } variant { to_int !u - to_int !l }
let m = of_int (to_int !l let m = of_int (to_int !l
+ +
to_int to_int
......
...@@ -106,7 +106,7 @@ end ...@@ -106,7 +106,7 @@ end
predicate invCourse (alloc:first_free_addr) (this:course) = predicate invCourse (alloc:first_free_addr) (this:course) =
let (rStud,students,count,sum) = this in let (rStud,students,count,sum) = this in
count >= 0 count >= 0
/\ /\
valid_array alloc 0 (count - 1) students valid_array alloc 0 (count - 1) students
/\ /\
injective 0 (count - 1) students injective 0 (count - 1) students
...@@ -182,7 +182,7 @@ fun SetMark(R:Course, c:[R], s: [c.Rstud], mark: int) : unit ...@@ -182,7 +182,7 @@ fun SetMark(R:Course, c:[R], s: [c.Rstud], mark: int) : unit
end end
(* (*
Local Variables: Local Variables:
compile-command: "unset LANG; make -C ../.. examples/programs/course" compile-command: "unset LANG; make -C ../.. examples/programs/course"
End: End:
*) *)
...@@ -101,9 +101,9 @@ module M ...@@ -101,9 +101,9 @@ module M
(* paths and shortest paths (* paths and shortest paths
path x y d = path x y d =
there is a path from x to y of length d there is a path from x to y of length d
shortest_path x y d = shortest_path x y d =
there is a path from x to y of length d, and no shorter path *) there is a path from x to y of length d, and no shorter path *)
inductive path vertex vertex int = inductive path vertex vertex int =
| Path_nil : | Path_nil :
...@@ -195,8 +195,8 @@ module M ...@@ -195,8 +195,8 @@ module M
let su = ref (g_succ u) in let su = ref (g_succ u) in
while not (set_has_next su) do while not (set_has_next su) do
invariant invariant
{ S.subset !su (g_succ u) /\ { S.subset !su (g_succ u) /\
inv src !visited !q !d /\ inv_succ2 src !visited !q u !su } inv src !visited !q !d /\ inv_succ2 src !visited !q u !su }
variant { S.cardinal !su } variant { S.cardinal !su }
let v = set_next su in let v = set_next su in
relax u v relax u v
......
(* Correctness of a program computing the minimal distance between (* Correctness of a program computing the minimal distance between
two words (code by Claude Marché). two words (code by Claude Marché).
This program computes a variant of the Levenshtein distance. Given This program computes a variant of the Levenshtein distance. Given
two strings [w1] and [w2] of respective lengths [n1] and [n2], it two strings [w1] and [w2] of respective lengths [n1] and [n2], it
...@@ -98,12 +98,12 @@ module Distance ...@@ -98,12 +98,12 @@ module Distance
/\ (forall k:int. 0 <= k <= j -> min_suffix w1 w2 (i+1) k t[k]) /\ (forall k:int. 0 <= k <= j -> min_suffix w1 w2 (i+1) k t[k])
/\ min_suffix w1 w2 (i+1) (j+1) !o } /\ min_suffix w1 w2 (i+1) (j+1) !o }
begin begin
let temp = !o in let temp = !o in
o := t[j]; o := t[j];
if w1[i] = w2[j] then if w1[i] = w2[j] then
t[j] <- temp t[j] <- temp
else else
t[j] <- (min t[j] t[j+1]) + 1 t[j] <- (min t[j] t[j+1]) + 1
end end
done done
done; done;
......
...@@ -80,7 +80,7 @@ rewrite <- (Z_div_exact_full_2 n 3). ...@@ -80,7 +80,7 @@ rewrite <- (Z_div_exact_full_2 n 3).
assert (h: (n mod 5 = 0 \/ n mod 5 <> 0)%Z) by omega. assert (h: (n mod 5 = 0 \/ n mod 5 <> 0)%Z) by omega.
destruct h. destruct h.
rewrite Zdiv0. rewrite Zdiv0.
Qed. Qed.
(* DO NOT EDIT BELOW *) (* DO NOT EDIT BELOW *)
......
...@@ -43,7 +43,7 @@ theory FibSumEven "sum of even-valued Fibonacci numbers" ...@@ -43,7 +43,7 @@ theory FibSumEven "sum of even-valued Fibonacci numbers"
axiom SumTooLarge: forall m n:int. axiom SumTooLarge: forall m n:int.
n >= 0 -> (fib n) >= m -> fib_sum_even_lt_from m n = 0 n >= 0 -> (fib n) >= m -> fib_sum_even_lt_from m n = 0
(* Note: we take for granted that [fib] is an (* Note: we take for granted that [fib] is an
increasing sequence *) increasing sequence *)
axiom SumYes: forall n m s:int. axiom SumYes: forall n m s:int.
n >= 0 -> (fib n) < m -> mod (fib n) 2 = 0 -> n >= 0 -> (fib n) < m -> mod (fib n) 2 = 0 ->
......
...@@ -59,14 +59,14 @@ rewrite fibn; auto with zarith. ...@@ -59,14 +59,14 @@ rewrite fibn; auto with zarith.
rewrite Zplus_mod. rewrite Zplus_mod.
assert (h: (0 <= (n mod 3) < 3)%Z). assert (h: (0 <= (n mod 3) < 3)%Z).
apply Z_mod_lt; auto with zarith. apply Z_mod_lt; auto with zarith.
assert (h':( n mod 3 = 0 \/ n mod 3 = 1 \/ n mod 3 = 2)%Z) assert (h':( n mod 3 = 0 \/ n mod 3 = 1 \/ n mod 3 = 2)%Z)
by omega. by omega.
clear h. clear h.
destruct h' as [h0|[h1|h2]]. destruct h' as [h0|[h1|h2]].
split; auto with zarith. split; auto with zarith.
SearchAbout Zmod. SearchAbout Zmod.
assert assert
Qed. Qed.
(* DO NOT EDIT BELOW *) (* DO NOT EDIT BELOW *)
......
...@@ -29,11 +29,11 @@ module Flag ...@@ -29,11 +29,11 @@ module Flag
label Init: label Init:
while !i < !r do while !i < !r do
invariant { 0 <= !b <= !i <= !r <= n /\ invariant { 0 <= !b <= !i <= !r <= n /\
monochrome a 0 !b Blue /\ monochrome a 0 !b Blue /\
monochrome a !b !i White /\ monochrome a !b !i White /\
monochrome a !r n Red /\ monochrome a !r n Red /\
length a = n /\ length a = n /\
permut_sub a (at a Init) 0 n } permut_sub a (at a Init) 0 n }
variant { !r - !i } variant { !r - !i }
match a[!i] with match a[!i] with
| Blue -> | Blue ->
......
...@@ -82,10 +82,10 @@ Parameter atan: R -> R. ...@@ -82,10 +82,10 @@ Parameter atan: R -> R.
Axiom Tan_atan : forall (x:R), ((Rtrigo.tan (atan x)) = x). Axiom Tan_atan : forall (x:R), ((Rtrigo.tan (atan x)) = x).
Inductive mode := Inductive mode :=
| NearestTiesToEven : mode | NearestTiesToEven : mode
| ToZero : mode | ToZero : mode
| Up : mode | Up : mode
| Down : mode | Down : mode
| NearTiesToAway : mode . | NearTiesToAway : mode .
Parameter single : Type. Parameter single : Type.
......
...@@ -37,7 +37,7 @@ module M ...@@ -37,7 +37,7 @@ module M
interpretation on the left (or on the right); requires induction *) interpretation on the left (or on the right); requires induction *)
lemma Interp_eq: lemma Interp_eq:
forall x1 x2 : M.map int int, i j : int. forall x1 x2 : M.map int int, i j : int.
(forall k : int. i <= k < j -> M.get x1 k = M.get x2 k) -> (forall k : int. i <= k < j -> M.get x1 k = M.get x2 k) ->
interp x1 i j = interp x2 i j interp x1 i j = interp x2 i j
(* the sum of the elements of x[i..j[ *) (* the sum of the elements of x[i..j[ *)
...@@ -93,11 +93,11 @@ let search_safety () = ...@@ -93,11 +93,11 @@ let search_safety () =
let delta = y - !s - c + x[d] in let delta = y - !s - c + x[d] in
if 0 <= delta && delta <= 9 * d then begin if 0 <= delta && delta <= 9 * d then begin
x[d] <- c; x[d] <- c;
let k = div delta 9 in let k = div delta 9 in
for i = 0 to d - 1 do for i = 0 to d - 1 do
invariant { length x = m } invariant { length x = m }
if i < k then x[i] <- 9 if i < k then x[i] <- 9
else if i = k then x[i] <- mod delta 9 else if i = k then x[i] <- mod delta 9
else x[i] <- 0 else x[i] <- 0
done; done;
raise Success raise Success
...@@ -134,14 +134,14 @@ let search () = ...@@ -134,14 +134,14 @@ let search () =
if 0 <= delta && delta <= 9 * d then begin if 0 <= delta && delta <= 9 * d then begin
x[d] <- c; x[d] <- c;
assert { sum x.elts d m = y - delta }; assert { sum x.elts d m = y - delta };
let k = div delta 9 in let k = div delta 9 in
assert { k <= d }; assert { k <= d };
for i = 0 to d - 1 do for i = 0 to d - 1 do
invariant { length x = m /\ is_integer x.elts /\ invariant { length x = m /\ is_integer x.elts /\
sum x.elts d m = y - delta /\ sum x.elts d m = y - delta /\
sum x.elts 0 i = if i <= k then 9*i else delta } sum x.elts 0 i = if i <= k then 9*i else delta }
if i < k then x[i] <- 9 if i < k then x[i] <- 9
else if i = k then x[i] <- (mod delta 9) else if i = k then x[i] <- (mod delta 9)
else x[i] <- 0 else x[i] <- 0
done; done;
(* assume { sum !x 0 d = delta }; *) (* assume { sum !x 0 d = delta }; *)
...@@ -257,21 +257,21 @@ let search_smallest () = ...@@ -257,21 +257,21 @@ let search_smallest () =
for c = x[d] + 1 to 9 do for c = x[d] + 1 to 9 do
invariant { invariant {
x = at x Init /\ x = at x Init /\
forall c' : int. x[d] < c' < c -> forall c' : int. x[d] < c' < c ->
forall u : int. forall u : int.
interp (at x.elts Init) 0 m < u <= interp9 (M.set x.elts d c') d m -> interp (at x.elts Init) 0 m < u <= interp9 (M.set x.elts d c') d m ->
sum_digits u <> y } sum_digits u <> y }
let delta = y - !s - c + x[d] in let delta = y - !s - c + x[d] in
if 0 <= delta && delta <= 9 * d then begin if 0 <= delta && delta <= 9 * d then begin
assert { smallest_size delta <= d }; assert { smallest_size delta <= d };
x[d] <- c; x[d] <- c;
assert { sum x.elts d m = y - delta }; assert { sum x.elts d m = y - delta };
assert { gt_digit x.elts (at x.elts Init) d }; assert { gt_digit x.elts (at x.elts Init) d };
let k = div delta 9 in let k = div delta 9 in
assert { k <= d }; assert { k <= d };
for i = 0 to d - 1 do for i = 0 to d - 1 do
invariant { invariant {
length x = m /\ is_integer x.elts /\ length x = m /\ is_integer x.elts /\
sum x.elts d m = y - delta /\ sum x.elts d m = y - delta /\
sum x.elts 0 i = (if i <= k then 9*i else delta) /\ sum x.elts 0 i = (if i <= k then 9*i else delta) /\
(forall j : int. 0 <= j < i -> (forall j : int. 0 <= j < i ->
...@@ -279,7 +279,7 @@ let search_smallest () = ...@@ -279,7 +279,7 @@ let search_smallest () =
(j >= smallest_size delta -> x[j] = 0)) /\ (j >= smallest_size delta -> x[j] = 0)) /\
gt_digit x.elts (at x.elts Init) d } gt_digit x.elts (at x.elts Init) d }
if i < k then x[i] <- 9 if i < k then x[i] <- 9
else if i = k then x[i] <- mod delta 9 else if i = k then x[i] <- mod delta 9
else x[i] <- 0; else x[i] <- 0;
assert { is_integer x.elts } assert { is_integer x.elts }
done; done;
...@@ -327,14 +327,14 @@ let () = ...@@ -327,14 +327,14 @@ let () =
for c = x.(d) + 1 to 9 do for c = x.(d) + 1 to 9 do
let delta = y - !s - c + x.(d) in let delta = y - !s - c + x.(d) in
if 0 <= delta && delta <= 9 * d then begin if 0 <= delta && delta <= 9 * d then begin
x.(d) <- c; x.(d) <- c;
let k = delta / 9 in let k = delta / 9 in
for i = 0 to d-1 do for i = 0 to d-1 do
x.(i) <- if i < k then 9 else if i = k then delta mod 9 else 0 x.(i) <- if i < k then 9 else if i = k then delta mod 9 else 0
done; done;
for i = max d (n-1) downto 0 do Format.printf "%d" x.(i) done; for i = max d (n-1) downto 0 do Format.printf "%d" x.(i) done;
Format.printf "@."; Format.printf "@.";
exit 0 exit 0
end end
done; done;
s := !s - x.(d) s := !s - x.(d)
......
...@@ -28,7 +28,7 @@ module Quicksort ...@@ -28,7 +28,7 @@ module Quicksort
let m = ref l in let m = ref l in
label L: begin label L: begin
for i = l + 1 to r do for i = l + 1 to r do
invariant { (forall j:int. l < j <= !m -> t[j] < v) /\ invariant { (forall j:int. l < j <= !m -> t[j] < v) /\
(forall j:int. !m < j < i -> t[j] >= v) /\ (forall j:int. !m < j < i -> t[j] >= v) /\
permut_sub t (at t L) l (r+1) /\ permut_sub t (at t L) l (r+1) /\
t[l] = v /\ l <= !m < i } t[l] = v /\ l <= !m < i }
......
...@@ -18,7 +18,7 @@ module M ...@@ -18,7 +18,7 @@ module M
| App rope rope (len: int) | App rope rope (len: int)
predicate inv (r: rope) = match r with predicate inv (r: rope) = match r with
| Str s ofs len -> | Str s ofs len ->
len = 0 \/ 0 <= ofs < S.length s /\ ofs + len <= S.length s len = 0 \/ 0 <= ofs < S.length s /\ ofs + len <= S.length s
| App l r _ -> | App l r _ ->
0 < len l /\ inv l /\ 0 < len r /\ inv r 0 < len l /\ inv l /\ 0 < len r /\ inv r
...@@ -33,33 +33,33 @@ module M ...@@ -33,33 +33,33 @@ module M
S.length s1 = S.length s2 /\ S.length s1 = S.length s2 /\
forall i:int. 0 <= i < S.length s1 -> S.get s1 i = S.get s2 i forall i:int. 0 <= i < S.length s1 -> S.get s1 i = S.get s2 i
let empty () = let empty () =
{} {}
Str (S.create 0) 0 0 Str (S.create 0) 0 0
{ len result = 0 /\ inv result /\ eq (model result) (S.create 0) } { len result = 0 /\ inv result /\ eq (model result) (S.create 0) }
let length r = let length r =
{} {}
len r len r
{ result = len r } { result = len r }
(** (**
let rec get (r: rope) i = let rec get (r: rope) i =
{ inv r /\ 0 <= i < len r } { inv r /\ 0 <= i < len r }
match r with match r with
| Str s ofs len -> | Str s ofs len ->
S.get s (ofs + i) S.get s (ofs + i)
| App l r _ -> | App l r _ ->
let n = length l in let n = length l in
if i < n then get l i else get r (i - n) if i < n then get l i else get r (i - n)
end end
{ result = S.get (model r) i } { result = S.get (model r) i }
**) **)
end