Documentation

Examples.Language.Enumerations

Enumeration programs with ordinary mathematical contracts #

The fixed interfaces retain the original constructors. Reads and initialized arrays use actual natural-cell operations, while their contracts mention enums. The source and RAM inputs share the same canonical constructor-index embedding. These examples establish source correctness, not whole-program RAM time bounds.

Instances For

    A layout and identity program need no equality decision procedure.

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

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

            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
              @[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
                  theorem Complexity.Examples.Enumerations.Status.Operations.arrayRead0.getD_eval_exists (rows : Array Mode) (index : ℕ) (fallback : Mode) (storage : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (defaultView : Language.Value Language.Ty.nat) (heap : Language.Heap) (observed : ((Language.Representation.array Language.CellTy.nat).comap Mode.programEmbedding.arrayMap).Rel rows storage heap) (defaultObserved : (Language.Representation.ofEmbedding Mode.programEmbedding).Rel fallback defaultView heap) :
                  ∃ (returned : ℕ) (finish : Language.Heap), getD storage index defaultView heap = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding Mode.programEmbedding).Rel (rows.getD index fallback) returned finish ∧ heap.ShapeExtends finish

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

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

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

                    @[reducible, inline]

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

                    Equations
                    Instances For

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

                      theorem Complexity.Examples.Enumerations.Status.isRunning_eq (input : Language.Buffer Language.CellTy.nat × ℕ) :
                      isRunning input = have operand := input.1; have operand_1 := input.2; do let current ← Operations.arrayRead0.getD operand operand_1 0 have condition : Bool := decide (current = 1) if condition = true then pure true else pure false

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

                      Added function bodies already typed against the complete linked table.

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

                        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

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

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

                          theorem Complexity.Examples.Enumerations.Status.lookup_total_iff (pre✝ : Language.Buffer Language.CellTy.nat × ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                          lookup_contract pre✝ post✝ ↔ ∀ (input : Language.Buffer Language.CellTy.nat × ℕ) (initialHeap : Language.Heap), pre✝ input initialHeap → ∃ (value : ℕ) (finalHeap : Language.Heap), lookup 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.

                          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.Enumerations.Status.isRunning_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat × ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × ℕ → Language.Heap → Bool → Language.Heap → Prop) :
                            isRunning_contract pre✝ post✝ ↔ ∀ (input : Language.Buffer Language.CellTy.nat × ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ isRunning input ⦃(fun (value : Bool) (finalHeap : Language.Heap) => { down := post✝ input initialHeap value finalHeap }, fun (x : Language.Fault) (x_1 : Language.Heap) => { down := False }, PUnit.unit)⦄

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

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

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

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

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem Complexity.Examples.Enumerations.Status.replicate_action_rel_native (count : ℕ) (mode : Mode) (mode_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                (Language.Representation.ofEmbedding Mode.programEmbedding).Rel mode mode_source✝ initialHeap✝ → ∃ (returned : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (finish : Language.Heap), replicate count mode_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ ((Language.Representation.array Language.CellTy.nat).comap Mode.programEmbedding.arrayMap).Rel (replicate_model count mode) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish) finish

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

                                @[reducible, inline]

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

                                Equations
                                Instances For
                                  @[reducible, inline]

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

                                  Equations
                                  Instances For
                                    theorem Complexity.Examples.Enumerations.Status.different_action_rel_native_preserving (left right : Mode) (left_source✝ right_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                    (Language.Representation.ofEmbedding Mode.programEmbedding).Rel left left_source✝ initialHeap✝ → (Language.Representation.ofEmbedding Mode.programEmbedding).Rel right right_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.bool) (finish : Language.Heap), different left_source✝ right_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding (Function.Embedding.refl Bool)).Rel (different_model left right) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish ∧ Language.Buffer.PreservesContents initialHeap✝ finish) finish

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

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

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

                                      Ordinary mathematical function generated from the same represented source block.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        theorem Complexity.Examples.Enumerations.Status.keepPhase_spec {pre✝ : Language.Env [Language.Ty.nat] → Language.Heap → Prop} {post✝ : Language.Env [Language.Ty.nat] → Language.Heap → ℕ → Language.Heap → Prop} :
                                        Language.FunctionTotal program keepPhaseId pre✝ post✝ → ∀ (phase : ℕ) (continuation : Std.Do.PostCond ℕ (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 phase Language.Env.empty) initialHeap ∧ ∀ (value : ℕ) (finalHeap : Language.Heap), post✝ (Language.Env.cons phase Language.Env.empty) initialHeap value finalHeap → (continuation.1 value finalHeap).down }⦄ keepPhase phase ⦃continuation⦄

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

                                        @[reducible, inline]

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

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

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

                                          theorem Complexity.Examples.Enumerations.Status.Operations.arrayRead0.getD_eval (rows : Array Mode) (index : ℕ) (fallback : Mode) (storage : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (defaultView : Language.Value Language.Ty.nat) (heap : Language.Heap) (observed : ((Language.Representation.array Language.CellTy.nat).comap Mode.programEmbedding.arrayMap).Rel rows storage heap) (defaultObserved : (Language.Representation.ofEmbedding Mode.programEmbedding).Rel fallback defaultView heap) :
                                          ∃ (returned : ℕ), getD storage index defaultView heap = Part.some (Except.ok returned, heap) ∧ (Language.Representation.ofEmbedding Mode.programEmbedding).Rel (rows.getD index fallback) returned heap
                                          theorem Complexity.Examples.Enumerations.Status.Operations.arrayRead0.getD_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat → ℕ → ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat → ℕ → ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                          getD_contract pre✝ post✝ ↔ ∀ (storage : Language.Buffer Language.CellTy.nat) (index defaultView : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ storage index defaultView initialHeap }⦄ getD storage index defaultView ⦃(fun (value : ℕ) (finalHeap : Language.Heap) => { down := post✝ storage index defaultView initialHeap value finalHeap }, fun (x : Language.Fault) (x_1 : Language.Heap) => { down := False }, PUnit.unit)⦄

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

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

                                          theorem Complexity.Examples.Enumerations.Status.keepPhase_contract_iff_triple (pre✝ : ℕ → Language.Heap → Prop) (post✝ : ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                          keepPhase_contract pre✝ post✝ ↔ ∀ (phase : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ phase initialHeap }⦄ keepPhase phase ⦃(fun (value : ℕ) (finalHeap : Language.Heap) => { down := post✝ phase 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 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 partial source action, with ordinary typed arguments and an explicitly supplied shared heap.

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

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

                                              theorem Complexity.Examples.Enumerations.Status.lookup_contract_iff_triple (pre✝ : Language.Buffer Language.CellTy.nat × ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                              lookup_contract pre✝ post✝ ↔ ∀ (input : Language.Buffer Language.CellTy.nat × ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ input initialHeap }⦄ lookup 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.

                                              @[reducible, inline]

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

                                              Equations
                                              Instances For

                                                The named function's actual independently interpreted source body.

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

                                                      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.

                                                      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]

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

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

                                                            theorem Complexity.Examples.Enumerations.Status.keepPhase_action_rel_native (phase : Phase) (phase_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                                            (Language.Representation.ofEmbedding Phase.programEmbedding).Rel phase phase_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.nat) (finish : Language.Heap), keepPhase phase_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding Phase.programEmbedding).Rel (keepPhase_model phase) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish) finish

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

                                                            @[reducible, inline]

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

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  theorem Complexity.Examples.Enumerations.Status.Operations.arrayRead0.getD_eq (storage : Language.Buffer Language.CellTy.nat) (index defaultView : ℕ) :
                                                                  getD storage index defaultView = have column := storage; have default := defaultView; do let value ← Language.Buffer.GetD.getNat column index default pure value

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

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

                                                                  @[reducible, inline]

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

                                                                  Equations
                                                                  Instances For

                                                                    Ordinary mathematical function generated from the same represented source block.

                                                                    Equations
                                                                    Instances For

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

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

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

                                                                        @[reducible, inline]

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

                                                                        Equations
                                                                        Instances For
                                                                          @[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]

                                                                              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

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

                                                                                  theorem Complexity.Examples.Enumerations.Status.different_total_iff (pre✝ : ℕ → ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ → Language.Heap → Bool → Language.Heap → Prop) :
                                                                                  different_contract pre✝ post✝ ↔ ∀ (left right : ℕ) (initialHeap : Language.Heap), pre✝ left right initialHeap → ∃ (value : Bool) (finalHeap : Language.Heap), different left right initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ left right initialHeap value finalHeap

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

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

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

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

                                                                                        theorem Complexity.Examples.Enumerations.Status.isRunning_total_iff (pre✝ : Language.Buffer Language.CellTy.nat × ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat × ℕ → Language.Heap → Bool → Language.Heap → Prop) :
                                                                                        isRunning_contract pre✝ post✝ ↔ ∀ (input : Language.Buffer Language.CellTy.nat × ℕ) (initialHeap : Language.Heap), pre✝ input initialHeap → ∃ (value : Bool) (finalHeap : Language.Heap), isRunning 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.

                                                                                        Ordinary mathematical function generated from the same represented source block.

                                                                                        Equations
                                                                                        Instances For
                                                                                          theorem Complexity.Examples.Enumerations.Status.lookup_eq (input : Language.Buffer Language.CellTy.nat × ℕ) :
                                                                                          lookup input = have operand := input.1; have operand_1 := input.2; do let sourceResult ← Operations.arrayRead0.getD operand operand_1 0 pure sourceResult

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

                                                                                          theorem Complexity.Examples.Enumerations.Status.Operations.arrayRead0.getD_total_iff (pre✝ : Language.Buffer Language.CellTy.nat → ℕ → ℕ → Language.Heap → Prop) (post✝ : Language.Buffer Language.CellTy.nat → ℕ → ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                                                                          getD_contract pre✝ post✝ ↔ ∀ (storage : Language.Buffer Language.CellTy.nat) (index defaultView : ℕ) (initialHeap : Language.Heap), pre✝ storage index defaultView initialHeap → ∃ (value : ℕ) (finalHeap : Language.Heap), getD storage index defaultView initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ storage index defaultView initialHeap value finalHeap

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

                                                                                          theorem Complexity.Examples.Enumerations.Status.keepPhase_action_eq_native (phase : Phase) (phase_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                                                                          (Language.Representation.ofEmbedding Phase.programEmbedding).Rel phase phase_source✝ initialHeap✝ → keepPhase phase_source✝ initialHeap✝ = Part.some (Except.ok (Phase.programEmbedding (keepPhase_model phase)), initialHeap✝)

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

                                                                                          theorem Complexity.Examples.Enumerations.Status.replicate_total_iff (pre✝ : ℕ → ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ → Language.Heap → Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                          replicate_contract pre✝ post✝ ↔ ∀ (count mode : ℕ) (initialHeap : Language.Heap), pre✝ count mode initialHeap → ∃ (value : Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap), replicate count mode initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ count mode 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.Enumerations.Status.replicate_contract_iff_triple (pre✝ : ℕ → ℕ → Language.Heap → Prop) (post✝ : ℕ → ℕ → Language.Heap → Language.Buffer Language.CellTy.nat → Language.Heap → Prop) :
                                                                                          replicate_contract pre✝ post✝ ↔ ∀ (count mode : ℕ) (initialHeap : Language.Heap), ⦃fun (currentHeap : Language.Heap) => { down := currentHeap = initialHeap ∧ pre✝ count mode initialHeap }⦄ replicate count mode ⦃(fun (value : Language.Buffer Language.CellTy.nat) (finalHeap : Language.Heap) => { down := post✝ count mode initialHeap value finalHeap }, fun (x : Language.Fault) (x_1 : Language.Heap) => { down := False }, PUnit.unit)⦄

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

                                                                                          @[reducible, inline]

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

                                                                                          Equations
                                                                                          • One or more equations did not get rendered due to their size.
                                                                                          Instances For
                                                                                            theorem Complexity.Examples.Enumerations.Status.keepPhase_action_rel_native_preserving (phase : Phase) (phase_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                                                                            (Language.Representation.ofEmbedding Phase.programEmbedding).Rel phase phase_source✝ initialHeap✝ → ∃ (returned : Language.Value Language.Ty.nat) (finish : Language.Heap), keepPhase phase_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding Phase.programEmbedding).Rel (keepPhase_model phase) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish ∧ Language.Buffer.PreservesContents initialHeap✝ finish) finish

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

                                                                                            The named function's actual independently interpreted source body.

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

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

                                                                                                @[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.Enumerations.Status.replicate_eq (count mode : ℕ) :
                                                                                                  replicate count mode = do let sourceResult ← Language.Buffer.Replicate.replicateNat count mode pure sourceResult

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

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

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

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

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

                                                                                                        theorem Complexity.Examples.Enumerations.Status.keepPhase_total_iff (pre✝ : ℕ → Language.Heap → Prop) (post✝ : ℕ → Language.Heap → ℕ → Language.Heap → Prop) :
                                                                                                        keepPhase_contract pre✝ post✝ ↔ ∀ (phase : ℕ) (initialHeap : Language.Heap), pre✝ phase initialHeap → ∃ (value : ℕ) (finalHeap : Language.Heap), keepPhase phase initialHeap = Part.some (Except.ok value, finalHeap) ∧ post✝ phase initialHeap value finalHeap

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

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

                                                                                                        theorem Complexity.Examples.Enumerations.Status.different_action_eq_native (left right : Mode) (left_source✝ right_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                                                                                        (Language.Representation.ofEmbedding Mode.programEmbedding).Rel left left_source✝ initialHeap✝ → (Language.Representation.ofEmbedding Mode.programEmbedding).Rel right right_source✝ initialHeap✝ → different left_source✝ right_source✝ initialHeap✝ = Part.some (Except.ok (different_model left right), initialHeap✝)

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

                                                                                                        theorem Complexity.Examples.Enumerations.Status.Operations.arrayRead0.getD_eval_preserving (rows : Array Mode) (index : ℕ) (fallback : Mode) (storage : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (defaultView : Language.Value Language.Ty.nat) (heap : Language.Heap) (observed : ((Language.Representation.array Language.CellTy.nat).comap Mode.programEmbedding.arrayMap).Rel rows storage heap) (defaultObserved : (Language.Representation.ofEmbedding Mode.programEmbedding).Rel fallback defaultView heap) :
                                                                                                        ∃ (returned : ℕ) (finish : Language.Heap), getD storage index defaultView heap = Part.some (Except.ok returned, finish) ∧ (Language.Representation.ofEmbedding Mode.programEmbedding).Rel (rows.getD index fallback) returned finish ∧ heap.ShapeExtends finish ∧ Language.Buffer.PreservesContents heap finish
                                                                                                        theorem Complexity.Examples.Enumerations.Status.replicate_action_rel_native_preserving (count : ℕ) (mode : Mode) (mode_source✝ : Language.Value Language.Ty.nat) (initialHeap✝ : Language.Heap) :
                                                                                                        (Language.Representation.ofEmbedding Mode.programEmbedding).Rel mode mode_source✝ initialHeap✝ → ∃ (returned : Language.Value (Language.Ty.buffer Language.CellTy.nat)) (finish : Language.Heap), replicate count mode_source✝ initialHeap✝ = Part.some (Except.ok returned, finish) ∧ ((Language.Representation.array Language.CellTy.nat).comap Mode.programEmbedding.arrayMap).Rel (replicate_model count mode) returned finish ∧ (fun (finish : Language.Heap) => initialHeap✝.ShapeExtends finish ∧ Language.Buffer.PreservesContents initialHeap✝ finish) finish

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

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

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

                                                                                                        Ordinary mathematical function generated from the same represented source block.

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

                                                                                                            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
                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Instances For
                                                                                                                  theorem Complexity.Examples.Enumerations.keepPhase_correct :
                                                                                                                  keepPhase.Correct (fun (x : Phase) => True) fun (input result : Phase) => result = input
                                                                                                                  Equations
                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                  Instances For
                                                                                                                    theorem Complexity.Examples.Enumerations.repeated_correct :
                                                                                                                    repeated.Correct (fun (x : ℕ × Mode) => True) fun (input : ℕ × Mode) (result : Array Mode) => 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.Enumerations.lookup_correct :
                                                                                                                      lookup.Correct (fun (x : History) => True) fun (input : History) (result : Mode) => result = input.values.getD input.index Mode.idle
                                                                                                                      Equations
                                                                                                                      • One or more equations did not get rendered due to their size.
                                                                                                                      Instances For
                                                                                                                        theorem Complexity.Examples.Enumerations.different_correct :
                                                                                                                        different.Correct (fun (x : Mode × Mode) => True) fun (input : Mode × Mode) (result : Bool) => result = decide (input.1 ≠ input.2)
                                                                                                                        Equations
                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                        Instances For