Documentation

Examples.Language.Strings

Ordinary String contracts over real character buffers #

Character-indexed reads, initialized strings and string rows reuse the existing buffer operations. Their mathematical equations use ordinary String/List APIs; no arbitrary toList conversion or UTF-8 byte indexing is introduced. The allocation bound counts the generated caller and initialized cells, conditional on arena readiness. It is not a complete whole-program time certificate.

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

        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
          @[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

            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

                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.Examples.Strings.Text.repeatSelected_eq (input : (Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat) × ℕ × ℕ) :
                  repeatSelected input = do let fallback ← Language.Buffer.Replicate.replicateNat 0 48 have operand : Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat := input.1 have operand_1 : ℕ × ℕ := input.2 have operand_2 : ℕ := operand_1.1 let selected ← Operations.arrayRead0.getD operand operand_2 fallback have operand : ℕ × ℕ := input.2 have operand : ℕ := operand.2 let character ← Language.Buffer.GetD.getNat selected operand 129417 have operand : ℕ := selected.length let sourceResult ← Language.Buffer.Replicate.replicateNat operand character pure sourceResult

                  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

                    The finite table of actual named source bodies.

                    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.Examples.Strings.Text.replicate_total_iff (pre✝ : ℕ → ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ → Language.Heap → Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                        replicate_contract pre✝ post✝ ↔ ∀ (length initial : ℕ) (initialHeap : Language.Heap), pre✝ length initial initialHeap → ∃ (value : Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap), replicate length initial initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ length initial 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
                          @[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 actual declared argument environment, constructed from ordinary source parameters. This is proof-side parameter transport, not an additional runtime operation.

                            Equations
                            Instances For

                              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
                                @[reducible, inline]

                                This named source function's index in its declared signature table.

                                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
                                    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.Examples.Strings.Text.row_eq (input : (Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat) × ℕ × ℕ) :
                                      row input = do let fallback ← Language.Buffer.Replicate.replicateNat 0 48 have operand : Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat := input.1 have operand_1 : ℕ × ℕ := input.2 have operand_2 : ℕ := operand_1.1 let sourceResult ← Operations.arrayRead0.getD operand operand_2 fallback pure sourceResult

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

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

                                      theorem Complexity.Examples.Strings.Text.length_action_eq_native (text : String) (text_source✝ : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (initialHeap✝ : Language.Heap) :
                                      Language.Representation.string.Rel text text_source✝ initialHeap✝ → length text_source✝ initialHeap✝ = Part.some (Except.ok (length_model text), initialHeap✝)

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

                                      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

                                        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

                                          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
                                            theorem Complexity.Examples.Strings.Text.length_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat → Language.Heap → ℕ → Language.Heap → Prop) :
                                            length_contract pre✝ post✝ ↔ ∀ (text : Language.Buffer Language.CellTy.nat) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ text initialHeap }⦄ length text ⦃(fun (value : ℕ) (finalHeap : Language.Heap) => { down := post✝ text initialHeap value finalHeap }, fun (x : Language.Fault) (x_1 : Language.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

                                              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]

                                                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

                                                    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

                                                        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.

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

                                                            theorem Complexity.Examples.Strings.Text.Operations.arrayRead0.getD_eq (storage : Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat) (index : ℕ) (defaultView : Language.Buffer Language.CellTy.nat) :
                                                            getD storage index defaultView = have column := storage; have default := defaultView; do let value ← Language.Buffer.Ragged.GetD.getNat column index default pure value

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

                                                            theorem Complexity.Examples.Strings.Text.lookup_action_rel_native_preserving (text : String) (index : ℕ) (text_source✝ : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (initialHeap✝ : Language.Heap) :
                                                            Language.Representation.string.Rel text text_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.nat) (finish : Language.Heap), lookup text_source✝ index initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel (lookup_model text index) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish ∧ Language.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 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.Examples.Strings.Text.length_total_iff (pre✝ : Language.Buffer Language.CellTy.nat → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat → Language.Heap → ℕ → Language.Heap → Prop) :
                                                              length_contract pre✝ post✝ ↔ ∀ (text : Language.Buffer Language.CellTy.nat) (initialHeap : Language.Heap), pre✝ text initialHeap → ∃ (value : ℕ) (finalHeap : Language.Heap), length text initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ text 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.

                                                                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
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  theorem Complexity.Examples.Strings.Text.lookup_total_iff (pre✝ : Language.Buffer Language.CellTy.nat → ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat → ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                                                  lookup_contract pre✝ post✝ ↔ ∀ (text : Language.Buffer Language.CellTy.nat) (index : ℕ) (initialHeap : Language.Heap), pre✝ text index initialHeap → ∃ (value : ℕ) (finalHeap : Language.Heap), lookup text index initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ text index initialHeap value finalHeap

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

                                                                  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.Examples.Strings.Text.replicate_eq (length initial : ℕ) :
                                                                  replicate length initial = do let sourceResult ← Language.Buffer.Replicate.replicateNat length initial pure sourceResult

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

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

                                                                  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

                                                                    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
                                                                        @[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.Examples.Strings.Text.lookup_eq (text : Language.Buffer Language.CellTy.nat) (index : ℕ) :
                                                                          lookup text index = do let sourceResult ← Language.Buffer.GetD.getNat text index 955 pure sourceResult

                                                                          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.Examples.Strings.Text.length_action_rel_native (text : String) (text_source✝ : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (initialHeap✝ : Language.Heap) :
                                                                          Language.Representation.string.Rel text text_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.nat) (finish : Language.Heap), length text_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (length_model text) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish) finish

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

                                                                          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.

                                                                          @[reducible, inline]

                                                                          This named source function's index in its declared signature table.

                                                                          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

                                                                              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.Examples.Strings.Text.replicate_action_rel_native_preserving (length : ℕ) (initial : Char) (initial_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                                                                (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel initial initial_source✝ initialHeap✝ → ∃ (returned : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (finish : Language.Heap), replicate length initial_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ Language.Representation.string.Rel (replicate_model length initial) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish ∧ Language.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.

                                                                                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

                                                                                    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 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

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

                                                                                          theorem Complexity.Examples.Strings.Text.replicate_contract_iff_triple (pre✝ : ℕ → ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ → Language.Heap → Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                          replicate_contract pre✝ post✝ ↔ ∀ (length initial : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ length initial initialHeap }⦄ replicate length initial ⦃(fun (value : Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap) => { down := post✝ length initial initialHeap value finalHeap }, fun (x : Language.Fault) (x_1 : Language.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.Examples.Strings.Text.replicate_action_rel_native (length : ℕ) (initial : Char) (initial_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                                                                            (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel initial initial_source✝ initialHeap✝ → ∃ (returned : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (finish : Language.Heap), replicate length initial_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ Language.Representation.string.Rel (replicate_model length initial) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish) finish

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

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

                                                                                            theorem Complexity.Examples.Strings.Text.lookup_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat → ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat → ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                                                                            lookup_contract pre✝ post✝ ↔ ∀ (text : Language.Buffer Language.CellTy.nat) (index : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ text index initialHeap }⦄ lookup text index ⦃(fun (value : ℕ) (finalHeap : Language.Heap) => { down := post✝ text index initialHeap value finalHeap }, fun (x : Language.Fault) (x_1 : Language.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

                                                                                              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]

                                                                                              This named source function's index in its declared signature table.

                                                                                              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]

                                                                                                  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]

                                                                                                    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.Examples.Strings.Text.Operations.arrayRead0.getD_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat → ℕ → Language.Buffer Language.CellTy.nat → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat → ℕ → Language.Buffer Language.CellTy.nat → Language.Heap → Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                      getD_contract pre✝ post✝ ↔ ∀ (storage : Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat) (index : ℕ) (defaultView : Language.Buffer Language.CellTy.nat) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ storage index defaultView initialHeap }⦄ getD storage index defaultView ⦃(fun (value : Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap) => { down := post✝ storage index defaultView initialHeap value finalHeap }, fun (x : Language.Fault) (x_1 : Language.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.Examples.Strings.Text.length_action_rel_native_preserving (text : String) (text_source✝ : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (initialHeap✝ : Language.Heap) :
                                                                                                      Language.Representation.string.Rel text text_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.nat) (finish : Language.Heap), length text_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding (Function.Embedding.refl ℕ)).Rel (length_model text) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish ∧ Language.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

                                                                                                        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]

                                                                                                        This named source function's index in its declared signature table.

                                                                                                        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
                                                                                                            @[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.Examples.Strings.Text.lookup_action_rel_native (text : String) (index : ℕ) (text_source✝ : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (initialHeap✝ : Language.Heap) :
                                                                                                              Language.Representation.string.Rel text text_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.nat) (finish : Language.Heap), lookup text_source✝ index initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel (lookup_model text index) returned finish ∧ (fun (finish : Language.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]

                                                                                                              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]

                                                                                                                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

                                                                                                                    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]

                                                                                                                    This named source function's index in its declared signature table.

                                                                                                                    Equations
                                                                                                                    Instances For
                                                                                                                      Equations
                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                      Instances For
                                                                                                                        theorem Complexity.Examples.Strings.repeated_correct :
                                                                                                                        repeated.Correct (fun (x : ℕ × Char) => True) fun (input : ℕ × Char) (result : String) => result = String.ofList (List.replicate input.1 input.2)
                                                                                                                        theorem Complexity.Examples.Strings.lookup_correct :
                                                                                                                        lookup.Correct (fun (x : String × ℕ) => True) fun (input : String × ℕ) (result : Char) => result = input.1.toList.getD input.2 'λ'
                                                                                                                        theorem Complexity.Examples.Strings.length_correct :
                                                                                                                        length.Correct (fun (x : String) => True) fun (input : String) (result : ℕ) => result = input.length
                                                                                                                        Equations
                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                        Instances For
                                                                                                                          theorem Complexity.Examples.Strings.row_correct :
                                                                                                                          row.Correct (fun (x : Input) => True) fun (input : Input) (result : String) => result = input.words.getD input.row ""
                                                                                                                          Equations
                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                          Instances For
                                                                                                                            theorem Complexity.Examples.Strings.repeatSelected_correct :
                                                                                                                            repeatSelected.Correct (fun (x : Input) => True) fun (input : Input) (result : String) => have selected := input.words.getD input.row ""; result = String.ofList (List.replicate selected.length (selected.toList.getD input.column '🦉'))
                                                                                                                            def Complexity.Examples.Strings.replicateBodyCost (length : ℕ) :
                                                                                                                            { bound : ℕ // ∀ (w heapLimit depth initial : ℕ) (heap : Language.Heap), Ram.LanguageCompiler.StmtArenaCostBound Text.program w heapLimit (depth + 1) (Text.program.body Text.replicateId) { locals := Text.replicate_args length initial, heap := heap } bound }

                                                                                                                            Infer the budget from the same real allocator call, including the source wrapper.

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

                                                                                                                              The initialized code-point cells carry the existing allocator's linear charge.