Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
f4b22c4d
Commit
f4b22c4d
authored
Feb 07, 2012
by
Jean-Christophe Filliâtre
Browse files
a little theory of set comprehension
parent
493e3afc
Changes
1
Hide whitespace changes
Inline
Side-by-side
theories/set.why
View file @
f4b22c4d
...
...
@@ -68,6 +68,37 @@ theory Set
lemma subset_diff:
forall s1 s2: set 'a. subset (diff s1 s2) s1
(* the set of all x of type 'a *)
constant all: set 'a
axiom all_def: forall x: 'a. mem x all
end
theory SetComprehension
use export Set
use HighOrd as HO
(* { x | p x } *)
function comprehension (p: HO.pred 'a) : set 'a
axiom comprehension_def:
forall p: HO.pred 'a.
forall x: 'a. mem x (comprehension p) <-> p x
(* { x | x in U and p(x) *)
function filter (p: HO.pred 'a) (u: set 'a) : set 'a =
comprehension (\ x: 'a. p x /\ mem x u)
(* { f x | x in U } *)
function map (f: HO.func 'a 'b) (u: set 'a) : set 'b =
comprehension (\ y: 'b. exists x: 'a. mem x u /\ y = f x)
lemma map_def:
forall f: HO.func 'a 'b, u: set 'a.
forall x: 'a. mem x u -> mem (f x) (map f u)
end
(* finite sets *)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment