Jump to content

C-minimal theory

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 116.68.83.156 (talk) at 18:59, 17 October 2010 (Example). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In model theory, a branch of mathematical logic, a C-minimal theory is a theory that is "minimal" with respect to a ternary relation C with certain properties. Algebraically closed fields with a (Krull) valuation are perhaps the most important example.

This notion was defined in analogy to the o-minimal theories, which are "minimal" (in the same sense) with respect to a linear order.

Definition

A C-relation is a ternary relation C(x;yz) that satisfies the following axioms.

A C-minimal structure is a structure M, in a signature containing the symbol C, such that C satisfies the above axioms and every set of elements of M that is definable with parameters in M is a Boolean combination of instances of C, i.e. of formulas of the form C(x;bc), where b and c are elements of M.

A theory is called C-minimal if all of its models are C-minimal. A structure is called strongly C-minimal if its theory is C-minimal. One can construct C-minimal structures which are not strongly C-minimal.

Example

For a prime number p and a p-adic number a let |a|p denote its p-adic norm. Then the relation defined by is a C-relation, and the theory of Qp is with addition and this relation is C-minimal. The theory of Qp as a field, however, is not C-minimal. UserInterface code:----

package gui;

import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException;

import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JTextField; import javax.swing.WindowConstants;

import filehandler.FileManager;

public class UserInterface {

private JFrame p_frame;
private JLabel inp_label;
private JLabel out_label;
private JButton inp_button;
private JButton out_button;
private JTextField inp_text;
private JTextField out_text;
private JButton file_process;
private JProgressBar progressBar;
private JFileChooser filechooser;
private JFileChooser dirchooser;
private JComboBox sort_order;
private File fileobj;
private String dirpath;
public UserInterface()
{
 p_frame=new JFrame();
 inp_button=new JButton("Browse");
 out_button=new JButton("Browse");
 inp_label=new JLabel("Input");
 out_label=new JLabel("Output");
 inp_text=new JTextField(20);
 out_text=new JTextField(20);
 file_process=new JButton("Process");
 progressBar=new JProgressBar(0,10);
 filechooser=new JFileChooser();
 dirchooser=new JFileChooser();
 sort_order=new JComboBox();
}
public void PopulateComp()
{
 inp_button.addActionListener(new ActionListener() {
  
  @Override
  public void actionPerformed(ActionEvent e)
  {
   int state=filechooser.showOpenDialog(p_frame);
   if(state==JFileChooser.APPROVE_OPTION)
   {
    fileobj=filechooser.getSelectedFile();
   inp_text.setText(fileobj.getAbsolutePath());
   }
   }
 });
 out_button.addActionListener(new ActionListener(){
  @Override
  public void actionPerformed(ActionEvent e) {
   // TODO Auto-generated method stub
   dirchooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   int state=dirchooser.showOpenDialog(p_frame);
   if(state==JFileChooser.APPROVE_OPTION)
   {
    File dirobj=dirchooser.getSelectedFile();
    dirpath=dirobj.getAbsolutePath();
    out_text.setText(dirpath);
    
   }
  }
  
 });
 sort_order.addItem("Ascending");
 sort_order.addItem("Descending");
 sort_order.setSelectedIndex(0);
 file_process.addActionListener(new Process_ButList());
 JPanel inp_panel=new JPanel();
 LayoutManager inner_layout1=new BoxLayout(inp_panel, BoxLayout.X_AXIS);
 inp_panel.setLayout(inner_layout1);
 inp_panel.add(inp_label);
 inp_panel.add(inp_text);
 inp_panel.add(inp_button);
 JPanel out_panel=new JPanel();
 
 LayoutManager inner_layout2=new BoxLayout(out_panel, BoxLayout.X_AXIS);
 out_panel.setLayout(inner_layout2);
 out_panel.add(out_label);
 out_panel.add(out_text);
 out_panel.add(out_button);
 JPanel sort_panel=new JPanel();
 sort_panel.add(new JLabel("Sort Order"));
 sort_panel.add(sort_order);
 JPanel hv_panel=new JPanel();
 LayoutManager outer_layout=new BoxLayout(hv_panel, BoxLayout.Y_AXIS);
 hv_panel.setLayout(outer_layout);
 hv_panel.add(inp_panel);
 hv_panel.add(out_panel);
 hv_panel.add(sort_panel);
 hv_panel.add(file_process);
 
 hv_panel.add(progressBar);
 //inp_panel.setAlignmentX(2.25f);
 //out_panel.setAlignmentX(2.25f);
 //file_process.setAlignmentX(Component.CENTER_ALIGNMENT);
 p_frame.setContentPane(hv_panel);
 p_frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
 p_frame.pack();
 p_frame.setResizable(false);
 p_frame.setVisible(true);
}

public static void main(String[] args)
{
 UserInterface ui_app=new UserInterface();
 ui_app.PopulateComp();
}
public class Process_ButList implements ActionListener
{
 @Override
 public void actionPerformed(ActionEvent e) {
  // TODO Auto-generated method stub
  if(fileobj!=null)
  {
   FileManager f_manage=new FileManager();
   try {
    f_manage.ReadFile(fileobj);
    f_manage.CreateWriteFile(out_text.getText());
    f_manage.SortInAnyOrder(dirpath,(String)sort_order.getSelectedItem());
   } catch (IOException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
   }
  }
 }
 
}

}

FileManager code:----


package filehandler;

import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream;

import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List;


public class FileManager { List file_contents; List file_names; List file_objects; public FileManager() {

file_contents=new LinkedList();
file_names=new LinkedList();

}

public void ReadFile(File input_file) throws IOException
{
 
 int file_details=0;
 boolean flag=false;
 String file_line="";
 FileInputStream f_input=new FileInputStream(input_file);
 while(file_details!=-1)
 {
  file_details=f_input.read();
  if((char)file_details=='\n')
  {
   file_line=file_line.trim();
   if(file_line!="")
   {
   file_contents.add(file_line);
   }
   file_line="";
  }
  else
  file_line+=(char)file_details;
 
 }
 Iterator file_iter;
 file_iter=file_contents.iterator();
 System.out.println("***********FileContents*************");
 while(file_iter.hasNext())
 {
  String each_line=file_iter.next();
  each_line=each_line.trim();
  String filename=each_line.substring(0,1);
  
  filename=filename.toUpperCase()+filename.toLowerCase()+".txt";
  Iterator file_name_iter=file_names.iterator();
  while(file_name_iter.hasNext())
  {
   String name=file_name_iter.next();
   if(filename.equals(name))
    flag=true;
  }
  if(!flag)
   {file_names.add(filename);}
   flag=false;
   System.out.println(each_line);
 }
 file_iter=file_names.iterator();
 while(file_iter.hasNext())
 {
  System.out.println(file_iter.next());
 }
}
public void CreateWriteFile(String dest) throws IOException
{
 Iterator file_iter;
 file_iter=file_names.iterator();
 while(file_iter.hasNext())
 {
  String f_name=file_iter.next();
  File f_new =new File(dest,f_name);
  f_new.createNewFile();
  PrintWriter f_out=new PrintWriter(new FileWriter(f_new,true),true);
  Iterator file_content_iter=file_contents.iterator();
  
  while(file_content_iter.hasNext())
  {
   String gen_fname;
   String lines=file_content_iter.next();
   gen_fname=lines.substring(0, 1);
   gen_fname=gen_fname.toUpperCase()+gen_fname.toLowerCase()+".txt";
   if(f_name.equals(gen_fname))
   {
    System.out.println(lines);
    f_out.println(lines);
   }
   
  }
  
 }
 //ext_out.print("Jacob");
}
public void SortInAnyOrder(String dirpath,String order) throws IOException
{
 Iterator f_names=file_names.iterator();
 
 while(f_names.hasNext())
 {
  String words="";
  String line="";
  List sep_file_contents=new LinkedList();
  int i=0;
  File file_obj=new File(dirpath,f_names.next());
  
  BufferedReader file_reader=new BufferedReader(new FileReader(file_obj));
  line=file_reader.readLine();
  while(line!=null)
  {
  System.out.println(line);
  line=line.trim();
  char[] clines=line.toCharArray();
  i=0;
  words="";
  while(i!=clines.length)
  {
   
   if(clines[i]==' ')
   {
    while(clines[i+1]==' ')
    i++;
   
    sep_file_contents.add(words);
    words="";
   }
   else
    words+=clines[i];
   i++;
  }
  sep_file_contents.add(words);
  line=file_reader.readLine();
  }
  if(order.equalsIgnoreCase("Ascending"))
  Collections.sort(sep_file_contents);
  else
   Collections.sort(sep_file_contents,Collections.reverseOrder());
  PrintWriter f_out=new PrintWriter(new FileWriter(file_obj),true);
  Iterator sort_iter=sep_file_contents.iterator();
  while(sort_iter.hasNext())
  {
   f_out.println(sort_iter.next());
  }
 }
}

}

References

  • Macpherson, Dugald; Steinhorn, Charles (1996), "On variants of o-minimality", Annals of Pure and Applied Logic, 79: 165–209, doi:10.1016/0168-0072(95)00037-2
  • Haskell, Deirdre; Macpherson, Dugald (1994), "Cell decompositions of C-minimal structures", Annals of Pure and Applied Logic, 66: 113–162, doi:10.1016/0168-0072(94)90064-7