Zulip Chat Archive

Stream: new members

Topic: Cartesian product


Maxime Darrin (Jul 02 2021 at 14:30):

Hi is there a way to talk about \R^2, \R^3, ... and to get tuples such that
v : \R^4, v[0] + v[1] + v[2] = v[3] for example ?

Anne Baanen (Jul 02 2021 at 14:31):

ℝ⁴ is written fin 4 → ℝ, for example:

Anne Baanen (Jul 02 2021 at 14:32):

import data.matrix.notation
import data.real.basic

def v : fin 4   := ![1, 2, 3, 4]

example :  v : fin 4  , v = ![v 0, v 1, v 2, v 3] :=
begin
  intro v,
  ext i,
  fin_cases i; simp
end

Anne Baanen (Jul 02 2021 at 14:34):

And your example property looks like:

def last_eq_sum_first (v : fin 4  ) :=
v 0 + v 1 + v 2 = v 3

Last updated: Dec 20 2023 at 11:08 UTC