Documentation

Examples.Language.CompositeArrays

Initialized arrays of composite values #

One source expression allocates every actual field column, including nested products and represented scalar fields. Its ordinary mathematical contract does not expose the columns. The allocation proof preserves existing input arrays. The inferred RAM body budgets count every column call and the generated wrapper, including the optional initializer's packing branch. They are conditional on readiness, not whole-program TimeO certificates.

Instances For
    theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayReplicate0.replicate_eq (length : ℕ) (initial : ℕ × ℕ × ℕ) :
    replicate length initial = have initialColumnL := initial.1; do let columnL ← Language.Buffer.Replicate.replicateNat length initialColumnL have operand : ℕ × ℕ := initial.2 have initialColumnRL : ℕ := operand.1 let columnRL ← Language.Buffer.Replicate.replicateNat length initialColumnRL have operand : ℕ × ℕ := initial.2 have initialColumnRR : ℕ := operand.2 let columnRR ← Language.Buffer.Replicate.replicateNat length initialColumnRR have operand : Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat := (columnRL, columnRR) pure (columnL, operand)

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

    @[reducible, inline]

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

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem Complexity.Examples.CompositeArrays.Columns.triples_contract_iff_triple (pre✝ : ℕ × ℕ × ℕ × ℕ → Language.Heap → Prop) (post✝ : ℕ × ℕ × ℕ × ℕ → Language.Heap → Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
      triples_contract pre✝ post✝ ↔ ∀ (input : ℕ × ℕ × ℕ × ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ triples input ⦃(fun (value : Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat) (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]

      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

        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.

        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.CompositeArrays.Columns.retain_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat × ℕ × (Bool × ℕ) × Bool → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × ℕ × (Bool × ℕ) × Bool → Language.Heap → ℕ → Language.Heap → Prop) :
        retain_contract pre✝ post✝ ↔ ∀ (input : Language.Buffer Language.CellTy.nat × ℕ × (Bool × ℕ) × Bool) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ retain input ⦃(fun (value : ℕ) (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.

        theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayRead0.getD_eval_exists (rows : Array Entry) (index : ℕ) (fallback : Entry) (storage : Language.Value ((Language.Ty.buffer Language.CellTy.nat).prod (((Language.Ty.buffer Language.CellTy.bool).prod (Language.Ty.buffer Language.CellTy.nat)).prod (Language.Ty.buffer Language.CellTy.bool)))) (defaultView : Language.Value (Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool))) (heap : Language.Heap) (observed : (((((Language.Representation.array Language.CellTy.nat).comap Language.Representation.charEmbedding.arrayMap).prod (((((Language.Representation.array Language.CellTy.bool).arrayProd (Language.Representation.array Language.CellTy.nat)).comap Language.Representation.intEquiv.toEmbedding.arrayMap).prod (Language.Representation.array Language.CellTy.bool)).comap Language.Representation.arrayUnzip)).comap Language.Representation.arrayUnzip).comap Entry.programEmbedding.arrayMap).Rel rows storage heap) (defaultObserved : (((Language.Representation.ofEmbedding Language.Representation.charEmbedding).prod (Language.Representation.int.prod (Language.Representation.ofEmbedding (Function.Embedding.refl Bool)))).comap Entry.programEmbedding).Rel fallback defaultView heap) :
        @[reducible, inline]

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

        Equations
        Instances For
          @[reducible, inline]

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

          Equations
          • 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.

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

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

              Ordinary mathematical function generated from the same represented source block.

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

                Ordinary mathematical function generated from the same represented source block.

                Equations
                Instances For
                  theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayRead0.getD_eq (storage : Language.Buffer Language.CellTy.nat × (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × Language.Buffer Language.CellTy.bool) (index : ℕ) (defaultView : ℕ × (Bool × ℕ) × Bool) :
                  getD storage index defaultView = have columnL := storage.1; have defaultL := defaultView.1; do let valueL ← Language.Buffer.GetD.getNat columnL index defaultL have operand : (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × Language.Buffer Language.CellTy.bool := storage.2 have operand : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat := operand.1 have columnRLL : Language.Buffer Language.CellTy.bool := operand.1 have operand : (Bool × ℕ) × Bool := defaultView.2 have operand : Bool × ℕ := operand.1 have defaultRLL : Bool := operand.1 let valueRLL ← Language.Buffer.GetD.getBool columnRLL index defaultRLL have operand : (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × Language.Buffer Language.CellTy.bool := storage.2 have operand : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat := operand.1 have columnRLR : Language.Buffer Language.CellTy.nat := operand.2 have operand : (Bool × ℕ) × Bool := defaultView.2 have operand : Bool × ℕ := operand.1 have defaultRLR : ℕ := operand.2 let valueRLR ← Language.Buffer.GetD.getNat columnRLR index defaultRLR have operand : (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × Language.Buffer Language.CellTy.bool := storage.2 have columnRR : Language.Buffer Language.CellTy.bool := operand.2 have operand : (Bool × ℕ) × Bool := defaultView.2 have defaultRR : Bool := operand.2 let valueRR ← Language.Buffer.GetD.getBool columnRR index defaultRR have operand : Bool × ℕ := (valueRLL, valueRLR) have operand : (Bool × ℕ) × Bool := (operand, valueRR) pure (valueL, operand)

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

                  theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayRead0.getD_spec {pre✝ : Language.Env [(Language.Ty.buffer Language.CellTy.nat).prod (((Language.Ty.buffer Language.CellTy.bool).prod (Language.Ty.buffer Language.CellTy.nat)).prod (Language.Ty.buffer Language.CellTy.bool)), Language.Ty.nat, Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool)] → Language.Heap → Prop} {post✝ : Language.Env [(Language.Ty.buffer Language.CellTy.nat).prod (((Language.Ty.buffer Language.CellTy.bool).prod (Language.Ty.buffer Language.CellTy.nat)).prod (Language.Ty.buffer Language.CellTy.bool)), Language.Ty.nat, Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool)] → Language.Heap → ℕ × (Bool × ℕ) × Bool → Language.Heap → Prop} :
                  Language.FunctionTotal program getDId pre✝ post✝ → ∀ (storage : Language.Buffer Language.CellTy.nat × (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × Language.Buffer Language.CellTy.bool) (index : ℕ) (defaultView : ℕ × (Bool × ℕ) × Bool) (continuation : Std.Do.PostCond (ℕ × (Bool × ℕ) × 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 storage (Language.Env.cons index (Language.Env.cons defaultView Language.Env.empty))) initialHeap ∧ ∀ (value : ℕ × (Bool × ℕ) × Bool) (finalHeap : Language.Heap), post✝ (Language.Env.cons storage (Language.Env.cons index (Language.Env.cons defaultView Language.Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ getD storage index defaultView ⦃continuation⦄

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

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

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

                    The source program's declared first-order signatures.

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

                      The named function's actual independently interpreted source body.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        @[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
                            theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayRead0.getD_eval_exists_preserving (rows : Array Entry) (index : ℕ) (fallback : Entry) (storage : Language.Value ((Language.Ty.buffer Language.CellTy.nat).prod (((Language.Ty.buffer Language.CellTy.bool).prod (Language.Ty.buffer Language.CellTy.nat)).prod (Language.Ty.buffer Language.CellTy.bool)))) (defaultView : Language.Value (Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool))) (heap : Language.Heap) (observed : (((((Language.Representation.array Language.CellTy.nat).comap Language.Representation.charEmbedding.arrayMap).prod (((((Language.Representation.array Language.CellTy.bool).arrayProd (Language.Representation.array Language.CellTy.nat)).comap Language.Representation.intEquiv.toEmbedding.arrayMap).prod (Language.Representation.array Language.CellTy.bool)).comap Language.Representation.arrayUnzip)).comap Language.Representation.arrayUnzip).comap Entry.programEmbedding.arrayMap).Rel rows storage heap) (defaultObserved : (((Language.Representation.ofEmbedding Language.Representation.charEmbedding).prod (Language.Representation.int.prod (Language.Representation.ofEmbedding (Function.Embedding.refl Bool)))).comap Entry.programEmbedding).Rel fallback defaultView heap) :

                            The finite table of actual named source bodies.

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

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

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

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

                                  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.CompositeArrays.Columns.Operations.arrayReplicate0.replicate_total_iff (pre✝ : ℕ → ℕ × ℕ × ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ × ℕ × ℕ → Language.Heap → Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat × 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 × Language.Buffer Language.CellTy.nat × 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.

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

                                        @[reducible, inline]

                                        Signature-preserving positions of this imported source program.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          theorem Complexity.Examples.CompositeArrays.Columns.retain_total_iff (pre✝ : Language.Buffer Language.CellTy.nat × ℕ × (Bool × ℕ) × Bool → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × ℕ × (Bool × ℕ) × Bool → Language.Heap → ℕ → Language.Heap → Prop) :
                                          retain_contract pre✝ post✝ ↔ ∀ (input : Language.Buffer Language.CellTy.nat × ℕ × (Bool × ℕ) × Bool) (initialHeap : Language.Heap), pre✝ input initialHeap → ∃ (value : ℕ) (finalHeap : Language.Heap), retain input initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ input 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.CompositeArrays.Columns.triples_eq (input : ℕ × ℕ × ℕ × ℕ) :
                                          triples input = have operand := input.1; have operand_1 := input.2; do let sourceResult ← Operations.arrayReplicate0.replicate operand operand_1 pure sourceResult

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

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

                                          theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayRead0.getD_eval (rows : Array Entry) (index : ℕ) (fallback : Entry) (storage : Language.Value ((Language.Ty.buffer Language.CellTy.nat).prod (((Language.Ty.buffer Language.CellTy.bool).prod (Language.Ty.buffer Language.CellTy.nat)).prod (Language.Ty.buffer Language.CellTy.bool)))) (defaultView : Language.Value (Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool))) (heap : Language.Heap) (observed : (((((Language.Representation.array Language.CellTy.nat).comap Language.Representation.charEmbedding.arrayMap).prod (((((Language.Representation.array Language.CellTy.bool).arrayProd (Language.Representation.array Language.CellTy.nat)).comap Language.Representation.intEquiv.toEmbedding.arrayMap).prod (Language.Representation.array Language.CellTy.bool)).comap Language.Representation.arrayUnzip)).comap Language.Representation.arrayUnzip).comap Entry.programEmbedding.arrayMap).Rel rows storage heap) (defaultObserved : (((Language.Representation.ofEmbedding Language.Representation.charEmbedding).prod (Language.Representation.int.prod (Language.Representation.ofEmbedding (Function.Embedding.refl Bool)))).comap Entry.programEmbedding).Rel fallback defaultView heap) :
                                          @[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]

                                              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]

                                                  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.CompositeArrays.Columns.Operations.arrayReplicate1.replicate_spec {pre✝ : Language.Env [Language.Ty.nat, Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool)] → Language.Heap → Prop} {post✝ : Language.Env [Language.Ty.nat, Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool)] → Language.Heap → Language.Buffer Language.CellTy.nat × (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × Language.Buffer Language.CellTy.bool → Language.Heap → Prop} :

                                                    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.

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

                                                            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]

                                                              Signatures of the functions added by this source declaration.

                                                              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.

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

                                                                  @[reducible, inline]

                                                                  The source program's declared first-order signatures.

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

                                                                    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
                                                                      theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayRead0.getD_eval_preserving (rows : Array Entry) (index : ℕ) (fallback : Entry) (storage : Language.Value ((Language.Ty.buffer Language.CellTy.nat).prod (((Language.Ty.buffer Language.CellTy.bool).prod (Language.Ty.buffer Language.CellTy.nat)).prod (Language.Ty.buffer Language.CellTy.bool)))) (defaultView : Language.Value (Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool))) (heap : Language.Heap) (observed : (((((Language.Representation.array Language.CellTy.nat).comap Language.Representation.charEmbedding.arrayMap).prod (((((Language.Representation.array Language.CellTy.bool).arrayProd (Language.Representation.array Language.CellTy.nat)).comap Language.Representation.intEquiv.toEmbedding.arrayMap).prod (Language.Representation.array Language.CellTy.bool)).comap Language.Representation.arrayUnzip)).comap Language.Representation.arrayUnzip).comap Entry.programEmbedding.arrayMap).Rel rows storage heap) (defaultObserved : (((Language.Representation.ofEmbedding Language.Representation.charEmbedding).prod (Language.Representation.int.prod (Language.Representation.ofEmbedding (Function.Embedding.refl Bool)))).comap Entry.programEmbedding).Rel fallback defaultView heap) :

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

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

                                                                        Signatures of the functions added by this source declaration.

                                                                        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.

                                                                          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
                                                                              theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayReplicate1.replicate_eq (length : ℕ) (value : ℕ × (Bool × ℕ) × Bool) :
                                                                              replicate length value = have initialColumnL := value.1; do let columnL ← Language.Buffer.Replicate.replicateNat length initialColumnL have operand : (Bool × ℕ) × Bool := value.2 have operand : Bool × ℕ := operand.1 have initialColumnRLL : Bool := operand.1 let columnRLL ← Language.Buffer.Replicate.replicateBool length initialColumnRLL have operand : (Bool × ℕ) × Bool := value.2 have operand : Bool × ℕ := operand.1 have initialColumnRLR : ℕ := operand.2 let columnRLR ← Language.Buffer.Replicate.replicateNat length initialColumnRLR have operand : (Bool × ℕ) × Bool := value.2 have initialColumnRR : Bool := operand.2 let columnRR ← Language.Buffer.Replicate.replicateBool length initialColumnRR have operand : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat := (columnRLL, columnRLR) have operand : (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × Language.Buffer Language.CellTy.bool := (operand, columnRR) pure (columnL, operand)

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

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

                                                                              theorem Complexity.Examples.CompositeArrays.Columns.Operations.arrayReplicate0.replicate_contract_iff_triple (pre✝ : ℕ → ℕ × ℕ × ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ × ℕ × ℕ → Language.Heap → Language.Buffer Language.CellTy.nat × Language.Buffer Language.CellTy.nat × 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 × Language.Buffer Language.CellTy.nat × 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 source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

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

                                                                              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

                                                                                  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]

                                                                                  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.CompositeArrays.Columns.entries_action_rel_native (input : ℕ × Entry) (input_source✝ : Language.Value (Language.Ty.nat.prod (Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool)))) (initialHeap✝ : Language.Heap) :

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

                                                                                    theorem Complexity.Examples.CompositeArrays.Columns.entries_eq (input : ℕ × ℕ × (Bool × ℕ) × Bool) :
                                                                                    entries input = have operand := input.1; have operand_1 := input.2; do let sourceResult ← Operations.arrayReplicate1.replicate operand operand_1 pure sourceResult

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

                                                                                    @[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 finite table of actual named source bodies.

                                                                                      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

                                                                                          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

                                                                                            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.CompositeArrays.Columns.retain_eq (input : Language.Buffer Language.CellTy.nat × ℕ × (Bool × ℕ) × Bool) :
                                                                                              retain input = have operand := input.1; have operand := operand.length; have operand_1 := input.2; do let entries ← Operations.arrayReplicate1.replicate operand operand_1 have operand : Language.Buffer Language.CellTy.nat := input.1 let index ← Language.Buffer.GetD.getNat operand 0 0 have operand : ℕ × (Bool × ℕ) × Bool := input.2 let selected ← Operations.arrayRead0.getD entries index operand pure selected.1

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

                                                                                              @[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.CompositeArrays.Columns.entries_action_rel_native_preserving (input : ℕ × Entry) (input_source✝ : Language.Value (Language.Ty.nat.prod (Language.Ty.nat.prod ((Language.Ty.bool.prod Language.Ty.nat).prod Language.Ty.bool)))) (initialHeap✝ : Language.Heap) :

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

                                                                                                  @[reducible, inline]

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

                                                                                                  Equations
                                                                                                  Instances For

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

                                                                                                    @[reducible, inline]

                                                                                                    The complete signature tables retained from imported source programs.

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

                                                                                                      Signature-preserving positions of this imported source program.

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

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

                                                                                                        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

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

                                                                                                          Added function bodies already typed against the complete linked table.

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

                                                                                                            Ordinary mathematical function generated from the same represented source block.

                                                                                                            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

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

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

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

                                                                                                                  The finite table of actual named source bodies.

                                                                                                                  Equations
                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                  Instances For
                                                                                                                    Equations
                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                    Instances For
                                                                                                                      theorem Complexity.Examples.CompositeArrays.triples_correct :
                                                                                                                      triples.Correct (fun (x : ℕ × ℕ × ℕ × ℕ) => True) fun (input : ℕ × ℕ × ℕ × ℕ) (result : Array (ℕ × ℕ × ℕ)) => 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.CompositeArrays.entries_correct :
                                                                                                                        entries.Correct (fun (x : ℕ × Entry) => True) fun (input : ℕ × Entry) (result : Array Entry) => 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.CompositeArrays.retain_correct :
                                                                                                                          retain.Correct (fun (x : Array ℕ × Entry) => True) fun (input : Array ℕ × Entry) (result : Char) => result = ((Array.replicate input.1.size input.2).getD (input.1.getD 0 0) input.2).label

                                                                                                                          The generated allocator composes the existing scalar certificates and real instructions.

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

                                                                                                                            Three actual initialized columns contribute their linear costs.

                                                                                                                            @[reducible, inline]

                                                                                                                            The source program's declared first-order signatures.

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

                                                                                                                              The named function's actual independently interpreted source body.

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

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

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

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

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

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

                                                                                                                                              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
                                                                                                                                                  @[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
                                                                                                                                                    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 independently interpreted source body.

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

                                                                                                                                                          The source program's declared first-order signatures.

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

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

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

                                                                                                                                                              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.CompositeArrays.Optional.retain_action_rel_native (input : Array ℕ × ℤ) (input_source✝ : Language.Value ((Language.Ty.buffer Language.CellTy.nat).prod (Language.Ty.bool.prod Language.Ty.nat))) (initialHeap✝ : Language.Heap) :
                                                                                                                                                                ((Language.Representation.array Language.CellTy.nat).prod Language.Representation.int).Rel input input_source✝ initialHeap✝ → ∃ (returned : Language.Value (Language.Ty.bool.prod Language.Ty.nat).option) (finish : Language.Heap), retain input_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ Language.Representation.int.option.Rel (retain_model input) 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.

                                                                                                                                                                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

                                                                                                                                                                    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.

                                                                                                                                                                    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.

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

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

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

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

                                                                                                                                                                          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

                                                                                                                                                                            Added function bodies already typed against the complete linked table.

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

                                                                                                                                                                              Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                              Equations
                                                                                                                                                                              Instances For
                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                The source program's declared first-order signatures.

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

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

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

                                                                                                                                                                                    The named function's actual independently interpreted source body.

                                                                                                                                                                                    Equations
                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                    Instances For
                                                                                                                                                                                      theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayRead0.getD_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → ℕ → Option (Bool × ℕ) → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → ℕ → Option (Bool × ℕ) → Language.Heap → Option (Bool × ℕ) → Language.Heap → Prop) :
                                                                                                                                                                                      getD_contract pre✝ post✝ ↔ ∀ (storage : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (index : ℕ) (defaultView : Option (Bool × ℕ)) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ storage index defaultView initialHeap }⦄ getD storage index defaultView ⦃(fun (value : Option (Bool × ℕ)) (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

                                                                                                                                                                                        The finite table of actual named source bodies.

                                                                                                                                                                                        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]

                                                                                                                                                                                          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.

                                                                                                                                                                                            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
                                                                                                                                                                                              theorem Complexity.Examples.CompositeArrays.Optional.retain_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat × Bool × ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × Bool × ℕ → Language.Heap → Option (Bool × ℕ) → Language.Heap → Prop) :
                                                                                                                                                                                              retain_contract pre✝ post✝ ↔ ∀ (input : Language.Buffer Language.CellTy.nat × Bool × ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ retain input ⦃(fun (value : Option (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.

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

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

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

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

                                                                                                                                                                                                Equations
                                                                                                                                                                                                Instances For

                                                                                                                                                                                                  The finite table of actual named source bodies.

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

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

                                                                                                                                                                                                    theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayRead0.getD_total_iff (pre✝ : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → ℕ → Option (Bool × ℕ) → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → ℕ → Option (Bool × ℕ) → Language.Heap → Option (Bool × ℕ) → Language.Heap → Prop) :
                                                                                                                                                                                                    getD_contract pre✝ post✝ ↔ ∀ (storage : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (index : ℕ) (defaultView : Option (Bool × ℕ)) (initialHeap : Language.Heap), pre✝ storage index defaultView initialHeap → ∃ (value : Option (Bool × ℕ)) (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.

                                                                                                                                                                                                    @[reducible, inline]

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

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

                                                                                                                                                                                                      The finite table of actual named source bodies.

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

                                                                                                                                                                                                        Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                        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

                                                                                                                                                                                                            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]

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

                                                                                                                                                                                                              Equations
                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                Signature-preserving positions of this imported source program.

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

                                                                                                                                                                                                                  Signatures of the functions added by this source declaration.

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

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

                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                      @[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

                                                                                                                                                                                                                          Actual imported function bodies with their internal calls relocated.

                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                          • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                            theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayReplicate2.replicate_total_iff (pre✝ : ℕ → Option Bool → Language.Heap → Prop) (post✝ : ℕ → Option Bool → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool → Language.Heap → Prop) :
                                                                                                                                                                                                                            replicate_contract pre✝ post✝ ↔ ∀ (length : ℕ) (value : Option Bool) (initialHeap : Language.Heap), pre✝ length value initialHeap → ∃ (value_1 : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool) (finalHeap : Language.Heap), replicate length value initialHeap = Part.some (Except.ok value_1, finalHeap) ∧ post✝ length value initialHeap value_1 finalHeap

                                                                                                                                                                                                                            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

                                                                                                                                                                                                                              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]

                                                                                                                                                                                                                                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

                                                                                                                                                                                                                                    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
                                                                                                                                                                                                                                      theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayReplicate0.replicate_total_iff (pre✝ : ℕ → Option ℕ → Language.Heap → Prop) (post✝ : ℕ → Option ℕ → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                      replicate_contract pre✝ post✝ ↔ ∀ (length : ℕ) (value : Option ℕ) (initialHeap : Language.Heap), pre✝ length value initialHeap → ∃ (value_1 : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap), replicate length value initialHeap = Part.some (Except.ok value_1, finalHeap) ∧ post✝ length value initialHeap value_1 finalHeap

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

                                                                                                                                                                                                                                      theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayReplicate1.replicate_contract_iff_triple (pre✝ : ℕ → Option (Bool × ℕ) → Language.Heap → Prop) (post✝ : ℕ → Option (Bool × ℕ) → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                      replicate_contract pre✝ post✝ ↔ ∀ (length : ℕ) (value : Option (Bool × ℕ)) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ length value initialHeap }⦄ replicate length value ⦃(fun (value_1 : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap) => { down := post✝ length value initialHeap value_1 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.CompositeArrays.Optional.missing_contract_iff_triple (pre✝ : ℕ → Language.Heap → Prop) (post✝ : ℕ → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                      missing_contract pre✝ post✝ ↔ ∀ (length : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ length initialHeap }⦄ missing length ⦃(fun (value : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap) => { down := post✝ length 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
                                                                                                                                                                                                                                        @[reducible, inline]

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

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

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

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

                                                                                                                                                                                                                                            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.CompositeArrays.Optional.retain_total_iff (pre✝ : Language.Buffer Language.CellTy.nat × Bool × ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × Bool × ℕ → Language.Heap → Option (Bool × ℕ) → Language.Heap → Prop) :
                                                                                                                                                                                                                                              retain_contract pre✝ post✝ ↔ ∀ (input : Language.Buffer Language.CellTy.nat × Bool × ℕ) (initialHeap : Language.Heap), pre✝ input initialHeap → ∃ (value : Option (Bool × ℕ)) (finalHeap : Language.Heap), retain input initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ input 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.CompositeArrays.Optional.Operations.arrayRead0.getD_eq (storage : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (index : ℕ) (defaultView : Option (Bool × ℕ)) :
                                                                                                                                                                                                                                              getD storage index defaultView = have operand := (false, 0); have packedDefault := (false, operand); have __do_jp := fun (packedDefault : Bool × Bool × ℕ) (y : Unit) => have columnL := storage.1; have defaultL := packedDefault.1; do let valueL ← Language.Buffer.GetD.getBool columnL index defaultL have operand : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat := storage.2 have columnRL : Language.Buffer Language.CellTy.bool := operand.1 have operand : Bool × ℕ := packedDefault.2 have defaultRL : Bool := operand.1 let valueRL ← Language.Buffer.GetD.getBool columnRL index defaultRL have operand : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat := storage.2 have columnRR : Language.Buffer Language.CellTy.nat := operand.2 have operand : Bool × ℕ := packedDefault.2 have defaultRR : ℕ := operand.2 let valueRR ← Language.Buffer.GetD.getNat columnRR index defaultRR have unpacked : Option (Bool × ℕ) := none have operand : Bool × ℕ := (valueRL, valueRR) have operand : Bool × Bool × ℕ := (valueL, operand) have condition : Bool := operand.1 have __do_jp : Option (Bool × ℕ) → Unit → ExceptT Language.Fault (StateT Language.Heap Part) (Option (Bool × ℕ)) := fun (unpacked : Option (Bool × ℕ)) (y : Unit) => pure unpacked if condition = true then have operand := (valueRL, valueRR); have operand := (valueL, operand); have operand := operand.2; have unpacked := some operand; do let y ← pure () __do_jp unpacked y else have unpacked := none; do let y ← pure () __do_jp unpacked y; match defaultView with | none => have operand := (false, 0); have packedDefault := (false, operand); do let y ← pure () __do_jp packedDefault y | some payload => have packedDefault := (true, payload); do let y ← pure () __do_jp packedDefault y

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

                                                                                                                                                                                                                                              @[reducible, inline]

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

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

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

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

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

                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                    @[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 source contract is equivalent to ordinary curried preconditions and successful result/heap postconditions, including termination and absence of faults.

                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                      The complete signature tables retained from imported source programs.

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

                                                                                                                                                                                                                                                        Added function bodies already typed against the complete linked table.

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

                                                                                                                                                                                                                                                          Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                          Equations
                                                                                                                                                                                                                                                          Instances For
                                                                                                                                                                                                                                                            @[reducible, inline]

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

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

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

                                                                                                                                                                                                                                                              theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayReplicate0.replicate_contract_iff_triple (pre✝ : ℕ → Option ℕ → Language.Heap → Prop) (post✝ : ℕ → Option ℕ → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                                              replicate_contract pre✝ post✝ ↔ ∀ (length : ℕ) (value : Option ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ length value initialHeap }⦄ replicate length value ⦃(fun (value_1 : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap) => { down := post✝ length value initialHeap value_1 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]

                                                                                                                                                                                                                                                              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.CompositeArrays.Optional.Operations.arrayReplicate1.replicate_eq (length : ℕ) (value : Option (Bool × ℕ)) :
                                                                                                                                                                                                                                                                replicate length value = have operand := (false, 0); have packed := (false, operand); have __do_jp := fun (packed : Bool × Bool × ℕ) (y : Unit) => have initialColumnL := packed.1; do let columnL ← Language.Buffer.Replicate.replicateBool length initialColumnL have operand : Bool × ℕ := packed.2 have initialColumnRL : Bool := operand.1 let columnRL ← Language.Buffer.Replicate.replicateBool length initialColumnRL have operand : Bool × ℕ := packed.2 have initialColumnRR : ℕ := operand.2 let columnRR ← Language.Buffer.Replicate.replicateNat length initialColumnRR have operand : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat := (columnRL, columnRR) pure (columnL, operand); match value with | none => have operand := (false, 0); have packed := (false, operand); do let y ← pure () __do_jp packed y | some payload => have packed := (true, payload); do let y ← pure () __do_jp packed y

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

                                                                                                                                                                                                                                                                theorem Complexity.Examples.CompositeArrays.Optional.flags_eq (input : ℕ × Bool) :
                                                                                                                                                                                                                                                                flags input = have operand := input.1; have operand_1 := input.2; have operand_2 := some operand_1; do let sourceResult ← Operations.arrayReplicate2.replicate operand operand_2 pure sourceResult

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

                                                                                                                                                                                                                                                                theorem Complexity.Examples.CompositeArrays.Optional.lookupOr_eq (input : (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × ℕ × Bool × ℕ) :
                                                                                                                                                                                                                                                                lookupOr input = have operand := input.1; have operand_1 := input.2; have operand_2 := operand_1.1; have operand_3 := input.2; have operand_4 := operand_3.2; have operand_5 := some operand_4; do let sourceResult ← Operations.arrayRead0.getD operand operand_2 operand_5 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.

                                                                                                                                                                                                                                                                @[reducible, inline]

                                                                                                                                                                                                                                                                Signature-preserving positions of this imported source program.

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

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

                                                                                                                                                                                                                                                                  @[reducible, inline]

                                                                                                                                                                                                                                                                  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.CompositeArrays.Optional.naturals_eq (input : ℕ × ℕ) :
                                                                                                                                                                                                                                                                    naturals input = have operand := input.1; have operand_1 := input.2; have operand_2 := some operand_1; do let sourceResult ← Operations.arrayReplicate0.replicate operand operand_2 pure sourceResult

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

                                                                                                                                                                                                                                                                    theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayReplicate1.replicate_total_iff (pre✝ : ℕ → Option (Bool × ℕ) → Language.Heap → Prop) (post✝ : ℕ → Option (Bool × ℕ) → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                                                    replicate_contract pre✝ post✝ ↔ ∀ (length : ℕ) (value : Option (Bool × ℕ)) (initialHeap : Language.Heap), pre✝ length value initialHeap → ∃ (value_1 : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap), replicate length value initialHeap = Part.some (Except.ok value_1, finalHeap) ∧ post✝ length value initialHeap value_1 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.

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

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

                                                                                                                                                                                                                                                                      The finite table of actual named source bodies.

                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                        theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayReplicate2.replicate_eq (length : ℕ) (value : Option Bool) :
                                                                                                                                                                                                                                                                        replicate length value = have packed := (false, false); have __do_jp := fun (packed : Bool × Bool) (y : Unit) => have initialColumnL := packed.1; do let columnL ← Language.Buffer.Replicate.replicateBool length initialColumnL have initialColumnR : Bool := packed.2 let columnR ← Language.Buffer.Replicate.replicateBool length initialColumnR pure (columnL, columnR); match value with | none => have packed := (false, false); do let y ← pure () __do_jp packed y | some payload => have packed := (true, payload); do let y ← pure () __do_jp packed y

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

                                                                                                                                                                                                                                                                        @[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.CompositeArrays.Optional.flags_total_iff (pre✝ : ℕ × Bool → Language.Heap → Prop) (post✝ : ℕ × Bool → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool → Language.Heap → Prop) :
                                                                                                                                                                                                                                                                          flags_contract pre✝ post✝ ↔ ∀ (input : ℕ × Bool) (initialHeap : Language.Heap), pre✝ input initialHeap → ∃ (value : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool) (finalHeap : Language.Heap), flags input initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ input initialHeap value finalHeap

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

                                                                                                                                                                                                                                                                          @[reducible, inline]

                                                                                                                                                                                                                                                                          Signature-preserving positions of this imported source program.

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

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

                                                                                                                                                                                                                                                                            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

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

                                                                                                                                                                                                                                                                              theorem Complexity.Examples.CompositeArrays.Optional.missing_total_iff (pre✝ : ℕ → Language.Heap → Prop) (post✝ : ℕ → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                                                              missing_contract pre✝ post✝ ↔ ∀ (length : ℕ) (initialHeap : Language.Heap), pre✝ length initialHeap → ∃ (value : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap), missing length initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ length initialHeap value finalHeap

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

                                                                                                                                                                                                                                                                              @[reducible, inline]

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

                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                @[reducible, inline]

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

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

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

                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                  Instances For

                                                                                                                                                                                                                                                                                    The named function's actual 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.CompositeArrays.Optional.Operations.arrayReplicate2.replicate_contract_iff_triple (pre✝ : ℕ → Option Bool → Language.Heap → Prop) (post✝ : ℕ → Option Bool → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool → Language.Heap → Prop) :
                                                                                                                                                                                                                                                                                      replicate_contract pre✝ post✝ ↔ ∀ (length : ℕ) (value : Option Bool) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ length value initialHeap }⦄ replicate length value ⦃(fun (value_1 : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool) (finalHeap : Language.Heap) => { down := post✝ length value initialHeap value_1 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.CompositeArrays.Optional.integers_eq (input : ℕ × Bool × ℕ) :
                                                                                                                                                                                                                                                                                      integers input = have operand := input.1; have operand_1 := input.2; have operand_2 := some operand_1; do let sourceResult ← Operations.arrayReplicate1.replicate operand operand_2 pure sourceResult

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

                                                                                                                                                                                                                                                                                      theorem Complexity.Examples.CompositeArrays.Optional.naturals_total_iff (pre✝ : ℕ × ℕ → Language.Heap → Prop) (post✝ : ℕ × ℕ → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                                                                      naturals_contract pre✝ post✝ ↔ ∀ (input : ℕ × ℕ) (initialHeap : Language.Heap), pre✝ input initialHeap → ∃ (value : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap), naturals input initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ input initialHeap value finalHeap

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

                                                                                                                                                                                                                                                                                      @[reducible, inline]

                                                                                                                                                                                                                                                                                      Signature-preserving positions of this imported source program.

                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                        theorem Complexity.Examples.CompositeArrays.Optional.missing_eq (length : ℕ) :
                                                                                                                                                                                                                                                                                        missing length = have operand := none; do let sourceResult ← Operations.arrayReplicate0.replicate length operand pure sourceResult

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

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

                                                                                                                                                                                                                                                                                        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.CompositeArrays.Optional.flags_contract_iff_triple (pre✝ : ℕ × Bool → Language.Heap → Prop) (post✝ : ℕ × Bool → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool → Language.Heap → Prop) :
                                                                                                                                                                                                                                                                                          flags_contract pre✝ post✝ ↔ ∀ (input : ℕ × Bool) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ flags input ⦃(fun (value : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.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.

                                                                                                                                                                                                                                                                                          The named function's actual independently interpreted source body.

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

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

                                                                                                                                                                                                                                                                                            Equations
                                                                                                                                                                                                                                                                                            Instances For

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

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

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

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

                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                Instances For

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

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

                                                                                                                                                                                                                                                                                                    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

                                                                                                                                                                                                                                                                                                      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
                                                                                                                                                                                                                                                                                                        theorem Complexity.Examples.CompositeArrays.Optional.lookup_eq (input : (Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) × ℕ) :
                                                                                                                                                                                                                                                                                                        lookup input = have operand := input.1; have operand_1 := input.2; have operand_2 := none; do let sourceResult ← Operations.arrayRead0.getD operand operand_1 operand_2 pure sourceResult

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

                                                                                                                                                                                                                                                                                                        theorem Complexity.Examples.CompositeArrays.Optional.Operations.arrayReplicate0.replicate_eq (length : ℕ) (value : Option ℕ) :
                                                                                                                                                                                                                                                                                                        replicate length value = have packed := (false, 0); have __do_jp := fun (packed : Bool × ℕ) (y : Unit) => have initialColumnL := packed.1; do let columnL ← Language.Buffer.Replicate.replicateBool length initialColumnL have initialColumnR : ℕ := packed.2 let columnR ← Language.Buffer.Replicate.replicateNat length initialColumnR pure (columnL, columnR); match value with | none => have packed := (false, 0); do let y ← pure () __do_jp packed y | some payload => have packed := (true, payload); do let y ← pure () __do_jp packed y

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

                                                                                                                                                                                                                                                                                                        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]

                                                                                                                                                                                                                                                                                                        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

                                                                                                                                                                                                                                                                                                            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.CompositeArrays.Optional.integers_contract_iff_triple (pre✝ : ℕ × Bool × ℕ → Language.Heap → Prop) (post✝ : ℕ × Bool × ℕ → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                                                                                              integers_contract pre✝ post✝ ↔ ∀ (input : ℕ × Bool × ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ integers input ⦃(fun (value : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (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.

                                                                                                                                                                                                                                                                                                              theorem Complexity.Examples.CompositeArrays.Optional.naturals_contract_iff_triple (pre✝ : ℕ × ℕ → Language.Heap → Prop) (post✝ : ℕ × ℕ → Language.Heap → Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                                                                                                                                                                                                                                              naturals_contract pre✝ post✝ ↔ ∀ (input : ℕ × ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ naturals input ⦃(fun (value : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (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.

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

                                                                                                                                                                                                                                                                                                              @[reducible, inline]

                                                                                                                                                                                                                                                                                                              The source program's declared first-order signatures.

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

                                                                                                                                                                                                                                                                                                                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.CompositeArrays.Optional.Operations.arrayRead0.getD_spec {pre✝ : Language.Env [(Language.Ty.buffer Language.CellTy.bool).prod ((Language.Ty.buffer Language.CellTy.bool).prod (Language.Ty.buffer Language.CellTy.nat)), Language.Ty.nat, (Language.Ty.bool.prod Language.Ty.nat).option] → Language.Heap → Prop} {post✝ : Language.Env [(Language.Ty.buffer Language.CellTy.bool).prod ((Language.Ty.buffer Language.CellTy.bool).prod (Language.Ty.buffer Language.CellTy.nat)), Language.Ty.nat, (Language.Ty.bool.prod Language.Ty.nat).option] → Language.Heap → Option (Bool × ℕ) → Language.Heap → Prop} :
                                                                                                                                                                                                                                                                                                                  Language.FunctionTotal program getDId pre✝ post✝ → ∀ (storage : Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.bool × Language.Buffer Language.CellTy.nat) (index : ℕ) (defaultView : Option (Bool × ℕ)) (continuation : Std.Do.PostCond (Option (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 storage (Language.Env.cons index (Language.Env.cons defaultView Language.Env.empty))) initialHeap ∧ ∀ (value : Option (Bool × ℕ)) (finalHeap : Language.Heap), post✝ (Language.Env.cons storage (Language.Env.cons index (Language.Env.cons defaultView Language.Env.empty))) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ getD storage index defaultView ⦃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.

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

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                    The named function's actual independently interpreted source body.

                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                      theorem Complexity.Examples.CompositeArrays.Optional.retain_eq (input : Language.Buffer Language.CellTy.nat × Bool × ℕ) :
                                                                                                                                                                                                                                                                                                                      retain input = have operand := input.1; have operand := operand.length; have operand_1 := input.2; have operand_2 := some operand_1; do let initialized ← Operations.arrayReplicate1.replicate operand operand_2 have operand : Language.Buffer Language.CellTy.nat := input.1 let index ← Language.Buffer.GetD.getNat operand 0 0 have operand : Option (Bool × ℕ) := none let sourceResult ← Operations.arrayRead0.getD initialized index operand pure sourceResult

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

                                                                                                                                                                                                                                                                                                                      Ordinary mathematical function generated from the same represented source block.

                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                      Instances For

                                                                                                                                                                                                                                                                                                                        Added function bodies already typed against the complete linked table.

                                                                                                                                                                                                                                                                                                                        Equations
                                                                                                                                                                                                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                        Instances For
                                                                                                                                                                                                                                                                                                                          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
                                                                                                                                                                                                                                                                                                                              Equations
                                                                                                                                                                                                                                                                                                                              • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                              Instances For
                                                                                                                                                                                                                                                                                                                                Equations
                                                                                                                                                                                                                                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                Instances For
                                                                                                                                                                                                                                                                                                                                  theorem Complexity.Examples.CompositeArrays.optionalFlags_correct :
                                                                                                                                                                                                                                                                                                                                  optionalFlags.Correct (fun (x : ℕ × Bool) => True) fun (input : ℕ × Bool) (result : Array (Option Bool)) => result = Array.replicate input.1 (some input.2)
                                                                                                                                                                                                                                                                                                                                  Equations
                                                                                                                                                                                                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                  Instances For
                                                                                                                                                                                                                                                                                                                                    theorem Complexity.Examples.CompositeArrays.optionalLookup_correct :
                                                                                                                                                                                                                                                                                                                                    optionalLookup.Correct (fun (x : Array (Option ℤ) × ℕ) => True) fun (input : Array (Option ℤ) × ℕ) (result : Option ℤ) => result = input.1.getD input.2 none
                                                                                                                                                                                                                                                                                                                                    Equations
                                                                                                                                                                                                                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                    Instances For
                                                                                                                                                                                                                                                                                                                                      theorem Complexity.Examples.CompositeArrays.optionalLookupOr_correct :
                                                                                                                                                                                                                                                                                                                                      optionalLookupOr.Correct (fun (x : Array (Option ℤ) × ℕ × ℤ) => True) fun (input : Array (Option ℤ) × ℕ × ℤ) (result : Option ℤ) => result = input.1.getD input.2.1 (some input.2.2)
                                                                                                                                                                                                                                                                                                                                      Equations
                                                                                                                                                                                                                                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                                                                                                                                                                                                                                      Instances For
                                                                                                                                                                                                                                                                                                                                        theorem Complexity.Examples.CompositeArrays.optionalRetain_correct :
                                                                                                                                                                                                                                                                                                                                        optionalRetain.Correct (fun (x : Array ℕ × ℤ) => True) fun (input : Array ℕ × ℤ) (result : Option ℤ) => result = (Array.replicate input.1.size (some input.2)).getD (input.1.getD 0 0) none

                                                                                                                                                                                                                                                                                                                                        Optional columns allocate normally and preserve the existing input array. An out-of-range lookup returns the actual optional fallback, not some 0.

                                                                                                                                                                                                                                                                                                                                        def Complexity.Examples.CompositeArrays.Optional.Operations.arrayReplicate0.bodyCost (length : ℕ) :
                                                                                                                                                                                                                                                                                                                                        { bound : ℕ // ∀ (w heapLimit depth : ℕ) (initial : Option ℕ) (heap : Language.Heap), Ram.LanguageCompiler.StmtArenaCostBound program w heapLimit (depth + 1) (program.body replicateId) { locals := replicate_args length initial, heap := heap } bound }

                                                                                                                                                                                                                                                                                                                                        The optional allocator pays for its real packing branch and both columns.

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

                                                                                                                                                                                                                                                                                                                                          Presence and payload initialization each contribute their actual linear work.