File: why_lib.why

package info (click to toggle)
frama-c 20100401%2Bboron%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 12,908 kB
  • ctags: 19,772
  • sloc: ml: 117,445; ansic: 10,764; makefile: 1,706; lisp: 176; sh: 27
file content (73 lines) | stat: -rw-r--r-- 3,025 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
(**************************************************************************)
(*                                                                        *)
(*  This file is part of Frama-C.                                         *)
(*                                                                        *)
(*  Copyright (C) 2007-2010                                               *)
(*    CEA   (Commissariat  l'nergie atomique et aux nergies            *)
(*           alternatives)                                                *)
(*    INRIA (Institut National de Recherche en Informatique et en         *)
(*           Automatique)                                                 *)
(*                                                                        *)
(*  you can redistribute it and/or modify it under the terms of the GNU   *)
(*  Lesser General Public License as published by the Free Software       *)
(*  Foundation, version 2.1.                                              *)
(*                                                                        *)
(*  It is distributed in the hope that it will be useful,                 *)
(*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *)
(*  GNU Lesser General Public License for more details.                   *)
(*                                                                        *)
(*  See the GNU Lesser General Public License version v2.1                *)
(*  for more details (enclosed in the file licenses/LGPLv2.1).            *)
(*                                                                        *)
(**************************************************************************)

(* Decidable Equality *)
type 'a equality

logic is_equal : 'a equality,'a,'a-> prop

axiom is_equal_dec : 
   forall eq:'a equality. forall a,a':'a. 
     is_equal(eq,a,a') or (not (is_equal(eq,a,a')))

axiom is_equal_sym: 
   forall eq:'a equality. forall a,a':'a. 
     is_equal(eq,a,a') -> is_equal(eq,a',a) 

axiom is_equal_trans : 
   forall eq:'a equality. forall a,b,c:'a. 
     is_equal(eq,a,b) -> 
     is_equal(eq,b,c) ->
     is_equal(eq,a,c)

axiom is_equal_not_trans: 
  forall eq:'a equality. forall a,b,c:'a. 
     is_equal(eq,a,b) -> 
     not (is_equal(eq,b,c)) ->
     not (is_equal(eq,a,c))


(* Map Definition *)

type ('a,'b) map

logic get: ('a,'b) map,'a -> 'b
logic set: ('a,'b) map,'a , 'b -> ('a,'b) map

axiom get_set_same : 
 forall m:('a,'b) map. forall a:'a. forall b:'b. 
   get(set(m,a,b),a) = b

axiom get_set_other : 
 forall m:('a,'b) map. forall a,a':'a. forall b:'b. 
   a<>a' -> get(set(m,a,b),a') = get(m,a') 

axiom get_set_eq : 
 forall m:('a,'b) map. forall eq:'a equality. forall a,a':'a. forall b:'b. 
   is_equal(eq,a,a')->get(set(m,a,b),a) = b

axiom get_set_neq : 
 forall m:('a,'b) map. forall eq:'a equality. forall a,a':'a. forall b:'b. 
    not (is_equal(eq,a,a')) -> get(set(m,a,b),a') = get(m,a')