You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: prover_impl.rs
    path of file: ./repos/risc0/risc0/zkvm/src/host/server/prove
    
    the code of the file until where you have to start completion: // Copyright 2024 RISC Zero, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may 
    
    fn prove_session(&self, ctx: &VerifierContext, session: &Session) -> Result<Receipt> {
        tracing::info!(
            "prove_session: {}, exit_code = {:?}, journal = {:?}",
            self.name,
            session.exit_code,
            session.journal.as_ref().map(|x| hex::encode(x))
        );
        let mut segments = Vec::new();
        for segment_ref in session.segments.iter() {
            let segment = segment_ref.resolve()?;
            for hook in &session.hooks {
                hook.on_pre_prove_segment(&segment);
            }
            segments.push(self.prove_segment(ctx, &segment)?);
            for hook in &session.hooks {
                hook.on_post_prove_segment(&segment);
            }
        }
        // TODO(#982): Support unresolved assumptions here.
        let composite_receipt = CompositeReceipt {
            segments,
            assumptions: session
                .assumptions
                .iter()
                .map(|a| Ok(a.as_receipt()?.inner.clone()))
                .collect::<Result<Vec<_>>>()?,
            journal_digest: session.journal.as_ref().map(|journal| journal.digest()),
        };

        // Verify the receipt to catch if something is broken in the proving process.
        composite_receipt.verify_integrity_with_context(ctx)?;
        if composite_receipt.get_claim()?.digest() != session.get_claim()?.digest() {
            tracing::debug!("composite receipt and session claim do not match");
            tracing::debug!(
                "composite receipt claim: {:#?}",
                composite_receipt.get_claim()?
            );
            tracing::debug!("session claim: {:#?}", session.get_claim()?);
            bail!(
                "session and composite receipt claim do not match: session {}, receipt {}",
                hex::encode(&session.get_claim()?.digest()),
                hex::encode(&composite_receipt.get_claim()?.digest())
            );
        }

        let receipt = Receipt::new(
            InnerReceipt::Composite(composite_receipt),
            session.journal.clone().unwrap_or_default().bytes,
        );

        // Verify the receipt to catch if something is broken in the proving process.
        receipt.verify_integrity_with_context(ctx)?;
        if receipt.get_claim()?.digest() != session.get_claim()?.digest() {
            tracing::debug!("receipt and session claim do not match");
            tracing::debug!("receipt claim: {:#?}", receipt.get_claim()?);
            tracing::debug!("session claim: {:#?}", session.get_claim()?);
            bail!(
                "session and receipt claim do not match: session {}, receipt {}",
                hex::encode(&session.get_claim()?.digest()),
                hex::encode(&receipt.get_claim()?.digest())
            );
        }

        Ok(receipt)
    }