#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ConstructiveProp {
True,
False,
And(Box<ConstructiveProp>, Box<ConstructiveProp>),
Or(Box<ConstructiveProp>, Box<ConstructiveProp>),
Not(Box<ConstructiveProp>),
Implies(Box<ConstructiveProp>, Box<ConstructiveProp>),
Exists(String, Box<ConstructiveProp>),
Forall(String, Box<ConstructiveProp>),
Atom(String, Vec<String>),
Eq(String, String),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ProofTerm {
Unit,
Pair(Box<ProofTerm>, Box<ProofTerm>),
Fst(Box<ProofTerm>),
Snd(Box<ProofTerm>),
Inl(Box<ProofTerm>),
Inr(Box<ProofTerm>),
Lambda(String, Box<ProofTerm>),
App(Box<ProofTerm>, Box<ProofTerm>),
Pack(String, Box<ProofTerm>),
Unpack {
witness: String,
proof_var: String,
packed: Box<ProofTerm>,
body: Box<ProofTerm>,
},
Absurd(Box<ProofTerm>),
Var(String),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ExtractedProgram {
pub name: String,
pub input_type: String,
pub output_type: String,
pub body: ProofTerm,
pub original_prop: ConstructiveProp,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ProgramSpec {
pub pre: ConstructiveProp,
pub post: ConstructiveProp,
pub name: String,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ExtractionResult {
Success(ExtractedProgram),
NonConstructive(String),
Failure(String),
}