Skip to content

Commit

Permalink
Replace remaining or_intros with weakening
Browse files Browse the repository at this point in the history
  • Loading branch information
bpandreotti committed Aug 13, 2024
1 parent e517c02 commit f3bb55d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions carcara/src/elaborator/reordering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ type RecomputationFunc = fn(&StepNode) -> Vec<Rc<Term>>;

fn get_recomputation_func(rule: &str) -> Option<RecomputationFunc> {
Some(match rule {
"or_intro" => recompute_or_intro,
"weakening" => recompute_weakening,
"contraction" => recompute_contraction,
"resolution" | "th_resolution" | "strict_resolution" => recompute_resolution,
_ => return None,
})
}

fn recompute_or_intro(step: &StepNode) -> Vec<Rc<Term>> {
fn recompute_weakening(step: &StepNode) -> Vec<Rc<Term>> {
let mut new = step.clause.clone();
let premise = step.premises[0].clause();
new[..premise.len()].clone_from_slice(premise);
Expand Down
2 changes: 1 addition & 1 deletion carcara/src/elaborator/transitivity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub fn eq_transitive(
id: ids.next_id(),
depth: step.depth,
clause,
rule: "or_intro".to_owned(),
rule: "weakening".to_owned(),
premises: vec![latest_step],
args: Vec::new(),
discharge: Vec::new(),
Expand Down
6 changes: 3 additions & 3 deletions carcara/src/elaborator/uncrowding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ pub fn uncrowd_resolution(
let mut final_step = premises[previous_cut].node.as_step().unwrap().clone();

if final_step.clause.len() != step.clause.len() {
let clause = get_or_intro_clause(&final_step.clause, &step.clause);
let clause = get_weakening_clause(&final_step.clause, &step.clause);
final_step = StepNode {
id: ids.next_id(),
depth: step.depth,
clause,
rule: "or_intro".to_owned(),
rule: "weakening".to_owned(),
premises: vec![Rc::new(ProofNode::Step(final_step))],
..Default::default()
}
Expand Down Expand Up @@ -190,7 +190,7 @@ fn add_partial_resolution_step<'a>(
}
}

fn get_or_intro_clause(current: &[Rc<Term>], target: &[Rc<Term>]) -> Vec<Rc<Term>> {
fn get_weakening_clause(current: &[Rc<Term>], target: &[Rc<Term>]) -> Vec<Rc<Term>> {
let mut missing: HashMap<&Rc<Term>, usize> = HashMap::new();
for term in target {
*missing.entry(term).or_default() += 1;
Expand Down

0 comments on commit f3bb55d

Please sign in to comment.