Papers
Topics
Authors
Recent
Search
2000 character limit reached

Compile–Trace–Filter Framework

Updated 21 January 2026
  • CTF is a framework that defines compiler correctness by relating source and target traces through configurable trace relations and filters.
  • It addresses semantic mismatches such as undefined behavior, resource exhaustion, and side channels with precise filtering mechanisms.
  • CTF enables systematic property preservation between source and target domains, thus supporting secure compilation through trace mapping.

The Compile–Trace–Filter (CTF) framework provides a generalized and parametric approach to compiler correctness and secure compilation for settings in which the set of traces produced by the source language and the target language differ in structure or granularity. Instead of requiring trace equality, as in classical trace-inclusion definitions, CTF makes explicit how a compiler can remain correct by relating source and target traces through an arbitrary trace relation, and by using an associated filter to connect target traces back to source trace semantics. This methodology accommodates a range of semantic mismatches, including undefined behavior, resource exhaustion, differing trace alphabets, and (computational) side-channels (Abate et al., 2019).

1. Core Components of the CTF Framework

CTF analysis is anchored in the following core elements:

  • Source and Target Traces: A source language is associated with a set of traces TraceS\mathit{Trace}_S, and the compiled target language with traces TraceT\mathit{Trace}_T.
  • Trace Relation RR: A relation R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T links possible source executions with corresponding target executions, potentially permitting translations that introduce or filter events (e.g., markers for undefined behavior).
  • Compiler and Semantics: The compiler ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T is equipped with operational semantics for both languages, ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s for the source and ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t for the target, where s∈TraceSs \in \mathit{Trace}_S, t∈TraceTt \in \mathit{Trace}_T.
  • Filter FF: For each target trace TraceT\mathit{Trace}_T0, the filter TraceT\mathit{Trace}_T1 returns all source traces TraceT\mathit{Trace}_T2 such that TraceT\mathit{Trace}_T3.

The CTF pipeline is therefore: TraceT\mathit{Trace}_T4.

2. Generalized Compiler Correctness via Trace Relations

Classical compiler correctness is often defined by trace inclusion: every trace of the compiled program must be a trace of the original program, which presumes that the trace sets of source and target are identical. The CTF framework generalizes this through:

Definition 1 (Trace-Relating Filter Relation):

A CTF relation is any TraceT\mathit{Trace}_T5.

Definition 2 (CTF-Correctness):

The compiler TraceT\mathit{Trace}_T6 is TraceT\mathit{Trace}_T7-correct if for all source programs TraceT\mathit{Trace}_T8 and for every TraceT\mathit{Trace}_T9,

RR0

This asserts that every target trace for a compiled program corresponds, under RR1, to a source trace for the original program.

3. Property Preservation and Transformation

CTF theory provides systematic tools for lifting properties between source and target trace domains using RR2:

  • Existential Image RR3:

Given a property RR4, the corresponding set of target traces is

RR5

This captures the set of traces that "come from" some source trace satisfying RR6.

  • Universal Image RR7:

For a target property RR8,

RR9

This is the set of source traces all whose R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T0-related target traces lie in R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T1.

These two maps are adjoint: R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T2, forming a Galois connection with respect to set inclusion.

The filter R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T3 can be viewed as the pointwise preimage of R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T4.

4. Handling Semantic Mismatches via CTF

CTF is designed to account explicitly for differences between trace alphabets. For example:

  • Undefined Behavior (UB): Let R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T5 be a special undefined-behavior event. Define

R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T6

The filter R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T7 removes everything after the first R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T8 event in the source, so any arbitrary continuation after UB in the target is "dropped."

  • Resource Exhaustion: For R⊆TraceS×TraceTR \subseteq \mathit{Trace}_S \times \mathit{Trace}_T9,

↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T0

Here, ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T1 returns the maximal source prefix corresponding to an out-of-memory target trace.

  • Side Channels: If ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T2, ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T3 can specify ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T4, and ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T5 simply projects away the timing information ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T6.

CTF thereby provides a rigorous mechanism for formally relating and filtering semantic artifacts that arise during compilation.

5. Concrete Example: Filtering Side-Channel Metadata

Consider a simple source language with input-output semantics. Suppose a source program ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T7 produces traces ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T8 and ↓:ProgramS→ProgramT\downarrow : \mathit{Program}_S \to \mathit{Program}_T9.

Suppose the compiler emits an extra secret-tag event ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s0 before each output:

  • ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s1
  • ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s2

Define ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s3 such that ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s4 iff ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s5 with all ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s6 events deleted equals ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s7. The filter ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s8 projects away the secret-ok tags, enabling property transfer even in the presence of such metadata.

6. Central Theorems and Robustness

The main theorems underpinning CTF establish the equivalence between ⟨P⟩S⇓s\langle P \rangle_S \Downarrow s9-correctness and property preservation:

Theorem 4 (CTF-Correctness ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t0 Property Preservation):

Let ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t1 with Galois connection ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t2. The following are equivalent:

  • a) CTF-correctness relative to ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t3
  • b) Source-to-target trace-property preservation (⟨P⟩T⇓t\langle P \rangle_T \Downarrow t4)
  • c) Target-to-source trace-property reflection (⟨P⟩T⇓t\langle P \rangle_T \Downarrow t5)

Moreover, corollaries transfer safety properties through safety-closure and image operators. CTF robustly generalizes to secure compilation in the presence of adversarial linking contexts.

7. Algorithmic Realization of the CTF Filter

Given a relation on events ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t6, the filter ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t7 operates by searching for all source traces ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t8 such that, proceeding eventwise along a target trace ⟨P⟩T⇓t\langle P \rangle_T \Downarrow t9, the pair s∈TraceSs \in \mathit{Trace}_S0 for all s∈TraceSs \in \mathit{Trace}_S1. In many cases a deterministic event-filter s∈TraceSs \in \mathit{Trace}_S2 suffices, so that s∈TraceSs \in \mathit{Trace}_S3 computes the source projection by dropping any s∈TraceSs \in \mathit{Trace}_S4-event mapped to s∈TraceSs \in \mathit{Trace}_S5 and mapping the rest to the appropriate s∈TraceSs \in \mathit{Trace}_S6-event (Abate et al., 2019).

Summary Table: CTF Key Concepts

Component Role Example
Trace Relation s∈TraceSs \in \mathit{Trace}_S7 Relate source and target traces s∈TraceSs \in \mathit{Trace}_S8
Filter s∈TraceSs \in \mathit{Trace}_S9 Recovers source traces from a target trace Removes UB suffixes, OOM markers, or secret tags
Existential Image t∈TraceTt \in \mathit{Trace}_T0 Lifts source properties to target trace properties Allows secret tags without breaking output property
Universal Image t∈TraceTt \in \mathit{Trace}_T1 Reflects target properties to source preconditions Dually computes sufficient source properties

The CTF framework, as introduced by Abate et al., systematizes reasoning about trace-relating compiler correctness, clarifies property preservation under trace transformations, and provides robust abstractions for secure compilation in the presence of observable semantic mismatches (Abate et al., 2019).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Compile-Trace-Filter (CTF) Framework.