3 Proof of Tarski fixed point theorem (existence of least fixed point)
4 for finite sets, using lemma functions.
6 Authors: Martin Clochard
14 clone export relations.PartialOrder with axiom .
19 axiom minimality: mem e a /\ forall x. mem x a -> rel e x
22 axiom range: forall x. mem x a -> mem (f x) a
23 axiom monotone: forall x y. mem x a -> mem y a -> rel x y -> rel (f x) (f y)
25 predicate fixpoint (x:t) = mem x a /\ f x = x
31 clone export Tarski with axiom .
33 let lemma least_fix_point () : unit
34 ensures {exists mu. fixpoint mu /\ forall x. fixpoint x -> rel mu x }
35 = let rec ghost aux (x: t) (b: fset t) : t
36 requires { mem x a /\ subset b a }
37 requires { forall y. mem y a -> rel x y -> mem y b }
38 requires { forall y. fixpoint y -> rel x y }
39 requires { rel x (f x) }
40 ensures { fixpoint result /\ forall x. fixpoint x -> rel result x }
41 variant { cardinal b }
42 = let y = f x in if x = y then x else aux y (remove x b)
43 in let _witness = aux e a in ()
48 clone export Tarski with axiom .
51 let lemma least_fix_point () : unit
52 ensures {exists mu. fixpoint mu /\ forall x. fixpoint x -> rel mu x }
57 invariant { mem !x a /\ subset !b a}
58 invariant { forall y. mem y a -> rel !x y -> mem y !b }
59 invariant { forall y. fixpoint y -> rel !x y }
60 invariant { rel !x (f !x) }
61 variant { cardinal !b }