Documentation

Examples.Language.Characters

Character programs with ordinary mathematical contracts #

Unicode characters retain their standard scalar codes. Real array allocation, defaulted reads and scalar comparison have checked ordinary Char observations; no task-specific alphabet encoding or additional input is needed. Nested grids retain their actual row boundaries, including empty rows. These are source correctness results, not complete caller RAM time bounds.

Instances For
    theorem Complexity.Examples.Characters.Character.atMarker_eq (input : (Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat) × ℕ × ℕ) :
    atMarker input = do let fallback ← Language.Buffer.Replicate.replicateNat 0 955 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 row ← Operations.arrayRead1.getD operand operand_2 fallback have operand : ℕ × ℕ := input.2 have operand : ℕ := operand.2 let cell ← Operations.arrayRead0.getD row operand 955 have operand : Bool := decide (cell = 129417) have boolean : Bool := false have __do_jp : Bool → Unit → ExceptT Language.Fault (StateT Language.Heap Part) Bool := fun (boolean : Bool) (y : Unit) => if boolean = true then pure false else pure true if operand = true then have boolean := false; do let y ← pure () __do_jp boolean y else have boolean := true; do let y ← pure () __do_jp boolean y

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

    theorem Complexity.Examples.Characters.Character.different_contract_iff_triple (pre✝ : ℕ → ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ → Language.Heap → Bool → Language.Heap → Prop) :
    different_contract pre✝ post✝ ↔ ∀ (left right : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ left right initialHeap }⦄ different left right ⦃(fun (value : Bool) (finalHeap : Language.Heap) => { down := post✝ left right 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

      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 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.Characters.Character.lookup_eq (values : Language.Buffer Language.CellTy.nat) (index : ℕ) :
          lookup values index = do let sourceResult ← Operations.arrayRead0.getD values index 955 pure sourceResult

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

          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

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

                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]

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

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

                          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.Examples.Characters.Character.different_spec {pre✝ : Language.Env [Language.Ty.nat, Language.Ty.nat] → Language.Heap → Prop} {post✝ : Language.Env [Language.Ty.nat, Language.Ty.nat] → Language.Heap → Bool → Language.Heap → Prop} :
                            Language.FunctionTotal program differentId pre✝ post✝ → ∀ (left right : ℕ) (continuation : Std.Do.PostCond Bool (Std.Do.PostShape.except Language.Fault (Std.Do.PostShape.arg Language.Heap Std.Do.PostShape.pure))), ⦃fun (initialHeap : Language.Heap) => { down := pre✝ (Language.Env.cons left (Language.Env.cons right Language.Env.empty)) initialHeap ∧ ∀ (value : Bool) (finalHeap : Language.Heap), post✝ (Language.Env.cons left (Language.Env.cons right Language.Env.empty)) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ different 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.

                            Ordinary mathematical function generated from the same represented source block.

                            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
                                theorem Complexity.Examples.Characters.Character.different_action_rel_native_preserving (left right : Char) (left_source✝ right_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel left left_source✝ initialHeap✝ → (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel right right_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.bool) (finish : Language.Heap), different left_source✝ right_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding (Function.Embedding.refl Bool)).Rel (different_model left right) 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.

                                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 source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

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

                                  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]

                                    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.Characters.Character.different_eq (left right : ℕ) :
                                      different left right = have operand := decide (left = right); have boolean := false; have __do_jp := fun (boolean : Bool) (y : Unit) => pure boolean; if operand = true then have boolean := false; do let y ← pure () __do_jp boolean y else have boolean := true; do let y ← pure () __do_jp boolean 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.

                                      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.Examples.Characters.Character.different_action_rel_native (left right : Char) (left_source✝ right_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                        (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel left left_source✝ initialHeap✝ → (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel right right_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.bool) (finish : Language.Heap), different left_source✝ right_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding (Function.Embedding.refl Bool)).Rel (different_model left right) 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.

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

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

                                        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.Examples.Characters.Character.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✝ ↔ ∀ (values : Language.Buffer Language.CellTy.nat) (index : ℕ) (initialHeap : Language.Heap), pre✝ values index initialHeap → ∃ (value : ℕ) (finalHeap : Language.Heap), lookup values index initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ values index initialHeap value finalHeap

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

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

                                          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 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.Examples.Characters.Character.atMarker_contract_iff_triple (pre✝ : (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.Heap → Bool → Language.Heap → Prop) :
                                                atMarker_contract pre✝ post✝ ↔ ∀ (input : (Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat) × ℕ × ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ atMarker input ⦃(fun (value : Bool) (finalHeap : Language.Heap) => { down := post✝ input 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]

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

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

                                                          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]

                                                            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
                                                                theorem Complexity.Examples.Characters.Character.Operations.arrayRead0.getD_total_iff (pre✝ : Language.Buffer Language.CellTy.nat → ℕ → ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat → ℕ → ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                                                getD_contract pre✝ post✝ ↔ ∀ (storage : Language.Buffer Language.CellTy.nat) (index defaultView : ℕ) (initialHeap : Language.Heap), pre✝ storage index defaultView initialHeap → ∃ (value : ℕ) (finalHeap : Language.Heap), getD storage index defaultView initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ storage index defaultView 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.Examples.Characters.Character.Operations.arrayRead1.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.

                                                                @[reducible, inline]

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

                                                                Equations
                                                                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

                                                                    The finite table of actual named source bodies.

                                                                    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.Examples.Characters.Character.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.

                                                                        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.Characters.Character.Operations.arrayRead0.getD_eq (storage : Language.Buffer Language.CellTy.nat) (index defaultView : ℕ) :
                                                                          getD storage index defaultView = have column := storage; have default := defaultView; do let value ← Language.Buffer.GetD.getNat column index default pure value

                                                                          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.Examples.Characters.Character.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.array Language.CellTy.nat).comap Language.Representation.charEmbedding.arrayMap).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.

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

                                                                              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]

                                                                              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
                                                                                  theorem Complexity.Examples.Characters.Character.different_total_iff (pre✝ : ℕ → ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ → Language.Heap → Bool → Language.Heap → Prop) :
                                                                                  different_contract pre✝ post✝ ↔ ∀ (left right : ℕ) (initialHeap : Language.Heap), pre✝ left right initialHeap → ∃ (value : Bool) (finalHeap : Language.Heap), different left right initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ 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.

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

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

                                                                                  @[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 source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                    @[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.Examples.Characters.Character.lookup_action_rel_native (values : Array Char) (index : ℕ) (values_source✝ : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (initialHeap✝ : Language.Heap) :
                                                                                      ((Language.Representation.array Language.CellTy.nat).comap Language.Representation.charEmbedding.arrayMap).Rel values values_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.nat) (finish : Language.Heap), lookup values_source✝ index initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel (lookup_model values 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.

                                                                                      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]

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

                                                                                              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
                                                                                                  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.Examples.Characters.Character.Operations.arrayRead1.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.

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

                                                                                                          Signatures of the functions added by this source declaration.

                                                                                                          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
                                                                                                                theorem Complexity.Examples.Characters.Character.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.

                                                                                                                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.Characters.Character.lookup_action_rel_native_preserving (values : Array Char) (index : ℕ) (values_source✝ : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (initialHeap✝ : Language.Heap) :
                                                                                                                  ((Language.Representation.array Language.CellTy.nat).comap Language.Representation.charEmbedding.arrayMap).Rel values values_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.nat) (finish : Language.Heap), lookup values_source✝ index initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel (lookup_model values 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]

                                                                                                                  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
                                                                                                                      theorem Complexity.Examples.Characters.Character.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.array Language.CellTy.nat).comap Language.Representation.charEmbedding.arrayMap).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.

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

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

                                                                                                                        theorem Complexity.Examples.Characters.Character.Operations.arrayRead0.getD_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat → ℕ → ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat → ℕ → ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                                                                                                        getD_contract pre✝ post✝ ↔ ∀ (storage : Language.Buffer Language.CellTy.nat) (index defaultView : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ storage index defaultView initialHeap }⦄ getD storage index defaultView ⦃(fun (value : ℕ) (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.

                                                                                                                        @[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.Characters.Character.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.

                                                                                                                          theorem Complexity.Examples.Characters.Character.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✝ ↔ ∀ (values : Language.Buffer Language.CellTy.nat) (index : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ values index initialHeap }⦄ lookup values index ⦃(fun (value : ℕ) (finalHeap : Language.Heap) => { down := post✝ values 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.

                                                                                                                          theorem Complexity.Examples.Characters.Character.different_action_eq_native (left right : Char) (left_source✝ right_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                                                                                                          (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel left left_source✝ initialHeap✝ → (Language.Representation.ofEmbedding Language.Representation.charEmbedding).Rel right right_source✝ initialHeap✝ → different left_source✝ right_source✝ initialHeap✝ = Part.some (Except.ok (different_model left right), initialHeap✝)

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

                                                                                                                          Equations
                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                          Instances For
                                                                                                                            theorem Complexity.Examples.Characters.repeated_correct :
                                                                                                                            repeated.Correct (fun (x : ℕ × Char) => True) fun (input : ℕ × Char) (result : Array Char) => result = Array.replicate input.1 input.2
                                                                                                                            Equations
                                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                                            Instances For
                                                                                                                              theorem Complexity.Examples.Characters.lookup_correct :
                                                                                                                              lookup.Correct (fun (x : Array Char × ℕ) => True) fun (input : Array Char × ℕ) (result : Char) => result = input.1.getD input.2 'λ'
                                                                                                                              Equations
                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                              Instances For
                                                                                                                                theorem Complexity.Examples.Characters.different_correct :
                                                                                                                                different.Correct (fun (x : Char × Char) => True) fun (input : Char × Char) (result : Bool) => result = decide (input.1 ≠ input.2)
                                                                                                                                Equations
                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                Instances For
                                                                                                                                  theorem Complexity.Examples.Characters.atMarker_correct :
                                                                                                                                  atMarker.Correct (fun (x : GridInput) => True) fun (input : GridInput) (result : Bool) => result = decide ((input.rows.getD input.row #[]).getD input.column 'λ' = '🦉')