Zulip Chat Archive

Stream: general

Topic: lemmas for Nat.digits


Frederick Pu (Feb 16 2025 at 02:59):

do the following lemmas exist for Nat.digits?

example (x b : ) (hb : b > 1) (hx : (Nat.digits b x).length = 1) : Nat.digits b x = [x] := by sorry
example (x b : ) (hb : b > 1) (hx : x > 0) : (Nat.digits b x).length > 0 := by sorry

Matt Diamond (Feb 16 2025 at 03:26):

docs#Nat.digits_len gets you most of the way toward proving the 2nd one:

example (x b : ) (hb : b > 1) (hx : x > 0) : (Nat.digits b x).length > 0 := by
  rw [Nat.digits_len _ _ hb hx.ne']
  exact Nat.zero_lt_succ _

Daniel Weber (Feb 16 2025 at 05:35):

Could you do the first with docs#Nat.digits_of_lt ?

Frederick Pu (Feb 16 2025 at 15:22):

but we also need to prove that if (Nat.digits b x).length = 1 then x < b

Kevin Buzzard (Feb 16 2025 at 15:39):

Looks like digits_len reduces this to docs#Nat.log_eq_zero_iff

Kevin Buzzard (Feb 16 2025 at 15:40):

Probably one should prove x < b^length if that's not already there

Frederick Pu (Feb 16 2025 at 16:45):

doesn't Nat.digits_len basically do that?


Last updated: May 02 2025 at 03:31 UTC