Documentation

Examples.Language.LinkedList

Native linked-list programs and named node operations #

The author writes one optional-root match and one ref.read. The generated source body is definitionally the public linked-list operation, so its existing mathematical contract and refinement apply directly. The generated uncons_eq observes the same read through NodeRef.readM; no host list traversal or second machine proof supplies its behavior. Construction similarly writes one NodeRef.cons, reuses the public cons contract, and retains the exact new heap and fresh root. A singleton demonstrates inference of an absent tail's type.

The native family accepts ordinary List Nat arguments. One declaration generates a mathematical function and an actual node-backed source function; its refinement is generated without an author-written traversal proof. Constant initial values, reordered parameters, consecutive folds and calls to earlier native functions use the same correspondence construction. Mathematical sum proofs use existing List algebra and do not mention source environments.

NativeConstruction also returns ordinary lists. Its generated source allocates real nodes, shares tails and composes calls at their actual intermediate heaps. The mathematical proofs remain ordinary list equations; the final consumer observes both an old list and its new extension after allocation.

@[reducible, inline]
abbrev Complexity.Language.Examples.LinkedList.Reducer.add_onArgs {α✝ : Sort u_1} :
(ℕ → ℕ → α✝) → Env [Ty.nat, Ty.nat] → α✝

Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

Equations
Instances For
    theorem Complexity.Language.Examples.LinkedList.Reducer.add_total :
    FunctionTotal program addId (fun (x : Env signatures[addId].params) (x_1 : Heap) => True) fun (arguments : Env signatures[addId].params) (initialHeap : Heap) (value : Value signatures[addId].result) (finalHeap : Heap) => value = add arguments.head arguments.tail.head ∧ finalHeap = initialHeap

    Exact total source contract inherited from the generated native function.

    theorem Complexity.Language.Examples.LinkedList.Reducer.add_action_eq (accumulator head : ℕ) :
    add_action accumulator head = pure (accumulator.add head)

    One source-body equation in ordinary monadic notation; named callees remain opaque.

    Executable total value function generated from the same buffer-free source block.

    Equations
    Instances For

      Fold an actual source invocation back to its named ordinary-argument observation.

      theorem Complexity.Language.Examples.LinkedList.Reducer.add_action_eq_pure (accumulator head : ℕ) :
      add_action accumulator head = pure (add accumulator head)

      The actual source action terminates with the generated native result and preserves every initial heap. Lean's native recursion principle proves this once.

      theorem Complexity.Language.Examples.LinkedList.Reducer.add_spec {pre✝ : Env [Ty.nat, Ty.nat] → Heap → Prop} {post✝ : Env [Ty.nat, Ty.nat] → Heap → ℕ → Heap → Prop} :
      FunctionTotal program addId pre✝ post✝ → ∀ (accumulator head : ℕ) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons accumulator (Env.cons head Env.empty)) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons accumulator (Env.cons head Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ add_action accumulator head ⦃continuation⦄

      Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

      theorem Complexity.Language.Examples.LinkedList.Reducer.add_contract_iff_triple (pre✝ : ℕ → ℕ → Heap → Prop) (post✝ : ℕ → ℕ → Heap → ℕ → Heap → Prop) :
      add_contract pre✝ post✝ ↔ ∀ (accumulator head : ℕ) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ accumulator head initialHeap }⦄ add_action accumulator head ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ accumulator head initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

      Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

      The finite table of actual named source bodies.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[reducible, inline]

        The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

        Equations
        Instances For

          The named function's actual independently interpreted source body.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem Complexity.Language.Examples.LinkedList.Reducer.add_total_iff (pre✝ : ℕ → ℕ → Heap → Prop) (post✝ : ℕ → ℕ → Heap → ℕ → Heap → Prop) :
            add_contract pre✝ post✝ ↔ ∀ (accumulator head : ℕ) (initialHeap : Heap), pre✝ accumulator head initialHeap → ∃ (value : ℕ) (finalHeap : Heap), add_action accumulator head initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ accumulator head initialHeap value finalHeap

            The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

            @[reducible, inline]

            Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem Complexity.Language.Examples.LinkedList.add_eq (accumulator head : ℕ) :
                Reducer.add accumulator head = accumulator + head

                A named fold callback is an ordinary mathematical function generated from the same source body as its executable implementation.

                @[reducible, inline]

                Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[reducible, inline]

                    The source program's declared first-order signatures.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      The named function's actual independently interpreted source body.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        theorem Complexity.Language.Examples.LinkedList.Implementation.Source.uncons_eq (root : Option (NodeRef CellTy.nat)) :
                        uncons root = match root with | none => pure none | some payload => do let fields ← payload.readM pure (some fields)

                        One source-body equation in ordinary monadic notation; named callees remain opaque.

                        @[reducible, inline]

                        The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                        Equations
                        Instances For
                          theorem Complexity.Language.Examples.LinkedList.Implementation.Source.uncons_spec {pre✝ : Env [(Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option] → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Prop} :
                          FunctionTotal program unconsId pre✝ post✝ → ∀ (root : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (ℕ × Option (NodeRef CellTy.nat))) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons root Env.empty) initialHeap ∧ ∀ (value : Option (ℕ × Option (NodeRef CellTy.nat))) (finalHeap : Heap), post✝ (Env.cons root Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ uncons root ⦃continuation⦄

                          Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                          Fold an actual source invocation back to its named ordinary-argument observation.

                          theorem Complexity.Language.Examples.LinkedList.Implementation.Source.uncons_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Prop) :
                          uncons_contract pre✝ post✝ ↔ ∀ (root : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ root initialHeap }⦄ uncons root ⦃(fun (value : Option (ℕ × Option (NodeRef CellTy.nat))) (finalHeap : Heap) => { down := post✝ root initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                          Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                          theorem Complexity.Language.Examples.LinkedList.Implementation.Source.uncons_total_iff (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Prop) :
                          uncons_contract pre✝ post✝ ↔ ∀ (root : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ root initialHeap → ∃ (value : Option (ℕ × Option (NodeRef CellTy.nat))) (finalHeap : Heap), uncons root initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ root initialHeap value finalHeap

                          The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                          Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            The finite table of actual named source bodies.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              @[reducible, inline]

                              Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                              Equations
                              Instances For

                                The high-level declaration generates exactly the already verified source body.

                                theorem Complexity.Language.Examples.LinkedList.uncons_total (values : List ℕ) :
                                Implementation.Source.uncons_contract (fun (root : Option (NodeRef CellTy.nat)) (heap : Heap) => (Representation.list CellTy.nat).Rel values root heap) fun (x : Option (NodeRef CellTy.nat)) (initial : Heap) (result : Option (ℕ × Option (NodeRef CellTy.nat))) (finish : Heap) => (List.Uncons.resultRepresentation CellTy.nat).Rel (Option.map (fun (head : CellValue CellTy.nat) => (head, values.tail)) values.head?) result finish ∧ finish = initial

                                The public operation's contract applies without another implementation proof.

                                theorem Complexity.Language.Examples.LinkedList.uncons_spec (root : Option (NodeRef CellTy.nat)) (values : List ℕ) (initial : Heap) :
                                ⦃fun (heap : Heap) => ⌜heap = initial ∧ (Representation.list CellTy.nat).Rel values root heap⌝⦄ Implementation.uncons root ⦃Std.Do.PostCond.noThrow fun (result : Option (ℕ × Option (NodeRef CellTy.nat))) (finish : Heap) => ⌜(List.Uncons.resultRepresentation CellTy.nat).Rel (Option.map (fun (head : CellValue CellTy.nat) => (head, values.tail)) values.head?) result finish ∧ finish = initial⌝⦄

                                The native action returns the ordinary head/tail view and preserves the entire initial heap, including other roots sharing this list's tail.

                                theorem Complexity.Language.Examples.LinkedList.Construction.cons_spec {pre✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                FunctionTotal program consId pre✝ post✝ → ∀ (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons head (Env.cons tail Env.empty)) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons head (Env.cons tail Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ cons head tail ⦃continuation⦄

                                Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                theorem Complexity.Language.Examples.LinkedList.Construction.cons_eq (head : ℕ) (tail : Option (NodeRef CellTy.nat)) :
                                cons head tail = do let ref ← NodeRef.consM head tail pure (some ref)

                                One source-body equation in ordinary monadic notation; named callees remain opaque.

                                @[reducible, inline]

                                The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                Equations
                                Instances For
                                  @[reducible, inline]

                                  The source program's declared first-order signatures.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[reducible, inline]

                                    Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                    Equations
                                    Instances For

                                      The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          theorem Complexity.Language.Examples.LinkedList.Construction.cons_contract_iff_triple (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                          cons_contract pre✝ post✝ ↔ ∀ (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ head tail initialHeap }⦄ cons head tail ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ head tail initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                          Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                          @[reducible, inline]

                                          Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            The finite table of actual named source bodies.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              theorem Complexity.Language.Examples.LinkedList.Construction.cons_total_iff (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                              cons_contract pre✝ post✝ ↔ ∀ (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ head tail initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), cons head tail initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ head tail initialHeap value finalHeap

                                              The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                              The named function's actual independently interpreted source body.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For

                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                Named construction generates exactly the existing public cons operation.

                                                theorem Complexity.Language.Examples.LinkedList.cons_total (values : List ℕ) :
                                                Construction.cons_contract (fun (x : ℕ) (tail : Option (NodeRef CellTy.nat)) (heap : Heap) => (Representation.list CellTy.nat).Rel values tail heap) fun (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initial : Heap) (result : Option (NodeRef CellTy.nat)) (finish : Heap) => (Representation.list CellTy.nat).Rel (head :: values) result finish ∧ finish = (initial.cons head tail).2 ∧ result = some (initial.cons head tail).1 ∧ initial.ShapeExtends finish

                                                The public contract supplies mathematical cons, the exact allocated heap and fresh root, and preservation of every old represented list.

                                                theorem Complexity.Language.Examples.LinkedList.cons_spec (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (values : List ℕ) (initial : Heap) :
                                                ⦃fun (heap : Heap) => ⌜heap = initial ∧ (Representation.list CellTy.nat).Rel values tail heap⌝⦄ Construction.cons head tail ⦃Std.Do.PostCond.noThrow fun (result : Option (NodeRef CellTy.nat)) (finish : Heap) => ⌜(Representation.list CellTy.nat).Rel (head :: values) result finish ∧ finish = (initial.cons head tail).2 ∧ result = some (initial.cons head tail).1 ∧ initial.ShapeExtends finish⌝⦄

                                                The native action inherits the public source contract without reproving allocation or the representation of the shared tail.

                                                The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  The named function's actual independently interpreted source body.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Fold an actual source invocation back to its named ordinary-argument observation.

                                                    theorem Complexity.Language.Examples.LinkedList.Singleton.singleton_spec {pre✝ : Env [Ty.nat] → Heap → Prop} {post✝ : Env [Ty.nat] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                    FunctionTotal program singletonId pre✝ post✝ → ∀ (head : ℕ) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons head Env.empty) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons head Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ singleton head ⦃continuation⦄

                                                    Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                    @[reducible, inline]

                                                    Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      @[reducible, inline]

                                                      Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                      Equations
                                                      Instances For
                                                        theorem Complexity.Language.Examples.LinkedList.Singleton.singleton_eq (head : ℕ) :
                                                        singleton head = have operand := none; do let ref ← NodeRef.consM head operand pure (some ref)

                                                        One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                        theorem Complexity.Language.Examples.LinkedList.Singleton.singleton_total_iff (pre✝ : ℕ → Heap → Prop) (post✝ : ℕ → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                        singleton_contract pre✝ post✝ ↔ ∀ (head : ℕ) (initialHeap : Heap), pre✝ head initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), singleton head initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ head initialHeap value finalHeap

                                                        The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                        The finite table of actual named source bodies.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          theorem Complexity.Language.Examples.LinkedList.Singleton.singleton_contract_iff_triple (pre✝ : ℕ → Heap → Prop) (post✝ : ℕ → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                          singleton_contract pre✝ post✝ ↔ ∀ (head : ℕ) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ head initialHeap }⦄ singleton head ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ head initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                          Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                          @[reducible, inline]

                                                          The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                          Equations
                                                          Instances For

                                                            Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For

                                                              The inferred absent tail is an ordinary typed primitive binding before the real allocation, not an unchecked host-side list constructor.

                                                              The generated observation equations identify singleton with cons of the absent tail, even though their source argument lists differ.

                                                              theorem Complexity.Language.Examples.LinkedList.singleton_total :
                                                              Singleton.singleton_contract (fun (x : ℕ) (x_1 : Heap) => True) fun (head : ℕ) (initial : Heap) (result : Option (NodeRef CellTy.nat)) (finish : Heap) => (Representation.list CellTy.nat).Rel [head] result finish ∧ finish = (initial.cons head none).2 ∧ result = some (initial.cons head none).1 ∧ initial.ShapeExtends finish

                                                              The singleton has the ordinary [head] contract and allocates exactly the same fresh node as the public constructor with an empty represented tail.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                theorem Complexity.Language.Examples.LinkedList.Native.Source.sum_spec {pre✝ : Env [(Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option] → Heap → ℕ → Heap → Prop} :
                                                                FunctionTotal program sumId pre✝ post✝ → ∀ (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values Env.empty) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons values Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ sum values ⦃continuation⦄

                                                                Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                @[reducible, inline]

                                                                Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                Equations
                                                                Instances For
                                                                  theorem Complexity.Language.Examples.LinkedList.Native.Source.sumFrom_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → ℕ → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → ℕ → Heap → ℕ → Heap → Prop) :
                                                                  sumFrom_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initial : ℕ) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values initial initialHeap }⦄ sumFrom values initial ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ values initial initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                  Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                  Ordinary mathematical function generated from the same represented source block.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For

                                                                    Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      theorem Complexity.Language.Examples.LinkedList.Native.Source.sumPair_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                      sumPair_contract pre✝ post✝ ↔ ∀ (left : Option (NodeRef CellTy.nat)) (initial : ℕ) (right : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ left initial right initialHeap }⦄ sumPair left initial right ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ left initial right initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                      Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                      @[reducible, inline]

                                                                      Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        theorem Complexity.Language.Examples.LinkedList.Native.sumPair_action_eq_native (left : List ℕ) (initial : ℕ) (right : List ℕ) (left_source✝ right_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                        (Representation.list CellTy.nat).Rel left left_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel right right_source✝ initialHeap✝ → Source.sumPair left_source✝ initial right_source✝ initialHeap✝ = Part.some (Except.ok (sumPair left initial right), initialHeap✝)

                                                                        The same source execution returns the encoded mathematical result without changing its supplied heap, under the actual input representations.

                                                                        The named function's actual independently interpreted source body.

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          theorem Complexity.Language.Examples.LinkedList.Native.sumFrom_action_rel_native_preserving (values : List ℕ) (initial : ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                          (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sumFrom values_source✝ initial initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sumFrom values initial) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                          Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                          Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For
                                                                            @[reducible, inline]

                                                                            Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                            Equations
                                                                            • One or more equations did not get rendered due to their size.
                                                                            Instances For

                                                                              The named function's actual independently interpreted source body.

                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For
                                                                                theorem Complexity.Language.Examples.LinkedList.Native.sumTwice_action_rel_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sumTwice values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sumTwice values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                theorem Complexity.Language.Examples.LinkedList.Native.Source.sum_total_iff (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                sum_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ values initialHeap → ∃ (value : ℕ) (finalHeap : Heap), sum values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values initialHeap value finalHeap

                                                                                The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                Automatic correspondence for the same generated source function, without a machine budget.

                                                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                theorem Complexity.Language.Examples.LinkedList.Native.Source.sumFrom_eq (values : Option (NodeRef CellTy.nat)) (initial : ℕ) :
                                                                                sumFrom values initial = do let result ← Operations.fold0.fold initial values pure result

                                                                                One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                theorem Complexity.Language.Examples.LinkedList.Native.sumTwice_action_eq_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → Source.sumTwice values_source✝ initialHeap✝ = Part.some (Except.ok (sumTwice values), initialHeap✝)

                                                                                The same source execution returns the encoded mathematical result without changing its supplied heap, under the actual input representations.

                                                                                @[reducible, inline]

                                                                                The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                Equations
                                                                                Instances For

                                                                                  One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                  theorem Complexity.Language.Examples.LinkedList.Native.Source.sumFrom_total_iff (pre✝ : Option (NodeRef CellTy.nat) → ℕ → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → ℕ → Heap → ℕ → Heap → Prop) :
                                                                                  sumFrom_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initial : ℕ) (initialHeap : Heap), pre✝ values initial initialHeap → ∃ (value : ℕ) (finalHeap : Heap), sumFrom values initial initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values initial initialHeap value finalHeap

                                                                                  The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                  theorem Complexity.Language.Examples.LinkedList.Native.Source.sumPair_spec {pre✝ : Env [(Ty.node CellTy.nat).option, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option, Ty.nat, (Ty.node CellTy.nat).option] → Heap → ℕ → Heap → Prop} :
                                                                                  FunctionTotal program sumPairId pre✝ post✝ → ∀ (left : Option (NodeRef CellTy.nat)) (initial : ℕ) (right : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons left (Env.cons initial (Env.cons right Env.empty))) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons left (Env.cons initial (Env.cons right Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ sumPair left initial right ⦃continuation⦄

                                                                                  Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                  Automatic correspondence for the same generated source function, without a machine budget.

                                                                                  theorem Complexity.Language.Examples.LinkedList.Native.Source.sum_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                  sum_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values initialHeap }⦄ sum values ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                  Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                  theorem Complexity.Language.Examples.LinkedList.Native.Source.sumFrom_spec {pre✝ : Env [(Ty.node CellTy.nat).option, Ty.nat] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option, Ty.nat] → Heap → ℕ → Heap → Prop} :
                                                                                  FunctionTotal program sumFromId pre✝ post✝ → ∀ (values : Option (NodeRef CellTy.nat)) (initial : ℕ) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values (Env.cons initial Env.empty)) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons values (Env.cons initial Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ sumFrom values initial ⦃continuation⦄

                                                                                  Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                  Automatic correspondence for the same generated source function, without a machine budget.

                                                                                  The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For
                                                                                    @[reducible, inline]

                                                                                    Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For
                                                                                      theorem Complexity.Language.Examples.LinkedList.Native.Source.sumTwice_total_iff (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                      sumTwice_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ values initialHeap → ∃ (value : ℕ) (finalHeap : Heap), sumTwice values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values initialHeap value finalHeap

                                                                                      The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                      @[reducible, inline]

                                                                                      Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For

                                                                                        The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                        Equations
                                                                                        • One or more equations did not get rendered due to their size.
                                                                                        Instances For
                                                                                          @[reducible, inline]

                                                                                          The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                          Equations
                                                                                          Instances For

                                                                                            Added function bodies already typed against the complete linked table.

                                                                                            Equations
                                                                                            • One or more equations did not get rendered due to their size.
                                                                                            Instances For
                                                                                              theorem Complexity.Language.Examples.LinkedList.Native.sum_action_rel_native_preserving (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                              (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sum values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sum values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                              Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                              theorem Complexity.Language.Examples.LinkedList.Native.Source.sumTwice_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                              sumTwice_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values initialHeap }⦄ sumTwice values ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                              Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                              @[reducible, inline]

                                                                                              Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                              Equations
                                                                                              Instances For
                                                                                                theorem Complexity.Language.Examples.LinkedList.Native.sumPair_action_rel_native_preserving (left : List ℕ) (initial : ℕ) (right : List ℕ) (left_source✝ right_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                (Representation.list CellTy.nat).Rel left left_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel right right_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sumPair left_source✝ initial right_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sumPair left initial right) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                Equations
                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                Instances For

                                                                                                  Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                  Equations
                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                  Instances For
                                                                                                    theorem Complexity.Language.Examples.LinkedList.Native.sumTwice_action_rel_native_preserving (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                    (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sumTwice values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sumTwice values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                    Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                    theorem Complexity.Language.Examples.LinkedList.Native.sumFrom_action_eq_native (values : List ℕ) (initial : ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                    (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → Source.sumFrom values_source✝ initial initialHeap✝ = Part.some (Except.ok (sumFrom values initial), initialHeap✝)

                                                                                                    The same source execution returns the encoded mathematical result without changing its supplied heap, under the actual input representations.

                                                                                                    Actual imported function bodies with their internal calls relocated.

                                                                                                    Equations
                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                    Instances For

                                                                                                      Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                      The named function's actual independently interpreted source body.

                                                                                                      Equations
                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                      Instances For

                                                                                                        The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                        Equations
                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                        Instances For
                                                                                                          @[reducible, inline]

                                                                                                          The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                          Equations
                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                          Instances For
                                                                                                            theorem Complexity.Language.Examples.LinkedList.Native.Source.sumTwice_eq (values : Option (NodeRef CellTy.nat)) :
                                                                                                            sumTwice values = do let first ← sum values let result ← sumFrom values first pure result

                                                                                                            One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                            The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                            Equations
                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                            Instances For

                                                                                                              Ordinary mathematical function generated from the same represented source block.

                                                                                                              Equations
                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                              Instances For
                                                                                                                @[reducible, inline]

                                                                                                                The complete signature tables retained from imported source programs.

                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Instances For
                                                                                                                  @[reducible, inline]

                                                                                                                  The source program's declared first-order signatures.

                                                                                                                  Equations
                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                  Instances For
                                                                                                                    @[reducible, inline]
                                                                                                                    Equations
                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                    Instances For

                                                                                                                      Ordinary mathematical function generated from the same represented source block.

                                                                                                                      Equations
                                                                                                                      Instances For
                                                                                                                        @[reducible, inline]

                                                                                                                        Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                        Equations
                                                                                                                        Instances For
                                                                                                                          @[reducible, inline]

                                                                                                                          Signature-preserving positions of this imported source program.

                                                                                                                          Equations
                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                          Instances For

                                                                                                                            Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                            theorem Complexity.Language.Examples.LinkedList.Native.sum_action_eq_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                            (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → Source.sum values_source✝ initialHeap✝ = Part.some (Except.ok (sum values), initialHeap✝)

                                                                                                                            The same source execution returns the encoded mathematical result without changing its supplied heap, under the actual input representations.

                                                                                                                            @[reducible, inline]

                                                                                                                            Signature-preserving positions of this imported source program.

                                                                                                                            Equations
                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                            Instances For
                                                                                                                              theorem Complexity.Language.Examples.LinkedList.Native.Operations.fold0.fold_eq (initial✝ : ℕ) (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                              (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → fold initial✝ root✝ heap✝ = Part.some (Except.ok (List.foldl Reducer.add initial✝ values✝), heap✝)
                                                                                                                              @[reducible, inline]

                                                                                                                              Signatures of the functions added by this source declaration.

                                                                                                                              Equations
                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                              Instances For

                                                                                                                                Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                theorem Complexity.Language.Examples.LinkedList.Native.sumFrom_action_rel_native (values : List ℕ) (initial : ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sumFrom values_source✝ initial initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sumFrom values initial) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                theorem Complexity.Language.Examples.LinkedList.Native.Source.sumTwice_spec {pre✝ : Env [(Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option] → Heap → ℕ → Heap → Prop} :
                                                                                                                                FunctionTotal program sumTwiceId pre✝ post✝ → ∀ (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values Env.empty) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons values Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ sumTwice values ⦃continuation⦄

                                                                                                                                Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                theorem Complexity.Language.Examples.LinkedList.Native.Source.sumPair_eq (left : Option (NodeRef CellTy.nat)) (initial : ℕ) (right : Option (NodeRef CellTy.nat)) :
                                                                                                                                sumPair left initial right = have start := initial.add 0; do let first ← Operations.fold0.fold start left let result ← Operations.fold0.fold first right pure result

                                                                                                                                One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                theorem Complexity.Language.Examples.LinkedList.Native.sum_action_rel_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sum values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sum values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                Ordinary mathematical function generated from the same represented source block.

                                                                                                                                Equations
                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                Instances For
                                                                                                                                  @[reducible, inline]

                                                                                                                                  Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                  Equations
                                                                                                                                  Instances For
                                                                                                                                    @[reducible, inline]

                                                                                                                                    The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                    Equations
                                                                                                                                    Instances For
                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.Native.Operations.fold0.fold_rel (initial✝ : ℕ) (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                      (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), fold initial✝ root✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (List.foldl Reducer.add initial✝ values✝) returned finish ∧ heap✝.ShapeExtends finish
                                                                                                                                      @[reducible, inline]
                                                                                                                                      Equations
                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                      Instances For

                                                                                                                                        The named function's actual independently interpreted source body.

                                                                                                                                        Equations
                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                        Instances For
                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.Native.sumPair_action_rel_native (left : List ℕ) (initial : ℕ) (right : List ℕ) (left_source✝ right_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                          (Representation.list CellTy.nat).Rel left left_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel right right_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sumPair left_source✝ initial right_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sumPair left initial right) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                          Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                          The finite table of actual named source bodies.

                                                                                                                                          Equations
                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                          Instances For
                                                                                                                                            Equations
                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                            Instances For
                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.Native.Source.sumPair_total_iff (pre✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                              sumPair_contract pre✝ post✝ ↔ ∀ (left : Option (NodeRef CellTy.nat)) (initial : ℕ) (right : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ left initial right initialHeap → ∃ (value : ℕ) (finalHeap : Heap), sumPair left initial right initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ left initial right initialHeap value finalHeap

                                                                                                                                              The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.sumFrom_eq (values : List ℕ) (initial : ℕ) :
                                                                                                                                              Native.sumFrom values initial = initial + values.sum

                                                                                                                                              The mathematical proof uses ordinary list algebra. The native frontend generates the correspondence to the actual linked traversal separately.

                                                                                                                                              A constant initial value needs no represented argument supplied by the user.

                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.sumPair_eq (left right : List ℕ) (initial : ℕ) :
                                                                                                                                              Native.sumPair left initial right = initial + left.sum + right.sum

                                                                                                                                              Consecutive traversals can observe lists with shared tails: their abstract correctness needs no heap-disjointness assumption or repeated loop proof.

                                                                                                                                              Calls to earlier functions in the same native family reuse their generated correspondence while the mathematical proof remains ordinary rewriting.

                                                                                                                                              An ordinary mathematical theorem specializes the generated refinement of the very same source declaration; no environment or register adapter is supplied.

                                                                                                                                              Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                              Equations
                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                              Instances For

                                                                                                                                                The named function's actual independently interpreted source body.

                                                                                                                                                Equations
                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                Instances For
                                                                                                                                                  @[reducible, inline]

                                                                                                                                                  The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                  Equations
                                                                                                                                                  Instances For

                                                                                                                                                    Actual imported function bodies with their internal calls relocated.

                                                                                                                                                    Equations
                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                    Instances For
                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeConstruction.sumWithPrepended_action_rel_native (head : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                      (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.sumWithPrepended head values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (sumWithPrepended head values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Operations.fold0.fold_rel (initial✝ : ℕ) (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                      (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), fold initial✝ root✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (List.foldl Reducer.add initial✝ values✝) returned finish ∧ heap✝.ShapeExtends finish

                                                                                                                                                      The named function's actual independently interpreted source body.

                                                                                                                                                      Equations
                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                      Instances For
                                                                                                                                                        @[reducible, inline]

                                                                                                                                                        Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                        Equations
                                                                                                                                                        Instances For

                                                                                                                                                          The named function's actual independently interpreted source body.

                                                                                                                                                          Equations
                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                          Instances For
                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeConstruction.prependPair_action_rel_native_preserving (first second : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                            (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.prependPair first second values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (prependPair first second values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                            Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                            @[reducible, inline]

                                                                                                                                                            Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                            Equations
                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                            Instances For

                                                                                                                                                              Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                              @[reducible, inline]

                                                                                                                                                              Signature-preserving positions of this imported source program.

                                                                                                                                                              Equations
                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                              Instances For
                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeConstruction.prependPair_action_rel_native (first second : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.prependPair first second values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (prependPair first second values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                Equations
                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                Instances For

                                                                                                                                                                  Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                  Equations
                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                  Instances For

                                                                                                                                                                    The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                    Equations
                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                    Instances For
                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.prependPair_spec {pre✝ : Env [Ty.nat, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                      FunctionTotal program prependPairId pre✝ post✝ → ∀ (first second : ℕ) (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons first (Env.cons second (Env.cons values Env.empty))) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons first (Env.cons second (Env.cons values Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ prependPair first second values ⦃continuation⦄

                                                                                                                                                                      Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.prependPair_contract_iff_triple (pre✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                      prependPair_contract pre✝ post✝ ↔ ∀ (first second : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ first second values initialHeap }⦄ prependPair first second values ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ first second values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                      Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                      Signature-preserving positions of this imported source program.

                                                                                                                                                                      Equations
                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                      Instances For
                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Operations.consNat.cons_rel_preserving (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                        (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish ∧ Buffer.PreservesContents heap✝ finish

                                                                                                                                                                        Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                        Equations
                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                        Instances For
                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                          The source program's declared first-order signatures.

                                                                                                                                                                          Equations
                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                          Instances For
                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.prepend_total_iff (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                            prepend_contract pre✝ post✝ ↔ ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ head values initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), prepend head values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ head values initialHeap value finalHeap

                                                                                                                                                                            The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Operations.fold0.fold_eq (initial✝ : ℕ) (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                            (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → fold initial✝ root✝ heap✝ = Part.some (Except.ok (List.foldl Reducer.add initial✝ values✝), heap✝)
                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                            The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                            Equations
                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                            Instances For

                                                                                                                                                                              Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                              Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                              Equations
                                                                                                                                                                              Instances For

                                                                                                                                                                                Added function bodies already typed against the complete linked table.

                                                                                                                                                                                Equations
                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                Instances For

                                                                                                                                                                                  Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                  Equations
                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                  Instances For

                                                                                                                                                                                    Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                    Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                    Equations
                                                                                                                                                                                    Instances For
                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeConstruction.singleton_action_rel_native_preserving (head : ℕ) (initialHeap✝ : Heap) :
                                                                                                                                                                                      ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.singleton head initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (singleton head) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                      Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                      The finite table of actual named source bodies.

                                                                                                                                                                                      Equations
                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                      Instances For
                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                        Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                        Equations
                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                        Instances For
                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.sumWithPrepended_total_iff (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                                                                          sumWithPrepended_contract pre✝ post✝ ↔ ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ head values initialHeap → ∃ (value : ℕ) (finalHeap : Heap), sumWithPrepended head values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ head values initialHeap value finalHeap

                                                                                                                                                                                          The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                          The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                          Equations
                                                                                                                                                                                          Instances For
                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Operations.consNat.cons_rel (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                            (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish

                                                                                                                                                                                            The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                            Equations
                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                            Instances For
                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeConstruction.singleton_action_rel_native (head : ℕ) (initialHeap✝ : Heap) :
                                                                                                                                                                                              ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.singleton head initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (singleton head) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                              Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.singleton_eq (head : ℕ) :
                                                                                                                                                                                              singleton head = have operand := none; do let result ← Operations.consNat.cons head operand pure result

                                                                                                                                                                                              One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                              Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                              One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.sumWithPrepended_spec {pre✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → ℕ → Heap → Prop} :
                                                                                                                                                                                              FunctionTotal program sumWithPrependedId pre✝ post✝ → ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons head (Env.cons values Env.empty)) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons head (Env.cons values Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ sumWithPrepended head values ⦃continuation⦄

                                                                                                                                                                                              Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.prependPair_total_iff (pre✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                              prependPair_contract pre✝ post✝ ↔ ∀ (first second : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ first second values initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), prependPair first second values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ first second values initialHeap value finalHeap

                                                                                                                                                                                              The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                              The complete signature tables retained from imported source programs.

                                                                                                                                                                                              Equations
                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                              Instances For
                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                Equations
                                                                                                                                                                                                Instances For
                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                  Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                  Equations
                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.sumWithPrepended_eq (head : ℕ) (values : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                    sumWithPrepended head values = do let grown ← prepend head values let original ← Operations.fold0.fold 0 values let result ← Operations.fold0.fold original grown pure result

                                                                                                                                                                                                    One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeConstruction.prepend_action_rel_native_preserving (head : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.prepend head values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (prepend head values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                    Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeConstruction.prepend_action_rel_native (head : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.prepend head values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (prepend head values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                    Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                    Equations
                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                      Signature-preserving positions of this imported source program.

                                                                                                                                                                                                      Equations
                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.prepend_spec {pre✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                        FunctionTotal program prependId pre✝ post✝ → ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons head (Env.cons values Env.empty)) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons head (Env.cons values Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ prepend head values ⦃continuation⦄

                                                                                                                                                                                                        Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.singleton_spec {pre✝ : Env [Ty.nat] → Heap → Prop} {post✝ : Env [Ty.nat] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                        FunctionTotal program singletonId pre✝ post✝ → ∀ (head : ℕ) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons head Env.empty) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons head Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ singleton head ⦃continuation⦄

                                                                                                                                                                                                        Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                        Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                        Equations
                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                          Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                          Equations
                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                            Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                            Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                            Equations
                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                              Equations
                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.sumWithPrepended_contract_iff_triple (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                                                                                                sumWithPrepended_contract pre✝ post✝ ↔ ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ head values initialHeap }⦄ sumWithPrepended head values ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ head values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                Signatures of the functions added by this source declaration.

                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                  Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                  @[reducible, inline]
                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                    @[reducible, inline]
                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                      The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                        Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                          The named function's actual independently interpreted source body.

                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                            Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.prependPair_eq (first second : ℕ) (values : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                              prependPair first second values = do let tail ← prepend second values let result ← prepend first tail pure result

                                                                                                                                                                                                                              One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.singleton_total_iff (pre✝ : ℕ → Heap → Prop) (post✝ : ℕ → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                              singleton_contract pre✝ post✝ ↔ ∀ (head : ℕ) (initialHeap : Heap), pre✝ head initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), singleton head initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ head initialHeap value finalHeap

                                                                                                                                                                                                                              The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                              The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.singleton_contract_iff_triple (pre✝ : ℕ → Heap → Prop) (post✝ : ℕ → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                singleton_contract pre✝ post✝ ↔ ∀ (head : ℕ) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ head initialHeap }⦄ singleton head ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ head initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeConstruction.Source.prepend_contract_iff_triple (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                prepend_contract pre✝ post✝ ↔ ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ head values initialHeap }⦄ prepend head values ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ head values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                The native result is an ordinary list; its implementation allocates one node and shares the supplied tail through the generated correspondence.

                                                                                                                                                                                                                                An empty list is represented without storage, so singleton needs just the actual cons operation selected by the same native declaration.

                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.prependPair_eq (first second : ℕ) (values : List ℕ) :
                                                                                                                                                                                                                                NativeConstruction.prependPair first second values = first :: second :: values

                                                                                                                                                                                                                                Calls returning lists compose with ordinary equations, without a second implementation or a user-written proof about intermediate heaps.

                                                                                                                                                                                                                                Both the old list and the freshly extended list are available after allocation. Their source representations are composed by the frontend.

                                                                                                                                                                                                                                Ordinary mathematics specializes the generated relation with the actual returned list in its final heap. No time, capacity or disjointness premise is needed.

                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeRecursive.Source.replicateAppend_total_iff (pre✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                replicateAppend_contract pre✝ post✝ ↔ ∀ (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ count head tail initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), replicateAppend count head tail initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ count head tail initialHeap value finalHeap

                                                                                                                                                                                                                                The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeRecursive.Source.replicateAppend_contract_iff_triple (pre✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                replicateAppend_contract pre✝ post✝ ↔ ∀ (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ count head tail initialHeap }⦄ replicateAppend count head tail ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ count head tail initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRecursive.Source.replicateAppend_spec {pre✝ : Env [Ty.nat, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                  FunctionTotal program replicateAppendId pre✝ post✝ → ∀ (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons count (Env.cons head (Env.cons tail Env.empty))) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons count (Env.cons head (Env.cons tail Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ replicateAppend count head tail ⦃continuation⦄

                                                                                                                                                                                                                                  Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                  The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeRecursive.Operations.consNat.cons_rel_preserving (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish ∧ Buffer.PreservesContents heap✝ finish
                                                                                                                                                                                                                                    @[irreducible]
                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeRecursive.replicateAppend_action_rel_native_preserving (count head : ℕ) (tail : List ℕ) (tail_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel tail tail_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.replicateAppend count head tail_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (replicateAppend count head tail) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                    Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                    Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                      Signatures of the functions added by this source declaration.

                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                        Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRecursive.Operations.consNat.cons_rel (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                        (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish

                                                                                                                                                                                                                                        The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRecursive.Source.replicateAppend_eq (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                          replicateAppend count head tail = have result_join := none; have condition := decide (0 < count); have __do_jp := fun (result_join : Option (Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match result_join with | none => do let y ← pure () __do_jp y | some payload => pure payload; if condition = true then do let grown ← Operations.consNat.cons head tail have operand : ℕ := count.sub 1 let result ← replicateAppend operand head grown have result_join : Option (Option (NodeRef CellTy.nat)) := some result let y ← pure () __do_jp result_join y else have result_join := some tail; do let y ← pure () __do_jp result_join y

                                                                                                                                                                                                                                          One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                          @[irreducible]

                                                                                                                                                                                                                                          Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                            Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                              Added function bodies already typed against the complete linked table.

                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                The source program's declared first-order signatures.

                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRecursive.replicateAppend_action_rel_native (count head : ℕ) (tail : List ℕ) (tail_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                  (Representation.list CellTy.nat).Rel tail tail_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.replicateAppend count head tail_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (replicateAppend count head tail) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                  Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                  Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                    Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                    Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                      The finite table of actual named source bodies.

                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                        Recursive calls receive the actually allocated tail. Ordinary induction proves the native equation; generated correspondence handles every represented input and current heap using the declaration's single descent annotation.

                                                                                                                                                                                                                                                        This contract refers to the same allocating recursive source, not a second list program. Source termination and correctness have no machine-budget premise.

                                                                                                                                                                                                                                                        Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.body_observe (locals✝ : Locals) :
                                                                                                                                                                                                                                                        Stmt.observe View Body program locals✝ = body locals✝.1 locals✝.2.1 locals✝.2.2.1 locals✝.2.2.2.1 locals✝.2.2.2.2.1 locals✝.2.2.2.2.2.1

                                                                                                                                                                                                                                                        Coordinate conversion for composing this named observation.

                                                                                                                                                                                                                                                        Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.regroup_symm_apply (grouped✝ : Mutable × Captured) :
                                                                                                                                                                                                                                                        Regroup.symm grouped✝ = (grouped✝.1.1, grouped✝.1.2.1, grouped✝.1.2.2.1, grouped✝.2.1, grouped✝.2.2.1, grouped✝.2.2.2.1, ())
                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.variant_spec (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (invariant✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (variant✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ) (normal✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (returned✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) :
                                                                                                                                                                                                                                                        (∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (startHeap : Heap), invariant✝ index result output_join startHeap → ⦃fun (currentHeap : Heap) => { down := currentHeap = startHeap }⦄ guard index result output_join count head tail ⦃(fun (guardOutcome : Control Ty.bool × Locals) (afterGuardHeap : Heap) => { down := have afterGuard_index := guardOutcome.2.1; have afterGuard_result := guardOutcome.2.2.1; have afterGuard_output_join := guardOutcome.2.2.2.1; match guardOutcome.1 with | Control.returned again => if again = true then ⦃fun (currentHeap : Heap) => { down := currentHeap = afterGuardHeap }⦄ body afterGuard_index afterGuard_result afterGuard_output_join count head tail ⦃(fun (bodyOutcome : Control (Ty.node CellTy.nat).option × Locals) (afterBodyHeap : Heap) => { down := have afterBody_index := bodyOutcome.2.1; have afterBody_result := bodyOutcome.2.2.1; have afterBody_output_join := bodyOutcome.2.2.2.1; match bodyOutcome.1 with | Control.normal => invariant✝ afterBody_index afterBody_result afterBody_output_join afterBodyHeap ∧ variant✝ afterBody_index afterBody_result afterBody_output_join afterBodyHeap < variant✝ index result output_join startHeap | Control.returned value => returned✝ value afterBody_index afterBody_result afterBody_output_join afterBodyHeap | Control.fault a => False }, PUnit.unit)⦄ else normal✝ afterGuard_index afterGuard_result afterGuard_output_join afterGuardHeap | Control.normal => False | Control.fault a => False }, PUnit.unit)⦄) → ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))), ⦃fun (heap : Heap) => { down := invariant✝ index result output_join heap }⦄ prependRange_loop1 index result output_join count head tail ⦃(fun (outcome : Control (Ty.node CellTy.nat).option × Locals) (heap : Heap) => { down := have final_index := outcome.2.1; have final_result := outcome.2.2.1; have final_output_join := outcome.2.2.2.1; match outcome.1 with | Control.normal => normal✝ final_index final_result final_output_join heap | Control.returned value => returned✝ value final_index final_result final_output_join heap | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                        Prove this actual loop with fixed captures and well-founded progress on its mutable locals. Only normal body exits must decrease; guard effects, returns and faults retain their real heap.

                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.wellFounded_contract (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (invariant✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (relation✝ : Mutable × Heap → Mutable × Heap → Prop) :
                                                                                                                                                                                                                                                        WellFounded relation✝ → ∀ (ready : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (normal : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (returned : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop), (guard_contract count head tail invariant✝ (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => False) fun (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap) (again : Bool) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => if again = true then ready index result output_join heap after_index after_result after_output_join finish else normal after_index after_result after_output_join finish) → (∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap), invariant✝ index result output_join heap → body_contract count head tail (ready index result output_join heap) (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => invariant✝ after_index after_result after_output_join finish ∧ relation✝ ((after_index, after_result, after_output_join, ()), finish) ((index, result, output_join, ()), heap)) fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (value : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => returned value after_index after_result after_output_join finish) → contract count head tail invariant✝ (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => normal after_index after_result after_output_join finish) fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (value : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => returned value after_index after_result after_output_join finish

                                                                                                                                                                                                                                                        Prove a named loop from independent mathematical guard and body contracts. Actual guard effects and early body returns are retained; only normal iterations decrease.

                                                                                                                                                                                                                                                        Source lexical immutability preserves these captures on every actual exit.

                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.captureView_symm_apply (grouped✝ : Mutable × Captured) :
                                                                                                                                                                                                                                                        CaptureView.symm grouped✝ = View.symm (grouped✝.1.1, grouped✝.1.2.1, grouped✝.1.2.2.1, grouped✝.2.1, grouped✝.2.2.1, grouped✝.2.2.2.1, ())

                                                                                                                                                                                                                                                        Restore grouped locals using the checked coordinate projection laws.

                                                                                                                                                                                                                                                        This actual source block, retaining its loop or allocation-scope semantics.

                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.wellFounded_spec (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (invariant✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (relation✝ : Mutable × Heap → Mutable × Heap → Prop) :
                                                                                                                                                                                                                                                          WellFounded relation✝ → ∀ (normal : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (returned : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop), (∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (startHeap : Heap), invariant✝ index result output_join startHeap → ⦃fun (currentHeap : Heap) => { down := currentHeap = startHeap }⦄ guard index result output_join count head tail ⦃(fun (guardOutcome : Control Ty.bool × Locals) (afterGuardHeap : Heap) => { down := have afterGuard_index := guardOutcome.2.1; have afterGuard_result := guardOutcome.2.2.1; have afterGuard_output_join := guardOutcome.2.2.2.1; match guardOutcome.1 with | Control.returned again => if again = true then ⦃fun (currentHeap : Heap) => { down := currentHeap = afterGuardHeap }⦄ body afterGuard_index afterGuard_result afterGuard_output_join count head tail ⦃(fun (bodyOutcome : Control (Ty.node CellTy.nat).option × Locals) (afterBodyHeap : Heap) => { down := have afterBody_index := bodyOutcome.2.1; have afterBody_result := bodyOutcome.2.2.1; have afterBody_output_join := bodyOutcome.2.2.2.1; match bodyOutcome.1 with | Control.normal => invariant✝ afterBody_index afterBody_result afterBody_output_join afterBodyHeap ∧ relation✝ ((afterBody_index, afterBody_result, afterBody_output_join, ()), afterBodyHeap) ((index, result, output_join, ()), startHeap) | Control.returned value => returned value afterBody_index afterBody_result afterBody_output_join afterBodyHeap | Control.fault a => False }, PUnit.unit)⦄ else normal afterGuard_index afterGuard_result afterGuard_output_join afterGuardHeap | Control.normal => False | Control.fault a => False }, PUnit.unit)⦄) → ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))), ⦃fun (heap : Heap) => { down := invariant✝ index result output_join heap }⦄ prependRange_loop1 index result output_join count head tail ⦃(fun (outcome : Control (Ty.node CellTy.nat).option × Locals) (heap : Heap) => { down := have final_index := outcome.2.1; have final_result := outcome.2.2.1; have final_output_join := outcome.2.2.2.1; match outcome.1 with | Control.normal => normal final_index final_result final_output_join heap | Control.returned value => returned value final_index final_result final_output_join heap | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                          Prove this actual loop with fixed captures and well-founded progress on its mutable locals. Only normal body exits must decrease; guard effects, returns and faults retain their real heap.

                                                                                                                                                                                                                                                          Continuing completion coordinates recover the same full entry.

                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_total_iff (pre✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                          prependRange_contract pre✝ post✝ ↔ ∀ (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ count head tail initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), prependRange count head tail initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ count head tail initialHeap value finalHeap

                                                                                                                                                                                                                                                          The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.view_symm_apply (values✝ : Locals) :
                                                                                                                                                                                                                                                          View.symm values✝ = Env.cons values✝.1 (Env.cons values✝.2.1 (Env.cons values✝.2.2.1 (Env.cons values✝.2.2.2.1 (Env.cons values✝.2.2.2.2.1 (Env.cons values✝.2.2.2.2.2.1 Env.empty)))))

                                                                                                                                                                                                                                                          Restore complete lexical coordinates without unfolding proof fields.

                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.completion_rel_contract {Model✝ : Type} (stateRel✝ : Model✝ → Visible → Heap → Prop) (invariant✝ : Model✝ → Prop) {relation✝ : Model✝ → Model✝ → Prop} :
                                                                                                                                                                                                                                                          WellFounded relation✝ → ∀ (ready : Model✝ → Visible → Heap → Visible → Heap → Prop) (normal : Visible → Heap → Prop) (returned : Option (NodeRef CellTy.nat) → Visible → Heap → Prop), (∀ (model : Model✝), invariant✝ model → guard_completion_contract (stateRel✝ model) fun (start : Visible) (heap : Heap) (again : Bool) (output : Visible) (finish : Heap) => if again = true then ready model start heap output finish else normal output finish) → (∀ (model : Model✝) (start : Visible) (heap : Heap), invariant✝ model → stateRel✝ model start heap → body_completion_contract (ready model start heap) (fun (x : Visible) (x_1 : Heap) (output : Visible) (finish : Heap) => ∃ (next : Model✝), invariant✝ next ∧ stateRel✝ next output finish ∧ relation✝ next model) fun (x : Visible) (x_1 : Heap) => returned) → ∀ (model : Model✝), invariant✝ model → completion_contract (stateRel✝ model) (fun (x : Visible) (x_1 : Heap) => normal) fun (x : Visible) (x_1 : Heap) => returned

                                                                                                                                                                                                                                                          Relate this actual loop to a mathematical state without private completion slots. Only a continuing body supplies another invariant and a decrease; a local result exits through the real next guard.

                                                                                                                                                                                                                                                          The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Operations.consNat.cons_rel_preserving (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                            (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish ∧ Buffer.PreservesContents heap✝ finish

                                                                                                                                                                                                                                                            The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                              Enter this source boundary with empty private completion slots.

                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.choosePrepend_total_iff (pre✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                choosePrepend_contract pre✝ post✝ ↔ ∀ (choose : Bool) (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ choose head tail initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), choosePrepend choose head tail initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ choose head tail initialHeap value finalHeap

                                                                                                                                                                                                                                                                The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                Source lexical immutability preserves these captures on every actual exit.

                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                Complete lexical coordinates for this source block.

                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                  A lossless coordinate permutation; no source operation is executed.

                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                    Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.choosePrepend_action_rel_native_preserving (choose : Bool) (head : ℕ) (tail : List ℕ) (tail_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                      (Representation.list CellTy.nat).Rel tail tail_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.choosePrepend choose head tail_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (choosePrepend choose head tail) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.spec (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) {pre✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} {normal✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} {returned✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} :
                                                                                                                                                                                                                                                                      contract count head tail pre✝ normal✝ returned✝ → ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (post : Std.Do.PostCond (Control (Ty.node CellTy.nat).option × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ index result output_join heap ∧ (∀ (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap), normal✝ index result output_join heap after_index after_result after_output_join finish → (post.1 (Control.normal, after_index, after_result, after_output_join, count, head, tail, ()) finish).down) ∧ ∀ (value : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap), returned✝ index result output_join heap value after_index after_result after_output_join finish → (post.1 (Control.returned value, after_index, after_result, after_output_join, count, head, tail, ()) finish).down }⦄ prependRange_loop1 index result output_join count head tail ⦃post⦄

                                                                                                                                                                                                                                                                      Apply a chosen mathematical contract to the native block action. Continuations see ordinary mutable outputs; proved frames restore the fixed captures.

                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                      Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                        The source program's declared first-order signatures.

                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                          Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.contract_iff (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (normal✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (returned✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) :
                                                                                                                                                                                                                                                                            contract count head tail pre✝ normal✝ returned✝ ↔ ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap), pre✝ index result output_join heap → ⦃fun (current : Heap) => { down := current = heap }⦄ prependRange_loop1 index result output_join count head tail ⦃(fun (outcome : Control (Ty.node CellTy.nat).option × Locals) (finish : Heap) => { down := match outcome.1 with | Control.normal => have after := outcome.2; normal✝ index result output_join heap after.1 after.2.1 after.2.2.1 finish | Control.returned value => have after := outcome.2; returned✝ index result output_join heap value after.1 after.2.1 after.2.2.1 finish | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                            Introduce named mutable variables directly, without unpacking internal coordinates.

                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                            Source-visible locals, without compiler completion slots.

                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                              The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.observe (locals✝ : Locals) :
                                                                                                                                                                                                                                                                                Stmt.observe View Code program locals✝ = prependRange_loop1 locals✝.1 locals✝.2.1 locals✝.2.2.1 locals✝.2.2.2.1 locals✝.2.2.2.2.1 locals✝.2.2.2.2.2.1

                                                                                                                                                                                                                                                                                Coordinate conversion for composing this named observation.

                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.choosePrepend_contract_iff_triple (pre✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                choosePrepend_contract pre✝ post✝ ↔ ∀ (choose : Bool) (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ choose head tail initialHeap }⦄ choosePrepend choose head tail ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ choose head tail initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                The actual guard leaves the private completion slots empty. Only the source-visible locals and heap may change before the loop body.

                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                The ordinary mutable locals of this source loop.

                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.body_contract_iff (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (normal✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (returned✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) :
                                                                                                                                                                                                                                                                                  body_contract count head tail pre✝ normal✝ returned✝ ↔ ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap), pre✝ index result output_join heap → ⦃fun (current : Heap) => { down := current = heap }⦄ body index result output_join count head tail ⦃(fun (outcome : Control (Ty.node CellTy.nat).option × Locals) (finish : Heap) => { down := match outcome.1 with | Control.normal => have after := outcome.2; normal✝ index result output_join heap after.1 after.2.1 after.2.2.1 finish | Control.returned value => have after := outcome.2; returned✝ index result output_join heap value after.1 after.2.1 after.2.2.1 finish | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                  Introduce named mutable variables directly, without unpacking internal coordinates.

                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.choosePrepend_spec {pre✝ : Env [Ty.bool, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.bool, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                  FunctionTotal program choosePrependId pre✝ post✝ → ∀ (choose : Bool) (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons choose (Env.cons head (Env.cons tail Env.empty))) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons choose (Env.cons head (Env.cons tail Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ choosePrepend choose head tail ⦃continuation⦄

                                                                                                                                                                                                                                                                                  Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_spec {pre✝ : Env [Ty.nat, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                  FunctionTotal program prependRangeId pre✝ post✝ → ∀ (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons count (Env.cons head (Env.cons tail Env.empty))) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons count (Env.cons head (Env.cons tail Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ prependRange count head tail ⦃continuation⦄

                                                                                                                                                                                                                                                                                  Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                  Added function bodies already typed against the complete linked table.

                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                    The source-visible values retain only roots from this heap.

                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                      The real guard's contract mentions only source-visible inputs and outputs. Its compiler-slot frame is supplied by the generated bridge.

                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                        Relational total correctness with ordinary mutable parameters and fixed captures. The existing block contract retains both actual heaps and excludes faults.

                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                          Signatures of the functions added by this source declaration.

                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Operations.consNat.cons_rel (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                            (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish

                                                                                                                                                                                                                                                                                            The finite table of actual named source bodies.

                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.count_frame_contract (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (count✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → ℕ) (limit✝ : ℕ) (invariant✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (frame✝ : Heap → Heap → Prop) :
                                                                                                                                                                                                                                                                                              (∀ {a b c : Heap}, frame✝ a b → frame✝ b c → frame✝ a c) → ∀ (normal : Heap → Prop), (guard_contract count head tail invariant✝ (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (x_4 : Heap) => False) fun (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap) (again : Bool) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => count✝ after_index after_result after_output_join = count✝ index result output_join ∧ finish = heap ∧ invariant✝ after_index after_result after_output_join finish ∧ (again = true ↔ count✝ after_index after_result after_output_join < limit✝)) → (body_contract count head tail (fun (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap) => invariant✝ index result output_join heap ∧ count✝ index result output_join < limit✝) (fun (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => count✝ after_index after_result after_output_join = count✝ index result output_join + 1 ∧ invariant✝ after_index after_result after_output_join finish ∧ frame✝ heap finish) fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (x_4 : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (x_5 : Heap) => False) → (∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap), invariant✝ index result output_join heap → limit✝ ≤ count✝ index result output_join → normal heap) → ∀ (initial : Heap), contract count head tail (fun (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap) => invariant✝ index result output_join heap ∧ frame✝ initial heap) (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => normal finish ∧ frame✝ initial finish) fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (x_4 : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (x_5 : Heap) => False

                                                                                                                                                                                                                                                                                              Compose an increasing count and a transitive heap frame from the actual guard and body contracts. The guard preserves the count and heap; normal body steps increase the count by one. Array effects and the exit consequence remain supplied mathematical facts, without a runtime budget.

                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.guard_contract_iff (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (normal✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (returned✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Bool → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) :
                                                                                                                                                                                                                                                                                              guard_contract count head tail pre✝ normal✝ returned✝ ↔ ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap), pre✝ index result output_join heap → ⦃fun (current : Heap) => { down := current = heap }⦄ guard index result output_join count head tail ⦃(fun (outcome : Control Ty.bool × Locals) (finish : Heap) => { down := match outcome.1 with | Control.normal => have after := outcome.2; normal✝ index result output_join heap after.1 after.2.1 after.2.2.1 finish | Control.returned value => have after := outcome.2; returned✝ index result output_join heap value after.1 after.2.1 after.2.2.1 finish | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                              Introduce named mutable variables directly, without unpacking internal coordinates.

                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_contract_iff_triple (pre✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                              prependRange_contract pre✝ post✝ ↔ ∀ (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ count head tail initialHeap }⦄ prependRange count head tail ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ count head tail initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                              Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                              Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                  The same complete environment, grouped by source mutability.

                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                    Lossless proof coordinates, including fixed and shadowed captures.

                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                      Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                      Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.body_completion_spec {pre✝ : Visible → Heap → Prop} {normal✝ : Visible → Heap → Visible → Heap → Prop} {returned✝ : Visible → Heap → Option (NodeRef CellTy.nat) → Visible → Heap → Prop} :
                                                                                                                                                                                                                                                                                                        body_completion_contract pre✝ normal✝ returned✝ → ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (post : Std.Do.PostCond (Control (Ty.node CellTy.nat).option × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ (index, result, count, head, tail, ()) heap ∧ (∀ (output : Visible) (finish : Heap), normal✝ (index, result, count, head, tail, ()) heap output finish → (post.1 (Control.normal, reconstruct (entry (index, result, count, head, tail, ())) none output) finish).down) ∧ ∀ (value : Option (NodeRef CellTy.nat)) (output : Visible) (finish : Heap), returned✝ (index, result, count, head, tail, ()) heap value output finish → (post.1 (Control.normal, reconstruct (entry (index, result, count, head, tail, ())) (some value) output) finish).down }⦄ body index result none count head tail ⦃post⦄

                                                                                                                                                                                                                                                                                                        Apply the same completion contract at independently named source inputs. The actual action has canonical arguments, so native specification lookup does not need to infer a tuple from its projections.

                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.completion_spec_at {pre✝ : Visible → Heap → Prop} {normal✝ : Visible → Heap → Visible → Heap → Prop} {returned✝ : Visible → Heap → Option (NodeRef CellTy.nat) → Visible → Heap → Prop} :
                                                                                                                                                                                                                                                                                                        completion_contract pre✝ normal✝ returned✝ → ∀ (start : Visible) (post : Std.Do.PostCond (Control (Ty.node CellTy.nat).option × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ start heap ∧ (∀ (output : Visible) (finish : Heap), normal✝ start heap output finish → (post.1 (Control.normal, reconstruct (entry start) none output) finish).down) ∧ ∀ (value : Option (NodeRef CellTy.nat)) (output : Visible) (finish : Heap), returned✝ start heap value output finish → (post.1 (Control.normal, reconstruct (entry start) (some value) output) finish).down }⦄ prependRange_loop1 (entry start).1 (entry start).2.1 (entry start).2.2.1 (entry start).2.2.2.1 (entry start).2.2.2.2.1 (entry start).2.2.2.2.2.1 ⦃post⦄

                                                                                                                                                                                                                                                                                                        Apply the visible completion contract, reconstructing the full output from this same actual execution rather than guessing hidden coordinates.

                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.variant_contract (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (invariant✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (variant✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ) (ready✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (normal✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (returned✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                        (guard_contract count head tail invariant✝ (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => False) fun (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap) (again : Bool) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => if again = true then ready✝ index result output_join heap after_index after_result after_output_join finish else normal✝ after_index after_result after_output_join finish) → (∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap), invariant✝ index result output_join heap → body_contract count head tail (ready✝ index result output_join heap) (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => invariant✝ after_index after_result after_output_join finish ∧ variant✝ after_index after_result after_output_join finish < variant✝ index result output_join heap) fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (value : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => returned✝ value after_index after_result after_output_join finish) → contract count head tail invariant✝ (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => normal✝ after_index after_result after_output_join finish) fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (value : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => returned✝ value after_index after_result after_output_join finish

                                                                                                                                                                                                                                                                                                        Prove a named loop from independent mathematical guard and body contracts. Actual guard effects and early body returns are retained; only normal iterations decrease.

                                                                                                                                                                                                                                                                                                        Source lexical immutability preserves these captures on every actual exit.

                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.rel_contract (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) {Model✝ : Type} (stateRel✝ : Model✝ → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (invariant✝ : Model✝ → Prop) {relation✝ : Model✝ → Model✝ → Prop} :
                                                                                                                                                                                                                                                                                                        WellFounded relation✝ → ∀ (ready : Model✝ → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (normal : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop) (returned : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop), (∀ (model : Model✝), invariant✝ model → guard_contract count head tail (stateRel✝ model) (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => False) fun (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap) (again : Bool) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => if again = true then ready model index result output_join heap after_index after_result after_output_join finish else normal after_index after_result after_output_join finish) → (∀ (model : Model✝) (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (heap : Heap), invariant✝ model → stateRel✝ model index result output_join heap → body_contract count head tail (ready model index result output_join heap) (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => ∃ (next : Model✝), invariant✝ next ∧ stateRel✝ next after_index after_result after_output_join finish ∧ relation✝ next model) fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (value : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => returned value after_index after_result after_output_join finish) → ∀ (model : Model✝), invariant✝ model → contract count head tail (stateRel✝ model) (fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => normal after_index after_result after_output_join finish) fun (x : ℕ) (x_1 : Option (NodeRef CellTy.nat)) (x_2 : Option (Option (NodeRef CellTy.nat))) (x_3 : Heap) (value : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap) => returned value after_index after_result after_output_join finish

                                                                                                                                                                                                                                                                                                        Prove this actual loop using a related mathematical state and well-founded progress. Fixed captures are retained by the generated execution frames.

                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                        Author relations use visible locals and actual endpoint heaps. The existing action still returns its full locals and actual source control.

                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.completion_spec {pre✝ : Visible → Heap → Prop} {normal✝ : Visible → Heap → Visible → Heap → Prop} {returned✝ : Visible → Heap → Option (NodeRef CellTy.nat) → Visible → Heap → Prop} :
                                                                                                                                                                                                                                                                                                          completion_contract pre✝ normal✝ returned✝ → ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) (post : Std.Do.PostCond (Control (Ty.node CellTy.nat).option × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ (index, result, count, head, tail, ()) heap ∧ (∀ (output : Visible) (finish : Heap), normal✝ (index, result, count, head, tail, ()) heap output finish → (post.1 (Control.normal, reconstruct (entry (index, result, count, head, tail, ())) none output) finish).down) ∧ ∀ (value : Option (NodeRef CellTy.nat)) (output : Visible) (finish : Heap), returned✝ (index, result, count, head, tail, ()) heap value output finish → (post.1 (Control.normal, reconstruct (entry (index, result, count, head, tail, ())) (some value) output) finish).down }⦄ prependRange_loop1 index result none count head tail ⦃post⦄

                                                                                                                                                                                                                                                                                                          Apply the same completion contract at independently named source inputs. The actual action has canonical arguments, so native specification lookup does not need to infer a tuple from its projections.

                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.guard_observe (locals✝ : Locals) :
                                                                                                                                                                                                                                                                                                          Stmt.observe View Guard program locals✝ = guard locals✝.1 locals✝.2.1 locals✝.2.2.1 locals✝.2.2.2.1 locals✝.2.2.2.2.1 locals✝.2.2.2.2.2.1

                                                                                                                                                                                                                                                                                                          Coordinate conversion for composing this named observation.

                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                          Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.scopeSafe_reconstruct (rootHeap✝ finalHeap✝ : Heap) (start✝ visible✝ : Visible) (pending✝ : Option (Option (NodeRef CellTy.nat))) :
                                                                                                                                                                                                                                                                                                            ScopeSafe rootHeap✝ { locals := View.symm (reconstruct (entry start✝) pending✝ visible✝), heap := finalHeap✝ } Control.normal ↔ VisibleRooted rootHeap✝ visible✝ ∧ ValueRooted rootHeap✝ pending✝

                                                                                                                                                                                                                                                                                                            The original full scratch safety condition after actual frame restoration. Ancestor slots are empty at entry; the current completion remains a checked root.

                                                                                                                                                                                                                                                                                                            The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                              The actual source block observed with ordinary named local inputs.

                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.body_completion_spec_at {pre✝ : Visible → Heap → Prop} {normal✝ : Visible → Heap → Visible → Heap → Prop} {returned✝ : Visible → Heap → Option (NodeRef CellTy.nat) → Visible → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                  body_completion_contract pre✝ normal✝ returned✝ → ∀ (start : Visible) (post : Std.Do.PostCond (Control (Ty.node CellTy.nat).option × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ start heap ∧ (∀ (output : Visible) (finish : Heap), normal✝ start heap output finish → (post.1 (Control.normal, reconstruct (entry start) none output) finish).down) ∧ ∀ (value : Option (NodeRef CellTy.nat)) (output : Visible) (finish : Heap), returned✝ start heap value output finish → (post.1 (Control.normal, reconstruct (entry start) (some value) output) finish).down }⦄ body (entry start).1 (entry start).2.1 (entry start).2.2.1 (entry start).2.2.2.1 (entry start).2.2.2.2.1 (entry start).2.2.2.2.2.1 ⦃post⦄

                                                                                                                                                                                                                                                                                                                  Apply the visible completion contract, reconstructing the full output from this same actual execution rather than guessing hidden coordinates.

                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                  Restore the same full locals, retaining the ancestor slots from entry.

                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.prependRange_action_rel_native (count head : ℕ) (tail : List ℕ) (tail_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel tail tail_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.prependRange count head tail_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (prependRange count head tail) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                    Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                    Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                      The actual source block observed with ordinary named local inputs.

                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_eq (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                        prependRange count head tail = have output_join := none; have result := tail; have index := 0; have positiveStep := ⋯; do let __discr ← MonadLift.monadLift (prependRange_loop1 index result output_join count head tail) match __discr with | (loopControl, loopLocals) => have index := loopLocals.1; have result := loopLocals.2.1; have output_join := loopLocals.2.2.1; have __do_jp := fun (output_join : Option (Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (output_join : Option (Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match output_join with | none => do let y ← pure () __do_jp y | some payload => pure payload; match output_join with | none => have output_join := some result; do let y ← pure () __do_jp output_join y | some val => do let y ← pure () __do_jp output_join y; match loopControl with | Control.normal => do let y ← pure () __do_jp output_join y | Control.returned returned => pure returned | Control.fault error => do let y ← throw error __do_jp output_join y

                                                                                                                                                                                                                                                                                                                        One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                        Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.prependRange_action_rel_native_preserving (count head : ℕ) (tail : List ℕ) (tail_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                        (Representation.list CellTy.nat).Rel tail tail_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.prependRange count head tail_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (prependRange count head tail) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                        Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                        Actual finite execution fixes every ancestor completion slot. This restores full locals; it does not discard roots or assume successful cleanup.

                                                                                                                                                                                                                                                                                                                        The actual value-producing guard, reevaluated on every iteration.

                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                          Relational total correctness with ordinary mutable parameters and fixed captures. The existing block contract retains both actual heaps and excludes faults.

                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.regroup_apply (values✝ : Locals) :
                                                                                                                                                                                                                                                                                                                            Regroup values✝ = ((values✝.1, values✝.2.1, values✝.2.2.1, ()), values✝.2.2.2.1, values✝.2.2.2.2.1, values✝.2.2.2.2.2.1, ())
                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.body_spec (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) {pre✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} {normal✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} {returned✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                            body_contract count head tail pre✝ normal✝ returned✝ → ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (post : Std.Do.PostCond (Control (Ty.node CellTy.nat).option × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ index result output_join heap ∧ (∀ (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap), normal✝ index result output_join heap after_index after_result after_output_join finish → (post.1 (Control.normal, after_index, after_result, after_output_join, count, head, tail, ()) finish).down) ∧ ∀ (value : Option (NodeRef CellTy.nat)) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap), returned✝ index result output_join heap value after_index after_result after_output_join finish → (post.1 (Control.returned value, after_index, after_result, after_output_join, count, head, tail, ()) finish).down }⦄ body index result output_join count head tail ⦃post⦄

                                                                                                                                                                                                                                                                                                                            Apply a chosen mathematical contract to the native block action. Continuations see ordinary mutable outputs; proved frames restore the fixed captures.

                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.choosePrepend_action_rel_native (choose : Bool) (head : ℕ) (tail : List ℕ) (tail_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                            (Representation.list CellTy.nat).Rel tail tail_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.choosePrepend choose head tail_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (choosePrepend choose head tail) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                            Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                            The actual parsed lexical body, with its enclosing return type.

                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                              The actual source block observed with ordinary named local inputs.

                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                  Actual finite execution fixes every ancestor completion slot. This restores full locals; it does not discard roots or assume successful cleanup.

                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                  Project source-visible coordinates from the unchanged full locals.

                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                    Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                      Author relations use visible locals and actual endpoint heaps. The existing action still returns its full locals and actual source control.

                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.choosePrepend_eq (choose : Bool) (head : ℕ) (tail : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                        choosePrepend choose head tail = have result := tail; have __do_jp := fun (result : Option (NodeRef CellTy.nat)) (y : Unit) => pure result; if choose = true then do let r ← Operations.consNat.cons head result have result : Option (NodeRef CellTy.nat) := r let y ← pure () __do_jp result y else do let y ← pure () __do_jp result y

                                                                                                                                                                                                                                                                                                                                        One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.continue_eq (entry✝ : Env [Ty.nat, (Ty.node CellTy.nat).option, (Ty.node CellTy.nat).option.option, Ty.nat, Ty.nat, (Ty.node CellTy.nat).option]) (next✝ : Env [Ty.nat, (Ty.node CellTy.nat).option, (Ty.node CellTy.nat).option.option, Ty.nat, Ty.nat, (Ty.node CellTy.nat).option] → ExceptT Fault (StateT Heap Part) (Option (NodeRef CellTy.nat))) :
                                                                                                                                                                                                                                                                                                                                        Code.evalWith program entry✝ next✝ = do let __discr ← MonadLift.monadLift (prependRange_loop1 (View entry✝).1 (View entry✝).2.1 (View entry✝).2.2.1 (View entry✝).2.2.2.1 (View entry✝).2.2.2.2.1 (View entry✝).2.2.2.2.2.1) match __discr with | (control, locals) => match control with | Control.normal => next✝ (Env.cons locals.1 (Env.cons locals.2.1 (Env.cons locals.2.2.1 (Env.cons (entry✝.get Var.here.there.there.there) (Env.cons (entry✝.get Var.here.there.there.there.there) (Env.cons (entry✝.get Var.here.there.there.there.there.there) Env.empty)))))) | Control.returned value => pure value | Control.fault error => throw error

                                                                                                                                                                                                                                                                                                                                        Resume from actual mutable locals; immutable captures are preserved by the source frame.

                                                                                                                                                                                                                                                                                                                                        The completion observation is the actual source slot read.

                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                        Relational total correctness with ordinary mutable parameters and fixed captures. The existing block contract retains both actual heaps and excludes faults.

                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.RangeNative.Source.prependRange_loop1.guard_spec (count head : ℕ) (tail : Option (NodeRef CellTy.nat)) {pre✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} {normal✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} {returned✝ : ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Bool → ℕ → Option (NodeRef CellTy.nat) → Option (Option (NodeRef CellTy.nat)) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                          guard_contract count head tail pre✝ normal✝ returned✝ → ∀ (index : ℕ) (result : Option (NodeRef CellTy.nat)) (output_join : Option (Option (NodeRef CellTy.nat))) (post : Std.Do.PostCond (Control Ty.bool × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ index result output_join heap ∧ (∀ (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap), normal✝ index result output_join heap after_index after_result after_output_join finish → (post.1 (Control.normal, after_index, after_result, after_output_join, count, head, tail, ()) finish).down) ∧ ∀ (value : Bool) (after_index : ℕ) (after_result : Option (NodeRef CellTy.nat)) (after_output_join : Option (Option (NodeRef CellTy.nat))) (finish : Heap), returned✝ index result output_join heap value after_index after_result after_output_join finish → (post.1 (Control.returned value, after_index, after_result, after_output_join, count, head, tail, ()) finish).down }⦄ guard index result output_join count head tail ⦃post⦄

                                                                                                                                                                                                                                                                                                                                          Apply a chosen mathematical contract to the native block action. Continuations see ordinary mutable outputs; proved frames restore the fixed captures.

                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.choosePrepend_eq (choose : Bool) (head : ℕ) (tail : List ℕ) :
                                                                                                                                                                                                                                                                                                                                          RangeNative.choosePrepend choose head tail = if choose = true then head :: tail else tail

                                                                                                                                                                                                                                                                                                                                          A statement branch updates the represented mutable local only on its selected path; the mathematical result uses the ordinary List constructor.

                                                                                                                                                                                                                                                                                                                                          Ordinary finite-list induction proves the range's result. The generated source correspondence supplies the allocating loop and its intermediate heaps.

                                                                                                                                                                                                                                                                                                                                          Mutable branch correctness reuses the same generated source refinement, without assumptions about word width, allocation capacity or a time budget.

                                                                                                                                                                                                                                                                                                                                          Finite allocating iteration has budget-free source total correctness from the ordinary replicate equation; no second source-loop induction is supplied.

                                                                                                                                                                                                                                                                                                                                          A mathematical record whose array field is backed by actual source storage.

                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                            Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                            This actual source block, retaining its loop or allocation-scope semantics.

                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.spec (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) {pre✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} {normal✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} {returned✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                              contract count chunk initial pre✝ normal✝ returned✝ → ∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (post : Std.Do.PostCond (Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ remaining state heap ∧ (∀ (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap), normal✝ remaining state heap after_remaining after_state finish → (post.1 (Control.normal, after_remaining, after_state, count, chunk, initial, ()) finish).down) ∧ ∀ (value : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap), returned✝ remaining state heap value after_remaining after_state finish → (post.1 (Control.returned value, after_remaining, after_state, count, chunk, initial, ()) finish).down }⦄ repeatAppend_loop1 remaining state count chunk initial ⦃post⦄

                                                                                                                                                                                                                                                                                                                                              Apply a chosen mathematical contract to the native block action. Continuations see ordinary mutable outputs; proved frames restore the fixed captures.

                                                                                                                                                                                                                                                                                                                                              Assemble mathematical locals using source-variable parameter names.

                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                Relational total correctness with ordinary mutable parameters and fixed captures. The existing block contract retains both actual heaps and excludes faults.

                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_spec {pre✝ : Env [Ty.nat, Ty.buffer CellTy.nat, (Ty.buffer CellTy.nat).prod Ty.nat] → Heap → Prop} {post✝ : Env [Ty.nat, Ty.buffer CellTy.nat, (Ty.buffer CellTy.nat).prod Ty.nat] → Heap → Buffer CellTy.nat × ℕ → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                  FunctionTotal program repeatAppendId pre✝ post✝ → ∀ (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (continuation : Std.Do.PostCond (Buffer CellTy.nat × ℕ) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons count (Env.cons chunk (Env.cons initial Env.empty))) initialHeap ∧ ∀ (value : Buffer CellTy.nat × ℕ) (finalHeap : Heap), post✝ (Env.cons count (Env.cons chunk (Env.cons initial Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ repeatAppend count chunk initial ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                  Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                  The mathematical local update of a normal actual loop round.

                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_contract_iff_triple (pre✝ : ℕ → Buffer CellTy.nat → Buffer CellTy.nat × ℕ → Heap → Prop) (post✝ : ℕ → Buffer CellTy.nat → Buffer CellTy.nat × ℕ → Heap → Buffer CellTy.nat × ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                    repeatAppend_contract pre✝ post✝ ↔ ∀ (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ count chunk initial initialHeap }⦄ repeatAppend count chunk initial ⦃(fun (value : Buffer CellTy.nat × ℕ) (finalHeap : Heap) => { down := post✝ count chunk initial initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                    Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                    The actual source block observed with ordinary named local inputs.

                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                      Signatures of the functions added by this source declaration.

                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                        Extract a field's observation without source-coordinate transport.

                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                        The checked representation of this field at its current heap.

                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.model_contract (invariant✝ : Model → Prop) {relation✝ : Model → Model → Prop} :
                                                                                                                                                                                                                                                                                                                                                          WellFounded relation✝ → (∀ (model : Model), invariant✝ model → modelGuard model = true → invariant✝ (modelStep model)) → (∀ (model : Model), invariant✝ model → modelGuard model = true → relation✝ (modelStep model) model) → ∀ (whileState : Model), invariant✝ whileState → Stmt.BlockSpec (fun (locals : Locals) => Stmt.observe View Code program locals) (modelRel whileState) (fun (x : Locals) (x_1 : Heap) (output : Locals) (finish : Heap) => ∃ (finalModel : Model), modelRel finalModel output finish ∧ invariant✝ finalModel ∧ modelGuard finalModel = false) fun (x : Locals) (x_1 : Heap) (x_2 : Value ((Ty.buffer CellTy.nat).prod Ty.nat)) (x_3 : Locals) (x_4 : Heap) => False

                                                                                                                                                                                                                                                                                                                                                          Mathematical invariant preservation and descent prove the original named loop.

                                                                                                                                                                                                                                                                                                                                                          A lossless coordinate permutation; no source operation is executed.

                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                            The actual source block observed with ordinary named local inputs.

                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.model_rel_remaining {whileState✝ : Model} {locals✝ : Locals} {heap✝ : Heap} :
                                                                                                                                                                                                                                                                                                                                                              modelRel whileState✝ locals✝ heap✝ → (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel whileState✝.1 locals✝.1 heap✝

                                                                                                                                                                                                                                                                                                                                                              Extract a field's observation without source-coordinate transport.

                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_eq (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) :
                                                                                                                                                                                                                                                                                                                                                              repeatAppend count chunk initial = have state := initial; have remaining := count; do let __discr ← MonadLift.monadLift (repeatAppend_loop1 remaining state count chunk initial) match __discr with | (loopControl, loopLocals) => have remaining := loopLocals.1; have state := loopLocals.2.1; have __do_jp := fun (y : Unit) => pure state; match loopControl with | Control.normal => do let y ← pure () __do_jp y | Control.returned returned => pure returned | Control.fault error => do let y ← throw error __do_jp y

                                                                                                                                                                                                                                                                                                                                                              One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                              Relational total correctness with ordinary mutable parameters and fixed captures. The existing block contract retains both actual heaps and excludes faults.

                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.regroup_symm_apply (grouped✝ : Mutable × Captured) :
                                                                                                                                                                                                                                                                                                                                                                Regroup.symm grouped✝ = (grouped✝.1.1, grouped✝.1.2.1, grouped✝.2.1, grouped✝.2.2.1, grouped✝.2.2.2.1, ())

                                                                                                                                                                                                                                                                                                                                                                Source lexical immutability preserves these captures on every actual exit.

                                                                                                                                                                                                                                                                                                                                                                Lossless proof coordinates, including fixed and shadowed captures.

                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.wellFounded_contract (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (invariant✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (relation✝ : Mutable × Heap → Mutable × Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                  WellFounded relation✝ → ∀ (ready : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (normal : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (returned : Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop), (guard_contract count chunk initial invariant✝ (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => False) fun (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap) (again : Bool) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => if again = true then ready remaining state heap after_remaining after_state finish else normal after_remaining after_state finish) → (∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap), invariant✝ remaining state heap → body_contract count chunk initial (ready remaining state heap) (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => invariant✝ after_remaining after_state finish ∧ relation✝ ((after_remaining, after_state, ()), finish) ((remaining, state, ()), heap)) fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (value : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => returned value after_remaining after_state finish) → contract count chunk initial invariant✝ (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => normal after_remaining after_state finish) fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (value : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => returned value after_remaining after_state finish

                                                                                                                                                                                                                                                                                                                                                                  Prove a named loop from independent mathematical guard and body contracts. Actual guard effects and early body returns are retained; only normal iterations decrease.

                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.model_spec (invariant✝ : Model → Prop) {relation✝ : Model → Model → Prop} :
                                                                                                                                                                                                                                                                                                                                                                  WellFounded relation✝ → (∀ (model : Model), invariant✝ model → modelGuard model = true → invariant✝ (modelStep model)) → (∀ (model : Model), invariant✝ model → modelGuard model = true → relation✝ (modelStep model) model) → ∀ (whileState : Model), invariant✝ whileState → ∀ (remaining : Value Ty.nat) (state : Value ((Ty.buffer CellTy.nat).prod Ty.nat)) (count : Value Ty.nat) (chunk : Value (Ty.buffer CellTy.nat)) (initial : Value ((Ty.buffer CellTy.nat).prod Ty.nat)) (post : Std.Do.PostCond (Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := modelRel whileState (remaining, state, count, chunk, initial, ()) heap ∧ ∀ (finalModel : Model) (output : Locals) (finish : Heap), modelRel finalModel output finish → invariant✝ finalModel → modelGuard finalModel = false → (post.1 (Control.normal, output) finish).down }⦄ repeatAppend_loop1 remaining state count chunk initial ⦃post⦄

                                                                                                                                                                                                                                                                                                                                                                  Use the mathematical loop contract with the actual source continuation.

                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                  Complete lexical coordinates for this source block.

                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.guard_spec (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) {pre✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} {normal✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} {returned✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Bool → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                    guard_contract count chunk initial pre✝ normal✝ returned✝ → ∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (post : Std.Do.PostCond (Control Ty.bool × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ remaining state heap ∧ (∀ (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap), normal✝ remaining state heap after_remaining after_state finish → (post.1 (Control.normal, after_remaining, after_state, count, chunk, initial, ()) finish).down) ∧ ∀ (value : Bool) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap), returned✝ remaining state heap value after_remaining after_state finish → (post.1 (Control.returned value, after_remaining, after_state, count, chunk, initial, ()) finish).down }⦄ guard remaining state count chunk initial ⦃post⦄

                                                                                                                                                                                                                                                                                                                                                                    Apply a chosen mathematical contract to the native block action. Continuations see ordinary mutable outputs; proved frames restore the fixed captures.

                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.body_observe (locals✝ : Locals) :
                                                                                                                                                                                                                                                                                                                                                                    Stmt.observe View Body program locals✝ = body locals✝.1 locals✝.2.1 locals✝.2.2.1 locals✝.2.2.2.1 locals✝.2.2.2.2.1

                                                                                                                                                                                                                                                                                                                                                                    Coordinate conversion for composing this named observation.

                                                                                                                                                                                                                                                                                                                                                                    Extract a field's observation without source-coordinate transport.

                                                                                                                                                                                                                                                                                                                                                                    The finite table of actual named source bodies.

                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.guard_contract_iff (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (pre✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (normal✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (returned✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Bool → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                      guard_contract count chunk initial pre✝ normal✝ returned✝ ↔ ∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap), pre✝ remaining state heap → ⦃fun (current : Heap) => { down := current = heap }⦄ guard remaining state count chunk initial ⦃(fun (outcome : Control Ty.bool × Locals) (finish : Heap) => { down := match outcome.1 with | Control.normal => have after := outcome.2; normal✝ remaining state heap after.1 after.2.1 finish | Control.returned value => have after := outcome.2; returned✝ remaining state heap value after.1 after.2.1 finish | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                      Introduce named mutable variables directly, without unpacking internal coordinates.

                                                                                                                                                                                                                                                                                                                                                                      The same complete environment, grouped by source mutability.

                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                        Source lexical immutability preserves these captures on every actual exit.

                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.body_model (whileState✝ : Model) :
                                                                                                                                                                                                                                                                                                                                                                        Stmt.BlockSpec (fun (locals : Locals) => Stmt.observe View Body program locals) (modelRel whileState✝) (fun (x : Locals) (x_1 : Heap) (output : Locals) (finish : Heap) => modelRel (modelStep whileState✝) output finish) fun (x : Locals) (x_1 : Heap) (x_2 : Value ((Ty.buffer CellTy.nat).prod Ty.nat)) (x_3 : Locals) (x_4 : Heap) => False

                                                                                                                                                                                                                                                                                                                                                                        The mathematical round describes the actual named source block and its final heap.

                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.regroup_apply (values✝ : Locals) :
                                                                                                                                                                                                                                                                                                                                                                        Regroup values✝ = ((values✝.1, values✝.2.1, ()), values✝.2.2.1, values✝.2.2.2.1, values✝.2.2.2.2.1, ())
                                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                        The checked representation of this field at its current heap.

                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                          Ordinary mathematical values of the loop's lexical source bindings.

                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.count_frame_contract (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (count✝ : ℕ → Buffer CellTy.nat × ℕ → ℕ) (limit✝ : ℕ) (invariant✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (frame✝ : Heap → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                            (∀ {a b c : Heap}, frame✝ a b → frame✝ b c → frame✝ a c) → ∀ (normal : Heap → Prop), (guard_contract count chunk initial invariant✝ (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (x_3 : Heap) => False) fun (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap) (again : Bool) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => count✝ after_remaining after_state = count✝ remaining state ∧ finish = heap ∧ invariant✝ after_remaining after_state finish ∧ (again = true ↔ count✝ after_remaining after_state < limit✝)) → (body_contract count chunk initial (fun (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap) => invariant✝ remaining state heap ∧ count✝ remaining state < limit✝) (fun (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => count✝ after_remaining after_state = count✝ remaining state + 1 ∧ invariant✝ after_remaining after_state finish ∧ frame✝ heap finish) fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (x_3 : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (x_4 : Heap) => False) → (∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap), invariant✝ remaining state heap → limit✝ ≤ count✝ remaining state → normal heap) → ∀ (initial✝ : Heap), contract count chunk initial (fun (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap) => invariant✝ remaining state heap ∧ frame✝ initial✝ heap) (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => normal finish ∧ frame✝ initial✝ finish) fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (x_3 : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (x_4 : Heap) => False

                                                                                                                                                                                                                                                                                                                                                                            Compose an increasing count and a transitive heap frame from the actual guard and body contracts. The guard preserves the count and heap; normal body steps increase the count by one. Array effects and the exit consequence remain supplied mathematical facts, without a runtime budget.

                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.wellFounded_spec (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (invariant✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (relation✝ : Mutable × Heap → Mutable × Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                            WellFounded relation✝ → ∀ (normal : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (returned : Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop), (∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (startHeap : Heap), invariant✝ remaining state startHeap → ⦃fun (currentHeap : Heap) => { down := currentHeap = startHeap }⦄ guard remaining state count chunk initial ⦃(fun (guardOutcome : Control Ty.bool × Locals) (afterGuardHeap : Heap) => { down := have afterGuard_remaining := guardOutcome.2.1; have afterGuard_state := guardOutcome.2.2.1; match guardOutcome.1 with | Control.returned again => if again = true then ⦃fun (currentHeap : Heap) => { down := currentHeap = afterGuardHeap }⦄ body afterGuard_remaining afterGuard_state count chunk initial ⦃(fun (bodyOutcome : Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (afterBodyHeap : Heap) => { down := have afterBody_remaining := bodyOutcome.2.1; have afterBody_state := bodyOutcome.2.2.1; match bodyOutcome.1 with | Control.normal => invariant✝ afterBody_remaining afterBody_state afterBodyHeap ∧ relation✝ ((afterBody_remaining, afterBody_state, ()), afterBodyHeap) ((remaining, state, ()), startHeap) | Control.returned value => returned value afterBody_remaining afterBody_state afterBodyHeap | Control.fault a => False }, PUnit.unit)⦄ else normal afterGuard_remaining afterGuard_state afterGuardHeap | Control.normal => False | Control.fault a => False }, PUnit.unit)⦄) → ∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ), ⦃fun (heap : Heap) => { down := invariant✝ remaining state heap }⦄ repeatAppend_loop1 remaining state count chunk initial ⦃(fun (outcome : Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (heap : Heap) => { down := have final_remaining := outcome.2.1; have final_state := outcome.2.2.1; match outcome.1 with | Control.normal => normal final_remaining final_state heap | Control.returned value => returned value final_remaining final_state heap | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                            Prove this actual loop with fixed captures and well-founded progress on its mutable locals. Only normal body exits must decrease; guard effects, returns and faults retain their real heap.

                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                            Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.captureView_symm_apply (grouped✝ : Mutable × Captured) :
                                                                                                                                                                                                                                                                                                                                                                              CaptureView.symm grouped✝ = View.symm (grouped✝.1.1, grouped✝.1.2.1, grouped✝.2.1, grouped✝.2.2.1, grouped✝.2.2.2.1, ())

                                                                                                                                                                                                                                                                                                                                                                              Restore grouped locals using the checked coordinate projection laws.

                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                              Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                  The source program's declared first-order signatures.

                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                    Fixed lexical captures, independent of the shared heap.

                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.observe (locals✝ : Locals) :
                                                                                                                                                                                                                                                                                                                                                                                      Stmt.observe View Code program locals✝ = repeatAppend_loop1 locals✝.1 locals✝.2.1 locals✝.2.2.1 locals✝.2.2.2.1 locals✝.2.2.2.2.1

                                                                                                                                                                                                                                                                                                                                                                                      Coordinate conversion for composing this named observation.

                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.body_contract_iff (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (pre✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (normal✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (returned✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                      body_contract count chunk initial pre✝ normal✝ returned✝ ↔ ∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap), pre✝ remaining state heap → ⦃fun (current : Heap) => { down := current = heap }⦄ body remaining state count chunk initial ⦃(fun (outcome : Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (finish : Heap) => { down := match outcome.1 with | Control.normal => have after := outcome.2; normal✝ remaining state heap after.1 after.2.1 finish | Control.returned value => have after := outcome.2; returned✝ remaining state heap value after.1 after.2.1 finish | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                      Introduce named mutable variables directly, without unpacking internal coordinates.

                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.variant_contract (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (invariant✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (variant✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ) (ready✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (normal✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (returned✝ : Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                      (guard_contract count chunk initial invariant✝ (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => False) fun (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap) (again : Bool) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => if again = true then ready✝ remaining state heap after_remaining after_state finish else normal✝ after_remaining after_state finish) → (∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap), invariant✝ remaining state heap → body_contract count chunk initial (ready✝ remaining state heap) (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => invariant✝ after_remaining after_state finish ∧ variant✝ after_remaining after_state finish < variant✝ remaining state heap) fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (value : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => returned✝ value after_remaining after_state finish) → contract count chunk initial invariant✝ (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => normal✝ after_remaining after_state finish) fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (value : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => returned✝ value after_remaining after_state finish

                                                                                                                                                                                                                                                                                                                                                                                      Prove a named loop from independent mathematical guard and body contracts. Actual guard effects and early body returns are retained; only normal iterations decrease.

                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.continue_eq (entry✝ : Env [Ty.nat, (Ty.buffer CellTy.nat).prod Ty.nat, Ty.nat, Ty.buffer CellTy.nat, (Ty.buffer CellTy.nat).prod Ty.nat]) (next✝ : Env [Ty.nat, (Ty.buffer CellTy.nat).prod Ty.nat, Ty.nat, Ty.buffer CellTy.nat, (Ty.buffer CellTy.nat).prod Ty.nat] → ExceptT Fault (StateT Heap Part) (Buffer CellTy.nat × ℕ)) :
                                                                                                                                                                                                                                                                                                                                                                                      Code.evalWith program entry✝ next✝ = do let __discr ← MonadLift.monadLift (repeatAppend_loop1 (View entry✝).1 (View entry✝).2.1 (View entry✝).2.2.1 (View entry✝).2.2.2.1 (View entry✝).2.2.2.2.1) match __discr with | (control, locals) => match control with | Control.normal => next✝ (Env.cons locals.1 (Env.cons locals.2.1 (Env.cons (entry✝.get Var.here.there.there) (Env.cons (entry✝.get Var.here.there.there.there) (Env.cons (entry✝.get Var.here.there.there.there.there) Env.empty))))) | Control.returned value => pure value | Control.fault error => throw error

                                                                                                                                                                                                                                                                                                                                                                                      Resume from actual mutable locals; immutable captures are preserved by the source frame.

                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.rel_contract (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) {Model✝ : Type} (stateRel✝ : Model✝ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (invariant✝ : Model✝ → Prop) {relation✝ : Model✝ → Model✝ → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                      WellFounded relation✝ → ∀ (ready : Model✝ → ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (normal : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (returned : Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop), (∀ (model : Model✝), invariant✝ model → guard_contract count chunk initial (stateRel✝ model) (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => False) fun (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap) (again : Bool) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => if again = true then ready model remaining state heap after_remaining after_state finish else normal after_remaining after_state finish) → (∀ (model : Model✝) (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap), invariant✝ model → stateRel✝ model remaining state heap → body_contract count chunk initial (ready model remaining state heap) (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => ∃ (next : Model✝), invariant✝ next ∧ stateRel✝ next after_remaining after_state finish ∧ relation✝ next model) fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (value : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => returned value after_remaining after_state finish) → ∀ (model : Model✝), invariant✝ model → contract count chunk initial (stateRel✝ model) (fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => normal after_remaining after_state finish) fun (x : ℕ) (x_1 : Buffer CellTy.nat × ℕ) (x_2 : Heap) (value : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap) => returned value after_remaining after_state finish

                                                                                                                                                                                                                                                                                                                                                                                      Prove this actual loop using a related mathematical state and well-founded progress. Fixed captures are retained by the generated execution frames.

                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.contract_iff (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (pre✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (normal✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (returned✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                      contract count chunk initial pre✝ normal✝ returned✝ ↔ ∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (heap : Heap), pre✝ remaining state heap → ⦃fun (current : Heap) => { down := current = heap }⦄ repeatAppend_loop1 remaining state count chunk initial ⦃(fun (outcome : Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (finish : Heap) => { down := match outcome.1 with | Control.normal => have after := outcome.2; normal✝ remaining state heap after.1 after.2.1 finish | Control.returned value => have after := outcome.2; returned✝ remaining state heap value after.1 after.2.1 finish | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                      Introduce named mutable variables directly, without unpacking internal coordinates.

                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.model_rel_count {whileState✝ : Model} {locals✝ : Locals} {heap✝ : Heap} :
                                                                                                                                                                                                                                                                                                                                                                                      modelRel whileState✝ locals✝ heap✝ → (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel whileState✝.2.2.2.2 locals✝.2.2.1 heap✝

                                                                                                                                                                                                                                                                                                                                                                                      Extract a field's observation without source-coordinate transport.

                                                                                                                                                                                                                                                                                                                                                                                      The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                        Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.model_rel_chunk {whileState✝ : Model} {locals✝ : Locals} {heap✝ : Heap} :
                                                                                                                                                                                                                                                                                                                                                                                          modelRel whileState✝ locals✝ heap✝ → (Representation.array CellTy.nat).Rel whileState✝.2.2.2.1 locals✝.2.2.2.1 heap✝

                                                                                                                                                                                                                                                                                                                                                                                          Extract a field's observation without source-coordinate transport.

                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.guard_observe (locals✝ : Locals) :
                                                                                                                                                                                                                                                                                                                                                                                          Stmt.observe View Guard program locals✝ = guard locals✝.1 locals✝.2.1 locals✝.2.2.1 locals✝.2.2.2.1 locals✝.2.2.2.2.1

                                                                                                                                                                                                                                                                                                                                                                                          Coordinate conversion for composing this named observation.

                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.guard_model (whileState✝ : Model) :
                                                                                                                                                                                                                                                                                                                                                                                          Stmt.BlockSpec (fun (locals : Locals) => Stmt.observe View Guard program locals) (modelRel whileState✝) (fun (x : Locals) (x_1 : Heap) (x_2 : Locals) (x_3 : Heap) => False) fun (x : Locals) (x_1 : Heap) (again : Value Ty.bool) (output : Locals) (finish : Heap) => again = modelGuard whileState✝ ∧ modelRel whileState✝ output finish

                                                                                                                                                                                                                                                                                                                                                                                          The mathematical round describes the actual named source block and its final heap.

                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                          Relational total correctness with ordinary mutable parameters and fixed captures. The existing block contract retains both actual heaps and excludes faults.

                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                            The actual value-producing guard, reevaluated on every iteration.

                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.body_spec (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) {pre✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} {normal✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} {returned✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                              body_contract count chunk initial pre✝ normal✝ returned✝ → ∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (post : Std.Do.PostCond (Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure)), ⦃fun (heap : Heap) => { down := pre✝ remaining state heap ∧ (∀ (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap), normal✝ remaining state heap after_remaining after_state finish → (post.1 (Control.normal, after_remaining, after_state, count, chunk, initial, ()) finish).down) ∧ ∀ (value : Buffer CellTy.nat × ℕ) (after_remaining : ℕ) (after_state : Buffer CellTy.nat × ℕ) (finish : Heap), returned✝ remaining state heap value after_remaining after_state finish → (post.1 (Control.returned value, after_remaining, after_state, count, chunk, initial, ()) finish).down }⦄ body remaining state count chunk initial ⦃post⦄

                                                                                                                                                                                                                                                                                                                                                                                              Apply a chosen mathematical contract to the native block action. Continuations see ordinary mutable outputs; proved frames restore the fixed captures.

                                                                                                                                                                                                                                                                                                                                                                                              Added function bodies already typed against the complete linked table.

                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.variant_spec (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (invariant✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (variant✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → ℕ) (normal✝ : ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) (returned✝ : Buffer CellTy.nat × ℕ → ℕ → Buffer CellTy.nat × ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                  (∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ) (startHeap : Heap), invariant✝ remaining state startHeap → ⦃fun (currentHeap : Heap) => { down := currentHeap = startHeap }⦄ guard remaining state count chunk initial ⦃(fun (guardOutcome : Control Ty.bool × Locals) (afterGuardHeap : Heap) => { down := have afterGuard_remaining := guardOutcome.2.1; have afterGuard_state := guardOutcome.2.2.1; match guardOutcome.1 with | Control.returned again => if again = true then ⦃fun (currentHeap : Heap) => { down := currentHeap = afterGuardHeap }⦄ body afterGuard_remaining afterGuard_state count chunk initial ⦃(fun (bodyOutcome : Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (afterBodyHeap : Heap) => { down := have afterBody_remaining := bodyOutcome.2.1; have afterBody_state := bodyOutcome.2.2.1; match bodyOutcome.1 with | Control.normal => invariant✝ afterBody_remaining afterBody_state afterBodyHeap ∧ variant✝ afterBody_remaining afterBody_state afterBodyHeap < variant✝ remaining state startHeap | Control.returned value => returned✝ value afterBody_remaining afterBody_state afterBodyHeap | Control.fault a => False }, PUnit.unit)⦄ else normal✝ afterGuard_remaining afterGuard_state afterGuardHeap | Control.normal => False | Control.fault a => False }, PUnit.unit)⦄) → ∀ (remaining : ℕ) (state : Buffer CellTy.nat × ℕ), ⦃fun (heap : Heap) => { down := invariant✝ remaining state heap }⦄ repeatAppend_loop1 remaining state count chunk initial ⦃(fun (outcome : Control ((Ty.buffer CellTy.nat).prod Ty.nat) × Locals) (heap : Heap) => { down := have final_remaining := outcome.2.1; have final_state := outcome.2.2.1; match outcome.1 with | Control.normal => normal✝ final_remaining final_state heap | Control.returned value => returned✝ value final_remaining final_state heap | Control.fault a => False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                  Prove this actual loop with fixed captures and well-founded progress on its mutable locals. Only normal body exits must decrease; guard effects, returns and faults retain their real heap.

                                                                                                                                                                                                                                                                                                                                                                                                  The actual source block observed with ordinary named local inputs.

                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                    The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_loop1.view_symm_apply (values✝ : Locals) :
                                                                                                                                                                                                                                                                                                                                                                                                      View.symm values✝ = Env.cons values✝.1 (Env.cons values✝.2.1 (Env.cons values✝.2.2.1 (Env.cons values✝.2.2.2.1 (Env.cons values✝.2.2.2.2.1 Env.empty))))

                                                                                                                                                                                                                                                                                                                                                                                                      Restore complete lexical coordinates without unfolding proof fields.

                                                                                                                                                                                                                                                                                                                                                                                                      The actual parsed lexical body, with its enclosing return type.

                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeRange.ArrayRangeNative.Source.repeatAppend_total_iff (pre✝ : ℕ → Buffer CellTy.nat → Buffer CellTy.nat × ℕ → Heap → Prop) (post✝ : ℕ → Buffer CellTy.nat → Buffer CellTy.nat × ℕ → Heap → Buffer CellTy.nat × ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                        repeatAppend_contract pre✝ post✝ ↔ ∀ (count : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (initialHeap : Heap), pre✝ count chunk initial initialHeap → ∃ (value : Buffer CellTy.nat × ℕ) (finalHeap : Heap), repeatAppend count chunk initial initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ count chunk initial initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                        The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                        The mathematical guard of a single actual loop round.

                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                                                                          Observe actual locals at the current heap, retaining their real aliases.

                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                            Source lexical immutability preserves these captures on every actual exit.

                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeRange.repeatAppend_copies (count : ℕ) (chunkValues : Array ℕ) (initialValue : Payload) :
                                                                                                                                                                                                                                                                                                                                                                                                            ArrayRangeNative.Source.repeatAppend_contract (fun (actualCount : ℕ) (chunk : Buffer CellTy.nat) (initial : Buffer CellTy.nat × ℕ) (heap : Heap) => count = actualCount ∧ chunk.Contents heap chunkValues ∧ Complexity.Language.Examples.LinkedList.NativeRange.payloadRel✝ initialValue initial heap) fun (x : ℕ) (x_1 : Buffer CellTy.nat) (x_2 : Buffer CellTy.nat × ℕ) (x_3 : Heap) (result : Buffer CellTy.nat × ℕ) (finish : Heap) => ∃ (output : Payload), Complexity.Language.Examples.LinkedList.NativeRange.payloadRel✝¹ output result finish ∧ output.copies = initialValue.copies + count

                                                                                                                                                                                                                                                                                                                                                                                                            The general while has a budget-free source contract. Its mathematical state tracks the complete payload and the number of remaining copies, while the shared append contract retains the actual arrays at successive heaps.

                                                                                                                                                                                                                                                                                                                                                                                                            The source contract observes the entire returned record, including its actual final array. The supplied mathematical postcondition tracks its count; termination and correspondence require no machine resource premise.

                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                            Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                              Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.ListReducer.Source.push_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → ℕ → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → ℕ → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                              push_contract pre✝ post✝ ↔ ∀ (accumulator : Option (NodeRef CellTy.nat)) (head : ℕ) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ accumulator head initialHeap }⦄ push accumulator head ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ accumulator head initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                              Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                              The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.ListReducer.Source.push_eq (accumulator : Option (NodeRef CellTy.nat)) (head : ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                push accumulator head = do let result ← Operations.consNat.cons head accumulator pure result

                                                                                                                                                                                                                                                                                                                                                                                                                One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                Added function bodies already typed against the complete linked table.

                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                  Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                    Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                      The source program's declared first-order signatures.

                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                        The finite table of actual named source bodies.

                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                          Signatures of the functions added by this source declaration.

                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.ListReducer.Operations.consNat.cons_rel_preserving (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                            (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish ∧ Buffer.PreservesContents heap✝ finish
                                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.ListReducer.Source.push_total_iff (pre✝ : Option (NodeRef CellTy.nat) → ℕ → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → ℕ → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                            push_contract pre✝ post✝ ↔ ∀ (accumulator : Option (NodeRef CellTy.nat)) (head : ℕ) (initialHeap : Heap), pre✝ accumulator head initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), push accumulator head initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ accumulator head initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                            The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.ListReducer.push_action_rel_native (accumulator : List ℕ) (head : ℕ) (accumulator_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                            (Representation.list CellTy.nat).Rel accumulator accumulator_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.push accumulator_source✝ head initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (push accumulator head) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                            Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                            Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                              The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.ListReducer.Operations.consNat.cons_rel (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish
                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.ListReducer.push_action_rel_native_preserving (accumulator : List ℕ) (head : ℕ) (accumulator_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                (Representation.list CellTy.nat).Rel accumulator accumulator_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.push accumulator_source✝ head initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (push accumulator head) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                  The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.ListReducer.Source.push_spec {pre✝ : Env [(Ty.node CellTy.nat).option, Ty.nat] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option, Ty.nat] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                    FunctionTotal program pushId pre✝ post✝ → ∀ (accumulator : Option (NodeRef CellTy.nat)) (head : ℕ) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons accumulator (Env.cons head Env.empty)) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons accumulator (Env.cons head Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ push accumulator head ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                    Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                    Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]
                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                      Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeLists.reverseWithHead_action_rel_native (values : List ℕ) (head : ℕ) (tail : List ℕ) (values_source✝ tail_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                      (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel tail tail_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.reverseWithHead values_source✝ head tail_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (reverseWithHead values head tail) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                      Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                        Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                          Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                            The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                              Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeLists.Operations.fold1.fold_rel (initial✝ : ℕ) (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                  (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), fold initial✝ root✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (List.foldl Reducer.add initial✝ values✝) returned finish ∧ heap✝.ShapeExtends finish
                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                  The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseSum_eq (values : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                      reverseSum values = do let reversed ← reverse values let result ← Operations.fold1.fold 0 reversed pure result

                                                                                                                                                                                                                                                                                                                                                                                                                                                      One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseSum_spec {pre✝ : Env [(Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option] → Heap → ℕ → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                      FunctionTotal program reverseSumId pre✝ post✝ → ∀ (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values Env.empty) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons values Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ reverseSum values ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          The finite table of actual named source bodies.

                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                              The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeLists.reverseAppend_action_rel_native (values tail : List ℕ) (values_source✝ tail_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel tail tail_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.reverseAppend values_source✝ tail_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (reverseAppend values tail) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeLists.Operations.fold0.fold_rel (initial values✝ : List ℕ) (actual : Value (Ty.node CellTy.nat).option) (root✝ : Option (NodeRef CellTy.nat)) (heap : Heap) (accObserved : (Representation.list CellTy.nat).Rel initial actual heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      (Representation.list CellTy.nat).Rel values✝ root✝ heap → ∃ (value : Value (Ty.node CellTy.nat).option) (finish : Heap), fold actual root✝ heap = Part.some (Except.ok value, finish) ∧ (Representation.list CellTy.nat).Rel (List.foldl ListReducer.push initial values✝) value finish ∧ heap.ShapeExtends finish
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Added function bodies already typed against the complete linked table.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseSum_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          reverseSum_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values initialHeap }⦄ reverseSum values ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseWithHead_spec {pre✝ : Env [(Ty.node CellTy.nat).option, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        FunctionTotal program reverseWithHeadId pre✝ post✝ → ∀ (values : Option (NodeRef CellTy.nat)) (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values (Env.cons head (Env.cons tail Env.empty))) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons values (Env.cons head (Env.cons tail Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ reverseWithHead values head tail ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The source program's declared first-order signatures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseWithHead_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                reverseWithHead_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values head tail initialHeap }⦄ reverseWithHead values head tail ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ values head tail initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseSum_total_iff (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  reverseSum_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ values initialHeap → ∃ (value : ℕ) (finalHeap : Heap), reverseSum values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverse_spec {pre✝ : Env [(Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          FunctionTotal program reverseId pre✝ post✝ → ∀ (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values Env.empty) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons values Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ reverse values ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Actual imported function bodies with their internal calls relocated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeLists.reverseSum_action_rel_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.reverseSum values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (reverseSum values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverse_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                reverse_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values initialHeap }⦄ reverse values ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeLists.reverse_action_rel_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.reverse values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (reverse values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverse_eq (values : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                reverse values = have operand := none; do let result ← reverseAppend values operand pure result

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseWithHead_eq (values : Option (NodeRef CellTy.nat)) (head : ℕ) (tail : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                reverseWithHead values head tail = do let seeded ← ListReducer.Source.push tail head let result ← Operations.fold0.fold seeded values pure result

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverse_total_iff (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                reverse_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ values initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), reverse values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseAppend_total_iff (pre✝ : Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                reverseAppend_contract pre✝ post✝ ↔ ∀ (values tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ values tail initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), reverseAppend values tail initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values tail initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Signatures of the functions added by this source declaration.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseAppend_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    reverseAppend_contract pre✝ post✝ ↔ ∀ (values tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values tail initialHeap }⦄ reverseAppend values tail ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ values tail initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseAppend_spec {pre✝ : Env [(Ty.node CellTy.nat).option, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      FunctionTotal program reverseAppendId pre✝ post✝ → ∀ (values tail : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values (Env.cons tail Env.empty)) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons values (Env.cons tail Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ reverseAppend values tail ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeLists.Operations.fold1.fold_eq (initial✝ : ℕ) (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → fold initial✝ root✝ heap✝ = Part.some (Except.ok (List.foldl Reducer.add initial✝ values✝), heap✝)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeLists.Source.reverseWithHead_total_iff (pre✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          reverseWithHead_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (head : ℕ) (tail : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ values head tail initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), reverseWithHead values head tail initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values head tail initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The complete signature tables retained from imported source programs.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.push_eq (accumulator : List ℕ) (head : ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ListReducer.push accumulator head = head :: accumulator

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                An imported allocating callback is still an ordinary mathematical function; its generated source implementation constructs the real shared-tail node.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The author's proof reuses Lean's existing fold/cons identity. The frontend supplies callback correspondence, traversal termination and final-heap transport.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Returning the result of the same allocating traversal specializes its ordinary mathematical equation; no source-heap induction is repeated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.reverseWithHead_eq (values : List ℕ) (head : ℕ) (tail : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                NativeLists.reverseWithHead values head tail = values.reverse ++ head :: tail

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                A direct imported call and a fold of that same callback compose with their actual intermediate heap while the public proof uses ordinary List operations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                A scalar fold can consume the newly allocated list from an earlier call.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The mathematical reverse/append theorem describes the actual returned list in the final heap, with no machine budget or input-list separation premise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeBranches.choosePrepend_action_rel_native (flag : Bool) (head : ℕ) (left right : List ℕ) (left_source✝ right_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      (Representation.list CellTy.nat).Rel left left_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel right right_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.choosePrepend flag head left_source✝ right_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (choosePrepend flag head left right) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeBranches.Source.choosePrepend_total_iff (pre✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      choosePrepend_contract pre✝ post✝ ↔ ∀ (flag : Bool) (head : ℕ) (left right : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ flag head left right initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), choosePrepend flag head left right initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ flag head left right initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeBranches.chooseSum_action_rel_native (flag : Bool) (head : ℕ) (left right : List ℕ) (left_source✝ right_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      (Representation.list CellTy.nat).Rel left left_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel right right_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.chooseSum flag head left_source✝ right_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (chooseSum flag head left right) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeBranches.choosePrepend_action_rel_native_preserving (flag : Bool) (head : ℕ) (left right : List ℕ) (left_source✝ right_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      (Representation.list CellTy.nat).Rel left left_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel right right_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.choosePrepend flag head left_source✝ right_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (choosePrepend flag head left right) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Signatures of the functions added by this source declaration.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Actual imported function bodies with their internal calls relocated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The complete signature tables retained from imported source programs.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeBranches.Source.choosePrepend_spec {pre✝ : Env [Ty.bool, Ty.nat, (Ty.node CellTy.nat).option, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.bool, Ty.nat, (Ty.node CellTy.nat).option, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              FunctionTotal program choosePrependId pre✝ post✝ → ∀ (flag : Bool) (head : ℕ) (left right : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons flag (Env.cons head (Env.cons left (Env.cons right Env.empty)))) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons flag (Env.cons head (Env.cons left (Env.cons right Env.empty)))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ choosePrepend flag head left right ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeBranches.Operations.consNat.cons_rel_preserving (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish ∧ Buffer.PreservesContents heap✝ finish
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeBranches.Source.chooseSum_spec {pre✝ : Env [Ty.bool, Ty.nat, (Ty.node CellTy.nat).option, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.bool, Ty.nat, (Ty.node CellTy.nat).option, (Ty.node CellTy.nat).option] → Heap → ℕ → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                FunctionTotal program chooseSumId pre✝ post✝ → ∀ (flag : Bool) (head : ℕ) (left right : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons flag (Env.cons head (Env.cons left (Env.cons right Env.empty)))) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons flag (Env.cons head (Env.cons left (Env.cons right Env.empty)))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ chooseSum flag head left right ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The source program's declared first-order signatures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeBranches.Source.chooseSum_eq (flag : Bool) (head : ℕ) (left right : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  chooseSum flag head left right = have chosen_join := none; have __do_jp := fun (chosen_join : Option (Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (chosen_join : Option (Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match chosen_join with | none => do let y ← pure () __do_jp y | some payload => do let result ← Operations.fold0.fold 0 payload pure result; match chosen_join with | none => do let selected ← NativeConstruction.Source.prepend head right have chosen_join : Option (Option (NodeRef CellTy.nat)) := some selected let y ← pure () __do_jp chosen_join y | some val => do let y ← pure () __do_jp chosen_join y; if flag = true then do let selected ← Operations.consNat.cons head left have chosen_join : Option (Option (NodeRef CellTy.nat)) := some selected let y ← pure () __do_jp chosen_join y else do let y ← pure () __do_jp chosen_join y

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeBranches.Source.chooseSum_contract_iff_triple (pre✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  chooseSum_contract pre✝ post✝ ↔ ∀ (flag : Bool) (head : ℕ) (left right : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ flag head left right initialHeap }⦄ chooseSum flag head left right ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ flag head left right initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeBranches.Operations.consNat.cons_rel (head✝ : ℕ) (values✝ : List ℕ) (tail✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel values✝ tail✝ heap✝ → ∃ (returned : Option (NodeRef CellTy.nat)) (finish : Heap), cons head✝ tail✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (head✝ :: values✝) returned finish ∧ heap✝.ShapeExtends finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeBranches.Source.chooseSum_total_iff (pre✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          chooseSum_contract pre✝ post✝ ↔ ∀ (flag : Bool) (head : ℕ) (left right : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ flag head left right initialHeap → ∃ (value : ℕ) (finalHeap : Heap), chooseSum flag head left right initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ flag head left right initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeBranches.Operations.fold0.fold_eq (initial✝ : ℕ) (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → fold initial✝ root✝ heap✝ = Part.some (Except.ok (List.foldl Reducer.add initial✝ values✝), heap✝)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The finite table of actual named source bodies.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeBranches.Operations.fold0.fold_rel (initial✝ : ℕ) (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), fold initial✝ root✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (List.foldl Reducer.add initial✝ values✝) returned finish ∧ heap✝.ShapeExtends finish
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeBranches.Source.choosePrepend_contract_iff_triple (pre✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    choosePrepend_contract pre✝ post✝ ↔ ∀ (flag : Bool) (head : ℕ) (left right : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ flag head left right initialHeap }⦄ choosePrepend flag head left right ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ flag head left right initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Added function bodies already typed against the complete linked table.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeBranches.Source.choosePrepend_eq (flag : Bool) (head : ℕ) (left right : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        choosePrepend flag head left right = have chosen_join := none; have __do_jp := fun (chosen_join : Option (Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match chosen_join with | none => do let y ← pure () __do_jp y | some payload => do let result ← NativeConstruction.Source.prepend head payload pure result; if flag = true then do let grown ← Operations.consNat.cons head left let selected ← NativeConstruction.Source.prepend head grown have chosen_join : Option (Option (NodeRef CellTy.nat)) := some selected let y ← pure () __do_jp chosen_join y else do let selected ← NativeConstruction.Source.prepend head right have chosen_join : Option (Option (NodeRef CellTy.nat)) := some selected let y ← pure () __do_jp chosen_join y

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.choosePrepend_eq (flag : Bool) (head : ℕ) (left right : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        NativeBranches.choosePrepend flag head left right = head :: head :: if flag = true then head :: left else right

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The selected branch returns an ordinary list to one common continuation. Only the true branch adds the extra prefix node before the two named calls.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.chooseSum_eq (flag : Bool) (head : ℕ) (left right : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        NativeBranches.chooseSum flag head left right = head + if flag = true then left.sum else right.sum

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        A scalar fold consumes the list produced by either allocating branch. The proof is ordinary sum algebra, without an intermediate-heap induction.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The generated correspondence relates the actual selected branch and its common continuation to the ordinary list equation in the actual final heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        List-valued branch merging and a subsequent scalar fold share the same generated source refinement; no separate source traversal is supplied.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.consPair_total_iff (pre✝ : ℕ × Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ × Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          consPair_contract pre✝ post✝ ↔ ∀ (fields : ℕ × Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ fields initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), consPair fields initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ fields initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Added function bodies already typed against the complete linked table.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.isEmpty_action_rel_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.bool) (finish : Heap), Source.isEmpty values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl Bool)).Rel (isEmpty values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.inspectOrPrepend_action_rel_native_preserving (flag : Bool) (head : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value ((Ty.nat.prod (Ty.node CellTy.nat).option).option.prod (Ty.node CellTy.nat).option)) (finish : Heap), Source.inspectOrPrepend flag head values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.prod (Representation.list CellTy.nat)).Rel (inspectOrPrepend flag head values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.headOr_spec {pre✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → ℕ → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              FunctionTotal program headOrId pre✝ post✝ → ∀ (fallback : ℕ) (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond ℕ (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons fallback (Env.cons values Env.empty)) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Heap), post✝ (Env.cons fallback (Env.cons values Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ headOr fallback values ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.replaceHead_spec {pre✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              FunctionTotal program replaceHeadId pre✝ post✝ → ∀ (replacement : ℕ) (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons replacement (Env.cons values Env.empty)) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons replacement (Env.cons values Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ replaceHead replacement values ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.inspectOrPrepend_total_iff (pre✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              inspectOrPrepend_contract pre✝ post✝ ↔ ∀ (flag : Bool) (head : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ flag head values initialHeap → ∃ (value : Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) (finalHeap : Heap), inspectOrPrepend flag head values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ flag head values initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.uncons_spec {pre✝ : Env [(Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option] → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              FunctionTotal program unconsId pre✝ post✝ → ∀ (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (ℕ × Option (NodeRef CellTy.nat))) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values Env.empty) initialHeap ∧ ∀ (value : Option (ℕ × Option (NodeRef CellTy.nat))) (finalHeap : Heap), post✝ (Env.cons values Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ uncons values ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.headOption_spec {pre✝ : Env [(Ty.nat.prod (Ty.node CellTy.nat).option).option] → Heap → Prop} {post✝ : Env [(Ty.nat.prod (Ty.node CellTy.nat).option).option] → Heap → Option ℕ → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  FunctionTotal program headOptionId pre✝ post✝ → ∀ (parts : Option (ℕ × Option (NodeRef CellTy.nat))) (continuation : Std.Do.PostCond (Option ℕ) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons parts Env.empty) initialHeap ∧ ∀ (value : Option ℕ) (finalHeap : Heap), post✝ (Env.cons parts Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ headOption parts ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.uncons_action_rel_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.nat.prod (Ty.node CellTy.nat).option).option) (finish : Heap), Source.uncons values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ ((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.Rel (uncons values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.headOr_action_rel_native_preserving (fallback : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.headOr fallback values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (headOr fallback values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The complete signature tables retained from imported source programs.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.headOr_contract_iff_triple (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              headOr_contract pre✝ post✝ ↔ ∀ (fallback : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ fallback values initialHeap }⦄ headOr fallback values ⦃(fun (value : ℕ) (finalHeap : Heap) => { down := post✝ fallback values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeViews.replaceHead_action_rel_native_preserving (replacement : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.replaceHead replacement values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (replaceHead replacement values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The finite table of actual named source bodies.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.inspectAndPrepend_contract_iff_triple (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            inspectAndPrepend_contract pre✝ post✝ ↔ ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ head values initialHeap }⦄ inspectAndPrepend head values ⦃(fun (value : Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ head values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.isEmpty_action_rel_native_preserving (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.bool) (finish : Heap), Source.isEmpty values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl Bool)).Rel (isEmpty values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.isEmpty_total_iff (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → Bool → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                isEmpty_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ values initialHeap → ∃ (value : Bool) (finalHeap : Heap), isEmpty values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.inspectAndPrepend_action_rel_native_preserving (head : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value ((Ty.nat.prod (Ty.node CellTy.nat).option).option.prod (Ty.node CellTy.nat).option)) (finish : Heap), Source.inspectAndPrepend head values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.prod (Representation.list CellTy.nat)).Rel (inspectAndPrepend head values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.headOption_contract_iff_triple (pre✝ : Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Prop) (post✝ : Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Option ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  headOption_contract pre✝ post✝ ↔ ∀ (parts : Option (ℕ × Option (NodeRef CellTy.nat))) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ parts initialHeap }⦄ headOption parts ⦃(fun (value : Option ℕ) (finalHeap : Heap) => { down := post✝ parts initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The source program's declared first-order signatures.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.replaceHead_eq (replacement : ℕ) (values : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      replaceHead replacement values = do let listParts ← Operations.unconsNat.uncons values have tail_join : Option (Option (NodeRef CellTy.nat)) := none have __do_jp : Option (Option (NodeRef CellTy.nat)) → Unit → ExceptT Fault (StateT Heap Part) (Option (NodeRef CellTy.nat)) := fun (tail_join : Option (Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match tail_join with | none => do let y ← pure () __do_jp y | some payload => do let result ← NativeConstruction.Source.prepend replacement payload pure result match listParts with | none => have tail_join := some none; do let y ← pure () __do_jp tail_join y | some payload => have _head := payload.1; have rest := payload.2; have tail_join := some rest; do let y ← pure () __do_jp tail_join y

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeViews.inspectOrPrepend_action_rel_native (flag : Bool) (head : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value ((Ty.nat.prod (Ty.node CellTy.nat).option).option.prod (Ty.node CellTy.nat).option)) (finish : Heap), Source.inspectOrPrepend flag head values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.prod (Representation.list CellTy.nat)).Rel (inspectOrPrepend flag head values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.uncons_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      uncons_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values initialHeap }⦄ uncons values ⦃(fun (value : Option (ℕ × Option (NodeRef CellTy.nat))) (finalHeap : Heap) => { down := post✝ values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Actual imported function bodies with their internal calls relocated.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.Operations.unconsNat.uncons_rel_preserving (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → ∃ (returned : Value (CellTy.nat.toTy.prod (Ty.node CellTy.nat).option).option) (finish : Heap), uncons root✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (List.Uncons.resultRepresentation CellTy.nat).Rel (Option.map (fun (head : CellValue CellTy.nat) => (head, values✝.tail)) values✝.head?) returned finish ∧ heap✝.ShapeExtends finish ∧ Buffer.PreservesContents heap✝ finish
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.inspectAndPrepend_total_iff (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        inspectAndPrepend_contract pre✝ post✝ ↔ ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ head values initialHeap → ∃ (value : Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) (finalHeap : Heap), inspectAndPrepend head values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ head values initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.consPair_spec {pre✝ : Env [Ty.nat.prod (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat.prod (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              FunctionTotal program consPairId pre✝ post✝ → ∀ (fields : ℕ × Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons fields Env.empty) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons fields Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ consPair fields ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.inspectAndPrepend_spec {pre✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              FunctionTotal program inspectAndPrependId pre✝ post✝ → ∀ (head : ℕ) (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons head (Env.cons values Env.empty)) initialHeap ∧ ∀ (value : Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons head (Env.cons values Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ inspectAndPrepend head values ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.restoreOr_action_rel_native (parts : Option (ℕ × List ℕ)) (fallback : List ℕ) (parts_source✝ : Value (Ty.nat.prod (Ty.node CellTy.nat).option).option) (fallback_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.Rel parts parts_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel fallback fallback_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.restoreOr parts_source✝ fallback_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (restoreOr parts fallback) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.headOr_action_rel_native (fallback : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat) (finish : Heap), Source.headOr fallback values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (headOr fallback values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeViews.headOption_action_rel_native_preserving (parts : Option (ℕ × List ℕ)) (parts_source✝ : Value (Ty.nat.prod (Ty.node CellTy.nat).option).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.Rel parts parts_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat.option) (finish : Heap), Source.headOption parts_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).option.Rel (headOption parts) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.headOption_total_iff (pre✝ : Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Prop) (post✝ : Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Option ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        headOption_contract pre✝ post✝ ↔ ∀ (parts : Option (ℕ × Option (NodeRef CellTy.nat))) (initialHeap : Heap), pre✝ parts initialHeap → ∃ (value : Option ℕ) (finalHeap : Heap), headOption parts initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ parts initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.replaceHead_action_rel_native (replacement : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.replaceHead replacement values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (replaceHead replacement values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.inspectOrPrepend_eq (flag : Bool) (head : ℕ) (values : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        inspectOrPrepend flag head values = have result_join := none; have __do_jp := fun (result_join : Option (Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match result_join with | none => do let y ← pure () __do_jp y | some payload => pure payload; if flag = true then do let grown ← inspectAndPrepend head values have result_join : Option (Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) := some grown let y ← pure () __do_jp result_join y else have operand := none; have result_join := some (operand, values); do let y ← pure () __do_jp result_join y

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.restoreOr_action_rel_native_preserving (parts : Option (ℕ × List ℕ)) (fallback : List ℕ) (parts_source✝ : Value (Ty.nat.prod (Ty.node CellTy.nat).option).option) (fallback_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.Rel parts parts_source✝ initialHeap✝ → (Representation.list CellTy.nat).Rel fallback fallback_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.restoreOr parts_source✝ fallback_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (restoreOr parts fallback) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeViews.Operations.isEmptyNat.isEmpty_eq (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → isEmpty root✝ heap✝ = Part.some (Except.ok values✝.isEmpty, heap✝)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.consPair_eq (fields : ℕ × Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            consPair fields = have operand := fields.1; have operand_1 := fields.2; do let result ← NativeConstruction.Source.prepend operand operand_1 pure result

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeViews.headOption_action_rel_native (parts : Option (ℕ × List ℕ)) (parts_source✝ : Value (Ty.nat.prod (Ty.node CellTy.nat).option).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.Rel parts parts_source✝ initialHeap✝ → ∃ (returned : Value Ty.nat.option) (finish : Heap), Source.headOption parts_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.ofEmbedding (Function.Embedding.refl ℕ)).option.Rel (headOption parts) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.isEmpty_spec {pre✝ : Env [(Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.node CellTy.nat).option] → Heap → Bool → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            FunctionTotal program isEmptyId pre✝ post✝ → ∀ (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond Bool (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons values Env.empty) initialHeap ∧ ∀ (value : Bool) (finalHeap : Heap), post✝ (Env.cons values Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ isEmpty values ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.inspectOrPrepend_spec {pre✝ : Env [Ty.bool, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [Ty.bool, Ty.nat, (Ty.node CellTy.nat).option] → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                FunctionTotal program inspectOrPrependId pre✝ post✝ → ∀ (flag : Bool) (head : ℕ) (values : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons flag (Env.cons head (Env.cons values Env.empty))) initialHeap ∧ ∀ (value : Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons flag (Env.cons head (Env.cons values Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ inspectOrPrepend flag head values ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.consPair_contract_iff_triple (pre✝ : ℕ × Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ × Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                consPair_contract pre✝ post✝ ↔ ∀ (fields : ℕ × Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ fields initialHeap }⦄ consPair fields ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ fields initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.restoreOr_contract_iff_triple (pre✝ : Option (ℕ × Option (NodeRef CellTy.nat)) → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (ℕ × Option (NodeRef CellTy.nat)) → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                restoreOr_contract pre✝ post✝ ↔ ∀ (parts : Option (ℕ × Option (NodeRef CellTy.nat))) (fallback : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ parts fallback initialHeap }⦄ restoreOr parts fallback ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ parts fallback initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.replaceHead_contract_iff_triple (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                replaceHead_contract pre✝ post✝ ↔ ∀ (replacement : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ replacement values initialHeap }⦄ replaceHead replacement values ⦃(fun (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ replacement values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.isEmpty_contract_iff_triple (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → Bool → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  isEmpty_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ values initialHeap }⦄ isEmpty values ⦃(fun (value : Bool) (finalHeap : Heap) => { down := post✝ values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.Operations.isEmptyNat.isEmpty_rel (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → ∃ (returned : Bool) (finish : Heap), isEmpty root✝ heap✝ = Part.some (Except.ok returned, finish) ∧ Representation.bool.Rel values✝.isEmpty returned finish ∧ heap✝.ShapeExtends finish
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.headOption_eq (parts : Option (ℕ × Option (NodeRef CellTy.nat))) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      headOption parts = have result_join := none; have __do_jp := fun (result_join : Option (Option ℕ)) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match result_join with | none => do let y ← pure () __do_jp y | some payload => pure payload; match parts with | none => have result_join := some none; do let y ← pure () __do_jp result_join y | some payload => have operand := payload.1; have result_join := some (some operand); do let y ← pure () __do_jp result_join y

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The named function's actual partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The same source execution returns the encoded mathematical result without changing its supplied heap, under the actual input representations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.Operations.unconsNat.uncons_rel (values✝ : List ℕ) (root✝ : Option (NodeRef CellTy.nat)) (heap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (Representation.list CellTy.nat).Rel values✝ root✝ heap✝ → ∃ (returned : Value (CellTy.nat.toTy.prod (Ty.node CellTy.nat).option).option) (finish : Heap), uncons root✝ heap✝ = Part.some (Except.ok returned, finish) ∧ (List.Uncons.resultRepresentation CellTy.nat).Rel (Option.map (fun (head : CellValue CellTy.nat) => (head, values✝.tail)) values✝.head?) returned finish ∧ heap✝.ShapeExtends finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.uncons_total_iff (pre✝ : Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (NodeRef CellTy.nat) → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          uncons_contract pre✝ post✝ ↔ ∀ (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ values initialHeap → ∃ (value : Option (ℕ × Option (NodeRef CellTy.nat))) (finalHeap : Heap), uncons values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          theorem Complexity.Language.Examples.LinkedList.NativeViews.consPair_action_rel_native_preserving (fields : ℕ × List ℕ) (fields_source✝ : Value (Ty.nat.prod (Ty.node CellTy.nat).option)) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).Rel fields fields_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.consPair fields_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (consPair fields) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.restoreOr_spec {pre✝ : Env [(Ty.nat.prod (Ty.node CellTy.nat).option).option, (Ty.node CellTy.nat).option] → Heap → Prop} {post✝ : Env [(Ty.nat.prod (Ty.node CellTy.nat).option).option, (Ty.node CellTy.nat).option] → Heap → Option (NodeRef CellTy.nat) → Heap → Prop} :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              FunctionTotal program restoreOrId pre✝ post✝ → ∀ (parts : Option (ℕ × Option (NodeRef CellTy.nat))) (fallback : Option (NodeRef CellTy.nat)) (continuation : Std.Do.PostCond (Option (NodeRef CellTy.nat)) (Std.Do.PostShape.except Fault (Std.Do.PostShape.arg Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Heap) => { down := pre✝ (Env.cons parts (Env.cons fallback Env.empty)) initialHeap ∧ ∀ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), post✝ (Env.cons parts (Env.cons fallback Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ restoreOr parts fallback ⦃continuation⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Apply a supplied source contract with ordinary named arguments and its actual returned value and final heap. No callee body or new contract is inferred.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.inspectOrPrepend_contract_iff_triple (pre✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Bool → ℕ → Option (NodeRef CellTy.nat) → Heap → Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              inspectOrPrepend_contract pre✝ post✝ ↔ ∀ (flag : Bool) (head : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), ⦃fun (currentHeap : Heap) => { down := currentHeap = initialHeap ∧ pre✝ flag head values initialHeap }⦄ inspectOrPrepend flag head values ⦃(fun (value : Option (ℕ × Option (NodeRef CellTy.nat)) × Option (NodeRef CellTy.nat)) (finalHeap : Heap) => { down := post✝ flag head values initialHeap value finalHeap }, fun (x : Fault) (x_1 : Heap) => { down := False }, PUnit.unit)⦄

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Prove the ordinary-parameter source contract with a total-correctness triple for the same action. The ghost initial heap equals the actual entry heap; successful results use the actual final heap, and faults are excluded.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Automatic correspondence for the same generated source function, without a machine budget.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.restoreOr_eq (parts : Option (ℕ × Option (NodeRef CellTy.nat))) (fallback : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  restoreOr parts fallback = have result_join := none; have __do_jp := fun (result_join : Option (Option (NodeRef CellTy.nat))) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match result_join with | none => do let y ← pure () __do_jp y | some payload => pure payload; match parts with | none => have result_join := some fallback; do let y ← pure () __do_jp result_join y | some payload => do let restored ← consPair payload have result_join : Option (Option (NodeRef CellTy.nat)) := some restored let y ← pure () __do_jp result_join y

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.isEmpty_action_eq_native (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → Source.isEmpty values_source✝ initialHeap✝ = Part.some (Except.ok (isEmpty values), initialHeap✝)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The same source execution returns the encoded mathematical result without changing its supplied heap, under the actual input representations.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.headOr_total_iff (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → ℕ → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  headOr_contract pre✝ post✝ ↔ ∀ (fallback : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ fallback values initialHeap → ∃ (value : ℕ) (finalHeap : Heap), headOr fallback values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ fallback values initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Signatures of the functions added by this source declaration.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.restoreOr_total_iff (pre✝ : Option (ℕ × Option (NodeRef CellTy.nat)) → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : Option (ℕ × Option (NodeRef CellTy.nat)) → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        restoreOr_contract pre✝ post✝ ↔ ∀ (parts : Option (ℕ × Option (NodeRef CellTy.nat))) (fallback : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ parts fallback initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), restoreOr parts fallback initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ parts fallback initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.replaceHead_total_iff (pre✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Prop) (post✝ : ℕ → Option (NodeRef CellTy.nat) → Heap → Option (NodeRef CellTy.nat) → Heap → Prop) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        replaceHead_contract pre✝ post✝ ↔ ∀ (replacement : ℕ) (values : Option (NodeRef CellTy.nat)) (initialHeap : Heap), pre✝ replacement values initialHeap → ∃ (value : Option (NodeRef CellTy.nat)) (finalHeap : Heap), replaceHead replacement values initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ replacement values initialHeap value finalHeap

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.NativeViews.uncons_action_rel_native_preserving (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value (Ty.nat.prod (Ty.node CellTy.nat).option).option) (finish : Heap), Source.uncons values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ ((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.Rel (uncons values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish ∧ Buffer.PreservesContents initialHeap✝ finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            theorem Complexity.Language.Examples.LinkedList.NativeViews.Source.headOr_eq (fallback : ℕ) (values : Option (NodeRef CellTy.nat)) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            headOr fallback values = do let listParts ← Operations.unconsNat.uncons values have result_join : Option ℕ := none have __do_jp : Option ℕ → Unit → ExceptT Fault (StateT Heap Part) ℕ := fun (result_join : Option ℕ) (y : Unit) => have __do_jp := fun (y : Unit) => throw Fault.missingReturn; match result_join with | none => do let y ← pure () __do_jp y | some payload => pure payload match listParts with | none => have result_join := some fallback; do let y ← pure () __do_jp result_join y | some payload => have head := payload.1; have _tail := payload.2; have result_join := some head; do let y ← pure () __do_jp result_join y

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Budget-free total correctness with ordinary source parameters and relational initial/final heap postconditions. This is the existing source function contract.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Apply a predicate, postcondition or bound with ordinary source parameters to the actual argument environment. No new contract or execution is introduced.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Ordinary arguments and the actual result observed in their real source heaps. This interface does not assert the existence of a total mathematical model.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeViews.inspectAndPrepend_action_rel_native (head : ℕ) (values : List ℕ) (values_source✝ : Value (Ty.node CellTy.nat).option) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (Representation.list CellTy.nat).Rel values values_source✝ initialHeap✝ → ∃ (returned : Value ((Ty.nat.prod (Ty.node CellTy.nat).option).option.prod (Ty.node CellTy.nat).option)) (finish : Heap), Source.inspectAndPrepend head values_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).option.prod (Representation.list CellTy.nat)).Rel (inspectAndPrepend head values) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Language.Examples.LinkedList.NativeViews.consPair_action_rel_native (fields : ℕ × List ℕ) (fields_source✝ : Value (Ty.nat.prod (Ty.node CellTy.nat).option)) (initialHeap✝ : Heap) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ((Representation.ofEmbedding (Function.Embedding.refl ℕ)).prod (Representation.list CellTy.nat)).Rel fields fields_source✝ initialHeap✝ → ∃ (returned : Value (Ty.node CellTy.nat).option) (finish : Heap), Source.consPair fields_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Representation.list CellTy.nat).Rel (consPair fields) returned finish ∧ (fun (finish : Heap) => initialHeap✝.ShapeExtends finish) finish

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Successful execution observes the native result in its actual final heap and retains every previously represented immutable list.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fold an actual source invocation back to its named ordinary-argument observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      The actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        One source-body equation in ordinary monadic notation; named callees remain opaque.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The ordinary emptiness equation comes from the same tag-only source call.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.nativeUncons_eq (values : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        NativeViews.uncons values = Option.map (fun (head : ℕ) => (head, values.tail)) values.head?

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The optional mathematical head and tail describe the actual node read.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        A compound argument retains the ordinary head and its shared List tail.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.restoreOr_eq (parts : Option (ℕ × List ℕ)) (fallback : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        NativeViews.restoreOr parts fallback = match parts with | none => fallback | some fields => fields.1 :: fields.2

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Optional represented fields can be matched and passed to a named constructor.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.inspectAndPrepend_eq (head : ℕ) (values : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        NativeViews.inspectAndPrepend head values = (Option.map (fun (value : ℕ) => (value, values.tail)) values.head?, head :: values)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The old compound observation survives an actual allocation, and both old fields and the newly constructed list are returned together.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.replaceHead_eq (replacement : ℕ) (values : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        NativeViews.replaceHead replacement values = replacement :: values.tail

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        List cases expose the ordinary tail; the common continuation constructs the new first node. This is a mathematical proof, not a source-heap induction.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.headOr_eq (fallback : ℕ) (values : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        NativeViews.headOr fallback values = values.head?.getD fallback

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Scalar branch results inherit the ordinary optional-head equation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Matching a represented pair can return an ordinary optional scalar.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Language.Examples.LinkedList.inspectOrPrepend_eq (flag : Bool) (head : ℕ) (values : List ℕ) :
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        NativeViews.inspectOrPrepend flag head values = if flag = true then (Option.map (fun (value : ℕ) => (value, values.tail)) values.head?, head :: values) else (none, values)

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        A compound conditional result records only the selected allocation and retains the corresponding ordinary head/tail observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Ordinary emptiness correctness is independent of word ranges, storage and time bounds; the generated correspondence supplies the actual root observation.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Automatically generated correspondence retains both parts of the compound result at the same final heap, including the pre-allocation head/tail view.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        The List-match implementation inherits its ordinary functional theorem without any word-width, storage or time-budget assumption.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Scalar List matching has the same source result without a resource premise.

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        A compound branch result combines ordinary mathematics with generated heap-indexed correspondence, including the allocating path.