Skip to content

Commit

Permalink
adjust definition of isAction
Browse files Browse the repository at this point in the history
  • Loading branch information
khieta committed Nov 1, 2023
1 parent 4ee5771 commit fcfa4ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
3 changes: 0 additions & 3 deletions cedar-lean/Cedar/Spec/Value.lean
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ structure EntityUID where
ty : EntityType
eid : String

def EntityUID.isAction (uid : EntityUID) : Bool :=
uid.ty.id == "Action"

inductive Prim where
| bool (b : Bool)
| int (i : Int)
Expand Down
2 changes: 1 addition & 1 deletion cedar-lean/Cedar/Thm/Lemmas/Typechecker.lean
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ action store, and the ancestor relationships in the entity store are consistent
with the descendants information in the action store.
-/
def InstanceOfActionStore (entities : Entities) (as: ActionStore) : Prop :=
∀ uid data, entities.find? uid = some data → uid.isAction →
∀ uid data, entities.find? uid = some data → isAction uid as
∀ ancestor, ancestor ∈ data.ancestors →
∃ descendants, as.find? ancestor = some descendants ∧ uid ∈ descendants

Expand Down
7 changes: 5 additions & 2 deletions cedar-lean/Cedar/Validation/Typechecker.lean
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,12 @@ def entityUIDs? : Expr → Option (List EntityUID)
| .set xs => xs.mapM entityUID?
| _ => .none

def isAction (uid : EntityUID) (acts: ActionStore) : Bool :=
acts.contains uid

def actionUID? (x : Expr) (acts: ActionStore) : Option EntityUID := do
let uid ← entityUID? x
if acts.contains uid then .some uid else .none
if isAction uid acts then .some uid else .none

-- x₁ in x₂ where x₁ has type ety₁ and x₂ has type ety₂
def typeOfInₑ (ety₁ ety₂ : EntityType) (x₁ x₂ : Expr) (env : Environment) : ResultType :=
Expand Down Expand Up @@ -284,4 +287,4 @@ def typeOf (x : Expr) (c : Capabilities) (env : Environment) : ResultType :=
let tys ← xs.mapM₁ (λ ⟨x₁, _⟩ => justType (typeOf x₁ c env))
typeOfCall xfn tys xs

end Cedar.Validation
end Cedar.Validation

0 comments on commit fcfa4ee

Please sign in to comment.