Adelfa logoAdelfa
Schema Subsumption

Equality in the Untyped Lambda Calculus

ORBI benchmark

This page contains a solution to a problem set out in the paper "The Next 700 Challenge Problems for Reasoning with Higher-Order Abstract Syntax Representations" by Felty et al.[1]

This benchmark provides a specification for the untyped λ\lambda-calculus with two forms of equality: algorithmic and declarative.

The full solutions are provided in equal-untyped.lf and equal-untyped.ath.

Specification

Adelfa logo
equal-untyped.lf
tm: type.
lam: {M: tm -> tm} tm.
app: {M1:tm}{M2:tm} tm.

aeq: tm -> tm -> type.
deq: tm -> tm -> type.

ae_a : {M1: tm}{M2: tm}{N1:tm}{N2:tm}
       {D1:aeq M1 N1}{D2:aeq M2 N2}
       aeq (app M1 M2) (app N1 N2).
ae_l : {M: tm -> tm}{N: tm -> tm}
       {D: {z:tm} aeq z z -> aeq (M z) (N z)}
       aeq (lam ([x] M x)) (lam ([x] N x)).

de_a : {M1:tm}{M2:tm}{N1:tm}{N2:tm}
       {D1: deq M1 N1}{D2: deq M2 N2}
       deq (app M1 M2) (app N1 N2).
de_l : {M: tm -> tm}{N: tm -> tm}
       {D: {z:tm} deq z z -> deq (M z) (N z)}
       deq (lam ([x] M x)) (lam ([x] N x)).
de_s : {M:tm}{N:tm}
       {D: deq M N}
       deq N M.
de_t : {M1:tm}{M2:tm}{M3:tm}
       {D1: deq M1 M2}
       {D2: deq M2 M3}
       deq M1 M3.
de_r : {M:tm} deq M M.

The benchmark also defines two different context schemas to be used:

Adelfa logo
equal-untyped.ath
Schema xaG := (x: tm,a: aeq x x).
Schema daG := (x:tm, a:aeq x x, u:deq x x).

Properties of Algorithmic Equality

One wishes to prove three properties about algorithmic equality in isolation:

  1. Reflexivity
    Adelfa logo
    equal-untyped.ath
    
      
    %app
    
    
    
    
    %lam
    
    
    
    
    
    %var
     
  2. Symmetry
    Adelfa logo
    equal-untyped.ath
    
      {G |- Q : aeq T1 T2} => exists D, {G |- D : aeq T2 T1}.
     
    %lam
    
    
    
    
    %app
    
    
    
    
    %var
     
  3. Transitivity
    Adelfa logo
    equal-untyped.ath
    
      {G |- D1: aeq M1 M2} => {G |- D2: aeq M2 M3} => exists D3, {G |- D3: aeq M1 M3}.
     
    
    %lam
    
    
    
     
    %app
    
    
    
     
    %var
    
     

Completeness via Schema Subsumption

Now, one wishes to show that algorithmic equality is complete with respect to declarative equality. In other words "If two terms are declaratively equal, then they are algorithmically equal." This would entail analyzing the cases in which the terms under consideration are equal by reflexivity, symmetry, and transitivity. Then, one must prove that these properties hold for algorithmic equality. However, we have already shown these properties to hold in our above theorems.

The wrinkle is that these properties were proven with a context variable circumscribed by xaG which has the shape (x:tm, a:aeq x x), and in order to reason about declarative equality we must have the context variable circumscribed by daG which has the shape (x:tm, a:aeq x x, u:deq x x). Schema subsumption will allow Adelfa to realize that this extended shape's entry u: deq x x cannot impact the theorems reflG, tranG, or symG, and we can use them directly in daG.

Adelfa logo
equal-untyped.ath

  {G |- D1: deq M N} => exists D2, {G |- D2 : aeq M N}.

    


  

  





 
 
 
 

References

  1. [1] Felty, A.P., Momigliano, A., Pientka, B.: The Next 700 Challenge Problems for Reasoning with Higher-Order Abstract Syntax Representations. Journal of Automated Reasoning. 55, 307–372 (2015). https://doi.org/10.1007/s10817-015-9327-3⁠.