Commit 96addbf6 authored by Guillaume Melquiond's avatar Guillaume Melquiond

Reduce amount of "use export" in the standard library.

parent 2015eda9
......@@ -2,6 +2,7 @@
module M
use import int.Int
use import ref.Refint
use import array.Array
......
......@@ -9,6 +9,7 @@
module Roberval
use export int.Int
use export ref.Refint
type outcome = Left | Equal | Right
......@@ -174,4 +175,4 @@ module Puzzle12
end
end
end
\ No newline at end of file
end
......@@ -6,7 +6,10 @@
theory Graph
use export list.List
use import list.Append
use export list.Length
use list.Mem
use export int.Int
use export set.Fset
......
......@@ -6,6 +6,7 @@
module CheckingALargeRoutine
use import int.Int
use import int.Fact
use import ref.Ref
......
......@@ -42,6 +42,7 @@
module Conjugate
use import int.Int
use import ref.Refint
use import array.Array
......@@ -137,4 +138,4 @@ end
B[i] = partc - 1;
}
}
*)
\ No newline at end of file
*)
......@@ -17,7 +17,7 @@
module Spec
use import int.Int
use export int.Int
use export array.Array
use export array.IntArraySorted
......
......@@ -3,11 +3,12 @@
module FactRecursive
use import int.Int
use import int.Fact
let rec fact_rec (x:int) : int
requires { x >= 0 }
variant { x }
let rec fact_rec (x:int) : int
requires { x >= 0 }
variant { x }
ensures { result = fact x }
= if x = 0 then 1 else x * fact_rec (x-1)
......@@ -20,6 +21,7 @@ end
module FactImperative
use import int.Int
use import int.Fact
use import ref.Ref
......
......@@ -240,6 +240,7 @@ end
module FibonacciLogarithmic
use import int.Int
use import int.Fibonacci
use import int.EuclideanDivision
use import Mat22
......
......@@ -7,6 +7,7 @@
module Max
use import int.Int
use import ref.Refint
use import array.Array
......
......@@ -7,6 +7,7 @@
module TwoEqualElements
use import int.Int
use import ref.Refint
use import array.Array
......
......@@ -129,6 +129,7 @@ module M
(** behavior *)
use import list.List
use import list.Append
use import list.Reverse
......@@ -298,6 +299,7 @@ module M2
(** behavior *)
use import list.List
use import list.Append
use import list.Reverse
......
......@@ -8,9 +8,10 @@
module RandomAccessList
use import int.Int
use import option.Option
use import list.List
use import list.Append
use import list.HdTl
use import list.Nth
type tree 'a =
| Leaf 'a
......
......@@ -8,6 +8,7 @@ module InsertionSort
clone relations.TotalPreOrder with type t = elt, predicate rel = le
clone export list.Sorted with type t = elt, predicate le = le
use import list.List
use import list.Permut
let rec insert (x: elt) (l: list elt) : list elt
......
......@@ -33,6 +33,7 @@ end
(* Naive solution, in O(N^3) *)
module Algo1
use import int.Int
use import ref.Refint
use import Spec
......@@ -70,6 +71,7 @@ end
module Algo2
use import int.Int
use import ref.Refint
use import Spec
......@@ -103,6 +105,7 @@ end
module Algo3
use import int.Int
use import ref.Refint
use import int.ComputerDivision
use import Spec
......@@ -172,6 +175,7 @@ end
module Algo4
use import int.Int
use import ref.Refint
use import Spec
......
......@@ -7,6 +7,7 @@
module Elt
use export int.Int
use export list.List
use export list.Length
use export list.Append
use export list.Permut
......
......@@ -6,6 +6,7 @@
module MergesortQueue
use import int.Int
use import list.List
use import list.Mem
use import list.Length
use import list.Append
......
......@@ -7,6 +7,7 @@
module Relabel
use import list.List
use import list.Mem
use import list.Append
use import list.Distinct
......
......@@ -241,6 +241,7 @@ module Balance
use import String
use import Rope as R
use import int.Int
use import int.Fibonacci
use import int.MinMax
use import array.Array
......
......@@ -92,6 +92,7 @@ end
module MoreHoareLogic
use import int.Int
use import option.Option
use import ref.Ref
use import list.List
use import list.HdTl
......
......@@ -56,6 +56,7 @@ end
module SkewHeaps
use import int.Int
use import bintree.Tree
use export bintree.Size
use export bintree.Occ
......
......@@ -3,6 +3,7 @@
module FindInSortedList
use import int.Int
use import list.List
use import list.Mem
use import list.SortedInt
......
......@@ -51,6 +51,7 @@ end
module Palindrome
use import int.Int
use import option.Option
use import list.List
use import list.Length
use import list.Append
......
......@@ -11,6 +11,7 @@
theory GilbreathCardTrickPure
use export int.Int
use import option.Option
use export list.List
use export list.Length
use export list.Append
......
......@@ -73,6 +73,8 @@ module Treedel
use import Memory
use import bintree.Tree
use import bintree.Inorder
use import list.List
use import list.Append
use import list.Distinct
(* there is a binary tree t rooted at p in memory m *)
......
......@@ -9,7 +9,8 @@
module AmortizedQueue
use import int.Int
use export list.ListRich
use import option.Option
use import list.ListRich
type queue 'a = { front: list 'a; lenf: int;
rear : list 'a; lenr: int; }
......
......@@ -9,9 +9,10 @@
module SearchingALinkedList
use import int.Int
use export list.List
use export list.Length
use export list.Nth
use import option.Option
use import list.List
use import list.Length
use import list.Nth
predicate zero_at (l: list int) (i: int) =
nth i l = Some 0 /\ forall j:int. 0 <= j < i -> nth j l <> Some 0
......
......@@ -10,6 +10,8 @@
module RingBuffer
use import int.Int
use import option.Option
use import list.List
use import list.NthLengthAppend as L
use import array.Array
......
......@@ -31,7 +31,7 @@ a few operations specific to integer references *)
module Refint
use export int.Int
use import int.Int
use export Ref
let incr (r: ref int) ensures { !r = old !r + 1 } = r := !r + 1
......
......@@ -9,8 +9,8 @@ end
theory Size "number of nodes"
use export Tree
use export int.Int
use import Tree
use import int.Int
function size (t: tree 'a) : int = match t with
| Empty -> 0
......@@ -25,8 +25,8 @@ end
theory Occ "occurrences in a binary tree"
use export Tree
use export int.Int
use import Tree
use import int.Int
function occ (x: 'a) (t: tree 'a) : int = match t with
| Empty -> 0
......@@ -43,8 +43,9 @@ end
theory Inorder "inorder traversal"
use export Tree
use export list.Append
use import Tree
use import list.List
use import list.Append
function inorder (t: tree 'a) : list 'a = match t with
| Empty -> Nil
......@@ -55,8 +56,9 @@ end
theory Preorder "preorder traversal"
use export Tree
use export list.Append
use import Tree
use import list.List
use import list.Append
function preorder (t: tree 'a) : list 'a = match t with
| Empty -> Nil
......@@ -67,8 +69,10 @@ end
theory InorderLength
use import Tree
use import Size
use import Inorder
use import list.List
use import list.Length
lemma inorder_length: forall t: tree 'a. length (inorder t) = size t
......@@ -77,7 +81,7 @@ end
theory Zipper "Huet's zipper"
use export Tree
use import Tree
type zipper 'a =
| Top
......
......@@ -3,8 +3,8 @@
theory Path
use export list.List
use export list.Append
use import list.List
use import list.Append
type vertex
......@@ -45,7 +45,9 @@ end
theory IntPathWeight
clone export Path
use export int.Int
use import int.Int
use import list.List
use import list.Append
function weight vertex vertex : int
......
......@@ -350,7 +350,7 @@ end
theory Fact
use export Int
use import Int
function fact int : int
......@@ -473,7 +473,7 @@ end
theory Fibonacci "Fibonacci numbers"
use export Int
use import Int
function fib int : int
......
......@@ -31,7 +31,7 @@ end
(** {2 Membership in a list} *)
theory Mem
use export List
use import List
predicate mem (x: 'a) (l: list 'a) = match l with
| Nil -> false
......@@ -61,8 +61,8 @@ end
theory Nth
use export List
use export option.Option
use import List
use import option.Option
use import int.Int
function nth (n: int) (l: list 'a) : option 'a = match l with
......@@ -74,7 +74,7 @@ end
theory NthNoOpt
use export List
use import List
use import int.Int
function nth (n: int) (l: list 'a) : 'a
......@@ -87,9 +87,11 @@ end
theory NthLength
use import int.Int
use import option.Option
use import List
use export Nth
use export Length
use import int.Int
lemma nth_none_1:
forall l: list 'a, i: int. i < 0 -> nth i l = None
......@@ -106,8 +108,8 @@ end
theory HdTl
use export List
use export option.Option
use import List
use import option.Option
function hd (l: list 'a) : option 'a = match l with
| Nil -> None
......@@ -123,7 +125,7 @@ end
theory HdTlNoOpt
use export List
use import List
function hd (l: list 'a) : 'a
......@@ -140,6 +142,8 @@ end
theory NthHdTl
use import int.Int
use import option.Option
use import List
use import Nth
use import HdTl
......@@ -155,7 +159,8 @@ end
(** {2 Appending two lists} *)
theory Append
use export List
use import List
function (++) (l1 l2: list 'a) : list 'a = match l1 with
| Nil -> l2
......@@ -189,9 +194,10 @@ end
theory NthLengthAppend
use import int.Int
use import List
use export NthLength
use export Append
use import int.Int
lemma nth_append_1:
forall l1 l2: list 'a, i: int.
......@@ -207,7 +213,7 @@ end
theory Reverse
use export List
use import List
use import Append
function reverse (l: list 'a) : list 'a = match l with
......@@ -278,7 +284,7 @@ end
theory Combine
use export List
use import List
function combine (x: list 'a) (y: list 'b) : list ('a, 'b) =
match x, y with
......@@ -292,7 +298,7 @@ end
theory Sorted
use export List
use import List
type t
predicate le t t
......@@ -474,7 +480,7 @@ end
theory Prefix
use export List
use import List
use import int.Int
function prefix (n: int) (l: list 'a) : list 'a =
......@@ -488,7 +494,7 @@ end
theory Sum
use export List
use import List
use import int.Int
function sum (l: list int) : int = match l with
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment