Skip to content

unif_rule is unable to bypass the priority of injectivity unification vs rewriting reduction? BUG? #1159

@1337777

Description

@1337777

unif_rule is unable to bypass the priority of injectivity unification vs rewriting reduction? BUG?

MINIMAL EXAMPLE (more minimal is possible, without the type dependency)
And why it shows up / matters is contained in the pull request Deducteam/lambdapi-stdlib#25

constant symbol cat : TYPE;
constant symbol func : Π (A B : cat), TYPE;
constant symbol Id_func : Π [A : cat], func A A;

constant symbol catd: Π (X : cat), TYPE;
constant symbol Terminal_catd : Π (A : cat), catd A;

injective symbol Context_cat : Π [X : cat], catd X → cat;
rule Context_cat (Terminal_catd $A) ↪ $A;

// THE PROBLEM: unif_rule UNABLE TO BYPASS THE PRIORITY OF INJECTIVITY UNIFICATION VS REWRITING REDUCTION
// Context_cat $A ≡? (Context_cat (Terminal_catd (Context_cat $A)))

// In the case that injectivity unification happens first:
// $A ≡? (Terminal_catd (Context_cat $A))  which then fails
// In the case that rewriting reduction happens first:
// Context_cat $A ≡? (Context_cat $A)  which then succeds

// LAMBDAPI BUG? this unification rule doesnt work... it seems that it is not really registered
// so finding an alternative explicit coercion rule_Context_cat_Terminal_catd_func
unif_rule Context_cat $B ≡ (Context_cat (Terminal_catd (Context_cat $X))) ↪ [ $B ≡ $X];

symbol rule_Context_cat_Terminal_catd_func [X: cat] (A: catd X) 
: func (Context_cat (Terminal_catd (Context_cat A))) (Context_cat A)
≔ begin assume X A; 
// KO THIS FAILS WITHOUT simplify 
try refine Id_func;
// OK
simplify; refine Id_func; 
end;

// OK
// λ X A, Id_func
compute λ [X: cat] (A: catd X), rule_Context_cat_Terminal_catd_func A;

// KO
// [Terminal_catd (Context_cat A)] and [A] are not unifiable.
// Those two types are not unifiable.
assert [X: cat] (A: catd X) ⊢ rule_Context_cat_Terminal_catd_func A ≡ Id_func ;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions