diff options
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | cache.md | 8 | ||||
-rw-r--r-- | cache.pickle | bin | 8480 -> 9465 bytes | |||
-rw-r--r-- | cannot_solve.md | 6 | ||||
-rw-r--r-- | solve.py | 8 |
5 files changed, 33 insertions, 1 deletions
diff --git a/README.md b/README.md index 11a1f5b..4ea1973 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,18 @@ format: ((s, t), (goal_s, goal_t)) ['(v1)', '(v2)', '(v3)', ...] ``` +## Cannot Solve + +Caching implemented, view the current cache here: [cache.md](./cache.md) + +Input expressions that cannot be solved are logged here: [cannot_solve.md](./cannot_solve.md) + +format: + +``` +(s) | (t) +``` + ## Challenge Description diff --git a/cache.md b/cache.md index fda0d45..0fe5b8f 100644 --- a/cache.md +++ b/cache.md @@ -1,4 +1,5 @@ # cache + ``` (('(λa. a a)', '(λa b. a a)'), ('(λx y. x)', '(λx y. y)')): ['(λp. p (λe f. f) (λc d. c))', '(λb a c c. (λc d. c))', '(λp. p (λe f. f) (λc d. c))', '(λa b. b)', '(λa b. b)'] (('(λa. a a)', '(λa b. a b)'), ('(λx y. x)', '(λx y. y)')): ['(λa b. b)', '(λp. p (λe f. f) (λc d. c))', '(λa b. b)'] @@ -68,4 +69,11 @@ (('(λa b c. a (a b))', '(λa b c. a (a a))'), ('(λx y. x)', '(λx y. y)')): ['(λa b. b a b)', '(λa b. b b a)', '(λb a c c. (λc d. c))', '(λa b. a)', '(λa b. a)', '(λa b. a)', '(λa b. b)'] (('(λa b. a (b b))', '(λa b. a λc. b c)'), ('(λx y. x)', '(λx y. y)')): ['(λa b. a a a)', '(λa b. a)', '(λa b. a b a)', '(λa b. b)', '(λc d. c)'] (('(λa. a a a)', '(λa b c. a c)'), ('(λx y. x)', '(λx y. y)')): ['(λc d. c)', '(λc d. c)', '(λb. (λe f. f))', '(λa b. a)', '(λa b. a)'] +(('(λa b. a (a b a))', '(λa b c. a (a a))'), ('(λx y. x)', '(λx y. y)')): ['(λa b. b)', '(λb a c c. (λc d. c))', '(λa. (λc d. c))', '(λa b. b)'] +(('(λa b. a (b b) a)', '(λa b c. a (b c c) a)'), ('(λx y. x)', '(λx y. y)')): ['(λa b. a)', '(λc d. c)', '(λb a c c. (λc d. c))', '(λa b. b)', '(λa b. b)', '(λa b. b b a)', '(λa b. b)', '(λa b. b)', '(λa b. a)'] +(('(λa b. a a (a a))', '(λa b c. a a (c c))'), ('(λx y. x)', '(λx y. y)')): ['(λc d. c)', '(λa b c. a c a a)', '(λa b c. b c a b)', '(λa b. a)', '(λa. (λc d. c))', '(λa b. b)', '(λb a c c. (λc d. c))'] +(('(λa b. a (a a a))', '(λa b c. a (a a c))'), ('(λx y. x)', '(λx y. y)')): ['(λa b. b)', '(λa. a)', '(λa. (λc d. c))', '(λa b. b)'] +(('(λa b c. c c)', '(λa b c. b a a)'), ('(λx y. x)', '(λx y. y)')): ['(λb. (λe f. f))', '(λa b c. c a a a)', '(λa b. a)', '(λa b. b)'] +(('(λa b. a (a a b))', '(λa b c. a (a a a))'), ('(λx y. x)', '(λx y. y)')): ['(λa b. a)', '(λa b c. b c c c)', '(λa b. a)', '(λa b. b)', '(λb. (λe f. f))', '(λb. (λe f. f))', '(λa b. a)'] +(('(λa b. a a a)', '(λa b. a a b)'), ('(λx y. x)', '(λx y. y)')): ['(λa. a)', '(λp. p (λe f. f) (λc d. c))', '(λa b. a)'] ``` \ No newline at end of file diff --git a/cache.pickle b/cache.pickle index 3ffa233..8716e2f 100644 --- a/cache.pickle +++ b/cache.pickle Binary files differdiff --git a/cannot_solve.md b/cannot_solve.md new file mode 100644 index 0000000..711ce17 --- /dev/null +++ b/cannot_solve.md @@ -0,0 +1,6 @@ +# cannot solve + +``` +(λa b. a (a b b)) | (λa b. a λc. a a) + +``` \ No newline at end of file diff --git a/solve.py b/solve.py index 816340d..5a62db4 100644 --- a/solve.py +++ b/solve.py @@ -653,7 +653,13 @@ while True: level += 1 except: print("SOMETHING WENT HORRIBLY WRONG!") + print(f"CANNOT SOLVE {s=} {t=}") + cannot_solve = open("cannot_solve.md", "a") + cannot_solve.write(f"# cannot solve\n\n```\n") + cannot_solve.write(f"{s} | {t}\n\n") + cannot_solve.write(f"```") + print(f"level {level}, cache hits: {cache_hits}") try: del cache[last_added_to_cache] @@ -666,7 +672,7 @@ while True: pickle.dump(cache, handle, protocol=pickle.HIGHEST_PROTOCOL) cache_human_readable = open("cache.md", "w") - cache_human_readable.write(f"# cache\n```\n") + cache_human_readable.write(f"# cache\n\n```\n") for k in cache: cache_human_readable.write(f"{k}: {cache[k]}\n") print(k) |