(* Contribution to the Coq Library   V6.3 (July 1999)                    *)
Require Export List.
(* Definition of types *)
Parameter N : Set.
Inductive K : Set :=
| inv : K -> K
| ka : securite.N -> K
| ks : securite.N -> K.
Parameter D : Set.
Parameter Aid Bid : D.
Axiom
D_dec :
forall d1 d2 : D, {d1 = Aid /\ d2 = Bid} + {~ (d1 = Aid /\ d2 = Bid)}.
Inductive B : Set :=
| K2B : K -> B
| D2B : D -> B.
Inductive C : Set :=
| Encrypt : C -> K -> C
| Pair : C -> C -> C
| B2C : B -> C.
Notation SS := (list C) (only parsing).
(* <Warning> : Syntax is discontinued *)
(* known_in and not_comp_of predicates, equivS equivalence, setofkeys *)
Inductive known_in : C -> list C -> Prop :=
| E0 :
forall (c1 c2 : C) (s : list C), known_in c1 s -> known_in c1 (c2 :: s)
| EP0 :
forall (c : C) (s1 s2 : list C), known_in c s1 -> known_in c (s1 ++ s2)
| A1 :
forall (c1 c2 : C) (s : list C),
known_in c1 s -> known_in c2 s -> known_in (Pair c1 c2) s
| A2A :
forall (c1 c2 : C) (s : list C),
known_in (Pair c1 c2) s -> known_in c1 s
| A2B :
forall (c1 c2 : C) (s : list C),
known_in (Pair c1 c2) s -> known_in c2 s
| A3 :
forall (c1 : C) (k1 : K) (s : list C),
known_in c1 s ->
known_in (B2C (K2B k1)) s -> known_in (Encrypt c1 k1) s
| A4 :
forall (c1 : C) (k1 : K) (s : list C),
known_in (Encrypt c1 k1) s ->
known_in (B2C (K2B (inv k1))) s -> known_in c1 s.
Hint Resolve A1 A2A A2B A3 A4: otway_rees.
Inductive equivS : list C -> list C -> Prop :=
| equivS1a : equivS nil nil
| equivS1b :
forall (s1 s2 : list C) (c : C),
equivS s1 s2 -> equivS (c :: s1) (c :: s2)
| equivS2 :
forall (s : list C) (c1 c2 : C), equivS (c1 :: c2 :: s) (c2 :: c1 :: s)
| equivS4 :
forall s1 s2 s3 : list C, equivS s1 s2 -> equivS s2 s3 -> equivS s1 s3
| AlreadyIn1 : forall (c1 : C) (s : list C), In c1 s -> equivS s (c1 :: s)
| AlreadyIn1b : forall (c1 : C) (s : list C), In c1 s -> equivS (c1 :: s) s
| AlreadyIn :
forall (c1 : C) (s : list C), known_in c1 s -> equivS s (c1 :: s)
| AlreadyInb :
forall (c1 : C) (s : list C), known_in c1 s -> equivS (c1 :: s) s.
Hint Resolve equivS1a equivS1b equivS2 equivS4 AlreadyIn1 AlreadyIn1b
AlreadyIn AlreadyInb: otway_rees.

(* Specifications: *)
Lemma equivS3 : forall s1 s2 : list C, equivS s1 s2 -> equivS s2 s1.
Fixpoint setofkeys (s : list C) : Prop :=
match s with
| nil => True
| B2C (K2B _) :: s1 => setofkeys s1
| _ => False
end.