## Construct the biggest number

For all your silly time-killing forum games.

Moderators: jestingrabbit, Moderators General, Prelates

Fejfo
Posts: 5
Joined: Fri Mar 31, 2017 6:51 pm UTC

### Construct the biggest number

We start with:
• the numbers 0, 1
• the functions a+b, a⋅b, a^b, if

In each post (no double posting) we will construct new numbers (integers), functions or operators to add to the lists.
With the goal of creating a list of the largest numbers

You can only add numbers by applying a function from the list of function to numbers from the lists of numbers.

You can only create functions like
square(x)=x⋅x adds the function square
of course the a⋅a part of the function needs to be defined already

You can create conditional branches using if(condition,trueValue,falseValue)
e.g. max(x,y)=if(x>y, x, y) adds the max function

At the end of each post you need to recap which numbers and functions are defined so we don't need to search trough each post to find the lists.
Last edited by Fejfo on Fri Jun 29, 2018 8:18 pm UTC, edited 1 time in total.

Fejfo
Posts: 5
Joined: Fri Mar 31, 2017 6:51 pm UTC

### Re: Construct the biggest number

I'll start by constructing the number 2=1+1

And the function:

Code: Select all

`mediumHierachy(a,x)=if(a=0,    x+1,    mediumHierachy(        if(a is a function,            a(x),            a-1        ),mediumHierachy(            if(a is a function,a(x),a-1)        ,x)     ))`

Sorry for the complicated function, I'll explain it when I use it.

new numbers: 0,1,2
new functions: a+b, a⋅b, a^b, if, mediumHierachy

emlightened
Posts: 42
Joined: Sat Sep 26, 2015 9:35 pm UTC
Location: Somewhere cosy.

### Re: Construct the biggest number

You don't seem to have defined x-1. Maybe try case analysis? (see below)

Can the functions we make be partial?
Are the numbers naturals or integers? You said integers. So I'm guessing partial functions, right? Otherwise ^ and mediumHierarchy don't work.

Mind if I make a general suggestion?

Given all the stuff we're making, and that, well, it looks like the second post already contains higher order functions (a function which takes functions as arguments), may I suggest not just splitting the stuff we have into functions and numbers, but instead saying more about what it is?

So, for instance:

true, false : Bool
0,1,2 : Nat
+, ⋅, ^ : (Nat×Nat)→Nat
=, <, <= : (Nat×Nat)→Bool
if : (Bool×T×T)→T, for any type T
mediumHierachy : I genuinely can't tell. Why would you have a "if xyz is a function" instead of restricting the inputs?

× is just the cartesian product, and A→B is the set (type) of all functions from A to B.

This means that we can easily see whether an expression is valid or nonsensical, and it's easier to write stuff that makes sense! You can also guess what a function does by looking at it then.

Anyway, function is:

Code: Select all

`iterateFunction(  0,f,a) = aiterateFunction(n+1,f,a) = f(iterateFunction(n,f,a))`

(Which has type (Nat×(T→T)×T)→T, for any type T.)

And number is:

iterateFunction(2,_+1, 1) = iterateFunction(1,_+1, 1)+1 = (iterateFunction(0,_+1, 1)+1)+1 = (1+1)+1 = 3

Spoiler:
Booleans: true, false
Natural numbers: 0, 1, 2, 3
Functions: +, ⋅, ^, if, mediumHierarchy, iterateFunction

Not adding types until/unless it becomes an actual change.

"Therefore it is in the interests not only of public safety but also public sanity if the buttered toast on cats idea is scrapped, to be replaced by a monorail powered by cats smeared with chicken tikka masala floating above a rail made from white shag pile carpet."

Return to “Forum Games”

### Who is online

Users browsing this forum: Majestic-12 [Bot], solune, Vytron and 33 guests