-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Level checking implementation and proof (WIP) #533
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
cedar-lean/Cedar/Spec/Slice.lean
Outdated
have _ := Map.sizeOf_lt_of_kvs r | ||
have _ := List.sizeOf_lt_of_mem e.property | ||
have _ : sizeOf e.val.snd < sizeOf e.val := by simp [sizeOf, Prod._sizeOf_1, Nat.one_add] | ||
rw [record.sizeOf_spec] ; omega |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've sync'ed with @john-h-kastner-aws about this one. It turns out that I've written a lot of similar-looking definitions and theorems as part of internal proofs. I'll package this into a PR with useful definitions and lemmas.
For example, this code can be written without any termination clauses:
def Prim.entityUIDs : Prim → Set EntityUID
| .entityUID uid => Set.singleton uid
| _ => Set.empty
def Value.entityUIDs : Value → Set EntityUID
| .prim p => p.entityUIDs
| .set (Set.mk vs) => vs.attach.unionAll (λ ⟨v, _⟩ => v.entityUIDs)
| .record (Map.mk avs) => avs.attach₃.unionAll (λ ⟨(_, v), _⟩ => v.entityUIDs)
| .ext _ => Set.empty
open Cedar.Spec | ||
open Cedar.Validation | ||
|
||
theorem level_based_slicing_is_sound {e : Expr} {tx : TypedExpr} {n : Nat} {c c₁ : Capabilities} {env : Environment} {request : Request} {slice entities : Entities} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might also want to have another higher-level theorem (which calls this one) that doesn't mention capabilities. Something along these lines:
/-- |
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
still need to fill many holes in that case
Signed-off-by: John Kastner <jkastner@amazon.com>
71f9058
to
ba92360
Compare
Signed-off-by: John Kastner <jkastner@amazon.com>
c693718
to
54540ae
Compare
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
Signed-off-by: John Kastner <jkastner@amazon.com>
cases b₁ <;> simp | ||
specialize ih₂ hs hc hr htx₂ (by simp [hl]) | ||
simp [ih₂] | ||
replace ⟨ bt, tx₂, bty₂, c₂, htx, htx₂, hty₂, ht ⟩ := ht |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Implements level checking in Lean as described in RFC 76 and implemented in Rust.
Currently contains a substantial amount of correctness proof level checking and slicing, covering
getAttr
,hasAttr
,var
,lit
, andite
.The main theorem is