(* 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.
Fixpoint setofkeys (s : list C) : Prop :=
match s with
| nil => True
| B2C (K2B _) :: s1 => setofkeys s1
| _ => False
end.
Inductive not_comp_of : C -> list C -> Prop :=
| C1 :
forall (c1 c2 : C) (k : K) (s : list C),
not_comp_of (B2C (K2B k)) s ->
c1 <> Encrypt c2 k -> not_comp_of c1 (Encrypt c2 k :: s)
| C2 :
forall (c1 c2 : C) (k : K) (s : list C),
not_comp_of c1 (c2 :: s) ->
c1 <> Encrypt c2 k -> not_comp_of c1 (Encrypt c2 k :: s)
| C3 :
forall (c1 : C) (d : D) (s : list C),
not_comp_of c1 s ->
c1 <> B2C (D2B d) -> not_comp_of c1 (B2C (D2B d) :: s)
| C4 :
forall (c1 c2 c3 : C) (s : list C),
not_comp_of c1 (c2 :: c3 :: s) ->
c1 <> Pair c2 c3 -> not_comp_of c1 (Pair c2 c3 :: s)
| C5 : forall c1 : C, not_comp_of c1 nil
| C7 :
forall (k : K) (s : list C),
~ In (B2C (K2B k)) s -> setofkeys s -> not_comp_of (B2C (K2B k)) s
| D1 : forall (c1 : C) (s : list C), ~ known_in c1 s -> not_comp_of c1 s
| UnionSnE1 :
forall (c : C) (s1 s2 : list C),
not_comp_of c (s1 ++ s2) -> not_comp_of c s1.
Axiom
D2 :
forall (b : B) (s : list C),
not_comp_of (B2C b) s -> ~ known_in (B2C b) s.
Axiom
E1 :
forall (c1 c2 : C) (s : list C),
~ known_in c1 (c2 :: s) -> ~ known_in c1 s.
Axiom
EP1 :
forall (c : C) (s1 s2 : list C),
~ known_in c (s1 ++ s2) -> ~ known_in c s1.
Hint Resolve C1 C2 C3 C4 C5 C7 D1 UnionSnE1 D2 E1 EP1: otway_rees.
Axiom
equivknown :
forall (c : C) (s1 s2 : list C),
equivS s1 s2 -> known_in c s1 -> known_in c s2.
Axiom
equivncomp :
forall (c : C) (s1 s2 : list C),
equivS s1 s2 -> not_comp_of c s1 -> not_comp_of c s2.
(* Keys *)
Parameter KeyAB : D -> D -> K.
Parameter KeyX : D -> K.
Parameter rngDDKKeyAB : list C.
Parameter rngDDKKeyABminusKab : list C.
Notation Kab := (KeyAB Aid Bid) (only parsing).
(* <Warning> : Syntax is discontinued *)
Notation Kas := (KeyX Aid) (only parsing).
(* <Warning> : Syntax is discontinued *)
Notation Kbs := (KeyX Bid) (only parsing).
(* <Warning> : Syntax is discontinued *)

Axiom disjKasKeyAB : forall d1 d2 : D, KeyAB d1 d2 <> KeyX Aid.