Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
feat(data/vector/basic): reflected instance for vectors (#14669)
Browse files Browse the repository at this point in the history
This means that a `vector` from a tactic block can be used in an expression.
  • Loading branch information
eric-wieser committed Jun 15, 2022
1 parent b134b2f commit bf2edb5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/data/vector/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ variables {n : ℕ}
namespace vector
variables {α : Type*}

infixr `::ᵥ`:67 := vector.cons
infixr ` ::ᵥ `:67 := vector.cons

attribute [simp] head_cons tail_cons

Expand Down Expand Up @@ -564,4 +564,9 @@ instance : is_lawful_traversable.{u} (flip vector n) :=
id_map := by intros; cases x; simp! [(<$>)],
comp_map := by intros; cases x; simp! [(<$>)] }

meta instance reflect {α : Type} [has_reflect α] [reflected α] {n : ℕ} : has_reflect (vector α n) :=
λ v, @vector.induction_on n α (λ n, reflected) v
(`(λ a, @vector.nil.{0} a).subst `(α))
(λ n x xs ih, (`(λ x xs, vector.cons.{0} x xs).subst `(x)).subst ih)

end vector

0 comments on commit bf2edb5

Please sign in to comment.