JPP: Added WIP test case for gobel number mapping
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 49s
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 49s
This commit is contained in:
parent
423b2b2fa9
commit
36a6929aee
2 changed files with 491 additions and 56 deletions
|
|
@ -62,14 +62,17 @@ The formula "Zn+1=Zn2+C" in a PM-compatible style might look like:
|
|||
|
||||
Gödel assigned the following values to his constant signs:
|
||||
|
||||
* zero = 1
|
||||
* fun = 3
|
||||
* not = 5
|
||||
* ven = 7
|
||||
* van = 9
|
||||
* lbr = 11
|
||||
* rbr = 13
|
||||
* is = 5*
|
||||
```
|
||||
private static final Map<Integer, String> STRICT_1931_MAP = Map.of(
|
||||
1, "0", // 0 = Zero
|
||||
3, "f", // 𝘴 = Successor
|
||||
5, "~", // ¬ = Negation (NOT)
|
||||
7, "v", // ∨ = Disjunction (OR)
|
||||
9, "pi", // ∀ = Universal quantifier (For all)
|
||||
11, "(", // ( = Left parenthesis
|
||||
13, ")" // ) = Right parenthesis
|
||||
);
|
||||
```
|
||||
|
||||
*Note: In his original paper, Gödel primarily focused on a system with successor, but later extensions added =,+, and * as constant signs.
|
||||
|
||||
|
|
@ -105,7 +108,7 @@ This number is unfathomably larger than the previous one, as the exponents thems
|
|||
|
||||
## Mandelbrot Sequence Search
|
||||
|
||||
Mandelbrot Gödel number;
|
||||
(fake-example) Mandelbrot Gödel number;
|
||||
|
||||
683505876359950041159216395292418218643723548897506786765531772046527226636478552969268654443353250389915930385563708788491517027407860457492594921188896142308121054502817356554744425581825883892148702715030604280860100517232762642163389221976134018668275595000517989293393564980042093763809452107500000000000000000
|
||||
|
||||
|
|
@ -131,50 +134,4 @@ Here are the three steps to decode it:
|
|||
* 2. Extract the Exponents
|
||||
* 3. Map Back to Symbols
|
||||
|
||||
In java unit test this looks like;
|
||||
|
||||
```
|
||||
@Test
|
||||
public void testDecodeGodelNumber() {
|
||||
// Example: Encoding (Z, n, +) where Z=17, n=19, +=15
|
||||
// G = 2^17 * 3^19 * 5^15
|
||||
BigInteger godelNumber = new BigInteger("4649045868000000000000000");
|
||||
|
||||
List<Integer> decodedSymbols = decode(godelNumber);
|
||||
|
||||
// Assert the exponents match the original sequence
|
||||
Assertions.assertEquals(List.of(17, 19, 15), decodedSymbols);
|
||||
|
||||
// test resolved mandelbrot;
|
||||
BigInteger mandelBrotNumber = new BigInteger("683505876359950041159216395292418218643723548897506786765531772046527226636478552969268654443353250389915930385563708788491517027407860457492594921188896142308121054502817356554744425581825883892148702715030604280860100517232762642163389221976134018668275595000517989293393564980042093763809452107500000000000000000");
|
||||
List<Integer> mandelBrotSymbols = decode(mandelBrotNumber);
|
||||
Assertions.assertEquals(List.of(17, 11, 19, 3, 13, 5, 11, 17, 19, 13, 17, 11, 17, 19, 13, 15, 23), mandelBrotSymbols);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a Gödel number by finding the exponent of each prime factor.
|
||||
*/
|
||||
private List<Integer> decode(BigInteger g) {
|
||||
List<Integer> symbols = new ArrayList<>();
|
||||
BigInteger prime = BigInteger.valueOf(2);
|
||||
|
||||
// Loop through primes until the remaining number is 1
|
||||
while (g.compareTo(BigInteger.ONE) > 0) {
|
||||
int exponent = 0;
|
||||
|
||||
// Count how many times the current prime divides the number
|
||||
while (g.remainder(prime).equals(BigInteger.ZERO)) {
|
||||
g = g.divide(prime);
|
||||
exponent++;
|
||||
}
|
||||
|
||||
if (exponent > 0) {
|
||||
symbols.add(exponent);
|
||||
}
|
||||
|
||||
// Move to the next prime
|
||||
prime = prime.nextProbablePrime();
|
||||
}
|
||||
return symbols;
|
||||
}
|
||||
```
|
||||
In java unit test this looks like see [NumberGobelTest](../../../../nx01-jpp-base/src/test/java/ᒢᐩᐩ/ᒡᒢᑊᒻᒻᓫᔿ/ᣳᣝᐤᣜᣳ/ᔿᣔᐪᣗᑊᕁ/NumberGobelTest.java)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue