### higher-order application syntax

parent 9f30f6bc
 ... ... @@ -6,9 +6,9 @@ parameter r : int ref parameter f1 : y:int -> {} unit writes r { q1(!r, old(!r), y) } {} unit writes r { q1 (!r) (old (!r)) y } let g1 () = {} f1 !r { q1(!r, old(!r), old(!r)) } let g1 () = {} f1 !r { q1 (!r) (old (!r)) (old (!r)) } { logic foo(int) : int ... ... @@ -16,12 +16,12 @@ let g1 () = {} f1 !r { q1(!r, old(!r), old(!r)) } } parameter f : t:int ref -> x:int -> {} unit reads t writes t { q(!t, old(!t), x) } {} unit reads t writes t { q (!t) (old (!t)) x } let g (t:int ref) = {} f t (foo !t) { q(!t, old(!t), foo(old(!t))) } { q (!t) (old (!t)) (foo (old (!t))) } (* ... ...
 parameter x : int ref parameter f : unit -> { } unit writes x { !x = 1 - old(!x) } parameter f : unit -> { } unit writes x { !x = 1 - old (!x) } let p () = begin ... ... @@ -9,7 +9,7 @@ let p () = let t = () in (); (f ()); (f ()); assert { !x = at(!x, Init) }; assert { !x = at (!x) Init }; () end ... ...
 ... ... @@ -8,6 +8,6 @@ type t2 = t5 logic f(x : t1, y : t2) : t5 logic g(x : t1) : t5 = f(x,x) logic g(x : t1) : t5 = f x x end \ No newline at end of file end
 ... ... @@ -2,6 +2,6 @@ theory Test type t logic f(t,t) : t clone algebra.AC with type t = t, logic op = f goal G1 : forall x,y : t. f(x,y) = f(y,x) goal G2 : forall x,y,z : t. f(f(x,y),z) = f(x,f(y,z)) end \ No newline at end of file goal G1 : forall x,y : t. f x y = f y x goal G2 : forall x,y,z : t. f (f x y) z = f x (f y z) end
 theory Test use import int.EuclideanDivision goal G1 : mod(10,3) = 1 goal G2 : div(10,3) = 3 end \ No newline at end of file goal G1 : mod 10 3 = 1 goal G2 : div 10 3 = 3 end
 ... ... @@ -31,7 +31,7 @@ logic invariant(x:int, y:int, e:int) = e = 2 * (x + 1) * y2 - (2 * y + 1) * x2 and 2 * (y2 - x2) <= e <= 2 * y2 lemma Invariant_is_ok : forall x,y,e:int. invariant(x,y,e) -> best(x,y) lemma Invariant_is_ok : forall x,y,e:int. invariant x y e -> best x y } let bresenham () = ... ... @@ -39,10 +39,10 @@ let bresenham () = let y = ref 0 in let e = ref (2 * y2 - x2) in while !x <= x2 do invariant {0 <= !x and !x <= x2 + 1 and invariant(!x, !y, !e) } invariant {0 <= !x and !x <= x2 + 1 and invariant !x !y !e } variant { x2 + 1 - !x } (* here we would plot (x, y) *) assert { best(!x, !y) }; assert { best !x !y }; if !e < 0 then e := !e + 2 * y2 else begin ... ...