Zulip Chat Archive

Stream: Is there code for X?

Topic: snoc and cast


Wrenna Robson (Nov 01 2024 at 14:08):

Can anyone find a neat proof of this?

Wrenna Robson (Nov 01 2024 at 14:08):

import Mathlib.Data.Fin.Tuple.Basic

open Fin

theorem snoc_cast (bs : Fin k  β) (b : β) (h : k' + 1 = k + 1) (i : Fin (k' + 1)) :
    snoc (α := fun _ => β) bs b (cast h i) =
    snoc (α := fun _ => β) (fun i => bs (cast (Nat.succ_inj.mp h) i)) b i := sorry

Yaël Dillies (Nov 01 2024 at 14:10):

#mwe ?

Wrenna Robson (Nov 01 2024 at 14:46):

Uh, this is my mwe?

Wrenna Robson (Nov 01 2024 at 14:49):

I guess it lacks the imports.

Wrenna Robson (Nov 01 2024 at 14:49):

@Yaël Dillies is that better?

Wrenna Robson (Nov 01 2024 at 14:50):

Even more minimally, there's this:

theorem foobar (bs : Fin k  β) (h : k' = k) (f : (k : Nat)  (Fin k  β)  α) :
    f k' (fun i => bs (Fin.cast h i)) = f k bs := sorry

Not sure that needs any imports at all.

Kevin Buzzard (Nov 01 2024 at 14:53):

Wrenna Robson said:

Uh, this is my mwe?

It doesn't work in the web editor for me or locally. I was going to see if aesop worked but I can't get the code running.

Wrenna Robson (Nov 01 2024 at 14:55):

Oh, namespaces. There we go?

Markus Himmel (Nov 01 2024 at 14:55):

This seems to work:

import Mathlib.Data.Fin.Tuple.Basic

open Fin

theorem snoc_cast (bs : Fin k  β) (b : β) (h : k' + 1 = k + 1) (i : Fin (k' + 1)) :
    snoc (α := fun _ => β) bs b (cast h i) =
    snoc (α := fun _ => β) (fun i => bs (cast (Nat.succ_inj.mp h) i)) b i := by
  cases h
  simp

Wrenna Robson (Nov 01 2024 at 14:55):

theorem foobar (bs : Fin k  β) (h : k' = k) (f : (k : Nat)  (Fin k  β)  α) :
    f k' (fun i => bs (Fin.cast h i)) = f k bs := by aesop

Wrenna Robson (Nov 01 2024 at 14:56):

Didn't know you could do that with equalities.


Last updated: May 02 2025 at 03:31 UTC