This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize
for the AI-speak, we are working on rewriting it!
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.
[1]lines 1–34
# Generated by tools/algo/check.py from lib/algo/algo.spec: do not edit.# Each case prints its input (= X), its results, and the verdict of each postcondition# (? ...) as lib/algo/props.viv computes it; check.py checks them again in Python.from algo.cases import algo_case, CASE_NAMES
from algo.props import algo_is_factorial_count
from algo.legacy.permutations import generate_all_permutations
#| ta_permutations: TheAlgorithms all_permutations.py (backtracking), printed with `show`defalgo_t_ta_permutations(kind, n, inside, skip:Arr) ->Bool {
X =algo_case(kind, n, 1+97* kind + n)
print("@ ta_permutations", CASE_NAMES[kind], n)
F =generate_all_permutations(X, false)
print("= X", fmt(X))
print("= F", F)
p0 =algo_is_factorial_count(F, X)
print("?", p0)
return inside ==0or ((p0 or skip[0] ==1))
}
algo_t_ok_ta_permutations =true
algo_t_kinds_ta_permutations = [0.0, 1.0, 4.0]
algo_t_inside_ta_permutations = [1.0, 1.0, 1.0]
algo_t_sizes_ta_permutations = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]
algo_t_skip_ta_permutations = [0.0, 0.0, 0.0]
for algo_t_k tolen(algo_t_kinds_ta_permutations) {
for algo_t_s tolen(algo_t_sizes_ta_permutations) {
algo_t_r =algo_t_ta_permutations(algo_t_kinds_ta_permutations[algo_t_k], algo_t_sizes_ta_permutations[algo_t_s], algo_t_inside_ta_permutations[algo_t_k], algo_t_skip_ta_permutations[algo_t_k *1:(algo_t_k +1) *1])
algo_t_ok_ta_permutations = algo_t_ok_ta_permutations and algo_t_r
}
}
test"ta_permutations: factorial-count F X (kinds random dups equal)" {
assert_true(algo_t_ok_ta_permutations)
}