@@ -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`.
321321To see why, consider xs = [(1, false), (1, true)], f = Prod.fst.
322322Then `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
339339Note that `equiv_implies_canonical_eq` does not hold for all functions `f`.
340340To 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
0 commit comments