-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6eeef66
commit dc38e87
Showing
3 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import ProofLibrary.AlternativeMatches.Basic | ||
import ProofLibrary.AlternativeMatches.HomomorphismExtension | ||
import ProofLibrary.Models.Cores | ||
|
||
variable {sig : Signature} [DecidableEq sig.P] [DecidableEq sig.C] [DecidableEq sig.V] | ||
variable {obs : ObsoletenessCondition sig} {kb : KnowledgeBase sig} | ||
|
||
namespace GroundTermMapping | ||
|
||
def is_alt_match_at_chase_step (h : GroundTermMapping sig) (cb : ChaseBranch obs kb) (i : Nat) : Prop := | ||
match eq : cb.branch.infinite_list (i + 1) with | ||
| .none => True | ||
| .some node => | ||
have := eq ▸ cb.origin_is_some i | ||
let origin := node.origin.get (by rw [Option.is_none_or] at this; exact this) | ||
h.isAlternativeMatch origin.fst.val origin.snd cb.result | ||
|
||
end GroundTermMapping | ||
|
||
namespace ChaseBranch | ||
|
||
def has_alt_match_at_step (cb : ChaseBranch obs kb) (i : Nat) : Prop := ∃ (h : GroundTermMapping sig), h.is_alt_match_at_chase_step cb i | ||
|
||
def has_alt_match (cb : ChaseBranch obs kb) : Prop := ∃ i, cb.has_alt_match_at_step i | ||
|
||
theorem result_isWeakCore_of_noAltMatch (cb : ChaseBranch obs kb) : ¬ cb.has_alt_match -> cb.result.isWeakCore := by | ||
sorry | ||
|
||
theorem result_isStrongCore_of_noAltMatch (cb : ChaseBranch obs kb) : ¬ cb.has_alt_match -> cb.result.isStrongCore := by | ||
unfold FactSet.isStrongCore | ||
intro noAltMatch h endo | ||
have ⟨strong, inj⟩ := cb.result_isWeakCore_of_noAltMatch noAltMatch h endo | ||
constructor | ||
. exact strong | ||
constructor | ||
. exact inj | ||
. apply Classical.byContradiction | ||
intro contra | ||
unfold Function.surjective_for_domain_and_image_set at contra | ||
simp at contra | ||
rcases contra with ⟨t, t_mem, contra⟩ | ||
|
||
let term_property (ts : Set (GroundTerm sig)) (t : GroundTerm sig) := ∃ j, ∀ t', t' ∈ ts -> ¬ (h.repeat_hom j) t' = t | ||
let step_property (i : Nat) := (cb.branch.infinite_list i).is_none_or (fun node => ∃ t, t ∈ node.fact.val.terms ∧ term_property node.fact.val.terms t) | ||
|
||
-- there exists a smallest chase step with such a term (not necessarily t) | ||
have : ∃ i, step_property i ∧ ∀ (j : Fin i), ¬ step_property j.val := by | ||
sorry | ||
rcases this with ⟨step, prop_step, smallest⟩ | ||
|
||
let stronger_term_property (ts : Set (GroundTerm sig)) (t : GroundTerm sig) := ∃ j, ∀ k, j ≤ k -> ∀ t', t' ∈ ts -> ¬ (h.repeat_hom k) t' = t | ||
|
||
have term_prop_implies_stronger (ts : Set (GroundTerm sig)) (t : GroundTerm sig) : term_property ts t -> stronger_term_property ts t := by | ||
unfold term_property | ||
unfold stronger_term_property | ||
intro term_prop | ||
/- intro s s_mem -/ | ||
/- specialize term_prop s s_mem -/ | ||
rcases term_prop with ⟨j, term_prop⟩ | ||
exists j | ||
intro k le | ||
rcases Nat.exists_eq_add_of_le le with ⟨diff, diff_eq⟩ | ||
induction diff generalizing k with | ||
| zero => sorry | ||
| succ diff ih => | ||
unfold GroundTermMapping.repeat_hom | ||
rw [diff_eq] | ||
simp | ||
intro s s_mem contra | ||
apply ih (j + diff) _ rfl (h s) | ||
. sorry | ||
. rw [h.repeat_hom_swap] at contra | ||
exact contra | ||
. simp | ||
|
||
apply noAltMatch | ||
exists step | ||
|
||
sorry | ||
|
||
end ChaseBranch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters