def whole_preserves

stelliferous@0.0.2.0 · proofs/tensor_indexed_certificate.bend:90

import stelliferous@0.0.2.0/proofs/tensor_indexed_certificate.bend as TensorIndexedCertificate
import Base
import stelliferous@0.0.2.0/tensor_indexed.bend as Indexed
import stelliferous@0.0.2.0/traversal_array.bend as Traversal
import stelliferous@0.0.2.0/traversal_loop.bend as Loop
import stelliferous@0.0.2.0/proofs/storage_tree_model.bend as Tree
import stelliferous@0.0.2.0/proofs/storage_certificate.bend as Certificate
import stelliferous@0.0.2.0/proofs/traversal_witness.bend as TraversalWitness
import stelliferous@0.0.2.0/proofs/traversal_certificate.bend as TraversalCertificate

90def whole_preserves(~Element: Data,~Context: Data,~index: Context -> U32 -> U32,~base: Context -> U32 -> U32,~operation: U32 -> Element -> Element,
91  +depth: Nat,whole: Bool,blocks: U32,size: U32,total: U32,context: Context,-input: Array<Element>,-output: Array<Element>,input_certificate: Certificate.Certificate<Element,input>,
92  equation: {output == Tree.pack(Element,Certificate.normalized(Element,depth,Tree.reflect(Element,output))) : Array<Element>}) ->
93  TraversalWitness.ResultEvidence<Array<Element>,Element,input,depth,Indexed.run_whole(~Element,~Context,~index,~base,~operation,whole,blocks,size,total,context,input,output)>:
94  match whole:
95    case True{}:
96      TraversalCertificate.completed(~Array<Element>,~Element,~Indexed.Blocks<Context>,~TraversalWitness.array_evidence(~Element),
97        ~Loop.run(~Traversal.State<&1,&1,Array<Element>,Array<Element>,Indexed.Blocks<Context>>,~Indexed.block_step(~Element,~Context,~base,~operation)),~block_loop(~Element,~Context,~base,~operation),
98        U32.to_nat(blocks),0,Indexed.Blocks{0,size,context},input,output,Certificate.witness(Element,input,input_certificate),depth,equation)
99    case False{}:
100      preserves(~Element,~Context,~index,~operation,depth,Indexed.Call{U32.to_nat(total),context},input,output,input_certificate,equation)

Uses (21)

Used by (1)