Zulip Chat Archive

Stream: new members

Topic: Skolem's exponential functions


Janitha Aswedige (Jul 20 2025 at 02:54):

I'm trying to formalize a problem of Skolem. Need to define a set SS of functions NN\mathbb{N} \to \mathbb{N} so that 1,id1, id are in SS and SS is closed under addition, multiplication, and exponentiation.

inductive S : (  )  Prop
  | one : S (fun _ => 1)
  | id : S (fun n => n)
  | add {f g :   } : S f  S g  S (f + g)
  | mul {f g :   } : S f  S g  S (f * g)
  | exp {f g :   } : S f  S g  S (fun n => f n ^ g n)

Is this the best way to do it?

Matt Diamond (Jul 20 2025 at 02:57):

Did you mean subtraction or exponentiation? Your description mentions the first but your code implements the second

Janitha Aswedige (Jul 20 2025 at 03:02):

Sorry. It was a mistake. It's exponentiation. Fixed it.

Matt Diamond (Jul 20 2025 at 03:03):

All good, thanks for clarifying

Janitha Aswedige (Jul 20 2025 at 08:56):

I'm having some trouble filling in the last two sorrys. At this point, I'm wondering if the idea of the theorem and its proof is correct at all. Can someone please have a look?

import Mathlib.Data.Real.Basic
import Mathlib.Order.WellFounded
import Mathlib.SetTheory.Ordinal.Arithmetic

open Function

namespace Skolem

/-- S is the set of functions ℕ → ℕ so that 1, id ∈ S, and S is closed under +, *, and exponentiation. -/
inductive S : (  )  Prop
  | one : S (fun _ => 1)
  | id : S (fun n => n)
  | add {f g :   } : S f  S g  S (f + g)
  | mul {f g :   } : S f  S g  S (f * g)
  | exp {f g :   } : S f  S g  S (fun n => f n ^ g n)


theorem growth_prop (f :   ) (h : S f) : ( k,  n  k, f n  n)  ( c,  n, c  0  f n = c):= by
  induction h with
  | one =>
    simp
  | id =>
    simp
  | @add g h sg sh ihg ihh =>
    sorry
  | @mul g h mg mh ihg ihh =>
    sorry
  | @exp g h hg hh ihg ihh =>
    simp
    cases' ihg with kg Hg <;> cases' ihh with kh Hh
    left
    obtain k₁, gk := kg
    obtain k₂, hk := kh
    let k' := max (max k₁ k₂) 1
    use k'
    intro n H
    have H2 : g n  n := by aesop
    have H3 : h n  n := by aesop
    have H4 : g n ^ h n  n ^ n := by
      refine pow_le_pow H2 ?_ H3
      have : n  1 := by exact le_of_max_le_right H
      exact Nat.le_trans this H2
    have H5 : n ^ n  n := by
      refine Nat.le_pow ?_
      aesop
    exact Nat.le_trans H5 H4
    left
    obtain k₁, gk := kg
    obtain c, hc := Hh
    let k := max k₁ 1
    use k
    intro n H
    have H1 : g n  n := by
      have : n  k₁ := by exact le_of_max_le_left H
      exact gk n this
    have H2 : h n = c := by aesop
    have H3 : c  1 := by
      have : c  0 := by aesop
      omega
    have H4 : h n  1 := by omega
    have H5 : g n ^ h n  n ^ 1 := by
      refine pow_le_pow H1 ?_ H4
      have : g n  k := by exact Nat.le_trans H H1
      aesop
    aesop
    left
    sorry
    sorry

Aaron Liu (Jul 20 2025 at 09:02):

these seem solvable to me

Vlad (Jul 20 2025 at 13:40):

Proof

Janitha Aswedige (Jul 22 2025 at 04:55):

How do I write that (S,)(S,\preceq) is a well-ordering? I want it as a theorem but can't figure out how to write it.

import Mathlib.Tactic
import Mathlib.Order.Defs.Unbundled
import Mathlib.Order.RelClasses

open Function

namespace Skolem

/-- S is the set of functions ℕ → ℕ so that 1, id ∈ S, and S is closed under +, *, and exponentiation. -/
inductive S : (  )  Prop
  | one : S (fun _ => 1)
  | id : S (fun n => n)
  | add {f g :   } : S f  S g  S (f + g)
  | mul {f g :   } : S f  S g  S (f * g)
  | exp {f g :   } : S f  S g  S (fun n => f n ^ g n)

def EventuallyLT (f g :   ) : Prop :=  n₀,  n  n₀, f n < g n

infix:50 " ≺ " => EventuallyLT

def EventuallyLE (f g :   ) : Prop := f  g  f = g

infix:50 " ≼ " => EventuallyLE

Aaron Liu (Jul 22 2025 at 07:06):

Probably IsWellOrder S (· ≺ ·)

Janitha Aswedige (Jul 22 2025 at 07:46):

IsWellOrder S (· ≼ ·) gives an error; unexpected token '·'; expected '_' or identifier.

Yaël Dillies (Jul 22 2025 at 07:51):

Are you using the correct central dot?

Janitha Aswedige (Jul 22 2025 at 07:52):

I think so, used \ .

Aaron Liu (Jul 22 2025 at 08:02):

Then IsWellOrder S EventuallyLT should work

Janitha Aswedige (Jul 22 2025 at 08:07):

Still no :( theorem well_order : IsWellOrder S EventuallyLT := by sorry gives the error

application type mismatch
IsWellOrder S
argument
S
has type
(ℕ → ℕ) → Prop : Type
but is expected to have type
Type ?u.5733 : Type (?u.5733 + 1)

Yaël Dillies (Jul 22 2025 at 08:09):

Ah sorry, IsWellOrder {f // S f} (· ≺ ·) will do

Janitha Aswedige (Jul 22 2025 at 08:12):

That worked. I don't understand the goal state ⊢ IsWellOrder ↑{f | S f} fun x1 x2 => ↑x1 ≺ ↑x2 though. Could you please explain?

Yaël Dillies (Jul 22 2025 at 08:14):

What do you not understand about it? Also note I have edited my message above :wink:

Janitha Aswedige (Jul 22 2025 at 08:16):

Noted :) I don't get what it says.

Yaël Dillies (Jul 22 2025 at 08:21):

"(S,)(S,\preceq) is a well-ordering"

Yaël Dillies (Jul 22 2025 at 08:23):

There are some extra complications due to the fact that S isn't a type. That means you need to make it into a type (this is what {f // S f} does) AND you need to tweak the relation as alone has the wrong type

Janitha Aswedige (Jul 22 2025 at 08:26):

Okay, I think I understand it a little now, though not fully. Thanks! :)


Last updated: Dec 20 2025 at 21:32 UTC