FFFF

From Esolang
Jump to navigation Jump to search

FFFF or Formulate Finite Fields Fractionally. Is a finite state machine programming language using fractions created by user RainbowDash in 2025.

Computing

You will have a 2D array of any size initialized with all ones, depending on how large you want your fractions to get. There is only one register, and at the start you can initialize it to a fraction or an integer.

Now the computing works by getting the register, and asking the user for a number. It will then divide the register by that number and create a fraction and simplify that fraction such as 1/2. That maps to [1,2] on the 2D array. It will then go to [1,2] on the array and retrieve the number inside of it. It will then take that number and divide the register by it then simplify the fraction. It will then ask the user for a number and the cycle repeats.

1 2 3 4 5
1 1 1 1 1 1
2 1/2 1 1 1 1
3 1 1 1 1 1
4 1 1 1 1 1
5 1 1 1 1 1

Above is a 2D array map for an infinite loop program. If you input the number 1, it will continue to return 1 unless you input some other number, in that case the program breaks.

Syntax

A sample file looks like this

1
1/2 :: 3/2
2/1 :: 3/2

The lone number 1 can be set to a fraction or an integer. This determines what value the register starts at.
1/2 :: 3/2 means at [1,2] set the 2D array to 3/2.

Example FSM encoding.

Say we want to make the fsm

The resulting program would be

1
1/1 : 1/2
2/3 : 2/3

Where state A is encoded by the output fraction 1/1 while state B is encoded by the output fraction 2/1.

How to convert to any FSM

To convert to any FSM. We must use only prime numbers. Prime numbers for the states and prime numbers for the input symbols. Nothing can share a prime number, states can not use the same prime numbers as input symbols.

Now given a list of primes

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

To recreate the example FSM from the Example FSM encoding section. We can designate

State Designation
A 2
B 3
Symbol Designation
1 5
2 7
3 11

Then we can apply this rule.


Where current_state_prime is the current state input_prime is the transition symbol and target_state_prime is the state you are transitioning to. Make sure to convert it into a fraction and simplify it.
The end format for a state transition looks like

STATE/SYMBOL :: ARRAY_VALUE

Since A is our starting state we will set the register to 2 at the start.
The converted FSM looks like this.

2
2/5 :: 2/15
3/7 :: 1/7
3/11 :: 3/22

So to explain the program above.

State Symbol Target State Calculation Output Line Code
A (2) 1 (5) B (3) 2 / (5 × 3) = 2/15 2/5 :: 2/15
B (3) 2 (7) B (3) 3 / (7 × 3) = 3/21 = 1/7 3/7 :: 1/7
B (3) 3 (11) A (2) 3 / (11 × 2) = 3/22 3/11 :: 3/22

Implementation

FFFF/Implementation