We are considering removing `.` as an alternative for `·` in the lambda dot notation (e.g., `(·+·)`). Reasons: - `.` is not a perfect replacement for `·` (e.g., `(·.insert ·)`) - `.` is too overloaded: `(f.x)` and `(f .x)` and `(f . x)`. We want to keep the first two.
20 lines
659 B
Text
20 lines
659 B
Text
inductive Vector (α : Type u): Nat → Type u where
|
||
| nil : Vector α 0
|
||
| cons (head : α) (tail : Vector α n) : Vector α (n+1)
|
||
|
||
namespace Vector
|
||
def mem (a : α) : Vector α n → Prop
|
||
| nil => False
|
||
| cons b l => a = b ∨ mem a l
|
||
|
||
def foldr (f : α → β → β) (init : β) : Vector α n → β
|
||
| nil => init
|
||
| cons a l => f a (foldr f init l)
|
||
|
||
theorem foldr_max [LE β] [LT β] [DecidableRel (· < · : β → β → Prop)] {v: Vector α n} (f : α → β) (init : β)
|
||
(h: v.mem y):
|
||
f y ≤ v.foldr (λ x acc => max (f x) acc) init := by
|
||
induction v <;> simp only[foldr,max]
|
||
. admit
|
||
. split <;> admit
|
||
end Vector
|