Extensibella Example: unsat_proofs:frat

Language Specification

File: syntax.sos

[Reduce File] [Raw File]
Module unsat_proofs:frat

Builds on unsat_proofs:lrat


/*original clauses (o lines) at the start of the proof
  Note that, unlike regular FRAT, we require all o lines to be at the
  start (in full FRAT, o lines may mix with a and d lines).*/
fratProof ::= addOriginal(int, clause, fratProof)
            | endOriginal(proof)

Projection fratProof :





proof ::= ...
        /*final clauses (f lines) at the end of the proof, with and
          without hints*/
        | endFrat(int, finalClauses)
        | endFratPrf(int, [int], finalClauses)
        /*add a middle clause without a hint*/
        | addProofless(int, clause, proof)
        /*move a known clause from one ID to another
          (relocateClause(From, To, Rest)*/
        | relocateClause(int, int, proof)
        /*delete the specific clause with its ID*/
        | deleteFrat(int, clause, proof)
        /*text comment in the proof (c lines)*/
        | commentProof(string, proof)


rupProof Known emptyClause Prf
------------------------------------------------------ [Proj-EndFrat]
Known |{proof}- endFrat(ID, FC) ~~> emptyLrat(ID, Prf)


------------------------------------------- [Proj-EndFratPrf]
Known |{proof}- endFratPrf(ID, Prf, FC) ~~>
                emptyLrat(ID, Prf)


rupProof Known C Prf
---------------------------------------------- [Proj-AddProofless]
Known |{proof}- addProofless(ID, C, Rest) ~~>
                addLrupProof(ID, C, Prf, Rest)


/*
  Adds clause again, but with the new ID, then deletes the original
*/
T != F
mem (F, C) Known
---------------------------------------------- [Proj-RelocateProof]
Known |{proof}- relocateClause(F, T, Rest) ~~>
                addLrupProof(T, C, [F],
                     deleteLratProof(F, Rest))


----------------------------------------------------- [Proj-RelocateProofSame]
Known |{proof}- relocateClause(ID, ID, Rest) ~~> Rest


--------------------------------------- [Proj-DeleteFrat]
K |{proof}- deleteFrat(ID, C, Rest) ~~>
            deleteLratProof(ID, Rest)


------------------------------------------------ [Proj-CommentProof]
K |{proof}- commentProof(Comment, Rest) ~~> Rest





finalClauses ::= addFClause(int, clause, finalClauses)
               | endFClause

Projection finalClauses :





/*Replace the first ID with the second one, yielding the last proof
  Has known clauses for translation*/
Judgment replaceID : [(int, clause)] int int proof* proof
/*Replace the first ID with the second one in the proof*/
Fixed Judgment replaceIDProof : int int [int] [int]


replaceIDProof From To Prf NewPrf
----------------------------------------------- [RID-EmptyLrat]
{replaceID Known From To emptyLrat(ID, Prf)
                         emptyLrat(ID, NewPrf)}


replaceIDProof From To Prf NewPrf
replaceID Known From To Rest NewRest
------------------------------------------------------- [RID-AddLrup]
{replaceID Known From To addLrupProof(ID, C, Prf, Rest)
              addLrupProof(ID, C, NewPrf, NewRest)}


ID != From
replaceID Known From To Rest NewRest
-------------------------------------------------- [RID-DeleteOther]
{replaceID Known From To deleteLratProof(ID, Rest)
              deleteLratProof(ID, NewRest)}


replaceID Known From To Rest NewRest
---------------------------------------------------- [RID-DeleteFrom]
{replaceID Known From To deleteLratProof(From, Rest)
              deleteLratProof(To, NewRest)}


Known |{proof}- P ~~> PT
replaceID Known From To PT NewP
------------------------------- [RID-Default]*
replaceID Known From To P NewP



============================ [RIDP-Nil]
replaceIDProof From To [] []


replaceIDProof From To Rest NewRest
============================================= [RIDP-ConsReplace]
replaceIDProof From To From::Rest To::NewRest


From != ID
replaceIDProof From To Rest NewRest
=========================================== [RIDP-ConsDiff]
replaceIDProof From To ID::Rest ID::NewRest

File: check.sos

[Reduce File] [Raw File]
Module unsat_proofs:frat


Fixed Judgment fratProveFormula : formula fratProof

formulaToKnown 1 F KnownClauses
checkFratProof KnownClauses [] Prf
================================== [FratProveFormula]
fratProveFormula F Prf





    /*clauses in the formula, known clauses, o lines + regular proof*/
Judgment checkFratProof : [(int, clause)] [(int, clause)] fratProof*

select (ID, C) CRest Clauses /*pull out this clause*/
checkFratProof CRest (ID, C)::Known Rest
----------------------------------------------------- [CFP-AddOriginal]
checkFratProof Clauses Known addOriginal(ID, C, Rest)


checkProof Known Prf /*transition to checking the regular proof*/
--------------------------------------------- [CFP-EndOriginal]
checkFratProof Clauses Known endOriginal(Prf)





/*Check Proof*/

remove_all Known ID KRest
rupProof Known emptyClause Prf /*creates proof itself*/
checkFinalClauses (ID, emptyClause)::KRest Final
------------------------------------------------ [CP-EndFrat]
checkProof Known endFrat(ID, Final)


remove_all Known ID KRest
rupProof Known emptyClause Prf
checkFinalClauses (ID, emptyClause)::KRest Final
------------------------------------------------ [CP-EndFratPrf]
checkProof Known endFratPrf(ID, Prf, Final)


remove_all Known ID KRest
rupProof Known C Prf
checkProof (ID, C)::KRest Rest
------------------------------------------ [CP-AddProofless]
checkProof Known addProofless(ID, C, Rest)


To != From
remove_all Known To KRest
select (From, C) KRest2 KRest
checkProof (To, C)::KRest2 Rest
----------------------------------------------- [CP-RelocateClause]
checkProof Known relocateClause(From, To, Rest)


/*need a second rule to show Ext_Ind*/
mem (ID, C) Known
checkProof Known Rest
--------------------------------------------- [CP-RelocateClauseSame]
checkProof Known relocateClause(ID, ID, Rest)


select (ID, C) KRest Known
checkProof KRest Rest
---------------------------------------- [CP-DeleteFrat]
checkProof Known deleteFrat(ID, C, Rest)


checkProof Known Rest
-------------------------------------------- [CP-CommentProof]
checkProof Known commentProof(Comment, Rest)





Judgment checkFinalClauses : [(int, clause)] finalClauses*

select (ID, C) KRest Known
checkFinalClauses KRest Rest
----------------------------------------------- [CFC-AddFClause]
checkFinalClauses Known addFClause(ID, C, Rest)


------------------------------- [CFC-EndOriginal]
checkFinalClauses [] endFClause

File: elaboration.sos

[Reduce File] [Raw File]
Module unsat_proofs:frat

/*
  Note on elaboration:
  The second pass in FRAT elaboration is done after we have produced
  only LRAT clauses.  This part is not extensibly interesting because
  of this, so we do not define it here.
*/

/*
  In elaboration, we work backward and don't initially know if a
  clause will be necessary, so we mark it as unknown.  Once we find a
  use of it, we mark it as needed.  If it is still marked as unknown
  once we reach where it was added, we know it is not needed and can
  drop it.
*/
clauseUsedness ::= needed | unknown
Projection clauseUsedness :


Fixed Judgment fullElaborate : formula proof proof

formulaToKnown 1 F Known
elaborate Known P Needed E
========================== [FullElaborate]
fullElaborate F P E

Fixed Judgment fullElaborateFrat : formula fratProof fratProof

formulaToKnown 1 F Known
elaborateFratProof Known [] P Needed E
====================================== [FullElaborateFrat]
fullElaborateFrat F P E


Judgment elaborateFratProof : {
             [(int, clause)] [(int, clause)] fratProof*
             [(int, clauseUsedness)] fratProof}


select (ID, C) CRest Clauses /*pull out this clause*/
elaborateFratProof CRest (ID, C)::Known Rest Needed E
select (ID, needed) NRest Needed
----------------------------------------------------- [EFP-AddNeeded]
{elaborateFratProof Clauses Known
                    addOriginal(ID, C, Rest) NRest
                    addOriginal(ID, C, E)}


select (ID, C) CRest Clauses /*pull out this clause*/
elaborateFratProof CRest (ID, C)::Known Rest Needed E
select (ID, unknown) NRest Needed
----------------------------------------------------- [EFP-AddUnknown]
{elaborateFratProof Clauses Known
                    addOriginal(ID, C, Rest) NRest E}


elaborate Known P Needed E
------------------------------------------------------- [EFP-End]
{elaborateFratProof Clauses Known endOriginal(P) Needed
                    endOriginal(E)}


                /*clauses coming down, original proof, clauses needed,
                  output proof*/
Judgment elaborate : {[(int, clause)] proof* [(int, clauseUsedness)]
                      proof}


endKnownClauses FC Needed
select (ID, needed) NRest Needed
rupProof Known emptyClause Prf
makeUsed NRest Prf Updated
---------------------------------------- [Ela-EndFrat]
{elaborate Known endFrat(ID, FC) Updated
           emptyLrat(ID, Prf)}


endKnownClauses FC Needed
select (ID, needed) NRest Needed
makeUsed NRest Prf Updated
------------------------------------------------ [Ela-EndFratPrf]
{elaborate Known endFratPrf(ID, Prf, FC) Updated
             emptyLrat(ID, Prf)}


/*Note we do not have rules for proof endings without the set of final
  clauses.  This is because we need the final clauses for the
  elaboration step to know the remaining clauses.*/


select (ID, C) KRest Known
elaborate KRest Rest Needed ERest
----------------------------------------- [Ela-DeleteFrat]
{elaborate Known deleteFrat(ID, C, Rest)
             (ID, unknown)::Needed ERest}
/*Add as unknown because this is the first time we've seen it, going
  thourgh the proof backward, so we don't know if it is used*/


select (ID, C) KRest Known
elaborate KRest Rest Needed ERest
------------------------------------------ [Ela-DeleteLratProof]
{elaborate Known deleteLratProof(ID, Rest)
           (ID, unknown)::Needed ERest}


remove_all Known ID KRest
elaborate (ID, C)::KRest Rest Needed ERest
select (ID, needed) NRest Needed
makeUsed NRest Prf Updated
--------------------------------------------- [Ela-AddLrupProofNeeded]
{elaborate Known
     addLrupProof(ID, C, Prf, Rest)
     Updated addLrupProof(ID, C, Prf, ERest)}


remove_all Known ID KRest
elaborate (ID, C)::KRest Rest Needed ERest
select (ID, unknown) NRest Needed
------------------------------------------ [Ela-AddLrupProofUnknown]
{elaborate Known
     addLrupProof(ID, C, Prf, Rest)
     NRest ERest}


remove_all Known ID KRest
elaborate (ID, C)::KRest Rest Needed ERest
select (ID, needed) NRest Needed
rupProof Known C Prf
makeUsed NRest Prf Updated
-------------------------------------------- [Ela-AddProoflessNeeded]
{elaborate Known addProofless(ID, C, Rest)
    Updated addLrupProof(ID, C, Prf, ERest)}


remove_all Known ID KRest
elaborate (ID, C)::KRest Rest Needed ERest
select (ID, unknown) NRest Needed
------------------------------------------ [Ela-AddProoflessUnknown]
{elaborate Known addProofless(ID, C, Rest)
           NRest ERest}


/*remove_all then select inherently gives To != From*/
remove_all Known To KRest
select (From, C) KRest2 KRest
{elaborate (To, C)::KRest2 Rest
           Needed ERest}
select (To, needed) NRest Needed
------------------------------------ [Ela-RelocateNeeded-Diff]
{elaborate Known
    relocateClause(From, To, Rest)
    (From, needed)::NRest
    relocateClause(From, To, ERest)}


elaborate Known Rest Needed ERest
--------------------------------- [Ela-RelocateNeeded-Same]
{elaborate Known
    relocateClause(ID, ID, Rest)
    Needed ERest}


remove_all Known To KRest
select (From, C) KRest2 KRest
elaborate (To, C)::KRest2 Rest Needed ERest
select (To, unknown) NRest Needed
----------------------------------------------- [Ela-RelocateUnknown]
{elaborate Known relocateClause(From, To, Rest)
           (From, unknown)::NRest ERest}


elaborate Known Rest Needed ERest
-------------------------------------------------------- [Ela-Comment]
elaborate Known commentProof(Comment, Rest) Needed ERest


Known |{proof}- P ~~> PT
elaborate Known PT Needed EP
---------------------------- [Ela-Default]*
elaborate Known P Needed EP





/*produce the set of clauses known at the end of the proof*/
Judgment endKnownClauses : finalClauses* [(int, clauseUsedness)]


----------------------------- [EKC-End]
endKnownClauses endFClause []


isEmpty C
endKnownClauses Rest KRest
---------------------------------------- [EKC-AddEmpty]
{endKnownClauses addFClause(ID, C, Rest)
                 (ID, needed)::KRest}


!isEmpty C
endKnownClauses Rest KRest
----------------------------------------- [EKC-AddNonEmpty]
{endKnownClauses addFClause(ID, C, Rest)
                 (ID, unknown)::KRest}





/*
  This relation permits us to have empty-ish clause constructors from
  other extensions that still work here
*/
Judgment isEmpty : clause*

------------------- [IsEmpty-EmptyClause]
isEmpty emptyClause


|{clause}- C ~~> CT
isEmpty CT
------------------- [IsEmpty-Default]*
isEmpty C





/*Mark everything in the proof as needed
  {original known clauses, proof, updated clauses}*/
Fixed Judgment makeUsed : {[(int, clauseUsedness)] [int]
                           [(int, clauseUsedness)]}

======================= [MU-Nil]
makeUsed Known [] Known


select (ID, needed) KRest Known
makeUsed KRest Rest KOut
========================================== [MU-ConsNeeded]
makeUsed Known ID::Rest (ID, needed)::KOut


select (ID, unknown) KRest Known
makeUsed KRest Rest KOut
========================================== [MU-ConsUnknown]
makeUsed Known ID::Rest (ID, needed)::KOut


/*Add the delete clauses to the given proof
 {known clauses, clause ID's to delete, original proof, output proof}*/
Fixed Judgment addDeletes : [int] proof proof

================= [AD-Nil]
addDeletes [] P P


addDeletes Rest P PRest
================================================ [AD-Cons]
addDeletes ID::Rest P deleteLratProof(ID, PRest)

Reasoning

[Show All Proofs] [Hide All Proofs] [Raw File]

Click on a command or tactic to see a detailed view of its use.

Module unsat_proofs:frat.


Prove_Constraint unsat_proofs:lrat:proj_lit_unique.
Prove_Constraint unsat_proofs:lrat:proj_lit_is.


Prove_Constraint unsat_proofs:lrat:proj_clause_unique.
Prove_Constraint unsat_proofs:lrat:proj_clause_is.


Prove_Constraint unsat_proofs:lrat:proj_formula_unique.
Prove_Constraint unsat_proofs:lrat:proj_formula_is.


Add_Proj_Rel unsat_proofs:lrat:is_clause.
Prove_Ext_Ind unsat_proofs:lrat:is_clause.

Add_Proj_Rel unsat_proofs:lrat:is_formula.
Prove_Ext_Ind unsat_proofs:lrat:is_formula.


Prove unsat_proofs:lrat:is_lit_pos_or_neg.

Prove unsat_proofs:lrat:is_clause_empty_or_not.
Prove unsat_proofs:lrat:is_clause_or_or_not.
Prove unsat_proofs:lrat:is_clause_eq_or_not.

Prove unsat_proofs:lrat:is_formula_empty_or_not.
Prove unsat_proofs:lrat:is_formula_and_or_not.
Prove unsat_proofs:lrat:is_formula_eq_or_not.

Extensible_Theorem
  is_finalClauses_addFClause_or_not : forall F,
    IsF : is_finalClauses F ->
    (exists ID C F', F = addFClause ID C F') \/
    ((exists ID C F', F = addFClause ID C F') -> false)
  on IsF. [Show Proof]

Extensible_Theorem
  is_finalClauses_endFClause_or_not : forall F,
    IsF : is_finalClauses F ->
    F = endFClause \/ (F = endFClause -> false)
  on IsF. [Show Proof]

Extensible_Theorem
  is_finalClauses_eq_or_not : forall F1 F2,
    IsF1 : is_finalClauses F1 ->
    IsF2 : is_finalClauses F2 ->
    F1 = F2 \/ (F1 = F2 -> false)
  on IsF1. [Show Proof]



Prove unsat_proofs:lrat:negate_lit_unique.
Prove unsat_proofs:lrat:negate_lit_reverse.
Prove unsat_proofs:lrat:negate_lit_not_same.
Prove unsat_proofs:lrat:negate_lit_is_lit.
Prove unsat_proofs:lrat:negate_lit_is_lit_back.
Prove unsat_proofs:lrat:negate_lit_exists.


Prove_Constraint unsat_proofs:lrat:sat_clause_ext_to_proj.
Prove_Constraint unsat_proofs:lrat:sat_clause_proj_to_ext.
Prove_Constraint unsat_proofs:lrat:unsat_clause_ext_to_proj.
Prove_Constraint unsat_proofs:lrat:unsat_clause_proj_to_ext.


Prove_Constraint unsat_proofs:lrat:sat_formula_ext_to_proj.
Prove_Constraint unsat_proofs:lrat:sat_formula_proj_to_ext.


Prove unsat_proofs:lrat:unsat_sat_clause.


Prove unsat_proofs:lrat:sat_clause_orderless.
Prove unsat_proofs:lrat:sat_formula_orderless.


Prove unsat_proofs:lrat:unsat_clause_orderless.


Prove unsat_proofs:lrat:unit_clause_is.
Prove unsat_proofs:lrat:unit_clause_unique.
Prove unsat_proofs:lrat:unit_clause_not_assigned.
Prove unsat_proofs:lrat:unit_clause_not_assigned_negate.
Prove unsat_proofs:lrat:unit_clause_expand.
Prove unsat_proofs:lrat:unit_clause_add.


Prove unsat_proofs:lrat:gatherLits_is.
Prove unsat_proofs:lrat:gatherLits_exists.
Prove unsat_proofs:lrat:gatherLits_permutation.

Prove_Constraint unsat_proofs:lrat:proj_gatherLits.
Prove_Constraint unsat_proofs:lrat:proj_gatherLits_permutation.

Prove unsat_proofs:lrat:gatherLits_sat.
Prove unsat_proofs:lrat:gatherLits_mem_sat.
Prove unsat_proofs:lrat:gatherLits_unsat.
Prove unsat_proofs:lrat:negate_lits_unsat.


Extensible_Theorem
  checkFinalClauses_orderless : forall K1 K2 FC,
    IsK1 : is_list (is_pair is_integer is_clause) K1 ->
    IsK2 : is_list (is_pair is_integer is_clause) K2 ->
    CFC : checkFinalClauses K1 FC ->
    Prm : permutation K1 K2 ->
    checkFinalClauses K2 FC
  on CFC. [Show Proof]



%Reasonable to require is for arguments to show is for projection,
%since we might use things from the arguments.
Prove_Constraint unsat_proofs:lrat:proj_proof_is. [Show Proof]



Prove_Constraint unsat_proofs:lrat:proj_proof_extend. [Show Proof]



Prove unsat_proofs:lrat:check_proof_correct. [Show Proof]



Prove unsat_proofs:lrat:checkProof_orderless. [Show Proof]



Theorem rupProof_self : forall Known ID C,
  is_clause C -> lookup Known ID C -> rupProof Known C [ID]. [Show Proof]



Theorem mem_lookup : forall K ID C,
  is_list (is_pair is_integer is_clause) K -> mem (ID, C) K ->
  exists C', lookup K ID C'. [Show Proof]



Add_Ext_Size unsat_proofs:lrat:checkProof.
Add_Proj_Rel unsat_proofs:lrat:checkProof.
Prove_Ext_Ind unsat_proofs:lrat:checkProof. [Show Proof]



Prove_Constraint unsat_proofs:lrat:proj_checkProof. [Show Proof]



Prove unsat_proofs:lrat:formulaToKnown_unique.
Prove unsat_proofs:lrat:formulaToKnown_all_greater.
Prove unsat_proofs:lrat:formulaToKnown_all_unique.
Prove unsat_proofs:lrat:formulaToKnown_sat_formula.
Prove unsat_proofs:lrat:formulaToKnown_is.


Extensible_Theorem
  checkFratProof_correct : forall FormulaClauses Known FP Sat,
    IsFP : is_fratProof FP ->
    IsSat : is_list is_lit Sat ->
    GA_Sat : good_assignment Sat ->
    GCL_K : good_clause_list Known ->
    GCL_FC : good_clause_list FormulaClauses ->
    IsKnown : is_list (is_pair is_integer is_clause) Known ->
    IsFC : is_list (is_pair is_integer is_clause) FormulaClauses ->
    NoMem : (forall ID CK CFC, mem (ID, CK) Known ->
               mem (ID, CFC) FormulaClauses -> false) ->
    %The unsat proof checks out
    CFP : checkFratProof FormulaClauses Known FP ->
    %and there is a satisfying assignment for the existing clauses---
    SatK : (forall CID C, lookup Known CID C -> sat_clause Sat C) ->
    SatFC : (forall CID C, lookup FormulaClauses CID C ->
                           sat_clause Sat C) ->
    %this is impossible
    false
  on CFP. [Show Proof]



Theorem fratProveFormula_correct : forall F FPrf Sat,
  is_formula F -> is_fratProof FPrf -> is_list is_lit Sat ->
  good_assignment Sat ->
  %proof checking out  and  formula satisfiable
  fratProveFormula F FPrf -> sat_formula Sat F ->
  %is impossible
  false. [Show Proof]




Theorem select_is_clauseUsedness : forall L X Rest,
  is_list (is_pair is_integer is_clauseUsedness) L ->
  select X Rest L ->
  is_list (is_pair is_integer is_clauseUsedness) Rest. [Show Proof]



Theorem select_is_clauseUsedness_item : forall L X Rest,
  is_list (is_pair is_integer is_clauseUsedness) L ->
  select X Rest L ->
  is_pair is_integer is_clauseUsedness X. [Show Proof]



Theorem makeUsed_is : forall L P U,
  is_list (is_pair is_integer is_clauseUsedness) L ->
  makeUsed L P U ->
  is_list (is_pair is_integer is_clauseUsedness) U. [Show Proof]



Theorem makeUsed_needed : forall L P U ID,
  makeUsed L P U -> mem ID P -> mem (ID, needed) U. [Show Proof]



Extensible_Theorem
   endKnownClauses_is : forall F K,
     IsF : is_finalClauses F ->
     EKC : endKnownClauses F K ->
     is_list (is_pair is_integer is_clauseUsedness) K
   on EKC. [Show Proof]



Extensible_Theorem
   elaboration_is_needed : forall Known P Needed E,
     IsKnown : is_list (is_pair is_integer is_clause) Known ->
     GCL : good_clause_list Known ->
     IsP : is_proof P ->
     Ela : elaborate Known P Needed E ->
     is_list (is_pair is_integer is_clauseUsedness) Needed
   on Ela. [Show Proof]



Extensible_Theorem
   elaboration_is : forall Known P Needed E,
     IsKnown : is_list (is_pair is_integer is_clause) Known ->
     GCL : good_clause_list Known ->
     IsP : is_proof P ->
     Ela : elaborate Known P Needed E ->
     is_proof E
   on Ela. [Show Proof]



%Get only the clauses we need out of a list
Define gatherNeeded : list (pair integer clause) ->
                      list (pair integer clauseUsedness) ->
                      list (pair integer clause) -> prop by
  gatherNeeded K [] [];
  gatherNeeded K ((ID, needed)::CURest) ((ID, C)::NRest) :=
    mem (ID, C) K /\ gatherNeeded K CURest NRest;
  gatherNeeded K ((ID, NotNeeded)::CURest) NRest :=
    gatherNeeded K CURest NRest /\ (NotNeeded = needed -> false).


Define good_used_list : list (pair integer clauseUsedness) -> prop by
  good_used_list CU :=
    forall ID U1 CURest U2,
       select (ID, U1) CURest CU -> mem (ID, U2) CURest -> false.


Theorem good_used_list_drop : forall L IDN,
  good_used_list ((IDN)::L) -> good_used_list L. [Show Proof]



Theorem good_used_list_select : forall L Rest ID U,
  good_used_list L -> select (ID, U) Rest L ->
  good_used_list Rest. [Show Proof]



Theorem makeUsed_member : forall Needed Prf Updated ID U,
  makeUsed Needed Prf Updated -> mem (ID, U) Updated ->
  exists U', mem (ID, U') Needed. [Show Proof]



Theorem makeUsed_good_used_list : forall Needed Prf Updated,
  good_used_list Needed -> makeUsed Needed Prf Updated ->
  good_used_list Updated. [Show Proof]



Theorem domain_is : forall L D,
  is_list (is_pair is_integer is_clause) L -> domain L D ->
  is_list is_integer D. [Show Proof]



Extensible_Theorem
  endKnownClauses_related : forall Known FC CU DK DCU,
    IsFC : is_finalClauses FC ->
    IsKnown : is_list (is_pair is_integer is_clause) Known ->
    CFC : checkFinalClauses Known FC ->
    EKC : endKnownClauses FC CU ->
    DmnCU : domain CU DCU ->
    DmnK : domain Known DK ->
    permutation DCU DK
  on EKC. [Show Proof]



Theorem mem_is_clauseUsedness : forall CU IDC,
  is_list (is_pair is_integer is_clauseUsedness) CU -> mem IDC CU ->
  exists ID C, IDC = (ID, C) /\ is_integer ID /\ is_clauseUsedness C. [Show Proof]



Theorem makeUsed_subset : forall CU Prf CU' ID,
  is_list (is_pair is_integer is_clauseUsedness) CU ->
  is_integer ID -> makeUsed CU Prf CU' -> mem (ID, needed) CU ->
  mem (ID, needed) CU'. [Show Proof]



Extensible_Theorem
  clauseUsedness_is_needed_or_not : forall CU,
    Is : is_clauseUsedness CU ->
    CU = needed \/ (CU = needed -> false)
  on Is. [Show Proof]



Extensible_Theorem
  endKnownClauses_all_mem : forall Known FC CU ID U,
    CFC : checkFinalClauses Known FC ->
    EKC : endKnownClauses FC CU ->
    Mem : mem (ID, U) CU ->
    exists C, mem (ID, C) Known
  on EKC. [Show Proof]



Extensible_Theorem
  endKnownClauses_good_used_list : forall Known FC CU,
    IsFC : is_finalClauses FC ->
    IsKnown : is_list (is_pair is_integer is_clause) Known ->
    GCL : good_clause_list Known ->
    CFC : checkFinalClauses Known FC ->
    EKC : endKnownClauses FC CU ->
    good_used_list CU
  on EKC. [Show Proof]



Theorem good_clause_list_double_select : forall K ID CA CB RA RB,
  is_list (is_pair is_integer is_clause) K -> good_clause_list K ->
  select (ID, CA) RA K -> select (ID, CB) RB K -> CA = CB /\ RA = RB. [Show Proof]



Theorem remove_all_unique : forall K ID RA RB,
  remove_all K ID RA -> remove_all K ID RB -> RA = RB. [Show Proof]



Theorem good_clause_list_selects : forall L X CA CB LA LB,
  good_clause_list L -> select (X, CA) LA L -> select (X, CB) LB L ->
  LA = LB /\ CA = CB. [Show Proof]



Theorem mem_needed_is : forall L I,
  is_list (is_pair is_integer is_clauseUsedness) L -> mem I L ->
  is_pair is_integer is_clauseUsedness I. [Show Proof]



Extensible_Theorem
  elaboration_all_mem : forall Known P CU E ID U,
    IsP : is_proof P ->
    GCL : good_clause_list Known ->
    IsKnown : is_list (is_pair is_integer is_clause) Known ->
    CP : checkProof Known P ->
    Ela : elaborate Known P CU E ->
    Mem : mem (ID, U) CU ->
    exists C, mem (ID, C) Known
  on Ela,
  elaboration_good_used_list : forall Known P CU E,
    IsP : is_proof P ->
    IsKnown : is_list (is_pair is_integer is_clause) Known ->
    GCL : good_clause_list Known ->
    CP : checkProof Known P ->
    Ela : elaborate Known P CU E ->
    good_used_list CU
  on Ela. [Show Proof]



Theorem select_mem_or[A] : forall (A B : A) K KRest,
  select A KRest K -> mem B K -> B = A \/ mem B KRest. [Show Proof]



Theorem remove_all_exists : forall K ID,
  is_list (is_pair is_integer is_clause) K -> is_integer ID ->
  exists KR, remove_all K ID KR. [Show Proof]



Theorem permutation_transitive_clauses : forall A B C,
  is_list (is_pair is_integer is_clause) A ->
  is_list (is_pair is_integer is_clause) B ->
  is_list (is_pair is_integer is_clause) C ->
  permutation A B -> permutation B C -> permutation A C. [Show Proof]



Extensible_Theorem
  checkFinalClauses_perm_help : forall A B FC,
    IsFC : is_finalClauses FC ->
    IsA : is_list (is_pair is_integer is_clause) A ->
    IsB : is_list (is_pair is_integer is_clause) B ->
    CFCA : checkFinalClauses A FC ->
    CFCB : checkFinalClauses B FC ->
    exists L, permutation L A /\ permutation L B
  on CFCA. [Show Proof]



Theorem checkFinalClauses_perm : forall A B FC,
  is_finalClauses FC -> is_list (is_pair is_integer is_clause) A ->
  is_list (is_pair is_integer is_clause) B ->
  checkFinalClauses A FC -> checkFinalClauses B FC ->
  permutation A B. [Show Proof]



Define hasNeeded : list (pair integer clause) ->
                   list (pair integer clauseUsedness) ->
                   list (pair integer clause) -> prop by
  hasNeeded K CU N :=
    (forall ID, mem (ID, needed) CU -> exists C, mem (ID, C) N) /\
    (forall ID CN CK, mem (ID, CN) N -> mem (ID, CK) K -> CN = CK).


Theorem hasNeeded_mem : forall K CU N ID,
  hasNeeded K CU N -> mem (ID, needed) CU ->
  exists C, mem (ID, C) N. [Show Proof]



Theorem hasNeeded_lookup : forall K CU N ID C,
  is_list (is_pair is_integer is_clause) K -> good_clause_list K ->
  is_list (is_pair is_integer is_clause) N -> good_clause_list N ->
  good_used_list CU -> hasNeeded K CU N -> lookup K ID C ->
  mem (ID, needed) CU -> lookup N ID C. [Show Proof]



Theorem hasNeeded_drop : forall K ID U CU N,
  hasNeeded K ((ID, U)::CU) N -> hasNeeded K CU N. [Show Proof]



Theorem rupProof_help_hasNeeded : forall K A Prf Needed Updated KN,
  is_list (is_pair is_integer is_clause) K -> good_clause_list K ->
  good_used_list Needed ->
  is_list (is_pair is_integer is_clause) KN -> good_clause_list KN ->
  rupProof_help K A Prf ->
  makeUsed Needed Prf Updated -> hasNeeded K Updated KN ->
  rupProof_help KN A Prf. [Show Proof]



Theorem rupProof_hasNeeded : forall K C Prf Needed Updated KN,
  is_list (is_pair is_integer is_clause) K -> good_clause_list K ->
  good_used_list Needed ->
  is_list (is_pair is_integer is_clause) KN -> good_clause_list KN ->
  rupProof K C Prf ->
  makeUsed Needed Prf Updated -> hasNeeded K Updated KN ->
  rupProof KN C Prf. [Show Proof]



Theorem hasNeeded_select_known : forall K CU N ID C KRest,
  hasNeeded K ((ID, unknown)::CU) N -> select (ID, C) KRest K ->
  good_used_list ((ID, unknown)::CU) ->
  hasNeeded KRest CU N. [Show Proof]



Theorem good_used_list_mems : forall L X UA UB,
  good_used_list L -> mem (X, UA) L -> mem (X, UB) L -> UA = UB. [Show Proof]



Extensible_Theorem
  elaboration_check_add : forall KA KB KC P CU E,
    IsP : is_proof P ->
    IsKA : is_list (is_pair is_integer is_clause) KA ->
    IsKB : is_list (is_pair is_integer is_clause) KB ->
    IsKC : is_list (is_pair is_integer is_clause) KC ->
    GCLA : good_clause_list KA ->
    GCLB : good_clause_list KB ->
    GCLC : good_clause_list KC ->
    Ela : elaborate KA P CU E ->
    CP : checkProof KB E ->
    Mems : (forall ID C, mem (ID, C) KB -> mem (ID, C) KC) ->
    checkProof KC E
  on Ela. [Show Proof]



Extensible_Theorem
   elaboration_valid : forall Known P CU E Needed,
     IsP : is_proof P ->
     IsKnown : is_list (is_pair is_integer is_clause) Known ->
     IsNeeded : is_list (is_pair is_integer is_clause) Needed ->
     GCL : good_clause_list Known ->
     GCL_N : good_clause_list Needed ->
     CP : checkProof Known P ->
     Ela : elaborate Known P CU E ->
     HN : hasNeeded Known CU Needed ->
     checkProof Needed E
   on Ela. [Show Proof]



Theorem full_elaboration_valid : forall F P P',
  is_formula F -> is_proof P -> proveFormula F P ->
  fullElaborate F P P' -> proveFormula F P'. [Show Proof]



Extensible_Theorem
  elaborationFrat_all_mem : forall Clauses Known P CU E ID U,
    IsP : is_fratProof P ->
    GCL : good_clause_list Known ->
    IsKnown : is_list (is_pair is_integer is_clause) Known ->
    GCLC : good_clause_list Clauses ->
    IsClauses : is_list (is_pair is_integer is_clause) Clauses ->
    CP : checkFratProof Clauses Known P ->
    Ela : elaborateFratProof Clauses Known P CU E ->
    NoMem : (forall ID CK CC, mem (ID, CK) Known ->
                              mem (ID, CC) Clauses -> false) ->
    Mem : mem (ID, U) CU ->
    exists C, mem (ID, C) Known
  on Ela,
  elaborationFrat_good_used_list : forall Clauses Known P CU E,
    IsP : is_fratProof P ->
    GCL : good_clause_list Known ->
    IsKnown : is_list (is_pair is_integer is_clause) Known ->
    GCLC : good_clause_list Clauses ->
    IsClauses : is_list (is_pair is_integer is_clause) Clauses ->
    CP : checkFratProof Clauses Known P ->
    Ela : elaborateFratProof Clauses Known P CU E ->
    NoMem : (forall ID CK CC, mem (ID, CK) Known ->
                              mem (ID, CC) Clauses -> false) ->
    good_used_list CU
  on Ela. [Show Proof]



Extensible_Theorem
  elaborationFrat_valid : forall Clauses Known P CU E Needed Clauses',
    IsP : is_fratProof P ->
    IsClauses : is_list (is_pair is_integer is_clause) Clauses ->
    IsKnown : is_list (is_pair is_integer is_clause) Known ->
    IsClauses' : is_list (is_pair is_integer is_clause) Clauses' ->
    IsNeeded : is_list (is_pair is_integer is_clause) Needed ->
    GCL_C : good_clause_list Clauses ->
    GCL : good_clause_list Known ->
    GCL_C' : good_clause_list Clauses' ->
    GCL_N : good_clause_list Needed ->
    CP : checkFratProof Clauses Known P ->
    Ela : elaborateFratProof Clauses Known P CU E ->
    NoMem : (forall ID CK CC, mem (ID, CK) Known ->
                              mem (ID, CC) Clauses -> false) ->
    NoMemN : (forall ID CK CC, mem (ID, CK) Needed ->
                               mem (ID, CC) Clauses -> false) ->
    MemsC : (forall ID C, mem (ID, C) Clauses ->
                          mem (ID, C) Clauses') ->
    HN : hasNeeded Known CU Needed ->
    checkFratProof Clauses' Needed E
  on Ela. [Show Proof]



Theorem full_elaborationFrat_valid : forall F P P',
  is_formula F -> is_fratProof P -> fratProveFormula F P ->
  fullElaborateFrat F P P' -> fratProveFormula F P'. [Show Proof]


Back to example home