Skip to content

Commit 3c8c558

Browse files
authored
switch to Lean's DecidableLT (#531)
Signed-off-by: Craig Disselkoen <cdiss@amazon.com>
1 parent 2481def commit 3c8c558

File tree

9 files changed

+41
-43
lines changed

9 files changed

+41
-43
lines changed

cedar-lean/Cedar/Data/LT.lean

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,13 @@ theorem StrictLT.not_eq [LT α] [StrictLT α] (x y : α) :
6262
have h₃ := StrictLT.irreflexive x
6363
contradiction
6464

65-
abbrev DecidableLT (α) [LT α] := DecidableRel (α := α) (· < ·)
66-
6765
end Cedar.Data
6866

6967
----- Theorems and instances -----
7068

7169
open Cedar.Data
7270

73-
theorem List.lt_cons_cases [LT α] [Cedar.Data.DecidableLT α] {x y : α} {xs ys : List α} :
71+
theorem List.lt_cons_cases [LT α] [DecidableLT α] {x y : α} {xs ys : List α} :
7472
x :: xs < y :: ys →
7573
(x < y ∨ (¬ x < y ∧ ¬ y < x ∧ xs < ys))
7674
:= by
@@ -84,7 +82,7 @@ theorem List.cons_lt_cons [LT α] [StrictLT α] (x : α) (xs ys : List α) :
8482
apply List.Lex.cons
8583
simp only [lex_lt, h₁]
8684

87-
theorem List.slt_irrefl [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (xs : List α) :
85+
theorem List.slt_irrefl [LT α] [StrictLT α] [DecidableLT α] (xs : List α) :
8886
¬ xs < xs
8987
:= by
9088
induction xs
@@ -114,7 +112,7 @@ theorem List.slt_trans [LT α] [StrictLT α] {xs ys zs : List α} :
114112
apply List.Lex.cons
115113
exact List.slt_trans h₃ h₆
116114

117-
theorem List.slt_asymm [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] {xs ys : List α} :
115+
theorem List.slt_asymm [LT α] [StrictLT α] [DecidableLT α] {xs ys : List α} :
118116
xs < ys → ¬ ys < xs
119117
:= by
120118
intro h₁
@@ -170,7 +168,7 @@ theorem List.lt_conn [LT α] [StrictLT α] {xs ys : List α} :
170168
apply List.Lex.rel
171169
exact StrictLT.if_not_lt_eq_then_gt xhd yhd h₄ h₅
172170

173-
instance List.strictLT (α) [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] : StrictLT (List α) where
171+
instance List.strictLT (α) [LT α] [StrictLT α] [DecidableLT α] : StrictLT (List α) where
174172
asymmetric _ _ := List.slt_asymm
175173
transitive _ _ _ := List.slt_trans
176174
connected _ _ := List.lt_conn

cedar-lean/Cedar/Data/List.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ open Cedar.Data
2929

3030
----- Definitions -----
3131

32-
def insertCanonical [LT β] [Cedar.Data.DecidableLT β] (f : α → β) (x : α) (xs : List α) : List α :=
32+
def insertCanonical [LT β] [DecidableLT β] (f : α → β) (x : α) (xs : List α) : List α :=
3333
match xs with
3434
| [] => [x]
3535
| hd :: tl =>
@@ -46,7 +46,7 @@ If the ordering relation < on β is strict, then `canonicalize` returns a
4646
canonical representation of the input list, which is sorted and free of
4747
duplicates.
4848
-/
49-
def canonicalize [LT β] [Cedar.Data.DecidableLT β] (f : α → β) : List α → List α
49+
def canonicalize [LT β] [DecidableLT β] (f : α → β) : List α → List α
5050
| [] => []
5151
| hd :: tl => insertCanonical f hd (canonicalize f tl)
5252

cedar-lean/Cedar/Data/Map.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def mapMOnKeys {α β γ} [LT γ] [DecidableLT γ] [Monad m] (f : α → m γ) (
104104
instance [LT (Prod α β)] : LT (Map α β) where
105105
lt a b := a.kvs < b.kvs
106106

107-
instance decLt [LT (Prod α β)] [DecidableEq (Prod α β)] [Cedar.Data.DecidableLT (Prod α β)] : (n m : Map α β) → Decidable (n < m)
107+
instance decLt [LT (Prod α β)] [DecidableEq (Prod α β)] [DecidableLT (Prod α β)] : (n m : Map α β) → Decidable (n < m)
108108
| .mk nkvs, .mk mkvs => List.decidableLT nkvs mkvs
109109

110110
-- enables ∈ notation for map keys

cedar-lean/Cedar/Data/Set.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def foldl {α β} (f : α → β → α) (init : α) (s : Set β) : α :=
124124
instance [LT α] : LT (Set α) where
125125
lt a b := a.elts < b.elts
126126

127-
instance decLt [LT α] [DecidableEq α] [Cedar.Data.DecidableLT α] : (n m : Set α) → Decidable (n < m)
127+
instance decLt [LT α] [DecidableEq α] [DecidableLT α] : (n m : Set α) → Decidable (n < m)
128128
| .mk nelts, .mk melts => List.decidableLT nelts melts
129129

130130
-- enables ∅

cedar-lean/Cedar/Thm/Authorization/Authorizer.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ theorem Except.isOk_iff_exists {x : Except ε α} :
306306
:= by
307307
cases x <;> simp [Except.isOk, Except.toBool]
308308

309-
theorem if_mapM_doesn't_fail_on_list_then_doesn't_fail_on_set [LT α] [Cedar.Data.DecidableLT α] [StrictLT α] {f : α → Except ε β} {as : List α} :
309+
theorem if_mapM_doesn't_fail_on_list_then_doesn't_fail_on_set [LT α] [DecidableLT α] [StrictLT α] {f : α → Except ε β} {as : List α} :
310310
Except.isOk (as.mapM f) →
311311
Except.isOk ((Set.elts (Set.make as)).mapM f)
312312
:= by

cedar-lean/Cedar/Thm/Data/List/Basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ theorem sortedBy_cons [LT β] [StrictLT β] {f : α → β} {x : α} {ys : List
294294
apply h₂
295295
simp only [mem_cons, true_or]
296296

297-
theorem mem_of_sortedBy_unique {α β} [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] [DecidableEq β]
297+
theorem mem_of_sortedBy_unique {α β} [LT β] [StrictLT β] [DecidableLT β] [DecidableEq β]
298298
{f : α → β} {x y : α} {xs : List α} :
299299
xs.SortedBy f → x ∈ xs → y ∈ xs → f x = f y →
300300
x = y
@@ -317,7 +317,7 @@ theorem mem_of_sortedBy_unique {α β} [LT β] [StrictLT β] [Cedar.Data.Decidab
317317
simp only [hf, StrictLT.irreflexive] at hlt
318318
· exact ih hx hy
319319

320-
theorem mem_of_sortedBy_implies_find? {α β} [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] [DecidableEq β]
320+
theorem mem_of_sortedBy_implies_find? {α β} [LT β] [StrictLT β] [DecidableLT β] [DecidableEq β]
321321
{f : α → β} {x : α} {xs : List α} :
322322
x ∈ xs → xs.SortedBy f →
323323
xs.find? (fun y => f y == f x) = x
@@ -384,7 +384,7 @@ theorem map_eq_implies_sortedBy [LT β] [StrictLT β] {f : α → β} {g : γ
384384
apply sortedBy_implies_head_lt_tail h₂
385385
simp only [mem_cons, true_or]
386386

387-
theorem filter_sortedBy [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] {f : α → β} (p : α → Bool) {xs : List α} :
387+
theorem filter_sortedBy [LT β] [StrictLT β] [DecidableLT β] {f : α → β} (p : α → Bool) {xs : List α} :
388388
SortedBy f xs → SortedBy f (xs.filter p)
389389
:= by
390390
intro h₁
@@ -401,7 +401,7 @@ theorem filter_sortedBy [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] {f :
401401
exact h₂.left
402402
· exact ih
403403

404-
theorem filterMap_sortedBy [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] {f : α → β} {g : α → Option γ} {f' : γ → β} {xs : List α} :
404+
theorem filterMap_sortedBy [LT β] [StrictLT β] [DecidableLT β] {f : α → β} {g : α → Option γ} {f' : γ → β} {xs : List α} :
405405
(∀ x y, g x = some y → f x = f' y) →
406406
SortedBy f xs →
407407
SortedBy f' (xs.filterMap g)

cedar-lean/Cedar/Thm/Data/List/Canonical.lean

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ open Cedar.Data
3030

3131
/-! ### insertCanonical -/
3232

33-
theorem insertCanonical_singleton [LT β] [Cedar.Data.DecidableLT β] (f : α → β) (x : α) :
33+
theorem insertCanonical_singleton [LT β] [DecidableLT β] (f : α → β) (x : α) :
3434
insertCanonical f x [] = [x]
3535
:= by unfold insertCanonical; rfl
3636

37-
theorem insertCanonical_not_nil [DecidableEq β] [LT β] [Cedar.Data.DecidableLT β] (f : α → β) (x : α) (xs : List α) :
37+
theorem insertCanonical_not_nil [DecidableEq β] [LT β] [DecidableLT β] (f : α → β) (x : α) (xs : List α) :
3838
insertCanonical f x xs ≠ []
3939
:= by
4040
unfold insertCanonical
@@ -46,7 +46,7 @@ theorem insertCanonical_not_nil [DecidableEq β] [LT β] [Cedar.Data.DecidableLT
4646
split at h <;> try trivial
4747
split at h <;> trivial
4848

49-
theorem insertCanonical_sortedBy [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] {f : α → β} {xs : List α} (x : α) :
49+
theorem insertCanonical_sortedBy [LT β] [StrictLT β] [DecidableLT β] {f : α → β} {xs : List α} (x : α) :
5050
SortedBy f xs →
5151
SortedBy f (insertCanonical f x xs)
5252
:= by
@@ -85,7 +85,7 @@ theorem insertCanonical_sortedBy [LT β] [StrictLT β] [Cedar.Data.DecidableLT
8585
case cons_nil => exact SortedBy.cons_nil
8686
case cons_cons h₅ h₆ => exact SortedBy.cons_cons (by simp only [h₄, h₆]) h₅
8787

88-
theorem insertCanonical_cases [LT β] [Cedar.Data.DecidableLT β] (f : α → β) (x y : α) (ys : List α) :
88+
theorem insertCanonical_cases [LT β] [DecidableLT β] (f : α → β) (x y : α) (ys : List α) :
8989
(f x < f y ∧ insertCanonical f x (y :: ys) = x :: y :: ys) ∨
9090
(¬ f x < f y ∧ f x > f y ∧ insertCanonical f x (y :: ys) = y :: insertCanonical f x ys) ∨
9191
(¬ f x < f y ∧ ¬ f x > f y ∧ insertCanonical f x (y :: ys) = x :: ys)
@@ -102,7 +102,7 @@ theorem insertCanonical_cases [LT β] [Cedar.Data.DecidableLT β] (f : α → β
102102
case pos _ _ h₃ => simp [h₃, h₁]
103103
case neg _ _ h₃ => simp [h₃]
104104

105-
theorem insertCanonical_subset [LT β] [Cedar.Data.DecidableLT β] (f : α → β) (x : α) (xs : List α) :
105+
theorem insertCanonical_subset [LT β] [DecidableLT β] (f : α → β) (x : α) (xs : List α) :
106106
insertCanonical f x xs ⊆ x :: xs
107107
:= by
108108
induction xs
@@ -117,7 +117,7 @@ theorem insertCanonical_subset [LT β] [Cedar.Data.DecidableLT β] (f : α →
117117
· simp only [h₁, cons_subset, mem_cons, true_or, true_and]
118118
exact Subset.trans (List.subset_cons_self hd tl) (List.subset_cons_self x (hd :: tl))
119119

120-
theorem insertCanonical_equiv [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (x : α) (xs : List α) :
120+
theorem insertCanonical_equiv [LT α] [StrictLT α] [DecidableLT α] (x : α) (xs : List α) :
121121
x :: xs ≡ insertCanonical id x xs
122122
:= by
123123
unfold insertCanonical
@@ -173,7 +173,7 @@ theorem insertCanonical_equiv [LT α] [StrictLT α] [Cedar.Data.DecidableLT α]
173173
apply cons_equiv_cons
174174
exact ih
175175

176-
theorem insertCanonical_preserves_forallᵥ {α β γ} [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] {p : β → γ → Prop}
176+
theorem insertCanonical_preserves_forallᵥ {α β γ} [LT α] [StrictLT α] [DecidableLT α] {p : β → γ → Prop}
177177
{kv₁ : α × β} {kv₂ : α × γ} {kvs₁ : List (α × β)} {kvs₂ : List (α × γ)}
178178
(h₁ : kv₁.fst = kv₂.fst ∧ p kv₁.snd kv₂.snd)
179179
(h₂ : Forallᵥ p kvs₁ kvs₂) :
@@ -202,7 +202,7 @@ theorem insertCanonical_preserves_forallᵥ {α β γ} [LT α] [StrictLT α] [Ce
202202
· contradiction
203203
· exact Forall₂.cons (by exact h₁) (by exact h₄)
204204

205-
theorem insertCanonical_map_fst {α β γ} [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (xs : List (α × β)) (f : β → γ) (x : α × β) :
205+
theorem insertCanonical_map_fst {α β γ} [LT α] [StrictLT α] [DecidableLT α] (xs : List (α × β)) (f : β → γ) (x : α × β) :
206206
insertCanonical Prod.fst (Prod.map id f x) (map (Prod.map id f) xs) =
207207
map (Prod.map id f) (insertCanonical Prod.fst x xs)
208208
:= by
@@ -218,7 +218,7 @@ theorem insertCanonical_map_fst {α β γ} [LT α] [StrictLT α] [Cedar.Data.Dec
218218
simp [ih, Prod.map]
219219
· simp [Prod.map]
220220

221-
theorem insertCanonical_map_fst_canonicalize {α β γ} [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (xs : List (α × β)) (f : β → γ) (x : α × β) :
221+
theorem insertCanonical_map_fst_canonicalize {α β γ} [LT α] [StrictLT α] [DecidableLT α] (xs : List (α × β)) (f : β → γ) (x : α × β) :
222222
insertCanonical Prod.fst (Prod.map id f x) (canonicalize Prod.fst (map (Prod.map id f) xs)) =
223223
map (Prod.map id f) (insertCanonical Prod.fst x (canonicalize Prod.fst xs))
224224
:= by
@@ -230,11 +230,11 @@ theorem insertCanonical_map_fst_canonicalize {α β γ} [LT α] [StrictLT α] [C
230230

231231
/-! ## canonicalize -/
232232

233-
theorem canonicalize_nil [LT β] [Cedar.Data.DecidableLT β] (f : α → β) :
233+
theorem canonicalize_nil [LT β] [DecidableLT β] (f : α → β) :
234234
canonicalize f [] = []
235235
:= by unfold canonicalize; rfl
236236

237-
theorem canonicalize_nil' [DecidableEq β] [LT β] [Cedar.Data.DecidableLT β] (f : α → β) (xs : List α) :
237+
theorem canonicalize_nil' [DecidableEq β] [LT β] [DecidableLT β] (f : α → β) (xs : List α) :
238238
xs = [] ↔ (canonicalize f xs) = []
239239
:= by
240240
constructor
@@ -251,7 +251,7 @@ theorem canonicalize_nil' [DecidableEq β] [LT β] [Cedar.Data.DecidableLT β] (
251251
apply insertCanonical_not_nil f x (canonicalize f xs)
252252
exact h₁
253253

254-
theorem canonicalize_not_nil [DecidableEq β] [LT β] [Cedar.Data.DecidableLT β] (f : α → β) (xs : List α) :
254+
theorem canonicalize_not_nil [DecidableEq β] [LT β] [DecidableLT β] (f : α → β) (xs : List α) :
255255
xs ≠ [] ↔ (canonicalize f xs) ≠ []
256256
:= by
257257
constructor
@@ -267,14 +267,14 @@ theorem canonicalize_not_nil [DecidableEq β] [LT β] [Cedar.Data.DecidableLT β
267267
intro h₀
268268
cases xs <;> simp only [ne_eq, reduceCtorEq, not_false_eq_true, not_true_eq_false] at *
269269

270-
theorem canonicalize_cons [LT β] [Cedar.Data.DecidableLT β] (f : α → β) (xs : List α) (a : α) :
270+
theorem canonicalize_cons [LT β] [DecidableLT β] (f : α → β) (xs : List α) (a : α) :
271271
canonicalize f xs = canonicalize f ys → canonicalize f (a :: xs) = canonicalize f (a :: ys)
272272
:= by
273273
intro h₁
274274
unfold canonicalize
275275
simp [h₁]
276276

277-
theorem canonicalize_sortedBy [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] (f : α → β) (xs : List α) :
277+
theorem canonicalize_sortedBy [LT β] [StrictLT β] [DecidableLT β] (f : α → β) (xs : List α) :
278278
SortedBy f (canonicalize f xs)
279279
:= by
280280
induction xs
@@ -284,7 +284,7 @@ theorem canonicalize_sortedBy [LT β] [StrictLT β] [Cedar.Data.DecidableLT β]
284284
apply insertCanonical_sortedBy
285285
exact ih
286286

287-
theorem sortedBy_implies_canonicalize_eq [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] {f : α → β} {xs : List α} :
287+
theorem sortedBy_implies_canonicalize_eq [LT β] [StrictLT β] [DecidableLT β] {f : α → β} {xs : List α} :
288288
SortedBy f xs → (canonicalize f xs) = xs
289289
:= by
290290
intro h₁
@@ -296,7 +296,7 @@ theorem sortedBy_implies_canonicalize_eq [LT β] [StrictLT β] [Cedar.Data.Decid
296296
specialize ih h₁
297297
simp [ih, insertCanonical, h₂]
298298

299-
theorem canonicalize_subseteq [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] (f : α → β) (xs : List α) :
299+
theorem canonicalize_subseteq [LT β] [StrictLT β] [DecidableLT β] (f : α → β) (xs : List α) :
300300
xs.canonicalize f ⊆ xs
301301
:= by
302302
induction xs <;> simp only [canonicalize, Subset.refl]
@@ -308,7 +308,7 @@ theorem canonicalize_subseteq [LT β] [StrictLT β] [Cedar.Data.DecidableLT β]
308308
simp only [subset_cons_self]
309309

310310
/-- Corollary of `canonicalize_subseteq` -/
311-
theorem in_canonicalize_in_list [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] {f : α → β} {x : α} {xs : List α} :
311+
theorem in_canonicalize_in_list [LT β] [StrictLT β] [DecidableLT β] {f : α → β} {x : α} {xs : List α} :
312312
x ∈ xs.canonicalize f → x ∈ xs
313313
:= by
314314
intro h₁
@@ -321,7 +321,7 @@ Note that `canonicalize_equiv` does not hold for all functions `f`.
321321
To see why, consider xs = [(1, false), (1, true)], f = Prod.fst.
322322
Then `canonicalize f xs = [(1, false)] !≡ xs`.
323323
-/
324-
theorem canonicalize_equiv [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (xs : List α) :
324+
theorem canonicalize_equiv [LT α] [StrictLT α] [DecidableLT α] (xs : List α) :
325325
xs ≡ canonicalize id xs
326326
:= by
327327
induction xs
@@ -339,7 +339,7 @@ theorem canonicalize_equiv [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (xs
339339
Note that `equiv_implies_canonical_eq` does not hold for all functions `f`.
340340
To see why, consider the `example` immediately below this.
341341
-/
342-
theorem equiv_implies_canonical_eq [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (xs ys : List α) :
342+
theorem equiv_implies_canonical_eq [LT α] [StrictLT α] [DecidableLT α] (xs ys : List α) :
343343
xs ≡ ys → (canonicalize id xs) = (canonicalize id ys)
344344
:= by
345345
intro h₁
@@ -371,7 +371,7 @@ example :
371371
simp [List.Equiv]
372372
decide
373373

374-
theorem canonicalize_idempotent {α β} [LT β] [StrictLT β] [Cedar.Data.DecidableLT β] (f : α → β) (xs : List α) :
374+
theorem canonicalize_idempotent {α β} [LT β] [StrictLT β] [DecidableLT β] (f : α → β) (xs : List α) :
375375
canonicalize f (canonicalize f xs) = canonicalize f xs
376376
:= sortedBy_implies_canonicalize_eq (canonicalize_sortedBy f xs)
377377

@@ -384,7 +384,7 @@ Then `(canonicalize f xs).filter p = []` but `(xs.filter p).canonicalize f = [(1
384384
#eval (canonicalize Prod.fst [(1, false), (1, true)]).filter Prod.snd
385385
#eval ([(1, false), (1, true)].filter Prod.snd).canonicalize Prod.fst
386386
-/
387-
theorem canonicalize_id_filter {α} [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (p : α → Bool) (xs : List α) :
387+
theorem canonicalize_id_filter {α} [LT α] [StrictLT α] [DecidableLT α] (p : α → Bool) (xs : List α) :
388388
(canonicalize id xs).filter p = (xs.filter p).canonicalize id
389389
:= by
390390
have h₁ : (canonicalize id xs).filter p ≡ xs.filter p := by
@@ -397,7 +397,7 @@ theorem canonicalize_id_filter {α} [LT α] [StrictLT α] [Cedar.Data.DecidableL
397397
(canonicalize_sortedBy id (filter p xs))
398398
(Equiv.trans h₁ h₂)
399399

400-
theorem canonicalize_preserves_forallᵥ {α β γ} [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (p : β → γ → Prop) (kvs₁ : List (α × β)) (kvs₂ : List (α × γ)) :
400+
theorem canonicalize_preserves_forallᵥ {α β γ} [LT α] [StrictLT α] [DecidableLT α] (p : β → γ → Prop) (kvs₁ : List (α × β)) (kvs₂ : List (α × γ)) :
401401
List.Forallᵥ p kvs₁ kvs₂ →
402402
List.Forallᵥ p (List.canonicalize Prod.fst kvs₁) (List.canonicalize Prod.fst kvs₂)
403403
:= by
@@ -410,7 +410,7 @@ theorem canonicalize_preserves_forallᵥ {α β γ} [LT α] [StrictLT α] [Cedar
410410
have h₄ := canonicalize_preserves_forallᵥ p tl₁ tl₂ h₃
411411
apply insertCanonical_preserves_forallᵥ h₂ h₄
412412

413-
theorem canonicalize_of_map_fst {α β γ} [LT α] [StrictLT α] [Cedar.Data.DecidableLT α] (xs : List (α × β)) (f : β → γ) :
413+
theorem canonicalize_of_map_fst {α β γ} [LT α] [StrictLT α] [DecidableLT α] (xs : List (α × β)) (f : β → γ) :
414414
List.canonicalize Prod.fst (List.map (Prod.map id f) xs) =
415415
List.map (Prod.map id f) (List.canonicalize Prod.fst xs)
416416
:= by

cedar-lean/CedarProto/ValidatorSchema.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ structure ValidatorSchema where
3636
acts : EntityUidWithActionsIdMap
3737
deriving Inhabited
3838

39-
instance : Data.DecidableLT Spec.EntityTypeProto := by
39+
instance : DecidableLT Spec.EntityTypeProto := by
4040
unfold Spec.EntityTypeProto
4141
apply inferInstance
4242

@@ -49,12 +49,12 @@ The definitions and utility functions below are used to convert the descendant
4949
representation to the ancestor representation.
5050
-/
5151
@[inline]
52-
private def findInMapValues [LT α] [DecidableEq α] [Data.DecidableLT α] (m : Data.Map α (Data.Set α)) (k₁ : α) : Data.Set α :=
52+
private def findInMapValues [LT α] [DecidableEq α] [DecidableLT α] (m : Data.Map α (Data.Set α)) (k₁ : α) : Data.Set α :=
5353
let setOfSets := List.map (λ (k₂,v) => if v.contains k₁ then Data.Set.singleton k₂ else Data.Set.empty) m.toList
5454
setOfSets.foldl (λ acc v => acc.union v) Data.Set.empty
5555

5656
@[inline]
57-
private def descendantsToAncestors [LT α] [DecidableEq α] [Data.DecidableLT α] (descendants : Data.Map α (Data.Set α)) : Data.Map α (Data.Set α) :=
57+
private def descendantsToAncestors [LT α] [DecidableEq α] [DecidableLT α] (descendants : Data.Map α (Data.Set α)) : Data.Map α (Data.Set α) :=
5858
Data.Map.make (List.map
5959
(λ (k,_) => (k, findInMapValues descendants k)) descendants.toList)
6060

cedar-lean/DiffTest/Parser.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,11 @@ formalization standardizes on ancestor information.
419419
The definitions and utility functions below are used to convert the descendant
420420
representation to the ancestor representation.
421421
-/
422-
def findInMapValues [LT α] [DecidableEq α] [Cedar.Data.DecidableLT α] (m : Map α (Set α)) (k₁ : α) : Set α :=
422+
def findInMapValues [LT α] [DecidableEq α] [DecidableLT α] (m : Map α (Set α)) (k₁ : α) : Set α :=
423423
let setOfSets := List.map (λ (k₂,v) => if v.contains k₁ then Set.singleton k₂ else Set.empty) m.toList
424424
setOfSets.foldl (λ acc v => acc.union v) Set.empty
425425

426-
def descendantsToAncestors [LT α] [DecidableEq α] [Cedar.Data.DecidableLT α] (descendants : Map α (Set α)) : Map α (Set α) :=
426+
def descendantsToAncestors [LT α] [DecidableEq α] [DecidableLT α] (descendants : Map α (Set α)) : Map α (Set α) :=
427427
Map.make (List.map
428428
(λ (k,_) => (k, findInMapValues descendants k)) descendants.toList)
429429

0 commit comments

Comments
 (0)