Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching-related equivalences #446

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Matching-related equivalences #446

wants to merge 12 commits into from

Conversation

Engreyight
Copy link
Collaborator

Equivalences relating to the matching algorithm.

@Engreyight Engreyight changed the title Matchingequivs Matching-related equivalences Dec 11, 2024
(* Proof for Γ ⊢ (θ -> (l = ti)) <-> (l /\ θ = ti /\ θ) *)

(* Helper lemma for predicate patterns. *)
Lemma predicate_iff φ₁ φ₂ :
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to FOEqualityProofSystem.v.

(* Proof for Γ ⊢ (∃. (l = ti)) <-> (ti ∈ ∃. l) *)

(* Single exists version. *)
Goal forall l ti,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give this lemma a name, please.


(* Definitions for multiple exists version. *)

Fixpoint functional_when_applied (n : nat) (φ : Pattern) :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe these definitions in comments a bit. For example, the result of many_ex n \phi is $\exists x_1, \exists x_2, ..., \exists x_n, \varphi$

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional remarks:

  • This function is essentially opening n times, and checking whether the result is functional.
  • many_ex is essentially quantifying n times.
  • Check whether these functions are just instances of Coq's/stdpp's n-times application (such as PeanoNat.Nat.iter).
  • functional_when_applied should be renamed to include opening instead of "apply" (since the pattern is opened and not applied).

mlReflexivity.
Defined.

Lemma fwa_drop_one : forall n m l y,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name is misleading, it should include "opening".

apply le_lt_eq_dec in Hle as [Hle%Arith_prebase.lt_n_Sm_le | ->].

(* Multiple exists version. *)
Goal forall l ti n m,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give this theorem a name, please.

all: try solve [(eapply extract_wfp + eapply extract_wfq); eauto]; mlApplyMeta IHn in "0"; mlAssumption.
Qed.

(* Proof for Γ ⊢ (⌈l /\ ti⌉) -> (ti ∈ ∃. l) *)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These comments would be nice for the previous Goals too.


(* Definitions for multiple exists version. *)

Fixpoint fully_apply (n : nat) (p : Pattern) :=
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename it to many_open to match many_ex. Can this also be phrased with iter?

Defined.

(* Multiple exists version. *)
Goal forall n m l ti,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give this lemma a name, please.

set_solver.
Defined.

Goal forall (sy : symbols) (a : evar), exists ti s M, forall ρ,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain this proposition in a comment, and if it is purely unification-specific, move it into Unification.v.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants