An index of the tests that show DESIGN.md's features working together, for a reader arriving cold. Written by a Claude session, not by the owner: each entry says what its test does, and the test is the evidence, so a claim here that the test does not make is a mistake in this file.
tests/io_lift.sl— twoPrograms at two levels embedded in a program at a third, at no runtime cost. An erased factory mints the program's level;delegatemints aDelegate, read as aCoerciblebetween continuations whose types differ in level and result;coercible-ctorlifts it through each step with the erased level index differing on the two sides; the user'scoerceerases to nothing, and the extracted OCaml holds only the original values.tests/io_lift_runtime.slis the same embedding by rewrapping, one closure per step. Together they are the fullest exhibit of levels, erasure,delegateandcoercedepending on each other.tests/lt_subterm.sl—Lt a bandSubterm (Nat) a (Nat) beach derive the other, as erased functions, so onNatthe subterm order is the strict order. ItsloopreturnsFalsefromSubterm x xby a self-call the proof licenses, soSubtermirreflexivity appears load-bearing for consistency in the way ASSUMPTIONS 69 describes forPredates; whether that deserves a stated invariant is open for the owner.tests/lt_subterm_bad.slis the steple-splitexists for.tests/div.slandtests/div_structural.sl— division by repeated subtraction in two shapes: recursing on the subtraction's result under aSubtermproof the subtraction returns, and structural recursion on the dividend alone. The first is the pattern for well-founded recursion on any computed smallerNat.tests/gcd.sl— Euclid's algorithm; the recursive call is justified bylt-subapplied to the remainder's bound, so it uses the interderivation.tests/compose_list_dynamic.sl— folding a list of functions into one function, each step minting a level at runtime above the one the recursive call returned, with thePredatesproofs minted beside it. The tower of levels is as tall as the list and exists only when the program runs.tests/compose_list.slis the defunctionalized form, the list kept as data under one interpreter, whose composed closure sits at one fixed level.tests/runtime_level_bad.sl— the same composition called from a function body is refused: a level minted inside the call cannot be proved to predate the caller's, so in this test the composed function is callable only from run position.tests/stream.sl— a stream with no coinductive type, its tail a function at a level minted after the producer's.tests/gmap.sl— a map generic over every type withList's constructor shape, through first-classTyCtor,ValCtorandMatchablevalues; the shape is fixed by the signature.tests/packed_bound.slandtests/packed_list_predates.sl— functions at different levels in one list, with the levels erased: either each package proves its level below a bound, or the consumer takes a proof that the list predates its level andpredates-subtermwalks it down to each function.tests/packed_unbound_bad.slhas neither, andtests/packed_runtime_list_bad.slbuilds the list after the consumer's level was minted, where the list-level proof is refused.tests/recursion_through_pointer.sl— a function receiving itself inside a type with a negative occurrence and calling the pointer at its own level under a subterm decrease;tests/ackermann.slfor the lexicographic order across two subterm arguments.tests/nub.sl— recursion on a computed vector rather than a subterm: the filter returns an erased bound on the result's length, the recursion is on the erased length index, andlt-subturns the bound into theSubtermproof, at no runtime cost.tests/type_result_is.slandtests/type_result_cases.sl— a type computed by a call, made usable by anisreturn entry, and a closed existential whose erased type is fixed by matching a runtime witness beside a value of it.tests/eq_transport.sltransports along a user-defined equality by matchingRefl, with no substitution principle.tests/map.sl— DESIGN.md section 57, level-polymorphicmapthrough a factory that mints the level and proves the relation inside.tests/coerce.slandtests/delegate_coerce.sl— section 60, unwrapping a list of newtypes by an erased recursive proof and acoerce, and adelegatewhose argument and result pass through coercions.tests/char_ops.sl— the prelude'schar-cmp, a comparison ofChars that isu62-cmpon their codes. ACharis itsU8and aU8itsNatat runtime, so the arguments coerce down through both newtypes (coercible-wrapreversed withcoercible-sym, the two steps chained), the call tou62-cmpis markeddelegate, and theCoerciblecarrying the result back up toCmp (Char) CharLt a bis built by an erased match on the three outcomes, so nothing but the marked call is left to run. The test fetches withdelegate-ofthe proof the mark minted thatchar-cmpandu62-cmpare one function, reads theCoercibleoff it withcoercible-of, coerceschar-cmpto theNatsignature, and runs it both on characters and onNats with their bound proofs.tests/cell_rev_inplace.sl,tests/cell_rotate.slandtests/cell_map_retype.sl— algorithms that reuse the cells their unique destructures hand back (DESIGN.md sections 23, 37), besidetests/cell_append.sl's tail call modulo cons. The first is pointer reversal, one store per node under an(at)that skips the head slot; the second rotates a tree by reinvoking both the outer node's cell and its left child's; the third maps(ULst (Nat))to(ULst (Tag)), a cell being tied to its value constructor but not to the type constructor's arguments, withTaga newtype so the elements need no wrapper either.tests/cell_retype_ctor_bad.slis the step a cell does not take, a block rewritten as a different constructor's of the same non-erased arity.tests/cell_rev_certified.slandtests/cell_rotate_certified.sl— the same two algorithms carrying a relation about their result: reversal'sRevOntoand rotation'sFlatOnto, both in difference-list form, which is what lets rotation's derivation be rebuilt from its argument's with no lemma about appending. Each relation's indices name cells the algorithm overwrites, which an erased mention may do after the binder is consumed (section 15), and every entry of both proofs is declared erased (section 14).tests/cell_at_not_is_bad.slis the step that separates them: the result isatits argument and notisit, so a relation proved of the argument beforehand is refused where one about the result is wanted. It is the converse oftests/at_is_independent_bad.sl.tests/unique_typestate.sl— a handle whose erased index records its protocol state and whose operations consume it, so the index fixes the order and uniqueness stops a spent handle being reused. Each transition reinvokes the handle's own cell, anddo-open, which changes nothing but the index, is a full-at invocation returningatits argument.tests/unique_typestate_bad.slskips a step;tests/unique_double_bad.slis the other half.tests/placed_thread.sl— a value passed through a function that knows only its slot (DESIGN.md section 66).goplaces its parameternand hands thePlacedvalue tobump, whose signature names only an erased(Slot) s;bumpunplaces it, updates it in place through its cell and places it again, usingplaced-slotto keep the indexs; andgounplaces the result and usesplaced-slotonce more to return itat n.tests/placed_slot_missing_bad.slleaves out that last step.tests/subterm_call_result_bad.sl— a field is a subterm of what it was destructured from and a call's result is not (DESIGN.md section 28), so a recursive occurrence reached by calling a stored function does not drive recursion the waytests/recursion_through_pointer.sl's stored function does when the decreasing argument is a field.tests/vec_map.slandtests/binder_clash.sl— dependent motives checked under each branch's forced facts, and a branch refuted because a constructor's index mentions its ownFnbinder (DESIGN.md section 7).tests/absurd.sl,tests/absurd_proof.sl,tests/transparent_union.sl— absurd functions and branches, and a union whose other constructor is refuted by proof so the type is represented as its one field.tests/refute.sl,tests/refute_noprelude.sl— absurd bodies ending in a match annotated_whose branches are all absurd, in a value whose type no constructor can head, or in(open-absurd m _), with alet-matchbefore the final value;tests/refute_*_bad.slare what is refused.tests/else_enum.sl,tests/else_phantom.sl,tests/absurd_implicit.sl— anelsedispatching on a tag, one standing only for a phantom constructor and so counting as no real branch, and refuted constructors left unlisted.tests/phantom_false_bad.slis why a phantom branch still owes its value: omitted, it would proveFalse.tests/comptime.slandtests/comptime_transparent.sl—comptime-matchverifying aSettledand binding its fieldsSettled, proof by reflection.tests/native_compute.sl— the reflection oftests/u8.slwith the decision compiled:native-computerunslt-decas extracted OCaml and reads back aDecwhose fields are all erased, andcomptime-matchtakes the proof out of it.tests/native_compute_macro.sl— a macro that reads aSettledlist of bounds and spreads it into onenative-compute, one compiled decision per bound, each function's type depending on its bound.tests/comptime_tail.sl— a loop run at elaboration whose measure is erased. A non-erased binary counter drives the dispatch, while thesubtermdecrease is taken on an erasedNattied to that counter by the prelude'sNumeral, stepped bynumeral-succand cashed in through theEqit returns — DESIGN.md section 21's subterm recursion through an erased argument — so the iterations build no unaryNatand cost the same with the externNatas without it.tests/extern_tail.slis a loop of the same shape run by the extracted program rather than at elaboration.tests/first_class.slandtests/shadow_false_capture.sl— matching through first-class type and value constructors and aMatchable, opened first, and a function keeping the emptyFalseit was defined against after the name is shadowed by an inhabited one.tests/open_absurd.sl,tests/open_adt_unify.sl,tests/open_tyctor.sl— opening aMatchable(DESIGN.md section 8): a contradiction between two constructors held as a fact until theMatchablelisting both is opened, cashed in byopen-absurdor refuting the branch when the open comes first; twoMatchables sharing a constructor unified by opening both, which equates their type constructors; and a first-class type constructor that unifies withNatuntil itsMatchableis opened and its constructors' signatures tell the two apart.tests/unopened_matchable_bad.slandtests/open_adt_branch_bad.slshow a match finding nothing unopened and an open ending with its branch, andtests/open_adt_let.slan open inside alet's right-hand side serving the matches after it.tests/main_reverse.sl,tests/io_echo.sl,tests/thunk_list.sl— the three ways a final value is run by the driver, andtests/tail_values.slfor a checked tail call over multiple returns.tests/io_step.sl— iterating without recursing. A loop hands its next step to the driver as aContinueinstead of calling itself: one loop's continuation performs nothing, and another's writes and nothing else. The continuation is adef-uniqueclosure at the program's level, which comes after the looping function's own, so no function in the program can call it and the unbounded iteration stays the driver's; the step it is stored in consumes it, so each step wraps a fresh one.tests/io_unique_state.sl— a continuation owning a unique value across steps: a counter captured at unique by each step's continuation, updated in place through its cell as lines arrive, and read off at the end.tests/io_continuation_twice_bad.slandtests/io_shared_final_bad.slshow a continuation refused twice and a sharedProgramrefused as a program.tests/world_twice_bad.sl,tests/world_shared_bad.sl,tests/world_kept_bad.sl,tests/world_unboxed_bad.sl— the world refused for a second request, once shared, kept by a continuation for a later step, and taken out of a box that is not a newtype and so is no longeratthe world it came from.tests/world_erased.slshows aworld-doin an erased position performing nothing.tests/prove_literal_lt.sl,tests/numeral_succ.sl,tests/unary_constant.sl,tests/numeral_lemmas.sl— reasoning about literals, whoseNats are opaque. The prelude's macroprove-literal-ltgives anLtbetween two constants, which withlt-asymrefutes a branch that has equated them; its macrounaryrewrites a constant to successor form, walking only as far as the floor it is given, which is what lets one index aVec, and the third test gives it a computed constant. The fourth reasons through the prelude'sNumeralrelation by hand:numeral-succover aBinSuccwitness, andnumeral-injrefuting a branch.tests/bare_call.sl,tests/bare_lex.sl— calls with no decrease annotation (DESIGN.md section 48): the first has aPredatesproof and aSubtermproof inferred beside a written_; the second istests/ackermann.slwith nothing written, the inferred position being the firstsubtermargument that differs from its counterpart.tests/bare_lex_bad.slshows there is no search: a first argument that grows is refused although the second decreases.tests/wild_ctor.sl,tests/wild_call.slandtests/wild_is.sl—_for an erased argument (DESIGN.md section 50): a constructor's type argument solved from the field after it, from the telescope a body returns into throughvalues, and from a match's annotation; a call's type argument solved from a later argument or from the results' expected telescope; anis-entry's value taken by_, and a_inside a pinned field solved through the value expected.tests/wild_fn_binder.slsolves one under aFnbinder,tests/wild_erased_many.slputs one at amanyparameter in an erased position,tests/wild_match_ann.slwrites a match's_annotation at an argument position, andtests/wild_let.sllets typedletbinders solve the right-hand side.tests/wild_open.slhas a constructor's_solved by the argument after it in the enclosing call, andtests/wild_partial_ann.sla match annotation and a let binder type with_s inside them,tests/wild_bare_hole.sla bare_entry,tests/wild_later_arg.sla_at amanyparameter of an erased call solved by the proof argument after it,tests/wild_is_alias.slanisreturn instantiated with an alias-typed argument and fed to a_solved through anisfield, withtests/wild_is_alias_bad.slshowing the canonical type printed for such a value, andtests/wild_special_bad.sla special form refusing an open_. The refusals:tests/wild_nested_bad.sl((len _ (Nil _)), the inner)first),tests/wild_ambiguous_bad.sl,tests/wild_many_bad.sl,tests/wild_mismatch_bad.sl,tests/wild_match_ann_bad.slandtests/wild_type_bad.sl.tests/dump_context.sl—(dump-context)in theConsbranch of DESIGN.md section 61'sappend-into, after the tail call: the report shows the goal(many (List A) r at cell), the scrutinee's forced rule, the cell consumed by the write and the fresh one consumed by the call, the live written cell, and the at-database's classes.tests/dump_context_top.slis the same form as a top-level statement overSettledvalues, aunaryrule and a shared unique;tests/dump_context_focus.slnames what to report and has a_still open in the goal;tests/dump_context_type.slandtests/dump_context_stmt.slput it in a type and in an erased body;tests/dump_context_empty.slis the form alone in a file, where the prelude's entries are listed;tests/dump_context_erased_fns.slfollows a run-positiondef-fnswhose erased function andDelegateproof are listedSettled.tests/macro_read_file.sl— a macro that splices in the text oftests/macro_read_file_data.slas a string literal. Its path arrives as a literal, so as a handle, whose type the macro checks withsettled-eqbefore reading its value; it reads withread-fileat its own call's position and interns the text. The same test shows the refusals of a path outside the directory, ofNoPosand of a position that names no source.tests/macro_symbol_eq.slcompares names and gensyms withsymbol-eq.tests/tactic_lt_lemma.sl— a proof tactic written as a macro,lt-lemmafromstd/tactics.sl. It takes a lemma's whole signature and reads theLt,NatLe,AddandDoublehypotheses and the goal from it as syntax, each side as a base term under some number ofSuccs. Each hypothesis is an edge between two bases, or two for an(Add a b c), one fromaand one frombtoc, carrying its proof as anLtbetween the two sides, a non-strict one as anLtto theSuccof its upper side; the tactic searches for a path between the goal's bases, joins its edges withlt-le-trans, movesSuccs across a proof withLtSand withlt-predfromstd/nat.sl, and weakens the result to the goal withlt-succ-leftandlt-weaken. It then emits thedef-fnswith that proof as its body, which is checked like any other definition. The test covers chains, aSuccadded to or peeled off both sides, unevenly too, and a chain whose links differ in theirSuccs.tests/tactic_ne_false_lemma.slcovers the other two goals and the other two hypotheses: an(Ne a b)goal is proved by a chain either way, wrapped inNeLtorNeGt, and a(False)goal by a chain from an edge back to its own start whoseSuccs make it an(Lt x x), closed bylt-irrefl;(Add a b c)and(Double a b)hypotheses step throughadd-le-left,add-le-rightanddouble-le.tests/tactic_false_lemma_bad.slis a cycle of non-strict steps, andtests/tactic_ne_lemma_bad.slanNethe hypotheses allow to fail.tests/tactic_le_lemma.slcoversNatLe: each way of joining a strict and a non-strict step,(NatLe a a)from no hypotheses, a weakenedLtandNatLeunderSuccs;tests/tactic_le_lemma_bad.slis twoNatLesteps offered for anLtgoal. It checks theLtandSuccheads against the prelude's throughresolveandsettled-eq, so thealiasedlemma'sSpasses, and it emits the names it uses as handles, so thehygieniclemmas, whose parameters shadow them, still check.tests/tactic_lt_lemma_bad.slis a goal the hypotheses do not imply;tests/tactic_lt_lemma_head_bad.slis a goal whose head is none of the four;tests/tactic_lt_lemma_gensym.slhas another macro write the call with every variable a gensym, which the search matches through the prelude'ssymbol-eq.tests/dag_sum.sl— summing a tree of Peano naturals as a DAG, certified against aTreeSumrelation.same-treeandsame-nare at-functions that turn two trees, or two numbers, at one slot into an(ErasedOr (Eq T a b)): each pair of cells goes throughcell-same, which refutes a mismatched pair of constructors and equates the fields' slots for the recursive calls. The calls are skipped, so as far as this test shows the proof adds no runtime work.dag-summemoizes byslot-eqover a list and, on a hit, moves the remembered sum's proof to the new tree along that equality. A tower of 200 levels ofNode s s, 2^200 leaves read as a tree but 201 distinct nodes, is summed this way, whilenaive-sum, checked against the same relation, agrees with it at 12 levels.tests/dag_sum_slots.sl—tests/dag_sum.slmemoized throughSlotsand an array, so a memo lookup is O(1) rather than an O(n) search of a list. The table hands back the tree it holds at the looked-up slot, so a memo entry keeps only the sum and its proof, not a copy of the tree.tests/slots.sl— the prelude'sSlots(DESIGN.md section 69) turning identity into a number and back.recoverinterns one box, interns a second, and looks a third up; when the third's number equals the first's,nth-last-suffixcarries the first box'sNthLastproof past the second intern,nth-last-fnequates the two slots, and sorecovercan return the third box where its signature promises a resultatthe first.tests/slots_dag.sl— counting the distinct nodes of a 20000-node DAG by interning each node in aSlotsand skipping the subtree of any already there.