(* * Copyright (c) 2009-2011, Andrew Appel, Robert Dockins and Aquinas Hobor. * *)
(* This file specializes knot to have T = Prop *)
Local Open Scope nat_scope.
(* We get these from knot_hered and knot_hered_sa.  Module Type TY_FUNCTOR_PROP. Parameter F : Type -> Type. Parameter f_F : functor F. EXisting Instance f_F.  Parameter other : Type. End TY_FUNCTOR_PROP.  Module Type TY_FUNCTOR_SA_PROP. Declare Module TF:TY_FUNCTOR_PROP. Import TF.  Parameter saf_F : safunctor f_F. EXisting Instance saf_F. End TY_FUNCTOR_SA_PROP. *)
Module Type KNOT_PROP.
Declare Module TF:TY_FUNCTOR_PROP.
Parameter knot : Type.
Parameter ag_knot : ageable knot.
Existing Instance ag_knot.
Existing Instance ag_prod.
Definition predicate := (knot * other) -> Prop.
Parameter squash : (nat * F predicate) -> knot.
Parameter unsquash : knot -> (nat * F predicate).
Definition approx (n:nat) (p:predicate) : predicate :=
fun w => level w < n /\ p w.

(* Specifications: *)
Axiom squash_unsquash : forall x, squash (unsquash x) = x.
Axiom unsquash_squash : forall n x', unsquash (squash (n,x')) = (n, fmap F (approx n) x').
Axiom knot_level : forall k:knot,
level k = fst (unsquash k).
Axiom knot_age1 : forall k:knot,
age1 k =
match unsquash k with
| (O,_) => None
| (S n,x) => Some (squash (n,x))
end.