This commit is contained in:
@@ -1,17 +1,4 @@
|
|||||||
-- This module serves as the root of the `InductiveVerification` library.
|
-- This module serves as the root of the `InductiveVerification` library.
|
||||||
-- Import modules here that should be built as part of the library.
|
-- Import modules here that should be built as part of the library.
|
||||||
import InductiveVerification.Basic
|
import InductiveVerification.Message
|
||||||
|
import InductiveVerification.Event
|
||||||
inductive Agent
|
|
||||||
| Server : Agent
|
|
||||||
| Friend : Nat → Agent
|
|
||||||
| Spy : Agent
|
|
||||||
|
|
||||||
inductive Msg
|
|
||||||
| Agent : Agent → Msg -- Agent names
|
|
||||||
| Number : Nat → Msg -- Ordinary integers, timestamps, ...
|
|
||||||
| Nonce : Nat → Msg -- Unguessable nonces
|
|
||||||
| Key : Key → Msg -- Crypto keys
|
|
||||||
| Hash : Msg → Msg -- Hashing
|
|
||||||
| MPair : Msg → Msg → Msg -- Compound messages
|
|
||||||
| Crypt : Key → Msg → Msg -- Encryption, public- or shared-key
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
def hello := "world"
|
|
||||||
@@ -1,4 +1,17 @@
|
|||||||
import Mathlib
|
import Init.Data.Nat.Lemmas
|
||||||
|
import Init.Prelude
|
||||||
|
import Mathlib.Data.Nat.Basic
|
||||||
|
import Mathlib.Data.Nat.Dist
|
||||||
|
import Mathlib.Data.Set.Basic
|
||||||
|
import Mathlib.Data.Set.Defs
|
||||||
|
import Mathlib.Data.Set.Image
|
||||||
|
import Mathlib.Data.Set.Insert
|
||||||
|
import Mathlib.Data.Set.Lattice
|
||||||
|
import Mathlib.Order.Closure
|
||||||
|
import Mathlib.Order.Lattice
|
||||||
|
import Mathlib.Tactic.ApplyAt
|
||||||
|
import Mathlib.Tactic.SimpIntro
|
||||||
|
import Mathlib.Tactic.NthRewrite
|
||||||
|
|
||||||
-- Keys are integers
|
-- Keys are integers
|
||||||
abbrev Key := Nat
|
abbrev Key := Nat
|
||||||
@@ -121,9 +134,11 @@ lemma keysFor_union (H H' : Set Msg) : keysFor (H ∪ H') = keysFor H ∪ keysFo
|
|||||||
|
|
||||||
-- Monotonicity
|
-- Monotonicity
|
||||||
@[simp]
|
@[simp]
|
||||||
lemma keysFor_mono {G H : Set Msg} (h : G ⊆ H) : keysFor G ⊆ keysFor H := by
|
lemma keysFor_mono: Monotone keysFor := by
|
||||||
simp
|
simp_intro _ _ sub _ h
|
||||||
grind
|
rcases h with ⟨K, ⟨⟨X, _⟩, _⟩⟩ ; exists K; apply And.intro
|
||||||
|
· exists X; aapply sub
|
||||||
|
· assumption
|
||||||
|
|
||||||
-- Lemmas for `keysFor` with specific message types
|
-- Lemmas for `keysFor` with specific message types
|
||||||
@[simp]
|
@[simp]
|
||||||
@@ -321,7 +336,7 @@ lemma parts_idem {H : Set Msg} : parts (parts H) = parts H :=
|
|||||||
lemma parts_subset_iff {G H : Set Msg} : (G ⊆ parts H) ↔ (parts G ⊆ parts H) :=
|
lemma parts_subset_iff {G H : Set Msg} : (G ⊆ parts H) ↔ (parts G ⊆ parts H) :=
|
||||||
by apply partsClosureOperator.le_closure_iff
|
by apply partsClosureOperator.le_closure_iff
|
||||||
|
|
||||||
@[simp, grind]
|
@[simp]
|
||||||
lemma parts_trans {G H : Set Msg} {X : Msg} :
|
lemma parts_trans {G H : Set Msg} {X : Msg} :
|
||||||
X ∈ parts G → G ⊆ parts H → X ∈ parts H :=
|
X ∈ parts G → G ⊆ parts H → X ∈ parts H :=
|
||||||
by intro a b; apply parts_mono at b; rw[parts_idem] at b; apply b; apply a;
|
by intro a b; apply parts_mono at b; rw[parts_idem] at b; apply b; apply a;
|
||||||
@@ -331,9 +346,12 @@ by intro a b; apply parts_mono at b; rw[parts_idem] at b; apply b; apply a;
|
|||||||
lemma parts_cut {G H : Set Msg} {X Y : Msg} :
|
lemma parts_cut {G H : Set Msg} {X Y : Msg} :
|
||||||
Y ∈ parts (insert X G) → X ∈ parts H → Y ∈ parts (G ∪ H) :=
|
Y ∈ parts (insert X G) → X ∈ parts H → Y ∈ parts (G ∪ H) :=
|
||||||
by
|
by
|
||||||
intro a b; rw[parts_union]; rw[parts_insert] at a; cases a <;> grind
|
intro a b; rw[parts_union]; rw[parts_insert] at a; cases a <;> grind[parts_trans]
|
||||||
|
|
||||||
-- Rewrite rules for pulling out atomic messages
|
@[simp]
|
||||||
|
lemma parts_cut_mono {G H : Set Msg} {X : Msg} :
|
||||||
|
X ∈ parts H → parts (insert X G) ⊆ parts (G ∪ H) :=
|
||||||
|
by grind[parts_cut]
|
||||||
|
|
||||||
@[simp]
|
@[simp]
|
||||||
lemma parts_insert_Agent {H : Set Msg} {agt : Agent} :
|
lemma parts_insert_Agent {H : Set Msg} {agt : Agent} :
|
||||||
@@ -1320,7 +1338,7 @@ lemma pushKeysMPair {K : Key} {X Y : Msg} {H : Set Msg}:
|
|||||||
by simp [Set.insert_comm]
|
by simp [Set.insert_comm]
|
||||||
|
|
||||||
lemma pushKeysCrypt {K K' : Key} {X : Msg} {H : Set Msg}:
|
lemma pushKeysCrypt {K K' : Key} {X : Msg} {H : Set Msg}:
|
||||||
insert (Key K) (insert (Crypt K' N) H) = insert (Crypt K' N) (insert (Key K) H) :=
|
insert (Key K) (insert (Crypt K' X) H) = insert (Crypt K' X) (insert (Key K) H) :=
|
||||||
by simp [Set.insert_comm]
|
by simp [Set.insert_comm]
|
||||||
|
|
||||||
lemma pushCryptsAgent {X : Msg} {K : Key} {C : Agent} {H : Set Msg} :
|
lemma pushCryptsAgent {X : Msg} {K : Key} {C : Agent} {H : Set Msg} :
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import InductiveVerification
|
import InductiveVerification
|
||||||
|
|
||||||
def main : IO Unit :=
|
def main : IO Unit :=
|
||||||
IO.println s!"Hello, {hello}!"
|
IO.println "Hello, world!"
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ name = "inductive-verification"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
defaultTargets = ["inductive-verification"]
|
defaultTargets = ["inductive-verification"]
|
||||||
|
|
||||||
|
[[require]]
|
||||||
|
name = "mathlib"
|
||||||
|
git = "https://github.com/leanprover-community/mathlib4.git"
|
||||||
|
|
||||||
[[lean_lib]]
|
[[lean_lib]]
|
||||||
name = "InductiveVerification"
|
name = "InductiveVerification"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
leanprover/lean4:v4.23.0
|
leanprover/lean4:v4.27.0-rc1
|
||||||
Reference in New Issue
Block a user